1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-30 18:24:29 +01:00

Get board information earlier so errors can be properly displayed with a link back to the index.

This commit is contained in:
Savetheinternet 2010-11-30 23:17:26 +11:00 committed by Paul Merrill
parent 5e5a988ead
commit 5962ea3d8c

View File

@ -30,7 +30,7 @@
!isset($_POST['password']) !isset($_POST['password'])
) error(ERROR_BOT); ) error(ERROR_BOT);
$post = Array(); $post = Array('board' => $_POST['board']);
if(isset($_POST['thread'])) { if(isset($_POST['thread'])) {
$OP = false; $OP = false;
@ -57,6 +57,17 @@
if(time()-$user['appeared']<LURKTIME) error(ERROR_LURK); if(time()-$user['appeared']<LURKTIME) error(ERROR_LURK);
*/ */
// Open database connection
sql_open();
// Check if board exists
if(!openBoard($post['board']))
error(ERROR_NOBOARD);
//Check if thread exists
if(!$OP && !threadExists($post['thread']))
error(ERROR_NONEXISTANT);
// Check for a file // Check for a file
if($OP) { if($OP) {
if(!isset($_FILES['file']['tmp_name']) || empty($_FILES['file']['tmp_name'])) if(!isset($_FILES['file']['tmp_name']) || empty($_FILES['file']['tmp_name']))
@ -70,7 +81,6 @@
$post['password'] = $_POST['password']; $post['password'] = $_POST['password'];
$post['filename'] = $_FILES['file']['name']; $post['filename'] = $_FILES['file']['name'];
$post['has_file'] = $OP || !empty($_FILES['file']['tmp_name']); $post['has_file'] = $OP || !empty($_FILES['file']['tmp_name']);
$post['board'] = $_POST['board'];
if($post['has_file']) { if($post['has_file']) {
$size = $_FILES['file']['size']; $size = $_FILES['file']['size'];
@ -81,11 +91,6 @@
'maxsz'=>commaize(MAX_FILESIZE)))); 'maxsz'=>commaize(MAX_FILESIZE))));
} }
sql_open();
if(!openBoard($post['board'])) error(ERROR_NOBOARD);
if(!$OP && !threadExists($post['thread']))
error(ERROR_NONEXISTANT);
$trip = generate_tripcode($post['name']); $trip = generate_tripcode($post['name']);
$post['name'] = $trip[0]; $post['name'] = $trip[0];
$post['trip'] = (isset($trip[1])?$trip[1]:''); $post['trip'] = (isset($trip[1])?$trip[1]:'');