| [ Index ] |
|
Code source de PHP NUKE 7.9 |
1 <?php 2 3 /************************************************************************/ 4 /* PHP-NUKE: Web Portal System */ 5 /* =========================== */ 6 /* */ 7 /* Copyright (c) 2005 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 (!defined('MODULE_FILE')) { 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 22 function format_url($comment) { 23 global $nukeurl; 24 unset($location); 25 $comment = filter($comment); 26 $links = array(); 27 $hrefs = array(); 28 $pos = 0; 29 while (!(($pos = strpos($comment,"<",$pos)) === false)) { 30 $pos++; 31 $endpos = strpos($comment,">",$pos); 32 $tag = substr($comment,$pos,$endpos-$pos); 33 $tag = trim($tag); 34 if (isset($location)) { 35 if (!strcasecmp(strtok($tag," "),"/A")) { 36 $link = substr($comment,$linkpos,$pos-1-$linkpos); 37 $links[] = $link; 38 $hrefs[] = $location; 39 unset($location); 40 } 41 $pos = $endpos+1; 42 } else { 43 if (!strcasecmp(strtok($tag," "),"A")) { 44 if (eregi("HREF[ \t\n\r\v]*=[ \t\n\r\v]*\"([^\"]*)\"",$tag,$regs)); 45 else if (eregi("HREF[ \t\n\r\v]*=[ \t\n\r\v]*([^ \t\n\r\v]*)",$tag,$regs)); 46 else $regs[1] = ""; 47 if ($regs[1]) { 48 $location = $regs[1]; 49 } 50 $pos = $endpos+1; 51 $linkpos = $pos; 52 } else { 53 $pos = $endpos+1; 54 } 55 } 56 } 57 for ($i=0; $i<sizeof($links); $i++) { 58 if (!stripos_clone($hrefs[$i], "http://")) { 59 $hrefs[$i] = $nukeurl; 60 } elseif (!stripos_clone($hrefs[$i], "mailto://")) { 61 $href = explode("/",$hrefs[$i]); 62 $href = " [$href[2]]"; 63 $comment = str_replace(">$links[$i]</a>", "title='$hrefs[$i]'> $links[$i]</a>$href", $comment); 64 } 65 } 66 return($comment); 67 } 68 69 function modone() { 70 global $admin, $moderate, $module_name, $sid, $prefix, $db; 71 $artsid = intval($sid); 72 $comnum = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_stories WHERE sid='$artsid' AND comments!='0'")); 73 if ($comnum != 0) { 74 if(((isset($admin)) AND ($moderate == 1)) || ($moderate==2)) echo "<form action=\"modules.php?name=$module_name&file=comments\" method=\"post\">"; 75 } 76 } 77 78 function modtwo($tid, $score, $reason) { 79 global $admin, $user, $moderate, $reasons, $prefix, $db, $sid, $cookie, $userinfo; 80 $artsid = intval($sid); 81 $tid = intval($tid); 82 $comnum = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_stories WHERE sid='$artsid' AND comments!='0'")); 83 if ($comnum != 0) { 84 $whoisath = $db->sql_fetchrow($db->sql_query("SELECT name FROM ".$prefix."_comments WHERE tid='$tid'")); 85 cookiedecode($user); 86 if((((isset($admin)) AND ($moderate == 1)) || ($moderate == 2)) AND ($user)) { 87 if (strtolower($cookie[1]) == strtolower($whoisath['name'])) { 88 echo " | <select name=dkn$tid>"; 89 echo "<option value=\"$score:0\">$reasons[0]</option>\n"; 90 echo "</select>"; 91 } else { 92 echo " | <select name=dkn$tid>"; 93 for($i=0; $i<sizeof($reasons); $i++) { 94 echo "<option value=\"$score:$i\">$reasons[$i]</option>\n"; 95 } 96 echo "</select>"; 97 } 98 } 99 } 100 } 101 102 function modthree($sid, $mode, $order, $thold=0) { 103 global $admin, $user, $moderate, $db, $prefix, $userinfo, $cookie; 104 $artsid = intval($sid); 105 $comnum = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_stories WHERE sid='$artsid' AND comments!='0'")); 106 if ($comnum != 0) { 107 if((((is_admin($admin)) AND ($moderate == 1)) || ($moderate==2)) AND ($user)) { 108 // Quake - start 109 getusrinfo($user); 110 if (!isset($mode) OR empty($mode)) { 111 if(isset($userinfo['umode'])) { 112 $mode = $userinfo['umode']; 113 } else { 114 $mode = "thread"; 115 } 116 } 117 if (!isset($order) OR empty($order)) { 118 if(isset($userinfo['uorder'])) { 119 $order = $userinfo['uorder']; 120 } else { 121 $order = 0; 122 } 123 } 124 if (!isset($thold) OR empty($thold)) { 125 if(isset($userinfo['thold'])) { 126 $thold = $userinfo['thold']; 127 } else { 128 $thold = 0; 129 } 130 } 131 // Quake - end 132 $form = "<input type=hidden name=sid value=$sid>"; 133 $form .= "<input type=hidden name=mode value=$mode>"; 134 $form .= "<input type=hidden name=order value=$order>"; 135 $form .= "<input type=hidden name=thold value=$thold>"; 136 $form .= "<input type=hidden name=op value=moderate><br>"; 137 echo $form; 138 139 OpenTable(); 140 echo "<center><font class=\"title\">"._COMMENTSMODERATION."</font><br><br>"._CLICKTOMODERATE."<br><br>"; 141 echo "<input type=submit value=\""._MODERATE."\"></form></center>"; 142 CloseTable(); 143 } 144 } 145 } 146 147 function nocomm() { 148 OpenTable(); 149 echo "<center><font class=\"content\">"._NOCOMMENTSACT."</font></center>"; 150 CloseTable(); 151 } 152 153 function navbar($sid, $title, $thold, $mode, $order) { 154 global $user, $bgcolor1, $bgcolor2, $textcolor1, $textcolor2, $anonpost, $prefix, $db, $module_name, $admin, $pid, $userinfo, $cookie; 155 $sid = intval($sid); 156 $title = filter($title, "nohtml"); 157 cookiedecode($user); 158 getusrinfo($user); 159 if (!isset($mode) OR empty($mode)) { 160 if(isset($userinfo['umode'])) { 161 $mode = $userinfo['umode']; 162 } else { 163 $mode = "thread"; 164 } 165 } 166 if (!isset($order) OR empty($order)) { 167 if(isset($userinfo['uorder'])) { 168 $order = $userinfo['uorder']; 169 } else { 170 $order = 0; 171 } 172 } 173 if (!isset($thold) OR empty($thold)) { 174 if(isset($userinfo['thold'])) { 175 $thold = $userinfo['thold']; 176 } else { 177 $thold = 0; 178 } 179 } 180 $query = $db->sql_query("SELECT * FROM ".$prefix."_comments WHERE sid='$sid'"); 181 if(!$query) { 182 $count = 0; 183 } else { 184 $count = $db->sql_numrows($query); 185 } 186 $sid = intval($sid); 187 $query = $db->sql_query("SELECT title FROM ".$prefix."_stories WHERE sid='$sid'"); 188 list($un_title) = $db->sql_fetchrow($query); 189 if(!isset($thold)) { 190 $thold=0; 191 } 192 echo "\n\n<!-- COMMENTS NAVIGATION BAR START -->\n\n"; 193 echo "<a name=\"comments\"></a>\n"; 194 OpenTable(); 195 echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\">\n"; 196 if($title) { 197 echo "<tr><td bgcolor=\"$bgcolor2\" align=\"center\"><font class=\"content\" color=\"$textcolor1\">\"$un_title\" | "; 198 if(is_user($user)) { 199 echo "<a href=\"modules.php?name=Your_Account&op=editcomm\"><font color=\"$textcolor1\">"._CONFIGURE."</font></a>"; 200 } else { 201 echo "<a href=\"modules.php?name=Your_Account\"><font color=\"$textcolor1\">"._LOGINCREATE."</font></a>"; 202 } 203 if(($count==1)) { 204 echo " | <B>$count</B> "._COMMENT.""; 205 } else { 206 echo " | <B>$count</B> "._COMMENTS.""; 207 } 208 if ($count > 0 AND is_active("Search")) { 209 echo " | <a href='modules.php?name=Search&type=comments&sid=$sid'>"._SEARCHDIS."</a>"; 210 } 211 echo "</font></td></tr>\n"; 212 } 213 echo "<tr><td bgcolor=\"$bgcolor1\" align=\"center\" width=\"100%\">\n"; 214 if ($anonpost==1 OR is_user($user)) { 215 echo "<form action=\"modules.php?name=$module_name&file=comments\" method=\"post\">" 216 ."<input type=\"hidden\" name=\"pid\" value=\"$pid\">" 217 ."<input type=\"hidden\" name=\"sid\" value=\"$sid\">" 218 ."<input type=\"hidden\" name=\"op\" value=\"Reply\">" 219 ."<input type=\"submit\" value=\""._REPLYMAIN."\"></td></form></tr>"; 220 } 221 echo "<tr><td bgcolor=\"$bgcolor2\" align=\"center\"><font class=\"tiny\">"._COMMENTSWARNING."</font></td></tr></table>" 222 ."\n\n<!-- COMMENTS NAVIGATION BAR END -->\n\n"; 223 CloseTable(); 224 if ($anonpost == 0 AND !is_user($user)) { 225 echo "<br>"; 226 OpenTable(); 227 echo "<center>"._NOANONCOMMENTS."</center>"; 228 CloseTable(); 229 } 230 } 231 232 function DisplayKids ($tid, $mode, $order=0, $thold=0, $level=0, $dummy=0, $tblwidth=99) { 233 global $datetime, $user, $cookie, $bgcolor1, $reasons, $anonymous, $anonpost, $commentlimit, $prefix, $textcolor2, $db, $module_name, $user_prefix, $userinfo, $cookie; 234 $tid = intval($tid); 235 $comments = 0; 236 cookiedecode($user); 237 getusrinfo($user); 238 if (!isset($mode) OR empty($mode)) { 239 if(isset($userinfo['umode'])) { 240 $mode = $userinfo['umode']; 241 } else { 242 $mode = "thread"; 243 } 244 } 245 if (!isset($order) OR empty($order)) { 246 if(isset($userinfo['uorder'])) { 247 $order = $userinfo['uorder']; 248 } else { 249 $order = 0; 250 } 251 } 252 if (!isset($thold) OR empty($thold)) { 253 if(isset($userinfo['thold'])) { 254 $thold = $userinfo['thold']; 255 } else { 256 $thold = 0; 257 } 258 } 259 $result = $db->sql_query("SELECT tid, pid, sid, date, name, email, host_name, subject, comment, score, reason FROM ".$prefix."_comments WHERE pid='$tid' ORDER BY date, tid"); 260 if ($mode == 'nested') { 261 /* without the tblwidth variable, the tables run of the screen with netscape */ 262 /* in nested mode in long threads so the text can't be read. */ 263 while ($row = $db->sql_fetchrow($result)) { 264 $r_tid = intval($row['tid']); 265 $r_pid = intval($row['pid']); 266 $r_sid = intval($row['sid']); 267 $r_date = $row['date']; 268 $r_name = filter($row['name'], "nohtml"); 269 $r_email = filter($row['email'], "nohtml"); 270 $r_host_name = filter($row['host_name'], "nohtml"); 271 $r_subject = filter($row['subject'], "nohtml"); 272 $r_comment = filter($row['comment']); 273 $r_score = intval($row['score']); 274 $r_reason = intval($row['reason']); 275 if($r_score >= $thold) { 276 if (!isset($level)) { 277 } else { 278 if (!$comments) { 279 echo "<ul>"; 280 $tblwidth -= 5; 281 } 282 } 283 $comments++; 284 if (!eregi("[a-z0-9]",$r_name)) $r_name = $anonymous; 285 if (!eregi("[a-z0-9]",$r_subject)) $r_subject = "["._NOSUBJECT."]"; 286 // HIJO enter hex color between first two appostrophe for second alt bgcolor 287 $r_bgcolor = ($dummy%2)?"":"#E6E6D2"; 288 echo "<a name=\"$r_tid\">"; 289 echo "<table border=\"0\"><tr bgcolor=\"$bgcolor1\"><td>"; 290 formatTimestamp($r_date); 291 if ($r_email) { 292 echo "<b>$r_subject</b> <font class=\"content\">"; 293 if($userinfo['noscore'] == 0) { 294 echo "("._SCORE." $r_score"; 295 if($r_reason>0) echo ", $reasons[$r_reason]"; 296 echo ")"; 297 } 298 echo "<br>"._BY." <a href=\"mailto:$r_email\">$r_name</a> <font class=\"content\"><b>($r_email)</b></font> "._ON." $datetime"; 299 } else { 300 echo "<b>$r_subject</b> <font class=\"content\">"; 301 if($userinfo['noscore'] == 0) { 302 echo "("._SCORE." $r_score"; 303 if($r_reason>0) echo ", $reasons[$r_reason]"; 304 echo ")"; 305 } 306 echo "<br>"._BY." $r_name "._ON." $datetime"; 307 } 308 if ($r_name != $anonymous) { 309 $row2 = $db->sql_fetchrow($db->sql_query("SELECT user_id FROM ".$user_prefix."_users WHERE username='$r_name'")); 310 $r_uid = intval($row2['user_id']); 311 echo "<br>(<a href=\"modules.php?name=Your_Account&op=userinfo&username=$r_name\">"._USERINFO."</a> "; 312 if(is_active("Private_Messages")) { 313 echo "| <a href=\"modules.php?name=Private_Messages&mode=post&u=$r_uid\">"._SENDAMSG."</a>) "; 314 } 315 echo ")"; 316 } 317 $row_url = $db->sql_fetchrow($db->sql_query("SELECT user_website FROM ".$user_prefix."_users WHERE username='$r_name'")); 318 $url = filter($row_url['user_website'], "nohtml"); 319 if ($url != "http://" AND !empty($url) AND stripos_clone($url, "http://")) { echo "<a href=\"$url\" target=\"new\">$url</a> "; } 320 echo "</font></td></tr><tr><td>"; 321 $options = ""; 322 $options .= "&mode=".$mode; 323 $options .= "&order=".$order; 324 $options .= "&thold=".$thold; 325 if((isset($userinfo['commentmax'])) AND (strlen($r_comment) > $userinfo['commentmax'])) echo substr("$r_comment", 0, $userinfo['commentmax'])."<br><br><b><a href=\"modules.php?name=$module_name&file=comments&sid=$r_sid&tid=$r_tid$options\">"._READREST."</a></b>"; 326 elseif(strlen($r_comment) > $commentlimit) echo substr("$r_comment", 0, $commentlimit)."<br><br><b><a href=\"modules.php?name=$module_name&file=comments&sid=$r_sid&tid=$r_tid$options\">"._READREST."</a></b>"; 327 else echo $r_comment; 328 echo "</td></tr></table><br><br>"; 329 if ($anonpost==1 OR is_admin($admin) OR is_user($user)) { 330 echo "<font class=\"content\" color=\"$textcolor2\"> [ <a href=\"modules.php?name=$module_name&file=comments&op=Reply&pid=$r_tid&sid=$r_sid$options\">"._REPLY."</a>"; 331 } 332 modtwo($r_tid, $r_score, $r_reason); 333 echo " ]</font><br><br>"; 334 DisplayKids($r_tid, $mode, $order, $thold, $level+1, $dummy+1, $tblwidth); 335 } 336 } 337 } elseif ($mode == 'flat') { 338 while ($row = $db->sql_fetchrow($result)) { 339 $r_tid = intval($row['tid']); 340 $r_pid = intval($row['pid']); 341 $r_sid = intval($row['sid']); 342 $r_date = $row['date']; 343 $r_name = filter($row['name'], "nohtml"); 344 $r_email = filter($row['email'], "nohtml"); 345 $r_host_name = filter($row['host_name'], "nohtml"); 346 $r_subject = filter($row['subject'], "nohtml"); 347 $r_comment = filter($row['comment']); 348 $r_score = intval($row['score']); 349 $r_reason = intval($row['reason']); 350 if($r_score >= $thold) { 351 if (!eregi("[a-z0-9]",$r_name)) $r_name = $anonymous; 352 if (!eregi("[a-z0-9]",$r_subject)) $r_subject = "["._NOSUBJECT."]"; 353 echo "<a name=\"$r_tid\">"; 354 echo "<hr><table width=\"99%\" border=\"0\"><tr bgcolor=\"$bgcolor1\"><td>"; 355 formatTimestamp($r_date); 356 if ($r_email) { 357 echo "<b>$r_subject</b> <font class=\"content\">"; 358 if($userinfo['noscore'] == 0) { 359 echo "("._SCORE." $r_score"; 360 if($r_reason>0) echo ", $reasons[$r_reason]"; 361 echo ")"; 362 } 363 echo "<br>"._BY." <a href=\"mailto:$r_email\">$r_name</a> <font class=\"content\"><b>($r_email)</b></font> "._ON." $datetime"; 364 } else { 365 echo "<b>$r_subject</b> <font class=\"content\">"; 366 if($userinfo['noscore'] == 0) { 367 echo "("._SCORE." $r_score"; 368 if($r_reason>0) echo ", $reasons[$r_reason]"; 369 echo ")"; 370 } 371 echo "<br>"._BY." $r_name "._ON." $datetime"; 372 } 373 if ($r_name != $anonymous) { 374 $row3 = $db->sql_fetchrow($db->sql_query("SELECT user_id FROM ".$user_prefix."_users WHERE username='$r_name'")); 375 $ruid = intval($row3['user_id']); 376 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>) "; 377 } 378 $row_url2 = $db->sql_fetchrow($db->sql_query("SELECT user_website FROM ".$user_prefix."_users WHERE username='$r_name'")); 379 $url = filter($row_url2['user_website'], "nohtml"); 380 if ($url != "http://" AND !empty($url) AND stripos_clone($url, "http://")) { echo "<a href=\"$url\" target=\"new\">$url</a> "; } 381 echo "</font></td></tr><tr><td>"; 382 $options = ""; 383 $options .= "&mode=".$mode; 384 $options .= "&order=".$order; 385 $options .= "&thold=".$thold; 386 if((isset($userinfo['commentmax'])) AND (strlen($r_comment) > $userinfo['commentmax'])) echo substr("$r_comment", 0, $userinfo['commentmax'])."<br><br><b><a href=\"modules.php?name=$module_name&file=comments&sid=$r_sid&tid=$r_tid$options\">"._READREST."</a></b>"; 387 elseif(strlen($r_comment) > $commentlimit) echo substr("$r_comment", 0, $commentlimit)."<br><br><b><a href=\"modules.php?name=$module_name&file=comments&sid=$r_sid&tid=$r_tid$options\">"._READREST."</a></b>"; 388 else echo $r_comment; 389 echo "</td></tr></table><br><br>"; 390 if ($anonpost==1 OR is_admin($admin) OR is_user($user)) { 391 echo "<font class=\"content\" color=\"$textcolor2\"> [ <a href=\"modules.php?name=$module_name&file=comments&op=Reply&pid=$r_tid&sid=$r_sid&mode=$mode&order=$order&thold=$thold\">"._REPLY."</a>"; 392 } 393 modtwo($r_tid, $r_score, $r_reason); 394 echo " ]</font><br><br>"; 395 DisplayKids($r_tid, $mode, $order, $thold); 396 } 397 } 398 } else { 399 while ($row = $db->sql_fetchrow($result)) { 400 $r_tid = intval($row['tid']); 401 $r_pid = intval($row['pid']); 402 $r_sid = intval($row['sid']); 403 $r_date = $row['date']; 404 $r_name = filter($row['name'], "nohtml"); 405 $r_email = filter($row['email'], "nohtml"); 406 $r_host_name = filter($row['host_name'], "nohtml"); 407 $r_subject = filter($row['subject'], "nohtml"); 408 $r_comment = filter($row['comment']); 409 $r_score = intval($row['score']); 410 $r_reason = intval($row['reason']); 411 if($r_score >= $thold) { 412 if (!isset($level)) { 413 } else { 414 if (!$comments) { 415 echo "<ul>"; 416 } 417 } 418 $comments++; 419 if (!eregi("[a-z0-9]",$r_name)) $r_name = $anonymous; 420 if (!eregi("[a-z0-9]",$r_subject)) $r_subject = "["._NOSUBJECT."]"; 421 formatTimestamp($r_date); 422 $options = ""; 423 $options .= "&mode=".$mode; 424 $options .= "&order=".$order; 425 $options .= "&thold=".$thold; 426 echo "<li><font class=\"content\" color=\"$textcolor2\"><a href=\"modules.php?name=$module_name&file=comments&op=showreply&tid=$r_tid&sid=$r_sid&pid=$r_pid$options#$r_tid\">$r_subject</a> "._BY." $r_name "._ON." $datetime</font><br>"; 427 DisplayKids($r_tid, $mode, $order, $thold, $level+1, $dummy+1); 428 } 429 } 430 } 431 if ($level AND $comments) { 432 echo "</ul>"; 433 } 434 } 435 436 function DisplayBabies ($tid, $level=0, $dummy=0) { 437 global $datetime, $anonymous, $prefix, $db, $module_name, $userinfo, $cookie, $user; 438 cookiedecode($user); 439 getusrinfo($user); 440 $tid = intval($tid); 441 $comments = 0; 442 $result = $db->sql_query("SELECT tid, pid, sid, date, name, email, host_name, subject, comment, score, reason FROM ".$prefix."_comments WHERE pid='$tid' ORDER BY date, tid"); 443 while ($row = $db->sql_fetchrow($result)) { 444 $r_tid = intval($row['tid']); 445 $r_pid = intval($row['pid']); 446 $r_sid = intval($row['sid']); 447 $r_date = $row['date']; 448 $r_name = filter($row['name'], "nohtml"); 449 $r_email = filter($row['email'], "nohtml"); 450 $r_host_name = filter($row['host_name'], "nohtml"); 451 $r_subject = filter($row['subject'], "nohtml"); 452 $r_comment = filter($row['comment']); 453 $r_score = intval($row['score']); 454 $r_reason = intval($row['reason']); 455 if (isset($level) AND !$comments) { 456 echo "<ul>"; 457 } 458 $comments++; 459 if (!eregi("[a-z0-9]",$r_name)) { $r_name = $anonymous; } 460 if (!eregi("[a-z0-9]",$r_subject)) { $r_subject = "["._NOSUBJECT."]"; } 461 formatTimestamp($r_date); 462 $options = ""; 463 $options .= "&mode=".$mode; 464 $options .= "&order=".$order; 465 $options .= "&thold=".$thold; 466 echo "<a href=\"modules.php?name=$module_name&file=comments&op=showreply&tid=$r_tid$options\">$r_subject</a></font><font class=\"content\"> "._BY." $r_name "._ON." $datetime<br>"; 467 DisplayBabies($r_tid, $level+1, $dummy+1); 468 } 469 if ($level AND $comments) { 470 echo "</ul>"; 471 } 472 } 473 474 function DisplayTopic ($sid, $pid=0, $tid=0, $mode="thread", $order=0, $thold=0, $level=0, $nokids=0) { 475 global $title, $bgcolor1, $bgcolor2, $bgcolor3, $hr, $user, $datetime, $cookie, $admin, $commentlimit, $anonymous, $reasons, $anonpost, $foot1, $foot2, $foot3, $foot4, $prefix, $acomm, $articlecomm, $db, $module_name, $nukeurl, $admin_file, $user_prefix, $userinfo; 476 $sid = intval($sid); 477 $pid = intval($pid); 478 $tid = intval($tid); 479 if (defined('NUKE_FILE')) { 480 global $title, $bgcolor1, $bgcolor2, $bgcolor3; 481 } else { 482 global $title, $bgcolor1, $bgcolor2, $bgcolor3; 483 include_once ("header.php"); 484 } 485 if ($pid!=0) { 486 include_once ("header.php"); 487 } 488 $count_times = 0; 489 cookiedecode($user); 490 getusrinfo($user); 491 $q = "SELECT tid, pid, sid, date, name, email, host_name, subject, comment, score, reason FROM ".$prefix."_comments WHERE sid='$sid' and pid='$pid'"; 492 if(!empty($thold)) { 493 $q .= " AND score>='$thold'"; 494 } else { 495 $q .= " AND score>='0'"; 496 } 497 if ($order==1) $q .= " ORDER BY date DESC"; 498 if ($order==2) $q .= " ORDER BY score DESC"; 499 $something = $db->sql_query($q); 500 $num_tid = $db->sql_numrows($something); 501 if ($acomm == 1) { 502 nocomm(); 503 return; 504 } 505 if (($acomm == 0) AND ($articlecomm == 1)) { 506 navbar($sid, $title, $thold, $mode, $order); 507 } 508 modone(); 509 while ($count_times < $num_tid) { 510 echo "<br>"; 511 OpenTable(); 512 $row_q = $db->sql_fetchrow($something); 513 $tid = intval($row_q['tid']); 514 $pid = intval($row_q['pid']); 515 $sid = intval($row_q['sid']); 516 $date = $row_q['date']; 517 $c_name = filter($row_q['name'], "nohtml"); 518 $email = filter($row_q['email'], "nohtml"); 519 $host_name = filter($row_q['host_name'], "nohtml"); 520 $subject = filter($row_q['subject'], "nohtml"); 521 $comment = filter($row_q['comment']); 522 $score = intval($row_q['score']); 523 $reason = intval($row_q['reason']); 524 $karma = $db->sql_fetchrow($db->sql_query("SELECT karma FROM ".$user_prefix."_users WHERE username='$c_name'")); 525 $karma = intval($karma['karma']); 526 if (is_admin($admin)) { 527 if ($karma == 1) { 528 $karma = "<img src=\"images/karma/1.gif\" border=\"0\" alt=\""._KARMALOW."\" title=\""._KARMALOW."\"> "; 529 } elseif ($karma == 2) { 530 $karma = "<img src=\"images/karma/2.gif\" border=\"0\" alt=\""._KARMABAD."\" title=\""._KARMABAD."\"> "; 531 } elseif ($karma == 3) { 532 $karma = "<img src=\"images/karma/3.gif\" border=\"0\" alt=\""._KARMADEVIL."\" title=\""._KARMADEVIL."\"> "; 533 } else { 534 $karma = ""; 535 } 536 } else { 537 $karma = ""; 538 } 539 if (empty($c_name)) { $c_name = $anonymous; } 540 if (empty($subject)) { $subject = "["._NOSUBJECT."]"; } 541 echo "<a name=\"$tid\"></a>"; 542 echo "<table width=\"99%\" border=\"0\"><tr bgcolor=\"$bgcolor1\"><td width=\"500\">"; 543 formatTimestamp($date); 544 if ($email) { 545 echo "<b>$subject</b> <font class=\"content\">"; 546 if($userinfo['noscore'] == 0) { 547 echo "("._SCORE." $score"; 548 if($reason>0) echo ", $reasons[$reason]"; 549 echo ")"; 550 } 551 echo "<br>"._BY." <a href=\"mailto:$email\">$c_name</a> <b>($email)</b> "._ON." $datetime"; 552 } else { 553 echo "<b>$subject</b> <font class=\"content\">"; 554 if($userinfo['noscore'] == 0) { 555 echo "("._SCORE." $score"; 556 if($reason>0) echo ", $reasons[$reason]"; 557 echo ")"; 558 } 559 echo "<br>"._BY." $c_name "._ON." $datetime"; 560 } 561 562 /* If you are admin you can see the Poster IP address */ 563 /* with this you can see who is flaming you...*/ 564 565 $journal = ""; 566 if (is_active("Journal")) { 567 $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")); 568 $jid = intval($row['jid']); 569 if (!empty($jid) AND isset($jid)) { 570 $journal = " | <a href=\"modules.php?name=Journal&file=display&jid=$jid\">"._JOURNAL."</a>"; 571 } else { 572 $journal = ""; 573 } 574 } 575 if ($c_name != $anonymous) { 576 $row2 = $db->sql_fetchrow($db->sql_query("SELECT user_id FROM ".$user_prefix."_users WHERE username='$c_name'")); 577 $r_uid = intval($row2['user_id']); 578 echo "<br>(<a href=\"modules.php?name=Your_Account&op=userinfo&username=$c_name\">"._USERINFO."</a> "; 579 if(is_active("Private_Messages")) { 580 echo "| <a href=\"modules.php?name=Private_Messages&mode=post&u=$r_uid\">"._SENDAMSG."</a>"; 581 } 582 echo "$journal) "; 583 } 584 $row_url = $db->sql_fetchrow($db->sql_query("SELECT user_website FROM ".$user_prefix."_users WHERE username='$c_name'")); 585 $url = filter($row_url['user_website'], "nohtml"); 586 if ($url != "http://" AND !empty($url) AND stripos_clone($url, "http://")) { echo "<a href=\"$url\" target=\"new\">$url</a> "; } 587 588 if(is_admin($admin)) { 589 $row3 = $db->sql_fetchrow($db->sql_query("SELECT host_name FROM ".$prefix."_comments WHERE tid='$tid'")); 590 $host_name = filter($row3['host_name'], "nohtml"); 591 echo "<br><b>(IP: $host_name)</b> $karma"; 592 } 593 echo "</font></td></tr><tr><td>"; 594 $options = ""; 595 $options .= "&mode=".$mode; 596 $options .= "&order=".$order; 597 $options .= "&thold=".$thold; 598 if((isset($userinfo['commentmax'])) AND (strlen($comment) > $userinfo['commentmax'])) echo substr($comment, 0, $userinfo['commentmax'])."<br><br><b><a href=\"modules.php?name=$module_name&file=comments&sid=$r_sid&tid=$r_tid$options\">"._READREST."</a></b>"; 599 elseif(strlen($comment) > $commentlimit) echo substr($comment, 0, $commentlimit)."<br><br><b><a href=\"modules.php?name=$module_name&file=comments&sid=$sid&tid=$tid$options\">"._READREST."</a></b>"; 600 else echo $comment; 601 echo "</td></tr></table><br><br>"; 602 if ($anonpost==1 OR is_admin($admin) OR is_user($user)) { 603 echo "<font class=\"content\"> [ <a href=\"modules.php?name=$module_name&file=comments&op=Reply&pid=$tid&sid=$sid$options\">"._REPLY."</a>"; 604 } 605 if ($pid != 0) { 606 $row4 = $db->sql_fetchrow($db->sql_query("SELECT pid FROM ".$prefix."_comments WHERE tid='$pid'")); 607 $erin = intval($row4['pid']); 608 echo " | <a href=\"modules.php?name=$module_name&file=comments&sid=$sid&pid=$erin$options\">"._PARENT."</a>"; 609 } 610 modtwo($tid, $score, $reason); 611 612 if(is_admin($admin)) { 613 echo " | <a href=\"".$admin_file.".php?op=RemoveComment&tid=$tid&sid=$sid\">"._DELETE."</a> ]</font><br><br>"; 614 } elseif ($anonpost != 0 OR is_admin($admin) OR is_user($user)) { 615 echo " ]</font><br><br>"; 616 } 617 618 DisplayKids($tid, $mode, $order, $thold, $level); 619 echo "</ul>"; 620 if($hr) echo "<hr noshade size=\"1\">"; 621 $count_times += 1; 622 CloseTable(); 623 } 624 modthree($sid, $mode, $order, $thold); 625 if ($pid==0) { 626 return array($sid, $pid, $subject); 627 628 } else { 629 include ("footer.php"); 630 } 631 } 632 633 function singlecomment($tid, $sid, $mode, $order, $thold) { 634 global $module_name, $user, $cookie, $datetime, $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $admin, $anonpost, $prefix, $textcolor2, $db; 635 include ("header.php"); 636 cookiedecode($user); 637 getusrinfo($user); 638 $sid = intval($sid); 639 $tid = intval($tid); 640 $row = $db->sql_fetchrow($db->sql_query("SELECT date, name, email, subject, comment, score, reason FROM ".$prefix."_comments WHERE tid='$tid' AND sid='$sid'")); 641 $date = $row['date']; 642 $name = filter($row['name'], "nohtml"); 643 $email = filter($row['email'], "nohtml"); 644 $subject = filter($row['subject'], "nohtml"); 645 $comment = filter($row['comment']); 646 $score = intval($row['score']); 647 $reason = intval($row['reason']); 648 $titlebar = "<b>$subject</b>"; 649 if(empty($name)) $name = $anonymous; 650 if(empty($subject)) $subject = "["._NOSUBJECT."]"; 651 modone(); 652 OpenTable(); 653 echo "<table width=\"99%\" border=\"0\"><tr bgcolor=\"$bgcolor1\"><td width=\"500\">"; 654 formatTimestamp($date); 655 if($email) echo "<b>$subject</b> <font class=\"content\" color=\"$textcolor2\">("._SCORE." $score)<br>"._BY." <a href=\"mailto:$email\"><font color=\"$bgcolor2\">$name</font></a> <font class=content><b>($email)</b></font> "._ON." $datetime"; 656 else echo "<b>$subject</b> <font class=content>("._SCORE." $score)<br>"._BY." $name "._ON." $datetime"; 657 echo "</td></tr><tr><td>$comment</td></tr></table><br><br>"; 658 if ($anonpost==1 OR is_admin($admin) OR is_user($user)) { 659 $options = ""; 660 $options .= "&mode=".$mode; 661 $options .= "&order=".$order; 662 $options .= "&thold=".$thold; 663 echo "<font class=content> [ <a href=\"modules.php?name=$module_name&file=comments&op=Reply&pid=$tid&sid=$sid$options\">"._REPLY."</a> | <a href=\"modules.php?name=$module_name&file=article&sid=$sid$options\">"._ROOT."</a>"; 664 } 665 modtwo($tid, $score, $reason); 666 echo " ]"; 667 modthree($sid, $mode, $order, $thold); 668 CloseTable(); 669 include ("footer.php"); 670 } 671 672 function reply($pid, $sid, $mode, $order, $thold) { 673 //include("config.php"); // globalized - Quake 674 include ("header.php"); 675 global $prefix, $module_name, $user, $cookie, $datetime, $bgcolor1, $bgcolor2, $bgcolor3, $db, $anonpost, $anonymous, $admin; 676 cookiedecode($user); 677 getusrinfo($user); 678 $sid = intval($sid); 679 $pid = intval($pid); 680 if ($anonpost == 0 AND !is_user($user)) { 681 OpenTable(); 682 echo "<center><font class=title><b>"._COMMENTREPLY."</b></font></center>"; 683 CloseTable(); 684 echo "<br>"; 685 OpenTable(); 686 echo "<center>"._NOANONCOMMENTS."<br><br>"._GOBACK."</center>"; 687 CloseTable(); 688 } else { 689 if ($pid != 0) { 690 $row = $db->sql_fetchrow($db->sql_query("SELECT date, name, email, subject, comment, score FROM ".$prefix."_comments WHERE tid='$pid'")); 691 $date = $row['date']; 692 $name = filter($row['name'], "nohtml"); 693 $email = filter($row['email'], "nohtml"); 694 $subject = filter($row['subject'], "nohtml"); 695 $comment = filter($row['comment']); 696 $score = intval($row['score']); 697 } else { 698 $row2 = $db->sql_fetchrow($db->sql_query("SELECT time, title, hometext, bodytext, informant, notes FROM ".$prefix."_stories WHERE sid='$sid'")); 699 $date = $row2['time']; 700 $subject = filter($row2['title'], "nohtml"); 701 $temp_comment = filter($row2['hometext']); 702 $comment2 = filter($row2['bodytext']); 703 $name = filter($row2['informant'], "nohtml"); 704 $notes = filter($row2['notes']); 705 } 706 if(empty($comment)) { 707 $comment = $temp_comment."<br><br>$comment2"; 708 } 709 OpenTable(); 710 echo "<center><font class=title><b>"._COMMENTREPLY."</b></font></center>"; 711 CloseTable(); 712 echo "<br>"; 713 OpenTable(); 714 if (empty($name)) $name = $anonymous; 715 if (empty($subject)) $subject = "["._NOSUBJECT."]"; 716 formatTimestamp($date); 717 echo "<b>$subject</b> <font class=\"content\">"; 718 if (!empty($temp_comment)) echo"("._SCORE." $score)"; 719 if (!empty($email)) { 720 echo "<br>"._BY." <a href=\"mailto:$email\">$name</a> <font class=\"content\"><b>($email)</b></font> "._ON." $datetime"; 721 } else { 722 echo "<br>"._BY." $name "._ON." $datetime"; 723 } 724 echo "<br><br>$comment<br><br>"; 725 if ($pid == 0) { 726 if (!empty($notes)) { 727 echo "<b>"._NOTE."</b> <i>$notes</i><br><br>"; 728 } else { 729 echo ""; 730 } 731 } 732 if (!isset($pid) || !isset($sid)) { echo "Something is not right. This message is just to keep things from messing up down the road"; exit(); } 733 if ($pid == 0) { 734 $row3 = $db->sql_fetchrow($db->sql_query("SELECT title FROM ".$prefix."_stories WHERE sid='$sid'")); 735 $subject = filter($row3['title'], "nohtml"); 736 } else { 737 $row4 = $db->sql_fetchrow($db->sql_query("SELECT subject FROM ".$prefix."_comments WHERE tid='$pid'")); 738 $subject = filter($row4['subject'], "nohtml"); 739 } 740 CloseTable(); 741 echo "<br>"; 742 OpenTable(); 743 echo "<form action=\"modules.php?name=$module_name&file=comments\" method=\"post\">"; 744 echo "<font class=option><b>"._YOURNAME.":</b></font> "; 745 if (is_user($user)) { 746 cookiedecode($user); 747 echo "<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><br><br>"; 748 } else { 749 echo "<font class=\"content\">$anonymous"; 750 echo " [ <a href=\"modules.php?name=Your_Account\">"._NEWUSER."</a> ]<br><br>"; 751 } 752 echo "<font class=\"option\"><b>"._SUBJECT.":</b></font><br>"; 753 if (!stripos_clone($subject,"Re:")) $subject = "Re: ".substr($subject,0,81).""; 754 echo "<input type=\"text\" name=\"subject\" size=\"50\" maxlength=\"85\" value=\"$subject\"><br><br>"; 755 echo "<font class=\"option\"><b>"._UCOMMENT.":</b></font><br>" 756 ."<textarea wrap=\"virtual\" cols=\"70\" rows=\"15\" name=\"comment\"></textarea><br>"; 757 if ($nuke_editor == 0) { 758 echo "<font class=\"content\">"._ALLOWEDHTML."<br>"; 759 while (list($key,) = each($AllowableHTML)) echo " <".$key.">"; 760 echo "</font><br><br>"; 761 } else { 762 echo ""._HTMLNOTALLOWED."</font><br><br>"; 763 } 764 if (is_user($user) AND ($anonpost == 1)) { echo "<input type=\"checkbox\" name=\"xanonpost\"> "._POSTANON."<br>"; } 765 if (!isset($mode) OR empty($mode)) { 766 if(isset($userinfo['umode'])) { 767 $mode = $userinfo['umode']; 768 } else { 769 $mode = "thread"; 770 } 771 } 772 if (!isset($order) OR empty($order)) { 773 if(isset($userinfo['uorder'])) { 774 $order = $userinfo['uorder']; 775 } else { 776 $order = 0; 777 } 778 } 779 if (!isset($thold) OR empty($thold)) { 780 if(isset($userinfo['thold'])) { 781 $thold = $userinfo['thold']; 782 } else { 783 $thold = 0; 784 } 785 } 786 787 echo "<input type=\"hidden\" name=\"pid\" value=\"$pid\">\n" 788 ."<input type=\"hidden\" name=\"sid\" value=\"$sid\">\n" 789 ."<input type=\"hidden\" name=\"mode\" value=\"$mode\">\n" 790 ."<input type=\"hidden\" name=\"order\" value=\"$order\">\n" 791 ."<input type=\"hidden\" name=\"thold\" value=\"$thold\">\n" 792 ."<input type=\"submit\" name=\"op\" value=\""._PREVIEW."\">\n" 793 ."<input type=\"submit\" name=\"op\" value=\""._OK."\"> "._GOBACK."\n" 794 ."</font></form>\n"; 795 CloseTable(); 796 } 797 include ("footer.php"); 798 } 799 800 function replyPreview ($pid, $sid, $subject, $comment, $xanonpost, $mode, $order, $thold) { 801 global $module_name, $user, $cookie, $AllowableHTML, $anonymous, $anonpost, $userinfo; 802 include ("header.php"); 803 cookiedecode($user); 804 getusrinfo($user); 805 $sid = intval($sid); 806 $pid = intval($pid); 807 OpenTable(); 808 echo "<center><font class=\"title\"><b>"._COMREPLYPRE."</b></font></center>"; 809 CloseTable(); 810 echo "<br>"; 811 OpenTable(); 812 cookiedecode($user); 813 $subject = filter($subject, "nohtml", 0, preview); 814 $comment = filter($comment); 815 if (!isset($pid) OR !isset($sid)) { 816 die(_NOTRIGHT); 817 } 818 echo "<b>$subject</b>"; 819 echo "<br><font class=\"content\">"._BY." "; 820 if (is_user($user)) { 821 echo $cookie[1]; 822 } else { 823 echo $anonymous; 824 } 825 echo " "._ONN."</font><br><br>"; 826 echo $comment; 827 CloseTable(); 828 echo "<br>"; 829 OpenTable(); 830 echo "<form action=\"modules.php?name=$module_name&file=comments\" method=\"post\"><font class=\"option\"><b>"._YOURNAME.":</b></font> "; 831 if (is_user($user)) { 832 echo "<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><br><br>"; 833 } else { 834 echo "<font class=\"content\">$anonymous<br><br>"; 835 } 836 echo "<font class=\"option\"><b>"._SUBJECT.":</b></font><br>" 837 ."<input type=\"text\" name=\"subject\" size=\"50\" maxlength=\"85\" value=\"$subject\"><br><br>" 838 ."<font class=\"option\"><b>"._UCOMMENT.":</b></font><br>" 839 ."<textarea wrap=\"virtual\" cols=\"70\" rows=\"15\" name=\"comment\">$comment</textarea><br>"; 840 if ($nuke_editor == 0) { 841 echo "<font class=\"content\">"._ALLOWEDHTML."<br>"; 842 while (list($key,) = each($AllowableHTML)) echo " <".$key.">"; 843 echo "</font><br><br>"; 844 } else { 845 echo ""._HTMLNOTALLOWED."</font><br><br>"; 846 } 847 if ($xanonpost AND $anonpost == 1){ 848 echo "<input type=\"checkbox\" name=\"xanonpost\" checked> "._POSTANON."<br>"; 849 } elseif (is_user($user) AND $anonpost == 1) { 850 echo "<input type=\"checkbox\" name=\"xanonpost\"> "._POSTANON."<br>"; 851 } 852 if (!isset($mode) OR empty($mode)) { 853 if(isset($userinfo['umode'])) { 854 $mode = $userinfo['umode']; 855 } else { 856 $mode = "thread"; 857 } 858 } 859 if (!isset($order) OR empty($order)) { 860 if(isset($userinfo['uorder'])) { 861 $order = $userinfo['uorder']; 862 } else { 863 $order = 0; 864 } 865 } 866 if (!isset($thold) OR empty($thold)) { 867 if(isset($userinfo['thold'])) { 868 $thold = $userinfo['thold']; 869 } else { 870 $thold = 0; 871 } 872 } 873 874 echo "<input type=\"hidden\" name=\"pid\" value=\"$pid\">" 875 ."<input type=\"hidden\" name=\"sid\" value=\"$sid\">" 876 ."<input type=\"hidden\" name=\"mode\" value=\"$mode\">" 877 ."<input type=\"hidden\" name=\"order\" value=\"$order\">" 878 ."<input type=\"hidden\" name=\"thold\" value=\"$thold\">" 879 ."<input type=submit name=op value=\""._PREVIEW."\">" 880 ."<input type=submit name=op value=\""._OK."\">\n" 881 ."</font></form>"; 882 CloseTable(); 883 include ("footer.php"); 884 } 885 886 function CreateTopic ($xanonpost, $subject, $comment, $pid, $sid, $host_name, $mode, $order, $thold) { 887 global $module_name, $user, $userinfo, $EditedMessage, $cookie, $AllowableHTML, $ultramode, $user_prefix, $prefix, $anonpost, $articlecomm, $db, $sitename; 888 cookiedecode($user); 889 getusrinfo($user); 890 $sid = intval($sid); 891 $pid = intval($pid); 892 $author = filter($author, "nohtml", 1); 893 $subject = filter($subject, "nohtml", 1); 894 $comment = format_url($comment); 895 $comment = filter($comment, "", 1); 896 if ($subject == "" OR $comment == "") { 897 include ("header.php"); 898 title("$sitename - "._COMMENTSSYSTEM.""); 899 OpenTable(); 900 echo "<center>"._COMMENTPOSTERROR."<br><br>"._GOBACK."</center>"; 901 CloseTable(); 902 include ("footer.php"); 903 die(); 904 } 905 //$comment = filter($comment); 906 if (is_user($user) AND !$xanonpost) { 907 $name = $userinfo[username]; 908 $email = $userinfo[femail]; 909 $url = $userinfo[user_website]; 910 $score = 1; 911 } else { 912 $name = ""; 913 $email = ""; 914 $url = ""; 915 $score = 0; 916 } 917 if(!isset($ip)) { 918 $ip = $_SERVER['REMOTE_ADDR']; 919 } 920 $fake = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_stories WHERE sid='$sid'")); 921 $comment = trim($comment); 922 $comment = filter($comment, "", 1); 923 if ($fake == 1 AND $articlecomm == 1) { 924 if (($anonpost == 0 AND is_user($user)) OR $anonpost == 1) { 925 if (is_user($user)) { 926 $krow = $db->sql_fetchrow($db->sql_query("SELECT karma FROM ".$user_prefix."_users WHERE username='$name'")); 927 $koptions = ""; 928 $koptions .= "&mode=".$mode; 929 $koptions .= "&order=".$order; 930 $koptions .= "&thold=".$thold; 931 if ($krow['karma'] == 2) { 932 $db->sql_query("INSERT INTO ".$prefix."_comments_moderated VALUES (NULL, '$pid', '$sid', now(), '$name', '$email', '$url', '$ip', '$subject', '$comment', '$score', '0', '0')"); 933 include ("header.php"); 934 title(_MODERATEDTITLE); 935 OpenTable(); 936 echo "<center>"._COMMENTMODERATED.""; 937 echo "<br><br><a href=\"modules.php?name=$module_name&file=article&sid=$sid$koptions\">"._MODERATEDRETURN."</a>"; 938 CloseTable(); 939 include ("footer.php"); 940 die(); 941 } elseif ($krow['karma'] == 3) { 942 Header("Location: modules.php?name=$module_name&file=article&sid=$sid$koptions"); 943 die(); 944 } 945 } 946 $db->sql_query("INSERT INTO ".$prefix."_comments VALUES (NULL, '$pid', '$sid', now(), '$name', '$email', '$url', '$ip', '$subject', '$comment', '$score', '0', '0')"); 947 $db->sql_query("UPDATE ".$prefix."_stories SET comments=comments+1 WHERE sid='$sid'"); 948 update_points(5); 949 if ($ultramode) { ultramode(); } 950 } else { 951 die("Nice try.."); 952 } 953 } else { 954 include ("header.php"); 955 echo "According to my records, the topic you are trying " 956 ."to reply to does not exist. If you're just trying to be " 957 ."annoying, well then too bad."; 958 include ("footer.php"); 959 die(); 960 } 961 $options = ""; 962 $options .= "&mode=".$mode; 963 $options .= "&order=".$order; 964 $options .= "&thold=".$thold; 965 Header("Location: modules.php?name=$module_name&file=article&sid=$sid$options"); 966 } 967 if (isset($sid)) { $sid = intval($sid); } else { $sid = ""; } 968 if (isset($tid)) { $tid = intval($tid); } else { $tid = ""; } 969 if (isset($pid)) { $pid = intval($pid); } else { $pid = ""; } 970 if (isset($order)) { $order = intval($order); } 971 if (isset($thold)) { $thold = intval($thold); } 972 973 if (!isset($op) OR empty($op)) { 974 $op = "DisplayTopic"; 975 } 976 977 if (!isset($mode) OR empty($mode)) { 978 if(isset($userinfo['umode'])) { 979 $mode = $userinfo['umode']; 980 } else { 981 $mode = "thread"; 982 } 983 } 984 if (!isset($order) OR empty($order)) { 985 if(isset($userinfo['uorder'])) { 986 $order = $userinfo['uorder']; 987 } else { 988 $order = 0; 989 } 990 } 991 if (!isset($thold) OR empty($thold)) { 992 if(isset($userinfo['thold'])) { 993 $thold = $userinfo['thold']; 994 } else { 995 $thold = 0; 996 } 997 } 998 999 switch($op) { 1000 1001 case "Reply": 1002 reply($pid, $sid, $mode, $order, $thold); 1003 break; 1004 1005 case ""._PREVIEW."": 1006 replyPreview ($pid, $sid, $subject, $comment, $xanonpost, $mode, $order, $thold); 1007 break; 1008 1009 case ""._OK."": 1010 CreateTopic($xanonpost, $subject, $comment, $pid, $sid, $host_name, $mode, $order, $thold); 1011 break; 1012 1013 case "moderate": 1014 if(!isset($admin)) { 1015 require_once ("mainfile.php"); 1016 } 1017 global $userinfo; 1018 if(($admintest==1) || ($moderate==2)) { 1019 while(list($tdw, $emp) = each($_POST)) { 1020 if (stripos_clone($tdw,"dkn")) { 1021 $emp = explode(":", $emp); 1022 if($emp[1] != 0) { 1023 $tdw = str_replace("dkn", "", $tdw); 1024 $emp[0] = intval($emp[0]); 1025 $emp[1] = intval($emp[1]); 1026 $tdw = intval($tdw); 1027 $q = "UPDATE ".$prefix."_comments SET"; 1028 if(($emp[1] == 9) AND ($emp[0]>=0)) { # Overrated 1029 $q .= " score=score-1 where tid='$tdw'"; 1030 } elseif (($emp[1] == 10) AND ($emp[0]<=4)) { # Underrated 1031 $q .= " score=score+1 where tid='$tdw'"; 1032 } elseif (($emp[1] > 4) AND ($emp[0]<=4)) { 1033 $q .= " score=score+1, reason='$emp[1]' where tid='$tdw'"; 1034 } elseif (($emp[1] < 5) AND ($emp[0] > -1)) { 1035 $q .= " score=score-1, reason='$emp[1]' where tid='$tdw'"; 1036 } elseif (($emp[0] == -1) || ($emp[0] == 5)) { 1037 $q .= " reason='$emp[1]' where tid='$tdw'"; 1038 } 1039 $row = $db->sql_fetchrow($db->sql_query("SELECT last_moderation_ip FROM ".$prefix."_comments WHERE tid='$tdw'")); 1040 $ip = $_SERVER['REMOTE_ADDR']; 1041 if(strlen($q) > 20 AND $row['last_moderation_ip'] != $ip) { 1042 $db->sql_query($q); 1043 $db->sql_query("UPDATE ".$prefix."_comments SET last_moderation_ip='$ip' WHERE tid='$tdw'"); 1044 } 1045 } 1046 } 1047 } 1048 } 1049 $options = ""; 1050 $options .= "&mode=".$mode; 1051 $options .= "&order=".$order; 1052 $options .= "&thold=".$thold; 1053 Header("Location: modules.php?name=$module_name&file=article&sid=$sid$options"); 1054 break; 1055 1056 case "showreply": 1057 DisplayTopic($sid, $pid, $tid, $mode, $order, $thold); 1058 break; 1059 1060 default: 1061 if (!empty($tid) AND empty($pid)) { 1062 singlecomment($tid, $sid, $mode, $order, $thold); 1063 } elseif (!defined('NUKE_FILE') xor ($pid==0 AND !isset($pid))) { 1064 $options = ""; 1065 $options .= "&mode=".$mode; 1066 $options .= "&order=".$order; 1067 $options .= "&thold=".$thold; 1068 1069 Header("Location: modules.php?name=$module_name&file=article&sid=$sid$options"); 1070 } else { 1071 if(!isset($pid)) $pid=0; 1072 DisplayTopic($sid, $pid, $tid, $mode, $order, $thold); 1073 } 1074 break; 1075 1076 } 1077 1078 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sun Apr 1 11:11:59 2007 | par Balluche grâce à PHPXref 0.7 |