Browse Source

post.php: fix undefined post on report

pull/114/head
Zankaria 4 weeks ago
parent
commit
0a1412b74f
  1. 20
      post.php

20
post.php

@ -544,7 +544,13 @@ function handle_report()
error($config['error']['nopost']);
}
$error = event('report', array('ip' => $_SERVER['REMOTE_ADDR'], 'board' => $board['uri'], 'post' => $post, 'reason' => $reason, 'link' => link_for($thread)));
$error = event('report', [
'ip' => $_SERVER['REMOTE_ADDR'],
'board' => $board['uri'],
'post' => $post,
'reason' => $reason,
'link' => link_for($post)
]);
if ($error) {
error($error);
}
@ -584,20 +590,20 @@ function handle_report()
return $result;
}
$postcontent = mb_substr($thread['body_nomarkup'], 0, 120) . '... _*(POST TRIMMED)*_';
$slackmessage = '<' . $config['domain'] . "/mod.php?/" . $board['dir'] . $config['dir']['res'] . ($thread['thread'] ? $thread['thread'] : $id) . ".html" . ($thread['thread'] ? '#' . $id : '') . '> \n ' . $reason . '\n ' . $postcontent . '\n';
$postcontent = mb_substr($post['body_nomarkup'], 0, 120) . '... _*(POST TRIMMED)*_';
$slackmessage = '<' . $config['domain'] . "/mod.php?/" . $board['dir'] . $config['dir']['res'] . ($post['thread'] ? $post['thread'] : $id) . ".html" . ($post['thread'] ? '#' . $id : '') . '> \n ' . $reason . '\n ' . $postcontent . '\n';
$slackresult = slack($slackmessage, $config['slack_channel']);
}
if (isset($config['matrix'])) {
$reported_post_url = $config['domain'] . "/mod.php?/" . $board['dir'] . $config['dir']['res'] . ($thread['thread'] ? $thread['thread'] : $id) . ".html";
$reported_post_url = $config['domain'] . "/mod.php?/" . $board['dir'] . $config['dir']['res'] . ($post['thread'] ? $post['thread'] : $id) . ".html";
$post_url = $config['matrix']['host'] . "/_matrix/client/r0/rooms/" . $config['matrix']['room_id'] . "/send/m.room.message?access_token=" . $config['matrix']['access_token'];
$trimmed_post = strlen($thread['body_nomarkup']) > $config['matrix']['max_message_length'] ? ' [...]' : '';
$postcontent = mb_substr($thread['body_nomarkup'], 0, $config['matrix']['max_message_length']) . $trimmed_post;
$matrix_message = $reported_post_url . ($thread['thread'] ? '#' . $id : '') . " \nReason:\n" . $reason . " \nPost:\n" . $postcontent . " \n";
$trimmed_post = strlen($post['body_nomarkup']) > $config['matrix']['max_message_length'] ? ' [...]' : '';
$postcontent = mb_substr($post['body_nomarkup'], 0, $config['matrix']['max_message_length']) . $trimmed_post;
$matrix_message = $reported_post_url . ($post['thread'] ? '#' . $id : '') . " \nReason:\n" . $reason . " \nPost:\n" . $postcontent . " \n";
$post_data = json_encode(
array(
"msgtype" => "m.text",

Loading…
Cancel
Save