[Phpfreechat-svn] SF.net SVN: phpfreechat: [982] trunk
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2007-02-28 17:58:05
|
Revision: 982 http://svn.sourceforge.net/phpfreechat/?rev=982&view=rev Author: kerphi Date: 2007-02-28 09:58:04 -0800 (Wed, 28 Feb 2007) Log Message: ----------- [en] Bug fix: QUERY_STRING should not be added when server_script_url setup in the parameter list [0h40] [fr] Bug fix : QUERY_STRING ne doit pas etre ajoute lorsque le parametre server_script_url est explicitement regle dans la liste des parametres [0h40] -- Cette ligne, et les suivantes ci-dessous, seront ignor?\195?\169es-- M demo/demo50_customized_usermetadata.php M demo/demo34_add_a_link_on_nicknames.php M demo/demo5_customized_style.php M demo/demo21_with_hardcoded_urls.php M demo/demo3_config.php M themes/default/chat.js.tpl.php M src/phpfreechat.class.php M src/pfcglobalconfig.class.php Modified Paths: -------------- trunk/demo/demo21_with_hardcoded_urls.php trunk/demo/demo34_add_a_link_on_nicknames.php trunk/demo/demo3_config.php trunk/demo/demo50_customized_usermetadata.php trunk/demo/demo5_customized_style.php trunk/src/pfcglobalconfig.class.php trunk/src/phpfreechat.class.php trunk/themes/default/chat.js.tpl.php Modified: trunk/demo/demo21_with_hardcoded_urls.php =================================================================== --- trunk/demo/demo21_with_hardcoded_urls.php 2007-02-28 17:21:49 UTC (rev 981) +++ trunk/demo/demo21_with_hardcoded_urls.php 2007-02-28 17:58:04 UTC (rev 982) @@ -8,7 +8,6 @@ // setup urls $params["data_public_url"] = "../data/public"; -$params["client_script_url"] = "./demo21_with_hardcoded_urls.php"; $params["server_script_url"] = "./demo21_with_hardcoded_urls.php"; $params["theme_default_url"] = "../themes"; Modified: trunk/demo/demo34_add_a_link_on_nicknames.php =================================================================== --- trunk/demo/demo34_add_a_link_on_nicknames.php 2007-02-28 17:21:49 UTC (rev 981) +++ trunk/demo/demo34_add_a_link_on_nicknames.php 2007-02-28 17:58:04 UTC (rev 982) @@ -4,7 +4,7 @@ $params["serverid"] = md5(__FILE__); // calculate a unique id for this chat $params["title"] = "A chat with a customized nickname list"; -$params["themepath"] = dirname(__FILE__)."/demo34_add_a_link_on_nicknames"; +$params["theme_path"] = dirname(__FILE__)."/demo34_add_a_link_on_nicknames"; $params["theme"] = "mytheme"; $chat = new phpFreeChat( $params ); Modified: trunk/demo/demo3_config.php =================================================================== --- trunk/demo/demo3_config.php 2007-02-28 17:21:49 UTC (rev 981) +++ trunk/demo/demo3_config.php 2007-02-28 17:58:04 UTC (rev 982) @@ -6,4 +6,4 @@ $params["nick"] = "guest"; $params["server_script_path"] = dirname(__FILE__)."/demo3_server.php"; -?> +?> \ No newline at end of file Modified: trunk/demo/demo50_customized_usermetadata.php =================================================================== --- trunk/demo/demo50_customized_usermetadata.php 2007-02-28 17:21:49 UTC (rev 981) +++ trunk/demo/demo50_customized_usermetadata.php 2007-02-28 17:58:04 UTC (rev 982) @@ -6,7 +6,7 @@ $params["title"] = "A chat which shows how to use user metadata : add avatar (images) to each connected users"; $params["nick"] = "guest".rand(1,1000); $params["nickmeta"] = array("avatar" => "demo50_data/avatar".rand(1,10).".jpg"); -$params["themepath"] = dirname(__FILE__)."/demo50_data"; +$params["theme_path"] = dirname(__FILE__)."/demo50_data"; $params["theme"] = "mytheme"; $chat = new phpFreeChat( $params ); Modified: trunk/demo/demo5_customized_style.php =================================================================== --- trunk/demo/demo5_customized_style.php 2007-02-28 17:21:49 UTC (rev 981) +++ trunk/demo/demo5_customized_style.php 2007-02-28 17:58:04 UTC (rev 982) @@ -8,7 +8,7 @@ // do not uses width parameter because of a display bug in IE6 //$params["width"] = "650px"; $params["max_msg"] = 21; -$params["themepath"] = dirname(__FILE__)."/demo5_customized_style_data"; +$params["theme_path"] = dirname(__FILE__)."/demo5_customized_style_data"; $params["theme"] = "mytheme"; $chat = new phpFreeChat( $params ); Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2007-02-28 17:21:49 UTC (rev 981) +++ trunk/src/pfcglobalconfig.class.php 2007-02-28 17:58:04 UTC (rev 982) @@ -102,10 +102,10 @@ var $nickname_colorlist = array('#CCCCCC','#000000','#3636B2','#2A8C2A','#C33B3B','#C73232','#80267F','#66361F','#D9A641','#3DCC3D','#1A5555','#2F8C74','#4545E6','#B037B0','#4C4C4C','#959595'); var $theme = "default"; - var $themepath = ""; - var $themepath_default = ""; - var $theme_url = ""; - var $theme_default_url = ""; + var $theme_path = ''; + var $theme_default_path = ''; + var $theme_url = ''; + var $theme_default_url = ''; var $baseurl = ""; @@ -114,7 +114,7 @@ var $container_type = "File"; var $client_script_path = ""; - var $client_script_url = ""; // default is calculated from 'client_script_path' + // var $client_script_url = ""; // default is calculated from 'client_script_path' var $server_script_path = ""; var $server_script_url = ""; // default is calculated from 'server_script_path' var $xajaxpath = ""; // default is dirname(__FILE__)."/../lib/xajax_0.2.3"; @@ -136,6 +136,7 @@ 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", "channels", "privmsg", "nickmeta","baseurl"); var $_params_type = array(); + var $_query_string = ''; function pfcGlobalConfig( $params = array() ) { @@ -165,12 +166,17 @@ $this->data_public_path = dirname(__FILE__)."/../data/public"; else $this->data_public_path = $params["data_public_path"]; + + // if the user didn't specify the server_script_url, then remember it and + // append QUERY_STRING to it + if (!isset($params['server_script_url'])) + $this->_query_string = isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != '' ? + '?'.$_SERVER['QUERY_STRING'] : + ''; // load users container or keep default one if (isset($params["container_type"])) - $this->container_type = $params["container_type"]; - - + $this->container_type = $params["container_type"]; // load default container's config $ct =& pfcContainer::Instance($this->container_type, true); @@ -348,54 +354,60 @@ // $this->data_public_path."/xajax_js/xajax.js")); // $this->errors = array_merge($this->errors, @install_file($this->xajaxpath."/xajax_js/xajax_uncompressed.js", // $this->data_public_path."/xajax_js/xajax_uncompressed.js" )); + + + // --- // test client script // try to find the path into server configuration - if ($this->client_script_path == "") + if ($this->client_script_path == '') $this->client_script_path = getScriptFilename(); - $filetotest = $this->client_script_path; - // do not take into account the url parameters - if (preg_match("/(.*)\?(.*)/", $filetotest, $res)) - $filetotest = $res[1]; - if ( !file_exists($filetotest) ) - $this->errors[] = _pfc("%s doesn't exist", $filetotest); - if ($this->client_script_url == "") - $this->client_script_url = "./".basename($filetotest); + + if ($this->server_script_url == '' && $this->server_script_path == '') + { + $filetotest = $this->client_script_path; + // do not take into account the url parameters + if (preg_match("/(.*)\?(.*)/", $filetotest, $res)) + $filetotest = $res[1]; + if ( !file_exists($filetotest) ) + $this->errors[] = _pfc("%s doesn't exist", $filetotest); + $this->server_script_url = './'.basename($filetotest).$this->_query_string; + } + + //if ($this->client_script_url == "") + // $this->client_script_url = "./".basename($filetotest); // calculate datapublic url if ($this->data_public_url == "") $this->data_public_url = relativePath($this->client_script_path, $this->data_public_path); - + if ($this->server_script_path == '') + $this->server_script_path = $this->client_script_path; // --- - // test server script - if ($this->server_script_path == "") + // test server script + if ($this->server_script_url == '') { - $this->server_script_path = $this->client_script_path; - if ($this->server_script_url == "") - $this->server_script_url = $this->client_script_url; + $filetotest = $this->server_script_path; + // do not take into account the url parameters + if (preg_match("/(.*)\?(.*)/",$this->server_script_path, $res)) + $filetotest = $res[1]; + if ( !file_exists($filetotest) ) + $this->errors[] = _pfc("%s doesn't exist", $filetotest); + $this->server_script_url = relativePath($this->client_script_path, $this->server_script_path).'/'.basename($filetotest).$this->_query_string; } - $filetotest = $this->server_script_path; - // do not take into account the url parameters - if (preg_match("/(.*)\?(.*)/",$this->server_script_path, $res)) - $filetotest = $res[1]; - if ( !file_exists($filetotest) ) - $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 = realpath(dirname(__FILE__)."/../themes"); - if ($this->themepath == "" || !is_dir($this->themepath)) - $this->themepath = $this->themepath_default; + + // check if the theme_path parameter are correctly setup + if ($this->theme_default_path == "" || !is_dir($this->theme_default_path)) + $this->theme_default_path = realpath(dirname(__FILE__)."/../themes"); + if ($this->theme_path == "" || !is_dir($this->theme_path)) + $this->theme_path = $this->theme_default_path; // calculate theme url if ($this->theme_default_url == '') - $this->theme_default_url = relativePath($this->client_script_path, $this->themepath_default); + $this->theme_default_url = relativePath($this->client_script_path, $this->theme_default_path); if ($this->theme_url == '') - $this->theme_url = relativePath($this->client_script_path, $this->themepath); + $this->theme_url = relativePath($this->client_script_path, $this->theme_path); // --- @@ -580,44 +592,47 @@ function isDefaultFile($file) { - $fexists1 = file_exists($this->themepath."/default/".$file); - $fexists2 = file_exists($this->themepath."/".$this->theme."/".$file); + $fexists1 = file_exists($this->theme_path."/default/".$file); + $fexists2 = file_exists($this->theme_path."/".$this->theme."/".$file); return ($this->theme == "default" ? $fexists1 : !$fexists2); } /* function getFileUrlByProxy($file, $addprefix = true) { - if (file_exists($this->themepath."/".$this->theme."/".$file)) + if (file_exists($this->theme_path."/".$this->theme."/".$file)) return ($addprefix ? $this->data_public_url."/".$this->getId()."/proxy.php" : "")."?p=".$this->theme."/".$file; else - if (file_exists($this->themepath_default."/default/".$file)) + if (file_exists($this->theme_default_path."/default/".$file)) return ($addprefix ? $this->data_public_url."/".$this->getId()."/proxy.php" : "")."?p=default/".$file; 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)); + die(_pfc("Error: '%s' could not be found, please check your theme_path '%s' and your theme '%s' are correct", $file, $this->theme_path, $this->theme)); } */ function getFilePathFromTheme($file) { - if (file_exists($this->themepath."/".$this->theme."/".$file)) - return $this->themepath."/".$this->theme."/".$file; + if (file_exists($this->theme_path."/".$this->theme."/".$file)) + return $this->theme_path."/".$this->theme."/".$file; else - if (file_exists($this->themepath_default."/default/".$file)) - return $this->themepath_default."/default/".$file; + if (file_exists($this->theme_default_path."/default/".$file)) + return $this->theme_default_path."/default/".$file; 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)); + { + $this->destroyCache(); + die(_pfc("Error: '%s' could not be found, please check your themepath '%s' and your theme '%s' are correct", $file, $this->theme_path, $this->theme)); + } } function getFileUrlFromTheme($file) { - if (file_exists($this->themepath.'/'.$this->theme.'/'.$file)) + if (file_exists($this->theme_path.'/'.$this->theme.'/'.$file)) return $this->theme_url.'/'.$this->theme.'/'.$file; else - if (file_exists($this->themepath_default.'/default/'.$file)) + if (file_exists($this->theme_default_path.'/default/'.$file)) return $this->theme_default_url.'/default/'.$file; else - return 'notfound'; + return 'notfound'; } Modified: trunk/src/phpfreechat.class.php =================================================================== --- trunk/src/phpfreechat.class.php 2007-02-28 17:21:49 UTC (rev 981) +++ trunk/src/phpfreechat.class.php 2007-02-28 17:58:04 UTC (rev 982) @@ -393,7 +393,7 @@ $t->assignObject($c,"c"); if (!$c->isDefaultFile('style.css.php')) { - $t->setTemplate($c->themepath_default.'/default/style.css.php'); + $t->setTemplate($c->theme_default_path.'/default/style.css.php'); $css_code .= $t->getOutput(); } $t->setTemplate($c->getFilePathFromTheme('style.css.php')); Modified: trunk/themes/default/chat.js.tpl.php =================================================================== --- trunk/themes/default/chat.js.tpl.php 2007-02-28 17:21:49 UTC (rev 981) +++ trunk/themes/default/chat.js.tpl.php 2007-02-28 17:58:04 UTC (rev 982) @@ -53,7 +53,7 @@ var pfc_isready = false; var xajaxConfig = { - requestURI: "<?php echo $c->server_script_url.(isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "" ? "?".$_SERVER["QUERY_STRING"] : ""); ?>", + requestURI: "<?php echo $c->server_script_url; ?>", debug: false, statusMessages: false, waitCursor: false, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |