diff --git a/post.php b/post.php index 599e9353..e035143e 100644 --- a/post.php +++ b/post.php @@ -357,6 +357,9 @@ function handle_report(){ $query->bindValue(':reason', $reason, PDO::PARAM_STR); $query->execute() or error(db_error($query)); + $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'; + if ($config['slack']) { @@ -382,14 +385,17 @@ 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'; - $slackresult = slack($slackmessage, $config['slack_channel']); } + if(isset($config['matrix'])){ + $ch = curl_init("$config['matrix']['host']/_matrix/client/r0/rooms/$config['matrix']['room_id']/send/m.room.message?access_token=$config['matrix']['access_token']"); + curl_setopt($ch, CURLOPT_POSTFIELDS, $slackmessage); + $result = curl_exec($ch); + curl_close($ch); + } } $is_mod = isset($_POST['mod']) && $_POST['mod'];