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 : */
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) {
global $variables;
return $variables->variable_get($name, $default, $createit_comment, $type);

View File

@ -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"),