mirror of
https://github.com/ithrts/ImoutoIB.git
synced 2025-01-17 16:08:15 +01:00
mod tools
delete post/file without password if modlevel high enough (configurable) sticky/lock/autosage buttons for threads
This commit is contained in:
parent
733924d864
commit
9f9a7a0edf
@ -65,12 +65,72 @@ if (isset($delrep_thread) && (!file_exists($path . '/' . $database_folder . '/bo
|
||||
//OK THEN CONTINUE:
|
||||
|
||||
|
||||
//MOD THREAD BUTTONS
|
||||
if ($logged_in == true) {
|
||||
|
||||
//STICKY
|
||||
if (($config['mod']['thread_sticky'] <= $mod_level) && isset($_POST['sticky'])) {
|
||||
$thread_info = file_get_contents($path . '/' . $database_folder . '/boards/' . $delrep_board . '/' . $delrep_thread . '/info.php');
|
||||
if (preg_match('/\$info_sticky=1;/i', $thread_info) == true) {
|
||||
$thread_info = preg_replace('/\$info_sticky=1;/i', '$info_sticky=0;', $thread_info);
|
||||
$thread_sticky = false;
|
||||
} else {
|
||||
$thread_info = preg_replace('/\$info_sticky=0;/i', '$info_sticky=1;', $thread_info);
|
||||
$thread_sticky = true;
|
||||
}
|
||||
file_put_contents($path . '/' . $database_folder . '/boards/' . $delrep_board . '/' . $delrep_thread . '/info.php', $thread_info);
|
||||
if ($thread_sticky == true) {
|
||||
error("Thread has been stickied.", true);
|
||||
} else {
|
||||
error("Thread has been unstickied.", true);
|
||||
}
|
||||
}
|
||||
|
||||
//LOCK
|
||||
if (($config['mod']['thread_lock'] <= $mod_level) && isset($_POST['lock'])) {
|
||||
$thread_info = file_get_contents($path . '/' . $database_folder . '/boards/' . $delrep_board . '/' . $delrep_thread . '/info.php');
|
||||
if (preg_match('/\$info_locked=1;/i', $thread_info) == true) {
|
||||
$thread_info = preg_replace('/\$info_locked=1;/i', '$info_locked=0;', $thread_info);
|
||||
$thread_locked = false;
|
||||
} else {
|
||||
$thread_info = preg_replace('/\$info_locked=0;/i', '$info_locked=1;', $thread_info);
|
||||
$thread_locked = true;
|
||||
}
|
||||
file_put_contents($path . '/' . $database_folder . '/boards/' . $delrep_board . '/' . $delrep_thread . '/info.php', $thread_info);
|
||||
if ($thread_locked == true) {
|
||||
error("Thread has been locked.", true);
|
||||
} else {
|
||||
error("Thread has been unlocked.", true);
|
||||
}
|
||||
}
|
||||
|
||||
//AUTOSAGE
|
||||
if (($config['mod']['thread_autosage'] <= $mod_level) && isset($_POST['autosage'])) {
|
||||
$thread_info = file_get_contents($path . '/' . $database_folder . '/boards/' . $delrep_board . '/' . $delrep_thread . '/info.php');
|
||||
if (preg_match('/\$info_autosage=1;/i', $thread_info) == true) {
|
||||
$thread_info = preg_replace('/\$info_autosage=1;/i', '$info_autosage=0;', $thread_info);
|
||||
$thread_autosage = false;
|
||||
} else {
|
||||
$thread_info = preg_replace('/\$info_autosage=0;/i', '$info_autosage=1;', $thread_info);
|
||||
$thread_autosage = true;
|
||||
}
|
||||
file_put_contents($path . '/' . $database_folder . '/boards/' . $delrep_board . '/' . $delrep_thread . '/info.php', $thread_info);
|
||||
if ($thread_autosage == true) {
|
||||
error("Thread has been autosaged.", true);
|
||||
} else {
|
||||
error("Thread has been unautosaged.", true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (isset($_POST["delete"]) && $_POST["delete"] != "") {
|
||||
if (isset($_POST['file'])) { //file only?
|
||||
DeletePost($database_folder, $uploads_folder, $delrep_board, $delrep_thread, $delrep_reply, true, $secure_hash, $recent_replies);
|
||||
DeletePost($database_folder, $uploads_folder, $delrep_board, $delrep_thread, $delrep_reply, true, $secure_hash, $recent_replies, $config['mod']['post_delete'], $mod_level);
|
||||
} else {
|
||||
DeletePost($database_folder, $uploads_folder, $delrep_board, $delrep_thread, $delrep_reply, false, $secure_hash, $recent_replies);
|
||||
DeletePost($database_folder, $uploads_folder, $delrep_board, $delrep_thread, $delrep_reply, false, $secure_hash, $recent_replies, $config['mod']['post_delete'], $mod_level);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,6 +131,22 @@ $config['max_lines'] = 40;
|
||||
$config['wordfilters'][] = array('/little sister/i', 'imouto'); //regex
|
||||
|
||||
|
||||
//MODERATOR CONFIGURATION
|
||||
$config['mod']['ip'] = "40"; //see IP, or in this case hashed IP similarly to IDs, even if ID is disabled for visitors.
|
||||
$config['mod']['ban'] = "40";
|
||||
$config['mod']['reports'] = "10"; //dismiss reports
|
||||
$config['mod']['global_reports'] = "40"; //dismiss global reports
|
||||
$config['mod']['thread_sticky'] = "40";
|
||||
$config['mod']['thread_lock'] = "40";
|
||||
$config['mod']['thread_autosage'] = "40";
|
||||
$config['mod']['post_edit'] = "40";
|
||||
$config['mod']['post_delete'] = "10";
|
||||
$config['mod']['post_in_locked'] = "40";
|
||||
|
||||
$config['mod']['edit_user'] = "9001"; //create,edit,delete
|
||||
$config['mod']['mod_log'] = "40"; //look at modlog
|
||||
|
||||
|
||||
//DATABASE CONFIGURATION
|
||||
$config['db']['type'] = 'flat'; // flat, mysql
|
||||
// Flat file (No Database)
|
||||
|
@ -251,7 +251,7 @@ function UpdateThreads($database_folder, $board, $thread) {
|
||||
file_put_contents(__dir__ . '/../' . $database_folder . '/boards/' . $board . '/threads.php' , $threads_);
|
||||
}
|
||||
|
||||
function DeletePost($database_folder, $uploads_folder, $board, $thread, $post, $fileonly = false, $secure_hash, $recent_replies = 5) {
|
||||
function DeletePost($database_folder, $uploads_folder, $board, $thread, $post, $fileonly = false, $secure_hash, $recent_replies = 5, $mod_delete = false, $mod_level = false) {
|
||||
|
||||
//wip
|
||||
//add moderator checks to bypass pw check later
|
||||
@ -264,8 +264,10 @@ function DeletePost($database_folder, $uploads_folder, $board, $thread, $post, $
|
||||
include __dir__ . '/../' . $database_folder . '/boards/' . $board . '/' . $thread . '/OP.php';
|
||||
|
||||
//CHECK PASSWORD
|
||||
if (crypt(htmlspecialchars($_POST['password']), $secure_hash) != $op_password) {
|
||||
error('Wrong password...');
|
||||
if ($mod_level < $mod_delete) {
|
||||
if (crypt(htmlspecialchars($_POST['password']), $secure_hash) != $op_password) {
|
||||
error('Wrong password...');
|
||||
}
|
||||
}
|
||||
if ($fileonly == true) {
|
||||
if ($op_file[0][0] == '' || $op_file[0][0] == 'deleted') {
|
||||
@ -319,8 +321,11 @@ function DeletePost($database_folder, $uploads_folder, $board, $thread, $post, $
|
||||
error('Deletion logic set to reply, but specified reply does not exist in this thread.');
|
||||
}
|
||||
include __dir__ . '/../' . $database_folder . '/boards/' . $board . '/' . $thread . '/' . $post . '.php';
|
||||
if (crypt(htmlspecialchars($_POST['password']), $secure_hash) != $reply_password) {
|
||||
error('Wrong password...');
|
||||
|
||||
if ($mod_level < $mod_delete) {
|
||||
if (crypt(htmlspecialchars($_POST['password']), $secure_hash) != $reply_password) {
|
||||
error('Wrong password...');
|
||||
}
|
||||
}
|
||||
|
||||
//delete files if exist.
|
||||
|
@ -35,6 +35,12 @@ $frontpage_active = 0;
|
||||
$pages = '';
|
||||
|
||||
$logged_in = false;
|
||||
$mod_level = false;
|
||||
|
||||
$post_locked = false;
|
||||
$post_sticky = false;
|
||||
$post_autosage = false;
|
||||
|
||||
|
||||
if ($config['generated_in'] === true) {
|
||||
$start_time = microtime(true);
|
||||
|
11
post.php
11
post.php
@ -3,6 +3,17 @@
|
||||
require dirname(__FILE__) . '/require.php';
|
||||
|
||||
|
||||
//MOD FIELDS:
|
||||
if (($config['mod']['thread_sticky'] <= $mod_level) && isset($_POST['sticky'])) {
|
||||
$info_sticky = 1;
|
||||
}
|
||||
if (($config['mod']['thread_lock'] <= $mod_level) && isset($_POST['lock'])) {
|
||||
$info_locked = 1;
|
||||
}
|
||||
if (($config['mod']['thread_autosage'] <= $mod_level) && isset($_POST['autosage'])) {
|
||||
$info_autosage = 1;
|
||||
}
|
||||
|
||||
//POST FIELDS
|
||||
$post_board = phpClean($_POST['board']);
|
||||
$post_name = phpClean($_POST['name']);
|
||||
|
@ -101,6 +101,29 @@
|
||||
?>
|
||||
<label for="sage"><input type="checkbox" id="sage" name="sage" autocomplete="off"> No Bump</label>
|
||||
<div class="small">You may also type <i>sage</i> in the email field.</div>
|
||||
|
||||
<?php
|
||||
if ($current_page != 'thread' && $mod_level > 0) {
|
||||
echo '<div class="small"><b>Moderator tools:</b></div>';
|
||||
if ($config['mod']['thread_sticky'] <= $mod_level) {
|
||||
echo '
|
||||
<label for="sticky"><input type="checkbox" id="sticky" name="sticky" autocomplete="off"> Sticky Thread</label><br>
|
||||
';
|
||||
}
|
||||
if ($config['mod']['thread_lock'] <= $mod_level) {
|
||||
echo '
|
||||
<label for="lock"><input type="checkbox" id="lock" name="lock" autocomplete="off"> Lock Thread</label><br>
|
||||
';
|
||||
}
|
||||
if ($config['mod']['thread_autosage'] <= $mod_level) {
|
||||
echo '
|
||||
<label for="autosage"><input type="checkbox" id="autosage" name="autosage" autocomplete="off"> Autosage Thread</label><br>
|
||||
';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -121,6 +121,36 @@
|
||||
<form name="post_button" action="' . $prefix_folder . '/delete-report.php" method="post">
|
||||
<table>
|
||||
<tbody>
|
||||
|
||||
';
|
||||
if ($mod_level > 0) {
|
||||
echo '<tr><td><b>Moderator Tools:</b><br>';
|
||||
if ($config['mod']['thread_sticky'] <= $mod_level) {
|
||||
if ($info_sticky == 0) {
|
||||
echo '<input type="submit" name="sticky" value="Sticky"> ';
|
||||
} else {
|
||||
echo '<input type="submit" name="sticky" value="Unsticky"> ';
|
||||
}
|
||||
}
|
||||
if ($config['mod']['thread_lock'] <= $mod_level) {
|
||||
if ($info_locked == 0) {
|
||||
echo '<input type="submit" name="lock" value="Lock"> ';
|
||||
} else {
|
||||
echo '<input type="submit" name="lock" value="Unlock"> ';
|
||||
}
|
||||
}
|
||||
if ($config['mod']['thread_autosage'] <= $mod_level) {
|
||||
if ($info_autosage == 0) {
|
||||
echo '<input type="submit" name="autosage" value="Autosage"> ';
|
||||
} else {
|
||||
echo '<input type="submit" name="autosage" value="Unautosage"> ';
|
||||
}
|
||||
}
|
||||
echo '</td></tr>';
|
||||
}
|
||||
|
||||
echo '
|
||||
|
||||
<input type="hidden" name="board" value="' . $current_board . '"/>
|
||||
<input type="hidden" name="thread" value="' . $post_number_op . '"/>
|
||||
<input type="hidden" name="reply" value="' . $post_number_op . '"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user