From c1049928146f44b3cabc02c425d858313c0c6970 Mon Sep 17 00:00:00 2001 From: andi Date: Fri, 18 Feb 2005 13:48:09 +0100 Subject: check for changes.log #136 darcs-hash:20050218124809-9977f-3622ad862b92942942f4f6b36eabb7ace2fa49c2.gz --- inc/common.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'inc') 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) -- cgit v1.2.3