commit c4d12e43706d890a10d2265e06644dee00866c76 from: mischa date: Tue Sep 06 14:55:29 2022 UTC configurable LOG_SIZE to display commit - 191805fa2bbb70d3a6e466018bfd600d490937e6 commit + c4d12e43706d890a10d2265e06644dee00866c76 blob - d8500674a780d38362bc9b91687d976f4f3d07bf blob + b1b6d8ab92fe30fd0e693f63507307b0135ccd1e --- conf.php-sample +++ conf.php-sample @@ -34,6 +34,7 @@ define('VACATION', 'NO'); // Disable activity logging with 'NO" define('LOGGING', 'YES'); +define('LOG_SIZE', '25'); // Admin email for logging define('ADMIN_EMAIL', 'postmaster@example.tld'); blob - 76f006869fd14b0aa27676c93e0dc649bb77c3f0 blob + d6b0645c0314b15c02b7c52a98658234abbb6c3e --- languages/en.lang +++ languages/en.lang @@ -116,7 +116,7 @@ $LANG['Password_button'] = 'Change Password'; $LANG['Password_result_error'] = 'Unable to change your password.'; $LANG['Password_result_succes'] = 'Your password has been changed.'; -$LANG['Viewlog_welcome'] = 'View the last 10 actions for '; +$LANG['Viewlog_welcome'] = 'View the last actions for '; $LANG['Viewlog_timestamp'] = 'Timestamp'; $LANG['Viewlog_username'] = 'Admin'; $LANG['Viewlog_domain'] = 'Domain'; blob - ad221ee80ddcb546d74be85a016e81a9b17c5658 blob + 362f320bf5f5b25a8b07a12f10b933c33248803f --- templates/viewlog.tpl +++ templates/viewlog.tpl @@ -19,7 +19,7 @@ if (count($list_domains) > 0) { if (count($log ?? array()) > 0) { echo ""; echo ""; - echo ""; + echo ""; echo ""; echo ""; echo ""; blob - 61a57c5f2178b138120ad756fd0caf52059ace55 blob + affdb2b59f8df0794ac7d0ad40baedf4f880a75b --- viewlog.php +++ viewlog.php @@ -31,6 +31,7 @@ if ($ROLE == ADMIN_ROLE) { if ($_SERVER['REQUEST_METHOD'] == "GET") { $domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN); + $limit = LOG_SIZE; if (empty($domain) && count($list_domains) > 0) { $domain = $list_domains[0]['domain']; @@ -39,8 +40,9 @@ if ($_SERVER['REQUEST_METHOD'] == "GET") { if (in_array($domain, array_column($list_domains, 'domain'))) { $domain_key = array_search($domain, array_column($list_domains, 'domain')); $dbh = pdo_connect(); - $sth = $dbh->prepare("SELECT * FROM log WHERE domain=? ORDER BY timestamp DESC LIMIT 10"); + $sth = $dbh->prepare("SELECT * FROM log WHERE domain=? ORDER BY timestamp DESC LIMIT ?"); $sth->bindParam(1, $domain, PDO::PARAM_STR); + $sth->bindParam(2, $limit, PDO::PARAM_INT); $sth->execute(); $log = $sth->fetchAll(); }

" . $LANG['Viewlog_welcome'] . " " . $domain . "

" . $LANG['Viewlog_welcome'] . " " . $domain . " (". LOG_SIZE . ")

" . $LANG['Viewlog_timestamp'] . "