Simplifie la classe log

Fix #1553
This commit is contained in:
Alan Garcia 2014-02-28 15:25:07 +00:00
parent 4108189f4f
commit 822471cfa1
2 changed files with 13 additions and 19 deletions

View File

@ -30,11 +30,6 @@ mt_srand((float) $sec + ((float) $usec * 100000));
/* Format a field value for input or textarea : */ /* Format a field value for input or textarea : */
function fl($str) { return str_replace("<","&lt;",str_replace("\"","&quot;",$str)); } function fl($str) { return str_replace("<","&lt;",str_replace("\"","&quot;",$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) { function variable_get($name, $default = null, $createit_comment = null, $type=null) {
global $variables; global $variables;
return $variables->variable_get($name, $default, $createit_comment, $type); return $variables->variable_get($name, $default, $createit_comment, $type);

View File

@ -36,25 +36,24 @@ class m_log {
$err->log("log","list_logs_directory"); $err->log("log","list_logs_directory");
$c=array(); $c=array();
$dir2=$dir; foreach( glob("${dir}/*log*") as $absfile) {
if ($dir = @opendir($dir)) { $c[]=array("name"=>basename($absfile),
while (($file = readdir($dir)) !== false) { "creation_date"=>date("F d Y H:i:s.", filectime($absfile)),
if ($file!="." && $file!=".." && realpath($dir2 . "/" . $file) == $dir2 . "/" . $file){ "filesize"=>filesize($absfile),
$absfile=$dir2."/".$file; "downlink"=>"logs_download.php?file=".urlencode(basename($absfile)),
$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);
} }
usort($c,"compare_logname"); usort($c,"m_log::compare_logname");
return $c; return $c;
}//list_logs }//list_logs
// Used by list_logs_directory to sort
private function compare_logname($a, $b) {
return strcmp($a['name'],$b['name']);
}
function hook_menu() { function hook_menu() {
$obj = array( $obj = array(
'title' => _("Logs"), 'title' => _("Logs"),