$PerPage = POSTS_PER_PAGE; list($Page, $Limit) = Format::page_limit($PerPage); $CanEdit = check_perms('users_mod'); if ($CanEdit && isset($_POST['perform'])) { authorize(); if ($_POST['perform'] == 'add' && !empty($_POST['message'])) { $Message = db_string($_POST['message']); $Author = db_string($_POST['author']); $DB->query(" INSERT INTO changelog (Message, Author, Time) VALUES ('$Message', '$Author', NOW())"); $ID = $DB->inserted_id(); // SiteHistory::add_event(sqltime(), "Changelog $ID", "tools.php?action=change_log", 1, 3, "", $Message, $LoggedUser['ID']); } if ($_POST['perform'] == 'remove' && !empty($_POST['change_id'])) { $ID = (int) $_POST['change_id']; $DB->query(" DELETE FROM changelog WHERE ID = '$ID'"); } } $DB->query(" SELECT SQL_CALC_FOUND_ROWS ID, Message, Author, Date(Time) as Time FROM changelog ORDER BY ID DESC LIMIT $Limit"); $ChangeLog = $DB->to_array(); $DB->query('SELECT FOUND_ROWS()'); list($NumResults) = $DB->next_record(); View::show_header('Gazelle Change Log'); ?>