"; } function modtwo($tid, $score, $reason) { global $admin, $user, $moderate, $reasons; if((((isset($admin)) && ($moderate == 1)) || ($moderate == 2)) && ($user)) { echo " | "; } } function modthree($pollID, $mode, $order, $thold=0) { global $admin, $user, $moderate, $userimg; if((((isset($admin)) && ($moderate == 1)) || ($moderate==2)) && ($user)) echo "
"; } function navbar($pollID, $title, $thold, $mode, $order) { global $user, $bgcolor1, $bgcolor2, $textcolor1, $textcolor2, $anonpost, $pollcomm, $prefix; $query = mysql_query("select pollID FROM $prefix"._pollcomments." where pollID=$pollID"); if(!$query) $count = 0; else $count = mysql_num_rows($query); $result = mysql_query("select pollTitle from $prefix"._poll_desc." where pollID=$pollID"); list($title) = mysql_fetch_row($result); if(!isset($thold)) $thold=0; echo "\n\n\n\n"; echo "\n"; if($title) { echo "\n"; } else { echo " | $count "._COMMENTS."\n"; } } echo "" ."\n" ."
\"$title\" | "; if(is_user($user)) { echo ""._CONFIGURE.""; } else { echo ""._LOGINCREATE.""; } if(($count==1)) { echo " | $count "._COMMENT."
\n" ."
\n" ."
\n" .""._THRESHOLD." \n" ."\n" ."
\n"; cookiedecode($user); if (($pollcomm) AND ($mode != "nocomments")) { if ($anonpost==1 OR is_admin($admin) OR is_user($user)) { echo "
" ."" ."" ."" ."  "; } } echo "
\n" ."
"._COMMENTSWARNING."
" ."\n\n\n\n"; } function DisplayKids ($tid, $mode, $order=0, $thold=0, $level=0, $dummy=0, $tblwidth=99) { global $datetime, $user, $cookie, $bgcolor1, $reasons, $anonymous, $anonpost, $commentlimit, $prefix; $comments = 0; cookiedecode($user); $result = mysql_query("select tid, pid, pollID, date, name, email, url, host_name, subject, comment, score, reason from $prefix"._pollcomments." where pid = $tid order by date, tid"); if ($mode == 'nested') { /* without the tblwidth variable, the tables run of the screen with netscape in nested mode in long threads so the text can't be read. */ while (list($r_tid, $r_pid, $r_pollID, $r_date, $r_name, $r_email, $r_url, $r_host_name, $r_subject, $r_comment, $r_score, $r_reason) = mysql_fetch_row($result)) { if($r_score >= $thold) { if (!isset($level)) { } else { if (!$comments) { echo ""; if($hr) echo "
"; echo "

"; $count_times += 1; } modthree($pollID, $mode, $order, $thold); if($pid==0) return array($pollID, $pid, $subject); else include("footer.php"); } function singlecomment($tid, $pollID, $mode, $order, $thold) { //include("mainfile.php"); include("header.php"); global $user, $cookie, $datetime, $bgcolor1, $bgcolor2, $bgcolor3, $anonpost, $admin, $anonymous, $prefix; $deekayen = mysql_query("select date, name, email, url, subject, comment, score, reason from $prefix"._pollcomments." where tid=$tid and pollID=$pollID"); list($date, $name, $email, $url, $subject, $comment, $score, $reason) = mysql_fetch_row($deekayen); $titlebar = "$subject"; if($name == "") $name = $anonymous; if($subject == "") $subject = "["._NOSUBJECT."]"; modone(); echo "
"; formatTimestamp($date); if($email) echo "

$subject ("._SCORE." $score)
"._BY." $name ($email) "._ON." $datetime"; else echo "

$subject ("._SCORE." $score)
"._BY." $name "._ON." $datetime"; echo "

$comment

[ "._REPLY." | "._ROOT.""; modtwo($tid, $score, $reason); echo " ]"; modthree($pollID, $mode, $order, $thold); include("footer.php"); } function reply ($pid, $pollID, $mode, $order, $thold) { //include("mainfile.php"); include("header.php"); global $user, $cookie, $datetime, $bgcolor1, $bgcolor2, $bgcolor3, $AllowableHTML, $anonymous, $prefix, $anonpost; if($pid!=0) { list($date, $name, $email, $url, $subject, $comment, $score) = mysql_fetch_row(mysql_query("select date, name, email, url, subject, comment, score from $prefix"._pollcomments." where tid=$pid")); } else { list($subject) = mysql_fetch_row(mysql_query("select pollTitle FROM $prefix"._poll_desc." where pollID=$pollID")); } if($comment == "") { $comment = $temp_comment; } $titlebar = "$subject"; if($name == "") $name = $anonymous; if($subject == "") $subject = "["._NOSUBJECT."]"; formatTimestamp($date); OpenTable(); echo "

"._SURVEYCOM."
"; CloseTable(); echo "
"; OpenTable(); echo "
$subject

"; if ($comment == "") { echo "
"._DIRECTCOM."

"; } else { echo "
$comment
"; } CloseTable(); if(!isset($pid) || !isset($pollID)) { echo "Something is not right. This message is just to keep things from messing up down the road"; exit(); } if($pid == 0) { list($subject) = mysql_fetch_row(mysql_query("select pollTitle from $prefix"._poll_desc." where pollID=$pollID")); } else { list($subject) = mysql_fetch_row(mysql_query("select subject from $prefix"._pollcomments." where tid=$pid")); } echo "
"; OpenTable(); echo "
"; echo ""._YOURNAME.": "; if (is_user($user)) { cookiedecode($user); echo "$cookie[1] [ "._LOGOUT." ]"; } else { echo "$anonymous"; $xanonpost=1; } echo "

"._SUBJECT.":
"; if (!eregi("Re:",$subject)) $subject = "Re: ".substr($subject,0,81).""; echo "
"; echo "

"._UCOMMENT.":
" ."
"._ALLOWEDHTML."
"; while (list($key,)= each($AllowableHTML)) echo " <".$key.">"; echo "
"; if (is_user($user) AND ($anonpost == 1)) { echo " "._POSTANON."
"; } echo "" ."" ."" ."" ."" ."" ."" ."" .""; CloseTable(); include("footer.php"); } function replyPreview ($pid, $pollID, $subject, $comment, $xanonpost, $mode, $order, $thold, $posttype) { //include("mainfile.php"); include("header.php"); global $user, $cookie, $AllowableHTML, $anonymous; cookiedecode($user); $subject = stripslashes($subject); $comment = stripslashes($comment); if (!isset($pid) || !isset($pollID)) { echo ""._NOTRIGHT.""; exit(); } OpenTable(); echo "
"._SURVEYCOMPRE."
"; CloseTable(); echo "
"; OpenTable(); echo "$subject
"; echo ""._BY." "; if (is_user($user)) { echo "$cookie[1]"; } else { echo "$anonymous "; } echo ""._ONN."

"; if ($posttype=="exttrans") { echo nl2br(htmlspecialchars($comment)); } elseif ($posttype=="plaintext") { echo nl2br($comment); } else { echo $comment; } CloseTable(); echo "
"; OpenTable(); echo "
" .""._YOURNAME.": "; if (is_user($user)) { echo "$cookie[1] [ "._LOGOUT." ]"; } else { echo "$anonymous"; } echo "

"._SUBJECT.":
" ."

" ."

"._UCOMMENT.":
" ."
"; echo""._ALLOWEDHTML."
"; while (list($key,)= each($AllowableHTML)) echo " <".$key.">"; echo "
"; if (($xanonpost) AND ($anonpost == 1)) { echo " "._POSTANON."
"; } elseif ((is_user($user)) AND ($anonpost == 1)) { echo " "._POSTANON."
"; } echo "" ."" ."" ."" ." "; CloseTable(); include("footer.php"); } function CreateTopic ($xanonpost, $subject, $comment, $pid, $pollID, $host_name, $mode, $order, $thold, $posttype) { global $user, $userinfo, $EditedMessage, $cookie, $prefix; //include("mainfile.php"); $author = FixQuotes($author); $subject = FixQuotes(filter_text($subject, "nohtml")); if($posttype=="exttrans") $comment = FixQuotes(nl2br(htmlspecialchars(check_words($comment)))); elseif($posttype=="plaintext") $comment = FixQuotes(nl2br(filter_text($comment))); else $comment = FixQuotes(filter_text($comment)); if($user) getusrinfo($user); if (($user) && (!$xanonpost)) { getusrinfo($user); $name = $userinfo[uname]; $email = $userinfo[femail]; $url = $userinfo[url]; $score = 1; } else { $name = ""; $email = ""; $url = ""; $score = 0; } $ip = getenv("REMOTE_HOST"); if (empty($ip)) { $ip = getenv("REMOTE_ADDR"); } //begin fake thread control list($fake) = mysql_fetch_row(mysql_query("select count(*) from $prefix"._poll_desc." where pollID=$pollID")); mysql_query("LOCK TABLES $prefix"._pollcomments." WRITE"); //begin duplicate control list($tia) = mysql_fetch_row(mysql_query("select count(*) from $prefix"._pollcomments." where pid='$pid' and pollID='$pollID' and subject='$subject' and comment='$comment'")); //begin troll control if($user) { list($troll) = mysql_fetch_row(mysql_query("select count(*) from $prefix"._pollcomments." where (score=-1) and (name='$userinfo[uname]') and (to_days(now()) - to_days(date) < 3)")); } elseif(!$score) { list($troll) = mysql_fetch_row(mysql_query("select count(*) from $prefix"._pollcomments." where (score=-1) and (host_name='$ip') and (to_days(now()) - to_days(date) < 3)")); } if((!$tia) && ($fake == 1) && ($troll < 6)) { mysql_query("insert into $prefix"._pollcomments." values (NULL, '$pid', '$pollID', now(), '$name', '$email', '$url', '$ip', '$subject', '$comment', '$score', '0')"); } else { mysql_query("UNLOCK TABLES"); include("header.php"); if($tia) echo "Duplicate. Did you submit twice?

Back to Poll"; elseif($troll > 5) echo "This account or IP has been temporarily disabled. This means that either this IP, or user account has been moderated down more than 5 times in the last few hours. If you think this is unfair, you should contact the admin. If you are being a troll, now is the time for you to either grow up, or change your IP.

Back to Poll"; elseif($fake == 0) echo "According to my records, the topic you are trying to reply to does not exist. If you're just trying to be annoying, well then too bad."; include("footer.php"); exit; } mysql_query("UNLOCK TABLES"); Header("Location: pollBooth.php?op=results&pollID=$pollID"); } switch($op) { case "Reply": reply($pid, $pollID, $mode, $order, $thold); break; case ""._PREVIEW."": replyPreview ($pid, $pollID, $subject, $comment, $xanonpost, $mode, $order, $thold, $posttype); break; case ""._OK."": CreateTopic($xanonpost, $subject, $comment, $pid, $pollID, $host_name, $mode, $order, $thold, $posttype); break; case "moderate": if(isset($admin)) { include("auth.inc.php"); } else { include("mainfile.php"); } if(($admintest==1) || ($moderate==2)) { while(list($tdw, $emp) = each($HTTP_POST_VARS)) { if (eregi("dkn",$tdw)) { $emp = explode(":", $emp); if($emp[1] != 0) { $tdw = ereg_replace("dkn", "", $tdw); $q = "UPDATE $prefix"._pollcomments." SET"; if(($emp[1] == 9) && ($emp[0]>=0)) { # Overrated $q .= " score=score-1 where tid=$tdw"; } elseif (($emp[1] == 10) && ($emp[0]<=4)) { # Underrated $q .= " score=score+1 where tid=$tdw"; } elseif (($emp[1] > 4) && ($emp[0]<=4)) { $q .= " score=score+1, reason=$emp[1] where tid=$tdw"; } elseif (($emp[1] < 5) && ($emp[0] > -1)) { $q .= " score=score-1, reason=$emp[1] where tid=$tdw"; } elseif (($emp[0] == -1) || ($emp[0] == 5)) { $q .= " reason=$emp[1] where tid=$tdw"; } if(strlen($q) > 20) mysql_query("$q"); } } } } Header("Location: pollBooth.php?op=results&pollID=$pollID"); break; case "showreply": DisplayTopic($pollID, $pid, $tid, $mode, $order, $thold); break; default: if ((isset($tid)) && (!isset($pid))) { singlecomment($tid, $pollID, $mode, $order, $thold); } elseif (($mainfile) xor (($pid==0) AND (!isset($pid)))) { Header("Location: pollBooth.php?op=results&pollID=$pollID&mode=$mode&order=$order&thold=$thold"); } else { if(!isset($pid)) $pid=0; DisplayTopic($pollID, $pid, $tid, $mode, $order, $thold); } break; } ?>