?/deletefile
This commit is contained in:
parent
2a301de29f
commit
19ea6e3d44
@ -85,6 +85,9 @@ function mod_dashboard() {
|
|||||||
function mod_noticeboard($page_no = 1) {
|
function mod_noticeboard($page_no = 1) {
|
||||||
global $config, $pdo, $mod;
|
global $config, $pdo, $mod;
|
||||||
|
|
||||||
|
if ($page_no < 1)
|
||||||
|
error($config['error']['404']);
|
||||||
|
|
||||||
if (!hasPermission($config['mod']['noticeboard']))
|
if (!hasPermission($config['mod']['noticeboard']))
|
||||||
error($config['error']['noaccess']);
|
error($config['error']['noaccess']);
|
||||||
|
|
||||||
@ -113,7 +116,7 @@ function mod_noticeboard($page_no = 1) {
|
|||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
$noticeboard = $query->fetchAll(PDO::FETCH_ASSOC);
|
$noticeboard = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
if (empty($noticeboard))
|
if (empty($noticeboard) && $page_no > 1)
|
||||||
error($config['error']['404']);
|
error($config['error']['404']);
|
||||||
|
|
||||||
$query = prepare("SELECT COUNT(*) FROM `noticeboard`");
|
$query = prepare("SELECT COUNT(*) FROM `noticeboard`");
|
||||||
@ -126,6 +129,9 @@ function mod_noticeboard($page_no = 1) {
|
|||||||
function mod_log($page_no = 1) {
|
function mod_log($page_no = 1) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
if ($page_no < 1)
|
||||||
|
error($config['error']['404']);
|
||||||
|
|
||||||
if (!hasPermission($config['mod']['modlog']))
|
if (!hasPermission($config['mod']['modlog']))
|
||||||
error($config['error']['noaccess']);
|
error($config['error']['noaccess']);
|
||||||
|
|
||||||
@ -135,7 +141,7 @@ function mod_log($page_no = 1) {
|
|||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
$logs = $query->fetchAll(PDO::FETCH_ASSOC);
|
$logs = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
if (empty($logs))
|
if (empty($logs) && $page_no > 1)
|
||||||
error($config['error']['404']);
|
error($config['error']['404']);
|
||||||
|
|
||||||
$query = prepare("SELECT COUNT(*) FROM `modlogs`");
|
$query = prepare("SELECT COUNT(*) FROM `modlogs`");
|
||||||
@ -308,6 +314,9 @@ function mod_ban() {
|
|||||||
function mod_bans($page_no = 1) {
|
function mod_bans($page_no = 1) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
if ($page_no < 1)
|
||||||
|
error($config['error']['404']);
|
||||||
|
|
||||||
if (!hasPermission($config['mod']['view_banlist']))
|
if (!hasPermission($config['mod']['view_banlist']))
|
||||||
error($config['error']['noaccess']);
|
error($config['error']['noaccess']);
|
||||||
|
|
||||||
@ -344,7 +353,7 @@ function mod_bans($page_no = 1) {
|
|||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
$bans = $query->fetchAll(PDO::FETCH_ASSOC);
|
$bans = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
if (empty($bans))
|
if (empty($bans) && $page_no > 1)
|
||||||
error($config['error']['404']);
|
error($config['error']['404']);
|
||||||
|
|
||||||
$query = prepare("SELECT COUNT(*) FROM `bans`");
|
$query = prepare("SELECT COUNT(*) FROM `bans`");
|
||||||
@ -505,6 +514,26 @@ function mod_delete($board, $post) {
|
|||||||
header('Location: ?/' . sprintf($config['board_path'], $board) . $config['file_index'], true, $config['redirect_http']);
|
header('Location: ?/' . sprintf($config['board_path'], $board) . $config['file_index'], true, $config['redirect_http']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function mod_deletefile($board, $post) {
|
||||||
|
global $config, $mod;
|
||||||
|
|
||||||
|
if (!openBoard($board))
|
||||||
|
error($config['error']['noboard']);
|
||||||
|
|
||||||
|
if (!hasPermission($config['mod']['deletefile'], $board))
|
||||||
|
error($config['error']['noaccess']);
|
||||||
|
|
||||||
|
// Delete file
|
||||||
|
deleteFile($post);
|
||||||
|
// Record the action
|
||||||
|
modLog("Deleted file from post #{$post}");
|
||||||
|
// Rebuild board
|
||||||
|
buildIndex();
|
||||||
|
|
||||||
|
// Redirect
|
||||||
|
header('Location: ?/' . sprintf($config['board_path'], $board) . $config['file_index'], true, $config['redirect_http']);
|
||||||
|
}
|
||||||
|
|
||||||
function mod_user($uid) {
|
function mod_user($uid) {
|
||||||
global $config, $mod;
|
global $config, $mod;
|
||||||
|
|
||||||
@ -699,6 +728,11 @@ function mod_rebuild() {
|
|||||||
$rebuilt_scripts = array();
|
$rebuilt_scripts = array();
|
||||||
|
|
||||||
if (isset($_POST['rebuild_cache'])) {
|
if (isset($_POST['rebuild_cache'])) {
|
||||||
|
if ($config['cache']['enabled']) {
|
||||||
|
$log[] = 'Flushing cache';
|
||||||
|
Cache::flush();
|
||||||
|
}
|
||||||
|
|
||||||
$log[] = 'Clearing template cache';
|
$log[] = 'Clearing template cache';
|
||||||
load_twig();
|
load_twig();
|
||||||
$twig->clearCacheFiles();
|
$twig->clearCacheFiles();
|
||||||
|
1
mod.php
1
mod.php
@ -47,6 +47,7 @@ $pages = array(
|
|||||||
|
|
||||||
'!^/(\w+)/delete/(\d+)$!' => 'delete', // delete post
|
'!^/(\w+)/delete/(\d+)$!' => 'delete', // delete post
|
||||||
'!^/(\w+)/ban(&delete)?/(\d+)$!' => 'ban_post', // ban poster
|
'!^/(\w+)/ban(&delete)?/(\d+)$!' => 'ban_post', // ban poster
|
||||||
|
'!^/(\w+)/deletefile/(\d+)$!' => 'deletefile', // delete file from post
|
||||||
'!^/(\w+)/(un)?lock/(\d+)$!' => 'lock', // lock thread
|
'!^/(\w+)/(un)?lock/(\d+)$!' => 'lock', // lock thread
|
||||||
'!^/(\w+)/(un)?sticky/(\d+)$!' => 'sticky', // sticky thread
|
'!^/(\w+)/(un)?sticky/(\d+)$!' => 'sticky', // sticky thread
|
||||||
'!^/(\w+)/bump(un)?lock/(\d+)$!' => 'bumplock', // "bumplock" thread
|
'!^/(\w+)/bump(un)?lock/(\d+)$!' => 'bumplock', // "bumplock" thread
|
||||||
|
@ -84,9 +84,6 @@
|
|||||||
|
|
||||||
{% if mod|hasPermission(config.mod.rebuild) %}
|
{% if mod|hasPermission(config.mod.rebuild) %}
|
||||||
<li><a href="?/rebuild">{% trans 'Rebuild' %}</a></li>
|
<li><a href="?/rebuild">{% trans 'Rebuild' %}</a></li>
|
||||||
{% if config.cache.enabled %}
|
|
||||||
<li><a href="?/flushcache">{% trans 'Clear cache' %}</a></li>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if mod|hasPermission(config.mod.show_config) %}
|
{% if mod|hasPermission(config.mod.show_config) %}
|
||||||
|
Loading…
Reference in New Issue
Block a user