phpfreechat-svn Mailing List for phpFreeChat (Page 20)
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-09-23 15:49:08
|
Revision: 792 http://svn.sourceforge.net/phpfreechat/?rev=792&view=rev Author: kerphi Date: 2006-09-23 08:49:00 -0700 (Sat, 23 Sep 2006) Log Message: ----------- tag 1.0-beta6 release Added Paths: ----------- tags/1.0-beta6/ Copied: tags/1.0-beta6 (from rev 791, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-23 10:38:16
|
Revision: 791 http://svn.sourceforge.net/phpfreechat/?rev=791&view=rev Author: kerphi Date: 2006-09-23 03:38:08 -0700 (Sat, 23 Sep 2006) Log Message: ----------- some little fixes Modified Paths: -------------- trunk/demo/demo28_blune_theme.php trunk/demo/demo28_mini_blune_theme.php trunk/src/phpfreechat.class.php Modified: trunk/demo/demo28_blune_theme.php =================================================================== --- trunk/demo/demo28_blune_theme.php 2006-09-23 10:22:37 UTC (rev 790) +++ trunk/demo/demo28_blune_theme.php 2006-09-23 10:38:08 UTC (rev 791) @@ -2,7 +2,6 @@ require_once dirname(__FILE__)."/../src/phpfreechat.class.php"; $params = array("title" => "Blune PHPFreeChat", "max_msg" => 21, - "prefix" => "blune_", "clock" => false, "serverid" => md5(__FILE__), "theme" => "blune", Modified: trunk/demo/demo28_mini_blune_theme.php =================================================================== --- trunk/demo/demo28_mini_blune_theme.php 2006-09-23 10:22:37 UTC (rev 790) +++ trunk/demo/demo28_mini_blune_theme.php 2006-09-23 10:38:08 UTC (rev 791) @@ -2,7 +2,6 @@ require_once dirname(__FILE__)."/../src/phpfreechat.class.php"; $params = array("title" => "Blune PHPFreeChat", "max_msg" => 21, - "prefix" => "blune_", "clock" => false, "showwhosonline" => false, "showsmileys" => false, Modified: trunk/src/phpfreechat.class.php =================================================================== --- trunk/src/phpfreechat.class.php 2006-09-23 10:22:37 UTC (rev 790) +++ trunk/src/phpfreechat.class.php 2006-09-23 10:38:08 UTC (rev 791) @@ -455,7 +455,7 @@ // do not update when the user just quit if ($rawcmd != "update" && $rawcmd != "quit" && - $u->nick != "") + (!isset($u->nick) || $u->nick != "")) { // force an update just after a command is sent // thus the message user just poster is really fastly displayed This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-23 10:22:59
|
Revision: 790 http://svn.sourceforge.net/phpfreechat/?rev=790&view=rev Author: kerphi Date: 2006-09-23 03:22:37 -0700 (Sat, 23 Sep 2006) Log Message: ----------- [en] BBCode colors are now more flexible : I just added a transparent image with variable background colors. [45min] [fr] Les couleurs BBCode sont maintenant plus flexibles : J'ai ajout?\195?\169 une image transparente avec un fond de couleur variable. [45min] Modified Paths: -------------- trunk/src/client/chat.js.tpl.php trunk/src/client/pfcclient.js trunk/src/client/pfcgui.js Added Paths: ----------- trunk/themes/default/images/color_transparent.gif Removed Paths: ------------- trunk/themes/default/images/color_000000.gif trunk/themes/default/images/color_000055.gif trunk/themes/default/images/color_0000FF.gif trunk/themes/default/images/color_008000.gif trunk/themes/default/images/color_008080.gif trunk/themes/default/images/color_00FF00.gif trunk/themes/default/images/color_00FFFF.gif trunk/themes/default/images/color_7F7F7F.gif trunk/themes/default/images/color_800000.gif trunk/themes/default/images/color_800080.gif trunk/themes/default/images/color_D2D2D2.gif trunk/themes/default/images/color_FF0000.gif trunk/themes/default/images/color_FF00FF.gif trunk/themes/default/images/color_FF5500.gif trunk/themes/default/images/color_FFFF00.gif trunk/themes/default/images/color_FFFFFF.gif Modified: trunk/src/client/chat.js.tpl.php =================================================================== --- trunk/src/client/chat.js.tpl.php 2006-09-23 09:37:09 UTC (rev 789) +++ trunk/src/client/chat.js.tpl.php 2006-09-23 10:22:37 UTC (rev 790) @@ -118,12 +118,9 @@ 'images/bt_del.gif', 'images/bt_mail.gif', 'images/bt_color.gif', + 'images/color_transparent.gif', ); -// convert bbcode color value list to a bbcode color url list -function get_bbcode_color_url($v) { return 'images/color_'.substr($v,1).'.gif'; } -$bbcode_clist = array_map("get_bbcode_color_url", $bbcode_colorlist); -$fileurl_to_load = array_merge($fileurl_to_load, $bbcode_clist); foreach($fileurl_to_load as $f) { echo "pfc.res.setFileUrl('".$f."',pfc_proxy_url+'".$c->getFileUrlByProxy($f,false)."');\n"; Modified: trunk/src/client/pfcclient.js =================================================================== --- trunk/src/client/pfcclient.js 2006-09-23 09:37:09 UTC (rev 789) +++ trunk/src/client/pfcclient.js 2006-09-23 10:22:37 UTC (rev 790) @@ -1257,13 +1257,16 @@ /* clear any existing borders on the color buttons */ var colorbtn = this.getElementsByClassName($('pfc_colorlist'), 'pfc_color', ''); for(var i = 0; colorbtn.length > i; i++) + { colorbtn[i].style.border = 'none'; + colorbtn[i].style.padding = '0'; + } /* assign the new border style to the selected button */ this.current_text_color = color; setCookie('pfc_current_text_color', this.current_text_color); var idname = 'pfc_color_' + color; - $(idname).style.border = '1px solid #666'; + $(idname).style.border = '1px solid #555'; $(idname).style.padding = '1px'; // assigne the new color to the input text box Modified: trunk/src/client/pfcgui.js =================================================================== --- trunk/src/client/pfcgui.js 2006-09-23 09:37:09 UTC (rev 789) +++ trunk/src/client/pfcgui.js 2006-09-23 10:22:37 UTC (rev 790) @@ -596,15 +596,16 @@ for (var i=0 ; i<clist_v.length ; i++) { var bbc = clist_v[i]; - var img = document.createElement('img'); - img.bbc = bbc; - img.setAttribute('class', 'pfc_color'); - img.setAttribute('className', 'pfc_color'); // for IE6 - img.setAttribute('id', 'pfc_color_'+bbc); - img.setAttribute('src', pfc.res.getFileUrl('images/color_'+bbc+'.gif')); - img.setAttribute('alt', bbc); - img.onclick = function(){ pfc.switch_text_color(this.bbc); } - clist.appendChild(img); + var elt = document.createElement('img'); + elt.bbc = bbc; + elt.setAttribute('class', 'pfc_color'); + elt.setAttribute('className', 'pfc_color'); // for IE6 + elt.setAttribute('id', 'pfc_color_'+bbc); + elt.style.backgroundColor = '#'+bbc; + elt.setAttribute('src', pfc.res.getFileUrl('images/color_transparent.gif')); + elt.setAttribute('alt', bbc); + elt.onclick = function(){ pfc.switch_text_color(this.bbc); } + clist.appendChild(elt); } // error box : <p id="pfc_errors"> Deleted: trunk/themes/default/images/color_000000.gif =================================================================== (Binary files differ) Deleted: trunk/themes/default/images/color_000055.gif =================================================================== (Binary files differ) Deleted: trunk/themes/default/images/color_0000FF.gif =================================================================== (Binary files differ) Deleted: trunk/themes/default/images/color_008000.gif =================================================================== (Binary files differ) Deleted: trunk/themes/default/images/color_008080.gif =================================================================== (Binary files differ) Deleted: trunk/themes/default/images/color_00FF00.gif =================================================================== (Binary files differ) Deleted: trunk/themes/default/images/color_00FFFF.gif =================================================================== (Binary files differ) Deleted: trunk/themes/default/images/color_7F7F7F.gif =================================================================== (Binary files differ) Deleted: trunk/themes/default/images/color_800000.gif =================================================================== (Binary files differ) Deleted: trunk/themes/default/images/color_800080.gif =================================================================== (Binary files differ) Deleted: trunk/themes/default/images/color_D2D2D2.gif =================================================================== (Binary files differ) Deleted: trunk/themes/default/images/color_FF0000.gif =================================================================== (Binary files differ) Deleted: trunk/themes/default/images/color_FF00FF.gif =================================================================== (Binary files differ) Deleted: trunk/themes/default/images/color_FF5500.gif =================================================================== (Binary files differ) Deleted: trunk/themes/default/images/color_FFFF00.gif =================================================================== (Binary files differ) Deleted: trunk/themes/default/images/color_FFFFFF.gif =================================================================== (Binary files differ) Added: trunk/themes/default/images/color_transparent.gif =================================================================== (Binary files differ) Property changes on: trunk/themes/default/images/color_transparent.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-23 09:37:19
|
Revision: 789 http://svn.sourceforge.net/phpfreechat/?rev=789&view=rev Author: kerphi Date: 2006-09-23 02:37:09 -0700 (Sat, 23 Sep 2006) Log Message: ----------- prepare 1.0-beta6 Modified Paths: -------------- trunk/version Modified: trunk/version =================================================================== --- trunk/version 2006-09-23 09:36:13 UTC (rev 788) +++ trunk/version 2006-09-23 09:37:09 UTC (rev 789) @@ -1 +1 @@ -1.0-beta5 +1.0-beta6 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-23 09:36:18
|
Revision: 788 http://svn.sourceforge.net/phpfreechat/?rev=788&view=rev Author: kerphi Date: 2006-09-23 02:36:13 -0700 (Sat, 23 Sep 2006) Log Message: ----------- [en] Bug fix: when a user was disconnected by timeout because of his bad connection, when hi comes back he was not correctly reconnected. So, private messages were broken. [1h15] [fr] Bug fix : lorsque un utilisateur est deconnect?\195?\169 par timeout a cause de sa mauvaise connexion, ses metadonnees ne sont pas recrees car il ne repasse pas par la commande /connect. La solution est d'appeler la m?\195?\169thode /connect dans le cas ou l'on d?\195?\169tecte que l'utilisateur n'est plus online juste apr?\195?\168s sa deconnexion au moment du /update suivant. [1h15] Modified Paths: -------------- trunk/src/commands/connect.class.php trunk/src/commands/update.class.php Modified: trunk/src/commands/connect.class.php =================================================================== --- trunk/src/commands/connect.class.php 2006-09-23 09:31:52 UTC (rev 787) +++ trunk/src/commands/connect.class.php 2006-09-23 09:36:13 UTC (rev 788) @@ -11,6 +11,7 @@ $sender = $p["sender"]; $recipient = $p["recipient"]; $recipientid = $p["recipientid"]; + $getoldmsg = isset($p["getoldmsg"]) ? $p["getoldmsg"] : true; $c =& $this->c; $u =& $this->u; @@ -18,26 +19,29 @@ // reset the message id indicator (see getnewmsg.class.php) // i.e. be ready to re-get all last posted messages - require_once(dirname(__FILE__)."/join.class.php"); - $channels = array(); - if (count($u->channels) == 0) - $channels = $c->channels; - else - foreach($u->channels as $chan) - $channels[] = $chan["name"]; - foreach($channels as $channame) + if ($getoldmsg) { - $chanrecip = pfcCommand_join::GetRecipient($channame); - $chanid = pfcCommand_join::GetRecipientId($channame); - // reset the fromid flag - $from_id_sid = "pfc_from_id_".$c->getId()."_".$clientid."_".$chanid; - $from_id = $ct->getLastId($chanrecip)-$c->max_msg; - $_SESSION[$from_id_sid] = ($from_id<0) ? 0 : $from_id; - // reset the oldmsg flag - $oldmsg_sid = "pfc_oldmsg_".$c->getId()."_".$clientid."_".$chanid; - $_SESSION[$oldmsg_sid] = true; + require_once(dirname(__FILE__)."/join.class.php"); + $channels = array(); + if (count($u->channels) == 0) + $channels = $c->channels; + else + foreach($u->channels as $chan) + $channels[] = $chan["name"]; + foreach($channels as $channame) + { + $chanrecip = pfcCommand_join::GetRecipient($channame); + $chanid = pfcCommand_join::GetRecipientId($channame); + // reset the fromid flag + $from_id_sid = "pfc_from_id_".$c->getId()."_".$clientid."_".$chanid; + $from_id = $ct->getLastId($chanrecip)-$c->max_msg; + $_SESSION[$from_id_sid] = ($from_id<0) ? 0 : $from_id; + // reset the oldmsg flag + $oldmsg_sid = "pfc_oldmsg_".$c->getId()."_".$clientid."_".$chanid; + $_SESSION[$oldmsg_sid] = true; + } } - + // check if the user is alone on the server, and give it the admin status if yes $isadmin = $c->isadmin; if (!$isadmin) Modified: trunk/src/commands/update.class.php =================================================================== --- trunk/src/commands/update.class.php 2006-09-23 09:31:52 UTC (rev 787) +++ trunk/src/commands/update.class.php 2006-09-23 09:36:13 UTC (rev 788) @@ -18,7 +18,19 @@ // do not update if user isn't active (didn't connect) if ($u->active) { + // check the user has not been disconnected from the server by timeout + // if I found he has been disconnected, then I reconnect him with /connect command + $ct =& $c->getContainerInstance(); + if ($ct->isNickOnline(NULL, $u->nickid) < 0) + { + $cmd =& pfcCommand::Factory("connect"); + $cmdp = $p; + $cmdp["getoldmsg"] = false; + $cmd->run($xml_reponse, $cmdp); + } + $cmdp = $p; + // update the user nickname timestamp on the server $cmd =& pfcCommand::Factory("updatemynick"); $cmdp["recipient"] = NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-23 09:31:57
|
Revision: 787 http://svn.sourceforge.net/phpfreechat/?rev=787&view=rev Author: kerphi Date: 2006-09-23 02:31:52 -0700 (Sat, 23 Sep 2006) Log Message: ----------- Fix a php notice Modified Paths: -------------- trunk/lib/utf8/utf8_strlen.php Modified: trunk/lib/utf8/utf8_strlen.php =================================================================== --- trunk/lib/utf8/utf8_strlen.php 2006-09-22 20:33:57 UTC (rev 786) +++ trunk/lib/utf8/utf8_strlen.php 2006-09-23 09:31:52 UTC (rev 787) @@ -11,7 +11,7 @@ */ function utf8_strlen($str) { $n=0; - for($i=0; strlen($str{$i}); $i++) { + for($i=0; isset($str{$i}) && strlen($str{$i})>0; $i++) { $c = ord($str{$i}); if (!($c & 0x80)) // single-byte (0xxxxxx) $n++; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-22 20:34:25
|
Revision: 786 http://svn.sourceforge.net/phpfreechat/?rev=786&view=rev Author: kerphi Date: 2006-09-22 13:33:57 -0700 (Fri, 22 Sep 2006) Log Message: ----------- [en] Disk space optimization: when the last user quit a channel or a private room, the messages history is purged in the container. [1h15] [fr] Optimisation de l'espace disque : lorsque le dernier utilisateur quitte un salon ou un chat priv?\195?\169, l'historique des messages est automatiquement effac?\195?\169. [1h15] Modified Paths: -------------- trunk/src/pfccontainer.class.php trunk/src/proxies/checktimeout.class.php Modified: trunk/src/pfccontainer.class.php =================================================================== --- trunk/src/pfccontainer.class.php 2006-09-22 12:47:39 UTC (rev 785) +++ trunk/src/pfccontainer.class.php 2006-09-22 20:33:57 UTC (rev 786) @@ -83,6 +83,15 @@ $this->rmMeta('channelid-to-nickid', $this->encode($chan), $nickid); $this->rmMeta('nickid-to-channelid', $nickid, $this->encode($chan)); + // if the user is the last one to quit this room, + // then clean the room history + $ret = $this->getOnlineNick($chan); + if (count($ret['nickid']) == 0) + { + $this->rmMeta('channelid-to-msg', $this->encode($chan)); + $this->rmMeta('channelid-to-msgid', $this->encode($chan)); + } + // get the current user's channels list $channels = $this->getMeta("nickid-to-channelid",$nickid); $channels = $channels["value"]; @@ -219,7 +228,7 @@ if ($chan == NULL) $chan = 'SERVER'; - $online_user = array(); + $online_user = array('nick'=>array(),'nickid'=>array(),'timestamp'=>array()); $ret = $this->getMeta("channelid-to-nickid", $this->encode($chan)); for($i = 0; $i<count($ret['timestamp']); $i++) { Modified: trunk/src/proxies/checktimeout.class.php =================================================================== --- trunk/src/proxies/checktimeout.class.php 2006-09-22 12:47:39 UTC (rev 785) +++ trunk/src/proxies/checktimeout.class.php 2006-09-22 20:33:57 UTC (rev 786) @@ -43,15 +43,17 @@ $u =& $this->u; // disconnect users from specific channels - $container =& $c->getContainerInstance(); - $disconnected_users = $container->removeObsoleteNick($c->timeout); + $ct =& $c->getContainerInstance(); + $disconnected_users = $ct->removeObsoleteNick($c->timeout); for($i=0; $i<count($disconnected_users["nick"]); $i++) { $nick = $disconnected_users["nick"][$i]; for($j=0; $j<count($disconnected_users["channels"][$i]); $j++) { $chan = $disconnected_users["channels"][$i][$j]; - if ($chan != 'SERVER') + $online_users = $ct->getOnlineNick($chan); + if ($chan != 'SERVER' && + count($online_users['nickid'])) { $cmdp = $p; $cmdp["param"] = _pfc("%s quit (timeout)", $nick); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-22 12:47:45
|
Revision: 785 http://svn.sourceforge.net/phpfreechat/?rev=785&view=rev Author: kerphi Date: 2006-09-22 05:47:39 -0700 (Fri, 22 Sep 2006) Log Message: ----------- Bug fix: private message was broken Modified Paths: -------------- trunk/src/commands/privmsg.class.php Modified: trunk/src/commands/privmsg.class.php =================================================================== --- trunk/src/commands/privmsg.class.php 2006-09-22 12:40:08 UTC (rev 784) +++ trunk/src/commands/privmsg.class.php 2006-09-22 12:47:39 UTC (rev 785) @@ -82,6 +82,10 @@ $from_id_sid = "pfc_from_id_".$c->getId()."_".$clientid."_".$pvrecipientid; $from_id = $container->getLastId($pvrecipient)-$c->max_msg; $_SESSION[$from_id_sid] = ($from_id<0) ? 0 : $from_id; + + // register the user (and his metadata) in this pv + $ct =& $c->getContainerInstance(); + $ct->createNick($pvrecipient, $u->nick, $u->nickid); } // return ok to the client This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-22 12:40:56
|
Revision: 784 http://svn.sourceforge.net/phpfreechat/?rev=784&view=rev Author: kerphi Date: 2006-09-22 05:40:08 -0700 (Fri, 22 Sep 2006) Log Message: ----------- [en] Add a 'Send' button right to the messages input box (2h). [fr] Ajout d'un bouton 'Envoyer' ?\195?\160 droite de la boite de saisie des messages (2h). Modified Paths: -------------- trunk/i18n/ar_LB/main.php trunk/i18n/ba_BA/main.php trunk/i18n/bg_BG/main.php trunk/i18n/de_DE-formal/main.php trunk/i18n/de_DE-informal/main.php trunk/i18n/el_GR/main.php trunk/i18n/en_US/main.php trunk/i18n/es_ES/main.php trunk/i18n/fr_FR/main.php trunk/i18n/hu_HU/main.php trunk/i18n/id_ID/main.php trunk/i18n/it_IT/main.php trunk/i18n/ja_JP/main.php trunk/i18n/nb_NO/main.php trunk/i18n/nl_NL/main.php trunk/i18n/pl_PL/main.php trunk/i18n/pt_BR/main.php trunk/i18n/pt_PT/main.php trunk/i18n/ru_RU/main.php trunk/i18n/sr_CS/main.php trunk/i18n/sv_SE/main.php trunk/i18n/tr_TR/main.php trunk/i18n/ua_UA/main.php trunk/i18n/zh_CN/main.php trunk/i18n/zh_TW/main.php trunk/src/client/chat.js.tpl.php trunk/src/client/pfcclient.js trunk/src/client/pfcgui.js trunk/src/pfci18n.class.php trunk/themes/default/style.css Modified: trunk/i18n/ar_LB/main.php =================================================================== --- trunk/i18n/ar_LB/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/ar_LB/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -240,4 +240,70 @@ // line 199 in pfcgui.js.tpl.php $GLOBALS["i18n"]["Do you really want to leave this room ?"] = ""; +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = ""; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = ""; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = ""; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = ""; + +// line 395 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' must be writable"] = ""; + +// line 425 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' directory doesn't exist"] = ""; + +// line 544 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Please correct these errors"] = ""; + +// line 21 in pfcinfo.class.php +$GLOBALS["i18n"]["Error: the cached config file doesn't exists"] = ""; + +// line 190 in phpfreechat.class.php +$GLOBALS["i18n"]["Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"] = ""; + +// line 31 in help.class.php +$GLOBALS["i18n"]["Here is the command list:"] = ""; + +// line 63 in identify.class.php +$GLOBALS["i18n"]["Succesfully identified"] = ""; + +// line 68 in identify.class.php +$GLOBALS["i18n"]["Identification failure"] = ""; + +// line 25 in send.class.php +$GLOBALS["i18n"]["Your must be connected to send a message"] = ""; + +// line 87 in chat.js.tpl.php +$GLOBALS["i18n"]["Click here to send your message"] = ""; + +// line 80 in chat.js.tpl.php +$GLOBALS["i18n"]["Enter the text to format"] = ""; + +// line 81 in chat.js.tpl.php +$GLOBALS["i18n"]["Configuration has been rehashed"] = ""; + +// line 82 in chat.js.tpl.php +$GLOBALS["i18n"]["A problem occurs during rehash"] = ""; + +// line 83 in chat.js.tpl.php +$GLOBALS["i18n"]["Choosen nickname is allready used"] = ""; + +// line 84 in chat.js.tpl.php +$GLOBALS["i18n"]["phpfreechat current version is %s"] = ""; + +// line 85 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of joined channels has been reached"] = ""; + +// line 86 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of private chat has been reached"] = ""; + +// line 88 in chat.js.tpl.php +$GLOBALS["i18n"]["Send"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/ba_BA/main.php =================================================================== --- trunk/i18n/ba_BA/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/ba_BA/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -243,4 +243,70 @@ // line 199 in pfcgui.js.tpl.php $GLOBALS["i18n"]["Do you really want to leave this room ?"] = ""; +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = ""; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = ""; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = ""; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = ""; + +// line 395 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' must be writable"] = ""; + +// line 425 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' directory doesn't exist"] = ""; + +// line 544 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Please correct these errors"] = ""; + +// line 21 in pfcinfo.class.php +$GLOBALS["i18n"]["Error: the cached config file doesn't exists"] = ""; + +// line 190 in phpfreechat.class.php +$GLOBALS["i18n"]["Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"] = ""; + +// line 31 in help.class.php +$GLOBALS["i18n"]["Here is the command list:"] = ""; + +// line 63 in identify.class.php +$GLOBALS["i18n"]["Succesfully identified"] = ""; + +// line 68 in identify.class.php +$GLOBALS["i18n"]["Identification failure"] = ""; + +// line 25 in send.class.php +$GLOBALS["i18n"]["Your must be connected to send a message"] = ""; + +// line 87 in chat.js.tpl.php +$GLOBALS["i18n"]["Click here to send your message"] = ""; + +// line 80 in chat.js.tpl.php +$GLOBALS["i18n"]["Enter the text to format"] = ""; + +// line 81 in chat.js.tpl.php +$GLOBALS["i18n"]["Configuration has been rehashed"] = ""; + +// line 82 in chat.js.tpl.php +$GLOBALS["i18n"]["A problem occurs during rehash"] = ""; + +// line 83 in chat.js.tpl.php +$GLOBALS["i18n"]["Choosen nickname is allready used"] = ""; + +// line 84 in chat.js.tpl.php +$GLOBALS["i18n"]["phpfreechat current version is %s"] = ""; + +// line 85 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of joined channels has been reached"] = ""; + +// line 86 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of private chat has been reached"] = ""; + +// line 88 in chat.js.tpl.php +$GLOBALS["i18n"]["Send"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/bg_BG/main.php =================================================================== --- trunk/i18n/bg_BG/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/bg_BG/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -238,4 +238,70 @@ // line 199 in pfcgui.js.tpl.php $GLOBALS["i18n"]["Do you really want to leave this room ?"] = ""; +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = ""; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = ""; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = ""; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = ""; + +// line 395 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' must be writable"] = ""; + +// line 425 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' directory doesn't exist"] = ""; + +// line 544 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Please correct these errors"] = ""; + +// line 21 in pfcinfo.class.php +$GLOBALS["i18n"]["Error: the cached config file doesn't exists"] = ""; + +// line 190 in phpfreechat.class.php +$GLOBALS["i18n"]["Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"] = ""; + +// line 31 in help.class.php +$GLOBALS["i18n"]["Here is the command list:"] = ""; + +// line 63 in identify.class.php +$GLOBALS["i18n"]["Succesfully identified"] = ""; + +// line 68 in identify.class.php +$GLOBALS["i18n"]["Identification failure"] = ""; + +// line 25 in send.class.php +$GLOBALS["i18n"]["Your must be connected to send a message"] = ""; + +// line 87 in chat.js.tpl.php +$GLOBALS["i18n"]["Click here to send your message"] = ""; + +// line 80 in chat.js.tpl.php +$GLOBALS["i18n"]["Enter the text to format"] = ""; + +// line 81 in chat.js.tpl.php +$GLOBALS["i18n"]["Configuration has been rehashed"] = ""; + +// line 82 in chat.js.tpl.php +$GLOBALS["i18n"]["A problem occurs during rehash"] = ""; + +// line 83 in chat.js.tpl.php +$GLOBALS["i18n"]["Choosen nickname is allready used"] = ""; + +// line 84 in chat.js.tpl.php +$GLOBALS["i18n"]["phpfreechat current version is %s"] = ""; + +// line 85 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of joined channels has been reached"] = ""; + +// line 86 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of private chat has been reached"] = ""; + +// line 88 in chat.js.tpl.php +$GLOBALS["i18n"]["Send"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/de_DE-formal/main.php =================================================================== --- trunk/i18n/de_DE-formal/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/de_DE-formal/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -243,4 +243,70 @@ // line 199 in pfcgui.js.tpl.php $GLOBALS["i18n"]["Do you really want to leave this room ?"] = ""; +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = ""; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = ""; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = ""; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = ""; + +// line 395 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' must be writable"] = ""; + +// line 425 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' directory doesn't exist"] = ""; + +// line 544 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Please correct these errors"] = ""; + +// line 21 in pfcinfo.class.php +$GLOBALS["i18n"]["Error: the cached config file doesn't exists"] = ""; + +// line 190 in phpfreechat.class.php +$GLOBALS["i18n"]["Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"] = ""; + +// line 31 in help.class.php +$GLOBALS["i18n"]["Here is the command list:"] = ""; + +// line 63 in identify.class.php +$GLOBALS["i18n"]["Succesfully identified"] = ""; + +// line 68 in identify.class.php +$GLOBALS["i18n"]["Identification failure"] = ""; + +// line 25 in send.class.php +$GLOBALS["i18n"]["Your must be connected to send a message"] = ""; + +// line 87 in chat.js.tpl.php +$GLOBALS["i18n"]["Click here to send your message"] = ""; + +// line 80 in chat.js.tpl.php +$GLOBALS["i18n"]["Enter the text to format"] = ""; + +// line 81 in chat.js.tpl.php +$GLOBALS["i18n"]["Configuration has been rehashed"] = ""; + +// line 82 in chat.js.tpl.php +$GLOBALS["i18n"]["A problem occurs during rehash"] = ""; + +// line 83 in chat.js.tpl.php +$GLOBALS["i18n"]["Choosen nickname is allready used"] = ""; + +// line 84 in chat.js.tpl.php +$GLOBALS["i18n"]["phpfreechat current version is %s"] = ""; + +// line 85 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of joined channels has been reached"] = ""; + +// line 86 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of private chat has been reached"] = ""; + +// line 88 in chat.js.tpl.php +$GLOBALS["i18n"]["Send"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/de_DE-informal/main.php =================================================================== --- trunk/i18n/de_DE-informal/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/de_DE-informal/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -243,4 +243,70 @@ // line 199 in pfcgui.js.tpl.php $GLOBALS["i18n"]["Do you really want to leave this room ?"] = ""; +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = ""; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = ""; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = ""; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = ""; + +// line 395 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' must be writable"] = ""; + +// line 425 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' directory doesn't exist"] = ""; + +// line 544 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Please correct these errors"] = ""; + +// line 21 in pfcinfo.class.php +$GLOBALS["i18n"]["Error: the cached config file doesn't exists"] = ""; + +// line 190 in phpfreechat.class.php +$GLOBALS["i18n"]["Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"] = ""; + +// line 31 in help.class.php +$GLOBALS["i18n"]["Here is the command list:"] = ""; + +// line 63 in identify.class.php +$GLOBALS["i18n"]["Succesfully identified"] = ""; + +// line 68 in identify.class.php +$GLOBALS["i18n"]["Identification failure"] = ""; + +// line 25 in send.class.php +$GLOBALS["i18n"]["Your must be connected to send a message"] = ""; + +// line 87 in chat.js.tpl.php +$GLOBALS["i18n"]["Click here to send your message"] = ""; + +// line 80 in chat.js.tpl.php +$GLOBALS["i18n"]["Enter the text to format"] = ""; + +// line 81 in chat.js.tpl.php +$GLOBALS["i18n"]["Configuration has been rehashed"] = ""; + +// line 82 in chat.js.tpl.php +$GLOBALS["i18n"]["A problem occurs during rehash"] = ""; + +// line 83 in chat.js.tpl.php +$GLOBALS["i18n"]["Choosen nickname is allready used"] = ""; + +// line 84 in chat.js.tpl.php +$GLOBALS["i18n"]["phpfreechat current version is %s"] = ""; + +// line 85 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of joined channels has been reached"] = ""; + +// line 86 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of private chat has been reached"] = ""; + +// line 88 in chat.js.tpl.php +$GLOBALS["i18n"]["Send"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/el_GR/main.php =================================================================== --- trunk/i18n/el_GR/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/el_GR/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -239,4 +239,70 @@ // line 199 in pfcgui.js.tpl.php $GLOBALS["i18n"]["Do you really want to leave this room ?"] = ""; +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = ""; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = ""; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = ""; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = ""; + +// line 395 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' must be writable"] = ""; + +// line 425 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' directory doesn't exist"] = ""; + +// line 544 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Please correct these errors"] = ""; + +// line 21 in pfcinfo.class.php +$GLOBALS["i18n"]["Error: the cached config file doesn't exists"] = ""; + +// line 190 in phpfreechat.class.php +$GLOBALS["i18n"]["Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"] = ""; + +// line 31 in help.class.php +$GLOBALS["i18n"]["Here is the command list:"] = ""; + +// line 63 in identify.class.php +$GLOBALS["i18n"]["Succesfully identified"] = ""; + +// line 68 in identify.class.php +$GLOBALS["i18n"]["Identification failure"] = ""; + +// line 25 in send.class.php +$GLOBALS["i18n"]["Your must be connected to send a message"] = ""; + +// line 87 in chat.js.tpl.php +$GLOBALS["i18n"]["Click here to send your message"] = ""; + +// line 80 in chat.js.tpl.php +$GLOBALS["i18n"]["Enter the text to format"] = ""; + +// line 81 in chat.js.tpl.php +$GLOBALS["i18n"]["Configuration has been rehashed"] = ""; + +// line 82 in chat.js.tpl.php +$GLOBALS["i18n"]["A problem occurs during rehash"] = ""; + +// line 83 in chat.js.tpl.php +$GLOBALS["i18n"]["Choosen nickname is allready used"] = ""; + +// line 84 in chat.js.tpl.php +$GLOBALS["i18n"]["phpfreechat current version is %s"] = ""; + +// line 85 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of joined channels has been reached"] = ""; + +// line 86 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of private chat has been reached"] = ""; + +// line 88 in chat.js.tpl.php +$GLOBALS["i18n"]["Send"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/en_US/main.php =================================================================== --- trunk/i18n/en_US/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/en_US/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -240,4 +240,70 @@ // line 56 in noflood.class.php $GLOBALS["i18n"]["Please don't post so many message, flood is not tolerated"] = "Please don't post so many message, flood is not tolerated"; -?> +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = "Error: '%s' is a private parameter, you are not allowed to change it"; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = "'%s' parameter must be an array"; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = "'%s' parameter must be a boolean"; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = "'%s' parameter must be a charatere string"; + +// line 395 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' must be writable"] = "'%s' must be writable"; + +// line 425 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' directory doesn't exist"] = "'%s' directory doesn't exist"; + +// line 544 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Please correct these errors"] = "Please correct these errors"; + +// line 21 in pfcinfo.class.php +$GLOBALS["i18n"]["Error: the cached config file doesn't exists"] = "Error: the cached config file doesn't exists"; + +// line 190 in phpfreechat.class.php +$GLOBALS["i18n"]["Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"] = "Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"; + +// line 31 in help.class.php +$GLOBALS["i18n"]["Here is the command list:"] = "Here is the command list:"; + +// line 63 in identify.class.php +$GLOBALS["i18n"]["Succesfully identified"] = "Succesfully identified"; + +// line 68 in identify.class.php +$GLOBALS["i18n"]["Identification failure"] = "Identification failure"; + +// line 25 in send.class.php +$GLOBALS["i18n"]["Your must be connected to send a message"] = "Your must be connected to send a message"; + +// line 87 in chat.js.tpl.php +$GLOBALS["i18n"]["Click here to send your message"] = "Click here to send your message"; + +// line 80 in chat.js.tpl.php +$GLOBALS["i18n"]["Enter the text to format"] = "Enter the text to format"; + +// line 81 in chat.js.tpl.php +$GLOBALS["i18n"]["Configuration has been rehashed"] = "Configuration has been rehashed"; + +// line 82 in chat.js.tpl.php +$GLOBALS["i18n"]["A problem occurs during rehash"] = "A problem occurs during rehash"; + +// line 83 in chat.js.tpl.php +$GLOBALS["i18n"]["Choosen nickname is allready used"] = "Choosen nickname is allready used"; + +// line 84 in chat.js.tpl.php +$GLOBALS["i18n"]["phpfreechat current version is %s"] = "phpfreechat current version is %s"; + +// line 85 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of joined channels has been reached"] = "Maximum number of joined channels has been reached"; + +// line 86 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of private chat has been reached"] = "Maximum number of private chat has been reached"; + +// line 88 in chat.js.tpl.php +$GLOBALS["i18n"]["Send"] = "Send"; + +?> \ No newline at end of file Modified: trunk/i18n/es_ES/main.php =================================================================== --- trunk/i18n/es_ES/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/es_ES/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -239,4 +239,70 @@ // line 199 in pfcgui.js.tpl.php $GLOBALS["i18n"]["Do you really want to leave this room ?"] = ""; +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = ""; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = ""; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = ""; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = ""; + +// line 395 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' must be writable"] = ""; + +// line 425 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' directory doesn't exist"] = ""; + +// line 544 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Please correct these errors"] = ""; + +// line 21 in pfcinfo.class.php +$GLOBALS["i18n"]["Error: the cached config file doesn't exists"] = ""; + +// line 190 in phpfreechat.class.php +$GLOBALS["i18n"]["Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"] = ""; + +// line 31 in help.class.php +$GLOBALS["i18n"]["Here is the command list:"] = ""; + +// line 63 in identify.class.php +$GLOBALS["i18n"]["Succesfully identified"] = ""; + +// line 68 in identify.class.php +$GLOBALS["i18n"]["Identification failure"] = ""; + +// line 25 in send.class.php +$GLOBALS["i18n"]["Your must be connected to send a message"] = ""; + +// line 87 in chat.js.tpl.php +$GLOBALS["i18n"]["Click here to send your message"] = ""; + +// line 80 in chat.js.tpl.php +$GLOBALS["i18n"]["Enter the text to format"] = ""; + +// line 81 in chat.js.tpl.php +$GLOBALS["i18n"]["Configuration has been rehashed"] = ""; + +// line 82 in chat.js.tpl.php +$GLOBALS["i18n"]["A problem occurs during rehash"] = ""; + +// line 83 in chat.js.tpl.php +$GLOBALS["i18n"]["Choosen nickname is allready used"] = ""; + +// line 84 in chat.js.tpl.php +$GLOBALS["i18n"]["phpfreechat current version is %s"] = ""; + +// line 85 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of joined channels has been reached"] = ""; + +// line 86 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of private chat has been reached"] = ""; + +// line 88 in chat.js.tpl.php +$GLOBALS["i18n"]["Send"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/fr_FR/main.php =================================================================== --- trunk/i18n/fr_FR/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/fr_FR/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -240,4 +240,70 @@ // line 56 in noflood.class.php $GLOBALS["i18n"]["Please don't post so many message, flood is not tolerated"] = "Svp, ne postez pas autant de messages à la suite, le flood n'est pas toléré"; -?> +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = "Erreur: le paramètre '%s' est privé, vous ne pouvez pas l'assigner"; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = "Le paramètre '%s' doit être un tableau (array)"; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = "Le paramètre '%s' doit être un boolean (true ou false)"; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = "Le paramètre '%s' doit être une chaîne de caractères"; + +// line 395 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' must be writable"] = "'%s' doit être accessible en écriture"; + +// line 425 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' directory doesn't exist"] = "Le répertoire '%s' n'existe pas"; + +// line 544 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Please correct these errors"] = "Merci de corriger ces erreurs"; + +// line 21 in pfcinfo.class.php +$GLOBALS["i18n"]["Error: the cached config file doesn't exists"] = "Erreur : le fichier de cache contenant la configuration n'existe pas"; + +// line 190 in phpfreechat.class.php +$GLOBALS["i18n"]["Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"] = "Erreur : le chat ne peut pas être chargé! soit votre navigateur ne supporte pas le javascript, soit vous n'avez pas donné les bons droits aux répertoires. N'hésitez pas à demander de l'aide sur le forum"; + +// line 31 in help.class.php +$GLOBALS["i18n"]["Here is the command list:"] = "Voici la liste des commandes :"; + +// line 63 in identify.class.php +$GLOBALS["i18n"]["Succesfully identified"] = "Identification réussie"; + +// line 68 in identify.class.php +$GLOBALS["i18n"]["Identification failure"] = "Identification incorrecte"; + +// line 25 in send.class.php +$GLOBALS["i18n"]["Your must be connected to send a message"] = "Vous devez être connecté pour envoyer un message"; + +// line 87 in chat.js.tpl.php +$GLOBALS["i18n"]["Click here to send your message"] = "Clickez ici pour envoyer votre message"; + +// line 80 in chat.js.tpl.php +$GLOBALS["i18n"]["Enter the text to format"] = "Entrez le texte à formater"; + +// line 81 in chat.js.tpl.php +$GLOBALS["i18n"]["Configuration has been rehashed"] = "La configuration a été rechargée (rehashed)"; + +// line 82 in chat.js.tpl.php +$GLOBALS["i18n"]["A problem occurs during rehash"] = "Un problème est survenu pendant le rehash"; + +// line 83 in chat.js.tpl.php +$GLOBALS["i18n"]["Choosen nickname is allready used"] = "Le pseudonyme est déjà utilisé"; + +// line 84 in chat.js.tpl.php +$GLOBALS["i18n"]["phpfreechat current version is %s"] = "La version courante de phpfreechat est %s"; + +// line 85 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of joined channels has been reached"] = "Le nombre maximum de salons autorisés a été atteint"; + +// line 86 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of private chat has been reached"] = "Le nombre maximum de chat privés a été atteint"; + +// line 88 in chat.js.tpl.php +$GLOBALS["i18n"]["Send"] = "Envoyer"; + +?> \ No newline at end of file Modified: trunk/i18n/hu_HU/main.php =================================================================== --- trunk/i18n/hu_HU/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/hu_HU/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -175,4 +175,137 @@ // 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'"; -?> + +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = ""; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = ""; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = ""; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = ""; + +// line 277 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["My room"] = ""; + +// line 395 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' must be writable"] = ""; + +// line 425 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' directory doesn't exist"] = ""; + +// line 544 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Please correct these errors"] = ""; + +// line 21 in pfcinfo.class.php +$GLOBALS["i18n"]["Error: the cached config file doesn't exists"] = ""; + +// line 190 in phpfreechat.class.php +$GLOBALS["i18n"]["Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"] = ""; + +// line 26 in unban.class.php +$GLOBALS["i18n"]["Missing parameter"] = ""; + +// line 45 in ban.class.php +$GLOBALS["i18n"]["banished from %s by %s"] = ""; + +// line 23 in banlist.class.php +$GLOBALS["i18n"]["The banished user's id list is:"] = ""; + +// line 32 in banlist.class.php +$GLOBALS["i18n"]["Empty"] = ""; + +// line 34 in banlist.class.php +$GLOBALS["i18n"]["'/unban {id}' will unban the user identified by {id}"] = ""; + +// line 35 in banlist.class.php +$GLOBALS["i18n"]["'/unban all' will unban all the users on this channel"] = ""; + +// line 31 in help.class.php +$GLOBALS["i18n"]["Here is the command list:"] = ""; + +// line 63 in identify.class.php +$GLOBALS["i18n"]["Succesfully identified"] = ""; + +// line 68 in identify.class.php +$GLOBALS["i18n"]["Identification failure"] = ""; + +// line 53 in join.class.php +$GLOBALS["i18n"]["%s joins %s"] = ""; + +// line 81 in noflood.class.php +$GLOBALS["i18n"]["kicked from %s by %s"] = ""; + +// line 25 in send.class.php +$GLOBALS["i18n"]["Your must be connected to send a message"] = ""; + +// line 50 in send.class.php +$GLOBALS["i18n"]["Can't send the message, %s is offline"] = ""; + +// line 34 in unban.class.php +$GLOBALS["i18n"]["Nobody has been unbanished"] = ""; + +// line 49 in unban.class.php +$GLOBALS["i18n"]["%s has been unbanished"] = ""; + +// line 56 in unban.class.php +$GLOBALS["i18n"]["%s users have been unbanished"] = ""; + +// line 53 in auth.class.php +$GLOBALS["i18n"]["You are not allowed to run '%s' command"] = ""; + +// line 73 in auth.class.php +$GLOBALS["i18n"]["Can't join %s because you are banished"] = ""; + +// line 83 in auth.class.php +$GLOBALS["i18n"]["Can't join %s because the channels list is restricted"] = ""; + +// line 57 in checknickchange.class.php +$GLOBALS["i18n"]["You are not allowed to change your nickname"] = ""; + +// line 57 in checktimeout.class.php +$GLOBALS["i18n"]["%s quit (timeout)"] = ""; + +// line 75 in noflood.class.php +$GLOBALS["i18n"]["Please don't post so many message, flood is not tolerated"] = ""; + +// line 87 in chat.js.tpl.php +$GLOBALS["i18n"]["Click here to send your message"] = ""; + +// line 55 in chat.js.tpl.php +$GLOBALS["i18n"]["Do you really want to leave this room ?"] = ""; + +// line 69 in chat.js.tpl.php +$GLOBALS["i18n"]["Private message"] = ""; + +// line 70 in chat.js.tpl.php +$GLOBALS["i18n"]["Close this tab"] = ""; + +// line 80 in chat.js.tpl.php +$GLOBALS["i18n"]["Enter the text to format"] = ""; + +// line 81 in chat.js.tpl.php +$GLOBALS["i18n"]["Configuration has been rehashed"] = ""; + +// line 82 in chat.js.tpl.php +$GLOBALS["i18n"]["A problem occurs during rehash"] = ""; + +// line 83 in chat.js.tpl.php +$GLOBALS["i18n"]["Choosen nickname is allready used"] = ""; + +// line 84 in chat.js.tpl.php +$GLOBALS["i18n"]["phpfreechat current version is %s"] = ""; + +// line 85 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of joined channels has been reached"] = ""; + +// line 86 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of private chat has been reached"] = ""; + +// line 88 in chat.js.tpl.php +$GLOBALS["i18n"]["Send"] = ""; + +?> \ No newline at end of file Modified: trunk/i18n/id_ID/main.php =================================================================== --- trunk/i18n/id_ID/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/id_ID/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -243,4 +243,70 @@ // line 199 in pfcgui.js.tpl.php $GLOBALS["i18n"]["Do you really want to leave this room ?"] = ""; +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = ""; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = ""; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = ""; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = ""; + +// line 395 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' must be writable"] = ""; + +// line 425 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' directory doesn't exist"] = ""; + +// line 544 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Please correct these errors"] = ""; + +// line 21 in pfcinfo.class.php +$GLOBALS["i18n"]["Error: the cached config file doesn't exists"] = ""; + +// line 190 in phpfreechat.class.php +$GLOBALS["i18n"]["Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"] = ""; + +// line 31 in help.class.php +$GLOBALS["i18n"]["Here is the command list:"] = ""; + +// line 63 in identify.class.php +$GLOBALS["i18n"]["Succesfully identified"] = ""; + +// line 68 in identify.class.php +$GLOBALS["i18n"]["Identification failure"] = ""; + +// line 25 in send.class.php +$GLOBALS["i18n"]["Your must be connected to send a message"] = ""; + +// line 87 in chat.js.tpl.php +$GLOBALS["i18n"]["Click here to send your message"] = ""; + +// line 80 in chat.js.tpl.php +$GLOBALS["i18n"]["Enter the text to format"] = ""; + +// line 81 in chat.js.tpl.php +$GLOBALS["i18n"]["Configuration has been rehashed"] = ""; + +// line 82 in chat.js.tpl.php +$GLOBALS["i18n"]["A problem occurs during rehash"] = ""; + +// line 83 in chat.js.tpl.php +$GLOBALS["i18n"]["Choosen nickname is allready used"] = ""; + +// line 84 in chat.js.tpl.php +$GLOBALS["i18n"]["phpfreechat current version is %s"] = ""; + +// line 85 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of joined channels has been reached"] = ""; + +// line 86 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of private chat has been reached"] = ""; + +// line 88 in chat.js.tpl.php +$GLOBALS["i18n"]["Send"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/it_IT/main.php =================================================================== --- trunk/i18n/it_IT/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/it_IT/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -239,4 +239,70 @@ // line 199 in pfcgui.js.tpl.php $GLOBALS["i18n"]["Do you really want to leave this room ?"] = ""; +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = ""; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = ""; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = ""; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = ""; + +// line 395 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' must be writable"] = ""; + +// line 425 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' directory doesn't exist"] = ""; + +// line 544 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Please correct these errors"] = ""; + +// line 21 in pfcinfo.class.php +$GLOBALS["i18n"]["Error: the cached config file doesn't exists"] = ""; + +// line 190 in phpfreechat.class.php +$GLOBALS["i18n"]["Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"] = ""; + +// line 31 in help.class.php +$GLOBALS["i18n"]["Here is the command list:"] = ""; + +// line 63 in identify.class.php +$GLOBALS["i18n"]["Succesfully identified"] = ""; + +// line 68 in identify.class.php +$GLOBALS["i18n"]["Identification failure"] = ""; + +// line 25 in send.class.php +$GLOBALS["i18n"]["Your must be connected to send a message"] = ""; + +// line 87 in chat.js.tpl.php +$GLOBALS["i18n"]["Click here to send your message"] = ""; + +// line 80 in chat.js.tpl.php +$GLOBALS["i18n"]["Enter the text to format"] = ""; + +// line 81 in chat.js.tpl.php +$GLOBALS["i18n"]["Configuration has been rehashed"] = ""; + +// line 82 in chat.js.tpl.php +$GLOBALS["i18n"]["A problem occurs during rehash"] = ""; + +// line 83 in chat.js.tpl.php +$GLOBALS["i18n"]["Choosen nickname is allready used"] = ""; + +// line 84 in chat.js.tpl.php +$GLOBALS["i18n"]["phpfreechat current version is %s"] = ""; + +// line 85 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of joined channels has been reached"] = ""; + +// line 86 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of private chat has been reached"] = ""; + +// line 88 in chat.js.tpl.php +$GLOBALS["i18n"]["Send"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/ja_JP/main.php =================================================================== --- trunk/i18n/ja_JP/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/ja_JP/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -240,4 +240,71 @@ // line 56 in noflood.class.php $GLOBALS["i18n"]["Please don't post so many message, flood is not tolerated"] = "大量で黙認できません大量のメッセージを投稿しないでください。"; -?> + +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = ""; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = ""; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = ""; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = ""; + +// line 395 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' must be writable"] = ""; + +// line 425 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' directory doesn't exist"] = ""; + +// line 544 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Please correct these errors"] = ""; + +// line 21 in pfcinfo.class.php +$GLOBALS["i18n"]["Error: the cached config file doesn't exists"] = ""; + +// line 190 in phpfreechat.class.php +$GLOBALS["i18n"]["Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"] = ""; + +// line 31 in help.class.php +$GLOBALS["i18n"]["Here is the command list:"] = ""; + +// line 63 in identify.class.php +$GLOBALS["i18n"]["Succesfully identified"] = ""; + +// line 68 in identify.class.php +$GLOBALS["i18n"]["Identification failure"] = ""; + +// line 25 in send.class.php +$GLOBALS["i18n"]["Your must be connected to send a message"] = ""; + +// line 87 in chat.js.tpl.php +$GLOBALS["i18n"]["Click here to send your message"] = ""; + +// line 80 in chat.js.tpl.php +$GLOBALS["i18n"]["Enter the text to format"] = ""; + +// line 81 in chat.js.tpl.php +$GLOBALS["i18n"]["Configuration has been rehashed"] = ""; + +// line 82 in chat.js.tpl.php +$GLOBALS["i18n"]["A problem occurs during rehash"] = ""; + +// line 83 in chat.js.tpl.php +$GLOBALS["i18n"]["Choosen nickname is allready used"] = ""; + +// line 84 in chat.js.tpl.php +$GLOBALS["i18n"]["phpfreechat current version is %s"] = ""; + +// line 85 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of joined channels has been reached"] = ""; + +// line 86 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of private chat has been reached"] = ""; + +// line 88 in chat.js.tpl.php +$GLOBALS["i18n"]["Send"] = ""; + +?> \ No newline at end of file Modified: trunk/i18n/nb_NO/main.php =================================================================== --- trunk/i18n/nb_NO/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/nb_NO/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -240,4 +240,70 @@ // line 199 in pfcgui.js.tpl.php $GLOBALS["i18n"]["Do you really want to leave this room ?"] = ""; +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = ""; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = ""; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = ""; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = ""; + +// line 395 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' must be writable"] = ""; + +// line 425 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' directory doesn't exist"] = ""; + +// line 544 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Please correct these errors"] = ""; + +// line 21 in pfcinfo.class.php +$GLOBALS["i18n"]["Error: the cached config file doesn't exists"] = ""; + +// line 190 in phpfreechat.class.php +$GLOBALS["i18n"]["Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"] = ""; + +// line 31 in help.class.php +$GLOBALS["i18n"]["Here is the command list:"] = ""; + +// line 63 in identify.class.php +$GLOBALS["i18n"]["Succesfully identified"] = ""; + +// line 68 in identify.class.php +$GLOBALS["i18n"]["Identification failure"] = ""; + +// line 25 in send.class.php +$GLOBALS["i18n"]["Your must be connected to send a message"] = ""; + +// line 87 in chat.js.tpl.php +$GLOBALS["i18n"]["Click here to send your message"] = ""; + +// line 80 in chat.js.tpl.php +$GLOBALS["i18n"]["Enter the text to format"] = ""; + +// line 81 in chat.js.tpl.php +$GLOBALS["i18n"]["Configuration has been rehashed"] = ""; + +// line 82 in chat.js.tpl.php +$GLOBALS["i18n"]["A problem occurs during rehash"] = ""; + +// line 83 in chat.js.tpl.php +$GLOBALS["i18n"]["Choosen nickname is allready used"] = ""; + +// line 84 in chat.js.tpl.php +$GLOBALS["i18n"]["phpfreechat current version is %s"] = ""; + +// line 85 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of joined channels has been reached"] = ""; + +// line 86 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of private chat has been reached"] = ""; + +// line 88 in chat.js.tpl.php +$GLOBALS["i18n"]["Send"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/nl_NL/main.php =================================================================== --- trunk/i18n/nl_NL/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/nl_NL/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -241,4 +241,70 @@ // line 199 in pfcgui.js.tpl.php $GLOBALS["i18n"]["Do you really want to leave this room ?"] = ""; +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = ""; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = ""; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = ""; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = ""; + +// line 395 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' must be writable"] = ""; + +// line 425 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' directory doesn't exist"] = ""; + +// line 544 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Please correct these errors"] = ""; + +// line 21 in pfcinfo.class.php +$GLOBALS["i18n"]["Error: the cached config file doesn't exists"] = ""; + +// line 190 in phpfreechat.class.php +$GLOBALS["i18n"]["Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"] = ""; + +// line 31 in help.class.php +$GLOBALS["i18n"]["Here is the command list:"] = ""; + +// line 63 in identify.class.php +$GLOBALS["i18n"]["Succesfully identified"] = ""; + +// line 68 in identify.class.php +$GLOBALS["i18n"]["Identification failure"] = ""; + +// line 25 in send.class.php +$GLOBALS["i18n"]["Your must be connected to send a message"] = ""; + +// line 87 in chat.js.tpl.php +$GLOBALS["i18n"]["Click here to send your message"] = ""; + +// line 80 in chat.js.tpl.php +$GLOBALS["i18n"]["Enter the text to format"] = ""; + +// line 81 in chat.js.tpl.php +$GLOBALS["i18n"]["Configuration has been rehashed"] = ""; + +// line 82 in chat.js.tpl.php +$GLOBALS["i18n"]["A problem occurs during rehash"] = ""; + +// line 83 in chat.js.tpl.php +$GLOBALS["i18n"]["Choosen nickname is allready used"] = ""; + +// line 84 in chat.js.tpl.php +$GLOBALS["i18n"]["phpfreechat current version is %s"] = ""; + +// line 85 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of joined channels has been reached"] = ""; + +// line 86 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of private chat has been reached"] = ""; + +// line 88 in chat.js.tpl.php +$GLOBALS["i18n"]["Send"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/pl_PL/main.php =================================================================== --- trunk/i18n/pl_PL/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/pl_PL/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -240,4 +240,71 @@ // line 56 in noflood.class.php $GLOBALS["i18n"]["Please don't post so many message, flood is not tolerated"] = "Proszę nie wysyłąć tak wielu komunikatów, nie jest to dopuszczalne"; -?> + +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = ""; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = ""; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = ""; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = ""; + +// line 395 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' must be writable"] = ""; + +// line 425 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' directory doesn't exist"] = ""; + +// line 544 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Please correct these errors"] = ""; + +// line 21 in pfcinfo.class.php +$GLOBALS["i18n"]["Error: the cached config file doesn't exists"] = ""; + +// line 190 in phpfreechat.class.php +$GLOBALS["i18n"]["Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"] = ""; + +// line 31 in help.class.php +$GLOBALS["i18n"]["Here is the command list:"] = ""; + +// line 63 in identify.class.php +$GLOBALS["i18n"]["Succesfully identified"] = ""; + +// line 68 in identify.class.php +$GLOBALS["i18n"]["Identification failure"] = ""; + +// line 25 in send.class.php +$GLOBALS["i18n"]["Your must be connected to send a message"] = ""; + +// line 87 in chat.js.tpl.php +$GLOBALS["i18n"]["Click here to send your message"] = ""; + +// line 80 in chat.js.tpl.php +$GLOBALS["i18n"]["Enter the text to format"] = ""; + +// line 81 in chat.js.tpl.php +$GLOBALS["i18n"]["Configuration has been rehashed"] = ""; + +// line 82 in chat.js.tpl.php +$GLOBALS["i18n"]["A problem occurs during rehash"] = ""; + +// line 83 in chat.js.tpl.php +$GLOBALS["i18n"]["Choosen nickname is allready used"] = ""; + +// line 84 in chat.js.tpl.php +$GLOBALS["i18n"]["phpfreechat current version is %s"] = ""; + +// line 85 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of joined channels has been reached"] = ""; + +// line 86 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of private chat has been reached"] = ""; + +// line 88 in chat.js.tpl.php +$GLOBALS["i18n"]["Send"] = ""; + +?> \ No newline at end of file Modified: trunk/i18n/pt_BR/main.php =================================================================== --- trunk/i18n/pt_BR/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/pt_BR/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -243,4 +243,70 @@ // line 199 in pfcgui.js.tpl.php $GLOBALS["i18n"]["Do you really want to leave this room ?"] = ""; +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = ""; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = ""; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = ""; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = ""; + +// line 395 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' must be writable"] = ""; + +// line 425 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' directory doesn't exist"] = ""; + +// line 544 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Please correct these errors"] = ""; + +// line 21 in pfcinfo.class.php +$GLOBALS["i18n"]["Error: the cached config file doesn't exists"] = ""; + +// line 190 in phpfreechat.class.php +$GLOBALS["i18n"]["Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"] = ""; + +// line 31 in help.class.php +$GLOBALS["i18n"]["Here is the command list:"] = ""; + +// line 63 in identify.class.php +$GLOBALS["i18n"]["Succesfully identified"] = ""; + +// line 68 in identify.class.php +$GLOBALS["i18n"]["Identification failure"] = ""; + +// line 25 in send.class.php +$GLOBALS["i18n"]["Your must be connected to send a message"] = ""; + +// line 87 in chat.js.tpl.php +$GLOBALS["i18n"]["Click here to send your message"] = ""; + +// line 80 in chat.js.tpl.php +$GLOBALS["i18n"]["Enter the text to format"] = ""; + +// line 81 in chat.js.tpl.php +$GLOBALS["i18n"]["Configuration has been rehashed"] = ""; + +// line 82 in chat.js.tpl.php +$GLOBALS["i18n"]["A problem occurs during rehash"] = ""; + +// line 83 in chat.js.tpl.php +$GLOBALS["i18n"]["Choosen nickname is allready used"] = ""; + +// line 84 in chat.js.tpl.php +$GLOBALS["i18n"]["phpfreechat current version is %s"] = ""; + +// line 85 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of joined channels has been reached"] = ""; + +// line 86 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of private chat has been reached"] = ""; + +// line 88 in chat.js.tpl.php +$GLOBALS["i18n"]["Send"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/pt_PT/main.php =================================================================== --- trunk/i18n/pt_PT/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/pt_PT/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -241,4 +241,70 @@ // line 199 in pfcgui.js.tpl.php $GLOBALS["i18n"]["Do you really want to leave this room ?"] = "Tens a certeza que queres deixar esta sala?"; +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = ""; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = ""; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = ""; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = ""; + +// line 395 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' must be writable"] = ""; + +// line 425 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' directory doesn't exist"] = ""; + +// line 544 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Please correct these errors"] = ""; + +// line 21 in pfcinfo.class.php +$GLOBALS["i18n"]["Error: the cached config file doesn't exists"] = ""; + +// line 190 in phpfreechat.class.php +$GLOBALS["i18n"]["Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"] = ""; + +// line 31 in help.class.php +$GLOBALS["i18n"]["Here is the command list:"] = ""; + +// line 63 in identify.class.php +$GLOBALS["i18n"]["Succesfully identified"] = ""; + +// line 68 in identify.class.php +$GLOBALS["i18n"]["Identification failure"] = ""; + +// line 25 in send.class.php +$GLOBALS["i18n"]["Your must be connected to send a message"] = ""; + +// line 87 in chat.js.tpl.php +$GLOBALS["i18n"]["Click here to send your message"] = ""; + +// line 80 in chat.js.tpl.php +$GLOBALS["i18n"]["Enter the text to format"] = ""; + +// line 81 in chat.js.tpl.php +$GLOBALS["i18n"]["Configuration has been rehashed"] = ""; + +// line 82 in chat.js.tpl.php +$GLOBALS["i18n"]["A problem occurs during rehash"] = ""; + +// line 83 in chat.js.tpl.php +$GLOBALS["i18n"]["Choosen nickname is allready used"] = ""; + +// line 84 in chat.js.tpl.php +$GLOBALS["i18n"]["phpfreechat current version is %s"] = ""; + +// line 85 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of joined channels has been reached"] = ""; + +// line 86 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of private chat has been reached"] = ""; + +// line 88 in chat.js.tpl.php +$GLOBALS["i18n"]["Send"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/ru_RU/main.php =================================================================== --- trunk/i18n/ru_RU/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/ru_RU/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -243,4 +243,71 @@ // line 199 in pfcgui.js.tpl.php $GLOBALS["i18n"]["Do you really want to leave this room ?"] = "Вы на самом деле хотите покинуть эту комнату?"; -?> + +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = ""; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = ""; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = ""; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = ""; + +// line 395 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' must be writable"] = ""; + +// line 425 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' directory doesn't exist"] = ""; + +// line 544 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Please correct these errors"] = ""; + +// line 21 in pfcinfo.class.php +$GLOBALS["i18n"]["Error: the cached config file doesn't exists"] = ""; + +// line 190 in phpfreechat.class.php +$GLOBALS["i18n"]["Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"] = ""; + +// line 31 in help.class.php +$GLOBALS["i18n"]["Here is the command list:"] = ""; + +// line 63 in identify.class.php +$GLOBALS["i18n"]["Succesfully identified"] = ""; + +// line 68 in identify.class.php +$GLOBALS["i18n"]["Identification failure"] = ""; + +// line 25 in send.class.php +$GLOBALS["i18n"]["Your must be connected to send a message"] = ""; + +// line 87 in chat.js.tpl.php +$GLOBALS["i18n"]["Click here to send your message"] = ""; + +// line 80 in chat.js.tpl.php +$GLOBALS["i18n"]["Enter the text to format"] = ""; + +// line 81 in chat.js.tpl.php +$GLOBALS["i18n"]["Configuration has been rehashed"] = ""; + +// line 82 in chat.js.tpl.php +$GLOBALS["i18n"]["A problem occurs during rehash"] = ""; + +// line 83 in chat.js.tpl.php +$GLOBALS["i18n"]["Choosen nickname is allready used"] = ""; + +// line 84 in chat.js.tpl.php +$GLOBALS["i18n"]["phpfreechat current version is %s"] = ""; + +// line 85 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of joined channels has been reached"] = ""; + +// line 86 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of private chat has been reached"] = ""; + +// line 88 in chat.js.tpl.php +$GLOBALS["i18n"]["Send"] = ""; + +?> \ No newline at end of file Modified: trunk/i18n/sr_CS/main.php =================================================================== --- trunk/i18n/sr_CS/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/sr_CS/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -243,4 +243,70 @@ // line 199 in pfcgui.js.tpl.php $GLOBALS["i18n"]["Do you really want to leave this room ?"] = ""; +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = ""; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = ""; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = ""; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = ""; + +// line 395 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' must be writable"] = ""; + +// line 425 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' directory doesn't exist"] = ""; + +// line 544 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Please correct these errors"] = ""; + +// line 21 in pfcinfo.class.php +$GLOBALS["i18n"]["Error: the cached config file doesn't exists"] = ""; + +// line 190 in phpfreechat.class.php +$GLOBALS["i18n"]["Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum"] = ""; + +// line 31 in help.class.php +$GLOBALS["i18n"]["Here is the command list:"] = ""; + +// line 63 in identify.class.php +$GLOBALS["i18n"]["Succesfully identified"] = ""; + +// line 68 in identify.class.php +$GLOBALS["i18n"]["Identification failure"] = ""; + +// line 25 in send.class.php +$GLOBALS["i18n"]["Your must be connected to send a message"] = ""; + +// line 87 in chat.js.tpl.php +$GLOBALS["i18n"]["Click here to send your message"] = ""; + +// line 80 in chat.js.tpl.php +$GLOBALS["i18n"]["Enter the text to format"] = ""; + +// line 81 in chat.js.tpl.php +$GLOBALS["i18n"]["Configuration has been rehashed"] = ""; + +// line 82 in chat.js.tpl.php +$GLOBALS["i18n"]["A problem occurs during rehash"] = ""; + +// line 83 in chat.js.tpl.php +$GLOBALS["i18n"]["Choosen nickname is allready used"] = ""; + +// line 84 in chat.js.tpl.php +$GLOBALS["i18n"]["phpfreechat current version is %s"] = ""; + +// line 85 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of joined channels has been reached"] = ""; + +// line 86 in chat.js.tpl.php +$GLOBALS["i18n"]["Maximum number of private chat has been reached"] = ""; + +// line 88 in chat.js.tpl.php +$GLOBALS["i18n"]["Send"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/sv_SE/main.php =================================================================== --- trunk/i18n/sv_SE/main.php 2006-09-22 09:31:12 UTC (rev 783) +++ trunk/i18n/sv_SE/main.php 2006-09-22 12:40:08 UTC (rev 784) @@ -243,4 +243,70 @@ // line 199 in pfcgui.js.tpl.php $GLOBALS["i18n"]["Do you really want to leave this room ?"] = ""; +// line 169 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["Error: '%s' is a private parameter, you are not allowed to change it"] = ""; + +// line 253 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be an array"] = ""; + +// line 265 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a boolean"] = ""; + +// line 271 in pfcglobalconfig.class.php +$GLOBALS["i18n"]["'%s' parameter must be a charatere string"] = ""; + +// line 395 in pfcglobalconfig.class.... [truncated message content] |
From: <ke...@us...> - 2006-09-22 09:31:17
|
Revision: 783 http://svn.sourceforge.net/phpfreechat/?rev=783&view=rev Author: kerphi Date: 2006-09-22 02:31:12 -0700 (Fri, 22 Sep 2006) Log Message: ----------- code cleaning Modified Paths: -------------- trunk/src/proxies/noflood.class.php Modified: trunk/src/proxies/noflood.class.php =================================================================== --- trunk/src/proxies/noflood.class.php 2006-09-22 09:28:51 UTC (rev 782) +++ trunk/src/proxies/noflood.class.php 2006-09-22 09:31:12 UTC (rev 783) @@ -53,17 +53,18 @@ $flood_nbchar = $container->getUserMeta($nickid, 'flood_nbchar'); $floodtime = time(); - // update the number of posted message indicator if ($floodtime - $lastfloodtime <= $c->proxies_cfg[$this->proxyname]["delay"]) + { + // update the number of posted message indicator $flood_nbmsg++; + // update the number of posted characteres indicator + $flood_nbchar += utf8_strlen($param); + } else + { $flood_nbmsg = 0; - - // update the number of posted characteres indicator - if ($floodtime - $lastfloodtime <= $c->proxies_cfg[$this->proxyname]["delay"]) - $flood_nbchar += utf8_strlen($param); - else $flood_nbchar = 0; + } if (!$isadmin && ($flood_nbmsg>$c->proxies_cfg[$this->proxyname]["msglimit"] || This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-22 09:29:04
|
Revision: 782 http://svn.sourceforge.net/phpfreechat/?rev=782&view=rev Author: kerphi Date: 2006-09-22 02:28:51 -0700 (Fri, 22 Sep 2006) Log Message: ----------- [en] Improve noflood proxy algorithme: now it takes into account the number of posted characteres and the number of posted messages. [fr] Ammelioration du proxy noflood : maintenant il prend en compte le nombre de caracteres postes ainsi que le nombre de messsages postes. Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php trunk/src/proxies/noflood.class.php Added Paths: ----------- trunk/lib/utf8/utf8_strlen.php Added: trunk/lib/utf8/utf8_strlen.php =================================================================== --- trunk/lib/utf8/utf8_strlen.php (rev 0) +++ trunk/lib/utf8/utf8_strlen.php 2006-09-22 09:28:51 UTC (rev 782) @@ -0,0 +1,24 @@ +<?php + +/** + * Counts the number of characters of a string in UTF-8. + * Unit-tested by Kasper and works 100% like strlen() / mb_strlen() + * + * @param string UTF-8 multibyte character string + * @return integer The number of characters + * @see strlen() + * @author Martin Kutschker <mar...@bl...> + */ +function utf8_strlen($str) { + $n=0; + for($i=0; strlen($str{$i}); $i++) { + $c = ord($str{$i}); + if (!($c & 0x80)) // single-byte (0xxxxxx) + $n++; + elseif (($c & 0xC0) == 0xC0) // multi-byte starting byte (11xxxxxx) + $n++; + } + return $n; +} + +?> \ No newline at end of file Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-09-22 08:12:22 UTC (rev 781) +++ trunk/src/pfcglobalconfig.class.php 2006-09-22 09:28:51 UTC (rev 782) @@ -45,7 +45,7 @@ var $post_proxies = array(); // these proxies will be handled just before to process commands and just after system proxies var $pre_proxies = array(); // these proxies will be handled before system proxies (at begining) var $proxies_cfg = array("auth" => array(), - "noflood" => array("limit"=>10,"delay"=>5), + "noflood" => array("charlimit"=>450,"msglimit"=>10,"delay"=>5), "censor" => array("words"=>array("fuck","sex","bitch"),"replaceby"=>"*"), "log" => array("path"=>"")); var $proxies_path = ""; // a custom proxies path Modified: trunk/src/proxies/noflood.class.php =================================================================== --- trunk/src/proxies/noflood.class.php 2006-09-22 08:12:22 UTC (rev 781) +++ trunk/src/proxies/noflood.class.php 2006-09-22 09:28:51 UTC (rev 782) @@ -22,6 +22,7 @@ require_once dirname(__FILE__)."/../pfci18n.class.php"; require_once dirname(__FILE__)."/../pfcuserconfig.class.php"; require_once dirname(__FILE__)."/../pfcproxycommand.class.php"; +require_once dirname(__FILE__)."/../../lib/utf8/utf8_strlen.php"; /** * pfcProxyCommand_noflood @@ -48,15 +49,26 @@ $nickid = $u->nickid; $isadmin = $container->getUserMeta($nickid, 'isadmin'); $lastfloodtime = $container->getUserMeta($nickid, 'floodtime'); - $nbflood = $container->getUserMeta($nickid, 'nbflood'); + $flood_nbmsg = $container->getUserMeta($nickid, 'flood_nbmsg'); + $flood_nbchar = $container->getUserMeta($nickid, 'flood_nbchar'); $floodtime = time(); - + + // update the number of posted message indicator if ($floodtime - $lastfloodtime <= $c->proxies_cfg[$this->proxyname]["delay"]) - $nbflood++; + $flood_nbmsg++; else - $nbflood = 0; + $flood_nbmsg = 0; + + // update the number of posted characteres indicator + if ($floodtime - $lastfloodtime <= $c->proxies_cfg[$this->proxyname]["delay"]) + $flood_nbchar += utf8_strlen($param); + else + $flood_nbchar = 0; - if ($nbflood>$c->proxies_cfg[$this->proxyname]["limit"]) + if (!$isadmin && + ($flood_nbmsg>$c->proxies_cfg[$this->proxyname]["msglimit"] || + $flood_nbchar>$c->proxies_cfg[$this->proxyname]["charlimit"]) + ) { // warn the flooder $msg = _pfc("Please don't post so many message, flood is not tolerated"); @@ -71,9 +83,10 @@ return; } - if ($nbflood == 0) + if ($flood_nbmsg == 0) $container->setUserMeta($nickid, 'floodtime', $floodtime); - $container->setUserMeta($nickid, 'nbflood', $nbflood); + $container->setUserMeta($nickid, 'flood_nbmsg', $flood_nbmsg); + $container->setUserMeta($nickid, 'flood_nbchar', $flood_nbchar); } // forward the command to the next proxy or to the final command This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-22 08:12:35
|
Revision: 781 http://svn.sourceforge.net/phpfreechat/?rev=781&view=rev Author: kerphi Date: 2006-09-22 01:12:22 -0700 (Fri, 22 Sep 2006) Log Message: ----------- -- 1 -- [en] CPU Optimization: since the new data model some operation were useless and CPU consuming. [fr] Optimisation du CPU : depuis la mise en place du nouveau datamodel certaines op?\195?\169rations n'?\195?\169taient plus necessaire et consommaient du CPU inutile. -- 2 -- [en] Bug fix: the /leave command was broken [fr] Bug fix : la commande /leave ne fonctionnait plus Modified Paths: -------------- trunk/src/commands/connect.class.php trunk/src/commands/getonlinenick.class.php trunk/src/commands/join.class.php trunk/src/commands/leave.class.php trunk/src/commands/update.class.php trunk/src/commands/updatemynick.class.php Modified: trunk/src/commands/connect.class.php =================================================================== --- trunk/src/commands/connect.class.php 2006-09-21 12:13:24 UTC (rev 780) +++ trunk/src/commands/connect.class.php 2006-09-22 08:12:22 UTC (rev 781) @@ -14,7 +14,7 @@ $c =& $this->c; $u =& $this->u; - $container =& $c->getContainerInstance(); + $ct =& $c->getContainerInstance(); // reset the message id indicator (see getnewmsg.class.php) // i.e. be ready to re-get all last posted messages @@ -31,7 +31,7 @@ $chanid = pfcCommand_join::GetRecipientId($channame); // reset the fromid flag $from_id_sid = "pfc_from_id_".$c->getId()."_".$clientid."_".$chanid; - $from_id = $container->getLastId($chanrecip)-$c->max_msg; + $from_id = $ct->getLastId($chanrecip)-$c->max_msg; $_SESSION[$from_id_sid] = ($from_id<0) ? 0 : $from_id; // reset the oldmsg flag $oldmsg_sid = "pfc_oldmsg_".$c->getId()."_".$clientid."_".$chanid; @@ -42,7 +42,7 @@ $isadmin = $c->isadmin; if (!$isadmin) { - $users = $container->getOnlineNick(NULL); + $users = $ct->getOnlineNick(NULL); if (isset($users["nickid"]) && count($users["nickid"]) == 0) $isadmin = true; } @@ -50,9 +50,16 @@ // setup some user meta $nickid = $u->nickid; // store the user ip - $container->setUserMeta($nickid, 'ip', $_SERVER["REMOTE_ADDR"]); + $ct->setUserMeta($nickid, 'ip', $_SERVER["REMOTE_ADDR"]); // store the admin flag - $container->setUserMeta($nickid, 'isadmin', $isadmin); + $ct->setUserMeta($nickid, 'isadmin', $isadmin); + + // register the user (and his metadata) in the allready joined channel + foreach( $u->channels as $id => $chan ) + $ct->createNick($chan["recipient"], $u->nick, $u->nickid); + foreach( $u->privmsg as $id => $pv ) + $ct->createNick($pv["recipient"], $u->nick, $u->nickid); + // connect to the server $xml_reponse->addScript("pfc.handleResponse('connect', 'ok', '');"); } Modified: trunk/src/commands/getonlinenick.class.php =================================================================== --- trunk/src/commands/getonlinenick.class.php 2006-09-21 12:13:24 UTC (rev 780) +++ trunk/src/commands/getonlinenick.class.php 2006-09-22 08:12:22 UTC (rev 781) @@ -22,9 +22,9 @@ // get the real nickname list $users = $container->getOnlineNick($recipient); $nicklist = array(); - if (isset($users["nickid"])) - foreach($users["nickid"] as $nid) - $nicklist[] = $container->getNickname($nid); + if (isset($users["nick"])) + foreach($users["nick"] as $n) + $nicklist[] = $n; sort($nicklist); if ($oldnicklist != $nicklist) // check if the nickname list must be updated on the client side Modified: trunk/src/commands/join.class.php =================================================================== --- trunk/src/commands/join.class.php 2006-09-21 12:13:24 UTC (rev 780) +++ trunk/src/commands/join.class.php 2006-09-22 08:12:22 UTC (rev 781) @@ -56,8 +56,12 @@ $cmdp["flag"] = 2; $cmd =& pfcCommand::Factory("notice"); $cmd->run($xml_reponse, $cmdp); + + // register the user (and his metadata) in the channel + $ct =& $c->getContainerInstance(); + $ct->createNick($chanrecip, $u->nick, $u->nickid); } - + // return ok to the client // then the client will create a new tab $xml_reponse->addScript("pfc.handleResponse('".$this->name."', 'ok', Array('".$chanid."','".addslashes($channame)."'));"); Modified: trunk/src/commands/leave.class.php =================================================================== --- trunk/src/commands/leave.class.php 2006-09-21 12:13:24 UTC (rev 780) +++ trunk/src/commands/leave.class.php 2006-09-22 08:12:22 UTC (rev 781) @@ -72,7 +72,7 @@ // remove the nickname from the channel/pv $container =& $c->getContainerInstance(); - $container->removeNick($chan, $u->nickid); + $container->removeNick($leave_recip, $u->nickid); // return ok to the client // then the client will remove the channel' tab Modified: trunk/src/commands/update.class.php =================================================================== --- trunk/src/commands/update.class.php 2006-09-21 12:13:24 UTC (rev 780) +++ trunk/src/commands/update.class.php 2006-09-22 08:12:22 UTC (rev 781) @@ -19,20 +19,8 @@ if ($u->active) { $cmdp = $p; - // update the user nickname timestamp + // update the user nickname timestamp on the server $cmd =& pfcCommand::Factory("updatemynick"); - foreach( $u->channels as $id => $chan ) - { - $cmdp["recipient"] = $chan["recipient"]; - $cmdp["recipientid"] = $id; - $cmd->run($xml_reponse, $cmdp); - } - foreach( $u->privmsg as $id => $pv ) - { - $cmdp["recipient"] = $pv["recipient"]; - $cmdp["recipientid"] = $id; - $cmd->run($xml_reponse, $cmdp); - } $cmdp["recipient"] = NULL; $cmdp["recipientid"] = NULL; $cmd->run($xml_reponse, $cmdp); Modified: trunk/src/commands/updatemynick.class.php =================================================================== --- trunk/src/commands/updatemynick.class.php 2006-09-21 12:13:24 UTC (rev 780) +++ trunk/src/commands/updatemynick.class.php 2006-09-22 08:12:22 UTC (rev 781) @@ -17,22 +17,6 @@ $container =& $c->getContainerInstance(); $container->updateNick($u->nickid); - - $was_there = ($container->isNickOnline($recipient, $nickid) >=0); - 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()); - // adjust the timeout value dynamicaly for this user - $c->timeout += $c->refresh_delay; - $c->saveInCache(); - */ - } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-21 12:13:35
|
Revision: 780 http://svn.sourceforge.net/phpfreechat/?rev=780&view=rev Author: kerphi Date: 2006-09-21 05:13:24 -0700 (Thu, 21 Sep 2006) Log Message: ----------- Rename bad spelled parameters name : 'skip_proxys' to 'skip_proxies', 'post_proxys' to 'post_proxies', 'pre_proxys' to 'pre_proxies', 'proxys_cfg' to 'proxies_cfg', 'proxys_path' to 'proxies_path', and 'proxys_path_default' to 'proxies_path_default'. Modified Paths: -------------- trunk/demo/demo48_custom_proxy.php trunk/src/pfccommand.class.php trunk/src/pfcglobalconfig.class.php trunk/src/pfci18n.class.php trunk/src/proxies/censor.class.php trunk/src/proxies/log.class.php trunk/src/proxies/noflood.class.php Added Paths: ----------- trunk/src/proxies/ Removed Paths: ------------- trunk/src/proxys/ Modified: trunk/demo/demo48_custom_proxy.php =================================================================== --- trunk/demo/demo48_custom_proxy.php 2006-09-21 09:10:29 UTC (rev 779) +++ trunk/demo/demo48_custom_proxy.php 2006-09-21 12:13:24 UTC (rev 780) @@ -3,9 +3,9 @@ require_once dirname(__FILE__)."/../src/phpfreechat.class.php"; $params["serverid"] = md5(__FILE__); // calculate a unique id for this chat -$params["skip_proxys"] = array("censor"); // shows how to disable a proxy (try to write fuck in the chat, it should be possible) -$params["post_proxys"] = array("myproxy"); -$params["proxys_path"] = dirname(__FILE__).'/demo48_custom_proxy'; +$params["skip_proxies"] = array("censor"); // shows how to disable a proxy (try to write fuck in the chat, it should be possible) +$params["post_proxies"] = array("myproxy"); +$params["proxies_path"] = dirname(__FILE__).'/demo48_custom_proxy'; $chat = new phpFreeChat( $params ); ?> Modified: trunk/src/pfccommand.class.php =================================================================== --- trunk/src/pfccommand.class.php 2006-09-21 09:10:29 UTC (rev 779) +++ trunk/src/pfccommand.class.php 2006-09-21 12:13:24 UTC (rev 780) @@ -79,21 +79,21 @@ $cmd =& new $cmd_classname(); $cmd->name = $cmd_name; - // instanciate the proxys chaine + // instanciate the proxies chaine $firstproxy =& $cmd; - for($i = count($c->_proxys)-1; $i >= 0; $i--) + for($i = count($c->_proxies)-1; $i >= 0; $i--) { - $proxy_name = strtolower($c->_proxys[$i]); + $proxy_name = strtolower($c->_proxies[$i]); $proxy_classname = "pfcProxyCommand_" . $proxy_name; if (!class_exists($proxy_classname)) { // try to include the proxy class file from the default path or from the customized path - $proxy_filename = $c->proxys_path_default.'/'.$proxy_name.".class.php"; + $proxy_filename = $c->proxies_path_default.'/'.$proxy_name.".class.php"; if (file_exists($proxy_filename)) require_once($proxy_filename); else { - $proxy_filename = $c->proxys_path.'/'.$proxy_name.".class.php"; + $proxy_filename = $c->proxies_path.'/'.$proxy_name.".class.php"; if (file_exists($proxy_filename)) require_once($proxy_filename); } } Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-09-21 09:10:29 UTC (rev 779) +++ trunk/src/pfcglobalconfig.class.php 2006-09-21 12:13:24 UTC (rev 780) @@ -41,15 +41,15 @@ var $lockurl = "http://www.phpfreechat.net"; // this is the url where the users must be redirected when the chat is locked // these parameters are static (cached) - var $skip_proxys = array(); // these proxies will be skiped. ex: append "censor" to the list to disable words censoring - var $post_proxys = array(); // these proxies will be handled just before to process commands and just after system proxies - var $pre_proxys = array(); // these proxies will be handled before system proxies (at begining) - var $proxys_cfg = array("auth" => array(), + var $skip_proxies = array(); // these proxies will be skiped. ex: append "censor" to the list to disable words censoring + var $post_proxies = array(); // these proxies will be handled just before to process commands and just after system proxies + var $pre_proxies = array(); // these proxies will be handled before system proxies (at begining) + var $proxies_cfg = array("auth" => array(), "noflood" => array("limit"=>10,"delay"=>5), "censor" => array("words"=>array("fuck","sex","bitch"),"replaceby"=>"*"), "log" => array("path"=>"")); - var $proxys_path = ""; // a custom proxies path - var $proxys_path_default = ""; // dirname(__FILE__).'/proxys' + var $proxies_path = ""; // a custom proxies path + var $proxies_path_default = ""; // dirname(__FILE__).'/proxies' var $title = ""; // default is _pfc("My Chat") var $channels = array(); // the default joined channels when opening the chat var $frozen_channels = array(); // if empty, allows users to create there own channels @@ -109,8 +109,8 @@ var $debugxajax = false; // private parameters - var $_sys_proxys = array("lock", "checktimeout", "checknickchange", "auth", "noflood", "censor", "log"); - var $_proxys = array(); // will contains proxies to execute on each command (filled in the init step) + var $_sys_proxies = array("lock", "checktimeout", "checknickchange", "auth", "noflood", "censor", "log"); + var $_proxies = array(); // will contains proxies to execute on each command (filled in the init step) var $_dyn_params = array("nick","isadmin","islocked","admins","frozen_channels"); var $_params_type = array(); @@ -168,11 +168,11 @@ if (preg_match('/^_/',$k)) $this->errors[] = _pfc("Error: '%s' is a private parameter, you are not allowed to change it", $k); - if ($k == "proxys_cfg") + if ($k == "proxies_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; + foreach ( $params["proxies_cfg"] as $k2 => $v2 ) + $this->proxies_cfg[$k2] = $v2; } else $this->$k = $v; @@ -399,30 +399,30 @@ // calculate the proxies chaine - $this->_proxys = array(); - foreach($this->pre_proxys as $px) + $this->_proxies = array(); + foreach($this->pre_proxies as $px) { - if (!in_array($px,$this->skip_proxys) && !in_array($px,$this->_proxys)) - $this->_proxys[] = $px; + if (!in_array($px,$this->skip_proxies) && !in_array($px,$this->_proxies)) + $this->_proxies[] = $px; } - foreach($this->_sys_proxys as $px) + foreach($this->_sys_proxies as $px) { - if (!in_array($px,$this->skip_proxys) && !in_array($px,$this->_proxys)) - $this->_proxys[] = $px; + if (!in_array($px,$this->skip_proxies) && !in_array($px,$this->_proxies)) + $this->_proxies[] = $px; } - foreach($this->post_proxys as $px) + foreach($this->post_proxies as $px) { - if (!in_array($px,$this->skip_proxys) && !in_array($px,$this->_proxys)) - $this->_proxys[] = $px; + if (!in_array($px,$this->skip_proxies) && !in_array($px,$this->_proxies)) + $this->_proxies[] = $px; } // save the proxies path - $this->proxys_path_default = dirname(__FILE__).'/proxys'; + $this->proxies_path_default = dirname(__FILE__).'/proxies'; // check the customized proxies path - if ($this->proxys_path != '' && !is_dir($this->proxys_path)) - $this->errors[] = _pfc("'%s' directory doesn't exist", $this->proxys_path); + if ($this->proxies_path != '' && !is_dir($this->proxies_path)) + $this->errors[] = _pfc("'%s' directory doesn't exist", $this->proxies_path); // load smileys from file $this->loadSmileyTheme(); Modified: trunk/src/pfci18n.class.php =================================================================== --- trunk/src/pfci18n.class.php 2006-09-21 09:10:29 UTC (rev 779) +++ trunk/src/pfci18n.class.php 2006-09-21 12:13:24 UTC (rev 780) @@ -137,7 +137,7 @@ $files = array_merge($files, glob(dirname(__FILE__)."/*.php")); $files = array_merge($files, glob(dirname(__FILE__)."/commands/*.php")); $files = array_merge($files, glob(dirname(__FILE__)."/containers/*.php")); - $files = array_merge($files, glob(dirname(__FILE__)."/proxys/*.php")); + $files = array_merge($files, glob(dirname(__FILE__)."/proxies/*.php")); $files = array_merge($files, glob(dirname(__FILE__)."/../themes/default/templates/*.php")); $res = array(); Copied: trunk/src/proxies (from rev 779, trunk/src/proxys) Modified: trunk/src/proxies/censor.class.php =================================================================== --- trunk/src/proxys/censor.class.php 2006-09-21 09:10:29 UTC (rev 779) +++ trunk/src/proxies/censor.class.php 2006-09-21 12:13:24 UTC (rev 780) @@ -44,8 +44,8 @@ $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"]; + $words = $c->proxies_cfg[$this->proxyname]["words"]; + $replaceby = $c->proxies_cfg[$this->proxyname]["replaceby"]; $patterns = array(); $replacements = array(); Modified: trunk/src/proxies/log.class.php =================================================================== --- trunk/src/proxys/log.class.php 2006-09-21 09:10:29 UTC (rev 779) +++ trunk/src/proxies/log.class.php 2006-09-21 12:13:24 UTC (rev 780) @@ -43,8 +43,8 @@ $c =& $this->c; $u =& $this->u; - $logpath = ($c->proxys_cfg[$this->proxyname]["path"] == "" ? $c->data_private_path."/logs" : - $c->proxys_cfg[$this->proxyname]["path"]); + $logpath = ($c->proxies_cfg[$this->proxyname]["path"] == "" ? $c->data_private_path."/logs" : + $c->proxies_cfg[$this->proxyname]["path"]); $logpath .= "/".$c->getId(); if (!file_exists($logpath)) @mkdir_r($logpath); Modified: trunk/src/proxies/noflood.class.php =================================================================== --- trunk/src/proxys/noflood.class.php 2006-09-21 09:10:29 UTC (rev 779) +++ trunk/src/proxies/noflood.class.php 2006-09-21 12:13:24 UTC (rev 780) @@ -51,12 +51,12 @@ $nbflood = $container->getUserMeta($nickid, 'nbflood'); $floodtime = time(); - if ($floodtime - $lastfloodtime <= $c->proxys_cfg[$this->proxyname]["delay"]) + if ($floodtime - $lastfloodtime <= $c->proxies_cfg[$this->proxyname]["delay"]) $nbflood++; else $nbflood = 0; - if ($nbflood>$c->proxys_cfg[$this->proxyname]["limit"]) + if ($nbflood>$c->proxies_cfg[$this->proxyname]["limit"]) { // warn the flooder $msg = _pfc("Please don't post so many message, flood is not tolerated"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-21 09:10:35
|
Revision: 779 http://svn.sourceforge.net/phpfreechat/?rev=779&view=rev Author: kerphi Date: 2006-09-21 02:10:29 -0700 (Thu, 21 Sep 2006) Log Message: ----------- remove obsolete 'prefix' parameter Modified Paths: -------------- trunk/demo/demo2_simple_with_params.php Modified: trunk/demo/demo2_simple_with_params.php =================================================================== --- trunk/demo/demo2_simple_with_params.php 2006-09-21 08:40:39 UTC (rev 778) +++ trunk/demo/demo2_simple_with_params.php 2006-09-21 09:10:29 UTC (rev 779) @@ -5,7 +5,6 @@ $params["serverid"] = md5(__FILE__); // calculate a unique id for this chat $params["title"] = "A simple chat with user's parameters"; $params["nick"] = "guest"; // setup the intitial nickname -$params["prefix"] = "myprefix_"; $params["frozen_nick"] = true; // do not allow to change the nickname $params["shownotice"] = 0; // 0 = nothing, 1 = just nickname changes, 2 = connect/quit, 3 = nick + connect/quit $params["max_nick_len"] = 20; // nickname length could not be longer than 10 caracteres This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-21 08:41:02
|
Revision: 778 http://svn.sourceforge.net/phpfreechat/?rev=778&view=rev Author: kerphi Date: 2006-09-21 01:40:39 -0700 (Thu, 21 Sep 2006) Log Message: ----------- [en] New parameters: 'max_channels' used to limit the number of channels tabs, 'max_privmsg' used to limit the number of private messages tabs (sponsored by Johnny Philavanh : 0 USD). [fr] Nouveaux parametres: 'max_channels' permet de limiter le nombre de channel qu'un utilisateur peut creer, 'max_privmsg' permet de limiter le nombre de messages prives par utilisateur (sponsorise par Johnny Philavanh : 0 USD) Modified Paths: -------------- trunk/demo/demo2_simple_with_params.php trunk/src/client/chat.js.tpl.php trunk/src/client/pfcclient.js trunk/src/commands/join.class.php trunk/src/commands/privmsg.class.php trunk/src/pfcglobalconfig.class.php Modified: trunk/demo/demo2_simple_with_params.php =================================================================== --- trunk/demo/demo2_simple_with_params.php 2006-09-20 20:24:30 UTC (rev 777) +++ trunk/demo/demo2_simple_with_params.php 2006-09-21 08:40:39 UTC (rev 778) @@ -10,7 +10,9 @@ $params["shownotice"] = 0; // 0 = nothing, 1 = just nickname changes, 2 = connect/quit, 3 = nick + connect/quit $params["max_nick_len"] = 20; // nickname length could not be longer than 10 caracteres $params["max_text_len"] = 300; // a message cannot be longer than 50 caracteres -$params["refresh_delay"] = 10000; // chat refresh speed is 10 secondes (10000ms) +$params["max_channels"] = 3; // limit the number of joined channels tab to 3 +$params["max_privmsg"] = 1; // limit the number of private message tab to 1 +$params["refresh_delay"] = 10000; // chat refresh speed is 10 secondes (10000ms) $params["max_msg"] = 15; // max message in the history is 15 (message seen when reloading the chat) $params["height"] = "230px"; // height of chat area is 230px $params["width"] = "800px"; // width of chat area is 800px Modified: trunk/src/client/chat.js.tpl.php =================================================================== --- trunk/src/client/chat.js.tpl.php 2006-09-20 20:24:30 UTC (rev 777) +++ trunk/src/client/chat.js.tpl.php 2006-09-21 08:40:39 UTC (rev 778) @@ -82,6 +82,8 @@ "A problem occurs during rehash", // _pfc "Choosen nickname is allready used", // _pfc "phpfreechat current version is %s", // _pfc + "Maximum number of joined channels has been reached", // _pfc + "Maximum number of private chat has been reached", // _pfc ); foreach($labels_to_load as $l) { Modified: trunk/src/client/pfcclient.js =================================================================== --- trunk/src/client/pfcclient.js 2006-09-20 20:24:30 UTC (rev 777) +++ trunk/src/client/pfcclient.js 2006-09-21 08:40:39 UTC (rev 778) @@ -168,7 +168,7 @@ this.refresh_loginlogout(); } } - else if (cmd == "join") + else if (cmd == "join" || cmd == "join2") { if (resp =="ok") { @@ -176,29 +176,13 @@ var tabid = param[0]; var name = param[1]; this.gui.createTab(name, tabid, "ch"); - this.gui.setTabById(tabid); - /* - this.channels.push(name); - this.channelids.push(tabid); - */ + if (cmd != "join2") this.gui.setTabById(tabid); this.refresh_Smileys(); this.refresh_WhosOnline(); } - else - alert(cmd + "-"+resp+"-"+param); - } - else if (cmd == "join2") - { - if (resp =="ok") + else if (resp == "max_channels") { - // create the new channel - var tabid = param[0]; - var name = param[1]; - this.gui.createTab(name, tabid, "ch"); - // do not switch to the new created tab - // keep it in the background - // this.gui.setTabById(tabid); - this.refresh_WhosOnline(); + this.displayMsg( cmd, this.res.getLabel('Maximum number of joined channels has been reached') ); } else alert(cmd + "-"+resp+"-"+param); @@ -228,7 +212,7 @@ } } - else if (cmd == "privmsg") + else if (cmd == "privmsg" || cmd == "privmsg2") { if (resp == "ok") { @@ -236,34 +220,16 @@ var tabid = param[0]; var name = param[1]; this.gui.createTab(name, tabid, "pv"); - this.gui.setTabById(tabid); + if (cmd != "privmsg2") this.gui.setTabById(tabid); this.privmsgs.push(name); this.privmsgids.push(tabid); } - else if (resp == "unknown") + else if (resp == "max_privmsg") { - // speak to unknown user + this.displayMsg( cmd, this.res.getLabel('Maximum number of private chat has been reached') ); } - else - alert(cmd + "-"+resp+"-"+param); - } - else if (cmd == "privmsg2") - { - if (resp == "ok") - { - // create the new channel - var tabid = param[0]; - var name = param[1]; - this.gui.createTab(name, tabid, "pv"); - // do not switch to the new created tab - // keep it in the background - // this.gui.setTabById(tabid); - - this.privmsgs.push(name); - this.privmsgids.push(tabid); - } else if (resp == "unknown") { // speak to unknown user Modified: trunk/src/commands/join.class.php =================================================================== --- trunk/src/commands/join.class.php 2006-09-20 20:24:30 UTC (rev 777) +++ trunk/src/commands/join.class.php 2006-09-21 08:40:39 UTC (rev 778) @@ -33,29 +33,31 @@ if(!isset($u->channels[$chanid])) { + if ($c->max_channels <= count($u->channels)) + { + // the maximum number of joined channels has been reached + $xml_reponse->addScript("pfc.handleResponse('".$this->name."', 'max_channels', Array());"); + return; + } + $u->channels[$chanid]["recipient"] = $chanrecip; $u->channels[$chanid]["name"] = $channame; $u->saveInCache(); - + // clear the cached nicknames list for the given channel $nicklist_sid = "pfc_nicklist_".$c->getId()."_".$clientid."_".$chanid; $_SESSION[$nicklist_sid] = NULL; + + // show a join message + $cmdp = $p; + $cmdp["param"] = _pfc("%s joins %s",$u->nick, $channame); + $cmdp["recipient"] = $chanrecip; + $cmdp["recipientid"] = $chanid; + $cmdp["flag"] = 2; + $cmd =& pfcCommand::Factory("notice"); + $cmd->run($xml_reponse, $cmdp); } - // show a join message - $cmdp = $p; - $cmdp["param"] = _pfc("%s joins %s",$u->nick, $channame); - $cmdp["recipient"] = $chanrecip; - $cmdp["recipientid"] = $chanid; - $cmdp["flag"] = 2; - $cmd =& pfcCommand::Factory("notice"); - $cmd->run($xml_reponse, $cmdp); - - - //$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."');"); - // return ok to the client // then the client will create a new tab $xml_reponse->addScript("pfc.handleResponse('".$this->name."', 'ok', Array('".$chanid."','".addslashes($channame)."'));"); Modified: trunk/src/commands/privmsg.class.php =================================================================== --- trunk/src/commands/privmsg.class.php 2006-09-20 20:24:30 UTC (rev 777) +++ trunk/src/commands/privmsg.class.php 2006-09-21 08:40:39 UTC (rev 778) @@ -61,6 +61,13 @@ // in the sessions if (!isset($u->privmsg[$pvrecipientid])) { + if ($c->max_privmsg <= count($u->privmsg)) + { + // the maximum number of private messages has been reached + $xml_reponse->addScript("pfc.handleResponse('".$this->name."', 'max_privmsg', Array());"); + return; + } + $u->privmsg[$pvrecipientid]["recipient"] = $pvrecipient; $u->privmsg[$pvrecipientid]["name"] = $pvname; $u->privmsg[$pvrecipientid]["pvnickid"] = $pvnickid; Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-09-20 20:24:30 UTC (rev 777) +++ trunk/src/pfcglobalconfig.class.php 2006-09-21 08:40:39 UTC (rev 778) @@ -53,6 +53,8 @@ var $title = ""; // default is _pfc("My Chat") var $channels = array(); // the default joined channels when opening the chat var $frozen_channels = array(); // if empty, allows users to create there own channels + var $max_channels = 10; // this the max number of allowed channels by users + var $max_privmsg = 5; // this the max number of allowed privmsg by users var $frozen_nick = false; var $max_nick_len = 15; var $max_text_len = 400; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-20 20:24:36
|
Revision: 777 http://svn.sourceforge.net/phpfreechat/?rev=777&view=rev Author: kerphi Date: 2006-09-20 13:24:30 -0700 (Wed, 20 Sep 2006) Log Message: ----------- Bug fix: the params type was considered as array but it can be an object if a pfcglobalconfig instance is passed Modified Paths: -------------- trunk/src/phpfreechat.class.php Modified: trunk/src/phpfreechat.class.php =================================================================== --- trunk/src/phpfreechat.class.php 2006-09-20 20:14:04 UTC (rev 776) +++ trunk/src/phpfreechat.class.php 2006-09-20 20:24:30 UTC (rev 777) @@ -38,7 +38,9 @@ function phpFreeChat( &$params ) { - if (isset($params["debug"]) && $params["debug"]) + if (!is_object($params) && + isset($params["debug"]) && + $params["debug"]) require_once dirname(__FILE__)."/../debug/log.php"; // check if the given parameters is a simple array This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-20 20:14:13
|
Revision: 776 http://svn.sourceforge.net/phpfreechat/?rev=776&view=rev Author: kerphi Date: 2006-09-20 13:14:04 -0700 (Wed, 20 Sep 2006) Log Message: ----------- add some link to documentation in the index page Modified Paths: -------------- trunk/index.php trunk/misc/tarSource Modified: trunk/index.php =================================================================== --- trunk/index.php 2006-09-20 18:31:54 UTC (rev 775) +++ trunk/index.php 2006-09-20 20:14:04 UTC (rev 776) @@ -53,17 +53,44 @@ <li> <ul> <li class="item"> - <a href="README.en">readme [en]</a> + <a href="overview.en.html">Overview [en]</a> </li> <li class="item"> - <a href="README.fr">readme [fr]</a> + <a href="overview.fr.html">Overview [fr]</a> </li> <li class="item"> - <a href="INSTALL.en">install [en]</a> + <a href="overview.es.html">Overview [es]</a> </li> <li class="item"> - <a href="INSTALL.fr">install [fr]</a> + <a href="overview.ar.html">Overview [zh]</a> </li> + <li class="item"> + <a href="overview.ar.html">Overview [ar]</a> + </li> + <li class="item"> + <a href="install.en.html">Install [en]</a> + </li> + <li class="item"> + <a href="install.fr.html">Install [fr]</a> + </li> + <li class="item"> + <a href="faq.en.html">FAQ [en]</a> + </li> + <li class="item"> + <a href="faq.fr.html">FAQ [fr]</a> + </li> + <li class="item"> + <a href="customize.en.html">Customize [en]</a> + </li> + <li class="item"> + <a href="customize.fr.html">Customize [fr]</a> + </li> + <li class="item"> + <a href="changelog.en.html">ChangeLog [en]</a> + </li> + <li class="item"> + <a href="changelog.fr.html">ChangeLog [fr]</a> + </li> </ul> </li> </ul> Modified: trunk/misc/tarSource =================================================================== --- trunk/misc/tarSource 2006-09-20 18:31:54 UTC (rev 775) +++ trunk/misc/tarSource 2006-09-20 20:14:04 UTC (rev 776) @@ -9,19 +9,19 @@ svn export .. ./$NAME rm -rf ./$NAME/contrib echo "-> downloading documentation" -wget http://www.phpfreechat.net/pages/fr/install.html -q -O ./$NAME/INSTALL.fr.html -wget http://www.phpfreechat.net/pages/en/install.html -q -O ./$NAME/INSTALL.en.html -wget http://www.phpfreechat.net/pages/fr/faq.html -q -O ./$NAME/FAQ.fr.html -wget http://www.phpfreechat.net/pages/en/faq.html -q -O ./$NAME/FAQ.en.html -wget http://www.phpfreechat.net/pages/fr/overview.html -q -O ./$NAME/OVERVIEW.fr.html -wget http://www.phpfreechat.net/pages/en/overview.html -q -O ./$NAME/OVERVIEW.en.html -wget http://www.phpfreechat.net/pages/ar/overview.html -q -O ./$NAME/OVERVIEW.ar.html -wget http://www.phpfreechat.net/pages/es/overview.html -q -O ./$NAME/OVERVIEW.es.html -wget http://www.phpfreechat.net/pages/zh/overview.html -q -O ./$NAME/OVERVIEW.zh.html -wget http://www.phpfreechat.net/pages/fr/customize.html -q -O ./$NAME/CUSTOMIZE.fr.html -wget http://www.phpfreechat.net/pages/en/customize.html -q -O ./$NAME/CUSTOMIZE.en.html -wget http://www.phpfreechat.net/pages/fr/changelog.html -q -O ./$NAME/CHANGELOG.fr.html -wget http://www.phpfreechat.net/pages/en/changelog.html -q -O ./$NAME/CHANGELOG.en.html +wget http://www.phpfreechat.net/pages/fr/install.html -q -O ./$NAME/install.fr.html +wget http://www.phpfreechat.net/pages/en/install.html -q -O ./$NAME/install.en.html +wget http://www.phpfreechat.net/pages/fr/faq.html -q -O ./$NAME/faq.fr.html +wget http://www.phpfreechat.net/pages/en/faq.html -q -O ./$NAME/faq.en.html +wget http://www.phpfreechat.net/pages/fr/overview.html -q -O ./$NAME/overview.fr.html +wget http://www.phpfreechat.net/pages/en/overview.html -q -O ./$NAME/overview.en.html +wget http://www.phpfreechat.net/pages/ar/overview.html -q -O ./$NAME/overview.ar.html +wget http://www.phpfreechat.net/pages/es/overview.html -q -O ./$NAME/overview.es.html +wget http://www.phpfreechat.net/pages/zh/overview.html -q -O ./$NAME/overview.zh.html +wget http://www.phpfreechat.net/pages/fr/customize.html -q -O ./$NAME/customize.fr.html +wget http://www.phpfreechat.net/pages/en/customize.html -q -O ./$NAME/customize.en.html +wget http://www.phpfreechat.net/pages/fr/changelog.html -q -O ./$NAME/changelog.fr.html +wget http://www.phpfreechat.net/pages/en/changelog.html -q -O ./$NAME/changelog.en.html echo "-> creating checkmd5.php file" ./checkmd5 ./$NAME ./$NAME/checkmd5.php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-20 18:32:27
|
Revision: 775 http://svn.sourceforge.net/phpfreechat/?rev=775&view=rev Author: kerphi Date: 2006-09-20 11:31:54 -0700 (Wed, 20 Sep 2006) Log Message: ----------- [en] Bug fix: the proxy.php loading was very long with gzhandler enabled (thanks to Alexander Blach from http://www.freakboard.de). [fr] Bug fix : le fichier proxy.php chargait tres lentement les pages lorsque gzhandler etait active (merci a Alexander Blach de http://www.freakboard.de) Modified Paths: -------------- trunk/src/client/proxy.php.tpl Modified: trunk/src/client/proxy.php.tpl =================================================================== --- trunk/src/client/proxy.php.tpl 2006-09-20 09:49:20 UTC (rev 774) +++ trunk/src/client/proxy.php.tpl 2006-09-20 18:31:54 UTC (rev 775) @@ -39,5 +39,5 @@ header("Content-Type: ".$contenttype); session_cache_limiter('public'); echo file_get_contents($file); - +flush(); // needed to fix problems with gzhandler enabled ?> \ 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-09-20 09:49:23
|
Revision: 774 http://svn.sourceforge.net/phpfreechat/?rev=774&view=rev Author: kerphi Date: 2006-09-20 02:49:20 -0700 (Wed, 20 Sep 2006) Log Message: ----------- fix a syntax error Modified Paths: -------------- trunk/src/commands/identify.class.php Modified: trunk/src/commands/identify.class.php =================================================================== --- trunk/src/commands/identify.class.php 2006-09-20 09:38:14 UTC (rev 773) +++ trunk/src/commands/identify.class.php 2006-09-20 09:49:20 UTC (rev 774) @@ -58,7 +58,7 @@ { // ok the current user is an admin, just save the isadmin flag in the metadata $container =& $c->getContainerInstance(); - $container->setUserMeta($u->nickid, 'isadmin' $isadmin); + $container->setUserMeta($u->nickid, 'isadmin', $isadmin); $msg .= _pfc("Succesfully identified"); $xml_reponse->addScript("pfc.handleResponse('".$this->name."', 'ok', '".$msg."');"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-20 09:38:19
|
Revision: 773 http://svn.sourceforge.net/phpfreechat/?rev=773&view=rev Author: kerphi Date: 2006-09-20 02:38:14 -0700 (Wed, 20 Sep 2006) Log Message: ----------- Portuguese translation (pt_PT) update (thanks to David Pinheiro) Modified Paths: -------------- trunk/i18n/pt_PT/main.php Modified: trunk/i18n/pt_PT/main.php =================================================================== --- trunk/i18n/pt_PT/main.php 2006-09-20 08:23:17 UTC (rev 772) +++ trunk/i18n/pt_PT/main.php 2006-09-20 09:38:14 UTC (rev 773) @@ -25,61 +25,62 @@ * * @author Stephane Gully <ste...@gm...> * @translation Paulo Bras + * @translation David Pinheiro */ // line 45 in phpfreechatconfig.class.php $GLOBALS["i18n"]["My Chat"] = "Chat"; // line 201 in phpfreechatconfig.class.php -$GLOBALS["i18n"]["%s not found, %s library can't be found."] = "%s nao encontrado, %s biblioteca não encontrada."; +$GLOBALS["i18n"]["%s not found, %s library can't be found."] = "%s não encontrado, biblioteca %s não encontrada."; // line 355 in phpfreechat.class.php -$GLOBALS["i18n"]["Please enter your nickname"] = "Por favor, indique o seu nome de utilizador"; +$GLOBALS["i18n"]["Please enter your nickname"] = "Por favor, indica o teu nome de utilizador"; // line 565 in phpfreechat.class.php -$GLOBALS["i18n"]["Text cannot be empty"] = "Deverá inserir algo na linha de texto"; +$GLOBALS["i18n"]["Text cannot be empty"] = "O texto não pode ser vazio"; // line 392 in phpfreechat.class.php -$GLOBALS["i18n"]["%s changes his nickname to %s"] = "%s modifica o nome de utilizador para %s"; +$GLOBALS["i18n"]["%s changes his nickname to %s"] = "%s alterou o nome de utilizador para %s"; // line 398 in phpfreechat.class.php -$GLOBALS["i18n"]["%s is connected"] = "%s está ligado"; +$GLOBALS["i18n"]["%s is connected"] = "%s acabou de entrar no chat"; // line 452 in phpfreechat.class.php -$GLOBALS["i18n"]["%s quit"] = "%s sair"; +$GLOBALS["i18n"]["%s quit"] = "%s saiu"; // line 468 in phpfreechat.class.php -$GLOBALS["i18n"]["%s disconnected (timeout)"] = "%s desligado (excesso de tempo)"; +$GLOBALS["i18n"]["%s disconnected (timeout)"] = "%s desligou-se (demasiado tempo inactivo)"; // line 262 in phpfreechat.class.php -$GLOBALS["i18n"]["Unknown command [%s]"] = "comando desconhecido [%s]"; +$GLOBALS["i18n"]["Unknown command [%s]"] = "Comando desconhecido [%s]"; // line 149 in phpfreechatconfig.class.php $GLOBALS["i18n"]["%s doesn't exist: %s"] = "%s não existe: %s"; // line 180 in phpfreechatconfig.class.php -$GLOBALS["i18n"]["You need %s"] = "Necessita %s"; +$GLOBALS["i18n"]["You need %s"] = "Precisas %s"; // line 241 in phpfreechatconfig.class.php -$GLOBALS["i18n"]["%s doesn't exist, %s library can't be found"] = "%s não existe, %s biblioteca não encontrada"; +$GLOBALS["i18n"]["%s doesn't exist, %s library can't be found"] = "%s não existe, biblioteca %s não encontrada"; // line 280 in phpfreechatconfig.class.php $GLOBALS["i18n"]["%s doesn't exist"] = "%s não existe"; // line 433 in phpfreechatconfig.class.php -$GLOBALS["i18n"]["%s directory must be specified"] = "%s deve especificar a directoria"; +$GLOBALS["i18n"]["%s directory must be specified"] = "A directoria %s deve ser especificada"; // line 439 in phpfreechatconfig.class.php $GLOBALS["i18n"]["%s must be a directory"] = "%s deve ser uma directoria"; // line 446 in phpfreechatconfig.class.php -$GLOBALS["i18n"]["%s can't be created"] = "%s não pode ser criado"; +$GLOBALS["i18n"]["%s can't be created"] = "%s não pode ser criada"; // line 451 in phpfreechatconfig.class.php -$GLOBALS["i18n"]["%s is not writeable"] = "%s não se pode escrever"; +$GLOBALS["i18n"]["%s is not writeable"] = "%s não pode ser escrita"; // line 496 in phpfreechatconfig.class.php -$GLOBALS["i18n"]["%s is not readable"] = "%s não se pode lêr"; +$GLOBALS["i18n"]["%s is not readable"] = "%s não se pode ser lida"; // line 469 in phpfreechatconfig.class.php $GLOBALS["i18n"]["%s is not a file"] = "%s não é um ficheiro"; @@ -91,10 +92,10 @@ $GLOBALS["i18n"]["PHP FREE CHAT [powered by phpFreeChat-%s]"] = "PHP FREE CHAT [powered by phpFreeChat-%s]"; // line 296 in javascript1.js.tpl.php -$GLOBALS["i18n"]["Hide nickname marker"] = "Escnder côres do nome de utilizador"; +$GLOBALS["i18n"]["Hide nickname marker"] = "Esconder marcador do nome de utilizador"; // line 304 in javascript1.js.tpl.php -$GLOBALS["i18n"]["Show nickname marker"] = "Mostrar as côres do nome de utilizador"; +$GLOBALS["i18n"]["Show nickname marker"] = "Mostrar marcador do nome de utilizador"; // line 389 in javascript1.js.tpl.php $GLOBALS["i18n"]["Disconnect"] = "Desligar"; @@ -109,136 +110,135 @@ $GLOBALS["i18n"]["Cut down"] = "Cortar"; // line 345 in javascript1.js.tpl.php -$GLOBALS["i18n"]["Hide dates and hours"] = "Esconder datas e horas"; +$GLOBALS["i18n"]["Hide dates and hours"] = "Esconder data e hora"; // line 353 in javascript1.js.tpl.php -$GLOBALS["i18n"]["Show dates and hours"] = "Mostrar datas e horas"; +$GLOBALS["i18n"]["Show dates and hours"] = "Mostrar data e hora"; // line 21 in chat.html.tpl.php -$GLOBALS["i18n"]["Enter your message here"] = "Insira a mensagem aqui"; +$GLOBALS["i18n"]["Enter your message here"] = "Insere a mensagem aqui"; // line 24 in chat.html.tpl.php -$GLOBALS["i18n"]["Enter your nickname here"] = "Insira o seu nome de utilizador aqui"; +$GLOBALS["i18n"]["Enter your nickname here"] = "Insere o teu nome de utilizador aqui"; - // line 44 in phpfreechatcontainer.class.php -$GLOBALS["i18n"]["%s must be implemented"] = ""; +$GLOBALS["i18n"]["%s must be implemented"] = "%s precisa ser implementado"; // line 121 in phpfreechatconfig.class.php -$GLOBALS["i18n"]["Error: undefined or obsolete parameter '%s', please correct or remove this parameter"] = ""; +$GLOBALS["i18n"]["Error: undefined or obsolete parameter '%s', please correct or remove this parameter"] = "Erro: Parâmetro indefinido ou obsoleto '%s', por favor corrige ou remove este parâmetro"; // line 343 in phpfreechatconfig.class.php -$GLOBALS["i18n"]["'%s' parameter is mandatory by default use '%s' value"] = ""; +$GLOBALS["i18n"]["'%s' parameter is mandatory by default use '%s' value"] = "O parametro '%s' é necessário, por omissão usa '%s'"; // line 378 in phpfreechatconfig.class.php -$GLOBALS["i18n"]["'%s' parameter must be a positive number"] = ""; +$GLOBALS["i18n"]["'%s' parameter must be a positive number"] = "O parametro '%s' tem que ser um numero positivo"; // line 386 in phpfreechatconfig.class.php -$GLOBALS["i18n"]["'%s' parameter is not valid. Available values are : '%s'"] = ""; +$GLOBALS["i18n"]["'%s' parameter is not valid. Available values are : '%s'"] = "O parâmetro '%s' não é válido. Valores possíveis são: '%s'"; // line 574 in phpfreechatconfig.class.php -$GLOBALS["i18n"]["Error: '%s' could not be found, please check your themepath '%s' and your theme '%s' are correct"] = ""; +$GLOBALS["i18n"]["Error: '%s' could not be found, please check your themepath '%s' and your theme '%s' are correct"] = "Erro: '%s' não pode ser encontrado, por favor verifica se o caminho para os temas '%s' e o tema '%s' estão correctos"; // line 48 in phpfreechattemplate.class.php -$GLOBALS["i18n"]["%s template could not be found"] = ""; +$GLOBALS["i18n"]["%s template could not be found"] = "Template %s não encontrado"; // line 37 in chat.html.tpl.php -$GLOBALS["i18n"]["Bold"] = ""; +$GLOBALS["i18n"]["Bold"] = "Negrito"; // line 38 in chat.html.tpl.php -$GLOBALS["i18n"]["Italics"] = ""; +$GLOBALS["i18n"]["Italics"] = "Italico"; // line 39 in chat.html.tpl.php -$GLOBALS["i18n"]["Underline"] = ""; +$GLOBALS["i18n"]["Underline"] = "Sublinhado"; // line 40 in chat.html.tpl.php -$GLOBALS["i18n"]["Delete"] = ""; +$GLOBALS["i18n"]["Delete"] = "Riscado"; // line 41 in chat.html.tpl.php -$GLOBALS["i18n"]["Pre"] = ""; +$GLOBALS["i18n"]["Pre"] = "Pre"; // line 42 in chat.html.tpl.php -$GLOBALS["i18n"]["Mail"] = ""; +$GLOBALS["i18n"]["Mail"] = "Mail"; // line 43 in chat.html.tpl.php -$GLOBALS["i18n"]["Color"] = ""; +$GLOBALS["i18n"]["Color"] = "Cor"; // line 83 in pfcclient.js.tpl.php -$GLOBALS["i18n"]["Hide smiley box"] = ""; +$GLOBALS["i18n"]["Hide smiley box"] = "Esconder ícones expressivos"; // line 84 in pfcclient.js.tpl.php -$GLOBALS["i18n"]["Show smiley box"] = ""; +$GLOBALS["i18n"]["Show smiley box"] = "Mostrar ícones expressivos"; // line 85 in pfcclient.js.tpl.php -$GLOBALS["i18n"]["Hide online users box"] = ""; +$GLOBALS["i18n"]["Hide online users box"] = "Esconder a caixa com os utilizadores ligados"; // line 86 in pfcclient.js.tpl.php -$GLOBALS["i18n"]["Show online users box"] = ""; +$GLOBALS["i18n"]["Show online users box"] = "Mostrar a caixa com os utilizadores ligados"; // line 186 in pfcglobalconfig.class.php -$GLOBALS["i18n"]["My room"] = ""; +$GLOBALS["i18n"]["My room"] = "Sala de Conversa"; // line 19 in unban.class.php -$GLOBALS["i18n"]["Missing parameter"] = ""; +$GLOBALS["i18n"]["Missing parameter"] = "Falta parâmetro"; // line 38 in ban.class.php -$GLOBALS["i18n"]["banished from %s by %s"] = ""; +$GLOBALS["i18n"]["banished from %s by %s"] = "banido de %s por %s"; // line 23 in banlist.class.php -$GLOBALS["i18n"]["The banished user's id list is:"] = ""; +$GLOBALS["i18n"]["The banished user's id list is:"] = "A lista de utilizadores banidos é:"; // line 32 in banlist.class.php -$GLOBALS["i18n"]["Empty"] = ""; +$GLOBALS["i18n"]["Empty"] = "Vazio"; // line 34 in banlist.class.php -$GLOBALS["i18n"]["'/unban {id}' will unban the user identified by {id}"] = ""; +$GLOBALS["i18n"]["'/unban {id}' will unban the user identified by {id}"] = "'/unban {id}' irá admitir o utilizador identificado por {id}"; // line 35 in banlist.class.php -$GLOBALS["i18n"]["'/unban all' will unban all the users on this channel"] = ""; +$GLOBALS["i18n"]["'/unban all' will unban all the users on this channel"] = "'/unban all' irá admitir todos os utilizadors banidos neste canal"; // line 24 in update.class.php -$GLOBALS["i18n"]["%s quit (timeout)"] = ""; +$GLOBALS["i18n"]["%s quit (timeout)"] = "%s saiu (demasiado tempo inactivo)"; // line 46 in join.class.php -$GLOBALS["i18n"]["%s joins %s"] = ""; +$GLOBALS["i18n"]["%s joins %s"] = "%s entrou na sala %s"; // line 31 in kick.class.php -$GLOBALS["i18n"]["kicked from %s by %s"] = ""; +$GLOBALS["i18n"]["kicked from %s by %s"] = "pontapeado da sala %s por %s"; // line 38 in send.class.php -$GLOBALS["i18n"]["Can't send the message, %s is offline"] = ""; +$GLOBALS["i18n"]["Can't send the message, %s is offline"] = "Não consigo enviar a mensagem, %s está deligado"; // line 27 in unban.class.php -$GLOBALS["i18n"]["Nobody has been unbanished"] = ""; +$GLOBALS["i18n"]["Nobody has been unbanished"] = "Ninguem foi readmitido"; // line 42 in unban.class.php -$GLOBALS["i18n"]["%s has been unbanished"] = ""; +$GLOBALS["i18n"]["%s has been unbanished"] = "%s foi readmitido"; // line 49 in unban.class.php -$GLOBALS["i18n"]["%s users have been unbanished"] = ""; +$GLOBALS["i18n"]["%s users have been unbanished"] = "%s utilizadores foram readmitidos"; // line 47 in auth.class.php -$GLOBALS["i18n"]["You are not allowed to run '%s' command"] = ""; +$GLOBALS["i18n"]["You are not allowed to run '%s' command"] = "Não tens permissão para correr o comando '%s'"; // line 66 in auth.class.php -$GLOBALS["i18n"]["Can't join %s because you are banished"] = ""; +$GLOBALS["i18n"]["Can't join %s because you are banished"] = "Não podes entrar na sala %s porque foste banido"; // line 76 in auth.class.php -$GLOBALS["i18n"]["Can't join %s because the channels list is restricted"] = ""; +$GLOBALS["i18n"]["Can't join %s because the channels list is restricted"] = "Não podes entrar na sala %s porque a lista de canais é restrita"; // line 89 in auth.class.php -$GLOBALS["i18n"]["You are not allowed to change your nickname"] = ""; +$GLOBALS["i18n"]["You are not allowed to change your nickname"] = "Não tens permissão para mudar o teu nome de utilizador"; // line 56 in noflood.class.php -$GLOBALS["i18n"]["Please don't post so many message, flood is not tolerated"] = ""; +$GLOBALS["i18n"]["Please don't post so many message, flood is not tolerated"] = "Por favor, não envies mais mensagens, não toleramos envios em massa"; // line 109 in pfcclient.js.tpl.php -$GLOBALS["i18n"]["Private message"] = ""; +$GLOBALS["i18n"]["Private message"] = "Mensagem privada"; // line 110 in pfcclient.js.tpl.php -$GLOBALS["i18n"]["Close this tab"] = ""; +$GLOBALS["i18n"]["Close this tab"] = "Fechar este separador"; // line 199 in pfcgui.js.tpl.php -$GLOBALS["i18n"]["Do you really want to leave this room ?"] = ""; +$GLOBALS["i18n"]["Do you really want to leave this room ?"] = "Tens a certeza que queres deixar esta sala?"; ?> \ 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-09-20 08:23:33
|
Revision: 772 http://svn.sourceforge.net/phpfreechat/?rev=772&view=rev Author: kerphi Date: 2006-09-20 01:23:17 -0700 (Wed, 20 Sep 2006) Log Message: ----------- finish the container refactoring Modified Paths: -------------- trunk/src/containers/file.class.php trunk/src/pfccontainer.class.php trunk/testcase/container_file.php trunk/testcase/container_generic.php Modified: trunk/src/containers/file.class.php =================================================================== --- trunk/src/containers/file.class.php 2006-09-19 21:32:46 UTC (rev 771) +++ trunk/src/containers/file.class.php 2006-09-20 08:23:17 UTC (rev 772) @@ -1,6 +1,6 @@ <?php /** - * pfccontainer_file.class.php + * file.class.php * * Copyright \xA9 2006 Stephane Gully <ste...@gm...> * @@ -36,17 +36,13 @@ function pfcContainer_File(&$config) { pfcContainer::pfcContainer($config); - // $this->loadPaths(); } function loadPaths() { $c =& $this->c; - $c->container_cfg_chat_dir = $c->data_private_path."/chat"; - $c->container_cfg_server_dir = $c->container_cfg_chat_dir."/s_".$c->serverid; - $c->container_cfg_server_nickname_dir = $c->container_cfg_server_dir."/nicknames"; - $c->container_cfg_meta_dir = $c->container_cfg_server_dir."/metadata"; - $c->container_cfg_channel_dir = $c->container_cfg_server_dir."/channels"; + $c->container_cfg_chat_dir = $c->data_private_path."/chat"; + $c->container_cfg_server_dir = $c->container_cfg_chat_dir."/s_".$c->serverid; } function getDefaultConfig() @@ -54,11 +50,8 @@ $c =& $this->c; $cfg = array(); - $cfg["chat_dir"] = ""; // will be generated from the other parameters into the init step - $cfg["server_dir"] = ""; // will be generated from the other parameters into the init step - $cfg["server_nickname_dir"] = ""; // will be generated from the other parameters into the init step - $cfg["meta_dir"] = ""; // will be generated from the other parameters into the init step - $cfg["channel_dir"] = ""; // will be generated from the other parameters into the init step + $cfg["chat_dir"] = ''; // will be generated from the other parameters into the init step + $cfg["server_dir"] = ''; // will be generated from the other parameters into the init step return $cfg; } @@ -72,415 +65,18 @@ $c->container_cfg_chat_dir = $c->data_private_path."/chat"; $this->loadPaths(); - $errors = array_merge($errors, @test_writable_dir($c->container_cfg_chat_dir, "container_cfg_chat_dir")); - $errors = array_merge($errors, @test_writable_dir($c->container_cfg_server_dir, "container_cfg_chat_dir/serverid")); - $errors = array_merge($errors, @test_writable_dir($c->container_cfg_server_nickname_dir, "container_cfg_chat_dir/nicknames")); - $errors = array_merge($errors, @test_writable_dir($c->container_cfg_meta_dir, "container_cfg_chat_dir/metadata")); - $errors = array_merge($errors, @test_writable_dir($c->container_cfg_channel_dir, "container_cfg_chat_dir/channels")); + $errors = array_merge($errors, @test_writable_dir($c->container_cfg_chat_dir, "container_cfg_chat_dir")); + $errors = array_merge($errors, @test_writable_dir($c->container_cfg_server_dir, "container_cfg_chat_dir/serverid")); return $errors; } - /** - * Create (connect/join) the nickname into the server or the channel locations - * Notice: the caller must take care to update all channels the users joined (use stored channel list into metadata) - * @param $chan if NULL then create the user on the server (connect), otherwise create the user on the given channel (join) - * @param $nick the nickname to create - * @param $nickid is the corresponding nickname id (taken from session) - */ - function createNick($chan, $nick, $nickid) - { - $c =& $this->c; - if ($chan == NULL) $chan = 'SERVER'; - - $this->setMeta2("nickid-to-metadata", $nickid, 'nick', $nick); - $this->setMeta2("metadata-to-nickid", 'nick', $this->_encode($nick), $nickid); - - $this->setMeta2("nickid-to-channelid", $nickid, $this->_encode($chan)); - $this->setMeta2("channelid-to-nickid", $this->_encode($chan), $nickid); - - // update the SERVER channel - if ($chan != 'SERVER') $this->updateNick($nickid); - - return true; - } - - /** - * Remove (disconnect/quit) the nickname from the server or from a channel - * Notice: The caller must take care to update all joined channels. - * @param $chan if NULL then remove the user on the server (disconnect), otherwise just remove the user from the given channel (quit) - * @param $nick the nickname to remove - * @return true if the nickname was correctly removed - */ - function removeNick($chan, $nickid) + function setMeta($group, $subgroup, $leaf, $leafvalue = NULL) { - if ($chan == NULL) $chan = 'SERVER'; - - $timestamp = $this->getMeta2("channelid-to-nickid", $this->_encode('SERVER'), $nickid); - $timestamp = $timestamp["timestamp"][0]; - - $deleted_user = array(); - $deleted_user["nick"][] = $this->getNickname($nickid); - $deleted_user["nickid"][] = $nickid; - $deleted_user["timestamp"][] = $timestamp; - - // remove the nickid from the channel list - $this->rmMeta2('channelid-to-nickid', $this->_encode($chan), $nickid); - $this->rmMeta2('nickid-to-channelid', $nickid, $this->_encode($chan)); - - // get the current user's channels list - $channels = $this->getMeta2("nickid-to-channelid",$nickid); - $channels = $channels["value"]; - // no more joined channel, just remove the user's metadata - if (count($channels) == 0) - { - // remove the nickname to nickid correspondance - $this->rmMeta2('metadata-to-nickid', 'nick', $this->_encode($this->getNickname($nickid))); - // remove disconnected nickname metadata - $this->rmMeta2('nickid-to-metadata', $nickid); - } - - return $deleted_user; - } - - /** - * Store/update the alive user status somewhere - * The default File container will just touch (update the date) the nickname file. - * @param $chan where to update the nick, if null then update the server nick - * @param $nick nickname to update (raw nickname) - */ - function updateNick($nickid) - { - $c =& $this->c; - - $chan = 'SERVER'; - - $this->setMeta2("nickid-to-channelid", $nickid, $this->_encode($chan)); - $this->setMeta2("channelid-to-nickid", $this->_encode($chan), $nickid); - return true; - } - - /** - * Change the user' nickname - * Notice: the caller will just call this function one time, this function must take care to update if necessary all channels the user joined - * @param $newnick - * @param $oldnick - * @return true on success, false on failure - */ - function changeNick($newnick, $oldnick) - { - $c =& $this->c; - - $oldnickid = $this->getNickId($oldnick); - $newnickid = $this->getNickId($newnick); - if ($oldnickid == "") return false; // the oldnick must be connected - if ($newnickid != "") return false; // the newnick must not be inuse - - // remove the oldnick to oldnickid correspondance - $this->rmMeta2("metadata-to-nickid", 'nick', $this->_encode($oldnick)); - - // update the nickname - $this->setMeta2("nickid-to-metadata", $oldnickid, 'nick', $newnick); - $this->setMeta2("metadata-to-nickid", 'nick', $this->_encode($newnick), $oldnickid); - return true; - } - - /** - * Returns the nickid corresponding to the given nickname - * The nickid is a unique id used to identify a user (generated from the browser sessionid) - * @param $nick - * @return string the nick id - */ - function getNickId($nick) - { - $nickid = $this->getMeta2("metadata-to-nickid", 'nick', $this->_encode($nick), true); - $nickid = isset($nickid["value"][0]) ? $nickid["value"][0] : ""; - return $nickid; - } - - /** - * Returns the nickname corresponding the the given nickid - * @param $nickid - * @return string the corresponding nickname - */ - function getNickname($nickid) - { - $nick = $this->getMeta2("nickid-to-metadata", $nickid, 'nick', true); - $nick = isset($nick["value"][0]) ? $this->_decode($nick["value"][0]) : ""; - return $nick; - } - - /** - * Remove (disconnect/quit) the timeouted nickname from the server or from a channel - * Notice: this function must remove all nicknames which are not uptodate from the given channel or from the server - * @param $chan if NULL then check obsolete nick on the server, otherwise just check obsolete nick on the given channel - * @param $timeout - * @return array("nickid"=>array("nickid1", ...),"timestamp"=>array(timestamp1, ...)) contains all disconnected nickids and there timestamp - */ - function removeObsoleteNick($timeout) - { - $c =& $this->c; - - $chan = 'SERVER'; - - $deleted_user = array('nick'=>array(), - 'nickid'=>array(), - 'timestamp'=>array(), - 'channels'=>array()); - $ret = $this->getMeta2("channelid-to-nickid", $this->_encode($chan)); - for($i = 0; $i<count($ret['timestamp']); $i++) - { - $timestamp = $ret['timestamp'][$i]; - $nickid = $ret['value'][$i]; - if (time() > ($timestamp+$timeout/1000) ) // user will be disconnected after 'timeout' secondes of inactivity - { - // get the current user's channels list - $channels = array(); - $ret2 = $this->getMeta2("nickid-to-channelid",$nickid); - foreach($ret2["value"] as $userchan) - { - // disconnect the user from each joined channels - $du = $this->removeNick($this->_decode($userchan), $nickid); - $channels[] = $this->_decode($userchan); - } - $deleted_user["nick"] = array_merge($deleted_user["nick"], $du["nick"]); - $deleted_user["nickid"] = array_merge($deleted_user["nickid"], $du["nickid"]); - $deleted_user["timestamp"] = array_merge($deleted_user["timestamp"], $du["timestamp"]); - $deleted_user["channels"] = array_merge($deleted_user["channels"], array($channels)); - } - } - - return $deleted_user; - } - - /** - * Returns the nickname list on the given channel or on the whole server - * @param $chan if NULL then returns all connected user, otherwise just returns the channel nicknames - * @return array("nickid"=>array("nickid1", ...),"timestamp"=>array(timestamp1, ...)) contains the nickid list with the associated timestamp (laste update time) - */ - function getOnlineNick($chan) - { - $c =& $this->c; - - if ($chan == NULL) $chan = 'SERVER'; - - $online_user = array(); - $ret = $this->getMeta2("channelid-to-nickid", $this->_encode($chan)); - for($i = 0; $i<count($ret['timestamp']); $i++) - { - $nickid = $ret['value'][$i]; - - // get timestamp from the SERVER channel - $timestamp = $this->getMeta2("channelid-to-nickid", $this->_encode('SERVER'), $nickid); - $timestamp = $timestamp['timestamp'][0]; - - $online_user["nick"][] = $this->getNickname($nickid); - $online_user["nickid"][] = $nickid; - $online_user["timestamp"][] = $timestamp; - } - return $online_user; - } - - /** - * Returns returns a positive number if the nick is online - * @param $chan if NULL then check if the user is online on the server, otherwise check if the user has joined the channel - * @return -1 if the user is off line, a positive (>=0) if the user is online - */ - function isNickOnline($chan, $nickid) - { - if ($chan == NULL) $chan = 'SERVER'; - - $ret = $this->getMeta2("channelid-to-nickid", $this->_encode($chan)); - for($i = 0; $i<count($ret['timestamp']); $i++) - { - if ($ret['value'][$i] == $nickid) return $i; - } - return -1; - } - - /** - * Write a command to the given channel or to the server - * Notice: a message is very generic, it can be a misc command (notice, me, ...) - * @param $chan if NULL then write the message on the server, otherwise just write the message on the channel message pool - * @param $nick is the sender nickname - * @param $cmd is the command name (ex: "send", "nick", "kick" ...) - * @param $param is the command' parameters (ex: param of the "send" command is the message) - * @return $msg_id the created message identifier - */ - function write($chan, $nick, $cmd, $param) - { - $c =& $this->c; - if ($chan == NULL) $chan = 'SERVER'; - - $msgid = $this->_requestMsgId($chan); - - // format message - $data = "\n"; - $data .= $msgid."\t"; - $data .= date("d/m/Y")."\t"; - $data .= date("H:i:s")."\t"; - $data .= $nick."\t"; - $data .= $cmd."\t"; - $data .= $param; - - // write message - $this->setMeta2("channelid-to-msg", $this->_encode($chan), $msgid, $data); - - // delete the obsolete message - $old_msgid = $msgid - $c->max_msg - 20; - if ($old_msgid > 0) - $this->rmMeta2("channelid-to-msg", $this->_encode($chan), $old_msgid); - - return $msgid; - } - - /** - * Read the last posted commands from a channel or from the server - * Notice: the returned array must be ordered by id - * @param $chan if NULL then read from the server, otherwise read from the given channel - * @param $from_id read all message with a greater id - * @return array() contains the command list - */ - function read($chan, $from_id) - { - $c =& $this->c; - if ($chan == NULL) $chan = 'SERVER'; - - // read new messages id - $new_msgid_list = array(); - $new_from_id = $from_id; - $msgid_list = $this->getMeta2("channelid-to-msg", $this->_encode($chan)); - for($i = 0; $i<count($msgid_list["value"]); $i++) - { - $msgidtmp = $msgid_list["value"][$i]; - - if ($msgidtmp > $from_id) - { - if ($msgidtmp > $new_from_id) $new_from_id = $msgidtmp; - $new_msgid_list[] = $msgidtmp; - } - } - - // read messages content and parse content - $datalist = array(); - foreach ( $new_msgid_list as $mid ) - { - $line = $this->getMeta2("channelid-to-msg", $this->_encode($chan), $mid, true); - $line = $line["value"][0]; - if ($line != "" && $line != "\n") - { - $formated_line = explode( "\t", $line ); - $data = array(); - $data["id"] = trim($formated_line[0]); - $data["date"] = $formated_line[1]; - $data["time"] = $formated_line[2]; - $data["sender"]= $formated_line[3]; - $data["cmd"] = $formated_line[4]; - $data["param"] = $formated_line[5]; - $datalist[$data["id"]] = $data; - } - } - ksort($datalist); - - return array("data" => $datalist, - "new_from_id" => $new_from_id ); - } - - /** - * Returns the last message id - * Notice: the default file container just returns the messages.index file content - * @param $chan if NULL then read if from the server, otherwise read if from the given channel - * @return int is the last posted message id - */ - function getLastId($chan) - { - if ($chan == NULL) $chan = 'SERVER'; - - $lastmsgid = $this->getMeta2("channelid-to-msgid", $this->_encode($chan), 'lastmsgid', true); - if (count($lastmsgid["value"]) == 0) - $lastmsgid = 0; - else - $lastmsgid = $lastmsgid["value"][0]; - return $lastmsgid; - } - - - /** - * Remove all created data for this server (identified by serverid) - * Notice: for the default File container, it's just a recursive directory remove - */ - function clear() - { - $c =& $this->c; - // remove the created files and directories - $dir = $c->container_cfg_server_dir; - @rm_r($dir); - // empty the cache - // $this->_meta = array(); - // $this->_users = array("nickid" => array(), - // "timestamp" => array()); - } - - - /** - * Return a unique id. Each time this function is called, the last id is incremented. - * used internaly - * @private - */ - function _requestMsgId($chan) - { - if ($chan == NULL) $chan = 'SERVER'; - - $lastmsgid = $this->getLastId($chan); - $lastmsgid++; - $this->setMeta2("channelid-to-msgid", $this->_encode($chan), 'lastmsgid', $lastmsgid); - - return $lastmsgid; - } - - /** - * Used to encode UTF8 strings to ASCII filenames - * @private - */ - function _encode($str) - { - return urlencode($str); - return base64_encode(urlencode($str)); - } - - /** - * Used to decode ASCII filenames to UTF8 strings - * @private - */ - function _decode($str) - { - return urldecode($str); - return urldecode(base64_decode($str)); - } - - - - - - - - - - - - - - /** - * Write a meta data value identified by a group / subgroup / leaf [with a value] - * @return 1 if the leaf allready existed, 0 if the leaf has been created - */ - function setMeta2($group, $subgroup, $leaf, $leafvalue = NULL) - // value, $key, $type, $subtype = NULL) - { // create directories $c =& $this->c; - $dir_base = $c->container_cfg_meta_dir; + $dir_base = $c->container_cfg_server_dir; $dir = $dir_base.'/'.$group.'/'.$subgroup; if (!is_dir($dir)) mkdir_r($dir); @@ -509,18 +105,14 @@ } - /** - * Read meta data identified by a group [/ subgroup [/ leaf]] - * @return ... - */ - function getMeta2($group, $subgroup = null, $leaf = null, $withleafvalue = false) + function getMeta($group, $subgroup = null, $leaf = null, $withleafvalue = false) { // read data from metadata file $ret = array(); $ret["timestamp"] = array(); $ret["value"] = array(); $c =& $this->c; - $dir_base = $c->container_cfg_meta_dir; + $dir_base = $c->container_cfg_server_dir; $dir = $dir_base.'/'.$group; @@ -568,24 +160,19 @@ return $ret; } - - /** - * Remove a meta data - * @return ... - */ - function rmMeta2($group, $subgroup = null, $leaf = null) - //($key, $type, $subtype = NULL) + function rmMeta($group, $subgroup = null, $leaf = null) { $c =& $this->c; + $dir = $c->container_cfg_server_dir; + if ($group == NULL) + { + rm_r($dir); + return true; + } + $dir .= '/'.$group; - // read data from metadata file - $c =& $this->c; - $dir_base = $c->container_cfg_meta_dir; - - $dir = $dir_base.'/'.$group; - if ($subgroup == NULL) { rm_r($dir); @@ -600,7 +187,7 @@ return true; } - $leaffilename = $dir."/".$leaf; + $leaffilename = $dir.'/'.$leaf; if (!file_exists($leaffilename)) return false; unlink($leaffilename); @@ -608,30 +195,22 @@ } - function getUserMeta($nickid, $key) + /** + * Used to encode UTF8 strings to ASCII filenames + */ + function encode($str) { - $ret = $this->getMeta2("nickid-to-metadata", $nickid, $key, true); - return isset($ret['value'][0]) ? $ret['value'][0] : NULL; + return urlencode($str); } - - function setUserMeta($nickid, $key, $value) + + /** + * Used to decode ASCII filenames to UTF8 strings + */ + function decode($str) { - $ret = $this->setMeta2("nickid-to-metadata", $nickid, $key, $value); - return $ret; + return urldecode($str); } - function getChanMeta($chan, $key) - { - $ret = $this->getMeta2("channelid-to-metadata", $this->_encode($chan), $key, true); - return isset($ret['value'][0]) ? $ret['value'][0] : NULL; - } - - function setChanMeta($chan, $key, $value) - { - $ret = $this->setMeta2("channelid-to-metadata", $this->_encode($chan), $key, $value); - return $ret; - } - } ?> \ No newline at end of file Modified: trunk/src/pfccontainer.class.php =================================================================== --- trunk/src/pfccontainer.class.php 2006-09-19 21:32:46 UTC (rev 771) +++ trunk/src/pfccontainer.class.php 2006-09-20 08:23:17 UTC (rev 772) @@ -41,74 +41,218 @@ * @param $nick the nickname to create * @param $nickid is the corresponding nickname id (taken from session) */ - function createNick($chan, $nickname, $nickid) - { die(_pfc("%s must be implemented", get_class($this)."::".__FUNCTION__)); } + function createNick($chan, $nick, $nickid) + { + $c =& $this->c; + if ($chan == NULL) $chan = 'SERVER'; + + $this->setMeta("nickid-to-metadata", $nickid, 'nick', $nick); + $this->setMeta("metadata-to-nickid", 'nick', $this->encode($nick), $nickid); + + $this->setMeta("nickid-to-channelid", $nickid, $this->encode($chan)); + $this->setMeta("channelid-to-nickid", $this->encode($chan), $nickid); + + // update the SERVER channel + if ($chan != 'SERVER') $this->updateNick($nickid); + + return true; + } + /** * Remove (disconnect/quit) the nickname from the server or from a channel - * Notice: The caller must take care to update all joined channels. - * @param $chan if NULL then remove the user on the server (disconnect), otherwise just remove the user from the given channel (quit) - * @param $nick the nickname to remove - * @return true if the nickname was correctly removed + * Notice: when a user quit, the caller must take care removeNick from each channels ('SERVER' included) + * This function takes care to remove all users metadata when he his disconnected from all channels + * @param $chan if NULL then remove the user from the 'SERVER' channel, otherwise just remove the user from the given channel (quit) + * @param $nickid the nickname id to remove + * @return array which contains removed user infos ('nickid', 'nick', 'timestamp') */ - function removeNick($chan, $nickname) - { die(_pfc("%s must be implemented", get_class($this)."::".__FUNCTION__)); } + function removeNick($chan, $nickid) + { + if ($chan == NULL) $chan = 'SERVER'; + $timestamp = $this->getMeta("channelid-to-nickid", $this->encode('SERVER'), $nickid); + $timestamp = $timestamp["timestamp"][0]; + + $deleted_user = array(); + $deleted_user["nick"][] = $this->getNickname($nickid); + $deleted_user["nickid"][] = $nickid; + $deleted_user["timestamp"][] = $timestamp; + + // remove the nickid from the channel list + $this->rmMeta('channelid-to-nickid', $this->encode($chan), $nickid); + $this->rmMeta('nickid-to-channelid', $nickid, $this->encode($chan)); + + // get the current user's channels list + $channels = $this->getMeta("nickid-to-channelid",$nickid); + $channels = $channels["value"]; + // no more joined channel, just remove the user's metadata + if (count($channels) == 0) + { + // remove the nickname to nickid correspondance + $this->rmMeta('metadata-to-nickid', 'nick', $this->encode($this->getNickname($nickid))); + // remove disconnected nickname metadata + $this->rmMeta('nickid-to-metadata', $nickid); + } + + return $deleted_user; + } + /** - * Store/update the alive user status somewhere - * The default File container will just touch (update the date) the nickname file. - * @param $chan where to update the nick, if null then update the server nick - * @param $nick nickname to update (raw nickname) + * Store/update the alive user status on the 'SERVER' channel + * The default File container will just touch (update the date) of the nickname file in the 'SERVER' channel. + * @param $nickid the nickname id to keep alive */ - function updateNick($chan, $nick) - { die(_pfc("%s must be implemented", get_class($this)."::".__FUNCTION__)); } + function updateNick($nickid) + { + $c =& $this->c; + $chan = 'SERVER'; + $this->setMeta("nickid-to-channelid", $nickid, $this->encode($chan)); + $this->setMeta("channelid-to-nickid", $this->encode($chan), $nickid); + return true; + } + /** - * Change the user' nickname - * Notice: this call must take care to update all channels the user joined - * @param $chan where to update the nick, if null then update the server nick + * Change the user's nickname + * As nickname value are stored in user's metadata, this function just update the 'nick' metadata * @param $newnick * @param $oldnick + * @return true on success, false on failure (if the oldnick doesn't exists) */ function changeNick($newnick, $oldnick) - { die(_pfc("%s must be implemented", get_class($this)."::".__FUNCTION__)); } - + { + $c =& $this->c; + + $oldnickid = $this->getNickId($oldnick); + $newnickid = $this->getNickId($newnick); + if ($oldnickid == "") return false; // the oldnick must be connected + if ($newnickid != "") return false; // the newnick must not be inuse + + // remove the oldnick to oldnickid correspondance + $this->rmMeta("metadata-to-nickid", 'nick', $this->encode($oldnick)); + + // update the nickname + $this->setMeta("nickid-to-metadata", $oldnickid, 'nick', $newnick); + $this->setMeta("metadata-to-nickid", 'nick', $this->encode($newnick), $oldnickid); + return true; + } + /** - * Returns the nickid, this is a unique id used to identify a user (taken from session) - * By default this nickid is just stored into the user' metadata, same as :->getNickMeta("nickid") + * Returns the nickid corresponding to the given nickname + * The nickid is a unique id used to identify a user (generated from the browser sessionid) + * The nickid is stored in the container when createNick is called. * @param $nick * @return string the nick id */ - function getNickId($nickname) - { die(_pfc("%s must be implemented", get_class($this)."::".__FUNCTION__)); } + function getNickId($nick) + { + $nickid = $this->getMeta("metadata-to-nickid", 'nick', $this->encode($nick), true); + $nickid = isset($nickid["value"][0]) ? $nickid["value"][0] : ""; + return $nickid; + } /** + * Returns the nickname corresponding the the given nickid + * @param $nickid + * @return string the corresponding nickname + */ + function getNickname($nickid) + { + $nick = $this->getMeta("nickid-to-metadata", $nickid, 'nick', true); + $nick = isset($nick["value"][0]) ? $this->decode($nick["value"][0]) : ""; + return $nick; + } + + /** * Remove (disconnect/quit) the timeouted nickname from the server or from a channel * Notice: this function must remove all nicknames which are not uptodate from the given channel or from the server * @param $chan if NULL then check obsolete nick on the server, otherwise just check obsolete nick on the given channel * @param $timeout - * @return array("nick"=>???, "timestamp"=>???) contains all disconnected nicknames and there timestamp + * @return array("nickid"=>array("nickid1", ...),"timestamp"=>array(timestamp1, ...)) contains all disconnected nickids and there timestamp */ - function removeObsoleteNick($chan, $timeout) - { die(_pfc("%s must be implemented", get_class($this)."::".__FUNCTION__)); } + function removeObsoleteNick($timeout) + { + $c =& $this->c; + $chan = 'SERVER'; + + $deleted_user = array('nick'=>array(), + 'nickid'=>array(), + 'timestamp'=>array(), + 'channels'=>array()); + $ret = $this->getMeta("channelid-to-nickid", $this->encode($chan)); + for($i = 0; $i<count($ret['timestamp']); $i++) + { + $timestamp = $ret['timestamp'][$i]; + $nickid = $ret['value'][$i]; + if (time() > ($timestamp+$timeout/1000) ) // user will be disconnected after 'timeout' secondes of inactivity + { + // get the current user's channels list + $channels = array(); + $ret2 = $this->getMeta("nickid-to-channelid",$nickid); + foreach($ret2["value"] as $userchan) + { + // disconnect the user from each joined channels + $du = $this->removeNick($this->decode($userchan), $nickid); + $channels[] = $this->decode($userchan); + } + $deleted_user["nick"] = array_merge($deleted_user["nick"], $du["nick"]); + $deleted_user["nickid"] = array_merge($deleted_user["nickid"], $du["nickid"]); + $deleted_user["timestamp"] = array_merge($deleted_user["timestamp"], $du["timestamp"]); + $deleted_user["channels"] = array_merge($deleted_user["channels"], array($channels)); + } + } + + return $deleted_user; + } + /** * Returns the nickname list on the given channel or on the whole server * @param $chan if NULL then returns all connected user, otherwise just returns the channel nicknames - * @return array(array("nick"=>???,"timestamp"=>???) contains the nickname list with the associated timestamp (laste update time) - */ + * @return array("nickid"=>array("nickid1", ...),"timestamp"=>array(timestamp1, ...)) contains the nickid list with the associated timestamp (laste update time) + */ function getOnlineNick($chan) - { die(_pfc("%s must be implemented", get_class($this)."::".__FUNCTION__)); } + { + $c =& $this->c; + + if ($chan == NULL) $chan = 'SERVER'; + $online_user = array(); + $ret = $this->getMeta("channelid-to-nickid", $this->encode($chan)); + for($i = 0; $i<count($ret['timestamp']); $i++) + { + $nickid = $ret['value'][$i]; + + // get timestamp from the SERVER channel + $timestamp = $this->getMeta("channelid-to-nickid", $this->encode('SERVER'), $nickid); + $timestamp = $timestamp['timestamp'][0]; + + $online_user["nick"][] = $this->getNickname($nickid); + $online_user["nickid"][] = $nickid; + $online_user["timestamp"][] = $timestamp; + } + return $online_user; + } + /** * Returns returns a positive number if the nick is online * @param $chan if NULL then check if the user is online on the server, otherwise check if the user has joined the channel * @return -1 if the user is off line, a positive (>=0) if the user is online */ - function isNickOnline($chan, $nick) - { die(_pfc("%s must be implemented", get_class($this)."::".__FUNCTION__)); } + function isNickOnline($chan, $nickid) + { + if ($chan == NULL) $chan = 'SERVER'; + $ret = $this->getMeta("channelid-to-nickid", $this->encode($chan)); + for($i = 0; $i<count($ret['timestamp']); $i++) + { + if ($ret['value'][$i] == $nickid) return $i; + } + return -1; + } + /** * Write a command to the given channel or to the server * Notice: a message is very generic, it can be a misc command (notice, me, ...) @@ -118,19 +262,85 @@ * @param $param is the command' parameters (ex: param of the "send" command is the message) * @return $msg_id the created message identifier */ - function write($chan, $nick, $msg) - { die(_pfc("%s must be implemented", get_class($this)."::".__FUNCTION__)); } + function write($chan, $nick, $cmd, $param) + { + $c =& $this->c; + if ($chan == NULL) $chan = 'SERVER'; + + $msgid = $this->_requestMsgId($chan); + // format message + $data = "\n"; + $data .= $msgid."\t"; + $data .= date("d/m/Y")."\t"; + $data .= date("H:i:s")."\t"; + $data .= $nick."\t"; + $data .= $cmd."\t"; + $data .= $param; + + // write message + $this->setMeta("channelid-to-msg", $this->encode($chan), $msgid, $data); + + // delete the obsolete message + $old_msgid = $msgid - $c->max_msg - 20; + if ($old_msgid > 0) + $this->rmMeta("channelid-to-msg", $this->encode($chan), $old_msgid); + + return $msgid; + } + /** * Read the last posted commands from a channel or from the server - * Notice: the returned array must be ordered by id + * Notice: the returned array is ordered by id * @param $chan if NULL then read from the server, otherwise read from the given channel * @param $from_id read all message with a greater id - * @return array() contains the command list + * @return array() contains the formated command list */ function read($chan, $from_id) - { die(_pfc("%s must be implemented", get_class($this)."::".__FUNCTION__)); } + { + $c =& $this->c; + if ($chan == NULL) $chan = 'SERVER'; + // read new messages id + $new_msgid_list = array(); + $new_from_id = $from_id; + $msgid_list = $this->getMeta("channelid-to-msg", $this->encode($chan)); + for($i = 0; $i<count($msgid_list["value"]); $i++) + { + $msgidtmp = $msgid_list["value"][$i]; + + if ($msgidtmp > $from_id) + { + if ($msgidtmp > $new_from_id) $new_from_id = $msgidtmp; + $new_msgid_list[] = $msgidtmp; + } + } + + // read messages content and parse content + $datalist = array(); + foreach ( $new_msgid_list as $mid ) + { + $line = $this->getMeta("channelid-to-msg", $this->encode($chan), $mid, true); + $line = $line["value"][0]; + if ($line != "" && $line != "\n") + { + $formated_line = explode( "\t", $line ); + $data = array(); + $data["id"] = trim($formated_line[0]); + $data["date"] = $formated_line[1]; + $data["time"] = $formated_line[2]; + $data["sender"]= $formated_line[3]; + $data["cmd"] = $formated_line[4]; + $data["param"] = $formated_line[5]; + $datalist[$data["id"]] = $data; + } + } + ksort($datalist); + + return array("data" => $datalist, + "new_from_id" => $new_from_id ); + } + /** * Returns the last message id * Notice: the default file container just returns the messages.index file content @@ -138,48 +348,127 @@ * @return int is the last posted message id */ function getLastId($chan) - { die(_pfc("%s must be implemented", get_class($this)."::".__FUNCTION__)); } + { + if ($chan == NULL) $chan = 'SERVER'; + + $lastmsgid = $this->getMeta("channelid-to-msgid", $this->encode($chan), 'lastmsgid', true); + if (count($lastmsgid["value"]) == 0) + $lastmsgid = 0; + else + $lastmsgid = $lastmsgid["value"][0]; + return $lastmsgid; + } + /** - * Read meta data identified by a key - * As an example the default file container store metadata into metadata/type/subtype/hash(key) - * @param $key is the index which identify a metadata - * @param $type is used to "group" some metadata - * @param $subtype is used to "group" precisely some metadata, use NULL to ignore it - * @return mixed the value assigned to the key, NULL if not found + * Return a unique id. Each time this function is called, the last id is incremented. + * used internaly + * @private + */ + function _requestMsgId($chan) + { + if ($chan == NULL) $chan = 'SERVER'; + + $lastmsgid = $this->getLastId($chan); + $lastmsgid++; + $this->setMeta("channelid-to-msgid", $this->encode($chan), 'lastmsgid', $lastmsgid); + + return $lastmsgid; + } + + + /** + * Remove all created data for this server (identified by serverid) + * Notice: for the default File container, it's just a recursive directory remove */ - function getMeta($key, $type, $subtype = NULL) - { die(_pfc("%s must be implemented", get_class($this)."::".__FUNCTION__)); } + function clear() + { + $this->rmMeta(NULL); + } /** - * Write a meta data value identified by a key - * As an example the default file container store metadata into metadata/type/subtype/hash(key) - * @param $key is the index which identify a metadata - * @param $value is the value associated to the key - * @param $type is used to "group" some metadata - * @param $subtype is used to "group" precisely some metadata, use NULL to ignore it - * @return true on success, false on error + * In the default File container: used to encode UTF8 strings to ASCII filenames + * This method can be overridden by the concrete container + */ + function encode($str) + { + return $str; + } + + /** + * In the default File container: used to decode ASCII filenames to UTF8 strings + * This method can be overridden by the concrete container + */ + function decode($str) + { + return $str; + } + + + function getUserMeta($nickid, $key) + { + $ret = $this->getMeta("nickid-to-metadata", $nickid, $key, true); + return isset($ret['value'][0]) ? $ret['value'][0] : NULL; + } + + function setUserMeta($nickid, $key, $value) + { + $ret = $this->setMeta("nickid-to-metadata", $nickid, $key, $value); + return $ret; + } + + function getChanMeta($chan, $key) + { + $ret = $this->getMeta("channelid-to-metadata", $this->encode($chan), $key, true); + return isset($ret['value'][0]) ? $ret['value'][0] : NULL; + } + + function setChanMeta($chan, $key, $value) + { + $ret = $this->setMeta("channelid-to-metadata", $this->encode($chan), $key, $value); + return $ret; + } + + /** + * Write a meta data value identified by a group / subgroup / leaf [with a value] + * As an example in the default file container this arborescent structure is modelised by simple directories + * group1/subgroup1/leaf1 + * /leaf2 + * /subgroup2/... + * Each leaf can contain or not a value. + * However each leaf and each group/subgroup must store the lastmodified time (timestamp). + * @param $group root arborescent element + * @param $subgroup is the root first child which contains leafs + * @param $leaf is the only element which can contain values + * @param $leafvalue NULL means the leaf will not contain any values + * @return 1 if the old leaf has been overwritten, 0 if a new leaf has been created */ - function setMeta($value, $key, $type, $subtype = NULL) + function setMeta($group, $subgroup, $leaf, $leafvalue = NULL) { die(_pfc("%s must be implemented", get_class($this)."::".__FUNCTION__)); } + /** - * Remove a meta data key/value couple - * Notice: if key is NULL then all the meta data must be removed - * @param $key is the key to delete, use NULL to delete all the metadata - * @param $type is used to "group" some metadata - * @param $subtype is used to "group" precisely some metadata, use NULL to ignore it - * @return true on success, false on error + * Read meta data identified by a group [/ subgroup [/ leaf]] + * @param $group is mandatory, it's the arborescence's root + * @param $subgroup if null then the subgroup list names are returned + * @param $leaf if null then the leaf names are returned + * @param $withleafvalue if set to true the leaf value will be returned + * @return array which contains two subarray 'timestamp' and 'value' */ - function rmMeta($key, $type, $subtype = NULL) + function getMeta($group, $subgroup = null, $leaf = null, $withleafvalue = false) { die(_pfc("%s must be implemented", get_class($this)."::".__FUNCTION__)); } + /** - * Remove all created data for this server (identified by serverid) - * Notice: for the default File container, it's just a recursive directory remove + * Remove a meta data or a group of metadata + * @param $group if null then it will remove all the possible groups (all the created metadata) + * @param $subgroup if null then it will remove the $group's childs (all the subgroup contained by $group) + * @param $leaf if null then it will remove all the $subgroup's childs (all the leafs contained by $subgroup) + * @return true on success, false on error */ - function clear() + function rmMeta($group, $subgroup = null, $leaf = null) { die(_pfc("%s must be implemented", get_class($this)."::".__FUNCTION__)); } + } -?> +?> \ No newline at end of file Modified: trunk/testcase/container_file.php =================================================================== --- trunk/testcase/container_file.php 2006-09-19 21:32:46 UTC (rev 771) +++ trunk/testcase/container_file.php 2006-09-20 08:23:17 UTC (rev 772) @@ -36,10 +36,10 @@ $group = $prefix."_nickid-to-channelid"; $subgroup = $prefix."_nickid1"; $leaf = $prefix."_channelid1"; - $ret = $ct->setMeta2($group, $subgroup, $leaf); + $ret = $ct->setMeta($group, $subgroup, $leaf); $this->assertEquals($ret, 0, "the leaf should be first time created"); - $f = $c->container_cfg_meta_dir.'/'.$group.'/'.$subgroup.'/'.$leaf; + $f = $c->container_cfg_server_dir.'/'.$group.'/'.$subgroup.'/'.$leaf; $ret = file_exists($f); $this->assertEquals($ret, true, "the leaf file should exists"); @@ -57,10 +57,10 @@ $subgroup = $prefix."_nickid1"; $leaf = $prefix."_channelid1"; $leafvalue = $prefix."_leafvalue1"; - $ret = $ct->setMeta2($group, $subgroup, $leaf, $leafvalue); + $ret = $ct->setMeta($group, $subgroup, $leaf, $leafvalue); $this->assertEquals($ret, 0, "the leaf should be first time created"); - $f = $c->container_cfg_meta_dir.'/'.$group.'/'.$subgroup.'/'.$leaf; + $f = $c->container_cfg_server_dir.'/'.$group.'/'.$subgroup.'/'.$leaf; $ret = file_exists($f); $this->assertEquals($ret, true, "the leaf file should exists"); @@ -79,14 +79,14 @@ $leaf = $prefix."_channelid1"; $leafvalue = $prefix."_leafvalue1"; - $ret = $ct->setMeta2($group, $subgroup, $leaf, $leafvalue); + $ret = $ct->setMeta($group, $subgroup, $leaf, $leafvalue); $this->assertEquals($ret, 0, "the leaf should be first time created"); $leafvalue = null; - $ret = $ct->setMeta2($group, $subgroup, $leaf, $leafvalue); + $ret = $ct->setMeta($group, $subgroup, $leaf, $leafvalue); $this->assertEquals($ret, 1, "the leaf should be overwritten"); - $f = $c->container_cfg_meta_dir.'/'.$group.'/'.$subgroup.'/'.$leaf; + $f = $c->container_cfg_server_dir.'/'.$group.'/'.$subgroup.'/'.$leaf; $ret = file_exists($f); $this->assertEquals($ret, true, "the leaf file should exists"); @@ -95,87 +95,6 @@ } - function test_getMeta_File_1() - { - $c =& $this->c; - $ct =& $this->ct; - - $prefix = __FUNCTION__; - $group = $prefix."_nickid-to-channelid"; - $subgroup = $prefix."_nickid1"; - $leaf = $prefix."_channelid1"; - $ct->setMeta2($group, $subgroup, $leaf); - $time = time(); - - $ret = $ct->getMeta2($group, $subgroup, $leaf); - $this->assertEquals(count($ret["timestamp"]), 1, "number of leaf is wrong"); - $this->assertEquals($ret["timestamp"][0], $time, "the leaf timestamp is wrong"); - $this->assertEquals($ret["value"][0], null, "the leaf value is wrong"); - - $ret = $ct->getMeta2($group, $subgroup); - $this->assertEquals(count($ret["timestamp"]), 1, "number of leaf is wrong"); - $this->assertEquals($ret["timestamp"][0], $time, "the leaf timestamp is wrong"); - $this->assertEquals($ret["value"][0], $leaf, "the leaf name is wrong"); - - $leafvalue = $prefix."_leafvalue"; - $ct->setMeta2($group, $subgroup, $leaf, $leafvalue); - $time = time(); - - $ret = $ct->getMeta2($group, $subgroup, $leaf, true); - $this->assertEquals(count($ret["timestamp"]), 1, "number of leaf is wrong"); - $this->assertEquals($ret["timestamp"][0], $time, "the leaf timestamp is wrong"); - $this->assertEquals($ret["value"][0], $leafvalue, "the leaf value is wrong"); - } - - function test_getMeta_File_2() - { - $c =& $this->c; - $ct =& $this->ct; - - $prefix = __FUNCTION__; - $group = $prefix."_nickid-to-channelid"; - $subgroup = $prefix."_nickid1"; - $leaf1 = $prefix."_channelid1"; - $leaf2 = $prefix."_channelid2"; - $ct->setMeta2($group, $subgroup, $leaf1); - $ct->setMeta2($group, $subgroup, $leaf2); - $time = time(); - - $ret = $ct->getMeta2($group, $subgroup); - asort($ret["value"]); - $this->assertEquals(count($ret["timestamp"]), 2, "number of leaf is wrong"); - $this->assertEquals($ret["timestamp"][0], $time, "the leaf timestamp is wrong"); - $this->assertEquals($ret["timestamp"][1], $time, "the leaf timestamp is wrong"); - $this->assertEquals($ret["value"][0], $leaf1, "the leaf name is wrong"); - $this->assertEquals($ret["value"][1], $leaf2, "the leaf name is wrong"); - } - - function test_getMeta_File_3() - { - $c =& $this->c; - $ct =& $this->ct; - - $prefix = __FUNCTION__; - $group = $prefix."_nickid-to-channelid"; - $subgroup1 = $prefix."_nickid1"; - $subgroup2 = $prefix."_nickid2"; - $leaf1 = $prefix."_channelid1"; - $leaf2 = $prefix."_channelid2"; - $ct->setMeta2($group, $subgroup1, $leaf1); - $ct->setMeta2($group, $subgroup1, $leaf2); - $ct->setMeta2($group, $subgroup2, $leaf1); - $ct->setMeta2($group, $subgroup2, $leaf2); - $time = time(); - - $ret = $ct->getMeta2($group); - asort($ret["value"]); - $this->assertEquals(count($ret["timestamp"]), 2, "number of subgroup is wrong"); - $this->assertEquals($ret["timestamp"][0], $time, "the subgroup timestamp is wrong"); - $this->assertEquals($ret["timestamp"][1], $time, "the subgroup timestamp is wrong"); - $this->assertEquals($ret["value"][0], $subgroup1, "the subgroup name is wrong"); - $this->assertEquals($ret["value"][1], $subgroup2, "the subgroup name is wrong"); - } - function test_rmMeta_File_1() { $c =& $this->c; @@ -185,12 +104,12 @@ $group = $prefix."_nickid-to-channelid"; $subgroup = $prefix."_nickid1"; $leaf = $prefix."_channelid1"; - $ret = $ct->setMeta2($group, $subgroup, $leaf); + $ret = $ct->setMeta($group, $subgroup, $leaf); - $ret = $ct->rmMeta2($group, $subgroup, $leaf); + $ret = $ct->rmMeta($group, $subgroup, $leaf); $this->assertEquals($ret, true, "the returned value should be true (rm success)"); - $f = $c->container_cfg_meta_dir.'/'.$group.'/'.$subgroup.'/'.$leaf; + $f = $c->container_cfg_server_dir.'/'.$group.'/'.$subgroup.'/'.$leaf; $ret = file_exists($f); $this->assertEquals($ret, false, "the leaf file should not exists anymore"); } @@ -205,20 +124,20 @@ $subgroup = $prefix."_nickid1"; $leaf1 = $prefix."_channelid1"; $leaf2 = $prefix."_channelid2"; - $ret = $ct->setMeta2($group, $subgroup, $leaf1); - $ret = $ct->setMeta2($group, $subgroup, $leaf2); + $ret = $ct->setMeta($group, $subgroup, $leaf1); + $ret = $ct->setMeta($group, $subgroup, $leaf2); - $ret = $ct->rmMeta2($group, $subgroup); + $ret = $ct->rmMeta($group, $subgroup); $this->assertEquals($ret, true, "the returned value should be true (rm success)"); - $f = $c->container_cfg_meta_dir.'/'.$group.'/'.$subgroup.'/'.$leaf1; + $f = $c->container_cfg_server_dir.'/'.$group.'/'.$subgroup.'/'.$leaf1; $ret = file_exists($f); $this->assertEquals($ret, false, "the leaf file should not exists anymore"); - $f = $c->container_cfg_meta_dir.'/'.$group.'/'.$subgroup.'/'.$leaf2; + $f = $c->container_cfg_server_dir.'/'.$group.'/'.$subgroup.'/'.$leaf2; $ret = file_exists($f); $this->assertEquals($ret, false, "the leaf file should not exists anymore"); - $d = $c->container_cfg_meta_dir.'/'.$group.'/'.$subgroup; + $d = $c->container_cfg_server_dir.'/'.$group.'/'.$subgroup; $ret = file_exists($f); $this->assertEquals($ret, false, "the subgroup directory should not exists anymore"); } @@ -233,48 +152,27 @@ $subgroup = $prefix."_nickid1"; $leaf1 = $prefix."_channelid1"; $leaf2 = $prefix."_channelid2"; - $ret = $ct->setMeta2($group, $subgroup, $leaf1); - $ret = $ct->setMeta2($group, $subgroup, $leaf2); + $ret = $ct->setMeta($group, $subgroup, $leaf1); + $ret = $ct->setMeta($group, $subgroup, $leaf2); - $ret = $ct->rmMeta2($group); + $ret = $ct->rmMeta($group); $this->assertEquals($ret, true, "the returned value should be true (rm success)"); - $f = $c->container_cfg_meta_dir.'/'.$group.'/'.$subgroup.'/'.$leaf1; + $f = $c->container_cfg_server_dir.'/'.$group.'/'.$subgroup.'/'.$leaf1; $ret = file_exists($f); $this->assertEquals($ret, false, "the leaf file should not exists anymore"); - $f = $c->container_cfg_meta_dir.'/'.$group.'/'.$subgroup.'/'.$leaf2; + $f = $c->container_cfg_server_dir.'/'.$group.'/'.$subgroup.'/'.$leaf2; $ret = file_exists($f); $this->assertEquals($ret, false, "the leaf file should not exists anymore"); - $d = $c->container_cfg_meta_dir.'/'.$group.'/'.$subgroup; + $d = $c->container_cfg_server_dir.'/'.$group.'/'.$subgroup; $ret = file_exists($d); $this->assertEquals($ret, false, "the subgroup directory should not exists anymore"); - $d = $c->container_cfg_meta_dir.'/'.$group; + $d = $c->container_cfg_server_dir.'/'.$group; $ret = file_exists($d); $this->assertEquals($ret, false, "the group directory should not exists anymore"); } - - - function test_encodedecode_File_1() - { - $c =& $this->c; - $ct =& $this->ct; - - $string = "il était une fois C;h:!?§+ toto=}at是"; - - $prefix = __FUNCTION__; - $group = $prefix."_nickid-to-channelid"; - $subgroup = $prefix."_nickid1"; - $leaf = $prefix."_".$ct->_encode($string); - $leafvalue = $string; - $ct->setMeta2($group, $subgroup, $leaf, $leafvalue); - - $ret = $ct->getMeta2($group, $subgroup); - $this->assertEquals($ret['value'][0], $leaf, "the leaf name is wrong"); - $ret = $ct->getMeta2($group, $subgroup, $leaf, true); - $this->assertEquals($ret['value'][0], $leafvalue, "the leaf value is wrong"); - } } // on desactive le timeout car se script peut mettre bcp de temps a s'executer Modified: trunk/testcase/container_generic.php =================================================================== --- trunk/testcase/container_generic.php 2006-09-19 21:32:46 UTC (rev 771) +++ trunk/testcase/container_generic.php 2006-09-20 08:23:17 UTC (rev 772) @@ -47,7 +47,7 @@ $this->c->destroyCache(); } - function testCreateNick_Generic() + function test_createNick_Generic() { $c =& $this->c; $ct =& $this->ct; @@ -68,7 +68,7 @@ $this->assertTrue($isonline, "nickname should be online on the server"); } - function testRemoveNick_Generic() + function test_removeNick_Generic() { $c =& $this->c; $ct =& $this->ct; @@ -90,7 +90,7 @@ $this->assertFalse($isonline, "nickname shouldn't be online on the server"); } - function testGetNickId_Generic() + function test_getNickId_Generic() { $c =& $this->c; $ct =& $this->ct; @@ -104,7 +104,7 @@ $this->assertEquals($nickid, $ret, "created nickname doesn't have a correct nickid"); } - function testGetNickname_Generic() + function test_getNickname_Generic() { $c =& $this->c; $ct =& $this->ct; @@ -120,7 +120,7 @@ $this->assertEquals($nick, $ret, "nickname value is wrong"); } - function testGetOnlineNick_Generic() + function test_getOnlineNick_Generic() { $c =& $this->c; $ct =& $this->ct; @@ -143,7 +143,7 @@ } - function testRemoveObsoleteNick_Generic() + function test_removeObsoleteNick_Generic() { $c =& $this->c; $ct =& $this->ct; @@ -161,7 +161,7 @@ $this->assertFalse($isonline, "nickname shouldn't be online anymore"); } - function testupdateNick_Generic() + function test_updateNick_Generic() { $c =& $this->c; $ct =& $this->ct; @@ -182,7 +182,7 @@ } - function testchangeNick_Generic() + function test_changeNick_Generic() { $c =& $this->c; $ct =& $this->ct; @@ -202,7 +202,7 @@ $this->assertTrue($isonline2, "nickname shouldn't be online"); } - function testgetLastId_Generic() + function test_getLastId_Generic() { $c =& $this->c; $ct =& $this->ct; @@ -224,7 +224,7 @@ $this->assertEquals(10, $msgid, "last msgid is not correct"); } - function testwrite_Generic() + function test_write_Generic() { $c =& $this->c; $ct =& $this->ct; @@ -245,7 +245,7 @@ $this->assertEquals(1, $res["new_from_id"],"new_from_id is not correct"); } - function testread_Generic() + function test_read_Generic() { $c =& $this->c; $ct =& $this->ct; @@ -276,6 +276,108 @@ $this->assertEquals($msg."9", $res["data"][10]["param"] ,"messages data is not the same as the sent one"); $this->assertEquals($res["new_from_id"], 10 ,"new_from_id is not correct"); } + + function test_encodedecode_Generic() + { + $c =& $this->c; + $ct =& $this->ct; + + $string = "il était une fois C;h:!?§+ toto=}at是"; + + $prefix = __FUNCTION__; + $group = $prefix."_nickid-to-channelid"; + $subgroup = $prefix."_nickid1"; + $leaf = $prefix."_".$ct->encode($string); + $leafvalue = $string; + $ct->setMeta($group, $subgroup, $leaf, $leafvalue); + + $ret = $ct->getMeta($group, $subgroup); + $this->assertEquals($ret['value'][0], $leaf, "the leaf name is wrong"); + $ret = $ct->getMeta($group, $subgroup, $leaf, true); + $this->assertEquals($ret['value'][0], $leafvalue, "the leaf value is wrong"); + } + + function test_getMeta_Generic_1() + { + $c =& $this->c; + $ct =& $this->ct; + + $prefix = __FUNCTION__; + $group = $prefix."_nickid-to-channelid"; + $subgroup = $prefix."_nickid1"; + $leaf = $prefix."_channelid1"; + $ct->setMeta($group, $subgroup, $leaf); + $time = time(); + + $ret = $ct->getMeta($group, $subgroup, $leaf); + $this->assertEquals(count($ret["timestamp"]), 1, "number of leaf is wrong"); + $this->assertEquals($ret["timestamp"][0], $time, "the leaf timestamp is wrong"); + $this->assertEquals($ret["value"][0], null, "the leaf value is wrong"); + + $ret = $ct->getMeta($group, $subgroup); + $this->assertEquals(count($ret["timestamp"]), 1, "number of leaf is wrong"); + $this->assertEquals($ret["timestamp"][0], $time, "the leaf timestamp is wrong"); + $this->assertEquals($ret["value"][0], $leaf, "the leaf name is wrong"); + + $leafvalue = $prefix."_leafvalue"; + $ct->setMeta($group, $subgroup, $leaf, $leafvalue); + $time = time(); + + $ret = $ct->getMeta($group, $subgroup, $leaf, true); + $this->assertEquals(count($ret["timestamp"]), 1, "number of leaf is wrong"); + $this->assertEquals($ret["timestamp"][0], $time, "the leaf timestamp is wrong"); + $this->assertEquals($ret["value"][0], $leafvalue, "the leaf value is wrong"); + } + + function test_getMeta_Generic_2() + { + $c =& $this->c; + $ct =& $this->ct; + + $prefix = __FUNCTION__; + $group = $prefix."_nickid-to-channelid"; + $subgroup = $prefix."_nickid1"; + $leaf1 = $prefix."_channelid1"; + $leaf2 = $prefix."_channelid2"; + $ct->setMeta($group, $subgroup, $leaf1); + $ct->setMeta($group, $subgroup, $leaf2); + $time = time(); + + $ret = $ct->getMeta($group, $subgroup); + asort($ret["value"]); + $this->assertEquals(count($ret["timestamp"]), 2, "number of leaf is wrong"); + $this->assertEquals($ret["timestamp"][0], $time, "the leaf timestamp is wrong"); + $this->assertEquals($ret["timestamp"][1], $time, "the leaf timestamp is wrong"); + $this->assertEquals($ret["value"][0], $leaf1, "the leaf name is wrong"); + $this->assertEquals($ret["value"][1], $leaf2, "the leaf name is wrong"); + } + + function test_getMeta_Generic_3() + { + $c =& $this->c; + $ct =& $this->ct; + + $prefix = __FUNCTION__; + $group = $prefix."_nickid-to-channelid"; + $subgroup1 = $prefix."_nickid1"; + $subgroup2 = $prefix."_nickid2"; + $leaf1 = $prefix."_channelid1"; + $leaf2 = $prefix."_channelid2"; + $ct->setMeta($group, $subgroup1, $leaf1); + $ct->setMeta($group, $subgroup1, $leaf2); + $ct->setMeta($group, $subgroup2, $leaf1); + $ct->setMeta($group, $subgroup2, $leaf2); + $time = time(); + + $ret = $ct->getMeta($group); + asort($ret["value"]); + $this->assertEquals(count($ret["timestamp"]), 2, "number of subgroup is wrong"); + $this->assertEquals($ret["timestamp"][0], $time, "the subgroup timestamp is wrong"); + $this->assertEquals($ret["timestamp"][1], $time, "the subgroup timestamp is wrong"); + $this->assertEquals($ret["value"][0], $subgroup1, "the subgroup name is wrong"); + $this->assertEquals($ret["value"][1], $subgroup2, "the subgroup name is wrong"); + } + } ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-19 21:33:10
|
Revision: 771 http://svn.sourceforge.net/phpfreechat/?rev=771&view=rev Author: kerphi Date: 2006-09-19 14:32:46 -0700 (Tue, 19 Sep 2006) Log Message: ----------- [en] Big containers refactoring: this make possible to handle easily user's metadata, fix a bug related to undisconnected but timeouted users and fix some memory leak in the default file container. [fr] Grosse reorganisation des containers : ceci rend possible le travail sur les metadonnees utilisateurs, regle un bug qui fesait que des utilisateurs deconnectes en timeout n'etait pas correctement deconnecte et resoud une fuitte de memoire dans le conteneur File. Modified Paths: -------------- trunk/src/commands/ban.class.php trunk/src/commands/banlist.class.php trunk/src/commands/connect.class.php trunk/src/commands/deop.class.php trunk/src/commands/identify.class.php trunk/src/commands/kick.class.php trunk/src/commands/op.class.php trunk/src/commands/privmsg.class.php trunk/src/commands/quit.class.php trunk/src/commands/unban.class.php trunk/src/commands/updatemynick.class.php trunk/src/containers/file.class.php trunk/src/phpfreechat.class.php trunk/src/proxys/auth.class.php trunk/src/proxys/checknickchange.class.php trunk/src/proxys/checktimeout.class.php trunk/src/proxys/noflood.class.php trunk/testcase/container_file.php trunk/testcase/container_generic.php Modified: trunk/src/commands/ban.class.php =================================================================== --- trunk/src/commands/ban.class.php 2006-09-19 15:25:50 UTC (rev 770) +++ trunk/src/commands/ban.class.php 2006-09-19 21:32:46 UTC (rev 771) @@ -31,9 +31,9 @@ $container =& $c->getContainerInstance(); $nickid = $container->getNickId($param); - if ($nickid != "undefined") + if ($nickid != "") { - $cmdtoplay = $container->getMeta("cmdtoplay", "nickname", $nickid); + $cmdtoplay = $container->getUserMeta($nickid, 'cmdtoplay'); $cmdtoplay = ($cmdtoplay == NULL) ? array() : unserialize($cmdtoplay); $cmdtmp = array("leave", /* cmdname */ @@ -44,17 +44,17 @@ ); //_pfc("banished from %s by %s", $recipient, $sender); $cmdtoplay[] = $cmdtmp; // ban the user from the current channel - $container->setMeta(serialize($cmdtoplay), "cmdtoplay", "nickname", $nickid); + $container->setUserMeta($nickid, 'cmdtoplay', serialize($cmdtoplay)); } // update the recipient banlist - $banlist = $container->getMeta("banlist_nickid", "channel", $recipientid); + $banlist = $container->getChanMeta($recipient, 'banlist_nickid'); if ($banlist == NULL) $banlist = array(); else $banlist = unserialize($banlist); $banlist[] = $nickid; // append the nickid to the banlist - $container->setMeta(serialize($banlist), "banlist_nickid", "channel", $recipientid); + $container->setChanMeta($recipient, 'banlist_nickid', serialize($banlist)); } } Modified: trunk/src/commands/banlist.class.php =================================================================== --- trunk/src/commands/banlist.class.php 2006-09-19 15:25:50 UTC (rev 770) +++ trunk/src/commands/banlist.class.php 2006-09-19 21:32:46 UTC (rev 771) @@ -17,7 +17,7 @@ $u =& $this->u; $container =& $c->getContainerInstance(); - $banlist = $container->getMeta("banlist_nickid", "channel", $p["recipientid"]); + $banlist = $container->getChanMeta($p["recipientid"], 'banlist_nickid'); if ($banlist == NULL) $banlist = array(); else $banlist = unserialize($banlist); $msg = ""; $msg .= "<p>"._pfc("The banished user's id list is:")."</p>"; Modified: trunk/src/commands/connect.class.php =================================================================== --- trunk/src/commands/connect.class.php 2006-09-19 15:25:50 UTC (rev 770) +++ trunk/src/commands/connect.class.php 2006-09-19 21:32:46 UTC (rev 771) @@ -50,9 +50,9 @@ // setup some user meta $nickid = $u->nickid; // store the user ip - $container->setMeta($_SERVER["REMOTE_ADDR"], "ip", "nickname", $nickid); + $container->setUserMeta($nickid, 'ip', $_SERVER["REMOTE_ADDR"]); // store the admin flag - $container->setMeta($isadmin, "isadmin", "nickname", $nickid); + $container->setUserMeta($nickid, 'isadmin', $isadmin); // connect to the server $xml_reponse->addScript("pfc.handleResponse('connect', 'ok', '');"); } Modified: trunk/src/commands/deop.class.php =================================================================== --- trunk/src/commands/deop.class.php 2006-09-19 15:25:50 UTC (rev 770) +++ trunk/src/commands/deop.class.php 2006-09-19 21:32:46 UTC (rev 771) @@ -26,7 +26,7 @@ $nicktodeop = trim($p["param"]); $container =& $c->getContainerInstance(); $nicktodeopid = $container->getNickId($nicktodeop); - $container->setMeta(false, "isadmin", "nickname", $nicktodeopid); + $container->setUserMeta($nicktodeopid, 'isadmin', false); } } Modified: trunk/src/commands/identify.class.php =================================================================== --- trunk/src/commands/identify.class.php 2006-09-19 15:25:50 UTC (rev 770) +++ trunk/src/commands/identify.class.php 2006-09-19 21:32:46 UTC (rev 771) @@ -58,7 +58,7 @@ { // 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); + $container->setUserMeta($u->nickid, 'isadmin' $isadmin); $msg .= _pfc("Succesfully identified"); $xml_reponse->addScript("pfc.handleResponse('".$this->name."', 'ok', '".$msg."');"); Modified: trunk/src/commands/kick.class.php =================================================================== --- trunk/src/commands/kick.class.php 2006-09-19 15:25:50 UTC (rev 770) +++ trunk/src/commands/kick.class.php 2006-09-19 21:32:46 UTC (rev 771) @@ -31,9 +31,9 @@ // kicking a user just add a command to play to the aimed user metadata. $container =& $c->getContainerInstance(); $nickid = $container->getNickId($param); - if ($nickid != "undefined") + if ($nickid != "") { - $cmdtoplay = $container->getMeta("cmdtoplay", "nickname", $nickid); + $cmdtoplay = $container->getUserMeta($nickid, 'cmdtoplay'); $cmdtoplay = ($cmdtoplay == NULL) ? array() : unserialize($cmdtoplay); $reason = _pfc("kicked from %s by %s", $u->channels[$recipientid]["name"], $sender); $cmdtmp = array("leave", /* cmdname */ @@ -43,7 +43,7 @@ $recipientid,/* recipientid */ ); $cmdtoplay[] = $cmdtmp; // kick the user from the current channel - $container->setMeta(serialize($cmdtoplay), "cmdtoplay", "nickname", $nickid); + $container->setUserMeta($nickid, 'cmdtoplay', serialize($cmdtoplay)); } } } Modified: trunk/src/commands/op.class.php =================================================================== --- trunk/src/commands/op.class.php 2006-09-19 15:25:50 UTC (rev 770) +++ trunk/src/commands/op.class.php 2006-09-19 21:32:46 UTC (rev 771) @@ -32,7 +32,7 @@ $nicktoop = trim($param); $container =& $c->getContainerInstance(); $nicktoopid = $container->getNickId($nicktoop); - $container->setMeta(true, "isadmin", "nickname", $nicktoopid); + $container->setUserMeta($nicktoopid, 'isadmin', true); } } Modified: trunk/src/commands/privmsg.class.php =================================================================== --- trunk/src/commands/privmsg.class.php 2006-09-19 15:25:50 UTC (rev 770) +++ trunk/src/commands/privmsg.class.php 2006-09-19 21:32:46 UTC (rev 771) @@ -30,7 +30,7 @@ } // error: can't speak to unknown - if ($pvnickid == "undefined") + if ($pvnickid == '') { // remove this old pv from the privmsg list $pvid_to_remove = ""; Modified: trunk/src/commands/quit.class.php =================================================================== --- trunk/src/commands/quit.class.php 2006-09-19 15:25:50 UTC (rev 770) +++ trunk/src/commands/quit.class.php 2006-09-19 21:32:46 UTC (rev 771) @@ -25,7 +25,7 @@ // from the channels foreach( $u->channels as $id => $chandetail ) - if ($container->removeNick($chandetail["recipient"], $u->nick)) + if ($container->removeNick($chandetail["recipient"], $u->nickid)) { $cmdp = $p; $cmdp["param"] = $id; @@ -36,7 +36,7 @@ } // from the private messages foreach( $u->privmsg as $id => $pvdetail ) - if ($container->removeNick($pvdetail["recipient"], $u->nick)) + if ($container->removeNick($pvdetail["recipient"], $u->nickid)) { $cmdp = $p; $cmdp["param"] = $id; @@ -46,9 +46,8 @@ $cmd->run($xml_reponse, $cmdp); } // from the server - $container->removeNick(NULL, $u->nick); + $container->removeNick(NULL, $u->nickid); - $xml_reponse->addScript("pfc.handleResponse('quit', 'ok', '');"); if ($c->debug) pxlog("/quit (a user just quit -> nick=".$u->nick.")", "chat", $c->getId()); Modified: trunk/src/commands/unban.class.php =================================================================== --- trunk/src/commands/unban.class.php 2006-09-19 15:25:50 UTC (rev 770) +++ trunk/src/commands/unban.class.php 2006-09-19 21:32:46 UTC (rev 771) @@ -34,7 +34,7 @@ $msg = "<p>"._pfc("Nobody has been unbanished")."</p>"; // update the recipient banlist - $banlist = $container->getMeta("banlist_nickid", "channel", $recipientid); + $banlist = $container->getChanMeta($recipient, 'banlist_nickid'); if ($banlist == NULL) $banlist = array(); else @@ -44,14 +44,14 @@ if (in_array($param, $banlist)) { $banlist = array_diff($banlist, array($param)); - $container->setMeta(serialize($banlist), "banlist_nickid", "channel", $recipientid); + $container->setChanMeta($recipient, 'banlist_nickid', serialize($banlist)); $updated = true; $msg = "<p>"._pfc("%s has been unbanished", $param)."</p>"; } else if ($param == "all") { $banlist = array(); - $container->setMeta(serialize($banlist), "banlist_nickid", "channel", $recipientid); + $container->setChanMeta($recipient, 'banlist_nickid', serialize($banlist)); $updated = true; $msg = "<p>"._pfc("%s users have been unbanished", $nb)."</p>"; } Modified: trunk/src/commands/updatemynick.class.php =================================================================== --- trunk/src/commands/updatemynick.class.php 2006-09-19 15:25:50 UTC (rev 770) +++ trunk/src/commands/updatemynick.class.php 2006-09-19 21:32:46 UTC (rev 771) @@ -16,7 +16,9 @@ $u =& $this->u; $container =& $c->getContainerInstance(); - $was_there = $container->updateNick($recipient, $u->nick); + $container->updateNick($u->nickid); + + $was_there = ($container->isNickOnline($recipient, $nickid) >=0); if (!$was_there) { // if the user were not in the list, it must be created in order to refresh his metadata Modified: trunk/src/containers/file.class.php =================================================================== --- trunk/src/containers/file.class.php 2006-09-19 15:25:50 UTC (rev 770) +++ trunk/src/containers/file.class.php 2006-09-19 21:32:46 UTC (rev 771) @@ -101,7 +101,7 @@ $this->setMeta2("channelid-to-nickid", $this->_encode($chan), $nickid); // update the SERVER channel - $this->updateNick($nickid); + if ($chan != 'SERVER') $this->updateNick($nickid); return true; } @@ -117,44 +117,30 @@ { if ($chan == NULL) $chan = 'SERVER'; - $ret = $this->getMeta2("channelid-to-nickid", $this->_encode('SERVER'), $nickid); - $timestamp = $ret["timestamp"][0]; + $timestamp = $this->getMeta2("channelid-to-nickid", $this->_encode('SERVER'), $nickid); + $timestamp = $timestamp["timestamp"][0]; $deleted_user = array(); $deleted_user["nick"][] = $this->getNickname($nickid); $deleted_user["nickid"][] = $nickid; $deleted_user["timestamp"][] = $timestamp; + // remove the nickid from the channel list + $this->rmMeta2('channelid-to-nickid', $this->_encode($chan), $nickid); + $this->rmMeta2('nickid-to-channelid', $nickid, $this->_encode($chan)); - // @todo ne supprimer l'utilisateur que du channel donne en parametres - // car la commande /leave va simplement supprimer l'utilisateur du channel courant - // il faut par contre faire un test sur les channels de l'utilisateur et dans le cas ou l'utilisateur - // est deconnecte du dernier channel (il se peut que ce soit SERVER) alors on supprime ses metadata. - - // il faudrait egalement adapter removeObsoleteNick pour qu'elle appel N fois removeNick - // N etant le nombre de channel de l'utilisateur. Ainsi l'utilisateur dera vraiment deconnecte - - - - // get the user's disconnected channels - $channels = array(); - $ret2 = $this->getMeta2("nickid-to-channelid",$nickid); - foreach($ret2["value"] as $v) - $channels[] = $this->_decode($v); - $deleted_user["channels"][] = $channels; - - // get the user nickname - $nick = $this->getNickname($nickid); - // loop on user channels - foreach($channels as $ch) + // get the current user's channels list + $channels = $this->getMeta2("nickid-to-channelid",$nickid); + $channels = $channels["value"]; + // no more joined channel, just remove the user's metadata + if (count($channels) == 0) { // remove the nickname to nickid correspondance - $this->rmMeta2("metadata-to-nickid", 'nick', $this->_encode($nick)); + $this->rmMeta2('metadata-to-nickid', 'nick', $this->_encode($this->getNickname($nickid))); // remove disconnected nickname metadata - $this->rmMeta2("nickid-to-metadata", $nickid); - // remove the nickid from the channel list - $this->rmMeta2("channelid-to-nickid", $this->_encode($ch), $nickid); + $this->rmMeta2('nickid-to-metadata', $nickid); } + return $deleted_user; } @@ -221,7 +207,7 @@ function getNickname($nickid) { $nick = $this->getMeta2("nickid-to-metadata", $nickid, 'nick', true); - $nick = isset($nick["value"][0]) ? $nick["value"][0] : ""; + $nick = isset($nick["value"][0]) ? $this->_decode($nick["value"][0]) : ""; return $nick; } @@ -249,11 +235,19 @@ $nickid = $ret['value'][$i]; if (time() > ($timestamp+$timeout/1000) ) // user will be disconnected after 'timeout' secondes of inactivity { - $du = $this->removeNick($nickid); + // get the current user's channels list + $channels = array(); + $ret2 = $this->getMeta2("nickid-to-channelid",$nickid); + foreach($ret2["value"] as $userchan) + { + // disconnect the user from each joined channels + $du = $this->removeNick($this->_decode($userchan), $nickid); + $channels[] = $this->_decode($userchan); + } $deleted_user["nick"] = array_merge($deleted_user["nick"], $du["nick"]); $deleted_user["nickid"] = array_merge($deleted_user["nickid"], $du["nickid"]); - $deleted_user["timestamp"] = array_merge($deleted_user["timestamp"], $du["timestamp"]); - $deleted_user["channels"] = array_merge($deleted_user["channels"], $du["channels"]); + $deleted_user["timestamp"] = array_merge($deleted_user["timestamp"], $du["timestamp"]); + $deleted_user["channels"] = array_merge($deleted_user["channels"], array($channels)); } } @@ -496,7 +490,7 @@ if ($leafvalue == NULL) { if (file_exists($leaffilename) && - filesize($leaffilename)>0) unlink($leaffilename); + filesize($leaffilename)>0) unlink($leaffilename); touch($leaffilename); } else @@ -520,12 +514,7 @@ * @return ... */ function getMeta2($group, $subgroup = null, $leaf = null, $withleafvalue = false) - //($key, $type, $subtype = NULL) { - // @todo read the value from the memory cache - //if (isset($this->_meta[$enc_type][$enc_subtype][$enc_key])) - // return $this->_meta[$enc_type][$enc_subtype][$enc_key]; - // read data from metadata file $ret = array(); $ret["timestamp"] = array(); @@ -557,7 +546,6 @@ if (is_dir($dir)) { $dh = opendir($dir); - $ret = array(); while (false !== ($file = readdir($dh))) { if ($file == "." || $file == "..") continue; // skip . and .. generic files @@ -572,15 +560,11 @@ if (!file_exists($leaffilename)) return $ret; if ($withleafvalue) - { $ret["value"][] = file_get_contents($leaffilename); - } + else + $ret["value"][] = NULL; $ret["timestamp"][] = filemtime($leaffilename); - // @todo - // store the result in the memory cache - //$this->_meta[$enc_type][$enc_subtype][$enc_key] = $ret; - return $ret; } @@ -623,7 +607,31 @@ return true; } - + + function getUserMeta($nickid, $key) + { + $ret = $this->getMeta2("nickid-to-metadata", $nickid, $key, true); + return isset($ret['value'][0]) ? $ret['value'][0] : NULL; + } + + function setUserMeta($nickid, $key, $value) + { + $ret = $this->setMeta2("nickid-to-metadata", $nickid, $key, $value); + return $ret; + } + + function getChanMeta($chan, $key) + { + $ret = $this->getMeta2("channelid-to-metadata", $this->_encode($chan), $key, true); + return isset($ret['value'][0]) ? $ret['value'][0] : NULL; + } + + function setChanMeta($chan, $key, $value) + { + $ret = $this->setMeta2("channelid-to-metadata", $this->_encode($chan), $key, $value); + return $ret; + } + } ?> \ No newline at end of file Modified: trunk/src/phpfreechat.class.php =================================================================== --- trunk/src/phpfreechat.class.php 2006-09-19 15:25:50 UTC (rev 770) +++ trunk/src/phpfreechat.class.php 2006-09-19 21:32:46 UTC (rev 771) @@ -355,7 +355,7 @@ // alert the other from the new pv // (warn other user that someone talk to him) $container =& $c->getContainerInstance(); - $cmdtoplay = $container->getMeta("cmdtoplay", "nickname", $u->privmsg[$recipientid]["pvnickid"]); + $cmdtoplay = $container->getUserMeta($u->privmsg[$recipientid]["pvnickid"], 'cmdtoplay'); $cmdtoplay = ($cmdtoplay == NULL) ? array() : unserialize($cmdtoplay); $cmdtmp = array("privmsg2", /* cmdname */ $u->nick, /* param */ @@ -366,7 +366,7 @@ if (!in_array($cmdtmp, $cmdtoplay)) { $cmdtoplay[] = $cmdtmp; - $container->setMeta(serialize($cmdtoplay), "cmdtoplay", "nickname", $u->privmsg[$recipientid]["pvnickid"]); + $container->setUserMeta($u->privmsg[$recipientid]["pvnickid"], 'cmdtoplay', serialize($cmdtoplay)); //$xml_reponse->addScript("alert('cmdtoplay[]=".serialize($cmdtoplay)."');"); } } @@ -382,13 +382,13 @@ while($morecmd) { // take a command from the list - $cmdtoplay = $container->getMeta("cmdtoplay", "nickname", $nickid); + $cmdtoplay = $container->getUserMeta($nickid, 'cmdtoplay'); $cmdtoplay = ($cmdtoplay == NULL) ? array() : unserialize($cmdtoplay); $cmdtmp = array_pop($cmdtoplay); if ($cmdtmp != NULL) { // store the new cmdtoplay list (-1 item) - $container->setMeta(serialize($cmdtoplay), "cmdtoplay", "nickname", $nickid); + $container->setUserMeta($nickid, "cmdtoplay", serialize($cmdtoplay)); // play the command $cmd =& pfcCommand::Factory($cmdtmp[0]); @@ -411,7 +411,7 @@ } // check if there is other command to play - $cmdtoplay = $container->getMeta("cmdtoplay", "nickname", $nickid); + $cmdtoplay = $container->getUserMeta($nickid, 'cmdtoplay'); $cmdtoplay = ($cmdtoplay == NULL) ? array() : unserialize($cmdtoplay); } Modified: trunk/src/proxys/auth.class.php =================================================================== --- trunk/src/proxys/auth.class.php 2006-09-19 15:25:50 UTC (rev 770) +++ trunk/src/proxys/auth.class.php 2006-09-19 21:32:46 UTC (rev 771) @@ -47,7 +47,7 @@ { $container =& $c->getContainerInstance(); $nickid = $u->nickid; - $isadmin = $container->getMeta("isadmin", "nickname", $nickid); + $isadmin = $container->getUserMeta($nickid, 'isadmin'); if (!$isadmin) { $xml_reponse->addScript("alert('".addslashes(_pfc("You are not allowed to run '%s' command", $this->name))."');"); @@ -62,8 +62,9 @@ $channame = $param; // check the user is not listed in the banished channel list + $chan = pfcCommand_join::GetRecipient($channame); $chanid = pfcCommand_join::GetRecipientId($channame); - $banlist = $container->getMeta("banlist_nickid", "channel", $chanid); + $banlist = $container->getChanMeta($chan, 'banlist_nickid'); if ($banlist == NULL) $banlist = array(); else $banlist = unserialize($banlist); $nickid = $u->nickid; if (in_array($nickid,$banlist)) Modified: trunk/src/proxys/checknickchange.class.php =================================================================== --- trunk/src/proxys/checknickchange.class.php 2006-09-19 15:25:50 UTC (rev 770) +++ trunk/src/proxys/checknickchange.class.php 2006-09-19 21:32:46 UTC (rev 771) @@ -87,7 +87,7 @@ $nick_in_use = true; } } - if ($nick_in_use || $newnickid != "undefined") + if ($nick_in_use || $newnickid != '') { $xml_reponse->addScript("pfc.handleResponse('nick', 'isused', '".addslashes($newnick)."');"); if ($c->debug) Modified: trunk/src/proxys/checktimeout.class.php =================================================================== --- trunk/src/proxys/checktimeout.class.php 2006-09-19 15:25:50 UTC (rev 770) +++ trunk/src/proxys/checktimeout.class.php 2006-09-19 21:32:46 UTC (rev 771) @@ -42,28 +42,26 @@ $c =& $this->c; $u =& $this->u; - if ( $this->name == 'update' || - $this->name == 'connect' ) + // disconnect users from specific channels + $container =& $c->getContainerInstance(); + $disconnected_users = $container->removeObsoleteNick($c->timeout); + for($i=0; $i<count($disconnected_users["nick"]); $i++) { - // disconnect users from the server pool - $container =& $c->getContainerInstance(); - $disconnected_users = $container->removeObsoleteNick(NULL,$c->timeout); - } - - if ( $this->name == 'getonlinenick' ) - { - // disconnect users from specific channels - $container =& $c->getContainerInstance(); - $disconnected_users = $container->removeObsoleteNick($recipient,$c->timeout); - if (isset($disconnected_users["nick"])) - foreach ($disconnected_users["nick"] as $n) + $nick = $disconnected_users["nick"][$i]; + for($j=0; $j<count($disconnected_users["channels"][$i]); $j++) + { + $chan = $disconnected_users["channels"][$i][$j]; + if ($chan != 'SERVER') { $cmdp = $p; - $cmdp["param"] = _pfc("%s quit (timeout)", $n); + $cmdp["param"] = _pfc("%s quit (timeout)", $nick); $cmdp["flag"] = 2; + $cmdp["recipient"] = $chan; + $cmdp["recipientid"] = md5($chan); // @todo: clean the recipient/recipientid notion $cmd =& pfcCommand::Factory("notice"); $cmd->run($xml_reponse, $cmdp); } + } } // forward the command to the next proxy or to the final command Modified: trunk/src/proxys/noflood.class.php =================================================================== --- trunk/src/proxys/noflood.class.php 2006-09-19 15:25:50 UTC (rev 770) +++ trunk/src/proxys/noflood.class.php 2006-09-19 21:32:46 UTC (rev 771) @@ -46,9 +46,9 @@ { $container =& $c->getContainerInstance(); $nickid = $u->nickid; - $isadmin = $container->getMeta("isadmin", "nickname", $nickid); - $lastfloodtime = $container->getMeta("floodtime", "nickname", $nickid); - $nbflood = $container->getMeta("nbflood", "nickname", $nickid); + $isadmin = $container->getUserMeta($nickid, 'isadmin'); + $lastfloodtime = $container->getUserMeta($nickid, 'floodtime'); + $nbflood = $container->getUserMeta($nickid, 'nbflood'); $floodtime = time(); if ($floodtime - $lastfloodtime <= $c->proxys_cfg[$this->proxyname]["delay"]) @@ -72,8 +72,8 @@ } if ($nbflood == 0) - $container->setMeta($floodtime, "floodtime", "nickname", $nickid); - $container->setMeta($nbflood, "nbflood", "nickname", $nickid); + $container->setUserMeta($nickid, 'floodtime', $floodtime); + $container->setUserMeta($nickid, 'nbflood', $nbflood); } // forward the command to the next proxy or to the final command Modified: trunk/testcase/container_file.php =================================================================== --- trunk/testcase/container_file.php 2006-09-19 15:25:50 UTC (rev 770) +++ trunk/testcase/container_file.php 2006-09-19 21:32:46 UTC (rev 771) @@ -275,7 +275,6 @@ $ret = $ct->getMeta2($group, $subgroup, $leaf, true); $this->assertEquals($ret['value'][0], $leafvalue, "the leaf value is wrong"); } - } // on desactive le timeout car se script peut mettre bcp de temps a s'executer Modified: trunk/testcase/container_generic.php =================================================================== --- trunk/testcase/container_generic.php 2006-09-19 15:25:50 UTC (rev 770) +++ trunk/testcase/container_generic.php 2006-09-19 21:32:46 UTC (rev 771) @@ -27,13 +27,14 @@ // here function setUp() { + // echo "setUp<br>"; require_once dirname(__FILE__)."/../src/pfcglobalconfig.class.php"; $params = array(); $params["title"] = "testcase -> pfccontainer_".$this->type; $params["serverid"] = md5(__FILE__/* . time()*/); $params["container_type"] = $this->type; - $this->c =& pfcGlobalConfig::Instance($params); - $this->ct =& $this->c->getContainerInstance(); + $this->c = new pfcGlobalConfig($params); + $this->ct = $this->c->getContainerInstance(); } // called after the test functions are executed @@ -41,11 +42,11 @@ // here function tearDown() { + // echo "tearDown<br>"; $this->ct->clear(); $this->c->destroyCache(); } - function testCreateNick_Generic() { $c =& $this->c; @@ -66,7 +67,7 @@ $isonline = ($this->ct->isNickOnline($chan, $nickid) >= 0); $this->assertTrue($isonline, "nickname should be online on the server"); } - + function testRemoveNick_Generic() { $c =& $this->c; @@ -78,18 +79,17 @@ // on the channel $this->ct->createNick($chan, $nick, $nickid); - $this->ct->removeNick($nickid); + $this->ct->removeNick($chan, $nickid); $isonline = ($this->ct->isNickOnline($chan, $nickid) >= 0); $this->assertFalse($isonline, "nickname shouldn't be online on the channel"); + $isonline2 = ($this->ct->isNickOnline(NULL, $nickid) >= 0); + $this->assertTrue($isonline2, "nickname should be online on the server"); - // on the server - $chan = NULL; - $this->ct->createNick($chan, $nick, $nickid); - $this->ct->removeNick($nickid); - $isonline = ($this->ct->isNickOnline($chan, $nickid) >= 0); - $this->assertFalse($isonline, "nickname shouldn't be online on the server"); + $this->ct->removeNick(NULL, $nickid); + $isonline = ($this->ct->isNickOnline(NULL, $nickid) >= 0); + $this->assertFalse($isonline, "nickname shouldn't be online on the server"); } - + function testGetNickId_Generic() { $c =& $this->c; @@ -104,7 +104,6 @@ $this->assertEquals($nickid, $ret, "created nickname doesn't have a correct nickid"); } - function testGetNickname_Generic() { $c =& $this->c; @@ -156,7 +155,8 @@ $this->ct->createNick($chan, $nick, $nickid); sleep(2); $ret = $this->ct->removeObsoleteNick(1000); - $this->assertEquals(count($ret["nickid"]), 1, "1 nickname should be obsolete"); + $this->assertEquals(1, count($ret["nickid"]), "1 nickname should be obsolete"); + $this->assertEquals(2, count($ret["channels"][0]), "nickname should be disconnected from two channels"); $isonline = ($this->ct->isNickOnline($chan, $nickid) >= 0); $this->assertFalse($isonline, "nickname shouldn't be online anymore"); } @@ -276,7 +276,6 @@ $this->assertEquals($msg."9", $res["data"][10]["param"] ,"messages data is not the same as the sent one"); $this->assertEquals($res["new_from_id"], 10 ,"new_from_id is not correct"); } - } ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-19 15:26:05
|
Revision: 770 http://svn.sourceforge.net/phpfreechat/?rev=770&view=rev Author: kerphi Date: 2006-09-19 08:25:50 -0700 (Tue, 19 Sep 2006) Log Message: ----------- Work in progress: datamodel refactoring (don't checkout this revision it doesn't work) Modified Paths: -------------- trunk/src/commands/leave.class.php trunk/src/containers/file.class.php trunk/testcase/container_file.php trunk/testcase/container_generic.php Modified: trunk/src/commands/leave.class.php =================================================================== --- trunk/src/commands/leave.class.php 2006-09-19 06:51:13 UTC (rev 769) +++ trunk/src/commands/leave.class.php 2006-09-19 15:25:50 UTC (rev 770) @@ -72,7 +72,7 @@ // remove the nickname from the channel/pv $container =& $c->getContainerInstance(); - $container->removeNick($leave_recip, $u->nick); + $container->removeNick($chan, $u->nickid); // return ok to the client // then the client will remove the channel' tab Modified: trunk/src/containers/file.class.php =================================================================== --- trunk/src/containers/file.class.php 2006-09-19 06:51:13 UTC (rev 769) +++ trunk/src/containers/file.class.php 2006-09-19 15:25:50 UTC (rev 770) @@ -92,61 +92,17 @@ { $c =& $this->c; - // store nickid -> nickname and nickname -> nickid correspondance - $this->setMeta($nick, "nickname", "fromnickid", $nickid); - $this->setMeta($nickid, "nickid", "fromnickname", $nick); + if ($chan == NULL) $chan = 'SERVER'; - $this->_registerUserMeta($nickid, $chan); + $this->setMeta2("nickid-to-metadata", $nickid, 'nick', $nick); + $this->setMeta2("metadata-to-nickid", 'nick', $this->_encode($nick), $nickid); - if ($c->debug) pxlog("createNick - nickname metadata created: chan=".($chan==NULL?"SERVER":$chan)." nickid=".$nickid, "chat", $c->getId()); + $this->setMeta2("nickid-to-channelid", $nickid, $this->_encode($chan)); + $this->setMeta2("channelid-to-nickid", $this->_encode($chan), $nickid); - /* - // increment the nick references (used to know when the nick is really disconnected) - $nick_ref = $this->getMeta("references", $nickid); - if ($nick_ref == NULL || !is_numeric($nick_ref)) $nick_ref = 0; - $nick_ref++; - $this->setMeta($nick_ref, "references", $nickid); - */ - + // update the SERVER channel + $this->updateNick($nickid); - $c =& $this->c; - $nick_dir = ($chan != NULL) ? - $c->container_cfg_channel_dir."/".$this->_encode($chan)."/nicknames" : - $c->container_cfg_server_dir."/nicknames"; - - // check the nickname directory exists - $errors = @test_writable_dir($nick_dir, $chan."/nicknames/".$nick); - if ($c->debug) - { - if (count($errors)>0) - pxlog("createNick(".$nick.", ".$nickid.") - Error: ".var_export($errors,true), "chat", $c->getId()); - } - - $nickid_filename = $nick_dir."/".$nickid; //$this->_encode($nick); - - // check the if the file exists only in debug mode! - if ($c->debug) - { - /* - if (file_exists($nickid_filename)) - pxlog("createNick(".$nick.", ".$nickid.") - Error: another nickname data file exists, we are overwriting it (nickname takeover)!: ".$nickid_filename, "chat", $c->getId()); - else - pxlog("createNick - nickname file created: chan=".($chan==NULL?"SERVER":$chan)." nickid=".$nickid, "chat", $c->getId()); - */ - } - - // trust the caller : this nick is not used - touch($nickid_filename); - - // append the nickname to the cached nickname list - $id = $this->isNickOnline($chan, $nick); - $_chan = ($chan == NULL) ? "SERVER" : $chan; - if ($id<0) - { - $this->_users[$_chan]["nickid"][] = $nickid; - $this->_users[$_chan]["timestamp"][] = filemtime($nickid_filename); - } - return true; } @@ -157,68 +113,49 @@ * @param $nick the nickname to remove * @return true if the nickname was correctly removed */ - function removeNick($chan, $nick) + function removeNick($chan, $nickid) { - // retrive the nickid to remove - $nickid = $this->getNickId($nick); - if ($nickid == "undefined") return false; + if ($chan == NULL) $chan = 'SERVER'; - $c =& $this->c; - $nick_dir = ($chan != NULL) ? - $c->container_cfg_channel_dir."/".$this->_encode($chan)."/nicknames" : - $c->container_cfg_server_dir."/nicknames"; - $nickid_filename = $nick_dir."/".$nickid; //$this->_encode($nick); + $ret = $this->getMeta2("channelid-to-nickid", $this->_encode('SERVER'), $nickid); + $timestamp = $ret["timestamp"][0]; + + $deleted_user = array(); + $deleted_user["nick"][] = $this->getNickname($nickid); + $deleted_user["nickid"][] = $nickid; + $deleted_user["timestamp"][] = $timestamp; - if ($c->debug) - { - // @todo: check if the removed nick is mine in debug mode! - - // check the nickname file really exists - if (!file_exists($nickid_filename)) - pxlog("removeNick(".$nick.") - Error: the nickname data file to remove doesn't exists: ".$nickid_filename, "chat", $c->getId()); - else - pxlog("removeNick - nickname file removed: chan=".($chan==NULL?"SERVER":$chan)." nickid=".$nickid, "chat", $c->getId()); - } - $ok = @unlink($nickid_filename); + // @todo ne supprimer l'utilisateur que du channel donne en parametres + // car la commande /leave va simplement supprimer l'utilisateur du channel courant + // il faut par contre faire un test sur les channels de l'utilisateur et dans le cas ou l'utilisateur + // est deconnecte du dernier channel (il se peut que ce soit SERVER) alors on supprime ses metadata. - // remove the user metadata if he is disconnected from the server + // il faudrait egalement adapter removeObsoleteNick pour qu'elle appel N fois removeNick + // N etant le nombre de channel de l'utilisateur. Ainsi l'utilisateur dera vraiment deconnecte - $this->_unregisterUserMeta($nickid, $chan); - /* - // decrement the nick references and kill the metadata if not more references is found - // (used to know when the nick is really disconnected) - $nick_ref = $this->getMeta("references", $nickid); - if ($nick_ref == NULL || !is_numeric($nick_ref)) $nick_ref = 0; - $nick_ref--; - if ($nick_ref <= 0) - { - $this->rmMeta("nickid", "fromnickname", $nick); - $this->rmMeta("nickname", "fromnickid", $nickid); - $this->rmMeta("references", $nickid); // destroy also the reference counter (by default its value is 0) - } - else - $this->setMeta($nick_ref, "references", $nickid); - */ - if ($c->debug) - { - // check the nickname file is correctly deleted - if (file_exists($nickid_filename)) - pxlog("removeNick(".$nick.") - Error: the nickname data file yet exists", "chat", $c->getId()); - } + // get the user's disconnected channels + $channels = array(); + $ret2 = $this->getMeta2("nickid-to-channelid",$nickid); + foreach($ret2["value"] as $v) + $channels[] = $this->_decode($v); + $deleted_user["channels"][] = $channels; - // remove the nickname from the cache list - $id = $this->isNickOnline($chan, $nick); - $_chan = ($chan == NULL) ? "SERVER" : $chan; - if ($id >= 0) + // get the user nickname + $nick = $this->getNickname($nickid); + // loop on user channels + foreach($channels as $ch) { - unset($this->_users[$_chan]["nickid"][$id]); - unset($this->_users[$_chan]["timestamp"][$id]); + // remove the nickname to nickid correspondance + $this->rmMeta2("metadata-to-nickid", 'nick', $this->_encode($nick)); + // remove disconnected nickname metadata + $this->rmMeta2("nickid-to-metadata", $nickid); + // remove the nickid from the channel list + $this->rmMeta2("channelid-to-nickid", $this->_encode($ch), $nickid); } - - return $ok; + return $deleted_user; } /** @@ -227,46 +164,15 @@ * @param $chan where to update the nick, if null then update the server nick * @param $nick nickname to update (raw nickname) */ - function updateNick($chan, $nick) + function updateNick($nickid) { - // retrive the nickid to update - $nickid = $this->getNickId($nick); - if ($nickid == "undefined") return false; - - // update the user metadata - $this->_registerUserMeta($nickid, $chan); - $c =& $this->c; - $there = false; - - $nick_dir = ($chan != NULL) ? - $c->container_cfg_channel_dir."/".$this->_encode($chan)."/nicknames" : - $c->container_cfg_server_dir."/nicknames"; - if (!is_dir($nick_dir)) mkdir_r($nick_dir); - - // update my online status file - $nickid_filename = $nick_dir."/".$nickid; //$this->_encode($nick); - if (file_exists($nickid_filename)) $there = true; - @touch($nickid_filename); - @chmod($nickid_filename, 0700); - if ($c->debug) pxlog("updateNick - nickname file updated: chan=".($chan==NULL?"SERVER":$chan)." nickid=".$nickid, "chat", $c->getId()); - - // append the nickname to the cache list - $_chan = ($chan == NULL) ? "SERVER" : $chan; - $id = $this->isNickOnline($chan, $nick); - if ($id < 0) - { - $this->_users[$_chan]["nickid"][] = $nickid; - $this->_users[$_chan]["timestamp"][] = filemtime($nickid_filename); - } - else - { - // just update the timestamp if the nickname is allready present in the cached list - $this->_users[$_chan]["timestamp"][$id] = filemtime($nickid_filename); - } - - return $there; + $chan = 'SERVER'; + + $this->setMeta2("nickid-to-channelid", $nickid, $this->_encode($chan)); + $this->setMeta2("channelid-to-nickid", $this->_encode($chan), $nickid); + return true; } /** @@ -278,41 +184,19 @@ */ function changeNick($newnick, $oldnick) { - $oldnickid = $this->getNickId($oldnick); - $newnickid = $this->getNickId($newnick); - if ($oldnickid == "undefined") return false; // the oldnick must be connected - if ($newnickid != "undefined") return false; // the newnick must not be inuse - - $this->rmMeta("nickid", "fromnickname", $oldnick); // remove the oldnickname -> oldnickid association - $this->setMeta($newnick, "nickname", "fromnickid", $oldnickid); - $this->setMeta($oldnickid, "nickid", "fromnickname", $newnick); - - /* $c =& $this->c; - $nick_dir = ($chan != NULL) ? - $c->container_cfg_channel_dir."/".$this->_encode($chan)."/nicknames" : - $c->container_cfg_server_dir."/nicknames"; - // $newnickid_filename = $nick_dir."/".$this->_encode($newnick); - $oldnickid_filename = $nick_dir."/".$oldnickid; //$this->_encode($oldnick); - - $ok = @rename($oldnick_filename, $newnick_filename); - */ - // update the nick cache list + $oldnickid = $this->getNickId($oldnick); + $newnickid = $this->getNickId($newnick); + if ($oldnickid == "") return false; // the oldnick must be connected + if ($newnickid != "") return false; // the newnick must not be inuse - //if($ok) - /* - { - $_chan = ($chan == NULL) ? "SERVER" : $chan; - $id = $this->isNickOnline($chan, $oldnick); - if ($id >= 0) - { - $this->_users[$_chan][$id]["nick"] = $newnick; - $this->_users[$_chan][$id]["timestamp"] = filemtime($newnick_filename); - } - } - */ + // remove the oldnick to oldnickid correspondance + $this->rmMeta2("metadata-to-nickid", 'nick', $this->_encode($oldnick)); + // update the nickname + $this->setMeta2("nickid-to-metadata", $oldnickid, 'nick', $newnick); + $this->setMeta2("metadata-to-nickid", 'nick', $this->_encode($newnick), $oldnickid); return true; } @@ -324,8 +208,8 @@ */ function getNickId($nick) { - $nickid = $this->getMeta("nickid", "fromnickname", $nick); - if ($nickid == NULL) $nickid = "undefined"; + $nickid = $this->getMeta2("metadata-to-nickid", 'nick', $this->_encode($nick), true); + $nickid = isset($nickid["value"][0]) ? $nickid["value"][0] : ""; return $nickid; } @@ -336,8 +220,8 @@ */ function getNickname($nickid) { - $nick = $this->getMeta("nickname", "fromnickid", $nickid); - if ($nick == NULL) $nick = ""; + $nick = $this->getMeta2("nickid-to-metadata", $nickid, 'nick', true); + $nick = isset($nick["value"][0]) ? $nick["value"][0] : ""; return $nick; } @@ -348,70 +232,31 @@ * @param $timeout * @return array("nickid"=>array("nickid1", ...),"timestamp"=>array(timestamp1, ...)) contains all disconnected nickids and there timestamp */ - function removeObsoleteNick($chan, $timeout) + function removeObsoleteNick($timeout) { $c =& $this->c; - $nick_dir = ($chan != NULL) ? - $c->container_cfg_channel_dir."/".$this->_encode($chan)."/nicknames" : - $c->container_cfg_server_dir."/nicknames"; - // check the nickname directory exists - $errors = @test_writable_dir($nick_dir, $chan."/nicknames"); - - $deleted_user = array(); - $online_user = array(); - $dir_handle = opendir($nick_dir); - while (false !== ($file = readdir($dir_handle))) - { - if ($file == "." || $file == "..") continue; // skip . and .. generic files - $f_time = filemtime($nick_dir."/".$file); - if (time() > ($f_time+$timeout/1000) ) // user will be disconnected after 'timeout' secondes of inactivity - { - $deleted_user["nick"][] = $this->getNickname($file); - $deleted_user["nickid"][] = $file; - $deleted_user["timestamp"][] = $f_time; - @unlink($nick_dir."/".$file); // disconnect expired user - } - else - { - // optimisation: cache user list for next getOnlineNick call - $online_user["nickid"][] = $file; - $online_user["timestamp"][] = $f_time; - } - } + $chan = 'SERVER'; - // remove the user metadata if he is disconnected from the server - if (isset($deleted_user["nickid"]) && count($deleted_user["nickid"])>0) + $deleted_user = array('nick'=>array(), + 'nickid'=>array(), + 'timestamp'=>array(), + 'channels'=>array()); + $ret = $this->getMeta2("channelid-to-nickid", $this->_encode($chan)); + for($i = 0; $i<count($ret['timestamp']); $i++) { - foreach($deleted_user["nickid"] as $du_nid) + $timestamp = $ret['timestamp'][$i]; + $nickid = $ret['value'][$i]; + if (time() > ($timestamp+$timeout/1000) ) // user will be disconnected after 'timeout' secondes of inactivity { - $du_nickid = $du_nid; - $du_nickname = $this->getNickname($du_nid); - - $this->_unregisterUserMeta($du_nickid, $chan); - - /* - // decrement the nick references and kill the metadata if not more references is found - // (used to know when the nick is really disconnected) - $nick_ref = $this->getMeta("references", $du_nickid); - if ($nick_ref == NULL || !is_numeric($nick_ref)) $nick_ref = 0; - $nick_ref--; - if ($nick_ref <= 0) - { - $this->rmMeta("nickid", "fromnickname", $du_nickname); - $this->rmMeta("nickname", "fromnickid", $du_nickid); - $this->rmMeta("references", $du_nickid); // destroy also the reference counter (by default its value is 0) - } - else - $this->setMeta($nick_ref, "references", $du_nickid); - */ + $du = $this->removeNick($nickid); + $deleted_user["nick"] = array_merge($deleted_user["nick"], $du["nick"]); + $deleted_user["nickid"] = array_merge($deleted_user["nickid"], $du["nickid"]); + $deleted_user["timestamp"] = array_merge($deleted_user["timestamp"], $du["timestamp"]); + $deleted_user["channels"] = array_merge($deleted_user["channels"], $du["channels"]); } } - - // cache the updated user list - $_chan = ($chan == NULL) ? "SERVER" : $chan; - $this->_users[$_chan] =& $online_user; - + return $deleted_user; } @@ -422,31 +267,25 @@ */ function getOnlineNick($chan) { - // return the cached user list if it exists - $_chan = ($chan == NULL) ? "SERVER" : $chan; - if (isset($this->_users[$_chan]) && is_array($this->_users[$_chan])) - return $this->_users[$_chan]; - $c =& $this->c; - - $nick_dir = ($chan != NULL) ? - $c->container_cfg_channel_dir."/".$this->_encode($chan)."/nicknames" : - $c->container_cfg_server_dir."/nicknames"; - if (!is_dir($nick_dir)) mkdir_r($nick_dir); + if ($chan == NULL) $chan = 'SERVER'; + $online_user = array(); - $dir_handle = opendir($nick_dir); - while (false !== ($file = readdir($dir_handle))) + $ret = $this->getMeta2("channelid-to-nickid", $this->_encode($chan)); + for($i = 0; $i<count($ret['timestamp']); $i++) { - if ($file == "." || $file == "..") continue; // skip . and .. generic files - $online_user["nickid"][] = $file; - $online_user["timestamp"][] = filemtime($nick_dir."/".$file); - } + $nickid = $ret['value'][$i]; - // cache the user list - $this->_users[$_chan] =& $online_user; + // get timestamp from the SERVER channel + $timestamp = $this->getMeta2("channelid-to-nickid", $this->_encode('SERVER'), $nickid); + $timestamp = $timestamp['timestamp'][0]; - return $this->_users[$_chan]; + $online_user["nick"][] = $this->getNickname($nickid); + $online_user["nickid"][] = $nickid; + $online_user["timestamp"][] = $timestamp; + } + return $online_user; } /** @@ -454,41 +293,16 @@ * @param $chan if NULL then check if the user is online on the server, otherwise check if the user has joined the channel * @return -1 if the user is off line, a positive (>=0) if the user is online */ - function isNickOnline($chan, $nick) + function isNickOnline($chan, $nickid) { - // @todo optimise with this piece of code - /* - $nickid = $this->getNickId($nick); - if ($nickid == "undefined") return false; + if ($chan == NULL) $chan = 'SERVER'; - $nick_dir = ($chan != NULL) ? - $c->container_cfg_channel_dir."/".$this->_encode($chan)."/nicknames" : - $c->container_cfg_server_dir."/nicknames"; - if (!is_dir($nick_dir)) mkdir_r($nick_dir); - - return file_exists($nick_dir."/".$nickid); - */ - - $nickid = $this->getNickId($nick); - - // get the nickname list - $_chan = ($chan == NULL) ? "SERVER" : $chan; - $online_user = isset($this->_users[$_chan]) ? $this->_users[$_chan] : $this->getOnlineNick($chan); - - $uid = 0; - $isonline = false; - if (!isset($online_user["nickid"])) return -1; - while($uid < count($online_user["nickid"]) && !$isonline) + $ret = $this->getMeta2("channelid-to-nickid", $this->_encode($chan)); + for($i = 0; $i<count($ret['timestamp']); $i++) { - if ($online_user["nickid"][$uid] == $nickid) - $isonline = true; - else - $uid++; + if ($ret['value'][$i] == $nickid) return $i; } - if ($isonline) - return $uid; - else - return -1; + return -1; } /** @@ -501,24 +315,15 @@ * @return $msg_id the created message identifier */ function write($chan, $nick, $cmd, $param) - { + { $c =& $this->c; + if ($chan == NULL) $chan = 'SERVER'; + + $msgid = $this->_requestMsgId($chan); - $msg_dir = ($chan != NULL) ? - $c->container_cfg_channel_dir."/".$this->_encode($chan)."/messages" : - $c->container_cfg_server_dir."/messages"; - // check the messages directory exists - $errors = @test_writable_dir($msg_dir, $chan."/messages"); - if (count($errors) > 0) return $errors; // an error occurs ? - - // request a unique id for this new message - $msg_id = $this->_requestMsgId($chan); - if (is_array($msg_id)) return $msg_id; // an error occurs ? - $msg_filename = $msg_dir."/".$msg_id; - // format message $data = "\n"; - $data .= $msg_id."\t"; + $data .= $msgid."\t"; $data .= date("d/m/Y")."\t"; $data .= date("H:i:s")."\t"; $data .= $nick."\t"; @@ -526,14 +331,14 @@ $data .= $param; // write message - file_put_contents($msg_filename, $data); + $this->setMeta2("channelid-to-msg", $this->_encode($chan), $msgid, $data); // delete the obsolete message - $old_msg_id = $msg_id - $c->max_msg - 20; - if ($old_msg_id > 0 && file_exists($msg_dir."/".$old_msg_id)) - @unlink($msg_dir."/".$old_msg_id); - - return $msg_id; + $old_msgid = $msgid - $c->max_msg - 20; + if ($old_msgid > 0) + $this->rmMeta2("channelid-to-msg", $this->_encode($chan), $old_msgid); + + return $msgid; } /** @@ -546,36 +351,29 @@ function read($chan, $from_id) { $c =& $this->c; - - $msg_dir = ($chan != NULL) ? - $c->container_cfg_channel_dir."/".$this->_encode($chan)."/messages" : - $c->container_cfg_server_dir."/messages"; - // check the messages directory exists - $errors = @test_writable_dir($msg_dir, $chan."/messages"); + if ($chan == NULL) $chan = 'SERVER'; - - // read the files into the directory - // sort it by filename order (id order) - // then take only the > $from_id messages - $newmsg = array(); + // read new messages id + $new_msgid_list = array(); $new_from_id = $from_id; - $dir_handle = opendir($msg_dir); - while (false !== ($file = readdir($dir_handle))) + $msgid_list = $this->getMeta2("channelid-to-msg", $this->_encode($chan)); + for($i = 0; $i<count($msgid_list["value"]); $i++) { - if ($file == "." || $file == "..") continue; // skip . and .. generic files - if ($file>$from_id) + $msgidtmp = $msgid_list["value"][$i]; + + if ($msgidtmp > $from_id) { - if ($file > $new_from_id) - $new_from_id = $file; - $newmsg[] = $file; + if ($msgidtmp > $new_from_id) $new_from_id = $msgidtmp; + $new_msgid_list[] = $msgidtmp; } } - - // format content + + // read messages content and parse content $datalist = array(); - foreach ( $newmsg as $m ) + foreach ( $new_msgid_list as $mid ) { - $line = file_get_contents($msg_dir."/".$m); + $line = $this->getMeta2("channelid-to-msg", $this->_encode($chan), $mid, true); + $line = $line["value"][0]; if ($line != "" && $line != "\n") { $formated_line = explode( "\t", $line ); @@ -603,131 +401,17 @@ */ function getLastId($chan) { - $c =& $this->c; + if ($chan == NULL) $chan = 'SERVER'; - // calculate the messages.index location - $chan_dir = ($chan != NULL) ? - $c->container_cfg_channel_dir."/".$this->_encode($chan) : - $c->container_cfg_server_dir; - $index_filename = $chan_dir . "/messages.index"; - - // read last message id - $lastid = trim(@file_get_contents($index_filename)); - if (!is_numeric($lastid)) $lastid = 0; - - return $lastid; - } - - - /** - * Read meta data identified by a key - * As an example the default file container store metadata into metadata/type/subtype/hash(key) - * @param $key is the index which identify a metadata - * @param $type is used to "group" some metadata - * @param $subtype is used to "group" precisely some metadata, use NULL to ignore it - * @return mixed the value assigned to the key, NULL if not found - */ - function getMeta($key, $type, $subtype = NULL) - { - // encode parameters - $enc_key = $this->_encode($key); - $enc_type = $this->_encode($type); - $enc_subtype = ($subtype == NULL) ? "NULL" : $this->_encode($subtype); - if (isset($this->_meta[$enc_type][$enc_subtype][$enc_key])) - return $this->_meta[$enc_type][$enc_subtype][$enc_key]; - - // read data from metadata file - $c =& $this->c; - $dir_base = $c->container_cfg_meta_dir; - $dir = $dir_base."/".$enc_type.($enc_subtype == "NULL" ? "" : "/".$enc_subtype); - $filename = $dir."/".$enc_key; - $ret = @file_get_contents($filename); - if ($ret == false) $ret = NULL; - - // store the result in the cache - $this->_meta[$enc_type][$enc_subtype][$enc_key] = $ret; - - return $ret; - } - - /** - * Write a meta data value identified by a key - * As an example the default file container store metadata into metadata/type/subtype/hash(key) - * @param $key is the index which identify a metadata - * @param $value is the value associated to the key - * @param $type is used to "group" some metadata - * @param $subtype is used to "group" precisely some metadata, use NULL to ignore it - * @return true on success, false on error - */ - function setMeta($value, $key, $type, $subtype = NULL) - { - // encode parameters - $enc_key = $this->_encode($key); - $enc_type = $this->_encode($type); - $enc_subtype = ($subtype == NULL) ? "NULL" : $this->_encode($subtype); - - // create directories - $c =& $this->c; - $dir_base = $c->container_cfg_meta_dir; - $dir = $dir_base."/".$enc_type.($enc_subtype == "NULL" ? "" : "/".$enc_subtype); - if (!is_dir($dir)) mkdir_r($dir); - - // create or replace metadata file - $filename = $dir."/".$enc_key; - $ret = @file_put_contents($filename, $value); - - // store the value in the cache - if ($ret) $this->_meta[$enc_type][$enc_subtype][$enc_key] = $value; - - if ($ret == false) - return false; + $lastmsgid = $this->getMeta2("channelid-to-msgid", $this->_encode($chan), 'lastmsgid', true); + if (count($lastmsgid["value"]) == 0) + $lastmsgid = 0; else - return true; + $lastmsgid = $lastmsgid["value"][0]; + return $lastmsgid; } - /** - * Remove a meta data key/value couple - * Notice: if key is NULL then all the meta data must be removed - * @param $key is the key to delete, use NULL to delete all the metadata - * @param $type is used to "group" some metadata - * @param $subtype is used to "group" precisely some metadata, use NULL to ignore it - * @return true on success, false on error - */ - function rmMeta($key, $type, $subtype = NULL) - { - $c =& $this->c; - - // encode parameters - $enc_key = ($key == NULL) ? "NULL" : $this->_encode($key); - $enc_type = $this->_encode($type); - $enc_subtype = ($subtype == NULL) ? "NULL" : $this->_encode($subtype); - // rm data from metadata file - $dir_base = $c->container_cfg_meta_dir; - $dir = $dir_base."/".$enc_type.($enc_subtype == "NULL" ? "" : "/".$enc_subtype); - $ret = true; - if ($enc_key == "NULL") - { - // remove all keys (the complete directory) - @rm_r($dir); - - // remove the cached data - unset($this->_meta[$enc_type][$enc_subtype]); - } - else - { - // just remove one key - $filename = $dir."/".$enc_key; - $ret = @unlink($filename); - - // remove the cached data - if (isset($this->_meta[$enc_type][$enc_subtype][$enc_key])) - unset($this->_meta[$enc_type][$enc_subtype][$enc_key]); - } - - return $ret; - } - /** * Remove all created data for this server (identified by serverid) * Notice: for the default File container, it's just a recursive directory remove @@ -739,56 +423,11 @@ $dir = $c->container_cfg_server_dir; @rm_r($dir); // empty the cache - $this->_meta = array(); - $this->_users = array("nickid" => array(), - "timestamp" => array()); + // $this->_meta = array(); + // $this->_users = array("nickid" => array(), + // "timestamp" => array()); } - function _registerUserMeta($nickid, $chan) - { - $c =& $this->c; - // create or update the nickname references (used to know when the nick is really disconnected) - if ($chan == NULL) $chan = "SERVER"; - $ref = $this->getMeta("references", $nickid); - if ($ref == NULL) - $ref = array(); - else - $ref = explode(';',$ref); - if ($c->debug) pxlog("registerUserMeta -> ref=".implode(';',$ref), "chat", $c->getId()); - if (in_array($chan,$ref)) - return; - else - $ref[] = $chan; - $ref = implode(';',$ref); - $this->setMeta($ref, "references", $nickid); - } - - function _unregisterUserMeta($nickid, $chan) - { - $c =& $this->c; - // decrement the nick references and kill the metadata if not more references is found - // (used to know when the nick is really disconnected) - if ($chan == NULL) $chan = "SERVER"; - $nickname = $this->getNickname($nickid); - $ref = $this->getMeta("references", $nickid); - if ($ref == NULL) $ref = ''; - $ref = explode(';',$ref); - $ref = array_diff($ref, array($chan)); - if (count($ref) == 0) - { - $this->rmMeta("nickid", "fromnickname", $nickname); - $this->rmMeta("nickname", "fromnickid", $nickid); - $this->rmMeta("references", $nickid); // destroy also the reference counter - if ($c->debug) pxlog("_unregisterUserMeta -> destroy!", "chat", $c->getId()); - } - else - { - $ref = implode(';',$ref); - $this->setMeta($ref, "references", $nickid); - if ($c->debug) pxlog("_unregisterUserMeta -> ref=".$ref, "chat", $c->getId()); - } - } - /** * Return a unique id. Each time this function is called, the last id is incremented. @@ -797,38 +436,13 @@ */ function _requestMsgId($chan) { - $c =& $this->c; - - // calculate the messages.index location - $chan_dir = ($chan != NULL) ? - $c->container_cfg_channel_dir."/".$this->_encode($chan) : - $c->container_cfg_server_dir; - // check the directory exists - $errors = @test_writable_dir($chan_dir, $chan_dir); - if (count($errors) > 0) return $errors; + if ($chan == NULL) $chan = 'SERVER'; - $index_filename = $chan_dir . "/messages.index"; + $lastmsgid = $this->getLastId($chan); + $lastmsgid++; + $this->setMeta2("channelid-to-msgid", $this->_encode($chan), 'lastmsgid', $lastmsgid); - // read last message id - $msg_id = 0; - if (!file_exists($index_filename)) - file_put_contents($index_filename, "0"); - $fp = fopen($index_filename, "rw+"); - if (is_resource($fp)) - { - flock ($fp, LOCK_EX); - $msg_id = fread($fp, filesize($index_filename)); - if (!is_numeric($msg_id)) $msg_id = 0; - // increment message id and save it - $msg_id++; - ftruncate($fp, 0); - fseek($fp, 0); - fwrite($fp, $msg_id); - flock ($fp, LOCK_UN); - fclose($fp); - } - - return $msg_id; + return $lastmsgid; } /** @@ -837,6 +451,7 @@ */ function _encode($str) { + return urlencode($str); return base64_encode(urlencode($str)); } @@ -846,6 +461,7 @@ */ function _decode($str) { + return urldecode($str); return urldecode(base64_decode($str)); } @@ -873,17 +489,19 @@ $dir_base = $c->container_cfg_meta_dir; $dir = $dir_base.'/'.$group.'/'.$subgroup; if (!is_dir($dir)) mkdir_r($dir); - + // create or replace metadata file $leaffilename = $dir."/".$leaf; $leafexists = file_exists($leaffilename); if ($leafvalue == NULL) { - @touch($leaffilename); + if (file_exists($leaffilename) && + filesize($leaffilename)>0) unlink($leaffilename); + touch($leaffilename); } else { - @file_put_contents($leaffilename, $leafvalue); + file_put_contents($leaffilename, $leafvalue); } // store the value in the memory cache @@ -919,12 +537,15 @@ if ($subgroup == NULL) { - $dh = opendir($dir); - while (false !== ($file = readdir($dh))) + if (is_dir($dir)) { - if ($file == "." || $file == "..") continue; // skip . and .. generic files - $ret["timestamp"][] = @filemtime($dir.'/'.$file); - $ret["value"][] = $file; + $dh = opendir($dir); + while (false !== ($file = readdir($dh))) + { + if ($file == "." || $file == "..") continue; // skip . and .. generic files + $ret["timestamp"][] = filemtime($dir.'/'.$file); + $ret["value"][] = $file; + } } return $ret; } @@ -933,13 +554,16 @@ if ($leaf == NULL) { - $dh = opendir($dir); - $ret = array(); - while (false !== ($file = readdir($dh))) + if (is_dir($dir)) { - if ($file == "." || $file == "..") continue; // skip . and .. generic files - $ret["timestamp"][] = @filemtime($dir.'/'.$file); - $ret["value"][] = $file; + $dh = opendir($dir); + $ret = array(); + while (false !== ($file = readdir($dh))) + { + if ($file == "." || $file == "..") continue; // skip . and .. generic files + $ret["timestamp"][] = filemtime($dir.'/'.$file); + $ret["value"][] = $file; + } } return $ret; } @@ -949,12 +573,9 @@ if (!file_exists($leaffilename)) return $ret; if ($withleafvalue) { - $ret["value"][] = @file_get_contents($leaffilename); + $ret["value"][] = file_get_contents($leaffilename); } - else - { - $ret["timestamp"][] = @filemtime($leaffilename); - } + $ret["timestamp"][] = filemtime($leaffilename); // @todo // store the result in the memory cache @@ -983,7 +604,7 @@ if ($subgroup == NULL) { - @rm_r($dir); + rm_r($dir); return true; } @@ -991,14 +612,14 @@ if ($leaf == NULL) { - @rm_r($dir); + rm_r($dir); return true; } $leaffilename = $dir."/".$leaf; if (!file_exists($leaffilename)) return false; - @unlink($leaffilename); + unlink($leaffilename); return true; } Modified: trunk/testcase/container_file.php =================================================================== --- trunk/testcase/container_file.php 2006-09-19 06:51:13 UTC (rev 769) +++ trunk/testcase/container_file.php 2006-09-19 15:25:50 UTC (rev 770) @@ -25,7 +25,257 @@ function tearDown() { pfcContainerTestcase::tearDown(); - } + } + + function test_setMeta_File_1() + { + $c =& $this->c; + $ct =& $this->ct; + + $prefix = __FUNCTION__; + $group = $prefix."_nickid-to-channelid"; + $subgroup = $prefix."_nickid1"; + $leaf = $prefix."_channelid1"; + $ret = $ct->setMeta2($group, $subgroup, $leaf); + $this->assertEquals($ret, 0, "the leaf should be first time created"); + + $f = $c->container_cfg_meta_dir.'/'.$group.'/'.$subgroup.'/'.$leaf; + $ret = file_exists($f); + $this->assertEquals($ret, true, "the leaf file should exists"); + + $ret = file_get_contents($f); + $this->assertEquals($ret, '', "the leaf file should contain nothing"); + } + + function test_setMeta_File_2() + { + $c =& $this->c; + $ct =& $this->ct; + + $prefix = __FUNCTION__; + $group = $prefix."_nickid-to-channelid"; + $subgroup = $prefix."_nickid1"; + $leaf = $prefix."_channelid1"; + $leafvalue = $prefix."_leafvalue1"; + $ret = $ct->setMeta2($group, $subgroup, $leaf, $leafvalue); + $this->assertEquals($ret, 0, "the leaf should be first time created"); + + $f = $c->container_cfg_meta_dir.'/'.$group.'/'.$subgroup.'/'.$leaf; + $ret = file_exists($f); + $this->assertEquals($ret, true, "the leaf file should exists"); + + $ret = file_get_contents($f); + $this->assertEquals($ret, $leafvalue, "the leaf file should contain the value"); + } + + function test_setMeta_File_3() + { + $c =& $this->c; + $ct =& $this->ct; + + $prefix = __FUNCTION__; + $group = $prefix."_nickid-to-channelid"; + $subgroup = $prefix."_nickid1"; + $leaf = $prefix."_channelid1"; + $leafvalue = $prefix."_leafvalue1"; + + $ret = $ct->setMeta2($group, $subgroup, $leaf, $leafvalue); + $this->assertEquals($ret, 0, "the leaf should be first time created"); + + $leafvalue = null; + $ret = $ct->setMeta2($group, $subgroup, $leaf, $leafvalue); + $this->assertEquals($ret, 1, "the leaf should be overwritten"); + + $f = $c->container_cfg_meta_dir.'/'.$group.'/'.$subgroup.'/'.$leaf; + $ret = file_exists($f); + $this->assertEquals($ret, true, "the leaf file should exists"); + + $ret = file_get_contents($f); + $this->assertEquals($ret, '', "the leaf file should contain nothing"); + } + + + function test_getMeta_File_1() + { + $c =& $this->c; + $ct =& $this->ct; + + $prefix = __FUNCTION__; + $group = $prefix."_nickid-to-channelid"; + $subgroup = $prefix."_nickid1"; + $leaf = $prefix."_channelid1"; + $ct->setMeta2($group, $subgroup, $leaf); + $time = time(); + + $ret = $ct->getMeta2($group, $subgroup, $leaf); + $this->assertEquals(count($ret["timestamp"]), 1, "number of leaf is wrong"); + $this->assertEquals($ret["timestamp"][0], $time, "the leaf timestamp is wrong"); + $this->assertEquals($ret["value"][0], null, "the leaf value is wrong"); + + $ret = $ct->getMeta2($group, $subgroup); + $this->assertEquals(count($ret["timestamp"]), 1, "number of leaf is wrong"); + $this->assertEquals($ret["timestamp"][0], $time, "the leaf timestamp is wrong"); + $this->assertEquals($ret["value"][0], $leaf, "the leaf name is wrong"); + + $leafvalue = $prefix."_leafvalue"; + $ct->setMeta2($group, $subgroup, $leaf, $leafvalue); + $time = time(); + + $ret = $ct->getMeta2($group, $subgroup, $leaf, true); + $this->assertEquals(count($ret["timestamp"]), 1, "number of leaf is wrong"); + $this->assertEquals($ret["timestamp"][0], $time, "the leaf timestamp is wrong"); + $this->assertEquals($ret["value"][0], $leafvalue, "the leaf value is wrong"); + } + + function test_getMeta_File_2() + { + $c =& $this->c; + $ct =& $this->ct; + + $prefix = __FUNCTION__; + $group = $prefix."_nickid-to-channelid"; + $subgroup = $prefix."_nickid1"; + $leaf1 = $prefix."_channelid1"; + $leaf2 = $prefix."_channelid2"; + $ct->setMeta2($group, $subgroup, $leaf1); + $ct->setMeta2($group, $subgroup, $leaf2); + $time = time(); + + $ret = $ct->getMeta2($group, $subgroup); + asort($ret["value"]); + $this->assertEquals(count($ret["timestamp"]), 2, "number of leaf is wrong"); + $this->assertEquals($ret["timestamp"][0], $time, "the leaf timestamp is wrong"); + $this->assertEquals($ret["timestamp"][1], $time, "the leaf timestamp is wrong"); + $this->assertEquals($ret["value"][0], $leaf1, "the leaf name is wrong"); + $this->assertEquals($ret["value"][1], $leaf2, "the leaf name is wrong"); + } + + function test_getMeta_File_3() + { + $c =& $this->c; + $ct =& $this->ct; + + $prefix = __FUNCTION__; + $group = $prefix."_nickid-to-channelid"; + $subgroup1 = $prefix."_nickid1"; + $subgroup2 = $prefix."_nickid2"; + $leaf1 = $prefix."_channelid1"; + $leaf2 = $prefix."_channelid2"; + $ct->setMeta2($group, $subgroup1, $leaf1); + $ct->setMeta2($group, $subgroup1, $leaf2); + $ct->setMeta2($group, $subgroup2, $leaf1); + $ct->setMeta2($group, $subgroup2, $leaf2); + $time = time(); + + $ret = $ct->getMeta2($group); + asort($ret["value"]); + $this->assertEquals(count($ret["timestamp"]), 2, "number of subgroup is wrong"); + $this->assertEquals($ret["timestamp"][0], $time, "the subgroup timestamp is wrong"); + $this->assertEquals($ret["timestamp"][1], $time, "the subgroup timestamp is wrong"); + $this->assertEquals($ret["value"][0], $subgroup1, "the subgroup name is wrong"); + $this->assertEquals($ret["value"][1], $subgroup2, "the subgroup name is wrong"); + } + + function test_rmMeta_File_1() + { + $c =& $this->c; + $ct =& $this->ct; + + $prefix = __FUNCTION__; + $group = $prefix."_nickid-to-channelid"; + $subgroup = $prefix."_nickid1"; + $leaf = $prefix."_channelid1"; + $ret = $ct->setMeta2($group, $subgroup, $leaf); + + $ret = $ct->rmMeta2($group, $subgroup, $leaf); + $this->assertEquals($ret, true, "the returned value should be true (rm success)"); + + $f = $c->container_cfg_meta_dir.'/'.$group.'/'.$subgroup.'/'.$leaf; + $ret = file_exists($f); + $this->assertEquals($ret, false, "the leaf file should not exists anymore"); + } + + function test_rmMeta_File_2() + { + $c =& $this->c; + $ct =& $this->ct; + + $prefix = __FUNCTION__; + $group = $prefix."_nickid-to-channelid"; + $subgroup = $prefix."_nickid1"; + $leaf1 = $prefix."_channelid1"; + $leaf2 = $prefix."_channelid2"; + $ret = $ct->setMeta2($group, $subgroup, $leaf1); + $ret = $ct->setMeta2($group, $subgroup, $leaf2); + + $ret = $ct->rmMeta2($group, $subgroup); + $this->assertEquals($ret, true, "the returned value should be true (rm success)"); + + $f = $c->container_cfg_meta_dir.'/'.$group.'/'.$subgroup.'/'.$leaf1; + $ret = file_exists($f); + $this->assertEquals($ret, false, "the leaf file should not exists anymore"); + $f = $c->container_cfg_meta_dir.'/'.$group.'/'.$subgroup.'/'.$leaf2; + $ret = file_exists($f); + $this->assertEquals($ret, false, "the leaf file should not exists anymore"); + + $d = $c->container_cfg_meta_dir.'/'.$group.'/'.$subgroup; + $ret = file_exists($f); + $this->assertEquals($ret, false, "the subgroup directory should not exists anymore"); + } + + function test_rmMeta_File_3() + { + $c =& $this->c; + $ct =& $this->ct; + + $prefix = __FUNCTION__; + $group = $prefix."_nickid-to-channelid"; + $subgroup = $prefix."_nickid1"; + $leaf1 = $prefix."_channelid1"; + $leaf2 = $prefix."_channelid2"; + $ret = $ct->setMeta2($group, $subgroup, $leaf1); + $ret = $ct->setMeta2($group, $subgroup, $leaf2); + + $ret = $ct->rmMeta2($group); + $this->assertEquals($ret, true, "the returned value should be true (rm success)"); + + $f = $c->container_cfg_meta_dir.'/'.$group.'/'.$subgroup.'/'.$leaf1; + $ret = file_exists($f); + $this->assertEquals($ret, false, "the leaf file should not exists anymore"); + $f = $c->container_cfg_meta_dir.'/'.$group.'/'.$subgroup.'/'.$leaf2; + $ret = file_exists($f); + $this->assertEquals($ret, false, "the leaf file should not exists anymore"); + + $d = $c->container_cfg_meta_dir.'/'.$group.'/'.$subgroup; + $ret = file_exists($d); + $this->assertEquals($ret, false, "the subgroup directory should not exists anymore"); + + $d = $c->container_cfg_meta_dir.'/'.$group; + $ret = file_exists($d); + $this->assertEquals($ret, false, "the group directory should not exists anymore"); + } + + + function test_encodedecode_File_1() + { + $c =& $this->c; + $ct =& $this->ct; + + $string = "il était une fois C;h:!?§+ toto=}at是"; + + $prefix = __FUNCTION__; + $group = $prefix."_nickid-to-channelid"; + $subgroup = $prefix."_nickid1"; + $leaf = $prefix."_".$ct->_encode($string); + $leafvalue = $string; + $ct->setMeta2($group, $subgroup, $leaf, $leafvalue); + + $ret = $ct->getMeta2($group, $subgroup); + $this->assertEquals($ret['value'][0], $leaf, "the leaf name is wrong"); + $ret = $ct->getMeta2($group, $subgroup, $leaf, true); + $this->assertEquals($ret['value'][0], $leafvalue, "the leaf value is wrong"); + } + } // on desactive le timeout car se script peut mettre bcp de temps a s'executer Modified: trunk/testcase/container_generic.php =================================================================== --- trunk/testcase/container_generic.php 2006-09-19 06:51:13 UTC (rev 769) +++ trunk/testcase/container_generic.php 2006-09-19 15:25:50 UTC (rev 770) @@ -30,12 +30,12 @@ require_once dirname(__FILE__)."/../src/pfcglobalconfig.class.php"; $params = array(); $params["title"] = "testcase -> pfccontainer_".$this->type; - $params["serverid"] = md5(__FILE__ . time()); + $params["serverid"] = md5(__FILE__/* . time()*/); $params["container_type"] = $this->type; $this->c =& pfcGlobalConfig::Instance($params); $this->ct =& $this->c->getContainerInstance(); } - + // called after the test functions are executed // this function is defined in PHPUnit_TestCase and overwritten // here @@ -45,45 +45,48 @@ $this->c->destroyCache(); } + function testCreateNick_Generic() { $c =& $this->c; $ct =& $this->ct; - $nick = $this->nick; - $nickid = $this->nickid; - $chan = $this->chan; + $prefix = __FUNCTION__; + $nick = $prefix . '_' . $this->nick; + $nickid = $prefix . '_' . $this->nickid; + $chan = $prefix . '_' . $this->chan; // create on the channel $this->ct->createNick($chan, $nick, $nickid); - $isonline = ($this->ct->isNickOnline($chan, $nick) >= 0); + $isonline = ($this->ct->isNickOnline($chan, $nickid) >= 0); $this->assertTrue($isonline, "nickname should be online on the channel"); // create on the server $chan = NULL; $this->ct->createNick($chan, $nick, $nickid); - $isonline = ($this->ct->isNickOnline($chan, $nick) >= 0); + $isonline = ($this->ct->isNickOnline($chan, $nickid) >= 0); $this->assertTrue($isonline, "nickname should be online on the server"); } - + function testRemoveNick_Generic() { $c =& $this->c; $ct =& $this->ct; - $nick = $this->nick; - $nickid = $this->nickid; - $chan = $this->chan; + $prefix = __FUNCTION__; + $nick = $prefix . '_' . $this->nick; + $nickid = $prefix . '_' . $this->nickid; + $chan = $prefix . '_' . $this->chan; // on the channel $this->ct->createNick($chan, $nick, $nickid); - $this->ct->removeNick($chan, $nick); - $isonline = ($this->ct->isNickOnline($chan, $nick) >= 0); + $this->ct->removeNick($nickid); + $isonline = ($this->ct->isNickOnline($chan, $nickid) >= 0); $this->assertFalse($isonline, "nickname shouldn't be online on the channel"); // on the server $chan = NULL; $this->ct->createNick($chan, $nick, $nickid); - $this->ct->removeNick($chan, $nick); - $isonline = ($this->ct->isNickOnline($chan, $nick) >= 0); + $this->ct->removeNick($nickid); + $isonline = ($this->ct->isNickOnline($chan, $nickid) >= 0); $this->assertFalse($isonline, "nickname shouldn't be online on the server"); } @@ -91,159 +94,165 @@ { $c =& $this->c; $ct =& $this->ct; - $nick = $this->nick; - $nickid = $this->nickid; - $chan = $this->chan; + $prefix = __FUNCTION__; + $nick = $prefix . '_' . $this->nick; + $nickid = $prefix . '_' . $this->nickid; + $chan = $prefix . '_' . $this->chan; $this->ct->createNick(NULL, $nick, $nickid); $ret = $this->ct->getNickId($nick); $this->assertEquals($nickid, $ret, "created nickname doesn't have a correct nickid"); } - - function testRemoveObsoleteNick_Generic() + + + function testGetNickname_Generic() { $c =& $this->c; $ct =& $this->ct; - $nick = $this->nick; - $nickid = $this->nickid; - $chan = $this->chan; + $prefix = __FUNCTION__; + $nick = $prefix . '_' . $this->nick; + $nickid = $prefix . '_' . $this->nickid; + $chan = $prefix . '_' . $this->chan; // on the channel $this->ct->createNick($chan, $nick, $nickid); - sleep(2); - $ret = $this->ct->removeObsoleteNick($chan, 1000); - $this->assertEquals(count($ret["nickid"]), 1, "1 nickname should be obsolete"); - $isonline = ($this->ct->isNickOnline($chan, $nick) >= 0); - $this->assertFalse($isonline, "nickname shouldn't be online anymore"); - - // on the server - $chan = NULL; + + $ret = $this->ct->getNickname($nickid); + $this->assertEquals($nick, $ret, "nickname value is wrong"); + } + + function testGetOnlineNick_Generic() + { + $c =& $this->c; + $ct =& $this->ct; + $prefix = __FUNCTION__; + $nick = $prefix . '_' . $this->nick; + $nickid = $prefix . '_' . $this->nickid; + $chan = $prefix . '_' . $this->chan; + + // on the channel $this->ct->createNick($chan, $nick, $nickid); - sleep(2); - $ret = $this->ct->removeObsoleteNick($chan, 1000); - $this->assertEquals(count($ret["nickid"]), 1, "1 nickname should be obsolete"); - $isonline = ($this->ct->isNickOnline($chan, $nick) >= 0); - $this->assertFalse($isonline, "nickname shouldn't be online anymore"); + $time = time(); + $ret = $this->ct->getOnlineNick($chan); + $this->assertEquals(1, count($ret["nickid"]), "1 nickname should be online"); + $this->assertEquals(1, count($ret["nick"]), "1 nickname should be online"); + $this->assertEquals(1, count($ret["timestamp"]), "1 nickname should be online"); + + $this->assertEquals($time, $ret["timestamp"][0], "nickname timestamp is wrong"); + $this->assertEquals($nick, $ret["nick"][0], "nickname value is wrong"); + $this->assertEquals($nickid, $ret["nickid"][0], "nickname id is wrong"); } + - function testSetGetRmMeta_Generic() + function testRemoveObsoleteNick_Generic() { $c =& $this->c; $ct =& $this->ct; - $nick = $this->nick; - $nickid = $this->nickid; - $chan = $this->chan; + $prefix = __FUNCTION__; + $nick = $prefix . '_' . $this->nick; + $nickid = $prefix . '_' . $this->nickid; + $chan = $prefix . '_' . $this->chan; - // set / get - $this->ct->setMeta($nickid, "key1", "nickname", $nick); - $metadata = $this->ct->getMeta("key1", "nickname", $nick); - $this->assertEquals($nickid, $metadata, "metadata value is not correct"); - - // set / rm / get - $this->ct->setMeta($nickid, "key2", "nickname", $nick); - $metadata = $this->ct->getMeta("key2", "nickname", $nick); - $this->assertEquals($nickid, $metadata, "metadata value is not correct"); - $this->ct->rmMeta("key2", "nickname", $nick); - $metadata = $this->ct->getMeta("key2", "nickname", $nick); - $this->assertNull($metadata, "metadata should not exists anymore"); - - // set / rm (all) / get - $this->ct->setMeta($nickid, "key2", "nickname", $nick); - $metadata = $this->ct->getMeta("key2", "nickname", $nick); - $this->assertEquals($nickid, $metadata, "metadata value is not correct"); - $this->ct->rmMeta(NULL, "nickname", $nick); - $metadata = $this->ct->getMeta("key2", "nickname", $nick); - $this->assertNull($metadata, "metadata should not exists anymore"); - $metadata = $this->ct->getMeta("key1", "nickname", $nick); - $this->assertNull($metadata, "metadata should not exists anymore"); + $this->ct->createNick($chan, $nick, $nickid); + sleep(2); + $ret = $this->ct->removeObsoleteNick(1000); + $this->assertEquals(count($ret["nickid"]), 1, "1 nickname should be obsolete"); + $isonline = ($this->ct->isNickOnline($chan, $nickid) >= 0); + $this->assertFalse($isonline, "nickname shouldn't be online anymore"); } - + function testupdateNick_Generic() { $c =& $this->c; $ct =& $this->ct; - $nick = $this->nick; - $nickid = $this->nickid; - $chan = $this->chan; + $prefix = __FUNCTION__; + $nick = $prefix . '_' . $this->nick; + $nickid = $prefix . '_' . $this->nickid; + $chan = $prefix . '_' . $this->chan; - // on the channel $this->ct->createNick($chan, $nick, $nickid); sleep(2); - $ret = $this->ct->updateNick($chan, $nick); + $ret = $this->ct->updateNick($nickid); $this->assertTrue($ret, "nickname should be correctly updated"); - $ret = $this->ct->removeObsoleteNick($chan, 1000); - $this->assertFalse(in_array($nick, $ret), "nickname shouldn't be removed because it has been updated"); - $isonline = ($this->ct->isNickOnline($chan, $nick) >= 0); + + $ret = $this->ct->removeObsoleteNick(1000); + $this->assertFalse(in_array($nick, $ret['nick']), "nickname shouldn't be removed because it has been updated"); + $isonline = ($this->ct->isNickOnline($chan, $nickid) >= 0); $this->assertTrue($isonline, "nickname should be online"); - - // on the server - $chan = NULL; - $this->ct->createNick($chan, $nick, $nickid); - sleep(2); - $ret = $this->ct->updateNick($chan, $nick); - $this->assertTrue($ret, "nickname should be correctly updated"); - $ret = $this->ct->removeObsoleteNick($chan, 1000); - $this->assertFalse(in_array($nick, $ret), "nickname shouldn't be removed because it has been updated"); - $isonline = ($this->ct->isNickOnline($chan, $nick) >= 0); - $this->assertTrue($isonline, "nickname should be online"); } + function testchangeNick_Generic() { $c =& $this->c; $ct =& $this->ct; - $nick1 = $this->nick; - $nick2 = $this->nick."2"; - $nickid = $this->nickid; - $chan = $this->chan; + $prefix = __FUNCTION__; + $nick1 = $prefix . '_' . $this->nick; + $nick2 = $prefix . '_' . $this->nick.'2'; + $nickid = $prefix . '_' . $this->nickid; + $chan = $prefix . '_' . $this->chan; // create a nick on a channel and change it $this->ct->createNick($chan, $nick1, $nickid); $ret = $this->ct->changeNick($nick2, $nick1); $this->assertTrue($ret, "nickname change function should returns true (success)"); - $isonline1 = ($this->ct->isNickOnline($chan, $nick1) >= 0); - $isonline2 = ($this->ct->isNickOnline($chan, $nick2) >= 0); + $isonline1 = ($this->ct->isNickOnline($chan, $this->ct->getNickId($nick1)) >= 0); + $isonline2 = ($this->ct->isNickOnline($chan, $this->ct->getNickId($nick2)) >= 0); $this->assertFalse($isonline1, "nickname shouldn't be online"); $this->assertTrue($isonline2, "nickname shouldn't be online"); } - + + function testgetLastId_Generic() + { + $c =& $this->c; + $ct =& $this->ct; + $prefix = __FUNCTION__; + $nick = $prefix . '_' . $this->nick; + $nickid = $prefix . '_' . $this->nickid; + $chan = $prefix . '_' . $this->chan; + $cmd = "send"; + $msg = "my test message"; + + // on the channel + $this->ct->createNick($chan, $nick, $nickid); + for($i = 0; $i < 10; $i++) + { + $msgid = $this->ct->write($chan, $nick, $cmd ,$msg . $i); + $this->assertEquals($msgid, $i+1,"generated msg_id is not correct"); + } + $msgid = $this->ct->getLastId($chan); + $this->assertEquals(10, $msgid, "last msgid is not correct"); + } + function testwrite_Generic() { $c =& $this->c; $ct =& $this->ct; - $nick = $this->nick; - $nickid = $this->nickid; - $chan = $this->chan; + $prefix = __FUNCTION__; + $nick = $prefix . '_' . $this->nick; + $nickid = $prefix . '_' . $this->nickid; + $chan = $prefix . '_' . $this->chan; $cmd = "send"; $msg = "my test message"; // create message on the channel $this->ct->createNick($chan, $nick, $nickid); $msgid = $this->ct->write($chan, $nick, $cmd, $msg); - $this->assertEquals($msgid, 1,"generated msg_id is not correct"); + $this->assertEquals(1, $msgid,"generated msg_id is not correct"); $res = $this->ct->read($chan, 0); $this->assertEquals(1, count($res["data"]), "1 messages should be read"); $this->assertEquals($msg, $res["data"][1]["param"] ,"messages data is not the same as the sent one"); - $this->assertEquals($res["new_from_id"], 1 ,"new_from_id is not correct"); - - // create message on the server - $chan = NULL; - $this->ct->createNick($chan, $nick, $nickid); - $msgid = $this->ct->write($chan, $nick, $cmd, $msg); - $this->assertEquals($msgid, 1,"generated msg_id is not correct"); - $res = $this->ct->read($chan, 0); - $this->assertEquals(1, count($res["data"]), "1 messages should be read"); - $this->assertEquals($msg, $res["data"][1]["param"] ,"messages data is not the same as the sent one"); - $this->assertEquals($res["new_from_id"], 1 ,"new_from_id is not correct"); + $this->assertEquals(1, $res["new_from_id"],"new_from_id is not correct"); } function testread_Generic() { $c =& $this->c; $ct =& $this->ct; - $nick = $this->nick; - $nickid = $this->nickid; - $chan = $this->chan; + $prefix = __FUNCTION__; + $nick = $prefix . '_' . $this->nick; + $nickid = $prefix . '_' . $this->nickid; + $chan = $prefix . '_' . $this->chan; $cmd = "send"; $msg = "my test message"; @@ -268,37 +277,6 @@ $this->assertEquals($res["new_from_id"], 10 ,"new_from_id is not correct"); } - function testgetLastId_Generic() - { - $c =& $this->c; - $ct =& $this->ct; - $nick = $this->nick; - $nickid = $this->nickid; - $chan = $this->chan; - $cmd = "send"; - $msg = "my test message"; - - // on the channel - $this->ct->createNick($chan, $nick, $nickid); - for($i = 0; $i < 10; $i++) - { - $msgid = $this->ct->write($chan, $nick, $cmd ,$msg . $i); - $this->assertEquals($msgid, $i+1,"generated msg_id is not correct"); - } - $msgid = $this->ct->getLastId($chan); - $this->assertEquals(10, $msgid, "last msgid is not correct"); - - // on the server - $chan = NULL; - $this->ct->createNick($chan, $nick, $nickid); - for($i = 0; $i < 10; $i++) - { - $msgid = $this->ct->write($chan, $nick, $cmd ,$msg . $i); - $this->assertEquals($msgid, $i+1,"generated msg_id is not correct"); - } - $msgid = $this->ct->getLastId($chan); - $this->assertEquals(10, $msgid, "last msgid is not correct"); - } } ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-19 06:51:22
|
Revision: 769 http://svn.sourceforge.net/phpfreechat/?rev=769&view=rev Author: kerphi Date: 2006-09-18 23:51:13 -0700 (Mon, 18 Sep 2006) Log Message: ----------- fix a js syntax error Modified Paths: -------------- trunk/src/client/pfcclient.js Modified: trunk/src/client/pfcclient.js =================================================================== --- trunk/src/client/pfcclient.js 2006-09-18 20:49:50 UTC (rev 768) +++ trunk/src/client/pfcclient.js 2006-09-19 06:51:13 UTC (rev 769) @@ -1025,7 +1025,7 @@ applyNickColor: function(root, nick, color) { - var nicktochange = this.getElementsByClassName(root, 'pfc_nick_'+ hex_md5(_to_utf8(nick)), '') + var nicktochange = this.getElementsByClassName(root, 'pfc_nick_'+ hex_md5(_to_utf8(nick)), ''); for(var i = 0; nicktochange.length > i; i++) nicktochange[i].style.color = color; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-18 20:49:58
|
Revision: 768 http://svn.sourceforge.net/phpfreechat/?rev=768&view=rev Author: kerphi Date: 2006-09-18 13:49:50 -0700 (Mon, 18 Sep 2006) Log Message: ----------- Work in progresse : new data model (in test) Modified Paths: -------------- trunk/src/containers/file.class.php Modified: trunk/src/containers/file.class.php =================================================================== --- trunk/src/containers/file.class.php 2006-09-17 20:51:29 UTC (rev 767) +++ trunk/src/containers/file.class.php 2006-09-18 20:49:50 UTC (rev 768) @@ -848,6 +848,161 @@ { return urldecode(base64_decode($str)); } + + + + + + + + + + + + + + /** + * Write a meta data value identified by a group / subgroup / leaf [with a value] + * @return 1 if the leaf allready existed, 0 if the leaf has been created + */ + function setMeta2($group, $subgroup, $leaf, $leafvalue = NULL) + // value, $key, $type, $subtype = NULL) + { + // create directories + $c =& $this->c; + $dir_base = $c->container_cfg_meta_dir; + $dir = $dir_base.'/'.$group.'/'.$subgroup; + if (!is_dir($dir)) mkdir_r($dir); + + // create or replace metadata file + $leaffilename = $dir."/".$leaf; + $leafexists = file_exists($leaffilename); + if ($leafvalue == NULL) + { + @touch($leaffilename); + } + else + { + @file_put_contents($leaffilename, $leafvalue); + } + + // store the value in the memory cache + //@todo + // $this->_meta[$enc_type][$enc_subtype][$enc_key] = $value; + + if ($leafexists) + return 1; // value overwritten + else + return 0; // value created + } + + + /** + * Read meta data identified by a group [/ subgroup [/ leaf]] + * @return ... + */ + function getMeta2($group, $subgroup = null, $leaf = null, $withleafvalue = false) + //($key, $type, $subtype = NULL) + { + // @todo read the value from the memory cache + //if (isset($this->_meta[$enc_type][$enc_subtype][$enc_key])) + // return $this->_meta[$enc_type][$enc_subtype][$enc_key]; + + // read data from metadata file + $ret = array(); + $ret["timestamp"] = array(); + $ret["value"] = array(); + $c =& $this->c; + $dir_base = $c->container_cfg_meta_dir; + + $dir = $dir_base.'/'.$group; + + if ($subgroup == NULL) + { + $dh = opendir($dir); + while (false !== ($file = readdir($dh))) + { + if ($file == "." || $file == "..") continue; // skip . and .. generic files + $ret["timestamp"][] = @filemtime($dir.'/'.$file); + $ret["value"][] = $file; + } + return $ret; + } + + $dir .= '/'.$subgroup; + + if ($leaf == NULL) + { + $dh = opendir($dir); + $ret = array(); + while (false !== ($file = readdir($dh))) + { + if ($file == "." || $file == "..") continue; // skip . and .. generic files + $ret["timestamp"][] = @filemtime($dir.'/'.$file); + $ret["value"][] = $file; + } + return $ret; + } + + $leaffilename = $dir."/".$leaf; + + if (!file_exists($leaffilename)) return $ret; + if ($withleafvalue) + { + $ret["value"][] = @file_get_contents($leaffilename); + } + else + { + $ret["timestamp"][] = @filemtime($leaffilename); + } + + // @todo + // store the result in the memory cache + //$this->_meta[$enc_type][$enc_subtype][$enc_key] = $ret; + + return $ret; + } + + + /** + * Remove a meta data + * @return ... + */ + function rmMeta2($group, $subgroup = null, $leaf = null) + //($key, $type, $subtype = NULL) + { + $c =& $this->c; + + + + // read data from metadata file + $c =& $this->c; + $dir_base = $c->container_cfg_meta_dir; + + $dir = $dir_base.'/'.$group; + + if ($subgroup == NULL) + { + @rm_r($dir); + return true; + } + + $dir .= '/'.$subgroup; + + if ($leaf == NULL) + { + @rm_r($dir); + return true; + } + + $leaffilename = $dir."/".$leaf; + + if (!file_exists($leaffilename)) return false; + @unlink($leaffilename); + return true; + } + + } ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |