[Phpfreechat-svn] SF.net SVN: phpfreechat: [500] trunk/src
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-05-23 20:34:28
|
Revision: 500 Author: kerphi Date: 2006-05-23 13:34:13 -0700 (Tue, 23 May 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=500&view=rev Log Message: ----------- Bug fix: the nick parameters passed in the parameter array was not take into account Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php trunk/src/pfcuserconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-05-23 20:33:23 UTC (rev 499) +++ trunk/src/pfcglobalconfig.class.php 2006-05-23 20:34:13 UTC (rev 500) @@ -31,7 +31,14 @@ class pfcGlobalConfig { var $serverid = ""; // this is the chat server id (comparable to the server host in IRC) + + // these parameters are dynamic (not cached) var $nick = ""; // the initial nickname ("" means the user will be queried) + var $channels = array(); // the default joined channels when opening the chat + var $privmsg = array(); // the default privmsg chat to lauch when opening the chat + var $active = false; // by default the user is not connected + + // these parameters are static (cached) var $title = ""; // default is _pfc("My Chat") var $channel = ""; // default is _pfc("My room") var $frozen_nick = false; @@ -124,6 +131,9 @@ if ($this->data_public_path == "") $this->data_public_path = dirname(__FILE__)."/../data/public"; $this->synchronizeWithCache(); + + // the nickname is not global, it must not be cached + $this->nick = $params["nick"]; } function &Instance( $params = array() ) @@ -428,52 +438,6 @@ else die(_pfc("Error: '%s' could not be found, please check your themepath '%s' and your theme '%s' are correct", $file, $this->themepath, $this->theme)); } - - - - - /* ---------------------------- */ - /* TO DELETE */ - - - /** - * save the pfcglobalconfig object into sessions if necessary - * else restore the old pfcglobalconfig object - */ - function synchronizeWithSession() - { - $session_id = $this->prefix."chatconfig_".$this->getId(); - if (isset($_SESSION[$session_id])) - { - $pfc_configvar = unserialize($_SESSION[$session_id]); - foreach($pfc_configvar as $key => $val) - $this->$key = $val; - if ($this->debug) pxlog("synchronizeWithSession[".$this->getId()."]: restore chatconfig from session nick=".$this->nick, "chatconfig", $this->getId()); - } - else - { - if (!$this->isInit()) - $this->init(); - $errors =& $this->getErrors(); - if (count($errors) > 0) - { - echo "<ul>"; foreach( $errors as $e ) echo "<li>".$e."</li>"; echo "</ul>"; - exit; - } - // save the validated config in session - $this->saveInSession(); - } - } - - function saveInSession() - { - $session_id = $this->prefix."chatconfig_".$this->getId(); - $_SESSION[$session_id] = serialize(get_object_vars($this)); - if ($this->debug) pxlog("saveInSession[".$this->getId()."]: nick=".$this->nick, "chatconfig", $this->getId()); - } - - - } ?> Modified: trunk/src/pfcuserconfig.class.php =================================================================== --- trunk/src/pfcuserconfig.class.php 2006-05-23 20:33:23 UTC (rev 499) +++ trunk/src/pfcuserconfig.class.php 2006-05-23 20:34:13 UTC (rev 500) @@ -10,7 +10,6 @@ var $active; var $timeout; - var $sessionid; var $is_init = false; // used internaly to know if the chat config is initialized @@ -27,6 +26,7 @@ $this->sessionid = session_id(); + // user parameters are cached in sessions $this->_getParam("nick"); if (!isset($this->nick)) $this->_setParam("nick",""); $this->_getParam("active"); @@ -35,9 +35,6 @@ if (!isset($this->channels)) $this->_setParam("channels",array()); $this->_getParam("privmsg"); if (!isset($this->privmsg)) $this->_setParam("privmsg",array()); - - //@ todo: save the nickname config into the cache - //$this->synchronizeWithCache(); } function &_getParam($p) @@ -49,6 +46,8 @@ $sessionid_param = $sessionid."_".$p; if (isset($_SESSION[$sessionid_param])) $this->$p = $_SESSION[$sessionid_param]; + else + $this->$p = $c->$p; // take the default parameter from the global config } return $this->$p; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |