From 893957c41481a0cd5eb624096337762ffa54ff28 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Sun, 9 Aug 2009 09:14:58 -0400 Subject: Created layout 7 The following changes were also made in this revision: * All HTML was changed to XHTML and a !DOCTYPE was included to reflect this * Rewrote quotes tracking system to be much less complicated and actually working * Changed quotes rendering to look more like Chirpy than Rash * Fixed comment textarea bug * Rewrote a ton of CSS so it's not as bloated * Added a JavaScript confirmation when deleting a comment * AJAXified voting on the POTW * AJAXified voting and flagging quotes * AJAXified commenting * AJAXified voting on posts * Added DateFinder back after it was accidentally deleted in Layout 4.5 The following database changes must be performed as soon as possible: * Fix title of NO post (the < is missing the semicolon) * Restore post Frasty Tha Snaman from a backup * Reset "flag" field of all rows in "rash_quotes" to 0 * Remove the "vote" and "flag" columns of "rash_tracking" * Rename the "quote_id" column of "rash_tracking" to "vote" The following external code changes must also be performed as soon as possible: * Add the following line to the end of the // Four Island block in The Fourm's functions.php: require('/svr/www/hatkirby/fourisland/main/includes/specialdates.php'); --- pages/post.php | 103 +++++++++++++++++++++++++++++++++------------------------ 1 file changed, 59 insertions(+), 44 deletions(-) (limited to 'pages/post.php') diff --git a/pages/post.php b/pages/post.php index 87413e8..121435a 100755 --- a/pages/post.php +++ b/pages/post.php @@ -22,74 +22,79 @@ if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} require('headerproc.php'); -$pageCategory = 'home'; -$pageAID = 'archive'; - include('includes/recaptchalib.php'); $privatekey = "6LfgvgEAAAAAAD0_UVLp57MU7tqcypsbZPS9qTnr"; -$template = new FITemplate('msg'); -$template->add('BACK','the previous page'); - -if (!isset($_GET['id'])) +if (!isset($_POST['id'])) { - $template->add('MSG','I\'m sorry, but there\'s no page-id set here, so sadly you can\'t comment yet. Why not contact the administratior (link on the HatBar) and tell her that you saw this error?'); + generateError('404'); } else { if ($_POST['comment'] == "") { - $template->add('MSG','I\'m sorry, but you didn\'t enter a comment!'); + die('I\'m sorry, but you didn\'t enter a comment!'); } else { if (!isLoggedIn()) { - $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); - if (!$resp->is_valid) + if ($_POST['username'] == "") { - $template->add('MSG',"The reCAPTCHA wasn't entered correctly. Go back and try it again. (reCAPTCHA said: " . $resp->error . ")"); + die('You forgot to enter a username.'); } else { if (preg_match('/^[A-Za-z0-9!#$&\'*+-\/=?^_`{|}~]+@[-A-Za-z0-9]+(\.[-A-Za-z0-9]+)+[A-Za-z]$/', $_POST['email'])) { - $getanon = "SELECT * FROM anon_commenters WHERE username = \"" . $_POST['username'] . "\""; - $getanon2 = mysql_query($getanon); - $getanon3 = mysql_fetch_array($getanon2); - - if ($getanon3['username'] == $_POST['username']) + $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); + if (!$resp->is_valid) { - if ($getanon3['email'] == $_POST['email']) - { - $setcomment = "INSERT INTO comments SET page_id = \"" . $_GET['id'] . "\", user_id = " . $getanon3['id'] . ", comment = \"" . $_POST['comment'] . "\", is_anon = 1"; - $setcomment2 = mysql_query($setcomment); + die('The reCAPTCHA wasn\'t entered correctly. Go back and try it again.'); + } else { + $getanon = "SELECT * FROM anon_commenters WHERE username = \"" . $_POST['username'] . "\""; + $getanon2 = mysql_query($getanon); + $getanon3 = mysql_fetch_array($getanon2); - $page_id = $_GET['id']; - $comType = substr($page_id,0,strpos($page_id,'-')); - $comID = substr($page_id,strpos($page_id,'-')+1); - if ($comType == 'updates') + if ($getanon3['username'] == $_POST['username']) + { + if ($getanon3['email'] == $_POST['email']) { - recalcPop($comID); + $setcomment = "INSERT INTO comments SET page_id = \"" . $_POST['id'] . "\", user_id = " . $getanon3['id'] . ", comment = \"" . $_POST['comment'] . "\", is_anon = 1"; + $setcomment2 = mysql_query($setcomment); + $cid = mysql_insert_id(); + + $page_id = $_POST['id']; + $comType = substr($page_id,0,strpos($page_id,'-')); + $comID = substr($page_id,strpos($page_id,'-')+1); + if ($comType == 'updates') + { + recalcPop($comID); + } + + $template = new FITemplate('new-comment'); + $template->add('ID', $cid); + $template->add('CODEDEMAIL', md5(strtolower($getanon3['email']))); + $template->add('TEXT', stripslashes($_POST['comment'])); + $template->add('USERNAME', $getanon3['username']); + $template->add('DATE', date("F jS Y \a\\t g:i:s a")); + $template->display(); + + exit; + } else { + die('I\'m sorry, but this anonymous username is already in use. If this is in fact you, please verify that you have entered the same email address that you entered the first time you commented here.'); } - - $template->add('MSG',"Thank you, " . $getanon3['username'] . ", for posting your valuable comment!"); } else { - $template->add('MSG',"I'm sorry, but this anonymous username is already in use. If this is in fact you, please verify that you have entered the same email address that you entered the first time you commented here."); - } - } else { - $setcomment = "INSERT INTO moderation SET page_id = \"" . $_GET['id'] . "\", author = \"" . $_POST['username'] . "\", email = \"" . $_POST['email'] . "\", comment = \"" . $_POST['comment'] . "\", website = \"" . $_POST['website'] . "\""; - $setcomment2 = mysql_query($setcomment); - - mail('hatkirby@fourisland.com', 'New comment to moderate on Four Island', 'Some one has anonymously left a comment on Four Island and it will require moderation.'); + $setcomment = "INSERT INTO moderation SET page_id = \"" . $_POST['id'] . "\", author = \"" . $_POST['username'] . "\", email = \"" . $_POST['email'] . "\", comment = \"" . $_POST['comment'] . "\", website = \"" . $_POST['website'] . "\""; + $setcomment2 = mysql_query($setcomment); - $template->add('MSG',"Thank you for posting your valuable comment!

However, as you aren't logged in, your comment will have to be verified by a moderator before it appears. Sorry!"); + die('Thank you for posting your valuable comment!
However, as you aren\'t logged in, your comment will have to be verified by a moderator before it appears. Sorry!'); + } } } else { - $template->add('MSG',"I'm sorry, but you've entered an invalid email address."); + die('I\'m sorry, but you\'ve entered an invalid email address.'); } } } else { - $setcomment = "INSERT INTO comments SET page_id = \"" . $_GET['id'] . "\", user_id = " . getSessionUserID() . ", comment = \"" . $_POST['comment'] . "\", is_anon = 0"; + $setcomment = "INSERT INTO comments SET page_id = \"" . $_POST['id'] . "\", user_id = " . getSessionUserID() . ", comment = \"" . $_POST['comment'] . "\", is_anon = 0"; $setcomment2 = mysql_query($setcomment); + $cid = mysql_insert_id(); - mail('hatkirby@fourisland.com', 'New comment on Four Island!', getSessionUsername() . ' has posted a comment on Four Island under the "page id" ' . $_GET['id']); - - $page_id = $_GET['id']; + $page_id = $_POST['id']; $comType = substr($page_id,0,strpos($page_id,'-')); $comID = substr($page_id,strpos($page_id,'-')+1); if ($comType == 'updates') @@ -97,11 +102,21 @@ if (!isset($_GET['id'])) recalcPop($comID); } - $template->add('MSG',"Thank you, " . getSessionUsername() . ", for posting your valuable comment!"); + $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . getSessionUserID(); + $getuser2 = mysql_query($getuser); + $getuser3 = mysql_fetch_array($getuser2); + + $template = new FITemplate('new-comment'); + $template->add('ID', $cid); + $template->add('CODEDEMAIL', md5(strtolower($getuser3['user_email']))); + $template->add('TEXT', stripslashes($_POST['comment'])); + $template->add('USERNAME', getSessionUsername()); + $template->add('DATE', date("F jS Y \a\\t g:i:s a")); + $template->display(); + + exit; } } } -$template->display(); - ?> -- cgit 1.4.1