[Phpfreechat-svn] SF.net SVN: phpfreechat: [946] trunk
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2007-02-09 10:21:26
|
Revision: 946 http://svn.sourceforge.net/phpfreechat/?rev=946&view=rev Author: kerphi Date: 2007-02-09 02:21:22 -0800 (Fri, 09 Feb 2007) Log Message: ----------- Small bug fixes : http://www.phpfreechat.net/forum/viewtopic.php?id=1202 Modified Paths: -------------- trunk/data/public/js/pfcgui.js trunk/src/commands/ban.class.php trunk/src/commands/kick.class.php trunk/src/containers/mysql.class.php Modified: trunk/data/public/js/pfcgui.js =================================================================== --- trunk/data/public/js/pfcgui.js 2007-02-08 17:48:08 UTC (rev 945) +++ trunk/data/public/js/pfcgui.js 2007-02-09 10:21:22 UTC (rev 946) @@ -409,6 +409,7 @@ img.s_symbol = s_symbol.unescapeHTML(); img.onclick = function(){ pfc.insertSmiley(this.s_symbol); } container.appendChild(img); + container.appendChild(document.createTextNode(' ')); // so smileys will wrap fine if lot of smiles in theme. } }, Modified: trunk/src/commands/ban.class.php =================================================================== --- trunk/src/commands/ban.class.php 2007-02-08 17:48:08 UTC (rev 945) +++ trunk/src/commands/ban.class.php 2007-02-09 10:21:22 UTC (rev 946) @@ -18,7 +18,7 @@ $c =& $this->c; $u =& $this->u; - $nick = isset($params[0]) ? trim($params[0]) : ''; + $nick = isset($params[0]) ? $params[0] : ''; $reason = isset($params[1]) ? $params[1] : ''; if ($reason == '') $reason = _pfc("no reason"); $channame = $u->channels[$recipientid]["name"]; Modified: trunk/src/commands/kick.class.php =================================================================== --- trunk/src/commands/kick.class.php 2007-02-08 17:48:08 UTC (rev 945) +++ trunk/src/commands/kick.class.php 2007-02-09 10:21:22 UTC (rev 946) @@ -18,7 +18,7 @@ $c =& $this->c; $u =& $this->u; - $nick = isset($params[0]) ? trim($params[0]) : ''; + $nick = isset($params[0]) ? $params[0] : ''; $reason = isset($params[1]) ? $params[1] : ''; if ($reason == '') $reason = _pfc("no reason"); Modified: trunk/src/containers/mysql.class.php =================================================================== --- trunk/src/containers/mysql.class.php 2007-02-08 17:48:08 UTC (rev 945) +++ trunk/src/containers/mysql.class.php 2007-02-09 10:21:22 UTC (rev 946) @@ -38,6 +38,16 @@ * $params["container_cfg_mysql_table"] = "phpfreechat"; * $params["container_cfg_mysql_username"] = "root"; * $params["container_cfg_mysql_password"] = ""; + * + * Advanced parameters are : + * $params["container_cfg_mysql_fieldtype_server"] = 'varchar(32)'; + * $params["container_cfg_mysql_fieldtype_group"] = 'varchar(64)'; + * $params["container_cfg_mysql_fieldtype_subgroup"] = 'varchar(64)'; + * $params["container_cfg_mysql_fieldtype_leaf"] = 'varchar(64)'; + * $params["container_cfg_mysql_fieldtype_leafvalue"] = 'text'; + * $params["container_cfg_mysql_fieldtype_timestamp"] = 'int(11)'; + * $params["container_cfg_mysql_engine"] = 'InnoDB'; + * * * @author Stephane Gully <ste...@gm...> * @author HenkBB @@ -47,14 +57,15 @@ var $_db = null; var $_sql_create_table = " CREATE TABLE IF NOT EXISTS `%table%` ( - `server` varchar(256) NOT NULL default '', - `group` varchar(256) NOT NULL default '', - `subgroup` varchar(256) NOT NULL default '', - `leaf` varchar(256) NOT NULL default '', - `leafvalue` varchar(1024) NOT NULL, - `timestamp` int(11) NOT NULL default 0, - PRIMARY KEY (`server`,`group`,`subgroup`,`leaf`) -) ENGINE=MEMORY;"; + `server` %fieldtype_server% NOT NULL default '', + `group` %fieldtype_group% NOT NULL default '', + `subgroup` %fieldtype_subgroup% NOT NULL default '', + `leaf` %fieldtype_leaf% NOT NULL default '', + `leafvalue` %fieldtype_leafvalue% NOT NULL, + `timestamp` %fieldtype_timestamp% NOT NULL default 0, + PRIMARY KEY (`server`,`group`,`subgroup`,`leaf`), + INDEX (`server`,`group`,`subgroup`,`timestamp`) +) ENGINE=%engine%;"; function pfcContainer_Mysql(&$config) { @@ -71,6 +82,14 @@ $cfg["mysql_table"] = 'phpfreechat'; $cfg["mysql_username"] = 'root'; $cfg["mysql_password"] = ''; + // advanced parameters (don't touch if you don't know what your are doing) + $cfg["mysql_fieldtype_server"] = 'varchar(32)'; + $cfg["mysql_fieldtype_group"] = 'varchar(64)'; + $cfg["mysql_fieldtype_subgroup"] = 'varchar(64)'; + $cfg["mysql_fieldtype_leaf"] = 'varchar(128)'; + $cfg["mysql_fieldtype_leafvalue"] = 'text'; + $cfg["mysql_fieldtype_timestamp"] = 'int(11)'; + $cfg["mysql_engine"] = 'InnoDB'; return $cfg; } @@ -105,7 +124,15 @@ } // create the table if it doesn't exists - $query = str_replace('%table%',$c->container_cfg_mysql_table,$this->_sql_create_table); + $query = $this->_sql_create_table; + $query = str_replace('%engine%', $c->container_cfg_mysql_engine,$query); + $query = str_replace('%table%', $c->container_cfg_mysql_table,$query); + $query = str_replace('%fieldtype_server%', $c->container_cfg_mysql_fieldtype_server,$query); + $query = str_replace('%fieldtype_group%', $c->container_cfg_mysql_fieldtype_group,$query); + $query = str_replace('%fieldtype_subgroup%', $c->container_cfg_mysql_fieldtype_subgroup,$query); + $query = str_replace('%fieldtype_leaf%', $c->container_cfg_mysql_fieldtype_leaf,$query); + $query = str_replace('%fieldtype_leafvalue%', $c->container_cfg_mysql_fieldtype_leafvalue,$query); + $query = str_replace('%fieldtype_timestamp%', $c->container_cfg_mysql_fieldtype_timestamp,$query); $result = mysql_query($query, $db); if ($result === FALSE) { @@ -180,29 +207,33 @@ $server = $c->serverid; $db = $this->_connect(); - $sql_where=""; - $value="leafvalue"; + $sql_where = ""; + $sql_group_by = ""; + $value = "leafvalue"; if ($group != NULL) { - $sql_where.=" AND `group`='$group'"; - $value="subgroup"; + $sql_where .= " AND `group`='$group'"; + $value = "subgroup"; + $sql_group_by = "GROUP BY `$value`"; } if ($subgroup != NULL) { - $sql_where.=" AND `subgroup`='$subgroup'"; - $value="leaf"; + $sql_where .= " AND `subgroup`='$subgroup'"; + $value = "leaf"; + $sql_group_by = ""; } if ($leaf != NULL) { - $sql_where.=" AND `leaf`='$leaf'"; - $value="leafvalue"; + $sql_where .= " AND `leaf`='$leaf'"; + $value = "leafvalue"; + $sql_group_by = ""; } - $sql_select="SELECT `$value`, `timestamp` FROM ".$c->container_cfg_mysql_table." WHERE `server`='$server' $sql_where GROUP BY `$value` ORDER BY timestamp"; - + $sql_select="SELECT `$value`, `timestamp` FROM ".$c->container_cfg_mysql_table." WHERE `server`='$server' $sql_where $sql_group_by ORDER BY timestamp"; + if ($c->debug) file_put_contents("/tmp/debug.txt", "\ngetSQL(".$sql_select.")", FILE_APPEND); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |