diff options
author | andi <andi@splitbrain.org> | 2005-02-18 13:48:09 +0100 |
---|---|---|
committer | andi <andi@splitbrain.org> | 2005-02-18 13:48:09 +0100 |
commit | c1049928146f44b3cabc02c425d858313c0c6970 (patch) | |
tree | 5ef2624470a9a56248b60382f84de7617778d66d /inc | |
parent | 8196db7bfdc38ec80fe16c5a30601198ff16e671 (diff) | |
download | rpg-c1049928146f44b3cabc02c425d858313c0c6970.tar.gz rpg-c1049928146f44b3cabc02c425d858313c0c6970.tar.bz2 |
check for changes.log #136
darcs-hash:20050218124809-9977f-3622ad862b92942942f4f6b36eabb7ace2fa49c2.gz
Diffstat (limited to 'inc')
-rw-r--r-- | inc/common.php | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/inc/common.php b/inc/common.php index afff702d2..2e146d485 100644 --- a/inc/common.php +++ b/inc/common.php @@ -662,13 +662,20 @@ function dbg($msg,$hidden=false){ */ function addLogEntry($date,$id,$summary=""){ global $conf; - $id = cleanID($id); + $id = cleanID($id);//FIXME not needed anymore? + + if(!@is_writable($conf['changelog'])){ + msg($conf['changelog'].' is not writable!',-1); + return; + } + if(!$date) $date = time(); //use current time if none supplied $remote = $_SERVER['REMOTE_ADDR']; $user = $_SERVER['REMOTE_USER']; $logline = join("\t",array($date,$remote,$id,$user,$summary))."\n"; + //FIXME: use adjusted io_saveFile instead $fh = fopen($conf['changelog'],'a'); if($fh){ fwrite($fh,$logline); @@ -687,6 +694,11 @@ function getRecents($num=0,$incdel=false){ $recent = array(); if(!$num) $num = $conf['recent']; + if(!@is_readable($conf['changelog'])){ + msg($conf['changelog'].' is not readable',-1); + return $recent; + } + $loglines = file($conf['changelog']); rsort($loglines); //reverse sort on timestamp @@ -720,6 +732,11 @@ function getRecents($num=0,$incdel=false){ */ function getRevisionInfo($id,$rev){ global $conf; + $info = array(); + if(!@is_readable($conf['changelog'])){ + msg($conf['changelog'].' is not readable',-1); + return $recent; + } $loglines = file($conf['changelog']); $loglines = preg_grep("/$rev\t\d+\.\d+\.\d+\.\d+\t$id\t/",$loglines); rsort($loglines); //reverse sort on timestamp (shouldn't be needed) |