Permalink
Browse files

Better mod options

  • Loading branch information...
r04r committed Jun 6, 2015
1 parent 410067a commit a46824f0973066d94b106a2eb14e328cec9f2b6d
Showing with 52 additions and 0 deletions.
  1. +2 −0 .htaccess
  2. +46 −0 action.php
  3. +2 −0 rewrite.conf
  4. +2 −0 topic.php
View
@@ -165,8 +165,10 @@ RewriteRule ^nuke_ID/([0-9a-zA-Z.]+)$ action.php?action=nuke_id&id=$1 [L]
RewriteRule ^exterminate$ exterminate.php [L]
RewriteRule ^undelete_topic/([0-9]+)$ action.php?action=undelete_topic&id=$1 [L]
RewriteRule ^delete_topic/([0-9]+)$ action.php?action=delete_topic&id=$1 [L]
RewriteRule ^stealth_delete_topic/([0-9]+)$ action.php?action=stealth_delete_topic&id=$1 [L]
RewriteRule ^undelete_reply/([0-9]+)$ action.php?action=undelete_reply&id=$1 [L]
RewriteRule ^delete_reply/([0-9]+)$ action.php?action=delete_reply&id=$1 [L]
RewriteRule ^stealth_delete_reply/([0-9]+)$ action.php?action=stealth_delete_reply&id=$1 [L]
RewriteRule ^stick_topic/([0-9]+)$ action.php?action=stick_topic&id=$1 [L]
RewriteRule ^unstick_topic/([0-9]+)$ action.php?action=unstick_topic&id=$1 [L]
RewriteRule ^lock_topic/([0-9]+)$ action.php?action=lock_topic&id=$1 [L]
View
@@ -393,6 +393,29 @@
break;
case 'stealth_delete_topic':
if(!allowed('delete') || !allowed('undelete')) {
add_error(MESSAGE_PAGE_ACCESS_DENIED, true);
}
if( ! ctype_digit($_GET['id'])) {
add_error('Invalid topic ID.', true);
}
$id = $_GET['id'];
$page_title = 'Stealth Delete topic';
if(isset($_POST['id'])) {
// CSRF checking.
check_token();
$link->update("topics", array("stealth_ban"=>1), "id=".$link->escape($id));
log_mod("stealth_delete_topic", $id);
redirect('Topic stealthbanned.');
}
break;
case 'delete_topic':
if(!allowed('delete')) {
@@ -471,6 +494,29 @@
redirect('Reply undeleted and pulled out of the archive.', 'topic/' . $parent_id . "#reply_" . $id);
break;
case 'stealth_delete_reply':
if(!allowed('delete') || !allowed('undelete')) {
add_error(MESSAGE_PAGE_ACCESS_DENIED, true);
}
if( ! ctype_digit($_GET['id'])) {
add_error('Invalid reply ID.', true);
}
$id = $_GET['id'];
$page_title = 'Stealth Delete reply';
if(isset($_POST['id'])) {
// CSRF checking.
check_token();
$link->update("replies", array("stealth_ban"=>1), "id=".$link->escape($id));
log_mod("stealth_delete_reply", $id);
redirect('Reply stealthbanned.');
}
break;
case 'delete_reply':
View
@@ -164,8 +164,10 @@ rewrite ^/nuke_ID/([0-9a-zA-Z.]+)$ /action.php?action=nuke_id&id=$1 last;
rewrite ^/exterminate$ /exterminate.php last;
rewrite ^/undelete_topic/([0-9]+)$ /action.php?action=undelete_topic&id=$1 last;
rewrite ^/delete_topic/([0-9]+)$ /action.php?action=delete_topic&id=$1 last;
rewrite ^/stealth_delete_topic/([0-9]+)$ /action.php?action=stealth_delete_topic&id=$1 last;
rewrite ^/undelete_reply/([0-9]+)$ /action.php?action=undelete_reply&id=$1 last;
rewrite ^/delete_reply/([0-9]+)$ /action.php?action=delete_reply&id=$1 last;
rewrite ^/stealth_delete_reply/([0-9]+)$ /action.php?action=stealth_delete_reply&id=$1 last;
rewrite ^/stick_topic/([0-9]+)$ /action.php?action=stick_topic&id=$1 last;
rewrite ^/unstick_topic/([0-9]+)$ /action.php?action=unstick_topic&id=$1 last;
rewrite ^/lock_topic/([0-9]+)$ /action.php?action=lock_topic&id=$1 last;
View
@@ -261,6 +261,7 @@ function create_no_link($var) {
if($locked && allowed("lock_topic")) echo '<li><a href="'.DOMAIN.'unlock_topic/' . $_GET['id'] . '" onclick="return submitDummyForm(\''.DOMAIN.'unlock_topic/' . $_GET['id'] . '\', \'id\', ' . $_GET['id'] . ', \'Unlock this topic?\');">Unlock</a></li>';
if(!$deleted) {
if(allowed("delete")) echo '<li><a href="'.DOMAIN.'delete_topic/' . $_GET['id'] . '" onclick="return submitDummyForm(\''.DOMAIN.'delete_topic/' . $_GET['id'] . '\', \'id\', ' . $_GET['id'] . ', \'Really delete this topic?\');">Delete</a></li>';
if(!$topic_stealth_banned && allowed('delete') && allowed('undelete')) echo '<li><a href="'.DOMAIN.'stealth_delete_topic/' . $_GET['id'] . '" onclick="return submitDummyForm(\''.DOMAIN.'stealth_delete_topic/' . $_GET['id'] . '\', \'id\', ' . $_GET['id'] . ', \'Really stealth delete this topic?\');">Stealth</a></li>';
}else{
if(allowed("undelete")) echo '<li><a href="'.DOMAIN.'undelete_topic/' . $_GET['id'] . '" onclick="return submitDummyForm(\''.DOMAIN.'undelete_topic/' . $_GET['id'] . '\', \'id\', ' . $_GET['id'] . ', \'Really undelete this topic?\');">Undelete</a></li>';
}
@@ -673,6 +674,7 @@ function preg_replace_anchors($data){
if(!$reply_deleted){
if(allowed("delete")) echo '<li><a href="'.DOMAIN.'delete_reply/' . $reply_id . '" onclick="return submitDummyForm(\''.DOMAIN.'delete_reply/' . $reply_id . '\', \'id\', ' . $reply_id . ', \'Really delete this reply?\');">Delete</a></li>';
if(!$reply_stealth && allowed('delete') && allowed('undelete')) echo '<li><a href="'.DOMAIN.'stealth_delete_reply/' . $reply_id . '" onclick="return submitDummyForm(\''.DOMAIN.'stealth_delete_reply/' . $reply_id . '\', \'id\', ' . $reply_id . ', \'Really stealth delete this reply?\');">Stealth</a></li>';
}else{
if(allowed("undelete")) echo '<li><a href="'.DOMAIN.'undelete_reply/' . $reply_id . '" onclick="return submitDummyForm(\''.DOMAIN.'undelete_reply/' . $reply_id . '\', \'id\', ' . $reply_id . ', \'Really undelete this reply?\');">Undelete</a></li>';
}

0 comments on commit a46824f

Please sign in to comment.