\n"
."\n";
cookiedecode($user);
if (($pollcomm) AND ($mode != "nocomments")) {
if ($anonpost==1 OR is_admin($admin) OR is_user($user)) {
echo "
\n"
."
"
."
"._COMMENTSWARNING."
\n"
."
"
."\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 "
";
$tblwidth -= 5;
}
}
$comments++;
if (!eregi("[a-z0-9]",$r_name)) $r_name = $anonymous;
if (!eregi("[a-z0-9]",$r_subject)) $r_subject = "["._NOSUBJECT."]";
// enter hex color between first two appostrophe for second alt bgcolor
$r_bgcolor = ($dummy%2)?"":"#E6E6D2";
echo "";
echo "
";
formatTimestamp($r_date);
if ($r_email) {
echo "
$subject ";
if(!$cookie[7]) {
echo "("._SCORE." $score";
if($reason>0) echo ", $reasons[$reason]";
echo ")";
}
echo " "._BY." $name "._ON." $datetime";
}
// If you are admin you can see the Poster IP address (you have this right, no?)
// with this you can see who is flaming you... ha-ha-ha
if ($name != $anonymous) { echo " ("._USERINFO." | "._SENDAMSG.") "; }
if (eregi("http://",$url)) { echo "$url "; }
if(is_admin($admin)) {
$result= mysql_query("select host_name from $prefix"._pollcomments." where tid='$tid'");
list($host_name) = mysql_fetch_row($result);
echo " (IP: $host_name)";
}
echo "
";
if ($posttype=="exttrans") {
echo nl2br(htmlspecialchars($comment));
} elseif ($posttype=="plaintext") {
echo nl2br($comment);
} else {
echo $comment;
}
CloseTable();
echo " ";
OpenTable();
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;
}
?>