|
@ -391,12 +391,15 @@ function handle_report(){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($config['matrix'])){ |
|
|
if(isset($config['matrix'])){ |
|
|
$slackmessage = $config['domain'] . "/mod.php?/" . $board['dir'] . $config['dir']['res'] . ( $thread['thread'] ? $thread['thread'] : $id ) . ".html" . ($thread['thread'] ? '#' . $id : '') . ' \\n ' . $reason . '\\n ' . $postcontent . ' \\n '; |
|
|
$trimmed_post = strlen($thread['body_nomarkup']) > 280 ? '[...]' : ''; |
|
|
$url = $config['matrix']['host'] . "/_matrix/client/r0/rooms/" . $config['matrix']['room_id'] . "/send/m.room.message?access_token=" . $config['matrix']['access_token']; |
|
|
$postcontent = mb_substr($thread['body_nomarkup'], 0, 280) . $trimmed_post; |
|
|
$ch = curl_init($url); |
|
|
$reported_post_url = $config['domain'] . "/mod.php?/" . $board['dir'] . $config['dir']['res'] . ( $thread['thread'] ? $thread['thread'] : $id ) . ".html"; |
|
|
|
|
|
$matrix_message = $reported_post_url . ($thread['thread'] ? '#' . $id : '') . ' \\n ' . $reason . '\\n ' . $postcontent . ' \\n '; |
|
|
|
|
|
$post_url = $config['matrix']['host'] . "/_matrix/client/r0/rooms/" . $config['matrix']['room_id'] . "/send/m.room.message?access_token=" . $config['matrix']['access_token']; |
|
|
|
|
|
$ch = curl_init($post_url); |
|
|
$post_data = json_encode(array( |
|
|
$post_data = json_encode(array( |
|
|
"msgtype" => "m.text", |
|
|
"msgtype" => "m.text", |
|
|
"body" => $slackmessage |
|
|
"body" => $matrix_message |
|
|
)); |
|
|
)); |
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); |
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); |
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
|
|