forked from OpenIB/OpenIB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreport.php
40 lines (31 loc) · 902 Bytes
/
report.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
include 'inc/functions.php';
function outputError($errCode, $errString) {
http_response_code($errCode);
error ($errString);
return 0;
}
$globalExists = isset($_GET['global']);
$postExists = isset($_GET['post']);
$boardExists = isset($_GET['board']);
if (!$postExists){
outputError(400, "No input.");
}
if (!$boardExists){
outputError(400, "No input.");
}
$post = $_GET['post'];
$board = $_GET['board'];
if (!preg_match('/^delete_\d+$/', $post)){
outputError(400, "Bad input.");
}
if (!openBoard($board)){
outputError(404, "No board.");
}
if ($config['report_captcha']) {
$captcha = generate_captcha($config['captcha']['extra']);
} else {
$captcha = null;
}
$body = Element('report.html', ['global' => $globalExists, 'post' => $post, 'board' => $board, 'captcha' => $captcha, 'config' => $config]);
echo Element('page.html', ['config' => $config, 'body' => $body]);