phpfreechat-svn Mailing List for phpFreeChat (Page 26)
Status: Beta
Brought to you by:
kerphi
You can subscribe to this list here.
2006 |
Jan
|
Feb
(2) |
Mar
|
Apr
(61) |
May
(56) |
Jun
(96) |
Jul
(23) |
Aug
(62) |
Sep
(76) |
Oct
(48) |
Nov
(28) |
Dec
(28) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(31) |
Feb
(40) |
Mar
(29) |
Apr
(11) |
May
(6) |
Jun
(18) |
Jul
(18) |
Aug
(108) |
Sep
(24) |
Oct
(6) |
Nov
(21) |
Dec
|
2008 |
Jan
|
Feb
(1) |
Mar
(16) |
Apr
|
May
(3) |
Jun
|
Jul
(7) |
Aug
(1) |
Sep
(3) |
Oct
|
Nov
(3) |
Dec
(2) |
2009 |
Jan
(2) |
Feb
|
Mar
(2) |
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
(1) |
2010 |
Jan
(2) |
Feb
|
Mar
|
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2018 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ke...@us...> - 2006-07-04 15:54:48
|
Revision: 642 Author: kerphi Date: 2006-07-04 08:54:40 -0700 (Tue, 04 Jul 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=642&view=rev Log Message: ----------- Now a timeout parameter is used to identify if a user is online or offline Modified Paths: -------------- trunk/src/pfcinfo.class.php Modified: trunk/src/pfcinfo.class.php =================================================================== --- trunk/src/pfcinfo.class.php 2006-07-04 15:33:50 UTC (rev 641) +++ trunk/src/pfcinfo.class.php 2006-07-04 15:54:40 UTC (rev 642) @@ -36,16 +36,23 @@ } /** + * @param $channel the returned list is the list of nicknames present on the given channel (NULL for the whole server) + * @param $timeout is the time to wait before a nickname is considered offline * @return array(string) a list of online nicknames */ - function getOnlineNick($channel = NULL) + function getOnlineNick($channel = NULL, $timeout = 20) { $container =& $this->getContainerInstance(); $res = $container->getOnlineNick($channel); $users = array(); if (isset($res["nickid"])) - foreach($res["nickid"] as $nickid) - $users[] = $container->getNickname($nickid); + { + for($i = 0; $i < count($res["nickid"]); $i++) + { + if (time()-$timeout < $res["timestamp"][$i]) + $users[] = $container->getNickname($res["nickid"][$i]); + } + } return $users; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-07-04 15:34:08
|
Revision: 641 Author: kerphi Date: 2006-07-04 08:33:50 -0700 (Tue, 04 Jul 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=641&view=rev Log Message: ----------- Finish the work on the API used to query the chat infos from external scripts Modified Paths: -------------- trunk/demo/demo32_show_last_messages-chat.php trunk/demo/demo32_show_last_messages-config.php trunk/demo/demo32_show_last_messages-showlastmsg.php trunk/src/pfcglobalconfig.class.php trunk/src/pfcinfo.class.php Modified: trunk/demo/demo32_show_last_messages-chat.php =================================================================== --- trunk/demo/demo32_show_last_messages-chat.php 2006-07-03 16:43:41 UTC (rev 640) +++ trunk/demo/demo32_show_last_messages-chat.php 2006-07-04 15:33:50 UTC (rev 641) @@ -1,10 +1,8 @@ <?php require_once dirname(__FILE__)."/../src/phpfreechat.class.php"; -$params["serverid"] = md5("Show last messages demo"); // calculate a unique id for this chat -$params["title"] = "Show last posted messages channel"; -//$params["max_msg"] = 1; -$chat = new phpFreeChat($params); +require_once dirname(__FILE__)."/demo32_show_last_messages-config.php"; +$chat = new phpFreeChat($pfc_config); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> @@ -40,4 +38,4 @@ ?> </body> -</html> +</html> \ No newline at end of file Modified: trunk/demo/demo32_show_last_messages-config.php =================================================================== --- trunk/demo/demo32_show_last_messages-config.php 2006-07-03 16:43:41 UTC (rev 640) +++ trunk/demo/demo32_show_last_messages-config.php 2006-07-04 15:33:50 UTC (rev 641) @@ -4,7 +4,7 @@ $params["title"] = "Show last posted messages channel"; $params["serverid"] = md5($params["title"]); // calculate a unique id for this chat $params["max_msg"] = 20; -$params["channels"] = "channel1"; +$params["channels"] = array("channel1"); $pfc_config =& pfcGlobalConfig::Instance( $params ); ?> \ No newline at end of file Modified: trunk/demo/demo32_show_last_messages-showlastmsg.php =================================================================== --- trunk/demo/demo32_show_last_messages-showlastmsg.php 2006-07-03 16:43:41 UTC (rev 640) +++ trunk/demo/demo32_show_last_messages-showlastmsg.php 2006-07-04 15:33:50 UTC (rev 641) @@ -1,27 +1,32 @@ <?php require_once dirname(__FILE__)."/../src/pfcinfo.class.php"; -$info = new pfcInfo( md5("Show last posted messages channel") ); -$lastmsg_raw = $info->getLastMsg("channel1", 10); -print_r($lastmsg_raw); +$pfcinfo = new pfcInfo( md5("Show last posted messages channel") ); +$errors = $pfcinfo->getErrors(); +if (count($errors)) +{ + foreach($errors as $e) + echo $e; +} +$lastmsg_raw = $pfcinfo->getLastMsg("channel1", 10); -echo "<h1>A demo which explains how to get the last posted messages</h1>"; +echo "<h1>A demo which explains how to get the last posted messages on a given channel</h1>"; echo '<div style="margin: auto; width: 70%; border: 1px solid red; background-color: #FDD; padding: 1em;">'; -$nbmsg = count($lastmsg_raw["messages"]); -$info = "<strong>%d</strong> last messages on <strong>'%s'</strong> channel are:"; -echo "<p>".sprintf($info, $nbmsg, "")."</p>"; +$nbmsg = count($lastmsg_raw["data"]); +$info = "<strong>%d</strong> last messages on <strong>'%s'</strong> are:"; +echo "<p>".sprintf($info, $nbmsg, "channel1")."</p>"; $bg = 1; echo '<table style="margin: auto; width: 70%; border: 1px solid red; background-color: #FEE;">'; // format messages to a readable string // be carreful ! this format will change in future -foreach($lastmsg_raw["messages"] as $m) +foreach($lastmsg_raw["data"] as $m) { - echo '<tr style="background-color: '.($bg == 1 ? "#FFE;" : "#EEF;").'">'; - echo '<td>'.$m[2].'</td>'; - echo '<td style="color:#F75; text-align: right;">'.$m[3].'</td>'; - echo "<td>".$m[4]."</td>"; + echo '<tr style="background-color:'.($bg == 1 ? "#FFE;" : "#EEF;").'">'; + echo '<td style="width:100px;">'.$m["date"].'</td>'; + echo '<td style="width:80px;color:#F55;text-align:right;font-weight:bold;">'.$m["sender"].'</td>'; + echo '<td>'.$m["param"].'</td>'; echo "</tr>"; if ($bg == 1) $bg = 2; Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-07-03 16:43:41 UTC (rev 640) +++ trunk/src/pfcglobalconfig.class.php 2006-07-04 15:33:50 UTC (rev 641) @@ -103,6 +103,21 @@ // setup the local for translated messages pfcI18N::Init(isset($params["language"]) ? $params["language"] : ""); + // check the serverid is really defined + if (!isset($params["serverid"])) + $this->errors[] = _pfc("'%s' parameter is mandatory by default use '%s' value", "serverid", "md5(__FILE__)"); + $this->serverid = $params["serverid"]; + + // _getCacheFile needs data_private_path + if (!isset($params["data_private_path"])) + $this->data_private_path = dirname(__FILE__)."/../data/private"; + else + $this->data_private_path = $params["data_private_path"]; + if (!isset($params["data_public_path"])) + $this->data_public_path = dirname(__FILE__)."/../data/public"; + else + $this->data_public_path = $params["data_public_path"]; + // check if a cached configuration allready exists // don't load parameters if the cache exists $cachefile = $this->_getCacheFile(); @@ -136,9 +151,6 @@ else $this->$k = $v; } - - if ($this->data_private_path == "") $this->data_private_path = dirname(__FILE__)."/../data/private"; - if ($this->data_public_path == "") $this->data_public_path = dirname(__FILE__)."/../data/public"; } // now load or save the configuration in the cache @@ -325,10 +337,6 @@ // load debug url $this->debugurl = relativePath($this->client_script_path, dirname(__FILE__)."/../debug"); - // check the serverid is really defined - if ($this->serverid == "") - $this->errors[] = _pfc("'%s' parameter is mandatory by default use '%s' value", "serverid", "md5(__FILE__)"); - // check if channels parameter is a strings array if (!is_array($this->channels)) $this->errors[] = _pfc("'%s' parameter must be an array", "channels"); @@ -414,9 +422,11 @@ return $this->serverid; } - function _getCacheFile() + function _getCacheFile($serverid = "", $data_private_path = "") { - return $this->data_private_path."/cache/pfcglobalconfig_".$this->getId(); + if ($serverid == "") $serverid = $this->getId(); + if ($data_private_path == "") $data_private_path = $this->data_private_path; + return $data_private_path."/cache/pfcglobalconfig_".$serverid; } function destroyCache() Modified: trunk/src/pfcinfo.class.php =================================================================== --- trunk/src/pfcinfo.class.php 2006-07-03 16:43:41 UTC (rev 640) +++ trunk/src/pfcinfo.class.php 2006-07-04 15:33:50 UTC (rev 641) @@ -1,20 +1,41 @@ <?php require_once dirname(__FILE__)."/pfcglobalconfig.class.php"; +require_once dirname(__FILE__)."/pfci18n.class.php"; +require_once dirname(__FILE__)."/commands/join.class.php"; class pfcInfo extends pfcGlobalConfig { var $container; + var $errors = array(); - function pfcInfo( $serverid ) + function pfcInfo( $serverid, $data_private_path = "" ) { - $cachefile = dirname(__FILE__)."/../data/private/cache/pfcglobalconfig_".$serverid; - $pfc_configvar = unserialize(file_get_contents($cachefile)); - foreach($pfc_configvar as $key => $val) - $this->$key = $val; + // check if the cache allready exists + // if it doesn't exists, just stop the process + // because we can't initialize the chat from the external API + if ($data_private_path == "") $data_private_path = dirname(__FILE__)."/../data/private"; + $cachefile = $this->_getCacheFile( $serverid, $data_private_path ); + if (!file_exists($cachefile)) + { + $this->errors[] = _pfc("Error: the cached config file doesn't exists"); + return; + } + // then intitialize the pfcglobalconfig + $params["serverid"] = $serverid; + $params["data_private_path"] = $data_private_path; + pfcGlobalConfig::pfcGlobalConfig($params); } - + /** + * @return array(string) a list of errors + */ + function getErrors() + { + return $this->errors; + } + + /** * @return array(string) a list of online nicknames */ function getOnlineNick($channel = NULL) @@ -30,13 +51,15 @@ function getLastMsg($channel, $nb) { - $container =& $this->getContainerInstance(); + // to get the channel recipient name + // @todo must use another function to get a private message last messages + $channel = pfcCommand_join::GetRecipient($channel); + + $container =& $this->getContainerInstance(); $lastmsg_id = $container->getLastId($channel); - echo $lastmsg_id; - die(); $lastmsg_raw = $container->read($channel, $lastmsg_id-10); return $lastmsg_raw; } } -?> +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-07-03 16:43:51
|
Revision: 640 Author: kerphi Date: 2006-07-03 09:43:41 -0700 (Mon, 03 Jul 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=640&view=rev Log Message: ----------- Optimization: don't initialize parameters when the cache file exists. Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-07-03 15:10:54 UTC (rev 639) +++ trunk/src/pfcglobalconfig.class.php 2006-07-03 16:43:41 UTC (rev 640) @@ -103,31 +103,45 @@ // setup the local for translated messages pfcI18N::Init(isset($params["language"]) ? $params["language"] : ""); - // load users container or keep default one - if (isset($params["container_type"])) - $this->container_type = $params["container_type"]; - - // load default container's config - $container =& $this->getContainerInstance(); - $container_cfg = $container->getDefaultConfig(); - foreach( $container_cfg as $k => $v ) + // check if a cached configuration allready exists + // don't load parameters if the cache exists + $cachefile = $this->_getCacheFile(); + if (!file_exists($cachefile)) { - $attr = "container_cfg_".$k; - if (!isset($this->$attr)) - $this->$attr = $v; - } + // load users container or keep default one + if (isset($params["container_type"])) + $this->container_type = $params["container_type"]; + + // load default container's config + $container =& $this->getContainerInstance(); + $container_cfg = $container->getDefaultConfig(); + foreach( $container_cfg as $k => $v ) + { + $attr = "container_cfg_".$k; + if (!isset($this->$attr)) + $this->$attr = $v; + } + + // load all user's parameters which will override default ones + foreach ( $params as $k => $v ) + { + if (!isset($this->$k)) + $this->errors[] = _pfc("Error: undefined or obsolete parameter '%s', please correct or remove this parameter", $k); + if ($k == "proxys_cfg") + { + // don't replace all the proxy_cfg parameters, just replace the specified ones + foreach ( $params["proxys_cfg"] as $k2 => $v2 ) + $this->proxys_cfg[$k2] = $v2; + } + else + $this->$k = $v; + } - // load all user's parameters which will override default ones - foreach ( $params as $k => $v ) - { - if (!isset($this->$k)) - $this->errors[] = _pfc("Error: undefined or obsolete parameter '%s', please correct or remove this parameter", $k); - $this->$k = $v; + if ($this->data_private_path == "") $this->data_private_path = dirname(__FILE__)."/../data/private"; + if ($this->data_public_path == "") $this->data_public_path = dirname(__FILE__)."/../data/public"; } - if ($this->data_private_path == "") $this->data_private_path = dirname(__FILE__)."/../data/private"; - if ($this->data_public_path == "") $this->data_public_path = dirname(__FILE__)."/../data/public"; - + // now load or save the configuration in the cache $this->synchronizeWithCache(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-07-03 15:12:04
|
Revision: 639 Author: kerphi Date: 2006-07-03 08:10:54 -0700 (Mon, 03 Jul 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=639&view=rev Log Message: ----------- Bug fix: if the user is not present on the channel, call the createNick function in order to update the user metadata which are maybe nonexistent (no more ghost users). Modified Paths: -------------- trunk/src/commands/updatemynick.class.php Modified: trunk/src/commands/updatemynick.class.php =================================================================== --- trunk/src/commands/updatemynick.class.php 2006-07-03 13:20:40 UTC (rev 638) +++ trunk/src/commands/updatemynick.class.php 2006-07-03 15:10:54 UTC (rev 639) @@ -10,10 +10,13 @@ $u =& $this->u; $container =& $c->getContainerInstance(); - $was_there = $container->updateNick($recipient, $u->nick); if (!$was_there) { + // if the user were not in the list, it must be created in order to refresh his metadata + // because when the user is timeouted, his metadata are destroyed. + $container->createNick($recipient, $u->nick, $u->nickid); + /* @todo: write the timeout adjustment when the user object will be available if ($c->debug) pxlog("Cmd_updateMyNick[".$c->sessionid."]: nick ".$u->nick." updated but was not there, adjust timeout to ".$c->timeout, "chat", $c->getId()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-07-03 13:21:03
|
Revision: 638 Author: kerphi Date: 2006-07-03 06:20:40 -0700 (Mon, 03 Jul 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=638&view=rev Log Message: ----------- typo Modified Paths: -------------- trunk/src/pfctools.php Modified: trunk/src/pfctools.php =================================================================== --- trunk/src/pfctools.php 2006-07-03 13:17:20 UTC (rev 637) +++ trunk/src/pfctools.php 2006-07-03 13:20:40 UTC (rev 638) @@ -119,14 +119,13 @@ function rm_r($dir) { - $dir = realpath($dir); if(!$dh = @opendir($dir)) return; while (($obj = readdir($dh))) { if($obj=='.' || $obj=='..') continue; if (!@unlink($dir.'/'.$obj)) rm_r($dir.'/'.$obj); } - rmdir($dir); + @rmdir($dir); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-07-03 13:17:25
|
Revision: 637 Author: kerphi Date: 2006-07-03 06:17:20 -0700 (Mon, 03 Jul 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=637&view=rev Log Message: ----------- Change the default directory creation rights to 755 in order to allow incorrect configured web servers to access to these directories. Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php trunk/src/pfctools.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-06-30 17:02:35 UTC (rev 636) +++ trunk/src/pfcglobalconfig.class.php 2006-07-03 13:17:20 UTC (rev 637) @@ -210,15 +210,15 @@ $dir2 = $this->data_private_path."/copy_r2"; $file2 = $dir2."/dummy"; // create a dummy directory - mkdir($dir1); + @mkdir($dir1); // check the directory exists if (!file_exists($dir1) || !is_dir($dir1)) $copy_r_ok = false; // create a dummy file - touch($file1); + @touch($file1); // check the file exists if (!file_exists($file1)) $copy_r_ok = false; // copy_r the dummy dir - copy_r($dir1,$dir2); + @copy_r($dir1,$dir2); // check the directory exists if (!file_exists($dir2) || !is_dir($dir2)) $copy_r_ok = false; // check the file exists @@ -228,8 +228,8 @@ // try to remove recursively the directory $rm_r_ok = true; - rm_r($dir2); - rm_r($dir1); + @rm_r($dir2); + @rm_r($dir1); // check the directory doesn't exists if (file_exists($dir1) || file_exists($dir2)) $rm_r_ok = false; // check the file doesn't exists Modified: trunk/src/pfctools.php =================================================================== --- trunk/src/pfctools.php 2006-06-30 17:02:35 UTC (rev 636) +++ trunk/src/pfctools.php 2006-07-03 13:17:20 UTC (rev 637) @@ -119,13 +119,14 @@ function rm_r($dir) { + $dir = realpath($dir); if(!$dh = @opendir($dir)) return; while (($obj = readdir($dh))) { if($obj=='.' || $obj=='..') continue; if (!@unlink($dir.'/'.$obj)) rm_r($dir.'/'.$obj); } - @rmdir($dir); + rmdir($dir); } /** @@ -137,7 +138,7 @@ * @param string $dest Destination path * @return bool Returns TRUE on success, FALSE on failure */ -function copy_r($source, $dest, $modedir = 0700, $modefile = 0644) +function copy_r($source, $dest, $modedir = 0755, $modefile = 0644) { // Simple copy for a file if (is_file($source)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-30 17:04:06
|
Revision: 636 Author: kerphi Date: 2006-06-30 10:02:35 -0700 (Fri, 30 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=636&view=rev Log Message: ----------- Work in progress: create an API to query from external scripts the chat data (who is online, last posted messages) Modified Paths: -------------- trunk/demo/demo31_show_who_is_online-whoisonline.php trunk/demo/demo32_show_last_messages-config.php trunk/demo/demo32_show_last_messages-showlastmsg.php trunk/demo/index.php trunk/src/pfcinfo.class.php Modified: trunk/demo/demo31_show_who_is_online-whoisonline.php =================================================================== --- trunk/demo/demo31_show_who_is_online-whoisonline.php 2006-06-30 16:28:03 UTC (rev 635) +++ trunk/demo/demo31_show_who_is_online-whoisonline.php 2006-06-30 17:02:35 UTC (rev 636) @@ -2,7 +2,9 @@ require_once dirname(__FILE__)."/../src/pfcinfo.class.php"; $info = new pfcInfo( md5("Whois online demo") ); -$users = $info->getOnlineNick(); +// NULL is used to get all the connected users, but you can specify +// a channel name to get only the connected user on a specific channel +$users = $info->getOnlineNick(NULL); echo "<h1>A demo which explains how to get the connected users list</h1>"; @@ -10,10 +12,10 @@ $info = ""; $nb_users = count($users); if ($nb_users <= 1) - $info = "<strong>%d</strong> user is connected to the <strong>'%s'</strong> channel !"; + $info = "<strong>%d</strong> user is connected to the server !"; else - $info = "<strong>%d</strong> users are connected to the <strong>'%s'</strong> channel !"; -echo "<p>".sprintf($info, $nb_users, "")."</p>"; + $info = "<strong>%d</strong> users are connected to the server !"; +echo "<p>".sprintf($info, $nb_users)."</p>"; echo "<p>Here is the nicknames' list:</p>"; echo "<ul>"; Modified: trunk/demo/demo32_show_last_messages-config.php =================================================================== --- trunk/demo/demo32_show_last_messages-config.php 2006-06-30 16:28:03 UTC (rev 635) +++ trunk/demo/demo32_show_last_messages-config.php 2006-06-30 17:02:35 UTC (rev 636) @@ -1,9 +1,10 @@ <?php require_once dirname(__FILE__)."/../src/phpfreechat.class.php"; -$params["serverid"] = md5(__FILE__); // calculate a unique id for this chat $params["title"] = "Show last posted messages channel"; -$params["max_msg"] = 1; +$params["serverid"] = md5($params["title"]); // calculate a unique id for this chat +$params["max_msg"] = 20; +$params["channels"] = "channel1"; $pfc_config =& pfcGlobalConfig::Instance( $params ); -?> +?> \ No newline at end of file Modified: trunk/demo/demo32_show_last_messages-showlastmsg.php =================================================================== --- trunk/demo/demo32_show_last_messages-showlastmsg.php 2006-06-30 16:28:03 UTC (rev 635) +++ trunk/demo/demo32_show_last_messages-showlastmsg.php 2006-06-30 17:02:35 UTC (rev 636) @@ -1,8 +1,9 @@ <?php require_once dirname(__FILE__)."/../src/pfcinfo.class.php"; -$info = new pfcInfo( md5("Show last messages demo") ); -$lastmsg_raw = $info->getLastMsg(10); +$info = new pfcInfo( md5("Show last posted messages channel") ); +$lastmsg_raw = $info->getLastMsg("channel1", 10); +print_r($lastmsg_raw); echo "<h1>A demo which explains how to get the last posted messages</h1>"; Modified: trunk/demo/index.php =================================================================== --- trunk/demo/index.php 2006-06-30 16:28:03 UTC (rev 635) +++ trunk/demo/index.php 2006-06-30 17:02:35 UTC (rev 636) @@ -95,12 +95,12 @@ <li><a href="demo21_with_hardcoded_urls.php">demo21 - with hardcoded url: data_public_url, client_script_url ... (interesting for strange server configuration)</a></li> <li><a href="demo27_customized_command.php">demo27 - a customized command (/roll)</a></li> <li><a href="demo34_add_a_link_on_nicknames.php">demo34 - Shows how to add a link on the nicknames list</a></li> -<!-- + <li><a href="demo31_show_who_is_online-chat.php">demo31 - demo which show how to get the connected users list (chat script)</a></li> <li><a href="demo31_show_who_is_online-whoisonline.php">demo31 - demo which show how to get the connected users list (whoisonline script)</a></li> <li><a href="demo32_show_last_messages-chat.php">demo32 - demo which show how to get the last posted messages (chat script)</a></li> <li><a href="demo32_show_last_messages-showlastmsg.php">demo32 - demo which show how to get the last posted messages (showlastmsg script)</a></li> ---> + <li><a href="demo35_shared_memory.php">demo35 - demo which show how to use the shared memory container</a></li> <li><a href="demo43_change_the_nicknames_colors.php">demo43 - demo which show how to change the nicknames automatic colors</a></li> </ul> Modified: trunk/src/pfcinfo.class.php =================================================================== --- trunk/src/pfcinfo.class.php 2006-06-30 16:28:03 UTC (rev 635) +++ trunk/src/pfcinfo.class.php 2006-06-30 17:02:35 UTC (rev 636) @@ -14,18 +14,27 @@ $this->$key = $val; } - function getOnlineNick() + /** + * @return array(string) a list of online nicknames + */ + function getOnlineNick($channel = NULL) { $container =& $this->getContainerInstance(); - $users = $container->getOnlineNick(); + $res = $container->getOnlineNick($channel); + $users = array(); + if (isset($res["nickid"])) + foreach($res["nickid"] as $nickid) + $users[] = $container->getNickname($nickid); return $users; } - function getLastMsg($nb) + function getLastMsg($channel, $nb) { $container =& $this->getContainerInstance(); - $lastmsg_id = $container->getLastMsgId(); - $lastmsg_raw = $container->readNewMsg($lastmsg_id-10); + $lastmsg_id = $container->getLastId($channel); + echo $lastmsg_id; + die(); + $lastmsg_raw = $container->read($channel, $lastmsg_id-10); return $lastmsg_raw; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-30 16:28:13
|
Revision: 635 Author: kerphi Date: 2006-06-30 09:28:03 -0700 (Fri, 30 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=635&view=rev Log Message: ----------- New proxy: a censor proxy used to filter bad words in posted messages Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Added Paths: ----------- trunk/src/proxys/censor.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-06-28 19:59:12 UTC (rev 634) +++ trunk/src/pfcglobalconfig.class.php 2006-06-30 16:28:03 UTC (rev 635) @@ -38,9 +38,10 @@ var $admins = array("admin" => ""); // nicknames is the key, password is the value // these parameters are static (cached) - var $proxys = array("auth", "noflood"); + var $proxys = array("auth", "noflood", "censor"); var $proxys_cfg = array("auth" => array(), - "noflood" => array("limit"=>10,"delay"=>5)); + "noflood" => array("limit"=>10,"delay"=>5), + "censor" => array("words"=>array("fuck","sex","bitch"),"replaceby"=>"*")); var $title = ""; // default is _pfc("My Chat") var $channels = array(); // the default joined channels when opening the chat var $frozen_channels = array(); // by default allow users to create there own channels Added: trunk/src/proxys/censor.class.php =================================================================== --- trunk/src/proxys/censor.class.php (rev 0) +++ trunk/src/proxys/censor.class.php 2006-06-30 16:28:03 UTC (rev 635) @@ -0,0 +1,59 @@ +<?php +/** + * censor.class.php + * + * Copyright © 2006 Stephane Gully <ste...@gm...> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ +require_once dirname(__FILE__)."/../pfci18n.class.php"; +require_once dirname(__FILE__)."/../pfcuserconfig.class.php"; +require_once dirname(__FILE__)."/../pfcproxycommand.class.php"; + +/** + * pfcProxyCommand_censor + * this proxy will filter bad words from messages + * @author Stephane Gully <ste...@gm...> + */ +class pfcProxyCommand_censor extends pfcProxyCommand +{ + function run(&$xml_reponse, $clientid, $param, $sender, $recipient, $recipientid) + { + $c =& $this->c; + $u =& $this->u; + + $cmdtocheck = array("send", "nick", "me"); + if ( in_array($this->name, $cmdtocheck) ) + { + $words = $c->proxys_cfg[$this->proxyname]["words"]; + $replaceby = $c->proxys_cfg[$this->proxyname]["replaceby"]; + + $patterns = array(); + $replacements = array(); + foreach($words as $w) + { + $patterns[] = "/".preg_quote($w)."/i"; + $replacements[] = str_repeat($replaceby,strlen($w)); + } + $param = preg_replace($patterns, $replacements, $param); + } + + // forward the command to the next proxy or to the final command + $this->next->run(&$xml_reponse, $clientid, $param, $sender, $recipient, $recipientid); + } +} + +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-28 19:59:21
|
Revision: 634 Author: kerphi Date: 2006-06-28 12:59:12 -0700 (Wed, 28 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=634&view=rev Log Message: ----------- Bug fix: the displayMsg javascript function was broken Modified Paths: -------------- trunk/lib/javascript/myprototype.js trunk/themes/default/templates/pfcclient.js.tpl.php Modified: trunk/lib/javascript/myprototype.js =================================================================== --- trunk/lib/javascript/myprototype.js 2006-06-28 14:27:42 UTC (rev 633) +++ trunk/lib/javascript/myprototype.js 2006-06-28 19:59:12 UTC (rev 634) @@ -1,10 +1,4 @@ -/* Prototype JavaScript framework, version 1.4.0 - * (c) 2005 Sam Stephenson <sa...@co...> - * - * Prototype is freely distributable under the terms of an MIT-style license. - * For details, see the Prototype web site: http://prototype.conio.net/ - * -/*--------------------------------------------------------------------------*/ +// modified prototype library var Prototype = { Version: '1.4.0', Modified: trunk/themes/default/templates/pfcclient.js.tpl.php =================================================================== --- trunk/themes/default/templates/pfcclient.js.tpl.php 2006-06-28 14:27:42 UTC (rev 633) +++ trunk/themes/default/templates/pfcclient.js.tpl.php 2006-06-28 19:59:12 UTC (rev 634) @@ -628,8 +628,10 @@ div.style.padding = "2px 5px 2px 5px"; pre = document.createElement('pre'); - Element.addClassName(pre, '<?php echo $prefix; ?>info'); - Element.addClassName(pre, '<?php echo $prefix; ?>info_'+cmd); + pre.setAttribute('class', '<?php echo $prefix; ?>info <?php echo $prefix; ?>info_'+cmd); + pre.setAttribute('className', '<?php echo $prefix; ?>info <?php echo $prefix; ?>info_'+cmd); // for IE6 + // Element.addClassName(pre, '<?php echo $prefix; ?>info'); + // Element.addClassName(pre, '<?php echo $prefix; ?>info_'+cmd); pre.style.border = "1px solid #555"; pre.style.padding = "5px"; pre.innerHTML = msg; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-28 14:27:53
|
Revision: 633 Author: kerphi Date: 2006-06-28 07:27:42 -0700 (Wed, 28 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=633&view=rev Log Message: ----------- First step to remove prototype dependencies. Why ? because prototype override some default javascript behaviors (Array) and break compatibility with others javascript libraries (example: ie7) Modified Paths: -------------- trunk/src/phpfreechat.class.php trunk/themes/default/templates/pfcclient.js.tpl.php trunk/themes/default/templates/pfcgui.js.tpl.php Added Paths: ----------- trunk/lib/javascript/myprototype.js Added: trunk/lib/javascript/myprototype.js =================================================================== --- trunk/lib/javascript/myprototype.js (rev 0) +++ trunk/lib/javascript/myprototype.js 2006-06-28 14:27:42 UTC (rev 633) @@ -0,0 +1,1520 @@ +/* Prototype JavaScript framework, version 1.4.0 + * (c) 2005 Sam Stephenson <sa...@co...> + * + * Prototype is freely distributable under the terms of an MIT-style license. + * For details, see the Prototype web site: http://prototype.conio.net/ + * +/*--------------------------------------------------------------------------*/ + +var Prototype = { + Version: '1.4.0', + ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)', + + emptyFunction: function() {}, + K: function(x) {return x} +} + +var Class = { + create: function() { + return function() { + this.initialize.apply(this, arguments); + } + } +} + +var Abstract = new Object(); + +Object.extend = function(destination, source) { + for (property in source) { + destination[property] = source[property]; + } + return destination; +} + +Object.inspect = function(object) { + try { + if (object == undefined) return 'undefined'; + if (object == null) return 'null'; + return object.inspect ? object.inspect() : object.toString(); + } catch (e) { + if (e instanceof RangeError) return '...'; + throw e; + } +} + +Function.prototype.bind = function() { + var __method = this, args = $A(arguments), object = args.shift(); + return function() { + return __method.apply(object, args.concat($A(arguments))); + } +} + +Function.prototype.bindAsEventListener = function(object) { + var __method = this; + return function(event) { + return __method.call(object, event || window.event); + } +} + +Object.extend(Number.prototype, { + toColorPart: function() { + var digits = this.toString(16); + if (this < 16) return '0' + digits; + return digits; + }, + + succ: function() { + return this + 1; + }, + + times: function(iterator) { + $R(0, this, true).each(iterator); + return this; + } +}); + +var Try = { + these: function() { + var returnValue; + + for (var i = 0; i < arguments.length; i++) { + var lambda = arguments[i]; + try { + returnValue = lambda(); + break; + } catch (e) {} + } + + return returnValue; + } +} + +/*--------------------------------------------------------------------------*/ + +var PeriodicalExecuter = Class.create(); +PeriodicalExecuter.prototype = { + initialize: function(callback, frequency) { + this.callback = callback; + this.frequency = frequency; + this.currentlyExecuting = false; + + this.registerCallback(); + }, + + registerCallback: function() { + setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); + }, + + onTimerEvent: function() { + if (!this.currentlyExecuting) { + try { + this.currentlyExecuting = true; + this.callback(); + } finally { + this.currentlyExecuting = false; + } + } + } +} + +/*--------------------------------------------------------------------------*/ + +function $() { + var elements = new Array(); + + for (var i = 0; i < arguments.length; i++) { + var element = arguments[i]; + if (typeof element == 'string') + element = document.getElementById(element); + + if (arguments.length == 1) + return element; + + elements.push(element); + } + + return elements; +} +Object.extend(String.prototype, { + stripTags: function() { + return this.replace(/<\/?[^>]+>/gi, ''); + }, + + stripScripts: function() { + return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); + }, + + extractScripts: function() { + var matchAll = new RegExp(Prototype.ScriptFragment, 'img'); + var matchOne = new RegExp(Prototype.ScriptFragment, 'im'); + return (this.match(matchAll) || []).map(function(scriptTag) { + return (scriptTag.match(matchOne) || ['', ''])[1]; + }); + }, + + evalScripts: function() { + return this.extractScripts().map(eval); + }, + + escapeHTML: function() { + var div = document.createElement('div'); + var text = document.createTextNode(this); + div.appendChild(text); + return div.innerHTML; + }, + + unescapeHTML: function() { + var div = document.createElement('div'); + div.innerHTML = this.stripTags(); + return div.childNodes[0] ? div.childNodes[0].nodeValue : ''; + }, + + toQueryParams: function() { + var pairs = this.match(/^\??(.*)$/)[1].split('&'); + return pairs.inject({}, function(params, pairString) { + var pair = pairString.split('='); + params[pair[0]] = pair[1]; + return params; + }); + }, + + toArray: function() { + return this.split(''); + }, + + camelize: function() { + var oStringList = this.split('-'); + if (oStringList.length == 1) return oStringList[0]; + + var camelizedString = this.indexOf('-') == 0 + ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1) + : oStringList[0]; + + for (var i = 1, len = oStringList.length; i < len; i++) { + var s = oStringList[i]; + camelizedString += s.charAt(0).toUpperCase() + s.substring(1); + } + + return camelizedString; + }, + + inspect: function() { + return "'" + this.replace('\\', '\\\\').replace("'", '\\\'') + "'"; + } +}); + +String.prototype.parseQuery = String.prototype.toQueryParams; + +var $break = new Object(); +var $continue = new Object(); + +var Enumerable = { + each: function(iterator) { + var index = 0; + try { + this._each(function(value) { + try { + iterator(value, index++); + } catch (e) { + if (e != $continue) throw e; + } + }); + } catch (e) { + if (e != $break) throw e; + } + }, + + all: function(iterator) { + var result = true; + this.each(function(value, index) { + result = result && !!(iterator || Prototype.K)(value, index); + if (!result) throw $break; + }); + return result; + }, + + any: function(iterator) { + var result = true; + this.each(function(value, index) { + if (result = !!(iterator || Prototype.K)(value, index)) + throw $break; + }); + return result; + }, + + collect: function(iterator) { + var results = []; + this.each(function(value, index) { + results.push(iterator(value, index)); + }); + return results; + }, + + detect: function (iterator) { + var result; + this.each(function(value, index) { + if (iterator(value, index)) { + result = value; + throw $break; + } + }); + return result; + }, + + findAll: function(iterator) { + var results = []; + this.each(function(value, index) { + if (iterator(value, index)) + results.push(value); + }); + return results; + }, + + grep: function(pattern, iterator) { + var results = []; + this.each(function(value, index) { + var stringValue = value.toString(); + if (stringValue.match(pattern)) + results.push((iterator || Prototype.K)(value, index)); + }) + return results; + }, + + include: function(object) { + var found = false; + this.each(function(value) { + if (value == object) { + found = true; + throw $break; + } + }); + return found; + }, + + inject: function(memo, iterator) { + this.each(function(value, index) { + memo = iterator(memo, value, index); + }); + return memo; + }, + + invoke: function(method) { + var args = $A(arguments).slice(1); + return this.collect(function(value) { + return value[method].apply(value, args); + }); + }, + + max: function(iterator) { + var result; + this.each(function(value, index) { + value = (iterator || Prototype.K)(value, index); + if (value >= (result || value)) + result = value; + }); + return result; + }, + + min: function(iterator) { + var result; + this.each(function(value, index) { + value = (iterator || Prototype.K)(value, index); + if (value <= (result || value)) + result = value; + }); + return result; + }, + + partition: function(iterator) { + var trues = [], falses = []; + this.each(function(value, index) { + ((iterator || Prototype.K)(value, index) ? + trues : falses).push(value); + }); + return [trues, falses]; + }, + + pluck: function(property) { + var results = []; + this.each(function(value, index) { + results.push(value[property]); + }); + return results; + }, + + reject: function(iterator) { + var results = []; + this.each(function(value, index) { + if (!iterator(value, index)) + results.push(value); + }); + return results; + }, + + sortBy: function(iterator) { + return this.collect(function(value, index) { + return {value: value, criteria: iterator(value, index)}; + }).sort(function(left, right) { + var a = left.criteria, b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + }).pluck('value'); + }, + + toArray: function() { + return this.collect(Prototype.K); + }, + + zip: function() { + var iterator = Prototype.K, args = $A(arguments); + if (typeof args.last() == 'function') + iterator = args.pop(); + + var collections = [this].concat(args).map($A); + return this.map(function(value, index) { + iterator(value = collections.pluck(index)); + return value; + }); + }, + + inspect: function() { + return '#<Enumerable:' + this.toArray().inspect() + '>'; + } +} + +Object.extend(Enumerable, { + map: Enumerable.collect, + find: Enumerable.detect, + select: Enumerable.findAll, + member: Enumerable.include, + entries: Enumerable.toArray + }); + +var $A = Array.from = function(iterable) { + if (!iterable) return []; + if (iterable.toArray) { + return iterable.toArray(); + } else { + var results = []; + for (var i = 0; i < iterable.length; i++) + results.push(iterable[i]); + return results; + } +} + +//Array.prototype._reverse = Array.prototype.reverse; + +//Object.extend(Array.prototype, Enumerable); +/* +Array.prototype._reverse = Array.prototype.reverse; + + +Object.extend(Array.prototype, { + _each: function(iterator) { + for (var i = 0; i < this.length; i++) + iterator(this[i]); + }, + + clear: function() { + this.length = 0; + return this; + }, + + first: function() { + return this[0]; + }, + + last: function() { + return this[this.length - 1]; + }, + + compact: function() { + return this.select(function(value) { + return value != undefined || value != null; + }); + }, + + flatten: function() { + return this.inject([], function(array, value) { + return array.concat(value.constructor == Array ? + value.flatten() : [value]); + }); + }, + + without: function() { + var values = $A(arguments); + return this.select(function(value) { + return !values.include(value); + }); + }, + + indexOf: function(object) { + for (var i = 0; i < this.length; i++) + if (this[i] == object) return i; + return -1; + }, + + reverse: function(inline) { + return (inline !== false ? this : this.toArray())._reverse(); + }, + + shift: function() { + var result = this[0]; + for (var i = 0; i < this.length - 1; i++) + this[i] = this[i + 1]; + this.length--; + return result; + }, + + inspect: function() { + return '[' + this.map(Object.inspect).join(', ') + ']'; + } +}); +*/ + + +var Hash = { + _each: function(iterator) { + for (key in this) { + var value = this[key]; + if (typeof value == 'function') continue; + + var pair = [key, value]; + pair.key = key; + pair.value = value; + iterator(pair); + } + }, + + keys: function() { + return this.pluck('key'); + }, + + values: function() { + return this.pluck('value'); + }, + + merge: function(hash) { + return $H(hash).inject($H(this), function(mergedHash, pair) { + mergedHash[pair.key] = pair.value; + return mergedHash; + }); + }, + + toQueryString: function() { + return this.map(function(pair) { + return pair.map(encodeURIComponent).join('='); + }).join('&'); + }, + + inspect: function() { + return '#<Hash:{' + this.map(function(pair) { + return pair.map(Object.inspect).join(': '); + }).join(', ') + '}>'; + } +} + +function $H(object) { + var hash = Object.extend({}, object || {}); + Object.extend(hash, Enumerable); + Object.extend(hash, Hash); + return hash; +} +ObjectRange = Class.create(); +Object.extend(ObjectRange.prototype, Enumerable); +Object.extend(ObjectRange.prototype, { + initialize: function(start, end, exclusive) { + this.start = start; + this.end = end; + this.exclusive = exclusive; + }, + + _each: function(iterator) { + var value = this.start; + do { + iterator(value); + value = value.succ(); + } while (this.include(value)); + }, + + include: function(value) { + if (value < this.start) + return false; + if (this.exclusive) + return value < this.end; + return value <= this.end; + } +}); + +var $R = function(start, end, exclusive) { + return new ObjectRange(start, end, exclusive); +} + +document.getElementsByClassName = function(className, parentElement) { + var children = ($(parentElement) || document.body).getElementsByTagName('*'); + return $A(children).inject([], function(elements, child) { + if (child.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)"))) + elements.push(child); + return elements; + }); +} + +/*--------------------------------------------------------------------------*/ + +if (!window.Element) { + var Element = new Object(); +} + +Object.extend(Element, { + visible: function(element) { + return $(element).style.display != 'none'; + }, + + toggle: function() { + for (var i = 0; i < arguments.length; i++) { + var element = $(arguments[i]); + Element[Element.visible(element) ? 'hide' : 'show'](element); + } + }, + + hide: function() { + for (var i = 0; i < arguments.length; i++) { + var element = $(arguments[i]); + element.style.display = 'none'; + } + }, + + show: function() { + for (var i = 0; i < arguments.length; i++) { + var element = $(arguments[i]); + element.style.display = ''; + } + }, + + remove: function(element) { + element = $(element); + element.parentNode.removeChild(element); + }, + + update: function(element, html) { + $(element).innerHTML = html.stripScripts(); + setTimeout(function() {html.evalScripts()}, 10); + }, + + getHeight: function(element) { + element = $(element); + return element.offsetHeight; + }, + + classNames: function(element) { + return new Element.ClassNames(element); + }, + + hasClassName: function(element, className) { + if (!(element = $(element))) return; + return Element.classNames(element).include(className); + }, + + addClassName: function(element, className) { + if (!(element = $(element))) return; + return Element.classNames(element).add(className); + }, + + removeClassName: function(element, className) { + if (!(element = $(element))) return; + return Element.classNames(element).remove(className); + }, + + // removes whitespace-only text node children + cleanWhitespace: function(element) { + element = $(element); + for (var i = 0; i < element.childNodes.length; i++) { + var node = element.childNodes[i]; + if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) + Element.remove(node); + } + }, + + empty: function(element) { + return $(element).innerHTML.match(/^\s*$/); + }, + + scrollTo: function(element) { + element = $(element); + var x = element.x ? element.x : element.offsetLeft, + y = element.y ? element.y : element.offsetTop; + window.scrollTo(x, y); + }, + + getStyle: function(element, style) { + element = $(element); + var value = element.style[style.camelize()]; + if (!value) { + if (document.defaultView && document.defaultView.getComputedStyle) { + var css = document.defaultView.getComputedStyle(element, null); + value = css ? css.getPropertyValue(style) : null; + } else if (element.currentStyle) { + value = element.currentStyle[style.camelize()]; + } + } + + if (window.opera && ['left', 'top', 'right', 'bottom'].include(style)) + if (Element.getStyle(element, 'position') == 'static') value = 'auto'; + + return value == 'auto' ? null : value; + }, + + setStyle: function(element, style) { + element = $(element); + for (name in style) + element.style[name.camelize()] = style[name]; + }, + + getDimensions: function(element) { + element = $(element); + if (Element.getStyle(element, 'display') != 'none') + return {width: element.offsetWidth, height: element.offsetHeight}; + + // All *Width and *Height properties give 0 on elements with display none, + // so enable the element temporarily + var els = element.style; + var originalVisibility = els.visibility; + var originalPosition = els.position; + els.visibility = 'hidden'; + els.position = 'absolute'; + els.display = ''; + var originalWidth = element.clientWidth; + var originalHeight = element.clientHeight; + els.display = 'none'; + els.position = originalPosition; + els.visibility = originalVisibility; + return {width: originalWidth, height: originalHeight}; + }, + + makePositioned: function(element) { + element = $(element); + var pos = Element.getStyle(element, 'position'); + if (pos == 'static' || !pos) { + element._madePositioned = true; + element.style.position = 'relative'; + // Opera returns the offset relative to the positioning context, when an + // element is position relative but top and left have not been defined + if (window.opera) { + element.style.top = 0; + element.style.left = 0; + } + } + }, + + undoPositioned: function(element) { + element = $(element); + if (element._madePositioned) { + element._madePositioned = undefined; + element.style.position = + element.style.top = + element.style.left = + element.style.bottom = + element.style.right = ''; + } + }, + + makeClipping: function(element) { + element = $(element); + if (element._overflow) return; + element._overflow = element.style.overflow; + if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden') + element.style.overflow = 'hidden'; + }, + + undoClipping: function(element) { + element = $(element); + if (element._overflow) return; + element.style.overflow = element._overflow; + element._overflow = undefined; + } +}); + +var Toggle = new Object(); +Toggle.display = Element.toggle; + +/*--------------------------------------------------------------------------*/ + +Abstract.Insertion = function(adjacency) { + this.adjacency = adjacency; +} + +Abstract.Insertion.prototype = { + initialize: function(element, content) { + this.element = $(element); + this.content = content.stripScripts(); + + if (this.adjacency && this.element.insertAdjacentHTML) { + try { + this.element.insertAdjacentHTML(this.adjacency, this.content); + } catch (e) { + if (this.element.tagName.toLowerCase() == 'tbody') { + this.insertContent(this.contentFromAnonymousTable()); + } else { + throw e; + } + } + } else { + this.range = this.element.ownerDocument.createRange(); + if (this.initializeRange) this.initializeRange(); + this.insertContent([this.range.createContextualFragment(this.content)]); + } + + setTimeout(function() {content.evalScripts()}, 10); + }, + + contentFromAnonymousTable: function() { + var div = document.createElement('div'); + div.innerHTML = '<table><tbody>' + this.content + '</tbody></table>'; + return $A(div.childNodes[0].childNodes[0].childNodes); + } +} + +var Insertion = new Object(); + +Insertion.Before = Class.create(); +Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), { + initializeRange: function() { + this.range.setStartBefore(this.element); + }, + + insertContent: function(fragments) { + fragments.each((function(fragment) { + this.element.parentNode.insertBefore(fragment, this.element); + }).bind(this)); + } +}); + +Insertion.Top = Class.create(); +Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), { + initializeRange: function() { + this.range.selectNodeContents(this.element); + this.range.collapse(true); + }, + + insertContent: function(fragments) { + fragments.reverse(false).each((function(fragment) { + this.element.insertBefore(fragment, this.element.firstChild); + }).bind(this)); + } +}); + +Insertion.Bottom = Class.create(); +Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), { + initializeRange: function() { + this.range.selectNodeContents(this.element); + this.range.collapse(this.element); + }, + + insertContent: function(fragments) { + fragments.each((function(fragment) { + this.element.appendChild(fragment); + }).bind(this)); + } +}); + +Insertion.After = Class.create(); +Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), { + initializeRange: function() { + this.range.setStartAfter(this.element); + }, + + insertContent: function(fragments) { + fragments.each((function(fragment) { + this.element.parentNode.insertBefore(fragment, + this.element.nextSibling); + }).bind(this)); + } +}); + +/*--------------------------------------------------------------------------*/ + +Element.ClassNames = Class.create(); +Element.ClassNames.prototype = { + initialize: function(element) { + this.element = $(element); + }, + + _each: function(iterator) { + this.element.className.split(/\s+/).select(function(name) { + return name.length > 0; + })._each(iterator); + }, + + set: function(className) { + this.element.className = className; + }, + + add: function(classNameToAdd) { + if (this.include(classNameToAdd)) return; + this.set(this.toArray().concat(classNameToAdd).join(' ')); + }, + + remove: function(classNameToRemove) { + if (!this.include(classNameToRemove)) return; + this.set(this.select(function(className) { + return className != classNameToRemove; + }).join(' ')); + }, + + toString: function() { + return this.toArray().join(' '); + } +} + +Object.extend(Element.ClassNames.prototype, Enumerable); +var Field = { + clear: function() { + for (var i = 0; i < arguments.length; i++) + $(arguments[i]).value = ''; + }, + + focus: function(element) { + $(element).focus(); + }, + + present: function() { + for (var i = 0; i < arguments.length; i++) + if ($(arguments[i]).value == '') return false; + return true; + }, + + select: function(element) { + $(element).select(); + }, + + activate: function(element) { + element = $(element); + element.focus(); + if (element.select) + element.select(); + } +} + +/*--------------------------------------------------------------------------*/ + +var Form = { + serialize: function(form) { + var elements = Form.getElements($(form)); + var queryComponents = new Array(); + + for (var i = 0; i < elements.length; i++) { + var queryComponent = Form.Element.serialize(elements[i]); + if (queryComponent) + queryComponents.push(queryComponent); + } + + return queryComponents.join('&'); + }, + + getElements: function(form) { + form = $(form); + var elements = new Array(); + + for (tagName in Form.Element.Serializers) { + var tagElements = form.getElementsByTagName(tagName); + for (var j = 0; j < tagElements.length; j++) + elements.push(tagElements[j]); + } + return elements; + }, + + getInputs: function(form, typeName, name) { + form = $(form); + var inputs = form.getElementsByTagName('input'); + + if (!typeName && !name) + return inputs; + + var matchingInputs = new Array(); + for (var i = 0; i < inputs.length; i++) { + var input = inputs[i]; + if ((typeName && input.type != typeName) || + (name && input.name != name)) + continue; + matchingInputs.push(input); + } + + return matchingInputs; + }, + + disable: function(form) { + var elements = Form.getElements(form); + for (var i = 0; i < elements.length; i++) { + var element = elements[i]; + element.blur(); + element.disabled = 'true'; + } + }, + + enable: function(form) { + var elements = Form.getElements(form); + for (var i = 0; i < elements.length; i++) { + var element = elements[i]; + element.disabled = ''; + } + }, + + findFirstElement: function(form) { + return Form.getElements(form).find(function(element) { + return element.type != 'hidden' && !element.disabled && + ['input', 'select', 'textarea'].include(element.tagName.toLowerCase()); + }); + }, + + focusFirstElement: function(form) { + Field.activate(Form.findFirstElement(form)); + }, + + reset: function(form) { + $(form).reset(); + } +} + +Form.Element = { + serialize: function(element) { + element = $(element); + var method = element.tagName.toLowerCase(); + var parameter = Form.Element.Serializers[method](element); + + if (parameter) { + var key = encodeURIComponent(parameter[0]); + if (key.length == 0) return; + + if (parameter[1].constructor != Array) + parameter[1] = [parameter[1]]; + + return parameter[1].map(function(value) { + return key + '=' + encodeURIComponent(value); + }).join('&'); + } + }, + + getValue: function(element) { + element = $(element); + var method = element.tagName.toLowerCase(); + var parameter = Form.Element.Serializers[method](element); + + if (parameter) + return parameter[1]; + } +} + +Form.Element.Serializers = { + input: function(element) { + switch (element.type.toLowerCase()) { + case 'submit': + case 'hidden': + case 'password': + case 'text': + return Form.Element.Serializers.textarea(element); + case 'checkbox': + case 'radio': + return Form.Element.Serializers.inputSelector(element); + } + return false; + }, + + inputSelector: function(element) { + if (element.checked) + return [element.name, element.value]; + }, + + textarea: function(element) { + return [element.name, element.value]; + }, + + select: function(element) { + return Form.Element.Serializers[element.type == 'select-one' ? + 'selectOne' : 'selectMany'](element); + }, + + selectOne: function(element) { + var value = '', opt, index = element.selectedIndex; + if (index >= 0) { + opt = element.options[index]; + value = opt.value; + if (!value && !('value' in opt)) + value = opt.text; + } + return [element.name, value]; + }, + + selectMany: function(element) { + var value = new Array(); + for (var i = 0; i < element.length; i++) { + var opt = element.options[i]; + if (opt.selected) { + var optValue = opt.value; + if (!optValue && !('value' in opt)) + optValue = opt.text; + value.push(optValue); + } + } + return [element.name, value]; + } +} + +/*--------------------------------------------------------------------------*/ + +var $F = Form.Element.getValue; + +/*--------------------------------------------------------------------------*/ + +Abstract.TimedObserver = function() {} +Abstract.TimedObserver.prototype = { + initialize: function(element, frequency, callback) { + this.frequency = frequency; + this.element = $(element); + this.callback = callback; + + this.lastValue = this.getValue(); + this.registerCallback(); + }, + + registerCallback: function() { + setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); + }, + + onTimerEvent: function() { + var value = this.getValue(); + if (this.lastValue != value) { + this.callback(this.element, value); + this.lastValue = value; + } + } +} + +Form.Element.Observer = Class.create(); +Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { + getValue: function() { + return Form.Element.getValue(this.element); + } +}); + +Form.Observer = Class.create(); +Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { + getValue: function() { + return Form.serialize(this.element); + } +}); + +/*--------------------------------------------------------------------------*/ + +Abstract.EventObserver = function() {} +Abstract.EventObserver.prototype = { + initialize: function(element, callback) { + this.element = $(element); + this.callback = callback; + + this.lastValue = this.getValue(); + if (this.element.tagName.toLowerCase() == 'form') + this.registerFormCallbacks(); + else + this.registerCallback(this.element); + }, + + onElementEvent: function() { + var value = this.getValue(); + if (this.lastValue != value) { + this.callback(this.element, value); + this.lastValue = value; + } + }, + + registerFormCallbacks: function() { + var elements = Form.getElements(this.element); + for (var i = 0; i < elements.length; i++) + this.registerCallback(elements[i]); + }, + + registerCallback: function(element) { + if (element.type) { + switch (element.type.toLowerCase()) { + case 'checkbox': + case 'radio': + Event.observe(element, 'click', this.onElementEvent.bind(this)); + break; + case 'password': + case 'text': + case 'textarea': + case 'select-one': + case 'select-multiple': + Event.observe(element, 'change', this.onElementEvent.bind(this)); + break; + } + } + } +} + +Form.Element.EventObserver = Class.create(); +Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), { + getValue: function() { + return Form.Element.getValue(this.element); + } +}); + +Form.EventObserver = Class.create(); +Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), { + getValue: function() { + return Form.serialize(this.element); + } +}); +if (!window.Event) { + var Event = new Object(); +} + +Object.extend(Event, { + KEY_BACKSPACE: 8, + KEY_TAB: 9, + KEY_RETURN: 13, + KEY_ESC: 27, + KEY_LEFT: 37, + KEY_UP: 38, + KEY_RIGHT: 39, + KEY_DOWN: 40, + KEY_DELETE: 46, + + element: function(event) { + return event.target || event.srcElement; + }, + + isLeftClick: function(event) { + return (((event.which) && (event.which == 1)) || + ((event.button) && (event.button == 1))); + }, + + pointerX: function(event) { + return event.pageX || (event.clientX + + (document.documentElement.scrollLeft || document.body.scrollLeft)); + }, + + pointerY: function(event) { + return event.pageY || (event.clientY + + (document.documentElement.scrollTop || document.body.scrollTop)); + }, + + stop: function(event) { + if (event.preventDefault) { + event.preventDefault(); + event.stopPropagation(); + } else { + event.returnValue = false; + event.cancelBubble = true; + } + }, + + // find the first node with the given tagName, starting from the + // node the event was triggered on; traverses the DOM upwards + findElement: function(event, tagName) { + var element = Event.element(event); + while (element.parentNode && (!element.tagName || + (element.tagName.toUpperCase() != tagName.toUpperCase()))) + element = element.parentNode; + return element; + }, + + observers: false, + + _observeAndCache: function(element, name, observer, useCapture) { + if (!this.observers) this.observers = []; + if (element.addEventListener) { + this.observers.push([element, name, observer, useCapture]); + element.addEventListener(name, observer, useCapture); + } else if (element.attachEvent) { + this.observers.push([element, name, observer, useCapture]); + element.attachEvent('on' + name, observer); + } + }, + + unloadCache: function() { + if (!Event.observers) return; + for (var i = 0; i < Event.observers.length; i++) { + Event.stopObserving.apply(this, Event.observers[i]); + Event.observers[i][0] = null; + } + Event.observers = false; + }, + + observe: function(element, name, observer, useCapture) { + var element = $(element); + useCapture = useCapture || false; + + if (name == 'keypress' && + (navigator.appVersion.match(/Konqueror|Safari|KHTML/) + || element.attachEvent)) + name = 'keydown'; + + this._observeAndCache(element, name, observer, useCapture); + }, + + stopObserving: function(element, name, observer, useCapture) { + var element = $(element); + useCapture = useCapture || false; + + if (name == 'keypress' && + (navigator.appVersion.match(/Konqueror|Safari|KHTML/) + || element.detachEvent)) + name = 'keydown'; + + if (element.removeEventListener) { + element.removeEventListener(name, observer, useCapture); + } else if (element.detachEvent) { + element.detachEvent('on' + name, observer); + } + } +}); + +/* prevent memory leaks in IE */ +Event.observe(window, 'unload', Event.unloadCache, false); +var Position = { + // set to true if needed, warning: firefox performance problems + // NOT neeeded for page scrolling, only if draggable contained in + // scrollable elements + includeScrollOffsets: false, + + // must be called before calling withinIncludingScrolloffset, every time the + // page is scrolled + prepare: function() { + this.deltaX = window.pageXOffset + || document.documentElement.scrollLeft + || document.body.scrollLeft + || 0; + this.deltaY = window.pageYOffset + || document.documentElement.scrollTop + || document.body.scrollTop + || 0; + }, + + realOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.scrollTop || 0; + valueL += element.scrollLeft || 0; + element = element.parentNode; + } while (element); + return [valueL, valueT]; + }, + + cumulativeOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + element = element.offsetParent; + } while (element); + return [valueL, valueT]; + }, + + positionedOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + element = element.offsetParent; + if (element) { + p = Element.getStyle(element, 'position'); + if (p == 'relative' || p == 'absolute') break; + } + } while (element); + return [valueL, valueT]; + }, + + offsetParent: function(element) { + if (element.offsetParent) return element.offsetParent; + if (element == document.body) return element; + + while ((element = element.parentNode) && element != document.body) + if (Element.getStyle(element, 'position') != 'static') + return element; + + return document.body; + }, + + // caches x/y coordinate pair to use with overlap + within: function(element, x, y) { + if (this.includeScrollOffsets) + return this.withinIncludingScrolloffsets(element, x, y); + this.xcomp = x; + this.ycomp = y; + this.offset = this.cumulativeOffset(element); + + return (y >= this.offset[1] && + y < this.offset[1] + element.offsetHeight && + x >= this.offset[0] && + x < this.offset[0] + element.offsetWidth); + }, + + withinIncludingScrolloffsets: function(element, x, y) { + var offsetcache = this.realOffset(element); + + this.xcomp = x + offsetcache[0] - this.deltaX; + this.ycomp = y + offsetcache[1] - this.deltaY; + this.offset = this.cumulativeOffset(element); + + return (this.ycomp >= this.offset[1] && + this.ycomp < this.offset[1] + element.offsetHeight && + this.xcomp >= this.offset[0] && + this.xcomp < this.offset[0] + element.offsetWidth); + }, + + // within must be called directly before + overlap: function(mode, element) { + if (!mode) return 0; + if (mode == 'vertical') + return ((this.offset[1] + element.offsetHeight) - this.ycomp) / + element.offsetHeight; + if (mode == 'horizontal') + return ((this.offset[0] + element.offsetWidth) - this.xcomp) / + element.offsetWidth; + }, + + clone: function(source, target) { + source = $(source); + target = $(target); + target.style.position = 'absolute'; + var offsets = this.cumulativeOffset(source); + target.style.top = offsets[1] + 'px'; + target.style.left = offsets[0] + 'px'; + target.style.width = source.offsetWidth + 'px'; + target.style.height = source.offsetHeight + 'px'; + }, + + page: function(forElement) { + var valueT = 0, valueL = 0; + + var element = forElement; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + + // Safari fix + if (element.offsetParent==document.body) + if (Element.getStyle(element,'position')=='absolute') break; + + } while (element = element.offsetParent); + + element = forElement; + do { + valueT -= element.scrollTop || 0; + valueL -= element.scrollLeft || 0; + } while (element = element.parentNode); + + return [valueL, valueT]; + }, + + clone: function(source, target) { + var options = Object.extend({ + setLeft: true, + setTop: true, + setWidth: true, + setHeight: true, + offsetTop: 0, + offsetLeft: 0 + }, arguments[2] || {}) + + // find page position of source + source = $(source); + var p = Position.page(source); + + // find coordinate system to use + target = $(target); + var delta = [0, 0]; + var parent = null; + // delta [0,0] will do fine with position: fixed elements, + // position:absolute needs offsetParent deltas + if (Element.getStyle(target,'position') == 'absolute') { + parent = Position.offsetParent(target); + delta = Position.page(parent); + } + + // correct by body offsets (fixes Safari) + if (parent == document.body) { + delta[0] -= document.body.offsetLeft; + delta[1] -= document.body.offsetTop; + } + + // set position + if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; + if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; + if(options.setWidth) target.style.width = source.offsetWidth + 'px'; + if(options.setHeight) target.style.height = source.offsetHeight + 'px'; + }, + + absolutize: function(element) { + element = $(element); + if (element.style.position == 'absolute') return; + Position.prepare(); + + var offsets = Position.positionedOffset(element); + var top = offsets[1]; + var left = offsets[0]; + var width = element.clientWidth; + var height = element.clientHeight; + + element._originalLeft = left - parseFloat(element.style.left || 0); + element._originalTop = top - parseFloat(element.style.top || 0); + element._originalWidth = element.style.width; + element._originalHeight = element.style.height; + + element.style.position = 'absolute'; + element.style.top = top + 'px';; + element.style.left = left + 'px';; + element.style.width = width + 'px';; + element.style.height = height + 'px';; + }, + + relativize: function(element) { + element = $(element); + if (element.style.position == 'relative') return; + Position.prepare(); + + element.style.position = 'relative'; + var top = parseFloat(element.style.top || 0) - (element._originalTop || 0); + var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); + + element.style.top = top + 'px'; + element.style.left = left + 'px'; + element.style.height = element._originalHeight; + element.style.width = element._originalWidth; + } +} + +// Safari returns margins on body which is incorrect if the child is absolutely +// positioned. For performance reasons, redefine Position.cumulativeOffset for +// KHTML/WebKit only. +if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) { + Position.cumulativeOffset = function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + if (element.offsetParent == document.body) + if (Element.getStyle(element, 'position') == 'absolute') break; + + element = element.offsetParent; + } while (element); + + return [valueL, valueT]; + } +} + + +function indexOf(array, object) +{ + for (var i = 0; i < array.length; i++) + if (array[i] == object) return i; + return -1; +} + +function without(array,value) { + var res = Array(); + for( var i = 0 ; i < array.length; i++) + { + if (array[i] != value) res.push(array[i]); + } + return res; +} Modified: trunk/src/phpfreechat.class.php =================================================================== --- trunk/src/phpfreechat.class.php 2006-06-28 13:18:35 UTC (rev 632) +++ trunk/src/phpfreechat.class.php 2006-06-28 14:27:42 UTC (rev 633) @@ -91,7 +91,7 @@ $output .= "<script type=\"text/javascript\" src=\"".$js_path."/md5.js\"></script>"; $output .= "<script type=\"text/javascript\" src=\"".$js_path."/cookie.js\"></script>"; $output .= "<script type=\"text/javascript\" src=\"".$js_path."/image_preloader.js\"></script>"; - $output .= "<script type=\"text/javascript\" src=\"".$js_path."/prototype.js\"></script>"; + $output .= "<script type=\"text/javascript\" src=\"".$js_path."/myprototype.js\"></script>"; $output .= "<script type=\"text/javascript\" src=\"".$js_path."/regex.js\"></script>"; $output .= "<script type=\"text/javascript\" src=\"".$js_path."/utf8.js\"></script>"; Modified: trunk/themes/default/templates/pfcclient.js.tpl.php =================================================================== --- trunk/themes/default/templates/pfcclient.js.tpl.php 2006-06-28 13:18:35 UTC (rev 632) +++ trunk/themes/default/templates/pfcclient.js.tpl.php 2006-06-28 14:27:42 UTC (rev 633) @@ -241,9 +241,9 @@ // synchronize the privmsg client arrays index = -1; - index = this.privmsgids.indexOf(tabid); - this.privmsgids = this.privmsgids.without(tabid); - this.privmsgs = this.privmsgs.without(this.privmsgs[index]); + index = indexOf(this.privmsgids, tabid); + this.privmsgids = without(this.privmsgids, tabid); + this.privmsgs = without(this.privmsgs, this.privmsgs[index]); } } @@ -412,7 +412,7 @@ for (var i=0; i<ul_online.childNodes.length; i++) { var nick = ul_online.childNodes[i].innerHTML; - if (nick.indexOf(nick_src) == 0) + if (indexOf(nick, nick_src) == 0) w.value = w.value.replace(nick_src, nick); } } @@ -807,8 +807,11 @@ span.pfc_nick = nicks[i]; span.onclick = function(){pfc.insert_text(this.pfc_nick+", ",""); return false;} span.appendChild(document.createTextNode(nicks[i])); - Element.addClassName(span, '<?php echo $prefix; ?>nickmarker'); - Element.addClassName(span, '<?php echo $prefix; ?>nick_'+ hex_md5(_to_utf8(nicks[i]))); + span.setAttribute('class', '<?php echo $prefix; ?>nickmarker <?php echo $prefix; ?>nick_'+ hex_md5(_to_utf8(nicks[i]))); + span.setAttribute('className', '<?php echo $prefix; ?>nickmarker <?php echo $prefix; ?>nick_'+ hex_md5(_to_utf8(nicks[i]))); // for IE6 + + // Element.addClassName(span, '<?php echo $prefix; ?>nickmarker'); + // Element.addClassName(span, '<?php echo $prefix; ?>nick_'+ hex_md5(_to_utf8(nicks[i]))); nobr.appendChild(span); li.appendChild(nobr); li.style.borderBottom = '1px solid #AAA'; @@ -1450,12 +1453,16 @@ if (!this.showwhosonline) { style['width'] = '100%'; - Element.setStyle(chatdiv, style); + chatdiv.setAttribute('style', 'width:100%'); + chatdiv.setAttribute('cssText', 'width:100%'); // for IE6 + // Element.setStyle(chatdiv, style); } else { style['width'] = ''; - Element.setStyle(chatdiv, style); + chatdiv.setAttribute('style', ''); + chatdiv.setAttribute('cssText', ''); // for IE6 + // Element.setStyle(chatdiv, style); } } } Modified: trunk/themes/default/templates/pfcgui.js.tpl.php =================================================================== --- trunk/themes/default/templates/pfcgui.js.tpl.php 2006-06-28 13:18:35 UTC (rev 632) +++ trunk/themes/default/templates/pfcgui.js.tpl.php 2006-06-28 14:27:42 UTC (rev 633) @@ -39,7 +39,14 @@ isCreated: function(tabid) { - return (this.tabids.indexOf(tabid) >= 0); + /* + for (var i = 0; i < this.tabids.length ; i++) + { + if (this.tabids[i] == tabid) return true; + } + return false; + */ + return (indexOf(this.tabids, tabid) >= 0); }, setTabById: function(tabid) @@ -60,7 +67,9 @@ if (this.tabids[i] == tabid) { // select the tab - Element.addClassName(tabtitle, 'selected'); + tabtitle.setAttribute('class', 'selected'); + tabtitle.setAttribute('className', 'selected'); // for IE6 + //Element.addClassName(tabtitle, 'selected'); tab_to_show = tabcontent; this.current_tab = this.tabs[i]; this.current_tab_id = tabid; @@ -68,7 +77,9 @@ else { // unselect the tab - Element.removeClassName(tabtitle, 'selected'); + tabtitle.setAttribute('class', ''); + tabtitle.setAttribute('className', ''); // for IE6 + //Element.removeClassName(tabtitle, 'selected'); tabcontent.style.display = 'none'; } } @@ -107,7 +118,10 @@ // if the chat content doesn't exists yet, just create a cached one cc = document.createElement('div'); cc.setAttribute('id', '<?php echo $prefix; ?>chat_'+tabid); - Element.addClassName(cc, '<?php echo $prefix; ?>chat'); + cc.setAttribute('class', '<?php echo $prefix; ?>chat'); + cc.setAttribute('className', '<?php echo $prefix; ?>chat'); // for IE6 + + // Element.addClassName(cc, '<?php echo $prefix; ?>chat'); cc.style.display = "block"; // needed by IE6 to show the online div at startup (first loaded page) // cc.style.marginLeft = "5px"; @@ -122,7 +136,9 @@ oc = document.createElement('div'); oc.setAttribute('id', '<?php echo $prefix; ?>online_'+tabid); - Element.addClassName(oc, '<?php echo $prefix; ?>online'); + oc.setAttribute('class', '<?php echo $prefix; ?>online'); + oc.setAttribute('className', '<?php echo $prefix; ?>online'); // for IE6 + //Element.addClassName(oc, '<?php echo $prefix; ?>online'); // I set the border style here because seting it in the CSS is not taken in account // oc.style.borderLeft = "1px solid #555"; oc.style.display = "block"; // needed by IE6 to show the online div at startup (first loaded page) @@ -151,12 +167,12 @@ div_chat.innerHTML = ''; // remove the tab from the list - var tabpos = this.tabids.indexOf(tabid); + var tabpos = indexOf(this.tabids, tabid); var name = this.tabs[tabpos]; - this.tabids = this.tabids.without(this.tabids[tabpos]); - this.tabs = this.tabs.without(this.tabs[tabpos]); - this.tabtypes = this.tabtypes.without(this.tabtypes[tabpos]); - tabpos = this.tabids.indexOf(this.getTabId()); + this.tabids = without(this.tabids, this.tabids[tabpos]); + this.tabs = without(this.tabs, this.tabs[tabpos]); + this.tabtypes = without(this.tabtypes, this.tabtypes[tabpos]); + tabpos = indexOf(this.tabids, this.getTabId()); if (tabpos<0) tabpos = 0; this.setTabById(this.tabids[tabpos]); return name; @@ -182,13 +198,15 @@ // do not create twice a the same tab if (this.isCreated(tabid)) return; - + // var tabid = hex_md5(_to_utf8(name)); //alert(name+'='+tabid); this.tabs.push(name); this.tabids.push(tabid); this.tabtypes.push(type); + //alert(this.tabs.toString()); + var li_title = document.createElement('li'); li_title.setAttribute('id', '<?php echo $prefix; ?>channel_title'+tabid); @@ -202,7 +220,9 @@ if (type == 'pv') img.setAttribute('src', '<?php echo $c->getFileUrlFromTheme('images/pv.gif'); ?>'); var a1 = document.createElement('a'); - Element.addClassName(a1, '<?php echo $prefix; ?>tabtitle'); + // Element.addClassName(a1, '<?php echo $prefix; ?>tabtitle'); + a1.setAttribute('class', '<?php echo $prefix; ?>tabtitle'); + a1.setAttribute('className', '<?php echo $prefix; ?>tabtitle'); // for IE6 a1.appendChild(img); a1.appendChild(document.createTextNode(name)); a1.setAttribute('href', '#'); @@ -218,7 +238,9 @@ } a2.alt = this.i18n._('Close this tab'); a2.title = a2.alt; - Element.addClassName(a2, '<?php echo $prefix; ?>tabclose'); + // Element.addClassName(a2, '<?php echo $prefix; ?>tabclose'); + a2.setAttribute('class', '<?php echo $prefix; ?>tabclose'); + a2.setAttribute('className', '<?php echo $prefix; ?>tabclose'); // for IE6 var img = document.createElement('img'); img.setAttribute('src', '<?php echo $c->getFileUrlFromTheme('images/tab_remove.gif'); ?>'); a2.appendChild(img); @@ -226,7 +248,9 @@ var div_content = document.createElement('div'); div_content.setAttribute('id', '<?php echo $prefix; ?>channel_content'+tabid); - Element.addClassName(div_content, '<?php echo $prefix; ?>content'); + // Element.addClassName(div_content, '<?php echo $prefix; ?>content'); + div_content.setAttribute('class', '<?php echo $prefix; ?>content'); + div_content.setAttribute('className', '<?php echo $prefix; ?>content'); // for IE6 div_content.style.display = 'none'; var div_chat = this.getChatContentFromTabId(tabid); @@ -245,7 +269,7 @@ */ notifyTab: function(tabid) { - var tabpos = this.tabids.indexOf(tabid); + var tabpos = indexOf(this.tabids, tabid); var tabtype = this.tabtypes[tabpos]; var img = $('<?php echo $prefix; ?>tabimg'+tabid); if (img) @@ -262,7 +286,7 @@ */ unnotifyTab: function(tabid) { - var tabpos = this.tabids.indexOf(tabid); + var tabpos = indexOf(this.tabids, tabid); var tabtype = this.tabtypes[tabpos]; var img = $('<?php echo $prefix; ?>tabimg'+tabid); if (img) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-28 13:18:41
|
Revision: 632 Author: kerphi Date: 2006-06-28 06:18:35 -0700 (Wed, 28 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=632&view=rev Log Message: ----------- fix a javascript warning Modified Paths: -------------- trunk/themes/default/templates/pfcgui.js.tpl.php Modified: trunk/themes/default/templates/pfcgui.js.tpl.php =================================================================== --- trunk/themes/default/templates/pfcgui.js.tpl.php 2006-06-27 20:11:04 UTC (rev 631) +++ trunk/themes/default/templates/pfcgui.js.tpl.php 2006-06-28 13:18:35 UTC (rev 632) @@ -81,7 +81,8 @@ content.scrollTop = this.scrollpos[tabid]; // scroll the new posted message - if (this.elttoscroll[tabid].length > 0) + if (this.elttoscroll[tabid] && + this.elttoscroll[tabid].length > 0) { // on by one for (var i=0; i<this.elttoscroll[tabid].length; i++) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-27 20:11:17
|
Revision: 631 Author: kerphi Date: 2006-06-27 13:11:04 -0700 (Tue, 27 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=631&view=rev Log Message: ----------- Show the join notice everytime Modified Paths: -------------- trunk/src/commands/join.class.php Modified: trunk/src/commands/join.class.php =================================================================== --- trunk/src/commands/join.class.php 2006-06-27 20:10:30 UTC (rev 630) +++ trunk/src/commands/join.class.php 2006-06-27 20:11:04 UTC (rev 631) @@ -33,13 +33,13 @@ // clear the cached nicknames list for the given channel $nicklist_sid = $c->prefix."nicklist_".$c->getId()."_".$clientid."_".$chanid; $_SESSION[$nicklist_sid] = NULL; - - // show a join message - $cmd =& pfcCommand::Factory("notice"); - $cmd->run($xml_reponse, $clientid, _pfc("%s joins %s",$u->nick, $channame), $sender, $chanrecip, $chanid, 1); } + // show a join message + $cmd =& pfcCommand::Factory("notice"); + $cmd->run($xml_reponse, $clientid, _pfc("%s joins %s",$u->nick, $channame), $sender, $chanrecip, $chanid, 1); + //$xml_reponse->addScript("alert('join: chan=".$channame.", from_id=".$from_id."');"); // $xml_reponse->addScript("alert('join: u->nick=".$u->nick." chanid=".$chanid." channame=".addslashes($channame)."');"); // $xml_reponse->addScript("alert('join: fromidsid=".$from_id_sid."');"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-27 20:10:42
|
Revision: 630 Author: kerphi Date: 2006-06-27 13:10:30 -0700 (Tue, 27 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=630&view=rev Log Message: ----------- Don't allow to send a message when the user is not connected Modified Paths: -------------- trunk/src/commands/send.class.php Modified: trunk/src/commands/send.class.php =================================================================== --- trunk/src/commands/send.class.php 2006-06-27 20:05:18 UTC (rev 629) +++ trunk/src/commands/send.class.php 2006-06-27 20:10:30 UTC (rev 630) @@ -12,7 +12,14 @@ $text = phpFreeChat::PreFilterMsg($param); - + // send an error because the current user is not connected + if (!$u->active) + { + $cmd =& pfcCommand::Factory("error"); + $cmd->run($xml_reponse, $clientid, _pfc("Your must be connected to send a message"), $sender, $recipient, $recipientid); + return; + } + // $offline = $container->getMeta("offline", "nickname", $u->privmsg[$recipientid]["name"]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-27 20:05:39
|
Revision: 629 Author: kerphi Date: 2006-06-27 13:05:18 -0700 (Tue, 27 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=629&view=rev Log Message: ----------- Now /quit will leave the joined channels Modified Paths: -------------- trunk/src/commands/quit.class.php Modified: trunk/src/commands/quit.class.php =================================================================== --- trunk/src/commands/quit.class.php 2006-06-27 19:58:06 UTC (rev 628) +++ trunk/src/commands/quit.class.php 2006-06-27 20:05:18 UTC (rev 629) @@ -21,15 +21,15 @@ foreach( $u->channels as $id => $chandetail ) if ($container->removeNick($chandetail["recipient"], $u->nick)) { - $cmd =& pfcCommand::Factory("notice"); - $cmd->run($xml_reponse, $clientid, $quitmsg, $sender, $chandetail["recipient"], $id, 2); + $cmd =& pfcCommand::Factory("leave"); + $cmd->run($xml_reponse, $clientid, $id, $sender, $chandetail["recipient"], $id, 2); } // from the private messages foreach( $u->privmsg as $id => $pvdetail ) if ($container->removeNick($pvdetail["recipient"], $u->nick)) { - $cmd =& pfcCommand::Factory("notice"); - $cmd->run($xml_reponse, $clientid, $quitmsg, $sender, $pvdetail["recipient"], $id, 2); + $cmd =& pfcCommand::Factory("leave"); + $cmd->run($xml_reponse, $clientid, $id, $sender, $pvdetail["recipient"], $id, 2); } // from the server $container->removeNick(NULL, $u->nick); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-27 19:58:16
|
Revision: 628 Author: kerphi Date: 2006-06-27 12:58:06 -0700 (Tue, 27 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=628&view=rev Log Message: ----------- Bug fix: after two click on channels tabs, the page was reloaded Modified Paths: -------------- trunk/themes/default/templates/pfcgui.js.tpl.php Modified: trunk/themes/default/templates/pfcgui.js.tpl.php =================================================================== --- trunk/themes/default/templates/pfcgui.js.tpl.php 2006-06-25 21:49:35 UTC (rev 627) +++ trunk/themes/default/templates/pfcgui.js.tpl.php 2006-06-27 19:58:06 UTC (rev 628) @@ -204,7 +204,7 @@ Element.addClassName(a1, '<?php echo $prefix; ?>tabtitle'); a1.appendChild(img); a1.appendChild(document.createTextNode(name)); - a1.setAttribute('href', ''); + a1.setAttribute('href', '#'); a1.pfc_tabid = tabid; a1.onclick = function(){pfc.gui.setTabById(this.pfc_tabid); return false;} li_div.appendChild(a1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-25 21:49:48
|
Revision: 627 Author: kerphi Date: 2006-06-25 14:49:35 -0700 (Sun, 25 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=627&view=rev Log Message: ----------- New hungarian translation hu_HU (thanks to Keratomi) Modified Paths: -------------- trunk/demo/index.php Added Paths: ----------- trunk/demo/demo46_in_hungarian.php trunk/i18n/hu_HU/ trunk/i18n/hu_HU/main.php Added: trunk/demo/demo46_in_hungarian.php =================================================================== --- trunk/demo/demo46_in_hungarian.php (rev 0) +++ trunk/demo/demo46_in_hungarian.php 2006-06-25 21:49:35 UTC (rev 627) @@ -0,0 +1,36 @@ +<?php + +require_once dirname(__FILE__)."/../src/phpfreechat.class.php"; + +$params["serverid"] = md5(__FILE__); // calculate a unique id for this chat +$params["language"] = "hu_HU"; +$chat = new phpFreeChat( $params ); + +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8" /> + <title>phpFreeChat demo</title> + + <?php $chat->printJavascript(); ?> + <?php $chat->printStyle(); ?> + + </head> + + <body> + <?php $chat->printChat(); ?> + +<?php + // print the current file + echo "<h2>The source code</h2>"; + $filename = __FILE__; + echo "<p><code>".$filename."</code></p>"; + echo "<pre style=\"margin: 0 50px 0 50px; padding: 10px; background-color: #DDD;\">"; + $content = file_get_contents($filename); + echo htmlentities($content); + echo "</pre>"; +?> + + </body> +</html> \ No newline at end of file Modified: trunk/demo/index.php =================================================================== --- trunk/demo/index.php 2006-06-25 20:31:55 UTC (rev 626) +++ trunk/demo/index.php 2006-06-25 21:49:35 UTC (rev 627) @@ -143,6 +143,7 @@ <li><a href="demo41_in_greek.php">demo41 - the greek translation of the chat</a></li> <li><a href="demo42_in_chinese_from_taiwan.php">demo42 - the Chinese from taiwan (traditional Chinese) translation of the chat</a></li> <li><a href="demo45_in_bulgarian.php">demo45 - the Bulgarian translation of the chat</a></li> + <li><a href="demo46_in_hungarian.php">demo46 - the Hungarian translation of the chat</a></li> </ul> </div> Added: trunk/i18n/hu_HU/main.php =================================================================== --- trunk/i18n/hu_HU/main.php (rev 0) +++ trunk/i18n/hu_HU/main.php 2006-06-25 21:49:35 UTC (rev 627) @@ -0,0 +1,178 @@ +<?php +/** + * i18n/hu_HU/main.php + * + * Copyright © 2006 Stephane Gully <ste...@gm...> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +/** + * Hungarian translation of the messages (utf8 encoded!) + * + * @author Stephane Gully <ste...@gm...> + * @translated by Keratomi <ker...@fr...> + */ + +// line 45 in phpfreechatconfig.class.php +$GLOBALS["i18n"]["My Chat"] = "Az én csetem"; + +// line 201 in phpfreechatconfig.class.php +$GLOBALS["i18n"]["%s not found, %s library can't be found."] = "%s nem található, %s könyvtár nem található."; + +// line 355 in phpfreechat.class.php +$GLOBALS["i18n"]["Please enter your nickname"] = "Kérlek írd be a beceved"; + +// line 565 in phpfreechat.class.php +$GLOBALS["i18n"]["Text cannot be empty"] = "Üzenetet is írj!"; + +// line 392 in phpfreechat.class.php +$GLOBALS["i18n"]["%s changes his nickname to %s"] = "%s megváltoztatta a becenevét erre: %s"; + +// line 398 in phpfreechat.class.php +$GLOBALS["i18n"]["%s is connected"] = "%s bekapcsolódott a beszélgetésbe"; + +// line 452 in phpfreechat.class.php +$GLOBALS["i18n"]["%s quit"] = "%s kilépett a beszélgetésből"; + +// line 468 in phpfreechat.class.php +$GLOBALS["i18n"]["%s disconnected (timeout)"] = "%s szétkapcsolva (időtúllépés)"; + +// line 262 in phpfreechat.class.php +$GLOBALS["i18n"]["Unknown command [%s]"] = "Ismeretlen parancs [%s]"; + +// line 149 in phpfreechatconfig.class.php +$GLOBALS["i18n"]["%s doesn't exist: %s"] = "%s nem létezik: %s"; + +// line 180 in phpfreechatconfig.class.php +$GLOBALS["i18n"]["You need %s"] = "Szükséges verzió: %s"; + +// line 241 in phpfreechatconfig.class.php +$GLOBALS["i18n"]["%s doesn't exist, %s library can't be found"] = "%s nem létezik, %s könyvtár nem található"; + +// line 280 in phpfreechatconfig.class.php +$GLOBALS["i18n"]["%s doesn't exist"] = "%s nem létezik"; + +// line 433 in phpfreechatconfig.class.php +$GLOBALS["i18n"]["%s directory must be specified"] = "%s mappát kell megadni"; + +// line 439 in phpfreechatconfig.class.php +$GLOBALS["i18n"]["%s must be a directory"] = "%s mappát kell megadni"; + +// line 446 in phpfreechatconfig.class.php +$GLOBALS["i18n"]["%s can't be created"] = "%s nem hozható létre"; + +// line 451 in phpfreechatconfig.class.php +$GLOBALS["i18n"]["%s is not writeable"] = "%s nem írható"; + +// line 496 in phpfreechatconfig.class.php +$GLOBALS["i18n"]["%s is not readable"] = "%s nem olvasható"; + +// line 469 in phpfreechatconfig.class.php +$GLOBALS["i18n"]["%s is not a file"] = "%s nem fájl"; + +// line 491 in phpfreechatconfig.class.php +$GLOBALS["i18n"]["%s is not a directory"] = "%s nem mappa"; + +// line 23 in chat.html.tpl.php +$GLOBALS["i18n"]["PHP FREE CHAT [powered by phpFreeChat-%s]"] = "PHP FREE CHAT [készítette: phpFreeChat-%s]"; + +// line 296 in javascript1.js.tpl.php +$GLOBALS["i18n"]["Hide nickname marker"] = "Becenév színének rejtése"; + +// line 304 in javascript1.js.tpl.php +$GLOBALS["i18n"]["Show nickname marker"] = "Becenév színének mutatása"; + +// line 389 in javascript1.js.tpl.php +$GLOBALS["i18n"]["Disconnect"] = "Szétkapcsolás"; + +// line 395 in javascript1.js.tpl.php +$GLOBALS["i18n"]["Connect"] = "Kapcsolódás"; + +// line 427 in javascript1.js.tpl.php +$GLOBALS["i18n"]["Magnify"] = "Nagyítás"; + +// line 434 in javascript1.js.tpl.php +$GLOBALS["i18n"]["Cut down"] = "Kivágás"; + +// line 345 in javascript1.js.tpl.php +$GLOBALS["i18n"]["Hide dates and hours"] = "Dátum és idő elrejtése"; + +// line 353 in javascript1.js.tpl.php +$GLOBALS["i18n"]["Show dates and hours"] = "Dátum és idő mutatása"; + +// line 21 in chat.html.tpl.php +$GLOBALS["i18n"]["Enter your message here"] = "Ide írd az üzeneted"; + +// line 24 in chat.html.tpl.php +$GLOBALS["i18n"]["Enter your nickname here"] = "Ide írd a beceneved"; + +// line 93 in phpfreechatconfig.class.php +$GLOBALS["i18n"]["Error: undefined or obsolete parameter '%s', please correct or remove this parameter"] = "Hiba: meghatározatlan vagy elavult paraméter '%s', kérlek javítsd, vagy távolítsd el"; + +// line 86 in pfcclient.js.tpl.php +$GLOBALS["i18n"]["Hide smiley box"] = "Hangulatjelek elrejtése"; + +// line 87 in pfcclient.js.tpl.php +$GLOBALS["i18n"]["Show smiley box"] = "Hangulatjelek mutatása"; + +// line 88 in pfcclient.js.tpl.php +$GLOBALS["i18n"]["Hide online users box"] = "Belépett felhasználók elrejtése"; + +// line 89 in pfcclient.js.tpl.php +$GLOBALS["i18n"]["Show online users box"] = "Belépett felhasználók mutatása"; + +// line 33 in chat.html.tpl.php +$GLOBALS["i18n"]["Bold"] = "Félkövér"; + +// line 34 in chat.html.tpl.php +$GLOBALS["i18n"]["Italics"] = "Dőlt"; + +// line 35 in chat.html.tpl.php +$GLOBALS["i18n"]["Underline"] = "Aláhúzott"; + +// line 36 in chat.html.tpl.php +$GLOBALS["i18n"]["Delete"] = "Törlés"; + +// line 37 in chat.html.tpl.php +$GLOBALS["i18n"]["Pre"] = "Formázott"; + +// line 38 in chat.html.tpl.php +$GLOBALS["i18n"]["Mail"] = "E-mail"; + +// line 39 in chat.html.tpl.php +$GLOBALS["i18n"]["Color"] = "Szín"; + +// line 48 in phpfreechattemplate.class.php +$GLOBALS["i18n"]["%s template could not be found"] = "%s sablon nem található"; + +// line 512 in phpfreechatconfig.class.php +$GLOBALS["i18n"]["Error: '%s' could not be found, please check your themepath '%s' and your theme '%s' are correct"] = "Hiba: '%s' nem található, kérlek ellenőrizd a témák mappa elérési útját '%s' és hogy a kiválasztott táma létezik-e: '%s'"; + +// line 75 in pfccommand.class.php +$GLOBALS["i18n"]["%s must be implemented"] = "Parancsvégrehajtás: %s"; + + +// line 343 in phpfreechatconfig.class.php +$GLOBALS["i18n"]["'%s' parameter is mandatory by default use '%s' value"] = "'%s' paraméter kötelező értéke: '%s'"; + +// line 378 in phpfreechatconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a positive number"] = "'%s' csak pozitív szám lehet"; + +// line 386 in phpfreechatconfig.class.php +$GLOBALS["i18n"]["'%s' parameter is not valid. Available values are : '%s'"] = "'%s' nem érvényes paraméter. Lehetséges értékei: '%s'"; + +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-25 20:32:03
|
Revision: 626 Author: kerphi Date: 2006-06-25 13:31:55 -0700 (Sun, 25 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=626&view=rev Log Message: ----------- check if the 'channels' parameter value is really an array of strings Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-06-24 20:09:32 UTC (rev 625) +++ trunk/src/pfcglobalconfig.class.php 2006-06-25 20:31:55 UTC (rev 626) @@ -175,7 +175,7 @@ if ($this->xajaxpath == "") $this->xajaxpath = dirname(__FILE__)."/../lib/xajax_0.2.3"; if ($this->jspath == "") $this->jspath = dirname(__FILE__)."/../lib/javascript"; if ($this->csstidypath == "") $this->csstidypath = dirname(__FILE__)."/../lib/csstidy-1.1"; - if (count($this->channels) == 0) $this->channels = array(_pfc("My room")); + if (is_array($this->channels) && count($this->channels) == 0) $this->channels = array(_pfc("My room")); // first of all, check the used functions $f_list["file_get_contents"] = _pfc("You need %s", "PHP 4 >= 4.3.0 or PHP 5"); @@ -313,7 +313,17 @@ // check the serverid is really defined if ($this->serverid == "") $this->errors[] = _pfc("'%s' parameter is mandatory by default use '%s' value", "serverid", "md5(__FILE__)"); - + + // check if channels parameter is a strings array + if (!is_array($this->channels)) + $this->errors[] = _pfc("'%s' parameter must be an array", "channels"); + else + foreach($this->channels as $chan) + { + if (!is_string($chan)) + $this->errors[] = _pfc("'%s' value must be a string", serialize($chan)); + } + // check the max_msg is >= 0 if (!is_numeric($this->max_msg) || $this->max_msg < 0) $this->errors[] = _pfc("'%s' parameter must be a positive number", "max_msg"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-24 20:09:52
|
Revision: 625 Author: kerphi Date: 2006-06-24 13:09:32 -0700 (Sat, 24 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=625&view=rev Log Message: ----------- new command: "/identify {password}" used to take admin rights Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php trunk/themes/default/templates/pfcclient.js.tpl.php Added Paths: ----------- trunk/src/commands/identify.class.php Added: trunk/src/commands/identify.class.php =================================================================== --- trunk/src/commands/identify.class.php (rev 0) +++ trunk/src/commands/identify.class.php 2006-06-24 20:09:32 UTC (rev 625) @@ -0,0 +1,67 @@ +<?php +/** + * identify.class.php + * + * Copyright © 2006 Stephane Gully <ste...@gm...> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +require_once(dirname(__FILE__)."/../pfccommand.class.php"); + +/** + * pfcCommand_identify + * this command will identify the user admin rights + * @author Stephane Gully <ste...@gm...> + */ +class pfcCommand_identify extends pfcCommand +{ + var $usage = "/identify {password}"; + + function run(&$xml_reponse, $clientid, $param, $sender, $recipient, $recipientid) + { + $c =& $this->c; + $u =& $this->u; + + $password = trim($param); + $isadmin = false; + + // @todo simplify the search in the admins config array using a native php function (array_search?) + foreach($c->admins as $a_nick => $a_pass) + { + if ($a_nick == $sender && $a_pass == $password) + $isadmin = true; + } + + $msg = ""; + if ($isadmin) + { + // ok the current user is an admin, just save the isadmin flag in the metadata + $container =& $c->getContainerInstance(); + $container->setMeta($isadmin, "isadmin", "nickname", $u->nickid); + + $msg .= _pfc("Succesfully identified"); + $xml_reponse->addScript("pfc.handleResponse('".$this->name."', 'ok', '".$msg."');"); + } + else + { + $msg .= _pfc("Identification failure"); + $xml_reponse->addScript("pfc.handleResponse('".$this->name."', 'ko', '".$msg."');"); + } + } +} + +?> \ No newline at end of file Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-06-24 20:08:36 UTC (rev 624) +++ trunk/src/pfcglobalconfig.class.php 2006-06-24 20:09:32 UTC (rev 625) @@ -35,6 +35,7 @@ // these parameters are dynamic (not cached) var $nick = ""; // the initial nickname ("" means the user will be queried) var $isadmin = false; + var $admins = array("admin" => ""); // nicknames is the key, password is the value // these parameters are static (cached) var $proxys = array("auth", "noflood"); Modified: trunk/themes/default/templates/pfcclient.js.tpl.php =================================================================== --- trunk/themes/default/templates/pfcclient.js.tpl.php 2006-06-24 20:08:36 UTC (rev 624) +++ trunk/themes/default/templates/pfcclient.js.tpl.php 2006-06-24 20:09:32 UTC (rev 625) @@ -390,6 +390,10 @@ var container = this.gui.getChatContentFromTabId(tabid); container.innerHTML = ""; } + else if (cmd == "identify") + { + this.displayMsg( cmd, param ); + } else alert(cmd + "-"+resp+"-"+param); }, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-24 20:08:40
|
Revision: 624 Author: kerphi Date: 2006-06-24 13:08:36 -0700 (Sat, 24 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=624&view=rev Log Message: ----------- the smiley box was hidden at first launch Modified Paths: -------------- trunk/themes/default/templates/chat.js.tpl.php Modified: trunk/themes/default/templates/chat.js.tpl.php =================================================================== --- trunk/themes/default/templates/chat.js.tpl.php 2006-06-24 20:07:30 UTC (rev 623) +++ trunk/themes/default/templates/chat.js.tpl.php 2006-06-24 20:08:36 UTC (rev 624) @@ -8,6 +8,7 @@ <?php if ($connect_at_startup) { ?> pfc.connect_disconnect(); <?php } ?> +pfc.refresh_Smileys(); <?php if ($debugxajax) { ?> xajax.DebugMessage = function(text) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-24 20:07:36
|
Revision: 623 Author: kerphi Date: 2006-06-24 13:07:30 -0700 (Sat, 24 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=623&view=rev Log Message: ----------- Now the flooder is kicked Modified Paths: -------------- trunk/src/proxys/noflood.class.php Modified: trunk/src/proxys/noflood.class.php =================================================================== --- trunk/src/proxys/noflood.class.php 2006-06-24 20:05:49 UTC (rev 622) +++ trunk/src/proxys/noflood.class.php 2006-06-24 20:07:30 UTC (rev 623) @@ -35,7 +35,7 @@ $c =& $this->c; $u =& $this->u; - $cmdtocheck = array("send", "nick", "me", "notice"); + $cmdtocheck = array("send", "nick", "me"); if ( in_array($this->name, $cmdtocheck) ) { $container =& $c->getContainerInstance(); @@ -56,6 +56,14 @@ $msg = _pfc("Please don't post so many message, flood is not tolerated"); $xml_reponse->addScript("alert('".addslashes($msg)."');"); // @todo kick the user + + + $msg = $recipientid." "; + $msg .=_pfc("kicked from %s by %s", $u->channels[$recipientid]["name"], "noflood"); + $cmd =& pfcCommand::Factory("leave"); + $cmd->run($xml_reponse, $clientid, $msg, $sender, $recipient, $recipientid); + + return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-24 20:05:56
|
Revision: 622 Author: kerphi Date: 2006-06-24 13:05:49 -0700 (Sat, 24 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=622&view=rev Log Message: ----------- by default the copy_r function must give 644 rights to files Modified Paths: -------------- trunk/src/pfctools.php Modified: trunk/src/pfctools.php =================================================================== --- trunk/src/pfctools.php 2006-06-17 20:22:04 UTC (rev 621) +++ trunk/src/pfctools.php 2006-06-24 20:05:49 UTC (rev 622) @@ -103,7 +103,7 @@ } -function mkdir_r($path, $mode = 0700) +function mkdir_r($path, $modedir = 0700) { // This function creates the specified directory using mkdir(). Note // that the recursive feature on mkdir() is broken with PHP 5.0.4 for @@ -112,8 +112,8 @@ { // The directory doesn't exist. Recurse, passing in the parent // directory so that it gets created. - mkdir_r(dirname($path), $mode); - mkdir($path, $mode); + mkdir_r(dirname($path), $modedir); + mkdir($path, $modedir); } } @@ -137,18 +137,18 @@ * @param string $dest Destination path * @return bool Returns TRUE on success, FALSE on failure */ -function copy_r($source, $dest, $mode = 0700) +function copy_r($source, $dest, $modedir = 0700, $modefile = 0644) { // Simple copy for a file if (is_file($source)) { $ret = copy($source, $dest); - chmod($dest, $mode); + chmod($dest, $modefile); return $ret; } // Make destination directory if (!is_dir($dest)) { - mkdir($dest, $mode); + mkdir($dest, $modedir); } // Take the directories entries @@ -166,7 +166,7 @@ if ($e == '.' || $e == '..' || $e == '.svn') continue; // Deep copy directories if ($dest !== $source . DIRECTORY_SEPARATOR . $e) - copy_r($source . DIRECTORY_SEPARATOR . $e, $dest . DIRECTORY_SEPARATOR . $e, $mode); + copy_r($source . DIRECTORY_SEPARATOR . $e, $dest . DIRECTORY_SEPARATOR . $e, $modedir, $modefile); } // Clean up This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-17 20:22:13
|
Revision: 621 Author: kerphi Date: 2006-06-17 13:22:04 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=621&view=rev Log Message: ----------- 1.0-beta2 tag Added Paths: ----------- tags/1.0-beta2/ Copied: tags/1.0-beta2 (from rev 620, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-17 18:45:18
|
Revision: 620 Author: kerphi Date: 2006-06-17 11:45:12 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=620&view=rev Log Message: ----------- Bug fix: the nickname list update was broken because of a cache problem Modified Paths: -------------- trunk/src/commands/getonlinenick.class.php Modified: trunk/src/commands/getonlinenick.class.php =================================================================== --- trunk/src/commands/getonlinenick.class.php 2006-06-17 18:36:48 UTC (rev 619) +++ trunk/src/commands/getonlinenick.class.php 2006-06-17 18:45:12 UTC (rev 620) @@ -24,15 +24,15 @@ // get the real nickname list $users = $container->getOnlineNick($recipient); - if ($oldnicklist != $users["nickid"]) // check if the nickname list must be updated on the client side - { - $_SESSION[$nicklist_sid] = $users["nickid"]; - - // sort the nicknames - $nicklist = array(); + $nicklist = array(); + if (isset($users["nickid"])) foreach($users["nickid"] as $nid) $nicklist[] = $container->getNickname($nid); - sort($nicklist); + sort($nicklist); + + if ($oldnicklist != $nicklist) // check if the nickname list must be updated on the client side + { + $_SESSION[$nicklist_sid] = $nicklist; if ($c->debug) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-17 18:36:55
|
Revision: 619 Author: kerphi Date: 2006-06-17 11:36:48 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=619&view=rev Log Message: ----------- remove the 'width' error Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-06-17 18:33:29 UTC (rev 618) +++ trunk/src/pfcglobalconfig.class.php 2006-06-17 18:36:48 UTC (rev 619) @@ -337,15 +337,6 @@ $lg_list = pfcI18N::GetAcceptedLanguage(); if ( $this->language != "" && !in_array($this->language, $lg_list) ) $this->errors[] = _pfc("'%s' parameter is not valid. Available values are : '%s'", "language", implode(", ", $lg_list)); - - // check the width parameter is not used - // because of a display bug in IE - if ( $this->width != "" && - $this->width != "auto" ) - { - $this->errors[] = "Do not uses 'width' parameter because of a display bug in IE6, please look at this workaround : http://www.phpfreechat.net/forum/viewtopic.php?pid=867#p867"; - $ok = false; - } // load smileys from file $this->loadSmileyTheme(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-17 18:33:34
|
Revision: 618 Author: kerphi Date: 2006-06-17 11:33:29 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=618&view=rev Log Message: ----------- adapte the blune to the new 1.x branche Modified Paths: -------------- trunk/themes/blune/templates/style.css.tpl.php Modified: trunk/themes/blune/templates/style.css.tpl.php =================================================================== --- trunk/themes/blune/templates/style.css.tpl.php 2006-06-17 18:20:22 UTC (rev 617) +++ trunk/themes/blune/templates/style.css.tpl.php 2006-06-17 18:33:29 UTC (rev 618) @@ -5,7 +5,7 @@ background-image: url(<?php echo $c->getFileUrlFromTheme('images/shade.gif'); ?>); } -div#<?php echo $prefix; ?>chat { +div.<?php echo $prefix; ?>chat { background-color:#CED4DF; } @@ -14,6 +14,7 @@ } div.<?php echo $prefix; ?>oldmsg { + background-image: none; background-color:#DCDEE4; } @@ -25,24 +26,34 @@ border: 1px solid #000; } -div#<?php echo $prefix; ?>online { - height: 48%; -} - -div#<?php echo $prefix; ?>smileys { - height: 48%; -} - p#<?php echo $prefix; ?>errors { display: none; margin-top: 5px; padding: 2px; height: 18px; - border: black solid 1px; + border: #555 solid 1px; color: #EC4A1F; background-color: #BEC5D0; text-align: center; font-style: italic; font-weight: bold; -} \ No newline at end of file +} + +ul#<?php echo $prefix; ?>channels_list li div { + background-color: #bec5d0; + border-bottom: 1px solid #bec5d0; +} +ul#<?php echo $prefix; ?>channels_list li.selected div { + background-color: #CED4DF; + border-bottom: 1px solid #CED4DF; + color: #000; + font-weight: bold; +} +ul#<?php echo $prefix; ?>channels_list li > div:hover { + background-color: #CED4DF; + border-bottom: 1px solid #CED4DF; +} +ul#<?php echo $prefix; ?>channels_list li.selected > div:hover { + background-color: #CED4DF; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |