From 24503e3abe705acde2df159aeae61be0d009f92e Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Wed, 19 Nov 2008 17:27:03 -0500 Subject: Imported sources --- includes/comments.php | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 includes/comments.php (limited to 'includes/comments.php') diff --git a/includes/comments.php b/includes/comments.php new file mode 100644 index 0000000..9cb8b18 --- /dev/null +++ b/includes/comments.php @@ -0,0 +1,97 @@ +add('PAGEID',$page_id); +$template->add('CODEDDEF',urlencode('http://www.fourisland.com/images/error404.png')); +$template->add('USERNAME',(isLoggedIn() ? sess_get('uname') : 'Anonymous')); + +if (!isLoggedIn()) +{ + $template->add('RECAPTCHA',recaptcha_get_html($publickey)); + $template->adds_block('NOLOG',array('exi'=>1)); +} + +$getcomments = "SELECT * FROM comments WHERE page_id = \"" . $page_id . "\" ORDER BY posttime"; +$getcomments2 = mysql_query($getcomments) or die($getcomments); +$i=0; +while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) +{ + $getuser = "SELECT * FROM users WHERE username = \"" . $getcomments3[$i]['username'] . "\""; + $getuser2 = mysql_query($getuser); + $getuser3 = mysql_fetch_array($getuser2); + + if ($getuser3['username'] == $getcomments3[$i]['username']) + { + $username = $getuser3['username']; + $email = $getuser3['user_email']; + $website = $getuser3['website']; + } else { + $getanon = "SELECT * FROM anon_commenters WHERE username = \"" . $getcomments3[$i]['username'] . "\""; + $getanon2 = mysql_query($getanon); + $getanon3 = mysql_fetch_array($getanon2); + + if ($getanon3['username'] == $getcomments3[$i]['username']) + { + $username = $getanon3['username'] . ' (Guest)'; + $email = $getanon3['email']; + $website = $getanon3['website']; + } + } + + if (isset($username)) + { + if ($getcomments3[$i]['rating'] > -2) + { + $text = parseBBCode($getcomments3[$i]['comment']); + } else { + $text = 'This comment has been rated down below the threshold for public viewing (-1), suggesting that it may contain inappropriate or off topic content. (Or it may have been flame bait, or simply bad!)'; + } + + if ($getcomments3[$i]['title'] != '') + { + $title2 = $getcomments3[$i]['title']; + } else { + $title2 = 'Untitled'; + } + + $template->add_ref($curID, 'COMMENTS', array( 'CODEDEMAIL' => md5(strtolower($email)), + 'USERNAME' => (($website != '') ? '' . $username . '' : $username), + 'DATE' => date("F dS Y \a\\t g:i:s a",strtotime($getcomments3[$i]['posttime'])), + 'RATING' => $getcomments3[$i]['rating'], + 'ID' => $getcomments3[$i]['id'], + 'TEXT' => $text, + 'TITLE' => $title2)); + } + $i++; +} +$template->display(); + +?> -- cgit 1.4.1