Fix leading whitespace in post.php

This commit is contained in:
Zankaria 2024-01-29 22:57:45 +01:00
parent f45bc768fe
commit 15cce3a31f

View File

@ -48,8 +48,8 @@ if (isset($_GET['Newsgroups']) && $config['nntpchan']['enabled']) {
$ref = $refs[0]; $ref = $refs[0];
$query = prepare("SELECT `board`,`id` FROM ``nntp_references`` WHERE `message_id` = :ref"); $query = prepare("SELECT `board`,`id` FROM ``nntp_references`` WHERE `message_id` = :ref");
$query->bindValue(':ref', $ref); $query->bindValue(':ref', $ref);
$query->execute() or error(db_error($query)); $query->execute() or error(db_error($query));
$ary = $query->fetchAll(PDO::FETCH_ASSOC); $ary = $query->fetchAll(PDO::FETCH_ASSOC);
@ -134,8 +134,8 @@ if (isset($_GET['Newsgroups']) && $config['nntpchan']['enabled']) {
$query = prepare("SELECT `board`,`id` FROM ``nntp_references`` WHERE `message_id_digest` LIKE :rule"); $query = prepare("SELECT `board`,`id` FROM ``nntp_references`` WHERE `message_id_digest` LIKE :rule");
$idx = $id . "%"; $idx = $id . "%";
$query->bindValue(':rule', $idx); $query->bindValue(':rule', $idx);
$query->execute() or error(db_error($query)); $query->execute() or error(db_error($query));
$ary = $query->fetchAll(PDO::FETCH_ASSOC); $ary = $query->fetchAll(PDO::FETCH_ASSOC);
if (count($ary) == 0) { if (count($ary) == 0) {
@ -199,7 +199,7 @@ if (isset($_POST['delete'])) {
error($config['error']['noboard']); error($config['error']['noboard']);
if ((!isset($_POST['mod']) || !$_POST['mod']) && $config['board_locked']) { if ((!isset($_POST['mod']) || !$_POST['mod']) && $config['board_locked']) {
error("Board is locked"); error("Board is locked");
} }
// Check if banned // Check if banned
@ -266,9 +266,9 @@ if (isset($_POST['delete'])) {
echo json_encode(array('success' => true)); echo json_encode(array('success' => true));
} }
// We are already done, let's continue our heavy-lifting work in the background (if we run off FastCGI) // We are already done, let's continue our heavy-lifting work in the background (if we run off FastCGI)
if (function_exists('fastcgi_finish_request')) if (function_exists('fastcgi_finish_request'))
@fastcgi_finish_request(); @fastcgi_finish_request();
rebuildThemes('post-delete', $board['uri']); rebuildThemes('post-delete', $board['uri']);
@ -290,7 +290,7 @@ if (isset($_POST['delete'])) {
error($config['error']['noboard']); error($config['error']['noboard']);
if ((!isset($_POST['mod']) || !$_POST['mod']) && $config['board_locked']) { if ((!isset($_POST['mod']) || !$_POST['mod']) && $config['board_locked']) {
error("Board is locked"); error("Board is locked");
} }
// Check if banned // Check if banned
@ -317,7 +317,7 @@ if (isset($_POST['delete'])) {
$resp = curl_exec($ch); $resp = curl_exec($ch);
if ($resp !== '1') { if ($resp !== '1') {
error($config['error']['captcha']); error($config['error']['captcha']);
} }
} }
@ -331,11 +331,10 @@ if (isset($_POST['delete'])) {
$post = $query->fetch(PDO::FETCH_ASSOC); $post = $query->fetch(PDO::FETCH_ASSOC);
$error = event('report', array('ip' => $_SERVER['REMOTE_ADDR'], 'board' => $board['uri'], 'post' => $post, 'reason' => $reason, 'link' => link_for($post))); $error = event('report', array('ip' => $_SERVER['REMOTE_ADDR'], 'board' => $board['uri'], 'post' => $post, 'reason' => $reason, 'link' => link_for($post)));
if ($error) {
if ($error) { error($error);
error($error); }
}
if ($config['syslog']) if ($config['syslog'])
_syslog(LOG_INFO, 'Reported post: ' . _syslog(LOG_INFO, 'Reported post: ' .
@ -372,7 +371,7 @@ if (isset($_POST['delete'])) {
error($config['error']['noboard']); error($config['error']['noboard']);
if ((!isset($_POST['mod']) || !$_POST['mod']) && $config['board_locked']) { if ((!isset($_POST['mod']) || !$_POST['mod']) && $config['board_locked']) {
error("Board is locked"); error("Board is locked");
} }
if (!isset($_POST['name'])) if (!isset($_POST['name']))
@ -451,8 +450,8 @@ if (isset($_POST['delete'])) {
$resp = curl_exec($ch); $resp = curl_exec($ch);
if ($resp !== '1') { if ($resp !== '1') {
error($config['error']['captcha'] . error($config['error']['captcha'] .
'<script>if (actually_load_captcha !== undefined) actually_load_captcha("'.$config['captcha']['provider_get'].'", "'.$config['captcha']['extra'].'");</script>'); '<script>if (actually_load_captcha !== undefined) actually_load_captcha("'.$config['captcha']['provider_get'].'", "'.$config['captcha']['extra'].'");</script>');
} }
} }
@ -637,7 +636,7 @@ if (isset($_POST['delete'])) {
} }
else { else {
if (!$post['op']) { if (!$post['op']) {
$numposts = numPosts($post['thread']); $numposts = numPosts($post['thread']);
} }
} }
@ -795,18 +794,17 @@ if (isset($_POST['delete'])) {
} }
} }
if ($config['user_flag'] && isset($_POST['user_flag'])) if ($config['user_flag'] && isset($_POST['user_flag']) && !empty($_POST['user_flag'])) {
if (!empty($_POST['user_flag']) ){
$user_flag = $_POST['user_flag']; $user_flag = $_POST['user_flag'];
if (!isset($config['user_flags'][$user_flag])) if (!isset($config['user_flags'][$user_flag])) {
error(_('Invalid flag selection!')); error(_('Invalid flag selection!'));
}
$flag_alt = isset($user_flag_alt) ? $user_flag_alt : $config['user_flags'][$user_flag]; $flag_alt = isset($user_flag_alt) ? $user_flag_alt : $config['user_flags'][$user_flag];
$post['body'] .= "\n<tinyboard flag>" . strtolower($user_flag) . "</tinyboard>" . $post['body'] .= "\n<tinyboard flag>" . strtolower($user_flag) . "</tinyboard>" .
"\n<tinyboard flag alt>" . $flag_alt . "</tinyboard>"; "\n<tinyboard flag alt>" . $flag_alt . "</tinyboard>";
} }
if ($config['allowed_tags'] && $post['op'] && isset($_POST['tag']) && isset($config['allowed_tags'][$_POST['tag']])) { if ($config['allowed_tags'] && $post['op'] && isset($_POST['tag']) && isset($config['allowed_tags'][$_POST['tag']])) {
@ -814,7 +812,7 @@ if (isset($_POST['delete'])) {
} }
if (!$dropped_post) if (!$dropped_post)
if ($config['proxy_save'] && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { if ($config['proxy_save'] && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$proxy = preg_replace("/[^0-9a-fA-F.,: ]/", '', $_SERVER['HTTP_X_FORWARDED_FOR']); $proxy = preg_replace("/[^0-9a-fA-F.,: ]/", '', $_SERVER['HTTP_X_FORWARDED_FOR']);
$post['body'] .= "\n<tinyboard proxy>".$proxy."</tinyboard>"; $post['body'] .= "\n<tinyboard proxy>".$proxy."</tinyboard>";
} }
@ -1038,7 +1036,7 @@ if (isset($_POST['delete'])) {
// Preprocess command is an ImageMagick b/w quantization // Preprocess command is an ImageMagick b/w quantization
$error = shell_exec_error(sprintf($config['tesseract_preprocess_command'], escapeshellarg($fname)) . " | " . $error = shell_exec_error(sprintf($config['tesseract_preprocess_command'], escapeshellarg($fname)) . " | " .
'tesseract stdin '.escapeshellarg($tmpname).' '.$config['tesseract_params']); 'tesseract stdin '.escapeshellarg($tmpname).' '.$config['tesseract_params']);
$tmpname .= ".txt"; $tmpname .= ".txt";
$value = @file_get_contents($tmpname); $value = @file_get_contents($tmpname);
@ -1137,8 +1135,8 @@ if (isset($_POST['delete'])) {
if ($dropped_post && $dropped_post['from_nntp']) { if ($dropped_post && $dropped_post['from_nntp']) {
$query = prepare("INSERT INTO ``nntp_references`` (`board`, `id`, `message_id`, `message_id_digest`, `own`, `headers`) VALUES ". $query = prepare("INSERT INTO ``nntp_references`` (`board`, `id`, `message_id`, `message_id_digest`, `own`, `headers`) VALUES ".
"(:board , :id , :message_id , :message_id_digest , false, :headers)"); "(:board , :id , :message_id , :message_id_digest , false, :headers)");
$query->bindValue(':board', $dropped_post['board']); $query->bindValue(':board', $dropped_post['board']);
$query->bindValue(':id', $id); $query->bindValue(':id', $id);
@ -1157,15 +1155,15 @@ if (isset($_POST['delete'])) {
$message = gen_nntp($headers, $files); $message = gen_nntp($headers, $files);
$query = prepare("INSERT INTO ``nntp_references`` (`board`, `id`, `message_id`, `message_id_digest`, `own`, `headers`) VALUES ". $query = prepare("INSERT INTO ``nntp_references`` (`board`, `id`, `message_id`, `message_id_digest`, `own`, `headers`) VALUES ".
"(:board , :id , :message_id , :message_id_digest , true , :headers)"); "(:board , :id , :message_id , :message_id_digest , true , :headers)");
$query->bindValue(':board', $post['board']); $query->bindValue(':board', $post['board']);
$query->bindValue(':id', $post['id']); $query->bindValue(':id', $post['id']);
$query->bindValue(':message_id', $msgid); $query->bindValue(':message_id', $msgid);
$query->bindValue(':message_id_digest', sha1($msgid)); $query->bindValue(':message_id_digest', sha1($msgid));
$query->bindValue(':headers', json_encode($headers)); $query->bindValue(':headers', json_encode($headers));
$query->execute() or error(db_error($query)); $query->execute() or error(db_error($query));
// Let's broadcast it! // Let's broadcast it!
nntp_publish($message, $msgid); nntp_publish($message, $msgid);