diff --git a/plugins/dynamix/NotificationsArchive.page b/plugins/dynamix/NotificationsArchive.page index eb73691eb..5bd8bf2d5 100644 --- a/plugins/dynamix/NotificationsArchive.page +++ b/plugins/dynamix/NotificationsArchive.page @@ -29,7 +29,7 @@ i.red-text{font-size:1.6rem} - +
_(Time)__(Event)__(Subject)__(Description)__(Importance)_
_(Wait)_
diff --git a/plugins/dynamix/include/DeleteLogFile.php b/plugins/dynamix/include/DeleteLogFile.php index 01a97e2f5..99c2d0dd7 100644 --- a/plugins/dynamix/include/DeleteLogFile.php +++ b/plugins/dynamix/include/DeleteLogFile.php @@ -15,20 +15,26 @@ $docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp'; require_once "$docroot/webGui/include/Wrappers.php"; $dynamix = parse_plugin_cfg('dynamix',true); +$unread = $dynamix['notify']['path']."/unread/"; $archive = $dynamix['notify']['path']."/archive"; $log = $_POST['log']??''; $filter = $_POST['filter']??false; $files = strpos($log,'*')===false ? [realpath("$archive/$log")] : glob("$archive/$log",GLOB_NOSORT); +function delete_file(...$file) { + array_map('unlink',array_filter($file,'file_exists')); +} + foreach ($files as $file) { // check file path if (strncmp($file,$archive,strlen($archive))!==0) continue; + $list = $unread.basename($file); if (!$filter) { // delete all files - @unlink($file); + delete_file($file,$list); } else { // delete selective files - if (exec("grep -om1 'importance=$filter' ".escapeshellarg($file))) @unlink($file); + if (exec("grep -om1 'importance=$filter' ".escapeshellarg($file))) delete_file($file,$list); } } ?> diff --git a/plugins/dynamix/include/NotificationsArchive.php b/plugins/dynamix/include/NotificationsArchive.php index 25a03d139..3437f0d1f 100644 --- a/plugins/dynamix/include/NotificationsArchive.php +++ b/plugins/dynamix/include/NotificationsArchive.php @@ -49,6 +49,6 @@ foreach ($files as $file) { $row++; } } -if ($rows==0) echo ""._("No notifications present").""; +if ($rows==0) echo "
"._("No notifications present")."
"; echo "\0$rows"; ?>