function DisplayComments($sid, $title, $pid = 0, $tid = 0) { global $userinfo, $MAIN_CFG, $prefix, $db, $bgcolor3, $cpgtpl, $CPG_SESS; if (empty($CPG_SESS['comments']['mode'])) { $CPG_SESS['comments']['mode'] = 'thread'; } $order =& $CPG_SESS['comments']['order']; $thold =& $CPG_SESS['comments']['thold']; require_once 'header.php'; $q = 'SELECT tid, pid, sid, date, name, email, host_name, subject, comment, score, reason FROM ' . $prefix . "_comments WHERE sid='{$sid}' and pid='{$pid}' AND score>=" . ($thold != "" ? "'{$thold}'" : "'0'"); if ($order == 1) { $q .= ' ORDER BY date DESC'; } if ($order == 2) { $q .= ' ORDER BY score DESC'; } $something = $db->sql_query($q); navbar($sid, $title, $thold, $CPG_SESS['comments']['mode'], $order); $moderate = $db->sql_numrows($something) > 0 && (is_admin() && $MAIN_CFG['global']['moderate'] > 0 || $MAIN_CFG['global']['moderate'] == 2 && is_user()); if ($moderate) { $cpgtpl->assign_var('U_MODERATE', URL::index()); } else { $cpgtpl->assign_var('U_MODERATE', false); } while ($row = $db->sql_fetchrow($something)) { $tid = $row['tid']; $pid = $row['pid']; $sid = $row['sid']; $comment = decode_bb_all($row['comment']); if ($row['name'] == '') { $row['name'] = _ANONYMOUS; } else { $usrdata = getusrdata($row['name']); } if ($row['subject'] == '') { $row['subject'] = "[" . _NOSUBJECT . "]"; } if ($userinfo['commentmax'] && strlen($comment) > $userinfo['commentmax']) { $comment = substr($comment, 0, $userinfo['commentmax']); $commext = 1; } elseif (strlen($comment) > $MAIN_CFG['global']['commentlimit']) { $comment = substr($comment, 0, $MAIN_CFG['global']['commentlimit']); $commext = 1; } if ($pid != 0) { list($parentid) = $db->sql_ufetchrow("SELECT pid FROM " . $prefix . "_comments WHERE tid='{$pid}'", SQL_NUM); } $cpgtpl->assign_block_vars('comment', array('IS_NESTED' => false, 'IS_NESTED_END' => false, 'IS_FIRST' => true, 'IS_FIRST_END' => false, 'IS_LIST' => false, 'I_COMMENTID' => $tid, 'I_SCORE' => $row['score'], 'S_SCORE' => _SCORE, 'S_BGCOLOR3' => $bgcolor3, 'S_SUBJECT' => $row['subject'], 'S_REASON' => $row['reason'] > 0 ? constant('_REASONS_' . $row['reason']) : '', 'S_BYNAME' => _BY . ' ' . $row['name'], 'S_BY' => _BY, 'S_NAME' => $row['name'], 'S_ON' => _ON, 'S_DATE' => formatDateTime($row['date'], _DATESTRING), 'S_IP' => is_admin() ? '(IP: ' . decode_ip($row['host_name']) . ')' : '', 'S_COMMENT' => $comment, 'S_COMMENTEXT' => _READREST, 'S_DELETE' => _DELETE, 'S_REPLY' => _REPLY, 'S_MODERATE' => modtwo($tid, $row['score'], $row['reason']), 'S_PARENT' => _PARENT, 'S_USERINFO' => _USERINFO, 'U_USERINFO' => isset($usrdata) ? URL::index("Your_Account&profile={$usrdata['user_id']}") : '', 'S_USERPM' => _SENDAMSG, 'U_USERPM' => isset($usrdata) && is_active('Private_Messages') ? URL::index("Private_Messages&mode=post&u={$usrdata['user_id']}") : '', 'U_COMMENTEXT' => isset($commentext) ? URL::index("&file=comments&sid={$sid}&tid={$tid}") : '', 'U_DELETE' => is_admin() ? URL::admin("comments&del={$tid}") : '', 'U_PARENT' => $pid != 0 ? URL::index("&comment=0&sid={$sid}&pid={$parentid}") : '', 'U_REPLY' => $MAIN_CFG['global']['anonpost'] || is_user() ? URL::index("&reply={$tid}&sid={$sid}") : '')); DisplayKids($tid, $CPG_SESS['comments']['mode'], $order, $thold, 0); $cpgtpl->assign_block_vars('comment', array('IS_NESTED' => false, 'IS_NESTED_END' => false, 'IS_FIRST' => false, 'IS_FIRST_END' => true)); } $db->sql_freeresult($something); if ($moderate) { modthree($sid); } $cpgtpl->assign_var('S_NOCOMMENTS', false); $cpgtpl->assign_var('S_ONECOMMENT', false); $cpgtpl->set_filenames(array('comments' => 'news/comments.html')); $cpgtpl->display('comments'); }
function DisplayTopic($pollID, $pid = 0, $tid = 0, $mode = "thread", $order = 0, $thold = 0, $level = 0, $nokids = 0) { global $hr, $user, $datetime, $cookie, $userinfo, $admin, $commentlimit, $anonymous, $reasons, $anonpost, $foot1, $foot2, $foot3, $foot4, $prefix, $module_name, $db, $admin_file, $user_prefix; if (defined('NUKE_FILE')) { global $title, $bgcolor1, $bgcolor2, $bgcolor3; } else { global $title, $bgcolor1, $bgcolor2, $bgcolor3; include "mainfile.php"; include "header.php"; } if ($pid != 0) { include "header.php"; } $count_times = 0; cookiedecode($user); getusrinfo($user); $pollID = intval($pollID); $pid = intval($pid); if (!isset($mode) or empty($mode)) { if (isset($userinfo['umode'])) { $mode = $userinfo['umode']; } else { $mode = "thread"; } } if (!isset($order) or empty($order)) { if (isset($userinfo['uorder'])) { $order = $userinfo['uorder']; } else { $order = 0; } } if (!isset($thold) or empty($thold)) { if (isset($userinfo['thold'])) { $thold = $userinfo['thold']; } else { $thold = 0; } } $tid = intval($tid); $q = "select tid, pid, pollID, date, name, email, host_name, subject, comment, score, reason from " . $prefix . "_pollcomments where pollID='{$pollID}' and pid='{$pid}'"; if (!empty($thold)) { $q .= " and score>='{$thold}'"; } else { $q .= " and score>='0'"; } if ($order == 1) { $q .= " order by date desc"; } if ($order == 2) { $q .= " order by score desc"; } $something = $db->sql_query($q); $num_tid = $db->sql_numrows($something); navbar($pollID, $title, $thold, $mode, $order); modone(); while ($count_times < $num_tid) { echo "<br>"; OpenTable(); $row_q = $db->sql_fetchrow($something); $tid = intval($row_q['tid']); $pid = intval($row_q['pid']); $pollID = intval($row_q['pollID']); $date = $row_q['date']; $c_name = filter($row_q['name'], "nohtml"); $email = filter($row_q['email'], "nohtml"); $host_name = filter($row_q['host_name'], "nohtml"); $subject = filter($row_q['subject'], "nohtml"); $comment = filter($row_q['comment']); $score = intval($row_q['score']); $reason = intval($row_q['reason']); $karma = $db->sql_fetchrow($db->sql_query("SELECT karma FROM " . $user_prefix . "_users WHERE username='******'")); $karma = intval($karma['karma']); if (is_admin($admin)) { if ($karma == 1) { $karma = "<img src=\"images/karma/1.gif\" border=\"0\" alt=\"" . _KARMALOW . "\" title=\"" . _KARMALOW . "\"> "; } elseif ($karma == 2) { $karma = "<img src=\"images/karma/2.gif\" border=\"0\" alt=\"" . _KARMABAD . "\" title=\"" . _KARMABAD . "\"> "; } elseif ($karma == 3) { $karma = "<img src=\"images/karma/3.gif\" border=\"0\" alt=\"" . _KARMADEVIL . "\" title=\"" . _KARMADEVIL . "\"> "; } else { $karma = ""; } } else { $karma = ""; } if (empty($c_name)) { $c_name = $anonymous; } if (empty($subject)) { $subject = "[" . _NOSUBJECT . "]"; } echo "<a name=\"{$tid}\">"; echo "<table width=99% border=0><tr bgcolor=\"{$bgcolor1}\"><td width=500>"; formatTimestamp($date); if ($email) { echo "<p><b>{$subject}</b> <font class=content>"; if ($userinfo['noscore'] == 0) { echo "(" . _SCORE . " {$score}"; if ($reason > 0) { echo ", {$reasons[$reason]}"; } echo ")"; } echo "<br>" . _BY . " <a href=\"mailto:{$email}\">{$c_name}</a> <b>({$email})</b> " . _ON . " {$datetime}"; } else { echo "<p><b>{$subject}</b> <font class=content>"; if ($userinfo['noscore'] == 0) { echo "(" . _SCORE . " {$score}"; if ($reason > 0) { echo ", {$reasons[$reason]}"; } echo ")"; } echo "<br>" . _BY . " {$c_name} " . _ON . " {$datetime}"; } // If you are admin you can see the Poster IP address (you have this right, no?) // with this you can see who is flaming you... ha-ha-ha $journal = ""; if (is_active("Journal")) { $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")); $jid = intval($row['jid']); if (!empty($jid) and isset($jid)) { $journal = " | <a href=\"modules.php?name=Journal&file=display&jid={$jid}\">" . _JOURNAL . "</a>"; } else { $journal = ""; } } if ($c_name != $anonymous) { $row2 = $db->sql_fetchrow($db->sql_query("SELECT user_id FROM " . $user_prefix . "_users WHERE username='******'")); $r_uid = intval($row2['user_id']); echo "<br>(<a href=\"modules.php?name=Your_Account&op=userinfo&username={$c_name}\">" . _USERINFO . "</a> "; if (is_active("Private_Messages")) { echo "| <a href=\"modules.php?name=Private_Messages&mode=post&u={$r_uid}\">" . _SENDAMSG . "</a>"; } echo "{$journal}) "; } $row_url = $db->sql_fetchrow($db->sql_query("SELECT user_website FROM " . $prefix . "_users WHERE username='******'")); $url = filter($row_url['user_website'], "nohtml"); if ($url != "http://" and !empty($url) and stripos_clone($url, "http://")) { echo "<a href=\"{$url}\" target=\"new\">{$url}</a> "; } if (is_admin($admin)) { $row3 = $db->sql_fetchrow($db->sql_query("SELECT host_name from " . $prefix . "_pollcomments where tid='{$tid}'")); $host_name = filter($row3['host_name'], "nohtml"); echo "<br><b>(IP: {$host_name})</b> {$karma}"; } echo "</font></td></tr><tr><td>"; if (isset($userinfo['commentmax']) && strlen($comment) > $userinfo['commentmax']) { echo substr("{$comment}", 0, $userinfo['commentmax']) . "<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>"; } 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>"; } else { echo $comment; } echo "</td></tr></table><br><p>"; if ($anonpost == 1 or is_admin($admin) or is_user($user)) { 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>"; } if ($pid != 0) { $row4 = $db->sql_fetchrow($db->sql_query("SELECT pid from " . $prefix . "_pollcomments where tid='{$pid}'")); $erin = intval($row4['pid']); echo "| <a href=\"modules.php?name={$module_name}&file=comments&pollID={$pollID}&pid={$erin}&mode={$mode}&order={$order}&thold={$thold}\">" . _PARENT . "</a>"; } modtwo($tid, $score, $reason); if (is_admin($admin)) { echo " | <a href=\"" . $admin_file . ".php?op=RemovePollComment&tid={$tid}&pollID={$pollID}\">" . _DELETE . "</a> ]</font><p>"; } elseif ($anonpost != 0 or is_admin($admin) or is_user($user)) { echo " ]</font><p>"; } DisplayKids($tid, $mode, $order, $thold, $level); echo "</ul>"; if ($hr) { echo "<hr noshade size=1>"; } echo "</p>"; $count_times += 1; CloseTable(); } modthree($pollID, $mode, $order, $thold); if ($pid == 0) { return array($pollID, $pid, $subject); } else { include_once "footer.php"; } }
function DisplayTopic($sid, $pid = 0, $tid = 0, $mode = "thread", $order = 0, $thold = 0, $level = 0, $nokids = 0) { global $hr, $user, $datetime, $cookie, $mainfile, $admin, $commentlimit, $anonymous, $reasons, $anonpost, $foot1, $foot2, $foot3, $foot4, $prefix, $acomm, $articlecomm, $db, $module_name, $nukeurl; if ($mainfile) { global $title, $bgcolor1, $bgcolor2, $bgcolor3; } else { global $title, $bgcolor1, $bgcolor2, $bgcolor3; include "mainfile.php"; include "header.php"; } if ($pid != 0) { include "header.php"; } $count_times = 0; cookiedecode($user); $q = "SELECT tid, pid, sid, date, name, email, host_name, subject, comment, score, reason FROM " . $prefix . "_comments WHERE sid='{$sid}' and pid='{$pid}'"; if ($thold != "") { $q .= " AND score>='{$thold}'"; } else { $q .= " AND score>='0'"; } if ($order == 1) { $q .= " ORDER BY date DESC"; } if ($order == 2) { $q .= " ORDER BY score DESC"; } $something = $db->sql_query($q); $num_tid = $db->sql_numrows($something); if ($acomm == 1) { nocomm(); return; } if ($acomm == 0 and $articlecomm == 1) { navbar($sid, $title, $thold, $mode, $order); } modone(); while ($count_times < $num_tid) { echo "<br>"; OpenTable(); $row_q = $db->sql_fetchrow($something); $tid = intval($row_q['tid']); $pid = intval($row_q['pid']); $sid = intval($row_q['sid']); $date = $row_q['date']; $c_name = stripslashes($row_q['name']); $email = stripslashes($row_q['email']); $host_name = $row_q['host_name']; $subject = stripslashes(check_html($row_q['subject'], "nohtml")); $comment = stripslashes($row_q['comment']); $score = intval($row_q['score']); $reason = intval($row_q['reason']); if ($c_name == "") { $c_name = $anonymous; } if ($subject == "") { $subject = "[" . _NOSUBJECT . "]"; } echo "<a name=\"{$tid}\"></a>"; echo "<table width=\"99%\" border=\"0\"><tr bgcolor=\"{$bgcolor1}\"><td width=\"500\">"; formatTimestamp($date); if ($email) { echo "<b>{$subject}</b> <font class=\"content\">"; if (!$cookie[7]) { echo "(" . _SCORE . " {$score}"; if ($reason > 0) { echo ", {$reasons[$reason]}"; } echo ")"; } echo "<br>" . _BY . " <a href=\"mailto:{$email}\">{$c_name}</a> <b>({$email})</b> " . _ON . " {$datetime}"; } else { echo "<b>{$subject}</b> <font class=\"content\">"; if (!$cookie[7]) { echo "(" . _SCORE . " {$score}"; if ($reason > 0) { echo ", {$reasons[$reason]}"; } echo ")"; } echo "<br>" . _BY . " {$c_name} " . _ON . " {$datetime}"; } /* If you are admin you can see the Poster IP address */ /* with this you can see who is flaming you...*/ if (is_active("Journal")) { $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")); $jid = intval($row['jid']); if ($jid != "" and isset($jid)) { $journal = " | <a href=\"modules.php?name=Journal&file=display&jid={$jid}\">" . _JOURNAL . "</a>"; } else { $journal = ""; } } if ($c_name != $anonymous) { $row2 = $db->sql_fetchrow($db->sql_query("SELECT user_id FROM " . $prefix . "_users WHERE username='******'")); $r_uid = intval($row2['user_id']); 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}) "; } $row_url = $db->sql_fetchrow($db->sql_query("SELECT user_website FROM " . $prefix . "_users WHERE username='******'")); $url = stripslashes($row_url['user_website']); if ($url != "http://" and $url != "" and eregi("http://", $url)) { echo "<a href=\"{$url}\" target=\"new\">{$url}</a> "; } if (is_admin($admin)) { $row3 = $db->sql_fetchrow($db->sql_query("SELECT host_name FROM " . $prefix . "_comments WHERE tid='{$tid}'")); $host_name = $row3['host_name']; echo "<br><b>(IP: {$host_name})</b>"; } echo "</font></td></tr><tr><td>"; 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&sid={$sid}&tid={$tid}&mode={$mode}&order={$order}&thold={$thold}\">" . _READREST . "</a></b>"; } 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}&mode={$mode}&order={$order}&thold={$thold}\">" . _READREST . "</a></b>"; } else { echo $comment; } echo "</td></tr></table><br><br>"; if ($anonpost == 1 or is_admin($admin) or is_user($user)) { echo "<font class=\"content\"> [ <a href=\"modules.php?name={$module_name}&file=comments&op=Reply&pid={$tid}&sid={$sid}&mode={$mode}&order={$order}&thold={$thold}\">" . _REPLY . "</a>"; } if ($pid != 0) { $row4 = $db->sql_fetchrow($db->sql_query("SELECT pid FROM " . $prefix . "_comments WHERE tid='{$pid}'")); $erin = intval($row4['pid']); echo " | <a href=\"modules.php?name={$module_name}&file=comments&sid={$sid}&pid={$erin}&mode={$mode}&order={$order}&thold={$thold}\">" . _PARENT . "</a>"; } modtwo($tid, $score, $reason); if (is_admin($admin)) { echo " | <a href=\"admin.php?op=RemoveComment&tid={$tid}&sid={$sid}\">" . _DELETE . "</a> ]</font><br><br>"; } elseif ($anonpost != 0 or is_admin($admin) or is_user($user)) { echo " ]</font><br><br>"; } DisplayKids($tid, $mode, $order, $thold, $level); echo "</ul>"; if ($hr) { echo "<hr noshade size=\"1\">"; } $count_times += 1; CloseTable(); } modthree($sid, $mode, $order, $thold); if ($pid == 0) { return array($sid, $pid, $subject); } else { include "footer.php"; } }