Thread: [Phpfreechat-svn] SF.net SVN: phpfreechat: [511] trunk/src/pfcglobalconfig.class.php
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-05-27 10:30:04
|
Revision: 511 Author: kerphi Date: 2006-05-27 03:29:54 -0700 (Sat, 27 May 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=511&view=rev Log Message: ----------- fix a php warning Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-05-27 10:29:24 UTC (rev 510) +++ trunk/src/pfcglobalconfig.class.php 2006-05-27 10:29:54 UTC (rev 511) @@ -136,7 +136,7 @@ $this->synchronizeWithCache(); // the nickname is not global, it must not be cached - $this->nick = $params["nick"]; + if (isset($params["nick"])) $this->nick = $params["nick"]; } function &Instance( $params = array() ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-07 20:14:47
|
Revision: 550 Author: kerphi Date: 2006-06-06 09:17:15 -0700 (Tue, 06 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=550&view=rev Log Message: ----------- Bug fix: the cache directory path was hardcoded Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-06-05 14:33:24 UTC (rev 549) +++ trunk/src/pfcglobalconfig.class.php 2006-06-06 16:17:15 UTC (rev 550) @@ -209,7 +209,7 @@ $this->errors = array_merge($this->errors, @test_writable_dir($this->data_public_path, "data_public_path")); $this->errors = array_merge($this->errors, @test_writable_dir($this->data_private_path, "data_private_path")); $this->errors = array_merge($this->errors, @install_dir($this->jspath, $this->data_public_path."/javascript")); - $this->errors = array_merge($this->errors, @test_writable_dir(dirname(__FILE__)."/../data/private/cache", "data_public_path/cache")); + $this->errors = array_merge($this->errors, @test_writable_dir($this->data_private_path."/cache", "data_private_path/cache")); // --- // test xajax lib existance @@ -387,7 +387,7 @@ */ function synchronizeWithCache($destroy = false) { - $cachefile = dirname(__FILE__)."/../data/private/cache/pfcglobalconfig_".$this->getId(); + $cachefile = $this->data_private_path."/cache/pfcglobalconfig_".$this->getId(); // destroy the cache if init parameter is present into the url if (isset($_GET["init"]) || $destroy) @unlink($cachefile); @@ -416,7 +416,7 @@ } function saveInCache() { - $cachefile = dirname(__FILE__)."/../data/private/cache/pfcglobalconfig_".$this->getId(); + $cachefile = $this->data_private_path."/cache/pfcglobalconfig_".$this->getId(); file_put_contents($cachefile, serialize(get_object_vars($this))); if ($this->debug) pxlog("pfcGlobalConfig::saveInCache()", "chatconfig", $this->getId()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-17 09:54:13
|
Revision: 611 Author: kerphi Date: 2006-06-17 02:54:09 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=611&view=rev Log Message: ----------- 'nick' and 'isadmin' parameter are dynamic, don't reassign it in the synchronizeWithCache function Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-06-17 08:01:09 UTC (rev 610) +++ trunk/src/pfcglobalconfig.class.php 2006-06-17 09:54:09 UTC (rev 611) @@ -38,7 +38,7 @@ // these parameters are static (cached) var $proxys = array("auth", "noflood"); - var $proxys_cfg = array("auth" => array(), + var $proxys_cfg = array("auth" => array(), "noflood" => array("limit"=>10,"delay"=>5)); var $title = ""; // default is _pfc("My Chat") var $channels = array(); // the default joined channels when opening the chat @@ -127,11 +127,6 @@ if ($this->data_public_path == "") $this->data_public_path = dirname(__FILE__)."/../data/public"; $this->synchronizeWithCache(); - - // the 'nick' is dynamic, it must not be cached - if (isset($params["nick"])) $this->nick = $params["nick"]; - // the 'isadmin' flag is dynamic, it must not be cached - if (isset($params["isadmin"])) $this->isadmin = $params["isadmin"]; } function &Instance( $params = array() ) @@ -399,7 +394,13 @@ $pfc_configvar = unserialize(file_get_contents($cachefile)); foreach($pfc_configvar as $key => $val) - $this->$key = $val; + { + // the 'nick' and 'isadmin' are dynamic parameters, it must not be cached + if ($key != "nick" && + $key != "isadmin") + $this->$key = $val; + } + return true; // synchronized } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-17 10:19:56
|
Revision: 612 Author: kerphi Date: 2006-06-17 03:19:50 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=612&view=rev Log Message: ----------- Bug fix: the global config was not correctly checked since the cache lock file addition. Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-06-17 09:54:09 UTC (rev 611) +++ trunk/src/pfcglobalconfig.class.php 2006-06-17 10:19:50 UTC (rev 612) @@ -386,7 +386,7 @@ { $cachefile = $this->_getCacheFile(); $cachefile_lock = $cachefile."_lock"; - + if (file_exists($cachefile)) { // if a cache file exists, remove the lock file because config has been succesfully stored @@ -406,7 +406,14 @@ else { if (file_exists($cachefile_lock)) - return false; // do nothing if the lock file exists + { + // delete too old lockfiles (more than 15 seconds) + $locktime = filemtime($cachefile_lock); + if ($locktime+15 < time()) + unlink($cachefile_lock); + else + return false; // do nothing if the lock file exists + } else @touch($cachefile_lock); // create the lockfile @@ -415,6 +422,7 @@ $errors =& $this->getErrors(); if (count($errors) > 0) { + @unlink($cachefile_lock); // destroy the lock file for the next attempt echo "<ul>"; foreach( $errors as $e ) echo "<li>".$e."</li>"; echo "</ul>"; exit; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-17 10:54:21
|
Revision: 613 Author: kerphi Date: 2006-06-17 03:54:12 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=613&view=rev Log Message: ----------- Be sure the copy_r and rm_r function works Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-06-17 10:19:50 UTC (rev 612) +++ trunk/src/pfcglobalconfig.class.php 2006-06-17 10:54:12 UTC (rev 613) @@ -198,6 +198,43 @@ $this->errors = array_merge($this->errors, @test_writable_dir($this->data_private_path, "data_private_path")); $this->errors = array_merge($this->errors, @install_dir($this->jspath, $this->data_public_path."/javascript")); $this->errors = array_merge($this->errors, @test_writable_dir($this->data_private_path."/cache", "data_private_path/cache")); + + // check the copyr and rm_r function works + if (count($this->errors) == 0) + { + $copyr_ok = true; + $dir1 = $this->data_private_path."/copyr1"; + $file1 = $dir1."/dummy"; + $dir2 = $this->data_private_path."/copyr2"; + $file2 = $dir2."/dummy"; + // create a dummy directory + mkdir($dir1); + // check the directory exists + if (!file_exists($dir1) || !is_dir($dir1)) $copyr_ok = false; + // create a dummy file + touch($file1); + // check the file exists + if (!file_exists($file1)) $copyr_ok = false; + // copyr the dummy dir + copyr($dir1,$dir2); + // check the directory exists + if (!file_exists($dir2) || !is_dir($dir2)) $copyr_ok = false; + // check the file exists + if (!file_exists($file2)) $copyr_ok = false; + if (!$copyr_ok) + $this->errors[] = _pfc("Recursive copy doesn't works"); + + // try to remove recursively the directory + $rm_r_ok = true; + rm_r($dir2); + rm_r($dir1); + // check the directory doesn't exists + if (file_exists($dir1) || file_exists($dir2)) $rm_r_ok = false; + // check the file doesn't exists + if (file_exists($file1) || file_exists($file2)) $rm_r_ok = false; + if (!$copyr_ok) + $this->errors[] = _pfc("Recursive remove doesn't works"); + } // --- // test xajax lib existance This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-17 18:36:55
|
Revision: 619 Author: kerphi Date: 2006-06-17 11:36:48 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=619&view=rev Log Message: ----------- remove the 'width' error Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-06-17 18:33:29 UTC (rev 618) +++ trunk/src/pfcglobalconfig.class.php 2006-06-17 18:36:48 UTC (rev 619) @@ -337,15 +337,6 @@ $lg_list = pfcI18N::GetAcceptedLanguage(); if ( $this->language != "" && !in_array($this->language, $lg_list) ) $this->errors[] = _pfc("'%s' parameter is not valid. Available values are : '%s'", "language", implode(", ", $lg_list)); - - // check the width parameter is not used - // because of a display bug in IE - if ( $this->width != "" && - $this->width != "auto" ) - { - $this->errors[] = "Do not uses 'width' parameter because of a display bug in IE6, please look at this workaround : http://www.phpfreechat.net/forum/viewtopic.php?pid=867#p867"; - $ok = false; - } // load smileys from file $this->loadSmileyTheme(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-06-25 20:32:03
|
Revision: 626 Author: kerphi Date: 2006-06-25 13:31:55 -0700 (Sun, 25 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=626&view=rev Log Message: ----------- check if the 'channels' parameter value is really an array of strings Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-06-24 20:09:32 UTC (rev 625) +++ trunk/src/pfcglobalconfig.class.php 2006-06-25 20:31:55 UTC (rev 626) @@ -175,7 +175,7 @@ if ($this->xajaxpath == "") $this->xajaxpath = dirname(__FILE__)."/../lib/xajax_0.2.3"; if ($this->jspath == "") $this->jspath = dirname(__FILE__)."/../lib/javascript"; if ($this->csstidypath == "") $this->csstidypath = dirname(__FILE__)."/../lib/csstidy-1.1"; - if (count($this->channels) == 0) $this->channels = array(_pfc("My room")); + if (is_array($this->channels) && count($this->channels) == 0) $this->channels = array(_pfc("My room")); // first of all, check the used functions $f_list["file_get_contents"] = _pfc("You need %s", "PHP 4 >= 4.3.0 or PHP 5"); @@ -313,7 +313,17 @@ // check the serverid is really defined if ($this->serverid == "") $this->errors[] = _pfc("'%s' parameter is mandatory by default use '%s' value", "serverid", "md5(__FILE__)"); - + + // check if channels parameter is a strings array + if (!is_array($this->channels)) + $this->errors[] = _pfc("'%s' parameter must be an array", "channels"); + else + foreach($this->channels as $chan) + { + if (!is_string($chan)) + $this->errors[] = _pfc("'%s' value must be a string", serialize($chan)); + } + // check the max_msg is >= 0 if (!is_numeric($this->max_msg) || $this->max_msg < 0) $this->errors[] = _pfc("'%s' parameter must be a positive number", "max_msg"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-07-03 16:43:51
|
Revision: 640 Author: kerphi Date: 2006-07-03 09:43:41 -0700 (Mon, 03 Jul 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=640&view=rev Log Message: ----------- Optimization: don't initialize parameters when the cache file exists. Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-07-03 15:10:54 UTC (rev 639) +++ trunk/src/pfcglobalconfig.class.php 2006-07-03 16:43:41 UTC (rev 640) @@ -103,31 +103,45 @@ // setup the local for translated messages pfcI18N::Init(isset($params["language"]) ? $params["language"] : ""); - // load users container or keep default one - if (isset($params["container_type"])) - $this->container_type = $params["container_type"]; - - // load default container's config - $container =& $this->getContainerInstance(); - $container_cfg = $container->getDefaultConfig(); - foreach( $container_cfg as $k => $v ) + // check if a cached configuration allready exists + // don't load parameters if the cache exists + $cachefile = $this->_getCacheFile(); + if (!file_exists($cachefile)) { - $attr = "container_cfg_".$k; - if (!isset($this->$attr)) - $this->$attr = $v; - } + // load users container or keep default one + if (isset($params["container_type"])) + $this->container_type = $params["container_type"]; + + // load default container's config + $container =& $this->getContainerInstance(); + $container_cfg = $container->getDefaultConfig(); + foreach( $container_cfg as $k => $v ) + { + $attr = "container_cfg_".$k; + if (!isset($this->$attr)) + $this->$attr = $v; + } + + // load all user's parameters which will override default ones + foreach ( $params as $k => $v ) + { + if (!isset($this->$k)) + $this->errors[] = _pfc("Error: undefined or obsolete parameter '%s', please correct or remove this parameter", $k); + if ($k == "proxys_cfg") + { + // don't replace all the proxy_cfg parameters, just replace the specified ones + foreach ( $params["proxys_cfg"] as $k2 => $v2 ) + $this->proxys_cfg[$k2] = $v2; + } + else + $this->$k = $v; + } - // load all user's parameters which will override default ones - foreach ( $params as $k => $v ) - { - if (!isset($this->$k)) - $this->errors[] = _pfc("Error: undefined or obsolete parameter '%s', please correct or remove this parameter", $k); - $this->$k = $v; + if ($this->data_private_path == "") $this->data_private_path = dirname(__FILE__)."/../data/private"; + if ($this->data_public_path == "") $this->data_public_path = dirname(__FILE__)."/../data/public"; } - if ($this->data_private_path == "") $this->data_private_path = dirname(__FILE__)."/../data/private"; - if ($this->data_public_path == "") $this->data_public_path = dirname(__FILE__)."/../data/public"; - + // now load or save the configuration in the cache $this->synchronizeWithCache(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-07-12 11:50:59
|
Revision: 653 Author: kerphi Date: 2006-07-12 04:50:50 -0700 (Wed, 12 Jul 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=653&view=rev Log Message: ----------- Bug fix: the 'admins' parameter in now dynamic Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-07-07 11:45:12 UTC (rev 652) +++ trunk/src/pfcglobalconfig.class.php 2006-07-12 11:50:50 UTC (rev 653) @@ -340,6 +340,11 @@ // load debug url $this->debugurl = relativePath($this->client_script_path, dirname(__FILE__)."/../debug"); + + // check the frozen_nick parameter is used with a none empty nickname + if ($this->frozen_nick && $this->nick == "") + $this->errors[] = _pfc("frozen_nick can't be used with a empty nick"); + // check if channels parameter is a strings array if (!is_array($this->channels)) $this->errors[] = _pfc("'%s' parameter must be an array", "channels"); @@ -459,13 +464,12 @@ // if a cache file exists, remove the lock file because config has been succesfully stored if (file_exists($cachefile_lock)) @unlink($cachefile_lock); + $dyn_params = array("nick","isadmin","islocked","admins"); $pfc_configvar = unserialize(file_get_contents($cachefile)); foreach($pfc_configvar as $key => $val) { - // the 'nick', 'isadmin', and 'islocked' are dynamic parameters, it must not be cached - if ($key != "nick" && - $key != "isadmin" && - $key != "islocked" ) + // the dynamics parameters must not be cached + if (!in_array($key,$dyn_params)) $this->$key = $val; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-07-12 12:16:47
|
Revision: 654 Author: kerphi Date: 2006-07-12 05:16:41 -0700 (Wed, 12 Jul 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=654&view=rev Log Message: ----------- Bug fix: the 'nick' parameter was broken Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-07-12 11:50:50 UTC (rev 653) +++ trunk/src/pfcglobalconfig.class.php 2006-07-12 12:16:41 UTC (rev 654) @@ -100,6 +100,7 @@ var $debugurl = ""; var $debug = false; var $debugxajax = false; + var $dyn_params = array("nick","isadmin","islocked","admins"); function pfcGlobalConfig( $params = array() ) { @@ -156,6 +157,10 @@ } } + // load dynamic parameter even if the config exists in the cache + foreach ( $this->dyn_params as $dp ) + $this->$dp = $params[$dp]; + // now load or save the configuration in the cache $this->synchronizeWithCache(); } @@ -464,12 +469,11 @@ // if a cache file exists, remove the lock file because config has been succesfully stored if (file_exists($cachefile_lock)) @unlink($cachefile_lock); - $dyn_params = array("nick","isadmin","islocked","admins"); $pfc_configvar = unserialize(file_get_contents($cachefile)); foreach($pfc_configvar as $key => $val) { // the dynamics parameters must not be cached - if (!in_array($key,$dyn_params)) + if (!in_array($key,$this->dyn_params)) $this->$key = $val; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-08-01 18:04:04
|
Revision: 661 Author: kerphi Date: 2006-08-01 11:03:47 -0700 (Tue, 01 Aug 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=661&view=rev Log Message: ----------- small doc update Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-08-01 18:01:18 UTC (rev 660) +++ trunk/src/pfcglobalconfig.class.php 2006-08-01 18:03:47 UTC (rev 661) @@ -60,7 +60,7 @@ var $start_minimized = false; var $height = "440px"; var $width = ""; - var $shownotice = 3; // show: 0 = nothing, 1 = just nickname changes, 2 = connect/quit, 3 = 1+2 + var $shownotice = 3; // show: 0 = nothing, 1 = just nickname changes, 2 = join/quit, 3 = 1+2 var $nickmarker = true; // show/hide nicknames colors var $clock = true; // show/hide dates and hours var $openlinknewwindow = true; // used to open the links in a new window This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-08-18 21:58:47
|
Revision: 681 Author: kerphi Date: 2006-08-18 14:58:42 -0700 (Fri, 18 Aug 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=681&view=rev Log Message: ----------- Try to set quit_on_closedwindow parameter to true by default. This could be annoying because on each page reload or on each page close a notice will be generated (but can be disabled with shownotice parameter). Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-08-18 21:44:47 UTC (rev 680) +++ trunk/src/pfcglobalconfig.class.php 2006-08-18 21:58:42 UTC (rev 681) @@ -54,7 +54,7 @@ var $refresh_delay = 5000; // in mili-seconds (5 seconds) var $timeout = 20000; // in mili-seconds (20 seconds) var $max_msg = 20; - var $quit_on_closedwindow = false; // false because a reload event is the same as a close event + var $quit_on_closedwindow = true; // could be annoying because the reload event is the same as a close event var $focus_on_connect = true; var $connect_at_startup = true; var $start_minimized = false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-04 19:46:37
|
Revision: 732 http://svn.sourceforge.net/phpfreechat/?rev=732&view=rev Author: kerphi Date: 2006-09-04 12:46:27 -0700 (Mon, 04 Sep 2006) Log Message: ----------- Check all parameters types at init step Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-09-03 17:28:36 UTC (rev 731) +++ trunk/src/pfcglobalconfig.class.php 2006-09-04 19:46:27 UTC (rev 732) @@ -101,10 +101,16 @@ var $debugurl = ""; var $debug = false; var $debugxajax = false; - var $dyn_params = array("nick","isadmin","islocked","admins"); + + // private parameters + var $_dyn_params = array("nick","isadmin","islocked","admins"); + var $_params_type = array(); function pfcGlobalConfig( $params = array() ) { + // first of all, save our current state in order to be able to check for variable types later + $this->_saveParamsTypes(); + // setup the local for translated messages pfcI18N::Init(isset($params["language"]) ? $params["language"] : ""); @@ -163,7 +169,7 @@ } // load dynamic parameter even if the config exists in the cache - foreach ( $this->dyn_params as $dp ) + foreach ( $this->_dyn_params as $dp ) if (isset($params[$dp])) $this->$dp = $params[$dp]; @@ -203,6 +209,22 @@ } /** + * This function saves all the parameters types in order to check later if the types are ok + */ + function _saveParamsTypes() + { + $vars = get_object_vars($this); + foreach($vars as $k => $v) + { + if (is_string($v)) $this->_params_type["string"][] = $k; + else if (is_bool($v)) $this->_params_type["bool"][] = $k; + else if (is_array($v)) $this->_params_type["array"][] = $k; + else if (is_int($v) && $v>=0) $this->_params_type["positivenumeric"][] = $k; + else $this->_params_type["misc"][] = $k; + } + } + + /** * Initialize the phpfreechat configuration * this initialisation is done once at startup then it is stored into a session cache */ @@ -211,6 +233,32 @@ $ok = true; if ($this->debug) pxlog("pfcGlobalConfig::init()", "chatconfig", $this->getId()); + + // check the parameters types + $array_params = $this->_params_type["array"]; + foreach( $array_params as $ap ) + { + if (!is_array($this->$ap)) + $this->errors[] = _pfc("'%s' parameter must be an array", $ap); + } + $numerical_positive_params = $this->_params_type["positivenumeric"]; + foreach( $numerical_positive_params as $npp ) + { + if (!is_int($this->$npp) || $this->$npp < 0) + $this->errors[] = _pfc("'%s' parameter must be a positive number", $npp); + } + $boolean_params = $this->_params_type["bool"]; + foreach( $boolean_params as $bp ) + { + if (!is_bool($this->$bp)) + $this->errors[] = _pfc("'%s' parameter must be a boolean", $bp); + } + $string_params = $this->_params_type["string"]; + foreach( $string_params as $sp ) + { + if (!is_string($this->$sp)) + $this->errors[] = _pfc("'%s' parameter must be a charatere string", $sp); + } if ($this->title == "") $this->title = _pfc("My Chat"); if ($this->xajaxpath == "") $this->xajaxpath = dirname(__FILE__)."/../lib/xajax_0.2.3"; @@ -354,37 +402,7 @@ // check the frozen_nick parameter is used with a none empty nickname if ($this->frozen_nick && $this->nick == "") $this->errors[] = _pfc("frozen_nick can't be used with a empty nick"); - - // check if channels parameter is a strings array - if (!is_array($this->channels)) - $this->errors[] = _pfc("'%s' parameter must be an array", "channels"); - else - foreach($this->channels as $chan) - { - if (!is_string($chan)) - $this->errors[] = _pfc("'%s' value must be a string", serialize($chan)); - } - - // check the max_msg is >= 0 - if (!is_numeric($this->max_msg) || $this->max_msg < 0) - $this->errors[] = _pfc("'%s' parameter must be a positive number", "max_msg"); - - // check the max_nick_len is >= 0 - if (!is_numeric($this->max_nick_len) || $this->max_nick_len < 0) - $this->errors[] = _pfc("'%s' parameter must be a positive number", "max_nick_len"); - // check the max_text_len is >= 0 - if (!is_numeric($this->max_text_len) || $this->max_text_len < 0) - $this->errors[] = _pfc("'%s' parameter must be a positive number", "max_text_len"); - - // check the refresh_delay is >= 0 - if (!is_numeric($this->refresh_delay) || $this->refresh_delay < 0) - $this->errors[] = _pfc("'%s' parameter must be a positive number", "refresh_delay"); - - // check the timeout is >= 0 - if (!is_numeric($this->timeout) || $this->timeout < 0) - $this->errors[] = _pfc("'%s' parameter must be a positive number", "timeout"); - // check the language is known $lg_list = pfcI18N::GetAcceptedLanguage(); if ( $this->language != "" && !in_array($this->language, $lg_list) ) @@ -507,7 +525,7 @@ foreach($pfc_configvar as $key => $val) { // the dynamics parameters must not be cached - if (!in_array($key,$this->dyn_params)) + if (!in_array($key,$this->_dyn_params)) $this->$key = $val; } @@ -533,7 +551,7 @@ if (count($errors) > 0) { @unlink($cachefile_lock); // destroy the lock file for the next attempt - echo "<ul>"; foreach( $errors as $e ) echo "<li>".$e."</li>"; echo "</ul>"; + echo "<p>"._pfc("Please correct these errors").":</p><ul>"; foreach( $errors as $e ) echo "<li>".$e."</li>"; echo "</ul>"; exit; } // save the validated config in cache @@ -589,4 +607,4 @@ } } -?> +?> \ 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-13 07:09:20
|
Revision: 759 http://svn.sourceforge.net/phpfreechat/?rev=759&view=rev Author: kerphi Date: 2006-09-13 00:09:16 -0700 (Wed, 13 Sep 2006) Log Message: ----------- [en] Remove the rm_r and copy_r verification because since refactoring I do not copy full directories anymore. [fr] Retire le teste de fonctionnement de rm_r et copy_r car depuis le refactoring, je ne copie plus de repertoires entiers. Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-09-12 16:53:44 UTC (rev 758) +++ trunk/src/pfcglobalconfig.class.php 2006-09-13 07:09:16 UTC (rev 759) @@ -288,43 +288,6 @@ $this->errors = array_merge($this->errors, @test_writable_dir($this->data_private_path, "data_private_path")); // $this->errors = array_merge($this->errors, @install_dir($this->jspath, $this->data_public_path."/javascript")); $this->errors = array_merge($this->errors, @test_writable_dir($this->data_private_path."/cache", "data_private_path/cache")); - - // check the copy_r and rm_r function works - if (count($this->errors) == 0) - { - $copy_r_ok = true; - $dir1 = $this->data_private_path."/copy_r1"; - $file1 = $dir1."/dummy"; - $dir2 = $this->data_private_path."/copy_r2"; - $file2 = $dir2."/dummy"; - // create a dummy directory - @mkdir($dir1); - // check the directory exists - if (!file_exists($dir1) || !is_dir($dir1)) $copy_r_ok = false; - // create a dummy file - @touch($file1); - // check the file exists - if (!file_exists($file1)) $copy_r_ok = false; - // copy_r the dummy dir - @copy_r($dir1,$dir2); - // check the directory exists - if (!file_exists($dir2) || !is_dir($dir2)) $copy_r_ok = false; - // check the file exists - if (!file_exists($file2)) $copy_r_ok = false; - if (!$copy_r_ok) - $this->errors[] = _pfc("Recursive copy doesn't works"); - - // try to remove recursively the directory - $rm_r_ok = true; - @rm_r($dir2); - @rm_r($dir1); - // check the directory doesn't exists - if (file_exists($dir1) || file_exists($dir2)) $rm_r_ok = false; - // check the file doesn't exists - if (file_exists($file1) || file_exists($file2)) $rm_r_ok = false; - if (!$copy_r_ok) - $this->errors[] = _pfc("Recursive remove doesn't works"); - } // --- // test xajax lib existance This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-09-15 18:13:26
|
Revision: 763 http://svn.sourceforge.net/phpfreechat/?rev=763&view=rev Author: kerphi Date: 2006-09-15 11:13:17 -0700 (Fri, 15 Sep 2006) Log Message: ----------- [en] Make frozen_channels a dynamic parameter. So it's a way to allow/forbid channels depending on external users rights. [fr] Retire le parametre frozen_channels du cache. Il est ainsi possible d'autoriser ou pas de rejoindre des salons en fonction de parametres externes. Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-09-13 21:28:09 UTC (rev 762) +++ trunk/src/pfcglobalconfig.class.php 2006-09-15 18:13:17 UTC (rev 763) @@ -104,7 +104,7 @@ var $debugxajax = false; // private parameters - var $_dyn_params = array("nick","isadmin","islocked","admins"); + var $_dyn_params = array("nick","isadmin","islocked","admins","frozen_channels"); var $_params_type = array(); function pfcGlobalConfig( $params = array() ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-10-24 16:14:52
|
Revision: 841 http://svn.sourceforge.net/phpfreechat/?rev=841&view=rev Author: kerphi Date: 2006-10-24 09:14:45 -0700 (Tue, 24 Oct 2006) Log Message: ----------- [en] Bug fix: the 'proxies_cfg' parameter array was badly initialized. [15min] [fr] Bug fix : le tableau de param?\195?\168tre 'proxies_cfg' ?\195?\169tait mal initialis?\195?\169. [15min] Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-10-23 20:03:27 UTC (rev 840) +++ trunk/src/pfcglobalconfig.class.php 2006-10-24 16:14:45 UTC (rev 841) @@ -178,7 +178,13 @@ { // don't replace all the proxy_cfg parameters, just replace the specified ones foreach ( $params["proxies_cfg"] as $k2 => $v2 ) - $this->proxies_cfg[$k2] = $v2; + { + if (is_array($v2)) + foreach( $v2 as $k3 => $v3) + $this->proxies_cfg[$k2][$k3] = $v3; + else + $this->proxies_cfg[$k2] = $v2; + } } else $this->$k = $v; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-10-29 11:20:59
|
Revision: 850 http://svn.sourceforge.net/phpfreechat/?rev=850&view=rev Author: kerphi Date: 2006-10-29 03:20:55 -0800 (Sun, 29 Oct 2006) Log Message: ----------- Bug fix : fix an intilite loop when 'frozen_nick' is true and 'nick' length is > 'max_nick_len' Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-10-29 10:42:05 UTC (rev 849) +++ trunk/src/pfcglobalconfig.class.php 2006-10-29 11:20:55 UTC (rev 850) @@ -204,6 +204,11 @@ // now load or save the configuration in the cache $this->synchronizeWithCache(); + + // This is a dirty workaround which fix a infinite loop when: + // 'frozen_nick' is true + // 'nick' length is > 'max_nick_len' + $this->nick = $this->filterNickname($this->nick); } function &Instance( $params = array() ) @@ -596,6 +601,14 @@ 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)); } + + function filterNickname($nickname) + { + $nickname = trim($nickname); + require_once dirname(__FILE__)."/../lib/utf8/utf8_substr.php"; + $nickname = utf8_substr($nickname, 0, $this->max_nick_len); + return $nickname; + } } ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-10-29 14:41:29
|
Revision: 851 http://svn.sourceforge.net/phpfreechat/?rev=851&view=rev Author: kerphi Date: 2006-10-29 06:34:37 -0800 (Sun, 29 Oct 2006) Log Message: ----------- fix a problem with empty nicknames (the nickname was initiated with 'false' string) Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-10-29 11:20:55 UTC (rev 850) +++ trunk/src/pfcglobalconfig.class.php 2006-10-29 14:34:37 UTC (rev 851) @@ -606,7 +606,7 @@ { $nickname = trim($nickname); require_once dirname(__FILE__)."/../lib/utf8/utf8_substr.php"; - $nickname = utf8_substr($nickname, 0, $this->max_nick_len); + $nickname = (string)utf8_substr($nickname, 0, $this->max_nick_len); return $nickname; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-01-05 22:34:20
|
Revision: 922 http://svn.sourceforge.net/phpfreechat/?rev=922&view=rev Author: kerphi Date: 2007-01-05 14:34:20 -0800 (Fri, 05 Jan 2007) Log Message: ----------- remove data_public_path writable check Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2007-01-05 22:26:55 UTC (rev 921) +++ trunk/src/pfcglobalconfig.class.php 2007-01-05 22:34:20 UTC (rev 922) @@ -337,7 +337,7 @@ $f_list["get_object_vars"] = _pfc("You need %s", "PHP 4 or PHP 5"); $this->errors = array_merge($this->errors, check_functions_exist($f_list)); - $this->errors = array_merge($this->errors, @test_writable_dir($this->data_public_path, "data_public_path")); + // $this->errors = array_merge($this->errors, @test_writable_dir($this->data_public_path, "data_public_path")); $this->errors = array_merge($this->errors, @test_writable_dir($this->data_private_path, "data_private_path")); // $this->errors = array_merge($this->errors, @install_dir($this->jspath, $this->data_public_path."/javascript")); $this->errors = array_merge($this->errors, @test_writable_dir($this->data_private_path."/cache", "data_private_path/cache")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-01-12 16:29:24
|
Revision: 927 http://svn.sourceforge.net/phpfreechat/?rev=927&view=rev Author: kerphi Date: 2007-01-12 08:29:19 -0800 (Fri, 12 Jan 2007) Log Message: ----------- bug fix : the data_public_path javascript content was not correctly copied when the data_public_path parameter was not the default. [1h] Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2007-01-06 12:45:49 UTC (rev 926) +++ trunk/src/pfcglobalconfig.class.php 2007-01-12 16:29:19 UTC (rev 927) @@ -339,9 +339,27 @@ // $this->errors = array_merge($this->errors, @test_writable_dir($this->data_public_path, "data_public_path")); $this->errors = array_merge($this->errors, @test_writable_dir($this->data_private_path, "data_private_path")); - // $this->errors = array_merge($this->errors, @install_dir($this->jspath, $this->data_public_path."/javascript")); $this->errors = array_merge($this->errors, @test_writable_dir($this->data_private_path."/cache", "data_private_path/cache")); + + // install the public directory content + $dir = dirname(__FILE__)."/../data/public/js"; + $dh = opendir($dir); + while (false !== ($file = readdir($dh))) + { + $f_src = $dir.'/'.$file; + $f_dst = $this->data_public_path.'/js/'.$file; + if ($file == "." || $file == ".." || !is_file($f_src)) continue; // skip . and .. generic files + // install js files only if the destination doesn't exists or if the destination timestamp is older than the source timestamp + if (!file_exists($f_dst) || filemtime($f_dst) < filemtime($f_src) ) + { + mkdir_r($this->data_public_path.'/js/'); + copy( $f_src, $f_dst ); + } + if (!file_exists($f_dst)) $this->errors[] = _pfc("%s doesn't exist, data_public_path cannot be installed", $f_dst); + } + closedir($dh); + // --- // test xajax lib existance $dir = $this->xajaxpath; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-03-11 13:45:34
|
Revision: 997 http://svn.sourceforge.net/phpfreechat/?rev=997&view=rev Author: kerphi Date: 2007-03-11 06:45:33 -0700 (Sun, 11 Mar 2007) Log Message: ----------- fix a problem with dynamic parameters Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2007-03-11 12:41:53 UTC (rev 996) +++ trunk/src/pfcglobalconfig.class.php 2007-03-11 13:45:33 UTC (rev 997) @@ -549,18 +549,10 @@ include $cachefile; foreach($pfc_conf as $key => $val) - $this->$key = $val; - - /* - $pfc_configvar = unserialize(file_get_contents($cachefile)); - foreach($pfc_configvar as $key => $val) - { // the dynamics parameters must not be cached if (!in_array($key,$this->_dyn_params)) $this->$key = $val; - } - */ - + return true; // synchronized } else @@ -668,4 +660,4 @@ } } -?> \ 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...> - 2007-04-18 13:59:37
|
Revision: 1019 http://svn.sourceforge.net/phpfreechat/?rev=1019&view=rev Author: kerphi Date: 2007-04-18 06:59:38 -0700 (Wed, 18 Apr 2007) Log Message: ----------- [en] Bug fix: themes resources (images/sound) were hidden if pfc sources were located in a private (for the web browsers) path. [1h45] [fr] Bug fix : les ressources des th?\195?\168mes (images et son) ne s'affichaient pas lorsque le code source de pfc ?\195?\169tait plac?\195?\169 dans un chemin priv?\195?\169 (non accessible par les navigateurs web). [1h45] Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2007-04-18 12:17:25 UTC (rev 1018) +++ trunk/src/pfcglobalconfig.class.php 2007-04-18 13:59:38 UTC (rev 1019) @@ -405,18 +405,35 @@ $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; } - + + // If the user didn't give any theme_default_url value, + // copy the default theme resources in a public directory + if ($this->theme_default_url == '') + { + mkdir_r($this->data_public_path.'/themes/default'); + if (!is_dir($this->data_public_path.'/themes/default')) + $this->errors[] = _pfc("cannot create %s", $this->data_public_path.'/themes/default'); + else + { + $ret = copy_r( dirname(__FILE__).'/../themes/default', + $this->data_public_path.'/themes/default' ); + if (!$ret) + $this->errors[] = _pfc("cannot copy %s in %s", + dirname(__FILE__).'/../themes/default', + $this->data_public_path.'/themes/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)) + if ($this->theme_default_path == '' || !is_dir($this->theme_default_path)) + $this->theme_default_path = 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->theme_default_path); + $this->theme_default_url = $this->data_public_url.'/themes'; if ($this->theme_url == '') - $this->theme_url = relativePath($this->client_script_path, $this->theme_path); - + $this->theme_url = $this->theme_default_url; // --- // run specific container initialisation This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-06-30 19:21:07
|
Revision: 1041 http://svn.sourceforge.net/phpfreechat/?rev=1041&view=rev Author: kerphi Date: 2007-06-30 12:21:04 -0700 (Sat, 30 Jun 2007) Log Message: ----------- cleaning Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2007-06-30 17:34:36 UTC (rev 1040) +++ trunk/src/pfcglobalconfig.class.php 2007-06-30 19:21:04 UTC (rev 1041) @@ -121,8 +121,6 @@ var $theme_default_path = ''; var $theme_url = ''; var $theme_default_url = ''; - - var $baseurl = ""; var $language = ""; // could be something in i18n/* directory ("" means the language is guess from the server config) var $output_encoding = "UTF-8"; // could be ISO-8859-1 or anything else (which must be supported by iconv php module) @@ -173,7 +171,7 @@ // private parameters var $_sys_proxies = array("lock", "checktimeout", "checknickchange", "auth", "noflood", "censor", "log"); - var $_dyn_params = array("nick","isadmin","islocked","admins","frozen_channels", "channels", "privmsg", "nickmeta","baseurl","time_offset","date_format","time_format"); + var $_dyn_params = array("nick","isadmin","islocked","admins","frozen_channels", "channels", "privmsg", "nickmeta","time_offset","date_format","time_format"); var $_params_type = array(); var $_query_string = ''; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-08-28 21:15:43
|
Revision: 1153 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1153&view=rev Author: kerphi Date: 2007-08-28 14:15:39 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Add some documentation for the parameters list Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2007-08-28 00:36:27 UTC (rev 1152) +++ trunk/src/pfcglobalconfig.class.php 2007-08-28 21:15:39 UTC (rev 1153) @@ -31,13 +31,74 @@ */ class pfcGlobalConfig { - var $serverid = ""; // this is the chat server id (comparable to the server host in IRC) + /** + * <p>This is the only mandatory parameter used to identify the chat server. + * You can compare it to the server ip/host like on an IRC server. + * If you don't know what to write, just try : <code>$params["serverid"] = md5(__FILE__);</code></p> + */ + var $serverid = ''; - // these parameters are dynamic (not cached) - var $nick = ""; // the initial nickname ("" means the user will be queried) + /** + * <p>Used to change the chat title that is visible just above the messages list. + * ("My Chat" by default)</p> + */ + var $title = ''; + + /** + * <p>If you have already identified the user (forum, portal...) you can force the user's nickname with this parameter. + * Defining a nick will skip the "Please enter your nickname" popup.</p> + * <p>Warning : Nicknames must be encoded in UTF-8. + * For example, if you get nicks from a databases where they are ISO-8859-1 encoded, + * you must convert it: <code>$params["nick"] = iconv("ISO-8859-1", "UTF-8", $bdd_nickname);</code> + * (of course, change the <code>$bdd_nickname</code> parameter for your needs)</p> + * <p>("" value by default, means users must choose a nickname when s/he connects)</p> + */ + var $nick = ""; + + /** + * <p>This is the maximum nickname length, a longer nickname is forbidden. + * ( 15 caracteres by default)</p> + */ + var $max_nick_len = 15; + + /** + * <p>Setting this to true will forbid the user to change his/her nickname later. + * (false value by default)</p> + */ + var $frozen_nick = false; + var $nickmeta = array(); // this is the nickname user's metadata, you can add : sexe, age, real name ... (ex: array('sexe'=>'f') ) var $nickmeta_private = array('ip'); // this is the meta that only admins can see + + /** + * <p>Used to create default rooms (auto-joined at startup). It contains an array of rooms names. + * (by default only one room is created named "My room")</p> + */ + var $channels = array(); + 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 $privmsg = array(); // the joined private chat when opening the chat (the nicknames must be online) + var $max_privmsg = 5; // this the max number of allowed privmsg by users + + + /** + * <p>This is the time to wait between two refreshes. + * A refresh is a HTTP request which asks the server if there are new messages to display. + * If there are no new messages, then a empty HTTP response is returned. + * ( 5000 by default, 5000ms = 5s)</p> + */ + var $refresh_delay = 5000; + + /** + * <p>This is the time of inactivity to wait before to considere to disconnecte user (in milliseconds). + * A user is inactive only if he closed his chat windows. + * A user with a open chat window is not inactive because he sends each <code>refresh_delay</code> a HTTP request. + * ( 20000 by default, 20000ms = 20s)</p> + */ + var $timeout = 20000; + + var $isadmin = false; var $admins = array("admin" => ""); // the key is the nickname, the value is the password var $firstisadmin = false; // give admin rights to the first connected user on the server @@ -74,63 +135,178 @@ var $proxies_path_default = ""; // dirname(__FILE__).'/proxies' var $cmd_path = ""; // a custom commands path var $cmd_path_default = ""; // dirname(__FILE__).'/commands' - 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 $privmsg = array(); // the joined private chat when opening the chat (the nicknames must be online) - var $max_privmsg = 5; // this the max number of allowed privmsg by users - var $frozen_nick = false; // set it to true if you don't want the user to be able to change his nickname - var $max_nick_len = 15; - var $max_text_len = 400; - var $refresh_delay = 5000; // in mili-seconds (5 seconds) + + /** + * <p>This is the maximum message length, a longer message is forbidden. + * ( 250 characters by default)</p> + */ + var $max_text_len = 400; + + var $max_refresh_delay = 60000; // in mili-seconds (60 seconds) - var $timeout = 20000; // in mili-seconds (20 seconds) - var $max_msg = 20; // number of messages keept in the history (this is what you see when you reload the chat) + + /** + * <p>This is the number of messages keept in the history. + * This is what you see when you reload the chat. + * The number of messages s/he can see is defined by this parameter. + * (20 lines by default)</p> + */ + var $max_msg = 20; var $max_displayed_lines = 150; // maximum number of displayed lines (old lines will be deleted to save browser's memory) - var $quit_on_closedwindow = true; // could be annoying because the reload event is the same as a close event - var $focus_on_connect = true; - var $connect_at_startup = true; - var $start_minimized = false; - var $height = "440px"; - var $width = ""; - var $shownotice = 3; // show: 0 = nothing, 1 = just nickname changes, 2 = join/quit, 3 = 1+2 - var $nickmarker = true; // show/hide nicknames colors - var $clock = true; // show/hide dates and hours + + /** + * <p>Setting this to true will send a <code>/quit</code> command when the user close his window + * (doesn't work on Firefox). + * This parameter isn't true by default because on IE and Konqueror/Safari, + * reloading the window (F5) will generate the same event as closing the window which can be annoying. + * (false value by default)</p> + */ + var $quit_on_closedwindow = true; + + /** + * <p>Setting this to true will give the focus to the input text box when connecting to the chat. + * It can be usefull not touch the focus when integrating the chat into an existing website + * because when the focus is changed, the viewport follows the focus location. + * (true value by default)</p> + */ + var $focus_on_connect = true; + + /** + * <p>Setting this to false will oblige user to click on the connect button if s/he wants to chat. + * (true value by default, means when the chat web page is open, + * a connection to the chat is automaticaly performed)</p> + */ + var $connect_at_startup = true; + + /** + * <p>Setting it to true will start the chat minimized. + * (false value by default)</p> + */ + var $start_minimized = false; + + /** + * <p>Height of the chat area. + * ("440px" by default)</p> + */ + var $height = "440px"; + + /** + * <p><ul><li>Setting this to 0 will show nothing.</li> + * <li>Setting it to 1 will show nicknames changes.</li> + * <li>Setting it to 2 will show connect/disconnect notifications.</li> + * <li>Setting it to 3 (1+2) will show nicknames and connect/disconnect notifications.</li></ul> + * (3 by default)</p> + */ + var $shownotice = 3; + + /** + * <p>Setting it to false will disable nickname colorization. + * (true value by default)</p> + **/ + var $nickmarker = true; + + /** + * <p>Setting it to false will hide the date/hour column. + * (true value by default)</p> + */ + var $clock = true; + var $startwithsound = true; // start with sound enabled - var $openlinknewwindow = true; // used to open the links in a new window + + /** + * <p>Setting it to true will add the <code>target="_blank"</code> into parsed links. + * This attribute can be used to open the followed link in a new window. + * (true value by default)</p> + */ + var $openlinknewwindow = true; + var $notify_window = true; // true : appends a prefix to the window title with the number of new posted messages var $short_url = true; // true : shortens long urls entered by users in the chat area var $short_url_width = 40; // final width of the shortened url /** + * Used to hide the phpfreechat linkback logo. * Be sure that you are conform to the license page before setting this to false ! * http://www.phpfreechat.net/license.en.html */ - var $display_pfc_logo = true; + var $display_pfc_logo = true; var $displaytabimage = true; var $displaytabclosebutton = true; - var $showwhosonline = true; - var $showsmileys = true; - var $btn_sh_whosonline = true; // display show/hide button for who is online - var $btn_sh_smileys = true; // display show/hide button for smileys + + /** + * <p>Used to show/hide online users list at startup. + * (true value by default)</p> + */ + var $showwhosonline = true; + + /** + * <p>Used to show/hide the smiley selector at startup. + * (true value by default)</p> + */ + var $showsmileys = true; + + /** + * <p>Used to display or not the showwhosonline button. + * (true value by default)</p> + */ + var $btn_sh_whosonline = true; + + /** + * <p>Used to display or not the showsmileys button. + * (true value by default)</p> + */ + var $btn_sh_smileys = true; + var $bbcode_colorlist = array("#FFFFFF","#000000","#000055","#008000","#FF0000","#800000","#800080","#FF5500","#FFFF00","#00FF00","#008080","#00FFFF","#0000FF","#FF00FF","#7F7F7F","#D2D2D2"); var $nickname_colorlist = array('#CCCCCC','#000000','#3636B2','#2A8C2A','#C33B3B','#C73232','#80267F','#66361F','#D9A641','#3DCC3D','#1A5555','#2F8C74','#4545E6','#B037B0','#4C4C4C','#959595'); - - var $theme = "default"; + + /** + * <p>This parameter specifies which theme the chat will use. + * A theme is a package that make possible to completly change the chat appearance (CSS) and the chat dynamics (JS) + * You can found official themes in the <code>themes/</code> directory on your local phpfreechat distribution. + * ('default' by default)</p> + */ + var $theme = 'default'; var $theme_path = ''; var $theme_default_path = ''; var $theme_url = ''; var $theme_default_url = ''; + + /** + * <p>Used to translate the chat text and messages. Accepted values are the <code>i18n/</code> sub directories names. + * (by default this is the local server language)</p> + */ + var $language = ''; + + /** + * <p>Useful to set a sepcific encoding for chat labels. + * This is really useful when the Web page embedding the chat is not UTF-8 encoded. + * This parameter should be the same as the chat web page. + * Could be ISO-8859-1 or anything else but it must be supported by iconv php module. + * (UTF-8 by default )</p> + */ + var $output_encoding = 'UTF-8'; + + /** + * <p>Used to specify the chat container (chat database). + * Accepted containers are : File and Mysql (in the future maybe other). + * ("File" by default)</p> + */ + var $container_type = 'File'; + + /** + * <p>Used to specify the script which will handle asynchronous request. + * Very useful when the chat (client) script is resource consuming (ex: forum or portal chat integration). + * <code>server_script_url</code> must point to the server script browable url (useful when using url rewriting). + * (by default these parameters are calculated automaticaly)</p> + */ + var $server_script_path = ''; + var $server_script_url = ''; + + - var $language = ""; // could be something in i18n/* directory ("" means the language is guess from the server config) - var $output_encoding = "UTF-8"; // could be ISO-8859-1 or anything else (which must be supported by iconv php module) - var $container_type = "File"; - var $client_script_path = ""; - var $server_script_path = ""; - var $server_script_url = ""; // default is calculated from 'server_script_path' var $data_private_path = ""; // default is dirname(__FILE__)."/../data/private"; var $data_public_path = ""; // default is dirname(__FILE__)."/../data/public"; var $data_public_url = ""; // default is calculated from 'data_public_path' path This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-08-29 12:37:04
|
Revision: 1157 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1157&view=rev Author: kerphi Date: 2007-08-29 05:37:02 -0700 (Wed, 29 Aug 2007) Log Message: ----------- Some doc updates Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2007-08-29 12:23:00 UTC (rev 1156) +++ trunk/src/pfcglobalconfig.class.php 2007-08-29 12:37:02 UTC (rev 1157) @@ -304,17 +304,41 @@ var $server_script_path = ''; var $server_script_url = ''; + /** + * <p>Used to specify the script path which firstly display the chat. + * This path will be used to calculate relatives paths for resources : javascript lib and images. + * Useful when the php configuration is uncommon, this option can be used to force the automatic detection process. + * (by default this parameters are auto-detected)</p> + */ + var $client_script_path = ''; - - var $client_script_path = ""; - var $data_private_path = ""; // default is dirname(__FILE__)."/../data/private"; - var $data_public_path = ""; // default is dirname(__FILE__)."/../data/public"; - var $data_public_url = ""; // default is calculated from 'data_public_path' path + /** + * <p>Used to store private data like cache, logs and chat history. + * Tip: you can optimize your chat performances, + * see <a href="http://www.phpfreechat.net/faq.en.html#tmpfs>this FAQ entry</a>. + * (<code>dirname(__FILE__)."/../data/private"</code> by default)</p> + */ + var $data_private_path = ''; /** - * This is the prototype javascript library url. + * This path must be reachable by your web server. + * Javascript and every resources (theme) files will be stored here. + * (dirname(__FILE__)."/../data/public" by default) + */ + var $data_public_path = ""; + + /** + * This url should link to the <code>data_private_path</code> directory. + * So that the clients browsers will be able to load needed javascript files and theme resources. + * It can be usefull when url rewriting is done on the server. + * (by default this parameters is calculated automaticaly from <code>data_private_path</code>) + */ + var $data_public_url = ''; + + /** + * <p>This is the prototype javascript library url. * Use this parameter to use your external library. - * default is data/js/prototype.js + * (default is <code>data/js/prototype.js</code>)</p> */ var $prototypejs_url = ''; @@ -323,21 +347,26 @@ var $is_init = false; // used internaly to know if the chat config is initialized var $version = ""; // the phpfreechat version: taken from the 'version' file content var $debugurl = ""; - var $debug = false; /** + * <p>When debug is true, some traces will be shown on the chat clients + * (default is false)</p> + */ + var $debug = false; + + /** * This is the user time zone * it is the difference in seconds between user clock and server clock */ - var $time_offset = 0; + var $time_offset = 0; /** * How to display the dates in the chat */ - var $date_format = "d/m/Y"; + var $date_format = "d/m/Y"; /** * How to display the time in the chat */ - var $time_format = "H:i:s"; + var $time_format = "H:i:s"; /** * This parameter is useful when your chat server is behind a reverse proxy that @@ -345,7 +374,6 @@ * see : http://www.phpfreechat.net/forum/viewtopic.php?id=1344 */ var $get_ip_from_xforwardedfor = false; - // private parameters var $_sys_proxies = array("lock", "checktimeout", "checknickchange", "auth", "noflood", "censor", "log"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |