|
@ -657,6 +657,28 @@ function handle_post(){ |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Convert multiple upload format to array of files. This makes the following code |
|
|
|
|
|
// work the same whether we used the JS or HTML multiple file upload techniques. |
|
|
|
|
|
if (array_key_exists('file_multiple', $_FILES)) { |
|
|
|
|
|
$file_array = $_FILES['file_multiple']; |
|
|
|
|
|
$_FILES = []; |
|
|
|
|
|
// If more than 0 files were uploaded |
|
|
|
|
|
if (!empty($file_array['tmp_name'][0])) { |
|
|
|
|
|
$i = 0; |
|
|
|
|
|
$n = count($file_array['tmp_name']); |
|
|
|
|
|
while ($i < $n) { |
|
|
|
|
|
$_FILES[strval($i+1)] = array( |
|
|
|
|
|
'name' => $file_array['name'][$i], |
|
|
|
|
|
'tmp_name' => $file_array['tmp_name'][$i], |
|
|
|
|
|
'type' => $file_array['type'][$i], |
|
|
|
|
|
'error' => $file_array['error'][$i], |
|
|
|
|
|
'size' => $file_array['size'][$i] |
|
|
|
|
|
); |
|
|
|
|
|
$i++; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$post['name'] = $_POST['name'] != '' ? $_POST['name'] : $config['anonymous']; |
|
|
$post['name'] = $_POST['name'] != '' ? $_POST['name'] : $config['anonymous']; |
|
|
$post['subject'] = $_POST['subject']; |
|
|
$post['subject'] = $_POST['subject']; |
|
|
$post['email'] = str_replace(' ', '%20', htmlspecialchars($_POST['email'])); |
|
|
$post['email'] = str_replace(' ', '%20', htmlspecialchars($_POST['email'])); |
|
@ -781,20 +803,14 @@ function handle_post(){ |
|
|
$i = 0; |
|
|
$i = 0; |
|
|
foreach ($_FILES as $key => $file) { |
|
|
foreach ($_FILES as $key => $file) { |
|
|
if ($file['size'] && $file['tmp_name']) { |
|
|
if ($file['size'] && $file['tmp_name']) { |
|
|
$file['filename'] = urldecode($file['name']); |
|
|
if (!in_array($file['error'], array(UPLOAD_ERR_NO_FILE, UPLOAD_ERR_OK))) { |
|
|
$file['extension'] = strtolower(mb_substr($file['filename'], mb_strrpos($file['filename'], '.') + 1)); |
|
|
error(sprintf3($config['error']['phpfileserror'], array( |
|
|
if (isset($config['filename_func'])) |
|
|
'index' => $i+1, |
|
|
$file['file_id'] = $config['filename_func']($file); |
|
|
'code' => $file['error'] |
|
|
else |
|
|
))); |
|
|
$file['file_id'] = time() . substr(microtime(), 2, 3); |
|
|
} |
|
|
|
|
|
$post['files'][] = process_filenames($file, $board['dir'], (sizeof($_FILES) > 1), $i); |
|
|
if (sizeof($_FILES) > 1) |
|
|
$i++; |
|
|
$file['file_id'] .= "-$i"; |
|
|
|
|
|
|
|
|
|
|
|
$file['file'] = $board['dir'] . $config['dir']['img'] . $file['file_id'] . '.' . $file['extension']; |
|
|
|
|
|
$file['thumb'] = $board['dir'] . $config['dir']['thumb'] . $file['file_id'] . '.' . ($config['thumb_ext'] ? $config['thumb_ext'] : $file['extension']); |
|
|
|
|
|
$post['files'][] = $file; |
|
|
|
|
|
$i++; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|