|
@ -544,7 +544,13 @@ function handle_report() |
|
|
error($config['error']['nopost']); |
|
|
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) { |
|
|
if ($error) { |
|
|
error($error); |
|
|
error($error); |
|
|
} |
|
|
} |
|
@ -584,20 +590,20 @@ function handle_report() |
|
|
return $result; |
|
|
return $result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$postcontent = mb_substr($thread['body_nomarkup'], 0, 120) . '... _*(POST TRIMMED)*_'; |
|
|
$postcontent = mb_substr($post['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'; |
|
|
$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']); |
|
|
$slackresult = slack($slackmessage, $config['slack_channel']); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($config['matrix'])) { |
|
|
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']; |
|
|
$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'] ? ' [...]' : ''; |
|
|
$trimmed_post = strlen($post['body_nomarkup']) > $config['matrix']['max_message_length'] ? ' [...]' : ''; |
|
|
$postcontent = mb_substr($thread['body_nomarkup'], 0, $config['matrix']['max_message_length']) . $trimmed_post; |
|
|
$postcontent = mb_substr($post['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"; |
|
|
$matrix_message = $reported_post_url . ($post['thread'] ? '#' . $id : '') . " \nReason:\n" . $reason . " \nPost:\n" . $postcontent . " \n"; |
|
|
$post_data = json_encode( |
|
|
$post_data = json_encode( |
|
|
array( |
|
|
array( |
|
|
"msgtype" => "m.text", |
|
|
"msgtype" => "m.text", |
|
|