configurable LOG_SIZE to display
This commit is contained in:
parent
191805fa2b
commit
c4d12e4370
|
@ -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');
|
||||
|
|
|
@ -116,7 +116,7 @@ $LANG['Password_button'] = 'Change Password';
|
|||
$LANG['Password_result_error'] = '<span class="error_msg">Unable to change your password.</span>';
|
||||
$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';
|
||||
|
|
|
@ -19,7 +19,7 @@ if (count($list_domains) > 0) {
|
|||
if (count($log ?? array()) > 0) {
|
||||
echo "<table id=\"log_table\">";
|
||||
echo "<tr>";
|
||||
echo "<td colspan=\"5\"><h3>" . $LANG['Viewlog_welcome'] . " " . $domain . "</h3></td>";
|
||||
echo "<td colspan=\"5\"><h3>" . $LANG['Viewlog_welcome'] . " " . $domain . " (". LOG_SIZE . ")</h3></td>";
|
||||
echo "</tr>";
|
||||
echo "<tr class=\"header\">";
|
||||
echo "<td>" . $LANG['Viewlog_timestamp'] . "</td>";
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue