[Phpfreechat-svn] SF.net SVN: phpfreechat: [557] trunk/src
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-06-08 19:45:25
|
Revision: 557 Author: kerphi Date: 2006-06-08 12:45:18 -0700 (Thu, 08 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=557&view=rev Log Message: ----------- Bug fix: the /rehash command was broken Bug fix: the themes were not installed in the public directory, now they are copied Modified Paths: -------------- trunk/src/commands/rehash.class.php trunk/src/pfcglobalconfig.class.php Modified: trunk/src/commands/rehash.class.php =================================================================== --- trunk/src/commands/rehash.class.php 2006-06-08 19:35:08 UTC (rev 556) +++ trunk/src/commands/rehash.class.php 2006-06-08 19:45:18 UTC (rev 557) @@ -14,10 +14,10 @@ function run(&$xml_reponse, $clientid, $param, $sender, $recipient, $recipientid) { $c =& $this->c; - $c->destroy(); - $synchro = $c->synchronizeWithCache(); + $destroyed = $c->destroy(); + $synchro = $c->synchronizeWithCache(); - if ($synchro) + if ($destroyed && $synchro) $xml_reponse->addScript("pfc.handleResponse('".$this->name."', 'ko', '');"); else $xml_reponse->addScript("pfc.handleResponse('".$this->name."', 'ok', '');"); Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-06-08 19:35:08 UTC (rev 556) +++ trunk/src/pfcglobalconfig.class.php 2006-06-08 19:45:18 UTC (rev 557) @@ -244,17 +244,6 @@ if ($this->client_script_url == "") $this->client_script_url = "./".basename($filetotest); - // set the default theme path - if ($this->themepath_default == "") - $this->themepath_default = dirname(__FILE__)."/../themes"; - if ($this->themepath == "") - $this->themepath = $this->themepath_default; - - // calculate the default theme url - if ($this->themeurl_default == "") - $this->themeurl_default = relativePath($this->client_script_path, $this->themepath_default); - if ($this->themeurl == "") - $this->themeurl = relativePath($this->client_script_path, $this->themepath); // calculate datapublic url if ($this->data_public_url == "") @@ -275,6 +264,24 @@ $this->errors[] = _pfc("%s doesn't exist", $filetotest); if ($this->server_script_url == "") $this->server_script_url = relativePath($this->client_script_path, $this->server_script_path)."/".basename($filetotest); + + // check if the themepath parameter are correctly setup + if ($this->themepath_default == "" || !is_dir($this->themepath_default)) + $this->themepath_default = dirname(__FILE__)."/../themes"; + if ($this->themepath == "" || !is_dir($this->themepath)) + $this->themepath = $this->themepath_default; + // copy the themes into the public directory + $this->errors = array_merge($this->errors, @install_dir($this->themepath_default, $this->data_public_path."/themes")); + $this->errors = array_merge($this->errors, @install_dir($this->themepath, $this->data_public_path."/themes")); + // now it's copied, so update the themepath parameters to the new location + $this->themepath_default = $this->data_public_path."/themes"; + $this->themepath = $this->data_public_path."/themes"; + // calculate the corresponding theme url + if ($this->themeurl_default == "") + $this->themeurl_default = relativePath($this->client_script_path, $this->data_public_path."/themes"); + if ($this->themeurl == "") + $this->themeurl = relativePath($this->client_script_path, $this->data_public_path."/themes"); + // --- // run specific container initialisation @@ -356,7 +363,7 @@ { if (preg_match("/^#.*/",$line)) continue; - else if (preg_match("/^([a-z_0-9]*(\.gif|\.png))(.*)$/i",$line,$res)) + else if (preg_match("/^([a-z_\-0-9]*(\.gif|\.png))(.*)$/i",$line,$res)) { $smiley_file = $this->getFileUrlFromTheme('smileys/'.$res[1]); $smiley_str = trim($res[3])."\n"; @@ -378,7 +385,10 @@ function destroy() { $cachefile = $this->data_private_path."/cache/pfcglobalconfig_".$this->getId(); - @unlink($cachefile); + if (!file_exists($cachefile)) + return false; + $this->is_init = false; + return @unlink($cachefile); } /** @@ -388,7 +398,7 @@ function synchronizeWithCache() { $cachefile = $this->data_private_path."/cache/pfcglobalconfig_".$this->getId(); - + if (file_exists($cachefile)) { $pfc_configvar = unserialize(file_get_contents($cachefile)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |