phpfreechat-svn Mailing List for phpFreeChat (Page 9)
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...> - 2007-08-03 16:12:00
|
Revision: 1079 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1079&view=rev Author: kerphi Date: 2007-08-03 09:11:59 -0700 (Fri, 03 Aug 2007) Log Message: ----------- add a log in a file Modified Paths: -------------- branches/pfc-comet/misc/comet-tests/iframe2/tester-loop.php Modified: branches/pfc-comet/misc/comet-tests/iframe2/tester-loop.php =================================================================== --- branches/pfc-comet/misc/comet-tests/iframe2/tester-loop.php 2007-08-02 18:59:18 UTC (rev 1078) +++ branches/pfc-comet/misc/comet-tests/iframe2/tester-loop.php 2007-08-03 16:11:59 UTC (rev 1079) @@ -1,6 +1,9 @@ <?php function macallback($pfccomet) { + static $id; + if (!isset($id)) $id = md5(uniqid(rand(), true)); + file_put_contents('/tmp/cometdebug',"id=".$id." ".time()."\n",FILE_APPEND|LOCK_EX); return $pfccomet->formatResponse(time()); } @@ -34,6 +37,8 @@ <body> <div id="date">here will be displayed the server time</div> + <input type="button" value="Disconnect" onclick="pfccomet.disconnect()" /> + <input type="button" value="Connect" onclick="pfccomet.connect()" /> </body> </html> \ 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: <gpi...@us...> - 2007-08-02 18:59:17
|
Revision: 1078 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1078&view=rev Author: gpinzone Date: 2007-08-02 11:59:18 -0700 (Thu, 02 Aug 2007) Log Message: ----------- Updated pxlog function to use file_put_contents and honor file locking. Modified Paths: -------------- trunk/debug/log.php Modified: trunk/debug/log.php =================================================================== --- trunk/debug/log.php 2007-08-02 16:52:42 UTC (rev 1077) +++ trunk/debug/log.php 2007-08-02 18:59:18 UTC (rev 1078) @@ -4,11 +4,8 @@ { $msg = htmlspecialchars(stripslashes(var_export($data, true))); $filename = dirname(__FILE__)."/../data/private/debug".$section."_".$id.".log"; - if (!file_exists($filename)) - @touch($filename); - $fp = @fopen($filename, 'a'); - @fwrite($fp, "[".$id."] ".date("Y/m/d H:i:s - ").$msg."\n"); - @fclose($fp); + + @file_put_contents($filename, "[".$id."] ".date("Y/m/d H:i:s - ").$msg."\n", FILE_APPEND | LOCK_EX); } ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-08-02 16:53:00
|
Revision: 1077 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1077&view=rev Author: kerphi Date: 2007-08-02 09:52:42 -0700 (Thu, 02 Aug 2007) Log Message: ----------- add a test with infinite loop Added Paths: ----------- branches/pfc-comet/misc/comet-tests/iframe2/tester-loop.php Added: branches/pfc-comet/misc/comet-tests/iframe2/tester-loop.php =================================================================== --- branches/pfc-comet/misc/comet-tests/iframe2/tester-loop.php (rev 0) +++ branches/pfc-comet/misc/comet-tests/iframe2/tester-loop.php 2007-08-02 16:52:42 UTC (rev 1077) @@ -0,0 +1,39 @@ +<?php + +function macallback($pfccomet) { + return $pfccomet->formatResponse(time()); +} + +require_once 'pfccomet.class.php'; +$pfccomet = new pfcComet(); +$pfccomet->pfccometjs_url = './pfccomet.js'; +$pfccomet->prototypejs_url = '../../../data/public/js/prototype.js'; +$pfccomet->backend_loop = true; +$pfccomet->backend_url = './tester-loop.php'; +$pfccomet->backend_callback = 'macallback'; +$pfccomet->onresponse_callback = 'update_servertime_area'; +$pfccomet->run(); + +?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title>pfcComet tester</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + +<script type="text/javascript"> +function update_servertime_area(comet,time) +{ + document.getElementById('date').innerHTML = time; +} +</script> + +<?php $pfccomet->printJavascript(); ?> + + + </head> + <body> + + <div id="date">here will be displayed the server time</div> + + </body> +</html> \ 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-08-02 16:44:19
|
Revision: 1076 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1076&view=rev Author: kerphi Date: 2007-08-02 09:44:15 -0700 (Thu, 02 Aug 2007) Log Message: ----------- Add the javascript callback handling Modified Paths: -------------- branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.class.php branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.js branches/pfc-comet/misc/comet-tests/iframe2/tester.php Modified: branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.class.php =================================================================== --- branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.class.php 2007-08-02 16:27:50 UTC (rev 1075) +++ branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.class.php 2007-08-02 16:44:15 UTC (rev 1076) @@ -8,6 +8,9 @@ var $backend_callback = null; var $backend_loop = false; var $backend_loop_sleep = 1; + var $onresponse_callback = null; + var $onconnect_callback = null; + var $ondisconnect_callback = null; function pfcComet() { @@ -29,23 +32,25 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <script type="text/javascript"> - // KHTML browser don\'t share javascripts between iframes - var is_khtml = navigator.appName.match("Konqueror") || navigator.appVersion.match("KHTML"); - if (is_khtml) - { - var prototypejs = document.createElement("script"); - prototypejs.setAttribute("type","text/javascript"); - prototypejs.setAttribute("src","'.$this->prototypejs_url.'"); - var head = document.getElementsByTagName("head"); - head[0].appendChild(prototypejs); - } +// // KHTML browser don\'t share javascripts between iframes +// var is_khtml = navigator.appName.match("Konqueror") || navigator.appVersion.match("KHTML"); +// if (is_khtml) +// { +// var prototypejs = document.createElement("script"); +// prototypejs.setAttribute("type","text/javascript"); +// prototypejs.setAttribute("src","'.$this->prototypejs_url.'"); +// var head = document.getElementsByTagName("head"); +// head[0].appendChild(prototypejs); +// } // load the comet object var pfccomet = window.parent.pfccomet; -</script>'; +</script> +<body> +'; flush(); // trigger the onConnect callback - echo '<script type="text/javascript">pfccomet._onConnect();</script>'; + echo '<script type="text/javascript">pfccomet._onConnect();</script>'."\n"; flush(); // trigger the backend callback @@ -64,7 +69,8 @@ } while($this->backend_loop); // trigger the onDisconnect callback - echo '<script type="text/javascript">pfccomet._onDisconnect();</script>'; + echo '<script type="text/javascript">pfccomet._onDisconnect();</script>'."\n"; + echo '</body></html>'; flush(); die(); @@ -73,7 +79,7 @@ function formatResponse($data) { - return '<script type="text/javascript">pfccomet._onResponse(\''.addslashes($data).'\');</script>'; + return '<script type="text/javascript">pfccomet._onResponse(\''.addslashes($data).'\');</script>'."\n"; } function printJavascript($return = false) @@ -82,10 +88,14 @@ $output .= '<script type="text/javascript" src="'.$this->pfccometjs_url.'"></script>'."\n"; $output .= '<script type="text/javascript"> Event.observe(window, "load", function() { - pfccomet = new pfcComet({"url":"'.$this->backend_url.'?'.$this->backend_param.'"}); - pfccomet.onConnect = function(comet) { alert("connected"); }; - pfccomet.onDisconnect = function(comet) { alert("disconnected"); }; - pfccomet.onResponse = function(comet,data) { alert("response:"+data); }; + pfccomet = new pfcComet({"url":"'.$this->backend_url.'?'.$this->backend_param.'"});'."\n"; + if ( $this->onresponse_callback ) + $output .= ' pfccomet.onResponse = '.$this->onresponse_callback.';'."\n"; + if ( $this->onconnect_callback ) + $output .= ' pfccomet.onConnect = '.$this->onconnect_callback.';'."\n"; + if ( $this->ondisconnect_callback ) + $output .= ' pfccomet.onDisconnect = '.$this->ondisconnect_callback.';'."\n"; + $output .= ' pfccomet.connect(); }); </script>'."\n"; @@ -97,4 +107,4 @@ } -?> +?> \ No newline at end of file Modified: branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.js =================================================================== --- branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.js 2007-08-02 16:27:50 UTC (rev 1075) +++ branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.js 2007-08-02 16:44:15 UTC (rev 1076) @@ -93,7 +93,11 @@ _onDisconnect: function() { if (this._iframe) { - if (navigator.appVersion.indexOf("MSIE") == -1) { this._iframe.remove(); } + if (navigator.appVersion.indexOf("MSIE") == -1 && + navigator.appVersion.indexOf("KHTML") == -1) // or Konqueror will crash + { + this._iframe.remove(); + } this._iframe = false; // release the iframe to prevent problems with IE when reloading the page } this._isconnected = false; Modified: branches/pfc-comet/misc/comet-tests/iframe2/tester.php =================================================================== --- branches/pfc-comet/misc/comet-tests/iframe2/tester.php 2007-08-02 16:27:50 UTC (rev 1075) +++ branches/pfc-comet/misc/comet-tests/iframe2/tester.php 2007-08-02 16:44:15 UTC (rev 1076) @@ -1,7 +1,7 @@ <?php function macallback($pfccomet) { - return $pfccomet->formatResponse('test macallback'); + return $pfccomet->formatResponse(time()); } require_once 'pfccomet.class.php'; @@ -9,7 +9,8 @@ $pfccomet->pfccometjs_url = './pfccomet.js'; $pfccomet->prototypejs_url = '../../../data/public/js/prototype.js'; $pfccomet->backend_url = './tester.php'; -$pfccomet->backend_callback = 'macallback'; +$pfccomet->backend_callback = 'macallback'; +$pfccomet->onresponse_callback = 'update_servertime_area'; $pfccomet->run(); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> @@ -17,9 +18,21 @@ <head> <title>pfcComet tester</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <?php $pfccomet->printJavascript(); ?> + +<script type="text/javascript"> +function update_servertime_area(comet,time) +{ + document.getElementById('date').innerHTML = time; +} +</script> + +<?php $pfccomet->printJavascript(); ?> + + </head> <body> -tester + + <div id="date">here will be displayed the server time</div> + </body> </html> \ 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: <gpi...@us...> - 2007-08-02 16:28:35
|
Revision: 1075 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1075&view=rev Author: gpinzone Date: 2007-08-02 09:27:50 -0700 (Thu, 02 Aug 2007) Log Message: ----------- Updated debug logging to honor file locking on appends. Modified Paths: -------------- trunk/src/containers/file.class.php trunk/src/containers/mysql.class.php trunk/src/proxies/log.class.php Modified: trunk/src/containers/file.class.php =================================================================== --- trunk/src/containers/file.class.php 2007-08-01 20:14:09 UTC (rev 1074) +++ trunk/src/containers/file.class.php 2007-08-02 16:27:50 UTC (rev 1075) @@ -73,7 +73,7 @@ $c =& pfcGlobalConfig::Instance(); if ($c->debug) - file_put_contents("/tmp/debug", "\nsetMeta(".$group.",".$subgroup.",".$leaf.",".$leafvalue.")", FILE_APPEND); + file_put_contents("/tmp/debug", "\nsetMeta(".$group.",".$subgroup.",".$leaf.",".$leafvalue.")", FILE_APPEND | LOCK_EX); // create directories $dir_base = $c->container_cfg_server_dir; @@ -107,7 +107,7 @@ { $c =& pfcGlobalConfig::Instance(); if ($c->debug) - file_put_contents("/tmp/debug", "\ngetMeta(".$group.",".$subgroup.",".$leaf.",".$withleafvalue.")", FILE_APPEND); + file_put_contents("/tmp/debug", "\ngetMeta(".$group.",".$subgroup.",".$leaf.",".$withleafvalue.")", FILE_APPEND | LOCK_EX); // read data from metadata file $ret = array(); @@ -167,7 +167,7 @@ { $c =& pfcGlobalConfig::Instance(); if ($c->debug) - file_put_contents("/tmp/debug", "\nrmMeta(".$group.",".$subgroup.",".$leaf.")", FILE_APPEND); + file_put_contents("/tmp/debug", "\nrmMeta(".$group.",".$subgroup.",".$leaf.")", FILE_APPEND | LOCK_EX); $dir = $c->container_cfg_server_dir; Modified: trunk/src/containers/mysql.class.php =================================================================== --- trunk/src/containers/mysql.class.php 2007-08-01 20:14:09 UTC (rev 1074) +++ trunk/src/containers/mysql.class.php 2007-08-02 16:27:50 UTC (rev 1075) @@ -158,7 +158,7 @@ $c =& pfcGlobalConfig::Instance(); if ($c->debug) - file_put_contents("/tmp/debug.txt", "\nsetMeta(".$group.",".$subgroup.",".$leaf.",".$leafvalue.")", FILE_APPEND); + file_put_contents("/tmp/debug.txt", "\nsetMeta(".$group.",".$subgroup.",".$leaf.",".$leafvalue.")", FILE_APPEND | LOCK_EX); $server = $c->serverid; $db = $this->_connect(); @@ -173,7 +173,7 @@ if( !(mysql_num_rows($res)>0) ) { if ($c->debug) - file_put_contents("/tmp/debug.txt", "\nsetSQL(".$sql_insert.")", FILE_APPEND); + file_put_contents("/tmp/debug.txt", "\nsetSQL(".$sql_insert.")", FILE_APPEND | LOCK_EX); mysql_query($sql_insert, $db); return 0; // value created @@ -183,7 +183,7 @@ if ($sql_update != "") { if ($c->debug) - file_put_contents("/tmp/debug.txt", "\nsetSQL(".$sql_update.")", FILE_APPEND); + file_put_contents("/tmp/debug.txt", "\nsetSQL(".$sql_update.")", FILE_APPEND | LOCK_EX); mysql_query($sql_update, $db); } @@ -197,7 +197,7 @@ $c =& pfcGlobalConfig::Instance(); if ($c->debug) - file_put_contents("/tmp/debug.txt", "\ngetMeta(".$group.",".$subgroup.",".$leaf.",".$withleafvalue.")", FILE_APPEND); + file_put_contents("/tmp/debug.txt", "\ngetMeta(".$group.",".$subgroup.",".$leaf.",".$withleafvalue.")", FILE_APPEND | LOCK_EX); $ret = array(); $ret["timestamp"] = array(); @@ -234,7 +234,7 @@ $sql_select="SELECT `$value`, `timestamp` FROM ".$c->container_cfg_mysql_table." WHERE `server`='$server' $sql_where $sql_group_by ORDER BY timestamp"; if ($c->debug) - file_put_contents("/tmp/debug.txt", "\ngetSQL(".$sql_select.")", FILE_APPEND); + file_put_contents("/tmp/debug.txt", "\ngetSQL(".$sql_select.")", FILE_APPEND | LOCK_EX); if ($sql_select != "") { @@ -266,7 +266,7 @@ { $c =& pfcGlobalConfig::Instance(); if ($c->debug) - file_put_contents("/tmp/debug.txt", "\nrmMeta(".$group.",".$subgroup.",".$leaf.")", FILE_APPEND); + file_put_contents("/tmp/debug.txt", "\nrmMeta(".$group.",".$subgroup.",".$leaf.")", FILE_APPEND | LOCK_EX); $server = $c->serverid; $db = $this->_connect(); @@ -283,7 +283,7 @@ $sql_delete .= " AND `leaf`='$leaf'"; if ($c->debug) - file_put_contents("/tmp/debug.txt", "\nrmSQL(".$sql_delete.")", FILE_APPEND); + file_put_contents("/tmp/debug.txt", "\nrmSQL(".$sql_delete.")", FILE_APPEND | LOCK_EX); mysql_query($sql_delete, $db); return true; Modified: trunk/src/proxies/log.class.php =================================================================== --- trunk/src/proxies/log.class.php 2007-08-01 20:14:09 UTC (rev 1074) +++ trunk/src/proxies/log.class.php 2007-08-02 16:27:50 UTC (rev 1075) @@ -59,7 +59,7 @@ $log .= date("H:i:s")."\t"; $log .= $sender."\t"; $log .= $param."\n"; - file_put_contents($logfile, $log, FILE_APPEND); + file_put_contents($logfile, $log, FILE_APPEND | LOCK_EX); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-08-01 20:14:07
|
Revision: 1074 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1074&view=rev Author: kerphi Date: 2007-08-01 13:14:09 -0700 (Wed, 01 Aug 2007) Log Message: ----------- fix problems on IE7 Modified Paths: -------------- branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.class.php branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.js Modified: branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.class.php =================================================================== --- branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.class.php 2007-08-01 20:06:54 UTC (rev 1073) +++ branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.class.php 2007-08-01 20:14:09 UTC (rev 1074) @@ -97,4 +97,4 @@ } -?> \ No newline at end of file +?> Modified: branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.js =================================================================== --- branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.js 2007-08-01 20:06:54 UTC (rev 1073) +++ branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.js 2007-08-01 20:14:09 UTC (rev 1074) @@ -35,7 +35,7 @@ { this._iframe = null; this._iframediv = null; - Event.observe(window, "unload", this._onUnload); + Event.observe(window, "unload", this._onDisconnect); if (navigator.appVersion.indexOf("MSIE") != -1) { @@ -48,7 +48,7 @@ this._iframe.close(); this._iframediv = this._iframe.createElement("div"); this._iframe.appendChild(this._iframediv); - this._iframe.parentWindow.comet = comet; + this._iframe.parentWindow.pfccomet = this; this._iframediv.innerHTML = '<iframe id="comet_iframe" src="' + this.url + '"></iframe>'; } else if (navigator.appVersion.indexOf("KHTML") != -1) { @@ -92,8 +92,10 @@ _onDisconnect: function() { - this._iframe.remove(); - this._onUnload(); + if (this._iframe) { + if (navigator.appVersion.indexOf("MSIE") == -1) { this._iframe.remove(); } + this._iframe = false; // release the iframe to prevent problems with IE when reloading the page + } this._isconnected = false; this.onDisconnect(this); }, @@ -103,12 +105,6 @@ this.onResponse(this,data); }, - _onUnload: function() { - if (this._iframe) { - this._iframe = false; // release the iframe to prevent problems with IE when reloading the page - } - }, - /** * User's callbacks */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-08-01 20:06:52
|
Revision: 1073 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1073&view=rev Author: kerphi Date: 2007-08-01 13:06:54 -0700 (Wed, 01 Aug 2007) Log Message: ----------- develope a more generic way to communicate with iframe/comet system Added Paths: ----------- branches/pfc-comet/misc/comet-tests/iframe2/ branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.class.php branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.js branches/pfc-comet/misc/comet-tests/iframe2/tester.php Added: branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.class.php =================================================================== --- branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.class.php (rev 0) +++ branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.class.php 2007-08-01 20:06:54 UTC (rev 1073) @@ -0,0 +1,100 @@ +<?php + +class pfcComet { + var $pfccometjs_url = './pfccomet.js'; + var $prototypejs_url = './prototype.js'; + var $backend_url = ''; + var $backend_param = 'backend'; + var $backend_callback = null; + var $backend_loop = false; + var $backend_loop_sleep = 1; + + function pfcComet() + { + if ($this->backend_url == '') + $this->backend_url = $_SERVER['PHP_SELF']; + } + + function run() + { + if (isset($_REQUEST[$this->backend_param])) + { + header("Cache-Control: no-cache, must-revalidate"); + header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); + flush(); + echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>pfcComet backend iframe</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +</head> +<script type="text/javascript"> + // KHTML browser don\'t share javascripts between iframes + var is_khtml = navigator.appName.match("Konqueror") || navigator.appVersion.match("KHTML"); + if (is_khtml) + { + var prototypejs = document.createElement("script"); + prototypejs.setAttribute("type","text/javascript"); + prototypejs.setAttribute("src","'.$this->prototypejs_url.'"); + var head = document.getElementsByTagName("head"); + head[0].appendChild(prototypejs); + } + // load the comet object + var pfccomet = window.parent.pfccomet; +</script>'; + flush(); + + // trigger the onConnect callback + echo '<script type="text/javascript">pfccomet._onConnect();</script>'; + flush(); + + // trigger the backend callback + do { + if (is_callable($this->backend_callback)) + { + $func = $this->backend_callback; + if ( is_array($func) ){ + echo $func[0]->$func[1]($this); + } else { + echo $func($this); + } + } + flush(); + sleep($this->backend_loop_sleep); + } while($this->backend_loop); + + // trigger the onDisconnect callback + echo '<script type="text/javascript">pfccomet._onDisconnect();</script>'; + flush(); + + die(); + } + } + + function formatResponse($data) + { + return '<script type="text/javascript">pfccomet._onResponse(\''.addslashes($data).'\');</script>'; + } + + function printJavascript($return = false) + { + $output = '<script type="text/javascript" src="'.$this->prototypejs_url.'"></script>'."\n"; + $output .= '<script type="text/javascript" src="'.$this->pfccometjs_url.'"></script>'."\n"; + $output .= '<script type="text/javascript"> +Event.observe(window, "load", function() { + pfccomet = new pfcComet({"url":"'.$this->backend_url.'?'.$this->backend_param.'"}); + pfccomet.onConnect = function(comet) { alert("connected"); }; + pfccomet.onDisconnect = function(comet) { alert("disconnected"); }; + pfccomet.onResponse = function(comet,data) { alert("response:"+data); }; + pfccomet.connect(); +}); +</script>'."\n"; + if ($return) + return $output; + else + echo $output; + } + +} + +?> \ No newline at end of file Added: branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.js =================================================================== --- branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.js (rev 0) +++ branches/pfc-comet/misc/comet-tests/iframe2/pfccomet.js 2007-08-01 20:06:54 UTC (rev 1073) @@ -0,0 +1,118 @@ +/** + * This class is used to get data from server using a persistent connexion + * thus the clients are informed in realtime from the server changes (very usefull for a chat application) + * Usage: + * var comet = new pfcComet({'url': './cometbackend.php', 'id': 1}); + * comet.onResponse = function(comet,data) { alert('response:'+data); }; + * comet.onConnect = function(comet) { alert('connected'); }; + * comet.onDisconnect = function(comet) { alert('disconnected'); }; + */ +var pfcComet = Class.create(); +pfcComet.prototype = { + + url: null, + _isconnected: false, + + initialize: function(params) { + if (!params) params = {}; + if (!params['url']) alert('error: url parameter is mandatory'); + this.url = params['url']; + }, + + connect: function() + { + if (this._isconnected) return; + this._openPersistentConnexion(); + }, + + disconnect: function() + { + if (!this._isconnected) return; + this._onDisconnect(); + }, + + _openPersistentConnexion: function() + { + this._iframe = null; + this._iframediv = null; + Event.observe(window, "unload", this._onUnload); + + if (navigator.appVersion.indexOf("MSIE") != -1) { + + // For IE browsers + this._iframe = new ActiveXObject("htmlfile"); + this._iframe.open(); + this._iframe.write("<html>"); + this._iframe.write("<script>document.domain = '"+document.domain+"'"); + this._iframe.write("</html>"); + this._iframe.close(); + this._iframediv = this._iframe.createElement("div"); + this._iframe.appendChild(this._iframediv); + this._iframe.parentWindow.comet = comet; + this._iframediv.innerHTML = '<iframe id="comet_iframe" src="' + this.url + '"></iframe>'; + + } else if (navigator.appVersion.indexOf("KHTML") != -1) { + + // for KHTML browsers + this._iframe = document.createElement('iframe'); + this._iframe.setAttribute('id', 'comet_iframe'); + this._iframe.setAttribute('src', this.url); + with (this._iframe.style) { + position = "absolute"; + left = top = "-100px"; + height = width = "1px"; + visibility = "hidden"; + } + document.body.appendChild(this._iframe); + + } else { + + // For other browser (Firefox...) + this._iframe = document.createElement('iframe'); + this._iframe.setAttribute('id', 'comet_iframe'); + with (this._iframe.style) { + left = top = "-100px"; + height = width = "1px"; + visibility = "hidden"; + display = 'none'; + } + this._iframediv = document.createElement('iframe'); + this._iframediv.setAttribute('src', this.url); + this._iframe.appendChild(this._iframediv); + document.body.appendChild(this._iframe); + + } + }, + + _onConnect: function() + { + this._isconnected = true; + this.onConnect(this); + }, + + _onDisconnect: function() + { + this._iframe.remove(); + this._onUnload(); + this._isconnected = false; + this.onDisconnect(this); + }, + + _onResponse: function(data) + { + this.onResponse(this,data); + }, + + _onUnload: function() { + if (this._iframe) { + this._iframe = false; // release the iframe to prevent problems with IE when reloading the page + } + }, + + /** + * User's callbacks + */ + onResponse: function(pfccomet, data) {}, + onConnect: function(pfccomet) {}, + onDisconnect: function(pfccomet) {} +} Added: branches/pfc-comet/misc/comet-tests/iframe2/tester.php =================================================================== --- branches/pfc-comet/misc/comet-tests/iframe2/tester.php (rev 0) +++ branches/pfc-comet/misc/comet-tests/iframe2/tester.php 2007-08-01 20:06:54 UTC (rev 1073) @@ -0,0 +1,25 @@ +<?php + +function macallback($pfccomet) { + return $pfccomet->formatResponse('test macallback'); +} + +require_once 'pfccomet.class.php'; +$pfccomet = new pfcComet(); +$pfccomet->pfccometjs_url = './pfccomet.js'; +$pfccomet->prototypejs_url = '../../../data/public/js/prototype.js'; +$pfccomet->backend_url = './tester.php'; +$pfccomet->backend_callback = 'macallback'; +$pfccomet->run(); + +?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title>pfcComet tester</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <?php $pfccomet->printJavascript(); ?> + </head> + <body> +tester + </body> +</html> \ 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: <gpi...@us...> - 2007-08-01 19:16:59
|
Revision: 1072 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1072&view=rev Author: gpinzone Date: 2007-08-01 12:17:00 -0700 (Wed, 01 Aug 2007) Log Message: ----------- Fixes bug 1762865. Smileys with double quote characters would still be escaped on IE browsers. The problem is with the unescapeHTML function in prototype.js. However, it's patched here as per kerphi. Modified Paths: -------------- trunk/data/public/js/pfcgui.js Modified: trunk/data/public/js/pfcgui.js =================================================================== --- trunk/data/public/js/pfcgui.js 2007-08-01 16:28:27 UTC (rev 1071) +++ trunk/data/public/js/pfcgui.js 2007-08-01 19:17:00 UTC (rev 1072) @@ -405,6 +405,10 @@ s_url = sl[i]; s_symbol = smileys[sl[i]]; s_symbol = s_symbol.unescapeHTML(); + // Replace " with " for IE and Webkit browsers. + // The prototype.js version 1.5.1.1 does not do this. + if (window.attachEvent && !window.opera) // IE detection from prototype.js + s_symbol = s_symbol.replace(/"/g,'"'); var img = document.createElement('img'); img.setAttribute('src', s_url); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gpi...@us...> - 2007-08-01 16:28:29
|
Revision: 1071 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1071&view=rev Author: gpinzone Date: 2007-08-01 09:28:27 -0700 (Wed, 01 Aug 2007) Log Message: ----------- Better PNG lossless compression used. Modified Paths: -------------- trunk/style/bulle.png trunk/style/check_off.png trunk/style/check_on.png trunk/style/valid-css.png trunk/style/valid-xhtml.png trunk/themes/default/smileys/arrow_left.png trunk/themes/default/smileys/arrow_right.png trunk/themes/default/smileys/emoticon_evilgrin.png trunk/themes/default/smileys/emoticon_grin.png trunk/themes/default/smileys/emoticon_happy.png trunk/themes/default/smileys/emoticon_surprised.png trunk/themes/default/smileys/emoticon_tongue.png trunk/themes/default/smileys/emoticon_unhappy.png trunk/themes/default/smileys/emoticon_waii.png trunk/themes/default/smileys/emoticon_wink.png trunk/themes/default/smileys/exclamation.png trunk/themes/default/smileys/lightbulb.png trunk/themes/default/smileys/weather_clouds.png trunk/themes/default/smileys/weather_cloudy.png trunk/themes/default/smileys/weather_lightning.png trunk/themes/default/smileys/weather_rain.png trunk/themes/default/smileys/weather_snow.png trunk/themes/default/smileys/weather_sun.png trunk/themes/zilveer/images/channels_content_bg.png trunk/themes/zilveer/images/newmsg.png trunk/themes/zilveer/images/oldmsg.png trunk/themes/zilveer/images/pfc_message1.png trunk/themes/zilveer/images/pfc_message2.png trunk/themes/zilveer/images/pfc_online.png trunk/themes/zilveer/images/pfc_send.png trunk/themes/zilveer/images/pfc_words.png trunk/themes/zilveer/images/tab_off.png trunk/themes/zilveer/images/tab_on.png Modified: trunk/style/bulle.png =================================================================== (Binary files differ) Modified: trunk/style/check_off.png =================================================================== (Binary files differ) Modified: trunk/style/check_on.png =================================================================== (Binary files differ) Modified: trunk/style/valid-css.png =================================================================== (Binary files differ) Modified: trunk/style/valid-xhtml.png =================================================================== (Binary files differ) Modified: trunk/themes/default/smileys/arrow_left.png =================================================================== (Binary files differ) Modified: trunk/themes/default/smileys/arrow_right.png =================================================================== (Binary files differ) Modified: trunk/themes/default/smileys/emoticon_evilgrin.png =================================================================== (Binary files differ) Modified: trunk/themes/default/smileys/emoticon_grin.png =================================================================== (Binary files differ) Modified: trunk/themes/default/smileys/emoticon_happy.png =================================================================== (Binary files differ) Modified: trunk/themes/default/smileys/emoticon_surprised.png =================================================================== (Binary files differ) Modified: trunk/themes/default/smileys/emoticon_tongue.png =================================================================== (Binary files differ) Modified: trunk/themes/default/smileys/emoticon_unhappy.png =================================================================== (Binary files differ) Modified: trunk/themes/default/smileys/emoticon_waii.png =================================================================== (Binary files differ) Modified: trunk/themes/default/smileys/emoticon_wink.png =================================================================== (Binary files differ) Modified: trunk/themes/default/smileys/exclamation.png =================================================================== (Binary files differ) Modified: trunk/themes/default/smileys/lightbulb.png =================================================================== (Binary files differ) Modified: trunk/themes/default/smileys/weather_clouds.png =================================================================== (Binary files differ) Modified: trunk/themes/default/smileys/weather_cloudy.png =================================================================== (Binary files differ) Modified: trunk/themes/default/smileys/weather_lightning.png =================================================================== (Binary files differ) Modified: trunk/themes/default/smileys/weather_rain.png =================================================================== (Binary files differ) Modified: trunk/themes/default/smileys/weather_snow.png =================================================================== (Binary files differ) Modified: trunk/themes/default/smileys/weather_sun.png =================================================================== (Binary files differ) Modified: trunk/themes/zilveer/images/channels_content_bg.png =================================================================== (Binary files differ) Modified: trunk/themes/zilveer/images/newmsg.png =================================================================== (Binary files differ) Modified: trunk/themes/zilveer/images/oldmsg.png =================================================================== (Binary files differ) Modified: trunk/themes/zilveer/images/pfc_message1.png =================================================================== (Binary files differ) Modified: trunk/themes/zilveer/images/pfc_message2.png =================================================================== (Binary files differ) Modified: trunk/themes/zilveer/images/pfc_online.png =================================================================== (Binary files differ) Modified: trunk/themes/zilveer/images/pfc_send.png =================================================================== (Binary files differ) Modified: trunk/themes/zilveer/images/pfc_words.png =================================================================== (Binary files differ) Modified: trunk/themes/zilveer/images/tab_off.png =================================================================== (Binary files differ) Modified: trunk/themes/zilveer/images/tab_on.png =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gpi...@us...> - 2007-08-01 15:59:01
|
Revision: 1070 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1070&view=rev Author: gpinzone Date: 2007-08-01 08:59:02 -0700 (Wed, 01 Aug 2007) Log Message: ----------- Updated log and debug code to use standard file handling functions. Modified Paths: -------------- trunk/debug/console.php trunk/src/pfci18n.class.php trunk/src/proxies/log.class.php Modified: trunk/debug/console.php =================================================================== --- trunk/debug/console.php 2007-08-01 14:37:04 UTC (rev 1069) +++ trunk/debug/console.php 2007-08-01 15:59:02 UTC (rev 1070) @@ -9,13 +9,9 @@ { $filename = dirname(__FILE__)."/../data/private/debug".$section."_".$chatid.".log"; $xml_reponse = new xajaxResponse(); - if (file_exists($filename)) + if (false !== $html = @file_get_contents_flock($filename)) { - $fp = fopen($filename, "r"); - $html = "<pre>"; - $html .= fread($fp, filesize($filename)); - $html .= "</pre>"; - fclose($fp); + $html = "<pre>" . $html . "</pre>"; unlink($filename); $xml_reponse->addAppend("debug".$section, "innerHTML", $html); } Modified: trunk/src/pfci18n.class.php =================================================================== --- trunk/src/pfci18n.class.php 2007-08-01 14:37:04 UTC (rev 1069) +++ trunk/src/pfci18n.class.php 2007-08-01 15:59:02 UTC (rev 1070) @@ -123,11 +123,11 @@ } closedir($dh); $i18n_accepted_lang_str = "array('" . implode("','", $i18n_accepted_lang) . "');"; - $data = file_get_contents(__FILE__); + $data = file_get_contents_flock(__FILE__); $data = preg_replace("/(\/\*<GetAcceptedLanguage>\*\/)(.*)(\/\*<\/GetAcceptedLanguage>\*\/)/", "$1".$i18n_accepted_lang_str."$3", $data); - file_put_contents(__FILE__,$data); + file_put_contents(__FILE__, $data, FILE_EX); // Now scan the source code in order to find "_pfc" patterns $files = array(); @@ -170,7 +170,7 @@ foreach( $dst_filenames as $dst_filename ) { // filter lines to keep, line to add - $old_content = file_get_contents($dst_filename); + $old_content = file_get_contents_flock($dst_filename); // remove php tags to keep only real content $old_content = preg_replace("/^\<\?php/", "", $old_content); $old_content = preg_replace("/\?\>$/", "", $old_content); @@ -187,7 +187,7 @@ $content = "<?php" . $old_content . $new_content . "?>"; //echo $content; - file_put_contents($dst_filename, $content); + file_put_contents($dst_filename, $content, FILE_EX); } } } Modified: trunk/src/proxies/log.class.php =================================================================== --- trunk/src/proxies/log.class.php 2007-08-01 14:37:04 UTC (rev 1069) +++ trunk/src/proxies/log.class.php 2007-08-01 15:59:02 UTC (rev 1070) @@ -51,19 +51,15 @@ if (file_exists($logpath) && is_writable($logpath)) { $logfile = $logpath."/chat.log"; - $f_exists = file_exists($logfile); - if (($f_exists && is_writable($logpath)) || - !$f_exists) + if (is_writable($logpath)) { - $fp = fopen($logfile, $f_exists ? 'a' : 'w'); // @todo write logs in a cleaner structured language (xml, html ... ?) $log = $recipient."\t"; $log .= date("d/m/Y")."\t"; $log .= date("H:i:s")."\t"; $log .= $sender."\t"; $log .= $param."\n"; - fwrite($fp, $log); - fclose($fp); + file_put_contents($logfile, $log, FILE_APPEND); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-08-01 14:37:04
|
Revision: 1069 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1069&view=rev Author: kerphi Date: 2007-08-01 07:37:04 -0700 (Wed, 01 Aug 2007) Log Message: ----------- basic comet implement using iframe (from www.zeitoun.net) Added Paths: ----------- branches/pfc-comet/misc/comet-tests/iframe/ branches/pfc-comet/misc/comet-tests/iframe/backend.php branches/pfc-comet/misc/comet-tests/iframe/client.html Added: branches/pfc-comet/misc/comet-tests/iframe/backend.php =================================================================== --- branches/pfc-comet/misc/comet-tests/iframe/backend.php (rev 0) +++ branches/pfc-comet/misc/comet-tests/iframe/backend.php 2007-08-01 14:37:04 UTC (rev 1069) @@ -0,0 +1,44 @@ +<?php + +header("Cache-Control: no-cache, must-revalidate"); +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +flush(); + +?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>Comet php backend</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +</head> +<body> + +<script type="text/javascript"> + // KHTML browser don't share javascripts between iframes + var is_khtml = navigator.appName.match("Konqueror") || navigator.appVersion.match("KHTML"); + if (is_khtml) + { + var prototypejs = document.createElement('script'); + prototypejs.setAttribute('type','text/javascript'); + prototypejs.setAttribute('src','../../../data/public/js/prototype.js'); + var head = document.getElementsByTagName('head'); + head[0].appendChild(prototypejs); + } + // load the comet object + var comet = window.parent.comet; +</script> + +<?php + +while(1) { + echo '<script type="text/javascript">'; + echo 'comet.printServerTime('.time().');'; + echo '</script>'; + flush(); // used to send the echoed data to the client + sleep(1); // a little break to unload the server CPU +} + +?> + + +</body> +</html> \ No newline at end of file Added: branches/pfc-comet/misc/comet-tests/iframe/client.html =================================================================== --- branches/pfc-comet/misc/comet-tests/iframe/client.html (rev 0) +++ branches/pfc-comet/misc/comet-tests/iframe/client.html 2007-08-01 14:37:04 UTC (rev 1069) @@ -0,0 +1,80 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title>Comet demo</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <script type="text/javascript" src="../../../data/public/js/prototype.js"></script> + </head> + <body> + <div id="content">The server time will be shown here</div> + +<script type="text/javascript"> +var comet = { + connection : false, + iframediv : false, + + initialize: function() { + if (navigator.appVersion.indexOf("MSIE") != -1) { + + // For IE browsers + comet.connection = new ActiveXObject("htmlfile"); + comet.connection.open(); + comet.connection.write("<html>"); + comet.connection.write("<script>document.domain = '"+document.domain+"'"); + comet.connection.write("</html>"); + comet.connection.close(); + comet.iframediv = comet.connection.createElement("div"); + comet.connection.appendChild(comet.iframediv); + comet.connection.parentWindow.comet = comet; + comet.iframediv.innerHTML = "<iframe id='comet_iframe' src='./backend.php'></iframe>"; + + } else if (navigator.appVersion.indexOf("KHTML") != -1) { + + // for KHTML browsers + comet.connection = document.createElement('iframe'); + comet.connection.setAttribute('id', 'comet_iframe'); + comet.connection.setAttribute('src', './backend.php'); + with (comet.connection.style) { + position = "absolute"; + left = top = "-100px"; + height = width = "1px"; + visibility = "hidden"; + } + document.body.appendChild(comet.connection); + + } else { + + // For other browser (Firefox...) + comet.connection = document.createElement('iframe'); + comet.connection.setAttribute('id', 'comet_iframe'); + with (comet.connection.style) { + left = top = "-100px"; + height = width = "1px"; + visibility = "hidden"; + display = 'none'; + } + comet.iframediv = document.createElement('iframe'); + comet.iframediv.setAttribute('src', './backend.php'); + comet.connection.appendChild(comet.iframediv); + document.body.appendChild(comet.connection); + + } + }, + + // this function will be called from backend.php + printServerTime: function (time) { + $('content').innerHTML = time; + }, + + onUnload: function() { + if (comet.connection) { + comet.connection = false; // release the iframe to prevent problems with IE when reloading the page + } + } +} +Event.observe(window, "load", comet.initialize); +Event.observe(window, "unload", comet.onUnload); +</script> + +</body> +</html> \ 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-08-01 14:06:39
|
Revision: 1068 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1068&view=rev Author: kerphi Date: 2007-08-01 07:06:37 -0700 (Wed, 01 Aug 2007) Log Message: ----------- remove comet stuff because I'll work on it in a special branche Modified Paths: -------------- trunk/themes/default/chat.js.tpl.php Removed Paths: ------------- trunk/data/public/js/pfccomet.js Deleted: trunk/data/public/js/pfccomet.js =================================================================== --- trunk/data/public/js/pfccomet.js 2007-08-01 14:05:22 UTC (rev 1067) +++ trunk/data/public/js/pfccomet.js 2007-08-01 14:06:37 UTC (rev 1068) @@ -1,87 +0,0 @@ -/** - * This class is used to get data from server using a persistent connexion - * thus the clients are informed in realtime from the server changes (very usefull for a chat application) - * Usage: - * var comet = new pfcComet({'url': './cometbackend.php', 'id': 1}); - * comet.onResponse = function(req) { alert('id:'+req['id']+' response:'+req['data']); }; - * comet.onConnect = function(comet) { alert('connected'); }; - * comet.onDisconnect = function(comet) { alert('disconnected'); }; - */ -var pfcComet = Class.create(); -pfcComet.prototype = { - - url: null, - id: 0, - timeout: 5000, - - _noerror: false, - _ajax: null, - _isconnected: false, - - initialize: function(params) { - if (!params) params = {}; - if (!params['url']) alert('error: url parameter is mandatory'); - this.url = params['url']; - if (params['id']) this.id = params['id']; - if (params['timeout']) this.timeout = params['timeout']; - }, - - connect: function() - { - if (this._isconnected) return; - this._isconnected = true; - this.onConnect(this); - this.waitForData(); - }, - - disconnect: function() - { - if (!this._isconnected) return; - this._isconnected = false; - this.onDisconnect(this); - // remove the registred callbacks in order to ignore the next response - this._ajax.options.onSuccess = null; - this._ajax.options.onComplete = null; - }, - - waitForData: function() - { - if (!this._isconnected) return; - - this._ajax = new Ajax.Request(this.url, { - method: 'get', - parameters: { 'id' : this.id }, - onSuccess: function(transport) { - // handle the server response - var response = transport.responseText.evalJSON(); - this.comet.id = response['id']; - this.comet.onResponse(response); - this.comet._noerror = true; - }, - onComplete: function(transport) { - // send a new ajax request when this request is finished - if (!this.comet._noerror) - // if a connection problem occurs, try to reconnect periodicaly - setTimeout(function(){ this.comet.waitForData(); }.bind(this), this.comet.timeout); - else - // of wait for the next data - this.comet.waitForData(); - this.comet._noerror = false; - } - }); - this._ajax.comet = this; - }, - - /** - * User's callbacks - */ - onResponse: function(response) - { - }, - onConnect: function(comet) - { - }, - onDisconnect: function(comet) - { - }, -} Modified: trunk/themes/default/chat.js.tpl.php =================================================================== --- trunk/themes/default/chat.js.tpl.php 2007-08-01 14:05:22 UTC (rev 1067) +++ trunk/themes/default/chat.js.tpl.php 2007-08-01 14:06:37 UTC (rev 1068) @@ -128,7 +128,6 @@ <script type="text/javascript" src="<?php echo $c->data_public_url; ?>/js/pfcgui.js"></script> <script type="text/javascript" src="<?php echo $c->data_public_url; ?>/js/pfcresource.js"></script> <script type="text/javascript" src="<?php echo $c->data_public_url; ?>/js/pfcprompt.js"></script> -<script type="text/javascript" src="<?php echo $c->data_public_url; ?>/js/pfccomet.js"></script> <div id="pfc_notloading" style="width:270px;background-color:#FFF;color:#000;border:1px solid #000;text-align:center;margin:5px auto 0 auto;font-size:10px;background-image:url('http://img402.imageshack.us/img402/3766/stopcc3.gif');background-repeat:no-repeat;background-position:center center;"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-08-01 14:05:21
|
Revision: 1067 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1067&view=rev Author: kerphi Date: 2007-08-01 07:05:22 -0700 (Wed, 01 Aug 2007) Log Message: ----------- add some tests for the future comet implementation Modified Paths: -------------- branches/pfc-comet/themes/default/chat.js.tpl.php Added Paths: ----------- branches/pfc-comet/misc/comet-tests/ branches/pfc-comet/misc/comet-tests/basic/ branches/pfc-comet/misc/comet-tests/basic/comet.php branches/pfc-comet/misc/comet-tests/basic/cometbackend.php branches/pfc-comet/misc/comet-tests/chat/ branches/pfc-comet/misc/comet-tests/chat/comet-chat.php branches/pfc-comet/misc/comet-tests/chat/comet-getdata.php branches/pfc-comet/misc/comet-tests/chat/comet-postdata.php branches/pfc-comet/misc/comet-tests/chat/data.txt branches/pfc-comet/misc/comet-tests/pfccomet.js Removed Paths: ------------- branches/pfc-comet/data/public/js/pfccomet.js Deleted: branches/pfc-comet/data/public/js/pfccomet.js =================================================================== --- branches/pfc-comet/data/public/js/pfccomet.js 2007-08-01 13:38:51 UTC (rev 1066) +++ branches/pfc-comet/data/public/js/pfccomet.js 2007-08-01 14:05:22 UTC (rev 1067) @@ -1,87 +0,0 @@ -/** - * This class is used to get data from server using a persistent connexion - * thus the clients are informed in realtime from the server changes (very usefull for a chat application) - * Usage: - * var comet = new pfcComet({'url': './cometbackend.php', 'id': 1}); - * comet.onResponse = function(req) { alert('id:'+req['id']+' response:'+req['data']); }; - * comet.onConnect = function(comet) { alert('connected'); }; - * comet.onDisconnect = function(comet) { alert('disconnected'); }; - */ -var pfcComet = Class.create(); -pfcComet.prototype = { - - url: null, - id: 0, - timeout: 5000, - - _noerror: false, - _ajax: null, - _isconnected: false, - - initialize: function(params) { - if (!params) params = {}; - if (!params['url']) alert('error: url parameter is mandatory'); - this.url = params['url']; - if (params['id']) this.id = params['id']; - if (params['timeout']) this.timeout = params['timeout']; - }, - - connect: function() - { - if (this._isconnected) return; - this._isconnected = true; - this.onConnect(this); - this.waitForData(); - }, - - disconnect: function() - { - if (!this._isconnected) return; - this._isconnected = false; - this.onDisconnect(this); - // remove the registred callbacks in order to ignore the next response - this._ajax.options.onSuccess = null; - this._ajax.options.onComplete = null; - }, - - waitForData: function() - { - if (!this._isconnected) return; - - this._ajax = new Ajax.Request(this.url, { - method: 'get', - parameters: { 'id' : this.id }, - onSuccess: function(transport) { - // handle the server response - var response = transport.responseText.evalJSON(); - this.comet.id = response['id']; - this.comet.onResponse(response); - this.comet._noerror = true; - }, - onComplete: function(transport) { - // send a new ajax request when this request is finished - if (!this.comet._noerror) - // if a connection problem occurs, try to reconnect periodicaly - setTimeout(function(){ this.comet.waitForData(); }.bind(this), this.comet.timeout); - else - // of wait for the next data - this.comet.waitForData(); - this.comet._noerror = false; - } - }); - this._ajax.comet = this; - }, - - /** - * User's callbacks - */ - onResponse: function(response) - { - }, - onConnect: function(comet) - { - }, - onDisconnect: function(comet) - { - }, -} Added: branches/pfc-comet/misc/comet-tests/basic/comet.php =================================================================== --- branches/pfc-comet/misc/comet-tests/basic/comet.php (rev 0) +++ branches/pfc-comet/misc/comet-tests/basic/comet.php 2007-08-01 14:05:22 UTC (rev 1067) @@ -0,0 +1,21 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8" /> + <title>pfcComet example</title> + <script type="text/javascript" src="../../../data/public/js/prototype.js"></script> + <script type="text/javascript" src="../pfccomet.js"></script> + </head> + <body> + + +<script type="text/javascript"> +var comet = new pfcComet({'url': './cometbackend.php', 'id': 1}); +comet.onResponse = function(req) { /*alert('id:'+req['id']+' response:'+req['data']);*/ }; +</script> + +<p onclick="comet.connect()">login</p> +<p onclick="comet.disconnect()">logout</p> + + </body> +</html> \ No newline at end of file Added: branches/pfc-comet/misc/comet-tests/basic/cometbackend.php =================================================================== --- branches/pfc-comet/misc/comet-tests/basic/cometbackend.php (rev 0) +++ branches/pfc-comet/misc/comet-tests/basic/cometbackend.php 2007-08-01 14:05:22 UTC (rev 1067) @@ -0,0 +1,11 @@ +<?php + +// return a json array +$response = array(); +$response['data'] = 'test'; +$response['id'] = time(); +echo json_encode($response); +flush(); +sleep(5); + +?> \ No newline at end of file Added: branches/pfc-comet/misc/comet-tests/chat/comet-chat.php =================================================================== --- branches/pfc-comet/misc/comet-tests/chat/comet-chat.php (rev 0) +++ branches/pfc-comet/misc/comet-tests/chat/comet-chat.php 2007-08-01 14:05:22 UTC (rev 1067) @@ -0,0 +1,55 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8" /> + <title>pfcComet example</title> + <script type="text/javascript" src="../../../data/public/js/prototype.js"></script> + <script type="text/javascript" src="../pfccomet.js"></script> + </head> + <body> + +<div id="chat"> +<script type="text/javascript"> +var comet = new pfcComet({'read_url': './comet-getdata.php'}); +comet.onDisconnect = function(comet) { + $('btn_connect').show(); + $('btn_disconnect').hide(); + $('ajaxlogo').hide(); +}; +comet.onConnect = function(comet) { + $('btn_disconnect').show(); + $('btn_connect').hide(); + $('ajaxlogo').show(); +}; +comet.onResponse = function(req) { new Insertion.Top($('content'),'<p>'+req['data']+'</p>'); }; +$('btn_connect').show(); +$('btn_disconnect').hide(); +$('ajaxlogo').hide(); +</script> + +<p> + <form action="" method="get" onsubmit="new Ajax.Request('./comet-postdata.php', { method: 'get', parameters: { 'msg' : $('nick').value + ': ' + $('word').value } } ); $('word').value = ''; return false;"> + <input type="button" value="Connect" id="btn_connect" onclick="comet.connect()" /> + <input type="button" value="Disconnect" id="btn_disconnect" onclick="comet.disconnect()" /> + <br/> + <input type="text" name="nick" id="nick" value="" /> + <input type="text" name="word" id="word" value="" /> + <input type="submit" name="submit" value="Send" /> + </form> +</p> + +<div id="content"> +</div> + +<p><img id="ajaxlogo" src="http://bulletproofajax.com/code/chapter06/loading/people/loading.gif" alt="" /></p> + +<script type="text/javascript"> +$('btn_connect').show(); +$('btn_disconnect').hide(); +$('ajaxlogo').hide(); +</script> + +</div> + + </body> +</html> \ No newline at end of file Added: branches/pfc-comet/misc/comet-tests/chat/comet-getdata.php =================================================================== --- branches/pfc-comet/misc/comet-tests/chat/comet-getdata.php (rev 0) +++ branches/pfc-comet/misc/comet-tests/chat/comet-getdata.php 2007-08-01 14:05:22 UTC (rev 1067) @@ -0,0 +1,32 @@ +<?php + +$filename = dirname(__FILE__).'/data.txt'; + +// infinite loop until the data file is not modified +$lastmodif = isset($_GET['id']) ? $_GET['id'] : 0; +$currentmodif = filemtime($filename); +while ($currentmodif <= $lastmodif) // check if the data file has been modified +{ + usleep( 10000); // sleep 10ms to unload the CPU + //usleep(1010000); // sleep 1sec10ms to unload the CPU + clearstatcache(); + $currentmodif = filemtime($filename); +} + + +$lines = file($filename); +$data = ''; +foreach($lines as $l) +{ + $l = explode("\t",$l); + if ($l[0] > $lastmodif) $data .= $l[1]; +} + +// return a json array +$response = array(); +$response['data'] = $data; +$response['id'] = $currentmodif; +echo json_encode($response); +flush(); + +?> \ No newline at end of file Added: branches/pfc-comet/misc/comet-tests/chat/comet-postdata.php =================================================================== --- branches/pfc-comet/misc/comet-tests/chat/comet-postdata.php (rev 0) +++ branches/pfc-comet/misc/comet-tests/chat/comet-postdata.php 2007-08-01 14:05:22 UTC (rev 1067) @@ -0,0 +1,16 @@ +<?php + +$filename = dirname(__FILE__).'/data.txt'; + +// store new message in the file +$msg = isset($_GET['msg']) ? $_GET['msg'] : ''; +if ($msg != '') +{ + $lines = file($filename); + $lines = array_slice($lines, -5); + $lines[] = time()."\t".$msg."\n"; + file_put_contents($filename,implode("",$lines)); + die(); +} + +?> \ No newline at end of file Added: branches/pfc-comet/misc/comet-tests/chat/data.txt =================================================================== --- branches/pfc-comet/misc/comet-tests/chat/data.txt (rev 0) +++ branches/pfc-comet/misc/comet-tests/chat/data.txt 2007-08-01 14:05:22 UTC (rev 1067) @@ -0,0 +1,6 @@ +1185975889 azd: +1185975890 azd: +1185975890 azd: +1185975890 azd: +1185976080 azd: eee +1185976081 azd: Added: branches/pfc-comet/misc/comet-tests/pfccomet.js =================================================================== --- branches/pfc-comet/misc/comet-tests/pfccomet.js (rev 0) +++ branches/pfc-comet/misc/comet-tests/pfccomet.js 2007-08-01 14:05:22 UTC (rev 1067) @@ -0,0 +1,96 @@ +/** + * This class is used to get data from server using a persistent connexion + * thus the clients are informed in realtime from the server changes (very usefull for a chat application) + * Usage: + * var comet = new pfcComet({'url': './cometbackend.php', 'id': 1}); + * comet.onRead = function(req) { alert('id:'+req['id']+' response:'+req['data']); }; + * comet.onConnect = function(comet) { alert('connected'); }; + * comet.onDisconnect = function(comet) { alert('disconnected'); }; + */ +var pfcComet = Class.create(); +pfcComet.prototype = { + + read_url: null, + id: 0, + timeout: 5000, + + _noerror: false, + _ajax: null, + _isconnected: false, + + initialize: function(params) { + if (!params) params = {}; + if (!params['read_url']) alert('error: read_url parameter is mandatory'); +// if (!params['write_url']) alert('error: write_url parameter is mandatory'); + this.read_url = params['read_url']; + if (params['id']) this.id = params['id']; + if (params['timeout']) this.timeout = params['timeout']; + }, + + connect: function() + { + if (this._isconnected) return; + this._isconnected = true; + this.onConnect(this); + this._waitForData(); + }, + + disconnect: function() + { + if (!this._isconnected) return; + this._isconnected = false; + this.onDisconnect(this); + // remove the registred callbacks in order to ignore the next response + this._ajax.transport.abort(); +// this._ajax.options.onSuccess = null; +// this._ajax.options.onComplete = null; + }, + + write: function(data) + { + }, + + _waitForData: function() + { + if (!this._isconnected) return; + + this._ajax = new Ajax.Request(this.read_url, { + method: 'get', + parameters: { 'id' : this.id }, + onSuccess: function(transport) { + // handle the server response + var response = transport.responseText.evalJSON(); + this.comet.id = response['id']; + this.comet.onResponse(response); + this.comet._noerror = true; + }, + onComplete: function(transport) { + // send a new ajax request when this request is finished + if (!this.comet._noerror) + // if a connection problem occurs, try to reconnect periodicaly + setTimeout(function(){ this.comet._waitForData(); }.bind(this), this.comet.timeout); + else + // of wait for the next data + this.comet._waitForData(); + this.comet._noerror = false; + } + }); + this._ajax.comet = this; + }, + + /** + * User's callbacks + */ + onRead: function(data) + { + }, + onWrite: function(data) + { + }, + onConnect: function(comet) + { + }, + onDisconnect: function(comet) + { + }, +} Modified: branches/pfc-comet/themes/default/chat.js.tpl.php =================================================================== --- branches/pfc-comet/themes/default/chat.js.tpl.php 2007-08-01 13:38:51 UTC (rev 1066) +++ branches/pfc-comet/themes/default/chat.js.tpl.php 2007-08-01 14:05:22 UTC (rev 1067) @@ -128,7 +128,6 @@ <script type="text/javascript" src="<?php echo $c->data_public_url; ?>/js/pfcgui.js"></script> <script type="text/javascript" src="<?php echo $c->data_public_url; ?>/js/pfcresource.js"></script> <script type="text/javascript" src="<?php echo $c->data_public_url; ?>/js/pfcprompt.js"></script> -<script type="text/javascript" src="<?php echo $c->data_public_url; ?>/js/pfccomet.js"></script> <div id="pfc_notloading" style="width:270px;background-color:#FFF;color:#000;border:1px solid #000;text-align:center;margin:5px auto 0 auto;font-size:10px;background-image:url('http://img402.imageshack.us/img402/3766/stopcc3.gif');background-repeat:no-repeat;background-position:center center;"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-08-01 13:38:49
|
Revision: 1066 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1066&view=rev Author: kerphi Date: 2007-08-01 06:38:51 -0700 (Wed, 01 Aug 2007) Log Message: ----------- Setup the comet implementation branche Added Paths: ----------- branches/pfc-comet/ Copied: branches/pfc-comet (from rev 1065, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gpi...@us...> - 2007-08-01 03:10:49
|
Revision: 1065 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1065&view=rev Author: gpinzone Date: 2007-07-31 20:10:49 -0700 (Tue, 31 Jul 2007) Log Message: ----------- Better PNG lossless compression used. Modified Paths: -------------- trunk/misc/logo_80x15.png trunk/misc/logo_88x31.png Modified: trunk/misc/logo_80x15.png =================================================================== (Binary files differ) Modified: trunk/misc/logo_88x31.png =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gpi...@us...> - 2007-07-31 20:02:52
|
Revision: 1064 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1064&view=rev Author: gpinzone Date: 2007-07-31 13:02:55 -0700 (Tue, 31 Jul 2007) Log Message: ----------- Eliminated flock_get_contents and flock_put_contents. Created patched version of file_get_contents that include file locking: file_get_contents_flock. Modified setMeta and getMeta to use file_get_contents_flock and file_put_contents. Rewrote setMeta's null $leafvalue handling to use file_put_contents. Modified Paths: -------------- trunk/src/containers/file.class.php trunk/src/pfctools.php Modified: trunk/src/containers/file.class.php =================================================================== --- trunk/src/containers/file.class.php 2007-07-30 14:43:40 UTC (rev 1063) +++ trunk/src/containers/file.class.php 2007-07-31 20:02:55 UTC (rev 1064) @@ -85,13 +85,11 @@ $leafexists = file_exists($leaffilename); if ($leafvalue == NULL) { - if (file_exists($leaffilename) && - filesize($leaffilename)>0) unlink($leaffilename); - touch($leaffilename); + file_put_contents($leaffilename, '', LOCK_EX); } else { - flock_put_contents($leaffilename, $leafvalue); + file_put_contents($leaffilename, $leafvalue, LOCK_EX); } // store the value in the memory cache @@ -157,7 +155,7 @@ if (!file_exists($leaffilename)) return $ret; if ($withleafvalue) - $ret["value"][] = flock_get_contents($leaffilename); + $ret["value"][] = file_get_contents_flock($leaffilename); else $ret["value"][] = NULL; $ret["timestamp"][] = filemtime($leaffilename); Modified: trunk/src/pfctools.php =================================================================== --- trunk/src/pfctools.php 2007-07-30 14:43:40 UTC (rev 1063) +++ trunk/src/pfctools.php 2007-07-31 20:02:55 UTC (rev 1064) @@ -255,8 +255,42 @@ return $errors; } +/** + * file_get_contents_flock + * define an alternative file_get_contents when this function doesn't exists on the used php version (<4.3.0) + */ +if (!defined('LOCK_SH')) { + define('LOCK_SH', 1); +} +function file_get_contents_flock($filename, $incpath = false, $resource_context = null) +{ + if (false === $fh = fopen($filename, 'rb', $incpath)) { + user_error('file_get_contents() failed to open stream: No such file or directory ['.$filename.']', + E_USER_WARNING); + return false; + } + + // Attempt to get a shared (read) lock + if (!flock($fh, LOCK_SH)) { + return false; + } + + clearstatcache(); + if ($fsize = @filesize($filename)) { + $data = fread($fh, $fsize); + } else { + $data = ''; + while (!feof($fh)) { + $data .= fread($fh, 8192); + } + } + + fclose($fh); + return $data; +} + /** * file_get_contents * define an alternative file_get_contents when this function doesn't exists on the used php version (<4.3.0) @@ -267,7 +301,7 @@ { if (false === $fh = fopen($filename, 'rb', $incpath)) { - trigger_error('file_get_contents() failed to open stream: No such file or directory', E_USER_WARNING); + trigger_error('file_get_contents() failed to open stream: No such file or directory ['.$filename.']', E_USER_WARNING); return false; } clearstatcache(); @@ -403,40 +437,4 @@ } } -/** - * Almost the Same as file_get_contents except that it uses flock() to lock the file - */ -function flock_get_contents($filename, $mode = "rb") -{ - $data = ''; - $fp = fopen( $filename, $mode ); - if( $fp && flock( $fp, LOCK_SH ) ) - { - clearstatcache(); - $size = filesize($filename); - if ($size > 0) - $data = fread( $fp, $size ); - // flock($fp, LOCK_UN); // will be done by fclose - } - fclose( $fp ); - return $data; -} - -/** - * Almost the Same as file_put_contents except that it uses flock() to lock the file - */ -function flock_put_contents($filename, $data, $mode = "wb") -{ - $fp = fopen( $filename, $mode ); - if( $fp ) - { - if ( flock( $fp, LOCK_EX ) ) - { - fwrite( $fp, $data ); - // flock($fp, LOCK_UN); // will be done by fclose - } - fclose( $fp ); - } -} - -?> +?> \ 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-07-30 14:43:38
|
Revision: 1063 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1063&view=rev Author: kerphi Date: 2007-07-30 07:43:40 -0700 (Mon, 30 Jul 2007) Log Message: ----------- Add the 'sender', 'recipient' and 'recipientid' parameters in the cmdtoplay commands Modified Paths: -------------- trunk/src/pfccommand.class.php trunk/src/phpfreechat.class.php Modified: trunk/src/pfccommand.class.php =================================================================== --- trunk/src/pfccommand.class.php 2007-07-30 13:16:33 UTC (rev 1062) +++ trunk/src/pfccommand.class.php 2007-07-30 14:43:40 UTC (rev 1063) @@ -194,7 +194,7 @@ return false; } - function RunPendingCmdToPlay($nickid,$clientid,&$xml_reponse) + function RunPendingCmdToPlay($nickid,$context,&$xml_reponse) { $c =& pfcGlobalConfig::Instance(); $u =& pfcUserConfig::Instance(); @@ -217,10 +217,10 @@ $cmd =& pfcCommand::Factory($cmdtmp['cmdstr']); $cmdp = $cmdtmp['params']; if (!isset($cmdp['param'])) $cmdp['param'] = ''; - if (!isset($cmdp['sender'])) $cmdp['sender'] = null; - if (!isset($cmdp['recipient'])) $cmdp['recipient'] = null; - if (!isset($cmdp['recipientid'])) $cmdp['recipientid'] = null; - $cmdp['clientid'] = $clientid; // the clientid must be the current user one + if (!isset($cmdp['sender'])) $cmdp['sender'] = $context['sender']; + if (!isset($cmdp['recipient'])) $cmdp['recipient'] = $context['recipient']; + if (!isset($cmdp['recipientid'])) $cmdp['recipientid'] = $context['recipientid']; + $cmdp['clientid'] = $context['clientid']; // the clientid must be the current user one $cmdp['cmdtoplay'] = true; // used to run some specials actions in the command (ex: if the cmdtoplay is a 'leave' command, then show an alert to the kicked or banished user) if ($c->debug) $cmd->run($xml_reponse, $cmdp); Modified: trunk/src/phpfreechat.class.php =================================================================== --- trunk/src/phpfreechat.class.php 2007-07-30 13:16:33 UTC (rev 1062) +++ trunk/src/phpfreechat.class.php 2007-07-30 14:43:40 UTC (rev 1063) @@ -271,18 +271,19 @@ } + + $cmdp = array(); + $cmdp["clientid"] = $clientid; + $cmdp["sender"] = $sender; + $cmdp["recipient"] = $recipient; + $cmdp["recipientid"] = $recipientid; // before playing the wanted command // play the found commands into the meta 'cmdtoplay' - pfcCommand::RunPendingCmdToPlay($u->nickid, $clientid, $xml_reponse); - + pfcCommand::RunPendingCmdToPlay($u->nickid, $cmdp, $xml_reponse); + // play the wanted command $cmd =& pfcCommand::Factory($cmdname); - $cmdp = array(); - $cmdp["clientid"] = $clientid; $cmdp["param"] = $param; $cmdp["params"] = $params; - $cmdp["sender"] = $sender; - $cmdp["recipient"] = $recipient; - $cmdp["recipientid"] = $recipientid; if ($cmd != NULL) { // call the command This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-07-30 13:16:30
|
Revision: 1062 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1062&view=rev Author: kerphi Date: 2007-07-30 06:16:33 -0700 (Mon, 30 Jul 2007) Log Message: ----------- Bug fix: privmsg command errors were not complete (thanks to sappheiros, sd bug 1762828) Modified Paths: -------------- trunk/data/public/js/pfcclient.js trunk/src/commands/privmsg.class.php trunk/src/commands/privmsg2.class.php trunk/src/phpfreechat.class.php Modified: trunk/data/public/js/pfcclient.js =================================================================== --- trunk/data/public/js/pfcclient.js 2007-07-30 13:12:30 UTC (rev 1061) +++ trunk/data/public/js/pfcclient.js 2007-07-30 13:16:33 UTC (rev 1062) @@ -282,6 +282,7 @@ else if (resp == "unknown") { // speak to unknown user + this.displayMsg( cmd, this.res.getLabel('You are trying to speak to a unknown (or not connected) user') ); } else if (resp == "speak_to_myself") { Modified: trunk/src/commands/privmsg.class.php =================================================================== --- trunk/src/commands/privmsg.class.php 2007-07-30 13:12:30 UTC (rev 1061) +++ trunk/src/commands/privmsg.class.php 2007-07-30 13:16:33 UTC (rev 1062) @@ -4,10 +4,12 @@ class pfcCommand_privmsg extends pfcCommand { + var $usage = "/privmsg {nickname}"; + function run(&$xml_reponse, $p) { $clientid = $p["clientid"]; - $param = $p["param"]; + $params = $p["params"]; $sender = $p["sender"]; $recipient = $p["recipient"]; $recipientid = $p["recipientid"]; @@ -16,17 +18,28 @@ $u =& pfcUserConfig::Instance(); $ct =& pfcContainer::Instance(); + if (count($params) == 0) + { + // error + $cmdp = $p; + $cmdp["param"] = _pfc("Missing parameter"); + $cmdp["param"] .= " (".$this->usage.")"; + $cmd =& pfcCommand::Factory("error"); + $cmd->run($xml_reponse, $cmdp); + return false; + } + // check the pvname exists on the server $pvname = ''; $pvnickid = ''; if ($this->name == 'privmsg2') { - $pvnickid = $param; + $pvnickid = $params[0]; $pvname = $ct->getNickname($pvnickid); } else { - $pvname = $param; + $pvname = $params[0]; $pvnickid = $ct->getNickId($pvname); } $nickid = $u->nickid; @@ -103,4 +116,4 @@ } } -?> \ No newline at end of file +?> Modified: trunk/src/commands/privmsg2.class.php =================================================================== --- trunk/src/commands/privmsg2.class.php 2007-07-30 13:12:30 UTC (rev 1061) +++ trunk/src/commands/privmsg2.class.php 2007-07-30 13:16:33 UTC (rev 1062) @@ -29,6 +29,7 @@ */ class pfcCommand_privmsg2 extends pfcCommand_privmsg { + var $usage = "/privmsg2 {nicknameid}"; } -?> \ No newline at end of file +?> Modified: trunk/src/phpfreechat.class.php =================================================================== --- trunk/src/phpfreechat.class.php 2007-07-30 13:12:30 UTC (rev 1061) +++ trunk/src/phpfreechat.class.php 2007-07-30 13:16:33 UTC (rev 1062) @@ -457,6 +457,7 @@ "Input Required", // _pfc "OK", // _pfc "Cancel", // _pfc + "You are trying to speak to a unknown (or not connected) user", // _pfc ); foreach($labels_to_load as $l) { @@ -566,4 +567,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-07-30 13:12:27
|
Revision: 1061 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1061&view=rev Author: kerphi Date: 2007-07-30 06:12:30 -0700 (Mon, 30 Jul 2007) Log Message: ----------- when the translation is not available, just display the initial string (key) arrounded with underscores (_) Modified Paths: -------------- trunk/data/public/js/pfcresource.js Modified: trunk/data/public/js/pfcresource.js =================================================================== --- trunk/data/public/js/pfcresource.js 2007-07-30 12:30:22 UTC (rev 1060) +++ trunk/data/public/js/pfcresource.js 2007-07-30 13:12:30 UTC (rev 1061) @@ -28,7 +28,7 @@ return String.sprintf2(this.getLabel.arguments); } else - return ""; + return '_'+key+'_'; }, setFileUrl: function(key, value) @@ -68,18 +68,3 @@ }; - - - - - - - - - - - - - - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-07-30 12:30:24
|
Revision: 1060 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1060&view=rev Author: kerphi Date: 2007-07-30 05:30:22 -0700 (Mon, 30 Jul 2007) Log Message: ----------- Remove useless instruction Modified Paths: -------------- trunk/src/pfctools.php Modified: trunk/src/pfctools.php =================================================================== --- trunk/src/pfctools.php 2007-07-30 10:36:58 UTC (rev 1059) +++ trunk/src/pfctools.php 2007-07-30 12:30:22 UTC (rev 1060) @@ -409,9 +409,7 @@ function flock_get_contents($filename, $mode = "rb") { $data = ''; - if (!file_exists($filename)) return $data; - - $fp = fopen( $filename, $mode ); + $fp = fopen( $filename, $mode ); if( $fp && flock( $fp, LOCK_SH ) ) { clearstatcache(); @@ -441,4 +439,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-07-30 10:36:56
|
Revision: 1059 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1059&view=rev Author: kerphi Date: 2007-07-30 03:36:58 -0700 (Mon, 30 Jul 2007) Log Message: ----------- Bug fix: fix alt img tags for smilies (thanks to Gerard Pinzone, sf patch 1762862) Modified Paths: -------------- trunk/data/public/js/pfcgui.js Modified: trunk/data/public/js/pfcgui.js =================================================================== --- trunk/data/public/js/pfcgui.js 2007-07-30 10:27:45 UTC (rev 1058) +++ trunk/data/public/js/pfcgui.js 2007-07-30 10:36:58 UTC (rev 1059) @@ -404,12 +404,13 @@ { s_url = sl[i]; s_symbol = smileys[sl[i]]; + s_symbol = s_symbol.unescapeHTML(); var img = document.createElement('img'); img.setAttribute('src', s_url); img.setAttribute('alt', s_symbol); img.setAttribute('title', s_symbol); - img.s_symbol = s_symbol.unescapeHTML(); + img.s_symbol = s_symbol; img.onclick = function(){ pfc.insertSmiley(this.s_symbol); } container.appendChild(img); container.appendChild(document.createTextNode(' ')); // so smileys will wrap fine if lot of smiles in theme. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-07-30 10:27:44
|
Revision: 1058 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1058&view=rev Author: kerphi Date: 2007-07-30 03:27:45 -0700 (Mon, 30 Jul 2007) Log Message: ----------- Bug fix: sometimes the messages ids are corrupted (thanks to Gerard Pinzone, sf patch 1762864) Modified Paths: -------------- trunk/src/pfctools.php Modified: trunk/src/pfctools.php =================================================================== --- trunk/src/pfctools.php 2007-07-27 07:30:58 UTC (rev 1057) +++ trunk/src/pfctools.php 2007-07-30 10:27:45 UTC (rev 1058) @@ -411,13 +411,13 @@ $data = ''; if (!file_exists($filename)) return $data; - $size = filesize($filename); - if ($size == 0) return $data; - $fp = fopen( $filename, $mode ); if( $fp && flock( $fp, LOCK_SH ) ) { - $data = fread( $fp, $size ); + clearstatcache(); + $size = filesize($filename); + if ($size > 0) + $data = fread( $fp, $size ); // flock($fp, LOCK_UN); // will be done by fclose } fclose( $fp ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-07-27 07:30:58
|
Revision: 1057 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1057&view=rev Author: kerphi Date: 2007-07-27 00:30:58 -0700 (Fri, 27 Jul 2007) Log Message: ----------- Allow unquotted reason for /kick and /ban commands (thanks to ljbuesch) http://www.phpfreechat.net/forum/viewtopic.php?id=1699 Modified Paths: -------------- trunk/src/commands/ban.class.php trunk/src/commands/kick.class.php Modified: trunk/src/commands/ban.class.php =================================================================== --- trunk/src/commands/ban.class.php 2007-07-23 10:21:38 UTC (rev 1056) +++ trunk/src/commands/ban.class.php 2007-07-27 07:30:58 UTC (rev 1057) @@ -21,6 +21,12 @@ $nick = isset($params[0]) ? $params[0] : ''; $reason = isset($params[1]) ? $params[1] : ''; if ($reason == '') $reason = _pfc("no reason"); + + // to allow unquotted reason + if (count($params) > 2) + for ($x=2;$x<count($params);$x++) + $reason.=" ".$params[$x]; + $channame = $u->channels[$recipientid]["name"]; if ($nick == '') Modified: trunk/src/commands/kick.class.php =================================================================== --- trunk/src/commands/kick.class.php 2007-07-23 10:21:38 UTC (rev 1056) +++ trunk/src/commands/kick.class.php 2007-07-27 07:30:58 UTC (rev 1057) @@ -22,6 +22,11 @@ $reason = isset($params[1]) ? $params[1] : ''; if ($reason == '') $reason = _pfc("no reason"); + // to allow unquotted reason + if (count($params) > 2) + for ($x=2;$x<count($params);$x++) + $reason.=" ".$params[$x]; + if ($nick == '') { // error This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-07-23 10:21:36
|
Revision: 1056 http://svn.sourceforge.net/phpfreechat/?rev=1056&view=rev Author: kerphi Date: 2007-07-23 03:21:38 -0700 (Mon, 23 Jul 2007) Log Message: ----------- Make possible to free the global config when using the pfcInfo API Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php trunk/src/pfcinfo.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2007-07-20 18:40:26 UTC (rev 1055) +++ trunk/src/pfcglobalconfig.class.php 2007-07-23 10:21:38 UTC (rev 1056) @@ -275,14 +275,16 @@ $this->nick = $this->filterNickname($this->nick); } - function &Instance( $params = array() ) + function &Instance( $params = array(), $destroy_instance = false ) { static $i; - if (!isset($i)) - $i = new pfcGlobalConfig( $params ); + if ($destroy_instance) + $i = NULL; + else + if (!isset($i)) + $i = new pfcGlobalConfig( $params ); return $i; } - /** * This function saves all the parameters types in order to check later if the types are ok Modified: trunk/src/pfcinfo.class.php =================================================================== --- trunk/src/pfcinfo.class.php 2007-07-20 18:40:26 UTC (rev 1055) +++ trunk/src/pfcinfo.class.php 2007-07-23 10:21:38 UTC (rev 1056) @@ -28,6 +28,12 @@ $this->c =& pfcGlobalConfig::Instance($params); } + function free() + { + // free the pfcglobalconfig instance + pfcGlobalConfig::Instance(array(), true); + } + /** * @return array(string) a list of errors */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-07-20 18:40:26
|
Revision: 1055 http://svn.sourceforge.net/phpfreechat/?rev=1055&view=rev Author: kerphi Date: 2007-07-20 11:40:26 -0700 (Fri, 20 Jul 2007) Log Message: ----------- Fix a possible warning Modified Paths: -------------- trunk/src/pfci18n.class.php Modified: trunk/src/pfci18n.class.php =================================================================== --- trunk/src/pfci18n.class.php 2007-07-20 13:46:58 UTC (rev 1054) +++ trunk/src/pfci18n.class.php 2007-07-20 18:40:26 UTC (rev 1055) @@ -25,7 +25,7 @@ function _pfc() { $args = func_get_args(); - $serverid = $GLOBALS['serverid']; // serverid is used to avoid conflicts with external code using same 'i18n' key + $serverid = isset($GLOBALS['serverid']) ? $GLOBALS['serverid'] : 0; // serverid is used to avoid conflicts with external code using same 'i18n' key $args[0] = isset($GLOBALS[$serverid]["i18n"][$args[0]]) && $GLOBALS[$serverid]["i18n"][$args[0]] != "" ? ($GLOBALS["output_encoding"] == "UTF-8" ? $GLOBALS[$serverid]["i18n"][$args[0]] : @@ -40,7 +40,7 @@ function _pfc2() { $args = func_get_args(); - $serverid = $GLOBALS['serverid']; // serverid is used to avoid conflicts with external code using same 'i18n' key + $serverid = isset($GLOBALS['serverid']) ? $GLOBALS['serverid'] : 0; // serverid is used to avoid conflicts with external code using same 'i18n' key $args[0] = isset($GLOBALS[$serverid]["i18n"][$args[0]]) && $GLOBALS[$serverid]["i18n"][$args[0]] != "" ? ($GLOBALS["output_encoding"] == "UTF-8" ? $GLOBALS[$serverid]["i18n"][$args[0]] : @@ -64,7 +64,7 @@ else require_once(dirname(__FILE__)."/../i18n/".$language."/main.php"); - $serverid = $GLOBALS['serverid']; // serverid is used to avoid conflicts with external code using same 'i18n' key + $serverid = isset($GLOBALS['serverid']) ? $GLOBALS['serverid'] : 0; // serverid is used to avoid conflicts with external code using same 'i18n' key $GLOBALS[$serverid]['i18n'] = $GLOBALS['i18n']; // do not pass by reference because $GLOBALS['i18n'] is maybe used by unknown external code $GLOBALS["output_encoding"] = "UTF-8"; // by default client/server communication is utf8 encoded @@ -192,4 +192,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. |