diff --git a/system/pages/admin/logs.php b/system/pages/admin/logs.php
index 1913edf0..f7c0e6d8 100644
--- a/system/pages/admin/logs.php
+++ b/system/pages/admin/logs.php
@@ -8,108 +8,74 @@
* @link https://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
-$title = 'Logs viewer';
-?>
+$title = 'Logs Viewer';
-
-
-
-
-
-
-
-
- Log name |
- Last updated |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
- Log name |
- Last updated |
-
-
-
-
-
-
+ $files[] = array($f, $server_path_logs);
+ }
+}
-display('admin.logs.html.twig', array('files' => $files));
+
+define('EXIST_NONE', 0);
+define('EXIST_SERVER_LOG', 1);
+define('EXIST_AAC_LOG', 2);
+
+$exist = EXIST_NONE;
+$file = isset($_GET['file']) ? $_GET['file'] : null;
if (!empty($file)) {
if (!preg_match('/[^A-z0-9\' _\/\-\.]/', $file)) {
if (file_exists($aac_path_logs . $file)) {
- echo '
-
-
-
';
- echo nl2br(file_get_contents($aac_path_logs . $file));
- echo '
-
';
+ $exist = EXIST_AAC_LOG;
} else if (file_exists($server_path_logs . $file)) {
- echo '';
- echo nl2br(file_get_contents($server_path_logs . $file));
- echo '
';
- } else
+ $exist = EXIST_SERVER_LOG;
+ } else {
echo 'Specified file does not exist.';
- } else
+ }
+
+ if ($exist !== EXIST_NONE) {
+ $content = nl2br(file_get_contents(($exist === EXIST_SERVER_LOG ? $server_path_logs : $aac_path_logs) . $file));
+ $twig->display('admin.logs.view.html.twig', array('file' => $file, 'content' => $content));
+ }
+ } else {
echo 'Invalid file name specified.';
-}
-?>
-
\ No newline at end of file
+ }
+}
\ No newline at end of file
diff --git a/system/pages/admin/reports.php b/system/pages/admin/reports.php
index 46daf543..821656b2 100644
--- a/system/pages/admin/reports.php
+++ b/system/pages/admin/reports.php
@@ -8,84 +8,54 @@
* @link https://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
-$title = 'Report viewer';
-?>
+$title = 'Report Viewer';
-
-
-
-
-
-
-
-
- Report name |
- Last updated |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
-
+ $files[] = array($f, $server_path_reports);
+ }
+}
+
+foreach ($files as &$f) {
+ $f['mtime'] = filemtime($f[1] . $f[0]);
+ $f['name'] = $f[0];
+}
+
+unset($f);
+
+$twig->display('admin.reports.html.twig', array('files' => $files));
-';
- echo nl2br(file_get_contents($server_path_reports . $file));
- echo '
';
- } else
- echo 'Specified file does not exist.';
- } else
- echo 'Invalid file name specified.';
-}
-?>
-
\ No newline at end of file
+ $twig->display('admin.logs.view.html.twig', array('file' => $file, 'content' => $content));
+ } else {
+ echo 'Specified file does not exist.';
+ }
+ } else {
+ echo 'Invalid file name specified.';
+ }
+}
\ No newline at end of file
diff --git a/system/templates/admin.logs.html.twig b/system/templates/admin.logs.html.twig
new file mode 100644
index 00000000..9c47bf6a
--- /dev/null
+++ b/system/templates/admin.logs.html.twig
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+ Log name |
+ Last updated |
+
+
+
+ {% for file in files %}
+
+
+ {{ file.name }}
+ |
+ {{ file.mtime|date('Y-m-d H:i:s') }} |
+
+ {% endfor %}
+
+
+
+ Log name |
+ Last updated |
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/system/templates/admin.logs.view.html.twig b/system/templates/admin.logs.view.html.twig
new file mode 100644
index 00000000..ae7ab9e2
--- /dev/null
+++ b/system/templates/admin.logs.view.html.twig
@@ -0,0 +1,8 @@
+
+
+
+ {{ content|raw }}
+
+
\ No newline at end of file
diff --git a/system/templates/admin.reports.html.twig b/system/templates/admin.reports.html.twig
new file mode 100644
index 00000000..bec8281e
--- /dev/null
+++ b/system/templates/admin.reports.html.twig
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+ Report name |
+ Last updated |
+
+
+
+ {% for file in files %}
+
+
+ {{ file.name }}
+ |
+ {{ file.mtime|date('Y-m-d H:i:s') }} |
+
+ {% endfor %}
+
+
+
+ Report name |
+ Last updated |
+
+
+
+
+
+
+
+
\ No newline at end of file