mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-30 18:24:29 +01:00
?/users (user list)
This commit is contained in:
parent
d1876a0dd6
commit
761cb4feab
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
4
mod.php
4
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
|
||||
|
||||
'!^/confirm/(.+)$!' => 'confirm', // confirm action (if javascript didn't work)
|
||||
'!^/users$!' => 'users', // manage users
|
||||
|
||||
|
||||
'!^/ban$!' => 'ban', // new ban
|
||||
'!^/IP/([\w.:]+)$!' => 'ip', // view ip address
|
||||
|
@ -31,9 +31,11 @@
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
<p class="unimportant" style="text-align:center;word-wrap:break-word">
|
||||
{% if count > logs|count %}
|
||||
<p class="unimportant" style="text-align:center;word-wrap:break-word">
|
||||
{% for i in range(0, count / config.mod.modlog_page) %}
|
||||
<a href="?/log/{{ i + 1 }}">[{{ i + 1 }}]</a>
|
||||
{% endfor %}
|
||||
</p>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user