diff --git a/inc/lib/Twig/Extensions/Extension/Tinyboard.php b/inc/lib/Twig/Extensions/Extension/Tinyboard.php index 4111fc3c..2691cc55 100644 --- a/inc/lib/Twig/Extensions/Extension/Tinyboard.php +++ b/inc/lib/Twig/Extensions/Extension/Tinyboard.php @@ -10,19 +10,21 @@ class Twig_Extensions_Extension_Tinyboard extends Twig_Extension public function getFilters() { return Array( - 'filesize' => new Twig_Filter_Function('format_bytes', Array('needs_environment' => false)), - 'truncate' => new Twig_Filter_Function('twig_truncate_filter', array('needs_environment' => false)), - 'truncate_body' => new Twig_Filter_Function('truncate', array('needs_environment' => false)), - 'extension' => new Twig_Filter_Function('twig_extension_filter', array('needs_environment' => false)), - 'sprintf' => new Twig_Filter_Function('sprintf', array('needs_environment' => false)), - 'capcode' => new Twig_Filter_Function('capcode', array('needs_environment' => false)), - 'hasPermission' => new Twig_Filter_Function('twig_hasPermission_filter', array('needs_environment' => false)), - 'date' => new Twig_Filter_Function('twig_date_filter', array('needs_environment' => false)), - 'poster_id' => new Twig_Filter_Function('poster_id', array('needs_environment' => false)), - 'remove_whitespace' => new Twig_Filter_Function('twig_remove_whitespace_filter', array('needs_environment' => false)), - 'count' => new Twig_Filter_Function('count', array('needs_environment' => false)), - 'ago' => new Twig_Filter_Function('ago', array('needs_environment' => false)), - 'until' => new Twig_Filter_Function('until', array('needs_environment' => false)) + 'filesize' => new Twig_Filter_Function('format_bytes'), + 'truncate' => new Twig_Filter_Function('twig_truncate_filter'), + 'truncate_body' => new Twig_Filter_Function('truncate'), + 'extension' => new Twig_Filter_Function('twig_extension_filter'), + 'sprintf' => new Twig_Filter_Function('sprintf'), + 'capcode' => new Twig_Filter_Function('capcode'), + 'hasPermission' => new Twig_Filter_Function('twig_hasPermission_filter'), + 'date' => new Twig_Filter_Function('twig_date_filter'), + 'poster_id' => new Twig_Filter_Function('poster_id'), + 'remove_whitespace' => new Twig_Filter_Function('twig_remove_whitespace_filter'), + 'count' => new Twig_Filter_Function('count'), + 'ago' => new Twig_Filter_Function('ago'), + 'until' => new Twig_Filter_Function('until'), + 'split' => new Twig_Filter_Function('twig_split_filter'), + 'push' => new Twig_Filter_Function('twig_push_filter'), ); } @@ -34,10 +36,10 @@ class Twig_Extensions_Extension_Tinyboard extends Twig_Extension public function getFunctions() { return Array( - 'time' => new Twig_Filter_Function('time', array('needs_environment' => false)), - 'timezone' => new Twig_Filter_Function('twig_timezone_function', array('needs_environment' => false)), - 'hiddenInputs' => new Twig_Filter_Function('hiddenInputs', array('needs_environment' => false)), - 'hiddenInputsHash' => new Twig_Filter_Function('hiddenInputsHash', array('needs_environment' => false)) + 'time' => new Twig_Filter_Function('time'), + 'timezone' => new Twig_Filter_Function('twig_timezone_function'), + 'hiddenInputs' => new Twig_Filter_Function('hiddenInputs'), + 'hiddenInputsHash' => new Twig_Filter_Function('hiddenInputsHash'), ); } @@ -57,6 +59,15 @@ function twig_timezone_function() { return sprintf("%s%02d", ($hr = (int)floor(($tz = date('Z')) / 3600)) > 0 ? '+' : '-', abs($hr)) . ':' . sprintf("%02d", (($tz / 3600) - $hr) * 60); } +function twig_split_filter($str, $delim) { + return explode($delim, $str); +} + +function twig_push_filter($array, $value) { + array_push($array, $value); + return $array; +} + function twig_remove_whitespace_filter($data) { return preg_replace('/[\t\r\n]/', '', $data); } diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 942cfd50..2b5487fd 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -250,3 +250,15 @@ function mod_delete($board, $post) { header('Location: ?/' . sprintf($config['board_path'], $board) . $config['file_index'], true, $config['redirect_http']); } +function mod_users() { + global $config; + if(!hasPermission($config['mod']['manageusers'])) + error($config['error']['noaccess']); + + $args = array(); + $query = query("SELECT *, (SELECT `time` FROM `modlogs` WHERE `mod` = `id` ORDER BY `time` DESC LIMIT 1) AS `last`, (SELECT `text` FROM `modlogs` WHERE `mod` = `id` ORDER BY `time` DESC LIMIT 1) AS `action` FROM `mods` ORDER BY `type` DESC,`id`") or error(db_error()); + $args['users'] = $query->fetchAll(PDO::FETCH_ASSOC); + + mod_page("Manage users", 'mod/users.html', $args); +} + diff --git a/mod.php b/mod.php index 3aba6fe4..d95f9552 100644 --- a/mod.php +++ b/mod.php @@ -23,10 +23,12 @@ $query = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''; $pages = array( '!^$!' => ':?/', // redirect to dashboard '!^/$!' => 'dashboard', // dashboard + '!^/confirm/(.+)$!' => 'confirm', // confirm action (if javascript didn't work) '!^/log$!' => 'log', // modlog '!^/log/(\d+)$!' => 'log', // modlog + + '!^/users$!' => 'users', // manage users - '!^/confirm/(.+)$!' => 'confirm', // confirm action (if javascript didn't work) '!^/ban$!' => 'ban', // new ban '!^/IP/([\w.:]+)$!' => 'ip', // view ip address diff --git a/templates/mod/log.html b/templates/mod/log.html index fe1c5c1f..61243202 100644 --- a/templates/mod/log.html +++ b/templates/mod/log.html @@ -31,9 +31,11 @@ {% endfor %} -
- {% for i in range(0, count / config.mod.modlog_page) %} - [{{ i + 1 }}] - {% endfor %} -
+{% if count > logs|count %} ++ {% for i in range(0, count / config.mod.modlog_page) %} + [{{ i + 1 }}] + {% endfor %} +
+{% endif %}