From 0f8cd197ac0965f51256423c0b776dba651e2c2d Mon Sep 17 00:00:00 2001 From: Visman Date: Sun, 8 Jan 2017 11:47:41 +0700 Subject: [PATCH] Deleted POST, GET ... --- post.php | 60 +++++++++++---------- profile.php | 148 ++++++++++++++++++++++++++------------------------- register.php | 43 +++++++-------- search.php | 76 +++++++++++++------------- upfiles.php | 22 ++++---- 5 files changed, 180 insertions(+), 169 deletions(-) diff --git a/post.php b/post.php index a5b6ff53..8fcc5ad6 100644 --- a/post.php +++ b/post.php @@ -14,8 +14,10 @@ if ($pun_user['g_read_board'] == '0') message($lang_common['No view'], false, '403 Forbidden'); -$tid = isset($_GET['tid']) ? intval($_GET['tid']) : 0; -$fid = isset($_GET['fid']) ? intval($_GET['fid']) : 0; +$request = $container->get('Request'); + +$tid = $request->getInt('tid', 0); +$fid = $request->getInt('fid', 0); if ($tid < 1 && $fid < 1 || $tid > 0 && $fid > 0) message($lang_common['Bad request'], false, '404 Not Found'); @@ -68,12 +70,12 @@ $errors = array(); // Did someone just hit "Submit" or "Preview"? -if (isset($_POST['form_sent'])) +if ($request->isPost('form_sent')) { flux_hook('post_before_validation'); // Flood protection - if (!isset($_POST['preview']) && $pun_user['last_post'] != '' && (time() - $pun_user['last_post']) < $pun_user['g_post_flood']) + if (! $request->isPost('preview') && $pun_user['last_post'] != '' && (time() - $pun_user['last_post']) < $pun_user['g_post_flood']) $errors[] = sprintf($lang_post['Flood start'], $pun_user['g_post_flood'], $pun_user['g_post_flood'] - (time() - $pun_user['last_post'])); // Make sure they got here from the site @@ -82,7 +84,7 @@ if (isset($_POST['form_sent'])) // If it's a new topic if ($fid) { - $subject = pun_trim($_POST['req_subject']); + $subject = trim($request->postStr('req_subject')); if ($pun_config['o_censoring'] == '1') $censored_subject = pun_trim(censor_words($subject)); @@ -106,8 +108,8 @@ if (isset($_POST['form_sent'])) // Otherwise it should be in $_POST else { - $username = pun_trim($_POST['req_username']); - $email = strtolower(pun_trim(($pun_config['p_force_guest_email'] == '1') ? $_POST['req_email'] : $_POST['email'])); + $username = trim($request->postStr('req_username')); + $email = strtolower(pun_trim($request->postStr($pun_config['p_force_guest_email'] == '1' ? 'req_email' : 'email'))); $banned_email = false; // Load the register.php/prof_reg.php language files @@ -136,7 +138,7 @@ if (isset($_POST['form_sent'])) } // Clean up message from POST - $orig_message = $message = pun_linebreaks(pun_trim($_POST['req_message'])); + $orig_message = $message = pun_linebreaks(trim($request->postStr('req_message'))); // Here we use strlen() not pun_strlen() as we want to limit the post to PUN_MAX_POSTSIZE bytes, not characters if (pun_strlen($message) > PUN_MAX_POSTSIZE) @@ -165,9 +167,9 @@ if (isset($_POST['form_sent'])) } } - $hide_smilies = isset($_POST['hide_smilies']) ? '1' : '0'; - $subscribe = isset($_POST['subscribe']) ? '1' : '0'; - $stick_topic = isset($_POST['stick_topic']) && $is_admmod ? '1' : '0'; + $hide_smilies = $request->isPost('hide_smilies') ? '1' : '0'; + $subscribe = $request->isPost('subscribe') ? '1' : '0'; + $stick_topic = $request->isPost('stick_topic') && $is_admmod ? '1' : '0'; // Replace four-byte characters (MySQL cannot handle them) $message = strip_bad_multibyte_chars($message); @@ -181,12 +183,12 @@ if (isset($_POST['form_sent'])) flux_hook('post_after_validation'); // Did everything go according to plan? - if (empty($errors) && !isset($_POST['preview'])) + if (empty($errors) && ! $request->isPost('preview')) { require PUN_ROOT.'include/search_idx.php'; // START Merge Post - if (isset($pun_config['o_merge_timeout']) && !$pun_user['is_guest'] && !$fid && (($is_admmod && !empty($_POST['merge'])) || !$is_admmod) && $cur_posting['poster_id']!=NULL && $cur_posting['message']!=NULL && ($now - $cur_posting['posted'])<$pun_config['o_merge_timeout'] && (pun_strlen($cur_posting['message'].$message) + 100 < PUN_MAX_POSTSIZE)) + if (isset($pun_config['o_merge_timeout']) && !$pun_user['is_guest'] && !$fid && (($is_admmod && $request->isPost('merge')) || !$is_admmod) && $cur_posting['poster_id']!=NULL && $cur_posting['message']!=NULL && ($now - $cur_posting['posted'])<$pun_config['o_merge_timeout'] && (pun_strlen($cur_posting['message'].$message) + 100 < PUN_MAX_POSTSIZE)) { $message= '[after='.($now - $cur_posting['posted']).']'."\n".$message; $merged = true; @@ -327,7 +329,7 @@ if (isset($_POST['form_sent'])) // If it's a new topic else if ($fid) { - $stick_fp = ($is_admmod && isset($_POST['stickfp'])) ? 1 : 0; // StickFP - Visman + $stick_fp = ($is_admmod && $request->isPost('stickfp')) ? 1 : 0; // StickFP - Visman // Create the topic $db->query('INSERT INTO '.$db->prefix.'topics (stick_fp, poster, subject, posted, last_post, last_poster, sticky, forum_id) VALUES('.$stick_fp.', \''.$db->escape($username).'\', \''.$db->escape($subject).'\', '.$now.', '.$now.', \''.$db->escape($username).'\', '.$stick_topic.', '.$fid.')') or error('Unable to create topic', __FILE__, __LINE__, $db->error()); $new_tid = $db->insert_id(); @@ -502,9 +504,9 @@ if ($tid) $form = '
'; // If a quote ID was specified in the url - if (isset($_GET['qid'])) + if ($request->isGet('qid')) { - $qid = intval($_GET['qid']); + $qid = $request->getInt('qid', 0); if ($qid < 1) message($lang_common['Bad request'], false, '404 Not Found'); @@ -608,7 +610,7 @@ require PUN_ROOT.'header.php';