2005-02-11
straider
If the change log file pointed by $conf['changelog']) doesn't exist, then several warning messages are displayed, causing some minor screen disruption. I had to tweak these functions, in inc/common.php:
<code php>
function getRecents($num=0,$incdel=false){
global $conf;
$recent = array();
if(!$num) $num = $conf['recent'];
// DWD Modify -> Change: Fix bug when changelog doesn't exist.
if(@file_exists($conf['changelog'])) {
$loglines = file($conf['changelog']);
rsort($loglines); //reverse sort on timestamp
foreach ($loglines as $line){
$line = rtrim($line); //remove newline
if(empty($line)) continue; //skip empty lines
$info = split("\\t",$line); //split into parts
//add id if not in yet and file still exists and is allowed to read
if(!$recent[$info[2]] &&
(@file_exists(wikiFN($info[2])) || $incdel) &&
(auth_quickaclcheck($info[2]) >= AUTH_READ)
){
$recent[$info[2]]['date'] = $info[0];
$recent[$info[2]]['ip'] = $info[1];
$recent[$info[2]]['user'] = $info[3];
$recent[$info[2]]['sum'] = $info[4];
$recent[$info[2]]['del'] = !@file_exists(wikiFN($info[2]));
}
if(count($recent) >= $num){
break; //finish if enough items found
}
}
}
// DWD Modify End.
return $recent;
}
function getRevisionInfo($id,$rev){
global $conf;
// DWD Modify -> Change: Fix bug when changelog doesn't exist.
if(@file_exists($conf['changelog'])) {
$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)
$line = split("\\t",$loglines[0]);
$info['date'] = $line[0];
$info['ip'] = $line[1];
$info['user'] = $line[3];
$info['sum'] = $line[4];
}
// DWD Modify End.
return $info;
}
</code>