forked from leftypol/leftypol
post.php: use modern array syntax
This commit is contained in:
parent
b88c876222
commit
b8af67a5e2
1 changed files with 10 additions and 10 deletions
20
post.php
20
post.php
|
@ -407,7 +407,7 @@ function handle_nntpchan()
|
|||
error("NNTPChan: Forbidden. $_SERVER[REMOTE_ADDR] is not a trusted peer");
|
||||
}
|
||||
|
||||
$_POST = array();
|
||||
$_POST = [];
|
||||
$_POST['json_response'] = true;
|
||||
|
||||
$headers = json_encode($_GET);
|
||||
|
@ -483,7 +483,7 @@ function handle_nntpchan()
|
|||
|
||||
$content = '';
|
||||
|
||||
$newfiles = array();
|
||||
$newfiles = [];
|
||||
foreach ($_FILES['attachment']['error'] as $id => $error) {
|
||||
if ($_FILES['attachment']['type'][$id] == 'text/plain') {
|
||||
$content .= file_get_contents($_FILES['attachment']['tmp_name'][$id]);
|
||||
|
@ -491,7 +491,7 @@ function handle_nntpchan()
|
|||
// Signed message, ignore for now
|
||||
} else {
|
||||
// A real attachment :^)
|
||||
$file = array();
|
||||
$file = [];
|
||||
$file['name'] = $_FILES['attachment']['name'][$id];
|
||||
$file['type'] = $_FILES['attachment']['type'][$id];
|
||||
$file['size'] = $_FILES['attachment']['size'][$id];
|
||||
|
@ -535,7 +535,7 @@ function handle_nntpchan()
|
|||
if (count($ary) == 0) {
|
||||
return ">>>>$id";
|
||||
} else {
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
foreach ($ary as $v) {
|
||||
if ($v['board'] != $xboard) {
|
||||
$ret[] = ">>>/" . $v['board'] . "/" . $v['id'];
|
||||
|
@ -580,7 +580,7 @@ function handle_delete()
|
|||
error($config['error']['invalidpassword']);
|
||||
}
|
||||
|
||||
$delete = array();
|
||||
$delete = [];
|
||||
foreach ($_POST as $post => $value) {
|
||||
if (preg_match('/^delete_(\d+)$/', $post, $m)) {
|
||||
$delete[] = (int) $m[1];
|
||||
|
@ -688,7 +688,7 @@ function handle_report()
|
|||
if (!isset($_POST['board'], $_POST['reason']))
|
||||
error($config['error']['bot']);
|
||||
|
||||
$report = array();
|
||||
$report = [];
|
||||
foreach ($_POST as $post => $value) {
|
||||
if (preg_match('/^delete_(\d+)$/', $post, $m)) {
|
||||
$report[] = (int) $m[1];
|
||||
|
@ -839,7 +839,7 @@ function handle_post()
|
|||
error($config['error']['bot']);
|
||||
}
|
||||
|
||||
$post = array('board' => $_POST['board'], 'files' => array());
|
||||
$post = array('board' => $_POST['board'], 'files' => []);
|
||||
|
||||
// Check if board exists
|
||||
if (!openBoard($post['board'])) {
|
||||
|
@ -1513,7 +1513,7 @@ function handle_post()
|
|||
// getting all images and then choosing one.
|
||||
for( $i = 0; $i < $zip->numFiles; $i++ ){
|
||||
$stat = $zip->statIndex( $i );
|
||||
$matches = array();
|
||||
$matches = [];
|
||||
if (preg_match('/.*cover.*\.(jpg|jpeg|png)/', $stat['name'], $matches)) {
|
||||
$filename = $matches[0];
|
||||
break;
|
||||
|
@ -1764,7 +1764,7 @@ function handle_post()
|
|||
}
|
||||
|
||||
if (isset($post['tracked_cites']) && !empty($post['tracked_cites'])) {
|
||||
$insert_rows = array();
|
||||
$insert_rows = [];
|
||||
foreach ($post['tracked_cites'] as $cite) {
|
||||
$insert_rows[] = '(' .
|
||||
$pdo->quote($board['uri']) . ', ' . (int) $id . ', ' .
|
||||
|
@ -1782,7 +1782,7 @@ function handle_post()
|
|||
if (isset($_COOKIE[$config['cookies']['js']])) {
|
||||
$js = json_decode($_COOKIE[$config['cookies']['js']]);
|
||||
} else {
|
||||
$js = (object) array();
|
||||
$js = (object) [];
|
||||
}
|
||||
// Tell it to delete the cached post for referer
|
||||
$js->{$_SERVER['HTTP_REFERER']} = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue