mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-02-03 05:17:15 +01:00
commit
77555e3c58
@ -1410,9 +1410,7 @@
|
||||
$config['mod']['groups'] = array(
|
||||
10 => 'Janitor',
|
||||
20 => 'Mod',
|
||||
30 => 'Admin',
|
||||
// 98 => 'God',
|
||||
99 => 'Disabled'
|
||||
30 => 'Admin'
|
||||
);
|
||||
|
||||
// If you add stuff to the above, you'll need to call this function immediately after.
|
||||
|
@ -3646,127 +3646,3 @@ function mod_pages($board = false) {
|
||||
|
||||
mod_page(_('Pages'), 'mod/pages.html', array('pages' => $pages, 'token' => make_secure_link_token('edit_pages' . ($board ? ('/' . $board) : '')), 'board' => $board));
|
||||
}
|
||||
|
||||
function mod_debug_antispam() {
|
||||
global $pdo, $config;
|
||||
|
||||
if (!hasPermission($config['mod']['debug_antispam']))
|
||||
error($config['error']['noaccess']);
|
||||
|
||||
$args = array();
|
||||
|
||||
if (isset($_POST['board'], $_POST['thread'])) {
|
||||
$where = '`board` = ' . $pdo->quote($_POST['board']);
|
||||
if ($_POST['thread'] != '')
|
||||
$where .= ' AND `thread` = ' . $pdo->quote($_POST['thread']);
|
||||
|
||||
if (isset($_POST['purge'])) {
|
||||
$query = prepare(', DATE ``antispam`` SET `expires` = UNIX_TIMESTAMP() + :expires WHERE' . $where);
|
||||
$query->bindValue(':expires', $config['spam']['hidden_inputs_expire']);
|
||||
$query->execute() or error(db_error());
|
||||
}
|
||||
|
||||
$args['board'] = $_POST['board'];
|
||||
$args['thread'] = $_POST['thread'];
|
||||
} else {
|
||||
$where = '';
|
||||
}
|
||||
|
||||
$query = query('SELECT COUNT(*) FROM ``antispam``' . ($where ? " WHERE $where" : '')) or error(db_error());
|
||||
$args['total'] = number_format($query->fetchColumn());
|
||||
|
||||
$query = query('SELECT COUNT(*) FROM ``antispam`` WHERE `expires` IS NOT NULL' . ($where ? " AND $where" : '')) or error(db_error());
|
||||
$args['expiring'] = number_format($query->fetchColumn());
|
||||
|
||||
$query = query('SELECT * FROM ``antispam`` ' . ($where ? "WHERE $where" : '') . ' ORDER BY `passed` DESC LIMIT 40') or error(db_error());
|
||||
$args['top'] = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
$query = query('SELECT * FROM ``antispam`` ' . ($where ? "WHERE $where" : '') . ' ORDER BY `created` DESC LIMIT 20') or error(db_error());
|
||||
$args['recent'] = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
mod_page(_('Debug: Anti-spam'), 'mod/debug/antispam.html', $args);
|
||||
}
|
||||
|
||||
function mod_debug_recent_posts() {
|
||||
global $pdo, $config;
|
||||
|
||||
if (!hasPermission($config['mod']['debug_recent']))
|
||||
error($config['error']['noaccess']);
|
||||
|
||||
$limit = 500;
|
||||
|
||||
$boards = listBoards();
|
||||
|
||||
// Manually build an SQL query
|
||||
$query = 'SELECT * FROM (';
|
||||
foreach ($boards as $board) {
|
||||
$query .= sprintf('SELECT *, %s AS `board` FROM ``posts_%s`` UNION ALL ', $pdo->quote($board['uri']), $board['uri']);
|
||||
}
|
||||
// Remove the last "UNION ALL" seperator and complete the query
|
||||
$query = preg_replace('/UNION ALL $/', ') AS `all_posts` ORDER BY `time` DESC LIMIT ' . $limit, $query);
|
||||
$query = query($query) or error(db_error());
|
||||
$posts = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
// Fetch recent posts from flood prevention cache
|
||||
$query = query("SELECT * FROM ``flood`` ORDER BY `time` DESC") or error(db_error());
|
||||
$flood_posts = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
foreach ($posts as &$post) {
|
||||
$post['snippet'] = pm_snippet($post['body']);
|
||||
foreach ($flood_posts as $flood_post) {
|
||||
if ($flood_post['time'] == $post['time'] &&
|
||||
$flood_post['posthash'] == make_comment_hex($post['body_nomarkup']) &&
|
||||
$flood_post['filehash'] == $post['filehash'])
|
||||
$post['in_flood_table'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
mod_page(_('Debug: Recent posts'), 'mod/debug/recent_posts.html', array('posts' => $posts, 'flood_posts' => $flood_posts));
|
||||
}
|
||||
|
||||
function mod_debug_sql() {
|
||||
global $config;
|
||||
|
||||
if (!hasPermission($config['mod']['debug_sql']))
|
||||
error($config['error']['noaccess']);
|
||||
|
||||
$args['security_token'] = make_secure_link_token('debug/sql');
|
||||
|
||||
if (isset($_POST['query'])) {
|
||||
$args['query'] = $_POST['query'];
|
||||
if ($query = query($_POST['query'])) {
|
||||
$args['result'] = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||
if (!empty($args['result']))
|
||||
$args['keys'] = array_keys($args['result'][0]);
|
||||
else
|
||||
$args['result'] = 'empty';
|
||||
} else {
|
||||
$args['error'] = db_error();
|
||||
}
|
||||
}
|
||||
|
||||
mod_page(_('Debug: SQL'), 'mod/debug/sql.html', $args);
|
||||
}
|
||||
|
||||
function mod_debug_apc() {
|
||||
global $config;
|
||||
|
||||
if (!hasPermission($config['mod']['debug_apc']))
|
||||
error($config['error']['noaccess']);
|
||||
|
||||
if ($config['cache']['enabled'] != 'apc')
|
||||
error('APC is not enabled.');
|
||||
|
||||
$cache_info = apc_cache_info('user');
|
||||
|
||||
// $cached_vars = new APCIterator('user', '/^' . $config['cache']['prefix'] . '/');
|
||||
$cached_vars = array();
|
||||
foreach ($cache_info['cache_list'] as $var) {
|
||||
if ($config['cache']['prefix'] != '' && strpos(isset($var['key']) ? $var['key'] : $var['info'], $config['cache']['prefix']) !== 0)
|
||||
continue;
|
||||
$cached_vars[] = $var;
|
||||
}
|
||||
|
||||
mod_page(_('Debug: APC'), 'mod/debug/apc.html', array('cached_vars' => $cached_vars));
|
||||
}
|
||||
|
||||
|
8
mod.php
8
mod.php
@ -104,13 +104,7 @@ $pages = array(
|
||||
|
||||
'/config' => 'secure_POST config', // config editor
|
||||
'/config/(\%b)' => 'secure_POST config', // config editor
|
||||
|
||||
// these pages aren't listed in the dashboard without $config['debug']
|
||||
'/debug/antispam' => 'debug_antispam',
|
||||
'/debug/recent' => 'debug_recent_posts',
|
||||
'/debug/apc' => 'debug_apc',
|
||||
'/debug/sql' => 'secure_POST debug_sql',
|
||||
|
||||
|
||||
// This should always be at the end:
|
||||
'/(\%b)/?' => 'view_board',
|
||||
'/(\%b)/' . preg_quote($config['file_index'], '!') => 'view_board',
|
||||
|
Loading…
x
Reference in New Issue
Block a user