diff --git a/bureau/class/functions.php b/bureau/class/functions.php index 306e2ba6..906ca090 100644 --- a/bureau/class/functions.php +++ b/bureau/class/functions.php @@ -30,11 +30,6 @@ mt_srand((float) $sec + ((float) $usec * 100000)); /* Format a field value for input or textarea : */ function fl($str) { return str_replace("<","<",str_replace("\"",""",$str)); } -/* Used by class/m_log.php for usort */ -function compare_logname($a, $b) { - return strcmp($a['name'],$b['name']); -} - function variable_get($name, $default = null, $createit_comment = null, $type=null) { global $variables; return $variables->variable_get($name, $default, $createit_comment, $type); diff --git a/bureau/class/m_log.php b/bureau/class/m_log.php index 61997a63..a4b5dafa 100644 --- a/bureau/class/m_log.php +++ b/bureau/class/m_log.php @@ -36,25 +36,24 @@ class m_log { $err->log("log","list_logs_directory"); $c=array(); - $dir2=$dir; - if ($dir = @opendir($dir)) { - while (($file = readdir($dir)) !== false) { - if ($file!="." && $file!=".." && realpath($dir2 . "/" . $file) == $dir2 . "/" . $file){ - $absfile=$dir2."/".$file; - $c[]=array("name"=>$file, - "creation_date"=>date("F d Y H:i:s.", filectime($absfile)), - "filesize"=>filesize($absfile), - "downlink"=>"logs_download.php?file=".urlencode($file), - ); - } - } - closedir($dir); + foreach( glob("${dir}/*log*") as $absfile) { + $c[]=array("name"=>basename($absfile), + "creation_date"=>date("F d Y H:i:s.", filectime($absfile)), + "filesize"=>filesize($absfile), + "downlink"=>"logs_download.php?file=".urlencode(basename($absfile)), + ); } - usort($c,"compare_logname"); + usort($c,"m_log::compare_logname"); return $c; }//list_logs + // Used by list_logs_directory to sort + private function compare_logname($a, $b) { + return strcmp($a['name'],$b['name']); + } + + function hook_menu() { $obj = array( 'title' => _("Logs"),