home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 April / PCWorld_2005-04_cd.bin / akce / web / unitednuke / unitednuke.exe / html / modules / Surveys / comments.php next >
PHP Script  |  2004-01-10  |  41KB  |  924 lines

  1. <?php
  2.  
  3. /************************************************************************/
  4. /* PHP-NUKE: Web Portal System                                          */
  5. /* ===========================                                          */
  6. /*                                                                      */
  7. /* Copyright (c) 2002 by Francisco Burzi                                */
  8. /* http://phpnuke.org                                                   */
  9. /*                                                                      */
  10. /* This program is free software. You can redistribute it and/or modify */
  11. /* it under the terms of the GNU General Public License as published by */
  12. /* the Free Software Foundation; either version 2 of the License.       */
  13. /************************************************************************/
  14.  
  15. if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
  16.     die ("You can't access this file directly...");
  17. }
  18. require_once("mainfile.php");
  19. $module_name = basename(dirname(__FILE__));
  20. get_lang($module_name);
  21. $pagetitle = "- "._SURVEYS."";
  22.  
  23. function format_url($comment) {
  24.     global $nukeurl;
  25.     unset($location);
  26.     $comment = $comment;
  27.     $links = array();
  28.     $hrefs = array();
  29.     $pos = 0;
  30.     while (!(($pos = strpos($comment,"<",$pos)) === false)) {
  31.     $pos++;
  32.     $endpos = strpos($comment,">",$pos);
  33.     $tag = substr($comment,$pos,$endpos-$pos);
  34.     $tag = trim($tag);
  35.     if (isset($location)) {
  36.             if (!strcasecmp(strtok($tag," "),"/A")) {
  37.             $link = substr($comment,$linkpos,$pos-1-$linkpos);
  38.             $links[] = $link;
  39.             $hrefs[] = $location;
  40.             unset($location);
  41.             }
  42.         $pos = $endpos+1;
  43.     } else {
  44.         if (!strcasecmp(strtok($tag," "),"A")) {
  45.         if (eregi("HREF[ \t\n\r\v]*=[ \t\n\r\v]*\"([^\"]*)\"",$tag,$regs));
  46.         else if (eregi("HREF[ \t\n\r\v]*=[ \t\n\r\v]*([^ \t\n\r\v]*)",$tag,$regs));
  47.         else $regs[1] = "";
  48.         if ($regs[1]) {
  49.                 $location = $regs[1];
  50.         }
  51.         $pos = $endpos+1;
  52.         $linkpos = $pos;
  53.         } else {
  54.         $pos = $endpos+1;
  55.         }
  56.     }
  57.     }
  58.     for ($i=0; $i<sizeof($links); $i++) {
  59.     if (!eregi("://", $hrefs[$i])) {
  60.         $hrefs[$i] = $nukeurl;
  61.     } elseif (!eregi("mailto://", $hrefs[$i])) {
  62.         $href = explode("/",$hrefs[$i]);
  63.         $href = " [$href[2]]";
  64.         $comment = ereg_replace(">$links[$i]</a>", "title='$hrefs[$i]'> $links[$i]</a>$href", $comment);
  65.     }
  66.     }
  67.     return($comment);
  68. }
  69.  
  70. function modone() {
  71.     global $admin, $moderate, $module_name;
  72.     if(((isset($admin)) && ($moderate == 1)) || ($moderate==2)) echo "<form action=\"modules.php?name=$module_name&file=comments\" method=\"post\">";
  73. }
  74.  
  75. function modtwo($tid, $score, $reason) {
  76.     global $admin, $user, $moderate, $reasons;
  77.     if((((isset($admin)) && ($moderate == 1)) || ($moderate == 2)) && ($user)) {
  78.         echo " | <select name=dkn$tid>";
  79.         for($i=0; $i<sizeof($reasons); $i++) {
  80.             echo "<option value=\"$score:$i\">$reasons[$i]</option>\n";
  81.         }
  82.         echo "</select>";
  83.     }
  84. }
  85.  
  86. function modthree($pollID, $mode, $order, $thold=0) {
  87.     global $admin, $user, $moderate;
  88.     if((((isset($admin)) && ($moderate == 1)) || ($moderate==2)) && ($user)) echo "<center><input type=hidden name=pollID value=$pollID><input type=hidden name=mode value=$mode><input type=hidden name=order value=$order><input type=hidden name=thold value=$thold>
  89.     <input type=hidden name=op value=moderate>
  90.     <input type=image src=images/menu/moderate.gif border=0></form></center>";
  91. }
  92.  
  93. function navbar($pollID, $title, $thold, $mode, $order) {
  94.     global $user, $bgcolor1, $bgcolor2, $textcolor1, $textcolor2, $anonpost, $pollcomm, $prefix, $db, $module_name;
  95.     OpenTable();
  96.     $pollID = intval($pollID);
  97.     $query = $db->sql_query("select pollID FROM ".$prefix."_pollcomments where pollID='$pollID'");
  98.     if(!$query) {
  99.     $count = 0;
  100.     } else {
  101.     $count = $db->sql_numrows($query);
  102.     }
  103.     $row = $db->sql_fetchrow($db->sql_query("SELECT pollTitle from ".$prefix."_poll_desc where pollID='$pollID'"));
  104.     $title = $row['pollTitle'];
  105.     if(!isset($thold)) $thold=0;
  106.     echo "\n\n<!-- COMMENTS NAVIGATION BAR START -->\n\n";
  107.     echo "<table width=\"99%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\">\n";
  108.     if($title) {
  109.     echo "<tr><td bgcolor=\"$bgcolor2\" align=\"center\"><font class=\"content\" color=\"$textcolor1\">\"$title\" | ";
  110.         if(is_user($user)) {
  111.         echo "<a href=\"modules.php?name=Your_Account&op=editcomm\"><font color=\"$textcolor1\">"._CONFIGURE."</font></a>";
  112.         } else {
  113.         echo "<a href=\"modules.php?name=Your_Account\"><font color=\"$textcolor1\">"._LOGINCREATE."</font></a>";
  114.         }
  115.         if(($count==1)) {
  116.             echo " | <B>$count</B> "._COMMENT."</font></td></tr>\n";
  117.         } else {
  118.             echo " | <B>$count</B> "._NEWSPOLLCOMENTSLOWERCASE."</font></td></tr>\n";
  119.         }
  120.     }
  121.     echo "<tr><td bgcolor=\"$bgcolor1\" align=\"center\" width=\"100%\">\n"
  122.     ."<table border=\"0\"><tr><td><font class=\"content\">\n"
  123.     ."<form method=\"post\" action=\"modules.php?name=$module_name&op=results&pollID=$pollID\">\n"
  124.     ."<font color=\"$textcolor2\">"._THRESHOLD."</font> <select name=\"thold\">\n"
  125.     ."<option value=\"-1\"";
  126.     if ($thold == -1) {
  127.     echo " selected";
  128.     }
  129.     echo ">-1</option>\n"
  130.          ."<option value=\"0\"";
  131.     if ($thold == 0) {
  132.     echo " selected";
  133.     }
  134.     echo ">0</option>\n"
  135.      ."<option value=\"1\"";
  136.     if ($thold == 1) {
  137.     echo " selected";
  138.     }
  139.     echo ">1</option>\n"
  140.      ."<option value=\"2\"";
  141.     if ($thold == 2) {
  142.     echo " selected";
  143.     }
  144.     echo ">2</option>\n"
  145.      ."<option value=\"3\"";
  146.     if ($thold == 3) {
  147.     echo " selected";
  148.     }
  149.     echo ">3</option>\n"
  150.      ."<option value=\"4\"";
  151.     if ($thold == 4) {
  152.     echo " selected";
  153.     }
  154.     echo ">4</option>\n"
  155.      ."<option value=\"5\"";
  156.     if ($thold == 5) {
  157.     echo " selected";
  158.     }
  159.     echo ">5</option>\n"
  160.      ."</select> <select name=mode>"
  161.      ."<option value=\"nocomments\"";
  162.     if ($mode == 'nocomments') {
  163.     echo " selected";
  164.     }
  165.     echo ">"._NOCOMMENTS."</option>\n"
  166.      ."<option value=\"nested\"";
  167.     if (!isset($mode) || $mode == 'nested' || $mode=="") {
  168.     echo " selected";
  169.     }
  170.     echo ">"._NESTED."</option>\n"
  171.      ."<option value=\"flat\"";
  172.     if ($mode == 'flat') {
  173.     echo " selected";
  174.     }
  175.     echo ">"._FLAT."</option>\n"
  176.      ."<option value=\"thread\"";
  177.     if ($mode=='thread') {
  178.     echo " selected";
  179.     }
  180.     echo ">"._THREAD."</option>\n"
  181.      ."</select> <select name=\"order\">"
  182.      ."<option value=\"0\"";
  183.     if (!$order) {
  184.     echo " selected";
  185.     }
  186.     echo ">"._OLDEST."</option>\n"
  187.      ."<option value=\"1\"";
  188.     if ($order==1) {
  189.     echo " selected";
  190.     }
  191.     echo ">"._NEWEST."</option>\n"
  192.          ."<option value=\"2\"";
  193.     if ($order==2) {
  194.     echo " selected";
  195.     }
  196.     echo ">"._HIGHEST."</option>\n"
  197.      ."</select>\n"
  198.      ."<input type=\"hidden\" name=\"sid\" value=\"$sid\">\n"
  199.      ."<input type=\"submit\" value=\""._REFRESH."\"></form>\n";
  200.     cookiedecode($user);
  201.     if (($pollcomm) AND ($mode != "nocomments")) {
  202.     if ($anonpost==1 OR is_admin($admin) OR is_user($user)) {
  203.         echo "</font></td><td bgcolor=\"$bgcolor1\" valign=\"top\"><font class=\"content\"><form action=\"modules.php?name=$module_name&file=comments\" method=\"post\">"
  204.         ."<input type=\"hidden\" name=\"pid\" value=\"$pid\">"
  205.         ."<input type=\"hidden\" name=\"pollID\" value=\"$pollID\">"
  206.         ."<input type=\"hidden\" name=\"op\" value=\"Reply\">"
  207.         ."  <input type=\"submit\" value=\""._REPLYMAIN."\">";
  208.     }
  209.     }
  210.     echo "</form></font></td></tr></table>\n"
  211.     ."</td></tr>"
  212.     ."<tr><td bgcolor=\"$bgcolor2\" align=\"center\"><font class=\"tiny\">"._COMMENTSWARNING."</font></td></tr>\n"
  213.     ."</table>"
  214.     ."\n\n<!-- COMMENTS NAVIGATION BAR END -->\n\n";
  215.     CloseTable();
  216.     if ($anonpost == 0 AND !is_user($user)) {
  217.         echo "<br>";
  218.     OpenTable();
  219.     echo "<center>"._NOANONCOMMENTS."</center>";
  220.     CloseTable();
  221.     }
  222. }
  223.  
  224. function DisplayKids ($tid, $mode, $order=0, $thold=0, $level=0, $dummy=0, $tblwidth=99) {
  225.     global $datetime, $user, $cookie, $bgcolor1, $reasons, $anonymous, $anonpost, $commentlimit, $prefix, $module_name, $db;
  226.     $comments = 0;
  227.     cookiedecode($user);
  228.         $tid = intval($tid);
  229.     $result = $db->sql_query("SELECT tid, pid, pollID, date, name, email, host_name, subject, comment, score, reason from ".$prefix."_pollcomments where pid = '$tid' order by date, tid");
  230.     if ($mode == 'nested') {
  231.         /* without the tblwidth variable, the tables run of the screen with netscape
  232.            in nested mode in long threads so the text can't be read. */
  233.         while($row = $db->sql_fetchrow($result)) {
  234.                         $r_tid = intval($row['tid']);
  235.                         $r_pid = intval($row['pid']);
  236.                         $r_pollID = intval($row['pollID']);
  237.                         $r_date = $row['date'];
  238.                         $r_name = $row['name'];
  239.                         $r_email = $row['email'];
  240.                         $r_host_name = $row['host_name'];
  241.                         $r_subject = $row['subject'];
  242.                         $r_comment = $row['comment'];
  243.                         $r_score = intval($row['score']);
  244.                         $r_reason = $row['reason'];
  245.             if($r_score >= $thold) {
  246.                 if (!isset($level)) {
  247.                 } else {
  248.                     if (!$comments) {
  249.                         echo "<ul>";
  250.                         $tblwidth -= 5;
  251.                     }
  252.                 }
  253.                 $comments++;
  254.                 if (!eregi("[a-z0-9]",$r_name)) $r_name = $anonymous;
  255.                 if (!eregi("[a-z0-9]",$r_subject)) $r_subject = "["._NOSUBJECT."]";
  256.             // enter hex color between first two appostrophe for second alt bgcolor
  257.                 $r_bgcolor = ($dummy%2)?"":"#E6E6D2";
  258.                 echo "<a name=\"$r_tid\">";
  259.                 echo "<table width=90% border=0><tr bgcolor=\"$r_bgcolor\"><td>";
  260.                 formatTimestamp($r_date);
  261.                 if ($r_email) {
  262.                     echo "<p><b>$r_subject</b> <font class=content>";
  263.                     if(!$cookie[7]) {
  264.                         echo "("._SCORE." $r_score";
  265.                         if($r_reason>0) echo ", $reasons[$r_reason]";
  266.                         echo ")";
  267.                     }
  268.                     echo "<br>"._BY." <a href=\"mailto:$r_email\">$r_name</a> <font class=content><b>($r_email)</b></font> "._ON." $datetime";
  269.                 } else {
  270.                     echo "<p><b>$r_subject</b> <font class=content>";
  271.                     if(!$cookie[7]) {
  272.                         echo "("._SCORE." $r_score";
  273.                         if($r_reason>0) echo ", $reasons[$r_reason]";
  274.                         echo ")";
  275.                     }
  276.                     echo "<br>"._BY." $r_name "._ON." $datetime";
  277.                 }            
  278.                 if ($r_name != $anonymous) {
  279.                     $row2 = $db->sql_fetchrow($db->sql_query("SELECT user_id FROM ".$prefix."_users WHERE username='$r_name'"));
  280.                     $r_uid = intval($row2['user_id']);
  281.                     echo "<BR>(<a href=\"modules.php?name=Your_Account&op=userinfo&username=$r_name\">"._USERINFO."</a> | <a href=\"modules.php?name=Private_Messages&mode=post&u=$r_uid\">"._SENDAMSG."</a>) ";
  282.                 }
  283.                 $row_url = $db->sql_fetchrow($db->sql_query("SELECT user_website FROM ".$prefix."_users WHERE username='$r_name'"));
  284.                 $url = $row_url['user_website'];
  285.                 if ($url != "http://" AND $url != "" AND eregi("http://", $url)) { echo "<a href=\"$url\" target=\"new\">$url</a> "; }
  286.                 echo "</font></td></tr><tr><td>";
  287.                 if(($cookie[10]) && (strlen($r_comment) > $cookie[10])) echo substr("$r_comment", 0, $cookie[10])."<br><br><b><a href=\"modules.php?name=$module_name&file=comments&pollID=$r_pollID&tid=$r_tid&mode=$mode&order=$order&thold=$thold\">"._READREST."</a></b>";
  288.                 elseif(strlen($r_comment) > $commentlimit) echo substr("$r_comment", 0, $commentlimit)."<br><br><b><a href=\"modules.php?name=$module_name&file=comments&pollID=$r_pollID&tid=$r_tid&mode=$mode&order=$order&thold=$thold\">"._READREST."</a></b>";
  289.                 else echo $r_comment;
  290.                 echo "</td></tr></table><br><p>";
  291.                 if ($anonpost==1 OR is_admin($admin) OR is_user($user)) {
  292.                     echo "<font class=content color=\"$bgcolor2\"> [ <a href=\"modules.php?name=$module_name&file=comments&op=Reply&pid=$r_tid&pollID=$r_pollID&mode=$mode&order=$order&thold=$thold\">"._REPLY."</a> ]";
  293.                 }
  294.                 modtwo($r_tid, $r_score, $r_reason);
  295.                 echo "</font><p>";
  296.                 DisplayKids($r_tid, $mode, $order, $thold, $level+1, $dummy+1, $tblwidth);
  297.             }
  298.         }
  299.     } elseif ($mode == 'flat') {
  300.     while($row = $db->sql_fetchrow($result)) {
  301.                         $r_tid = intval($row['tid']);
  302.                         $r_pid = intval($row['pid']);
  303.                         $r_pollID = intval($row['pollID']);
  304.                         $r_date = $row['date'];
  305.                         $r_name = $row['name'];
  306.                         $r_email = $row['email'];
  307.                         $r_host_name = $row['host_name'];
  308.                         $r_subject = $row['subject'];
  309.                         $r_comment = $row['comment'];
  310.                         $r_score = intval($row['score']);
  311.                         $r_reason = $row['reason'];
  312.             if($r_score >= $thold) {
  313.                 if (!eregi("[a-z0-9]",$r_name)) $r_name = $anonymous;
  314.                 if (!eregi("[a-z0-9]",$r_subject)) $r_subject = "["._NOSUBJECT."]";
  315.                 echo "<a name=\"$r_tid\">";
  316.                 echo "<hr><table width=99% border=0><tr bgcolor=\"$bgcolor1\"><td>";
  317.                 formatTimestamp($r_date);
  318.                 if ($r_email) {
  319.                     echo "<p><b>$r_subject</b> <font class=content>";
  320.                     if(!$cookie[7]) {
  321.                         echo "("._SCORE." $r_score";
  322.                         if($r_reason>0) echo ", $reasons[$r_reason]";
  323.                         echo ")";
  324.                     }
  325.                     echo "<br>"._BY." <a href=\"mailto:$r_email\">$r_name</a> <font class=content><b>($r_email)</b></font> "._ON." $datetime";
  326.                  } else {
  327.                     echo "<p><b>$r_subject</b> <font class=content>";
  328.                     if(!$cookie[7]) {
  329.                         echo "("._SCORE." $r_score";
  330.                         if($r_reason>0) echo ", $reasons[$r_reason]";
  331.                         echo ")";
  332.                     }
  333.                     echo "<br>"._BY." $r_name "._ON." $datetime";
  334.                 }            
  335.                 if ($r_name != $anonymous) {
  336.                     $row3 = $db->sql_fetchrow($db->sql_query("SELECT user_id FROM ".$prefix."_users WHERE username='$r_name'"));
  337.                     $ruid = intval($row3['user_id']);
  338.                     echo "<BR>(<a href=\"modules.php?name=Your_Account&op=userinfo&username=$r_name\">"._USERINFO."</a> | <a href=\"modules.php?name=Private_Messages&mode=post&u=$ruid\">"._SENDAMSG."</a>) ";
  339.                 }
  340.                 $row_url2 = $db->sql_fetchrow($db->sql_query("SELECT user_website FROM ".$prefix."_users WHERE username='$r_name'"));
  341.                 $url = $row_url2['user_website'];
  342.                 if ($url != "http://" AND $url != "" AND eregi("http://", $url)) { echo "<a href=\"$url\" target=\"new\">$url</a> "; }
  343.                 echo "</font></td></tr><tr><td>";
  344.                 if(($cookie[10]) && (strlen($r_comment) > $cookie[10])) echo substr("$r_comment", 0, $cookie[10])."<br><br><b><a href=\"modules.php?name=$module_name&file=comments&pollID=$r_pollID&tid=$r_tid&mode=$mode&order=$order&thold=$thold\">"._READREST."</a></b>";
  345.                 elseif(strlen($r_comment) > $commentlimit) echo substr("$r_comment", 0, $commentlimit)."<br><br><b><a href=\"modules.php?name=$module_name&file=comments&pollID=$r_pollID&tid=$r_tid&mode=$mode&order=$order&thold=$thold\">"._READREST."</a></b>";
  346.                 else echo $r_comment;
  347.                 echo "</td></tr></table><br><p><font class=content color=\"$bgcolor2\"> [ <a href=\"modules.php?name=$module_name&file=comments&op=Reply&pid=$r_tid&pollID=$r_pollID&mode=$mode&order=$order&thold=$thold\">"._REPLY."</a> ]";
  348.                 modtwo($r_tid, $r_score, $r_reason);
  349.                 echo "</font><p>";
  350.                 DisplayKids($r_tid, $mode, $order, $thold);
  351.             }
  352.         }
  353.     } elseif ($mode == 'thread') {
  354.     while($row = $db->sql_fetchrow($result)) {
  355.                         $r_tid = intval($row['tid']);
  356.                         $r_pid = intval($row['pid']);
  357.                         $r_pollID = intval($row['pollID']);
  358.                         $r_date = $row['date'];
  359.                         $r_name = $row['name'];
  360.                         $r_email = $row['email'];
  361.                         $r_host_name = $row['host_name'];
  362.                         $r_subject = $row['subject'];
  363.                         $r_comment = $row['comment'];
  364.                         $r_score = intval($row['score']);
  365.                         $r_reason = $row['reason'];
  366.             if($r_score >= $thold) {
  367.                 if (!isset($level)) {
  368.                 } else {
  369.                     if (!$comments) {
  370.                         echo "<ul>";
  371.                     }
  372.                 }
  373.                 $comments++;
  374.                 if (!eregi("[a-z0-9]",$r_name)) $r_name = $anonymous;
  375.                 if (!eregi("[a-z0-9]",$r_subject)) $r_subject = "["._NOSUBJECT."]";
  376.                 formatTimestamp($r_date);
  377.                 echo "<li><font class=\"content\"><a href=\"modules.php?name=$module_name&file=comments&op=showreply&tid=$r_tid&pollID=$r_pollID&pid=$r_pid&mode=$mode&order=$order&thold=$thold#$r_tid\">$r_subject</a> "._BY." $r_name "._ON." $datetime</font><br>";
  378.                 DisplayKids($r_tid, $mode, $order, $thold, $level+1, $dummy+1);
  379.             } 
  380.         }
  381.     } else {
  382.     /* without the tblwidth variable, the tables run of the screen with netscape
  383.            in nested mode in long threads so the text can't be read. */
  384.     while($row = $db->sql_fetchrow($result)) {
  385.                         $r_tid = intval($row['tid']);
  386.                         $r_pid = intval($row['pid']);
  387.                         $r_pollID = intval($row['pollID']);
  388.                         $r_date = $row['date'];
  389.                         $r_name = $row['name'];
  390.                         $r_email = $row['email'];
  391.                         $r_host_name = $row['host_name'];
  392.                         $r_subject = $row['subject'];
  393.                         $r_comment = $row['comment'];
  394.                         $r_score = intval($row['score']);
  395.                         $r_reason = $row['reason'];
  396.             if($r_score >= $thold) {
  397.                 if (!isset($level)) {
  398.                 } else {
  399.                     if (!$comments) {
  400.                         echo "<ul>";
  401.                         $tblwidth -= 5;
  402.                     }
  403.                 }
  404.                 $comments++;
  405.                 if (!eregi("[a-z0-9]",$r_name)) $r_name = $anonymous;
  406.                 if (!eregi("[a-z0-9]",$r_subject)) $r_subject = "["._NOSUBJECT."]";
  407.             // enter hex color between first two appostrophe for second alt bgcolor
  408.                 $r_bgcolor = ($dummy%2)?"":"#E6E6D2";
  409.                 echo "<a name=\"$r_tid\">";
  410.                 echo "<table width=90% border=0><tr bgcolor=\"$r_bgcolor\"><td>";
  411.                 formatTimestamp($r_date);
  412.                 if ($r_email) {
  413.                     echo "<p><b>$r_subject</b> <font class=content>";
  414.                     if(!$cookie[7]) {
  415.                         echo "("._SCORE." $r_score";
  416.                         if($r_reason>0) echo ", $reasons[$r_reason]";
  417.                         echo ")";
  418.                     }
  419.                     echo "<br>"._BY." <a href=\"mailto:$r_email\">$r_name</a> <font class=content><b>($r_email)</b></font> "._ON." $datetime";
  420.                 } else {
  421.                     echo "<p><b>$r_subject</b> <font class=content>";
  422.                     if(!$cookie[7]) {
  423.                         echo "("._SCORE." $r_score";
  424.                         if($r_reason>0) echo ", $reasons[$r_reason]";
  425.                         echo ")";
  426.                     }
  427.                     echo "<br>"._BY." $r_name "._ON." $datetime";
  428.                 }            
  429.                 if ($r_name != $anonymous) {
  430.                     $sql2 = "SELECT user_id FROM ".$prefix."_users WHERE username='$r_name'";
  431.                     $result2 = $db->sql_query($sql2);
  432.                     $row2 = $db->sql_fetchrow($result2);
  433.                     echo "<BR>(<a href=\"modules.php?name=Your_Account&op=userinfo&username=$r_name\">"._USERINFO."</a> | <a href=\"modules.php?name=Private_Messages&mode=post&u=$row2[user_id]\">"._SENDAMSG."</a>) ";
  434.                 }
  435.                 $sql_url = "SELECT user_website FROM ".$prefix."_users WHERE username='$r_name'";
  436.                 $result_url = $db->sql_query($sql_url);
  437.                 $row_url = $db->sql_fetchrow($result_url);
  438.                 $url = $row_url[user_website];
  439.                 if ($url != "http://" AND $url != "" AND eregi("http://", $url)) { echo "<a href=\"$url\" target=\"new\">$url</a> "; }
  440.                 echo "</font></td></tr><tr><td>";
  441.                 if(($cookie[10]) && (strlen($r_comment) > $cookie[10])) echo substr("$r_comment", 0, $cookie[10])."<br><br><b><a href=\"modules.php?name=$module_name&file=comments&pollID=$r_pollID&tid=$r_tid&mode=$mode&order=$order&thold=$thold\">"._READREST."</a></b>";
  442.                 elseif(strlen($r_comment) > $commentlimit) echo substr("$r_comment", 0, $commentlimit)."<br><br><b><a href=\"modules.php?name=$module_name&file=comments&pollID=$r_pollID&tid=$r_tid&mode=$mode&order=$order&thold=$thold\">"._READREST."</a></b>";
  443.                 else echo $r_comment;
  444.                 echo "</td></tr></table><br><p>";
  445.                 if ($anonpost==1 OR is_admin($admin) OR is_user($user)) {
  446.                     echo "<font class=content color=\"$bgcolor2\"> [ <a href=\"modules.php?name=$module_name&file=comments&op=Reply&pid=$r_tid&pollID=$r_pollID&mode=$mode&order=$order&thold=$thold\">"._REPLY."</a> ]";
  447.                 }
  448.                 modtwo($r_tid, $r_score, $r_reason);
  449.                 echo "</font><p>";
  450.                 DisplayKids($r_tid, $mode, $order, $thold, $level+1, $dummy+1, $tblwidth);
  451.             }
  452.         }
  453.         }
  454.     if ($level && $comments) {
  455.         echo "</ul>";
  456.     }
  457.  
  458. }
  459.  
  460. function DisplayBabies ($tid, $level=0, $dummy=0) {
  461.     global $datetime, $anonymous, $prefix, $db, $module_name;
  462.     $comments = 0;
  463.         $tid = intval($tid);
  464.     $result = $db->sql_query("SELECT tid, pid, pollID, date, name, email, host_name, subject, comment, score, reason from ".$prefix."_pollcomments where pid = '$tid' order by date, tid");
  465.     while($row = $db->sql_fetchrow($result)) {
  466.                         $r_tid = intval($row['tid']);
  467.                         $r_pid = intval($row['pid']);
  468.                         $r_pollID = intval($row['pollID']);
  469.                         $r_date = $row['date'];
  470.                         $r_name = $row['name'];
  471.                         $r_email = $row['email'];
  472.                         $r_host_name = $row['host_name'];
  473.                         $r_subject = $row['subject'];
  474.                         $r_comment = $row['comment'];
  475.                         $r_score = intval($row['score']);
  476.                         $r_reason = $row['reason'];
  477.         if (!isset($level)) {
  478.         } else {
  479.             if (!$comments) {
  480.                 echo "<ul>";
  481.             }
  482.         }
  483.         $comments++;
  484.         if (!eregi("[a-z0-9]",$r_name)) { $r_name = $anonymous; }
  485.         if (!eregi("[a-z0-9]",$r_subject)) { $r_subject = "["._NOSUBJECT."]"; }
  486.         formatTimestamp($r_date);
  487.         echo "<a href=\"modules.php?name=$module_name&file=comments&op=showreply&tid=$r_tid&mode=$mode&order=$order&thold=$thold\">$r_subject</a><font class=\"content\"> "._BY." $r_name "._ON." $datetime<br>";
  488.         DisplayBabies($r_tid, $level+1, $dummy+1);
  489.     } 
  490.     if ($level && $comments) {
  491.         echo "</ul>";
  492.     }
  493. }
  494.  
  495. function DisplayTopic ($pollID, $pid=0, $tid=0, $mode="nested", $order=0, $thold=0, $level=0, $nokids=0) {
  496.     global $hr, $user, $datetime, $cookie, $mainfile, $admin, $commentlimit, $anonymous, $reasons, $anonpost, $foot1, $foot2, $foot3, $foot4, $prefix, $module_name, $db;
  497.     if($mainfile) {
  498.         global $title, $bgcolor1, $bgcolor2, $bgcolor3;
  499.     } else {
  500.         global $title, $bgcolor1, $bgcolor2, $bgcolor3;
  501.         include("mainfile.php");
  502.         include("header.php");
  503.     }
  504.     if ($pid!=0) {
  505.         include("header.php");
  506.     }
  507.     $count_times = 0;
  508.     cookiedecode($user);
  509.     $q = "select tid, pid, pollID, date, name, email, host_name, subject, comment, score, reason from ".$prefix."_pollcomments where pollID='$pollID' and pid='$pid'";
  510.     if($thold != "") {
  511.         $q .= " and score>='$thold'";
  512.     } else {
  513.         $q .= " and score>='0'";
  514.     }
  515.     if ($order==1) $q .= " order by date desc";
  516.     if ($order==2) $q .= " order by score desc";
  517.     $something = $db->sql_query($q);
  518.     $num_tid = $db->sql_numrows($something);
  519.     navbar($pollID, $title, $thold, $mode, $order);
  520.     modone();
  521.     while ($count_times < $num_tid) {
  522.         echo "<br>";
  523.         OpenTable();
  524.         $row_q = $db->sql_fetchrow($something);
  525.         $tid = intval($row_q['tid']);
  526.         $pid = intval($row_q['pid']);
  527.         $pollID = intval($row_q['pollID']);
  528.         $date = $row_q['date'];
  529.         $c_name = $row_q['name'];
  530.         $email = $row_q['email'];
  531.         $host_name = $row_q['host_name'];
  532.         $subject = $row_q['subject'];
  533.         $comment = $row_q['comment'];
  534.         $score = intval($row_q['score']);
  535.         $reason = $row_q['reason'];
  536.         if ($c_name == "") { $c_name = $anonymous; }
  537.         if ($subject == "") { $subject = "["._NOSUBJECT."]"; }    
  538.  
  539.         echo "<a name=\"$tid\">";
  540.         echo "<table width=99% border=0><tr bgcolor=\"$bgcolor1\"><td width=500>";
  541.         formatTimestamp($date);
  542.         if ($email) {
  543.             echo "<p><b>$subject</b> <font class=content>";
  544.             if(!$cookie[7]) {
  545.                 echo "("._SCORE." $score";
  546.                 if($reason>0) echo ", $reasons[$reason]";
  547.                 echo ")";
  548.             }
  549.             echo "<br>"._BY." <a href=\"mailto:$email\">$c_name</a> <b>($email)</b> "._ON." $datetime"; 
  550.         } else {
  551.             echo "<p><b>$subject</b> <font class=content>";
  552.             if(!$cookie[7]) {
  553.                 echo "("._SCORE." $score";
  554.                 if($reason>0) echo ", $reasons[$reason]";
  555.                 echo ")";
  556.             }
  557.             echo "<br>"._BY." $c_name "._ON." $datetime";
  558.         }            
  559.         
  560.     // If you are admin you can see the Poster IP address (you have this right, no?)
  561.     // with this you can see who is flaming you... ha-ha-ha
  562.  
  563.     if (is_active("Journal")) {
  564.         $row = $db->sql_fetchrow($db->sql_query("SELECT jid from ".$prefix."_journal where aid='$c_name' AND status='yes' order by pdate,jid DESC limit 0,1"));
  565.         $jid = intval($row['jid']);
  566.         if ($jid != "" AND isset($jid)) {
  567.         $journal = " | <a href=\"modules.php?name=Journal&file=display&jid=$jid\">"._JOURNAL."</a>";
  568.         } else {
  569.         $journal = "";
  570.         }
  571.     }
  572.         if ($c_name != $anonymous) {
  573.             $row2 = $db->sql_fetchrow($db->sql_query("SELECT user_id FROM ".$prefix."_users WHERE username='$c_name'"));
  574.             $r_uid = intval($row2['user_id']);
  575.             echo "<br>(<a href=\"modules.php?name=Your_Account&op=userinfo&username=$c_name\">"._USERINFO."</a> | <a href=\"modules.php?name=Private_Messages&mode=post&u=$r_uid\">"._SENDAMSG."</a>$journal) ";
  576.         }
  577.         $row_url = $db->sql_fetchrow($db->sql_query("SELECT user_website FROM ".$prefix."_users WHERE username='$c_name'"));
  578.         $url = $row_url['user_website'];
  579.         if ($url != "http://" AND $url != "" AND eregi("http://", $url)) { echo "<a href=\"$url\" target=\"new\">$url</a> "; }
  580.         
  581.         if(is_admin($admin)) {
  582.             $row3 = $db->sql_fetchrow($db->sql_query("SELECT host_name from ".$prefix."_pollcomments where tid='$tid'"));
  583.             $host_name = $row3['host_name'];
  584.             echo "<br><b>(IP: $host_name)</b>";
  585.         }
  586.         
  587.         echo "</font></td></tr><tr><td>";
  588.         if(($cookie[10]) && (strlen($comment) > $cookie[10])) echo substr("$comment", 0, $cookie[10])."<br><br><b><a href=\"modules.php?name=$module_name&file=comments&pollID=$pollID&tid=$tid&mode=$mode&order=$order&thold=$thold\">"._READREST."</a></b>";
  589.         elseif(strlen($comment) > $commentlimit) echo substr("$comment", 0, $commentlimit)."<br><br><b><a href=\"modules.php?name=$module_name&file=comments&pollID=$pollID&tid=$tid&mode=$mode&order=$order&thold=$thold\">"._READREST."</a></b>";
  590.         else echo $comment;
  591.         echo "</td></tr></table><br><p>";
  592.         if ($anonpost==1 OR is_admin($admin) OR is_user($user)) {
  593.             echo "<font class=\"content\"> [ <a href=\"modules.php?name=$module_name&file=comments&op=Reply&pid=$tid&pollID=$pollID&mode=$mode&order=$order&thold=$thold\">"._REPLY."</a>";
  594.         }
  595.         if ($pid != 0) {
  596.             $row4 = $db->sql_fetchrow($db->sql_query("SELECT pid from ".$prefix."_pollcomments where tid='$pid'"));
  597.             $erin = intval($row4['pid']);
  598.             echo "| <a href=\"modules.php?name=$module_name&file=comments&pollID=$pollID&pid=$erin&mode=$mode&order=$order&thold=$thold\">"._PARENT."</a>";
  599.         }
  600.         modtwo($tid, $score, $reason);
  601.         
  602.         if(is_admin($admin)) {
  603.             echo " | <a href=\"admin.php?op=RemovePollComment&tid=$tid&pollID=$pollID\">"._DELETE."</a> ]</font><p>";
  604.         } elseif ($anonpost != 0 OR is_admin($admin) OR is_user($user)) {
  605.             echo " ]</font><p>";
  606.         }
  607.         
  608.         DisplayKids($tid, $mode, $order, $thold, $level);
  609.         echo "</ul>";
  610.         if($hr) echo "<hr noshade size=1>";
  611.         echo "</p>";
  612.         $count_times += 1;
  613.         CloseTable();
  614.     }
  615.     modthree($pollID, $mode, $order, $thold);
  616.     if($pid==0) return array($pollID, $pid, $subject);
  617.     else include("footer.php");
  618. }
  619.  
  620. function singlecomment($tid, $pollID, $mode, $order, $thold) {
  621.     include("header.php");
  622.     global $user, $cookie, $datetime, $bgcolor1, $bgcolor2, $bgcolor3, $anonpost, $admin, $anonymous, $prefix, $db, $module_name;
  623.     $tid = intval($tid);
  624.         $pollID = intval($pollID);
  625.     $row = $db->sql_fetchrow($db->sql_query("SELECT date, name, email, subject, comment, score, reason from ".$prefix."_pollcomments where tid='$tid' and pollID='$pollID'"));
  626.     $date = $row['date'];
  627.     $name = $row['name'];
  628.     $email = $row['email'];
  629.     $subject = $row['subject'];
  630.     $comment = $row['comment'];
  631.     $score = intval($row['score']);
  632.     $reason = $row['reason'];
  633.     $titlebar = "<b>$subject</b>";
  634.     if($name == "") $name = $anonymous;
  635.     if($subject == "") $subject = "["._NOSUBJECT."]";
  636.     modone();
  637.     echo "<table width=99% border=0><tr bgcolor=\"$bgcolor1\"><td width=500>";
  638.     formatTimestamp($date);
  639.     if($email) echo "<p><b>$subject</b> <font class=content>("._SCORE." $score)<br>"._BY." <a href=\"mailto:$email\"><font color=\"$bgcolor2\">$name</font></a> <font class=content><b>($email)</b></font> "._ON." $datetime";
  640.     else echo "<p><b>$subject</b> <font class=content>("._SCORE." $score)<br>"._BY." $name "._ON." $datetime";
  641.     echo "</td></tr><tr><td>$comment</td></tr></table><br><p><font class=content color=\"$bgcolor2\"> [ <a href=\"modules.php?name=$module_name&file=comments&op=Reply&pid=$tid&pollID=$pollID&mode=$mode&order=$order&thold=$thold\">"._REPLY."</a> | <a href=\"modules.php?name=$module_name&pollID=$pollID\">"._ROOT."</a>";
  642.     modtwo($tid, $score, $reason);
  643.     echo " ]";
  644.     modthree($pollID, $mode, $order, $thold);
  645.     include("footer.php");
  646. }
  647.  
  648. function reply ($pid, $pollID, $mode, $order, $thold) {
  649.     include("header.php");
  650.     global $anonymous, $user, $cookie, $datetime, $bgcolor1, $bgcolor2, $bgcolor3, $AllowableHTML, $anonymous, $prefix, $anonpost, $db, $module_name;
  651.         $pid = intval($pid);
  652.         $pollID = intval($pollID);
  653.     if ($anonpost == 0 AND !is_user($user)) {
  654.     OpenTable();
  655.     echo "<center><font class=title><b>"._SURVEYCOM."</b></font></center>";
  656.     CloseTable();
  657.     echo "<br>";
  658.     OpenTable();
  659.     echo "<center>"._NOANONCOMMENTS."<br><br>"._GOBACK."</center>";
  660.     CloseTable();
  661.     } else {
  662.     if($pid!=0) {
  663.         list($date, $name, $email, $subject, $comment, $score) = $db->sql_fetchrow($db->sql_query("select date, name, email, subject, comment, score from ".$prefix."_pollcomments where tid='$pid'"));
  664.         $score = intval($score);
  665.     } else {
  666.         list($subject) = $db->sql_fetchrow($db->sql_query("select pollTitle FROM ".$prefix."_poll_desc where pollID='$pollID'"));
  667.     }
  668.     if($comment == "") {
  669.         $comment = $temp_comment;
  670.     }
  671.     $titlebar = "<b>$subject</b>";
  672.     if($name == "") $name = $anonymous;
  673.     if($subject == "") $subject = "["._NOSUBJECT."]";
  674.     formatTimestamp($date);
  675.     OpenTable();
  676.     echo "<center><font class=\"title\"><b>"._SURVEYCOM."</b></font></center>";
  677.     CloseTable();
  678.     echo "<br>";
  679.     OpenTable();
  680.     echo "<center><font class=\"content\"><b>$subject</b></center><br>";
  681.     if ($comment == "") {
  682.         echo "<center><i>"._DIRECTCOM."</i></font></center><br>";
  683.     } else {
  684.         echo "<br>$comment</font>";
  685.     }
  686.     CloseTable();
  687.     if(!isset($pid) || !isset($pollID)) { echo "Something is not right. This message is just to keep things from messing up down the road"; exit(); }
  688.     if($pid == 0) {
  689.         list($subject) = $db->sql_fetchrow($db->sql_query("select pollTitle from ".$prefix."_poll_desc where pollID='$pollID'"));
  690.     } else {
  691.         list($subject) = $db->sql_fetchrow($db->sql_query("select subject from ".$prefix."_pollcomments where tid='$pid'"));
  692.     }
  693.     echo "<br>";
  694.     OpenTable();
  695.     echo "<form action=\"modules.php?name=$module_name&file=comments\" method=\"post\">";
  696.     echo "<font class=\"content\"><b>"._YOURNAME.":</b></font> ";
  697.     if (is_user($user)) {
  698.         cookiedecode($user);
  699.         echo "<font class=\"content\"><a href=\"modules.php?name=Your_Account\">$cookie[1]</a> [ <a href=\"modules.php?name=Your_Account&op=logout\">"._LOGOUT."</a> ]</font>";
  700.     } else {
  701.         echo "<font class=\"content\">$anonymous</font>";
  702.         $xanonpost=1;
  703.     }
  704.     echo "<br><br><font class=\"content\"><B>"._SUBJECT.":</B></FONT><BR>";
  705.     if (!eregi("Re:",$subject)) $subject = "Re: ".substr($subject,0,81)."";
  706.     echo "<INPUT TYPE=\"text\" NAME=\"subject\" SIZE=50 maxlength=85 value=\"$subject\"><BR>";
  707.     echo "<br><br><font class=\"content\"><B>"._UCOMMENT.":</B></FONT><BR>"
  708.         ."<TEXTAREA wrap=virtual cols=50 rows=10 name=comment></TEXTAREA><br>
  709.         <font class=\"content\">"._ALLOWEDHTML."<br>";
  710.         while (list($key,)= each($AllowableHTML)) echo " <".$key.">";
  711.         echo "<br>";
  712.     if (is_user($user) AND ($anonpost == 1)) { echo "<INPUT type=checkbox name=xanonpost> "._POSTANON."<br>"; }
  713.     echo "<INPUT type=\"hidden\" name=\"pid\" value=\"$pid\">"
  714.         ."<INPUT type=\"hidden\" name=\"pollID\" value=\"$pollID\">"
  715.         ."<INPUT type=\"hidden\" name=\"mode\" value=\"$mode\">"
  716.         ."<INPUT type=\"hidden\" name=\"order\" value=\"$order\">"
  717.         ."<INPUT type=\"hidden\" name=\"thold\" value=\"$thold\">"
  718.         ."<br><INPUT type=submit name=op value=\""._PREVIEW."\"> "
  719.         ."<INPUT type=submit name=op value=\""._OK."\"> "
  720.         ."<SELECT name=\"posttype\">"
  721.         ."<OPTION value=\"exttrans\">"._EXTRANS."</option>"
  722.         ."<OPTION value=\"html\" >"._HTMLFORMATED."</option>"
  723.         ."<OPTION value=\"plaintext\" SELECTED>"._PLAINTEXT."</option>"
  724.         ."</SELECT>"
  725.         ."</FORM>";
  726.     CloseTable();
  727.     }
  728.     include("footer.php");
  729. }
  730.  
  731. function replyPreview ($pid, $pollID, $subject, $comment, $xanonpost, $mode, $order, $thold, $posttype) {
  732.     include("header.php");
  733.     global $user, $cookie, $AllowableHTML, $anonymous, $module_name;
  734.     cookiedecode($user);
  735.     $subject = stripslashes($subject);
  736.     $comment = stripslashes($comment);
  737.     $pid = intval($pid);
  738.         $pollID = intval($pollID);
  739.     if (!isset($pid) || !isset($pollID)) {
  740.         echo ""._NOTRIGHT."";
  741.         exit();
  742.     }
  743.     OpenTable();
  744.     echo "<center><font class=\"title\"><b>"._SURVEYCOMPRE."</b></font></center>";
  745.     CloseTable();
  746.     echo "<br>";
  747.     OpenTable();
  748.     echo "<b>$subject</b><br>";
  749.     echo "<font class=content>"._BY." ";
  750.     if (is_user($user)) {
  751.         echo "$cookie[1]";
  752.     } else {
  753.         echo "$anonymous ";
  754.     }
  755.     echo ""._ONN."</font><br><br>";
  756.     if ($posttype=="exttrans") {
  757.         echo nl2br(htmlspecialchars($comment));
  758.     } elseif ($posttype=="plaintext") {
  759.         echo nl2br($comment);
  760.     } else {
  761.         echo $comment;
  762.     }
  763.     CloseTable();
  764.     echo "<br>";
  765.     OpenTable();
  766.     echo "<form action=\"modules.php?name=$module_name&file=comments\" method=\"post\">"
  767.         ."<font class=\"content\"><B>"._YOURNAME.":</B></FONT> ";
  768.     if (is_user($user)) {
  769.         echo "<font class=\"content\"><a href=\"modules.php?name=Your_Account\">$cookie[1]</a> <font class=\"content\">[ <a href=\"modules.php?name=Your_Account&op=logout\">"._LOGOUT."</a> ]</font>";
  770.     } else {
  771.         echo "<font class=\"content\">$anonymous</font>";
  772.     }
  773.     echo "<br><br><font class=\"content\"><B>"._SUBJECT.":</B></FONT><BR>"
  774.         ."<INPUT TYPE=\"text\" name=\"subject\" size=\"50\" maxlength=\"85\" value=\"$subject\"><br><br>"
  775.         ."<P><font class=\"content\"><B>"._UCOMMENT.":</B></FONT><BR>"
  776.         ."<TEXTAREA wrap=\"virtual\" cols=\"50\" rows=\"10\" name=\"comment\">$comment</TEXTAREA><br>";
  777.         echo"<font class=\"content\">"._ALLOWEDHTML."<br>";
  778.         while (list($key,)= each($AllowableHTML)) echo " <".$key.">";
  779.         echo "<br>";        
  780.     if (($xanonpost) AND ($anonpost == 1)) { 
  781.         echo "<INPUT type=\"checkbox\" name=\"xanonpost\" checked> "._POSTANON."<br>";
  782.     } elseif ((is_user($user)) AND ($anonpost == 1)) {
  783.         echo "<INPUT type=\"checkbox\" name=\"xanonpost\"> "._POSTANON."<br>";
  784.     }
  785.     echo "<INPUT type=\"hidden\" name=\"pid\" value=\"$pid\">"
  786.         ."<INPUT type=\"hidden\" name=\"pollID\" value=\"$pollID\"><INPUT type=\"hidden\" name=\"mode\" value=\"$mode\">"
  787.         ."<INPUT type=\"hidden\" name=\"order\" value=\"$order\"><INPUT type=\"hidden\" name=\"thold\" value=\"$thold\">"
  788.         ."<br><INPUT type=submit name=op value=\""._PREVIEW."\"> "
  789.         ."<INPUT type=submit name=op value=\""._OK."\"> <SELECT name=\"posttype\"><OPTION value=\"exttrans\"";
  790.         if($posttype=="exttrans") echo" SELECTED";
  791.         echo  ">"._EXTRANS."<OPTION value=\"html\"";;
  792.         if($posttype=="html") echo" SELECTED";
  793.         echo ">"._HTMLFORMATED."<OPTION value=\"plaintext\"";
  794.         if(($posttype!="exttrans") && ($posttype!="html")) echo" SELECTED";
  795.         echo ">"._PLAINTEXT."</SELECT></FORM>";
  796.     CloseTable();
  797.     include("footer.php");
  798. }
  799.  
  800. function CreateTopic ($xanonpost, $subject, $comment, $pid, $pollID, $host_name, $mode, $order, $thold, $posttype) {
  801.     global $user, $userinfo, $EditedMessage, $cookie, $prefix, $pollcomm, $anonpost, $db, $module_name;
  802.     $author = FixQuotes($author);
  803.     $subject = FixQuotes(filter_text($subject, "nohtml"));
  804.     $comment = format_url($comment);
  805.     if ($posttype=="exttrans") {
  806.         $comment = FixQuotes(nl2br(htmlspecialchars(check_words($comment))));
  807.     } elseif ($posttype=="plaintext") {
  808.         $comment = FixQuotes(nl2br(filter_text($comment)));
  809.     } else {
  810.         $comment = FixQuotes(filter_text($comment));
  811.     }
  812.     if(is_user($user)) {
  813.     getusrinfo($user);
  814.     }
  815.     if ((is_user($user)) && (!$xanonpost)) {
  816.         getusrinfo($user);
  817.     $name = $userinfo[username];
  818.     $email = $userinfo[femail];
  819.     $url = $userinfo[user_website];
  820.     $score = 1;
  821.     } else {
  822.     $name = "";
  823.     $email = "";
  824.     $url = "";
  825.     $score = 0;
  826.     }
  827.     $ip = $_SERVER["REMOTE_HOST"];
  828.     if (empty($ip)) {
  829.         $ip = $_SERVER["REMOTE_ADDR"];
  830.     }
  831.     $pollID = intval($pollID);
  832.     $result = $db->sql_query("select count(*) from ".$prefix."_poll_desc where pollID='$pollID'");
  833.     $fake = $db->sql_numrows($result);
  834.     if ($fake == 1) {
  835.     if ((($anonpost == 0) AND (is_user($user))) OR ($anonpost == 1)) {
  836.         $db->sql_query("insert into ".$prefix."_pollcomments values (NULL, '$pid', '$pollID', now(), '$name', '$email', '$url', '$ip', '$subject', '$comment', '$score', '0')");
  837.     } else {
  838.         echo "Nice try...";
  839.         die();
  840.     }
  841.     } else {
  842.     include("header.php");
  843.     Opentable();
  844.     echo ""._COMMENTSWARNINGS."";
  845.     Closetable();
  846.     include("footer.php");
  847.     die();
  848.     }
  849.     if ($pollcomm == 1) {
  850.     if (isset($cookie[4])) { $options .= "&mode=$cookie[4]"; } else { $options .= "&mode=nested"; }
  851.     if (isset($cookie[5])) { $options .= "&order=$cookie[5]"; } else { $options .= "&order=0"; }
  852.     if (isset($cookie[6])) { $options .= "&thold=$cookie[6]"; } else { $options .= "&thold=0"; }
  853.     } else {
  854.     $options = "";
  855.     }
  856.     Header("Location: modules.php?name=$module_name&op=results&pollID=$pollID$options");
  857. }
  858.  
  859. switch($op) {
  860.  
  861.     case "Reply":
  862.         reply($pid, $pollID, $mode, $order, $thold);
  863.         break;
  864.  
  865.     case ""._PREVIEW."":
  866.         replyPreview ($pid, $pollID, $subject, $comment, $xanonpost, $mode, $order, $thold, $posttype);
  867.         break;
  868.  
  869.     case ""._OK."":
  870.         CreateTopic($xanonpost, $subject, $comment, $pid, $pollID, $host_name, $mode, $order, $thold, $posttype);
  871.         break;
  872.  
  873.     case "moderate":
  874.         global $module_name;
  875.         if(isset($admin)) {
  876.             include("auth.php");
  877.         } else {
  878.             include("mainfile.php");    
  879.         }
  880.         if(($admintest==1) || ($moderate==2)) {
  881.             while(list($tdw, $emp) = each($HTTP_POST_VARS)) {
  882.                 if (eregi("dkn",$tdw)) {
  883.                     $emp = explode(":", $emp);
  884.                     if($emp[1] != 0) {
  885.                         $tdw = ereg_replace("dkn", "", $tdw);
  886.                         $tdw = intval($tdw);
  887.                         $q = "UPDATE ".$prefix."_pollcomments SET";
  888.                         if(($emp[1] == 9) && ($emp[0]>=0)) { # Overrated
  889.                             $q .= " score=score-1 where tid='$tdw'";
  890.                         } elseif (($emp[1] == 10) && ($emp[0]<=4)) { # Underrated
  891.                             $q .= " score=score+1 where tid='$tdw'";
  892.                         } elseif (($emp[1] > 4) && ($emp[0]<=4)) {
  893.                             $q .= " score='score+1', reason='$emp[1]' where tid='$tdw'";
  894.                         } elseif (($emp[1] < 5) && ($emp[0] > -1)) {
  895.                             $q .= " score='score-1', reason='$emp[1]' where tid='$tdw'";
  896.                         } elseif (($emp[0] == -1) || ($emp[0] == 5)) {
  897.                             $q .= " reason='$emp[1]' where tid='$tdw'";
  898.                         }
  899.                         if(strlen($q) > 20) $db->sql_query($q);
  900.                     }
  901.                 }
  902.             }
  903.         }
  904.         Header("Location: modules.php?name=$module_name&op=results&pollID=$pollID");
  905.         break;
  906.  
  907.     case "showreply":
  908.         DisplayTopic($pollID, $pid, $tid, $mode, $order, $thold);
  909.         break;
  910.  
  911.     default:
  912.         global $module_name;
  913.         if ((isset($tid)) && (!isset($pid))) {
  914.             singlecomment($tid, $pollID, $mode, $order, $thold);
  915.         } elseif (($mainfile) xor (($pid==0) AND (!isset($pid)))) {
  916.             Header("Location: modules.php?name=$module_name&op=results&pollID=$pollID&mode=$mode&order=$order&thold=$thold");
  917.         } else {
  918.             if(!isset($pid)) $pid=0;
  919.             DisplayTopic($pollID, $pid, $tid, $mode, $order, $thold);
  920.         }
  921.         break;
  922. }
  923.  
  924. ?>