@ -760,7 +760,6 @@ function mod_view_board($boardName, $page_no = 1) {
$overboard->settings['include'] = $config['overboards'][$boardName]['include'];
}
$overboard->settings['boards'] = listBoards();
echo $overboard->build($mod);
return;
}
@ -939,6 +938,23 @@ function mod_ban() {
header('Location: ?/', true, $config['redirect_http']);
}
function mod_warning() {
global $config;
if (!hasPermission($config['mod']['warning']))
error($config['error']['noaccess']);
if (!isset( $_POST['board'])) {
mod_page(_('New warning'), 'mod/warning_form.html', array('token' => make_secure_link_token('ban')));
return;
}
if (isset($_POST['redirect']))
header('Location: ' . $_POST['redirect'], true, $config['redirect_http']);
else
header('Location: ?/', true, $config['redirect_http']);
}
function mod_bans() {
global $config;
global $mod;
@ -1493,11 +1509,12 @@ function mod_merge($originBoard, $postID) {
else{
$sourceOp = $post['id'];
}
$newpost = "";
$newpost = "";
$boards = listBoards();
if (isset($_POST['board'])) {
$targetBoard = $_POST['board'];
$shadow = isset($_POST['shadow']);
$targetOp = "";
if ($_POST['target_thread']) {
$query = prepare(sprintf('SELECT * FROM ``posts_%s`` WHERE `id` = :id', $targetBoard));
@ -1524,6 +1541,12 @@ function mod_merge($originBoard, $postID) {
$query->bindValue(':oldthread', $sourceOp, PDO::PARAM_INT);
$query->execute() or error(db_error($query));
// build index
// Delete thread HTML page
file_unlink($board['dir'] . $config['dir']['res'] . link_for($post) );
file_unlink($board['dir'] . $config['dir']['res'] . link_for($post, true) ); // noko50
file_unlink($board['dir'] . $config['dir']['res'] . sprintf('%d.json', $post['id']));
//deletePost($postID);
//modLog("Deleted post #{$postID}");
buildIndex();
// build new thread
@ -1568,6 +1591,8 @@ function mod_merge($originBoard, $postID) {
$op = $post;
$op['id'] = $newID;
$clone = $shadow ? 'copy' : 'rename';
if ($post['has_file']) {
// copy image
foreach ($post['files'] as $i => & $file) {
@ -1642,6 +1667,7 @@ function mod_merge($originBoard, $postID) {
// insert reply
$newIDs[$post['id']] = $newPostID = post($post);
if (!empty($post['tracked_cites'])) {
$insert_rows = array();
foreach ($post['tracked_cites'] as $cite) {
@ -1670,6 +1696,7 @@ function mod_merge($originBoard, $postID) {
openBoard($originBoard);
deletePost($postID);
modLog("Deleted post #{$postID}");
buildIndex();
openBoard($targetBoard);
@ -1820,6 +1847,106 @@ function mod_ban_post($board, $delete, $post, $token = false) {
mod_page(_('New ban'), 'mod/ban_form.html', $args);
}
function mod_warning_post($board,$post, $token = false) {
global $config, $mod;
if (!openBoard($board))
error($config['error']['noboard']);
$security_token = make_secure_link_token($board . '/warning/' . $post);
$query = prepare(sprintf('SELECT ' . ('`ip`, `thread`') .
' FROM ``posts_%s`` WHERE `id` = :id', $board));
$query->bindValue(':id', $post);
$query->execute() or error(db_error($query));
if (!$_post = $query->fetch(PDO::FETCH_ASSOC))
error($config['error']['404']);
$thread = $_post['thread'];
$ip = $_post['ip'];
if (isset($_POST['new_warning'])) {
if (isset($_POST['ip']))
$ip = $_POST['ip'];
if (isset($_POST['public_message'], $_POST['message'])) {
// public warning message
$_POST['message'] = preg_replace('/[\r\n]/', '', $_POST['message']);
$query = prepare(sprintf('UPDATE ``posts_%s`` SET `body_nomarkup` = CONCAT(`body_nomarkup`, :body_nomarkup) WHERE `id` = :id', $board));
$query->bindValue(':id', $post);
$query->bindValue(':body_nomarkup', sprintf("\n< tinyboard warning message > %s< / tinyboard > ", utf8tohtml($_POST['message'])));
$query->execute() or error(db_error($query));
rebuildPost($post);
modLog("Attached a public warning message to post #{$post}: " . utf8tohtml($_POST['message']));
buildThread($thread ? $thread : $post);
buildIndex();
if ($config['autotagging']){
$query = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE id = :id", $board));
$query->bindValue(':id', $post );
$query->execute() or error(db_error($query));
$ip = "";
$time = "";
$filename = "";
$filehash = "";
$subject = "";
$name = "";
$body = "";
while ($mypost = $query->fetch(PDO::FETCH_ASSOC)) {
$time = $mypost["time"];
$ip = $mypost["ip"];
$body = $mypost["body_nomarkup"];
$name = $mypost["name"];
$subject = $mypost["subject"];
$filehash = $mypost["filehash"];
$mypost['files'] = $mypost['files'] ? json_decode($mypost['files']) : array();
// For each file append file name
for ($file_count = 0; $file_count < $mypost["num_files"];$file_count++){
$filename .= $mypost['files'][$file_count]->name . "\r\n";
}
}
if ($time !== ''){
$dt = new DateTime("@$time");
$autotag = "Post warned\r\n";
$autotag .= $name . " " . $subject . " " . $dt->format('Y-m-d H:i:s') . " No.". $post . "\r\n";
$autotag .= "/${board}/" . " " . $filehash . " " . $filename ."\r\n";
$autotag .= $body . "\r\n";
$autotag = escape_markup_modifiers($autotag);
markup($autotag);
$query = prepare('INSERT INTO ``ip_notes`` VALUES (NULL, :ip, :mod, :time, :body)');
$query->bindValue(':ip', $ip);
$query->bindValue(':mod', $mod['id']);
$query->bindValue(':time', time());
$query->bindValue(':body', $autotag);
$query->execute() or error(db_error($query));
modLog("Added a note for < a href = \"?/IP/{$ip}\" > {$ip}< / a > ");
}
}
}
if(isset($_POST['thread'])) {
// Redirect to thread
header('Location: ?/' . sprintf($config['board_path'], $board) . $config['dir']['res'] . str_replace('%d', $_POST['thread'], $config['file_page']), true, $config['redirect_http']);
} else {
// Redirect to board index.
header('Location: ?/' . sprintf($config['board_path'], $board) . $config['file_index'], true, $config['redirect_http']);
}
}
$args = array(
'ip' => $ip,
'hide_ip' => !hasPermission($config['mod']['show_ip'], $board),
'post' => $post,
'board' => $board,
'token' => $security_token
);
if($_GET['thread']) {
$args['thread'] = $_GET['thread'];
}
mod_page(_('New warning'), 'mod/warning_form.html', $args);
}
function mod_edit_post($board, $edit_raw_html, $postID) {
global $config, $mod;