[Phpfreechat-svn] SF.net SVN: phpfreechat: [723] trunk/src
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-09-02 20:15:12
|
Revision: 723 http://svn.sourceforge.net/phpfreechat/?rev=723&view=rev Author: kerphi Date: 2006-09-02 13:14:57 -0700 (Sat, 02 Sep 2006) Log Message: ----------- The proxy log data must be saved by default in the private directory Modified Paths: -------------- trunk/src/pfctools.php trunk/src/proxys/log.class.php Modified: trunk/src/pfctools.php =================================================================== --- trunk/src/pfctools.php 2006-09-01 15:11:27 UTC (rev 722) +++ trunk/src/pfctools.php 2006-09-02 20:14:57 UTC (rev 723) @@ -112,7 +112,7 @@ } -function mkdir_r($path, $modedir = 0700) +function mkdir_r($path, $modedir = 0775) { // This function creates the specified directory using mkdir(). Note // that the recursive feature on mkdir() is broken with PHP 5.0.4 for @@ -146,7 +146,7 @@ * @param string $dest Destination path * @return bool Returns TRUE on success, FALSE on failure */ -function copy_r($source, $dest, $modedir = 0755, $modefile = 0644) +function copy_r($source, $dest, $modedir = 0775, $modefile = 0664) { // Simple copy for a file if (is_file($source)) { Modified: trunk/src/proxys/log.class.php =================================================================== --- trunk/src/proxys/log.class.php 2006-09-01 15:11:27 UTC (rev 722) +++ trunk/src/proxys/log.class.php 2006-09-02 20:14:57 UTC (rev 723) @@ -43,23 +43,31 @@ $c =& $this->c; $u =& $this->u; - $logpath = ($c->proxys_cfg[$this->proxyname]["path"] == "" ? $c->data_public_path : - $c->proxys_cfg[$this->proxyname]["path"]); - $logfile = $logpath."/".$c->getId()."/chat.log"; - if (is_writable($logpath)) + $logpath = ($c->proxys_cfg[$this->proxyname]["path"] == "" ? $c->data_private_path."/logs" : + $c->proxys_cfg[$this->proxyname]["path"]); + $logpath .= "/".$c->getId(); + + if (!file_exists($logpath)) @mkdir_r($logpath); + if (file_exists($logpath) && is_writable($logpath)) { + $logfile = $logpath."/chat.log"; $f_exists = file_exists($logfile); if (($f_exists && is_writable($logpath)) || !$f_exists) { $fp = fopen($logfile, $f_exists ? 'a' : 'w'); // @todo write logs in a cleaner structured language (xml, html ... ?) - fwrite($fp, $recipient."\t".$sender."\t".$param."\n"); + $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); } } } - + // forward the command to the next proxy or to the final command $this->next->run($xml_reponse, $p); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |