[Phpfreechat-svn] SF.net SVN: phpfreechat: [1025] trunk/src
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2007-05-11 09:40:49
|
Revision: 1025 http://svn.sourceforge.net/phpfreechat/?rev=1025&view=rev Author: kerphi Date: 2007-05-11 02:40:49 -0700 (Fri, 11 May 2007) Log Message: ----------- [en] Integrate the user time zone contribution http://www.phpfreechat.net/forum/viewtopic.php?id=1508 (thanks to Peter's great work) [1h] [fr] Int?\195?\169gration de la contribution sur le param?\195?\169trage des fuseaux horaires utilisateurs http://www.phpfreechat.net/forum/viewtopic.php?id=1508 (merci ?\195?\160 Peter pour son tr?\195?\168s bon travail) [1h] Modified Paths: -------------- trunk/src/commands/getnewmsg.class.php trunk/src/pfccontainer.class.php trunk/src/pfcglobalconfig.class.php Modified: trunk/src/commands/getnewmsg.class.php =================================================================== --- trunk/src/commands/getnewmsg.class.php 2007-05-11 09:34:07 UTC (rev 1024) +++ trunk/src/commands/getnewmsg.class.php 2007-05-11 09:40:49 UTC (rev 1025) @@ -79,8 +79,8 @@ foreach ($data as $d) { $m_id = $d["id"]; - $m_date = $d["date"]; - $m_time = $d["time"]; + $m_date = gmdate($c->date_format, $d["timestamp"] + $c->time_offset); + $m_time = gmdate($c->time_format, $d["timestamp"] + $c->time_offset); $m_sender = $d["sender"]; $m_recipientid = $recipientid; $m_cmd = $d["cmd"]; @@ -92,8 +92,8 @@ $m_recipientid, $m_cmd, $m_param, - date("d/m/Y") == $m_date ? 1 : 0, - $oldmsg ? 1 : 0); + gmdate($c->date_format, time() + $c->time_offset) == $m_date ? 1 : 0, // posted today ? + $oldmsg ? 1 : 0); // is it a new message in the current session or is it a part of the history $data_sent = true; } if (count($js) != 0) Modified: trunk/src/pfccontainer.class.php =================================================================== --- trunk/src/pfccontainer.class.php 2007-05-11 09:34:07 UTC (rev 1024) +++ trunk/src/pfccontainer.class.php 2007-05-11 09:40:49 UTC (rev 1025) @@ -352,6 +352,7 @@ */ function isNickOnline($chan, $nickid) { + if (!$nickid) return false; if ($chan == NULL) $chan = 'SERVER'; $ret = $this->getMeta("channelid-to-nickid", @@ -380,8 +381,7 @@ // format message $data = "\n"; $data .= $msgid."\t"; - $data .= date("d/m/Y")."\t"; - $data .= date("H:i:s")."\t"; + $data .= time()."\t"; $data .= $nick."\t"; $data .= $cmd."\t"; $data .= $param; @@ -434,12 +434,11 @@ { $formated_line = explode( "\t", $line ); $data = array(); - $data["id"] = trim($formated_line[0]); - $data["date"] = $formated_line[1]; - $data["time"] = $formated_line[2]; - $data["sender"]= $formated_line[3]; - $data["cmd"] = $formated_line[4]; - $data["param"] = $formated_line[5]; + $data["id"] = trim($formated_line[0]); + $data["timestamp"] = $formated_line[1]; + $data["sender"] = $formated_line[2]; + $data["cmd"] = $formated_line[3]; + $data["param"] = $formated_line[4]; $datalist[$data["id"]] = $data; } } Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2007-05-11 09:34:07 UTC (rev 1024) +++ trunk/src/pfcglobalconfig.class.php 2007-05-11 09:40:49 UTC (rev 1025) @@ -133,6 +133,20 @@ var $debugxajax = false; /** + * This is the user time zone + * it is the difference in seconds between user clock and server clock + */ + var $time_offset = 0; + /** + * How to display the dates in the chat + */ + var $date_format = "d/m/Y"; + /** + * How to display the time in the chat + */ + var $time_format = "H:i:s"; + + /** * This parameter is useful when your chat server is behind a reverse proxy that * forward client ip address in HTTP_X_FORWARDED_FOR http header. * see : http://www.phpfreechat.net/forum/viewtopic.php?id=1344 @@ -142,7 +156,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"); + var $_dyn_params = array("nick","isadmin","islocked","admins","frozen_channels", "channels", "privmsg", "nickmeta","baseurl","time_offset","date_format","time_format"); var $_params_type = array(); var $_query_string = ''; @@ -266,7 +280,7 @@ 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 if (is_int($v) && $v>0) $this->_params_type["positivenumeric"][] = $k; else $this->_params_type["misc"][] = $k; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |