function echo_data($image, $topic, $row_color) { global $read_page, $ext, $id, $myname, $max, $forum_url; global $space_gif, $num, $old_message, $navigate; $thread_total = ""; if ($row_color % 2 == 0) { $bgcolor = "#c0c0c0"; $font_color = "#000000"; } else { $bgcolor = "#FFFFFF"; $font_color = "#000000"; } $subject = "<table cellspacing=0 cellpadding=0 border=0"; if ($bgcolor != "") { $subject .= " bgcolor=\"" . $bgcolor . "\""; } $subject .= ">\n"; $subject .= "<tr>\n<td>"; $subject .= $space_gif; $subject .= $image . "</td>\n<td><FONT face=\"Arial,Helvetica\" COLOR=\"{$font_color}\"> "; $subject .= "<a href=\"{$forum_url}/{$read_page}.{$ext}?admview=1&f={$num}&i=" . $topic["id"]; $subject .= "&t=" . $topic["thread"] . "\">" . $topic["subject"] . "</a>"; $author = $topic["author"]; $approved = $topic["approved"]; $datestamp = phorum_date_format($topic["datestamp"]); $threadflags = $topic["threadflags"]; $parent = $topic["parent"]; $thread = $topic["thread"]; $subject .= " "; $subject .= "</td>\n</tr>\n</table>"; ?> <tr VALIGN=middle> <td bgcolor=<?php echo $bgcolor; ?> ><?php echo $subject; ?> </td> <td bgcolor=<?php echo $bgcolor; ?> nowrap="nowrap"><FONT face="Arial,Helvetica" COLOR="<?php echo $font_color; ?> "><?php echo $author; ?> </td> <td bgcolor=<?php echo $bgcolor; ?> nowrap="nowrap"><FONT face="Arial,Helvetica" SIZE="-2" COLOR="<?php echo $font_color; ?> "><?php echo $datestamp; ?> </td> <td bgcolor=<?php echo $bgcolor; ?> nowrap="nowrap"><FONT face="Arial,Helvetica" SIZE="-2" COLOR="<?php echo $font_color; ?> "><a href="<?php echo $myname; ?> ?page=easyadmin&action=del&type=quick&id=<?php echo $topic["id"]; ?> &num=<?php echo $num; ?> &navigate=<?php echo $navigate; ?> &thread=<?php echo $max; ?> ">Delete</a> | <a href="<?php echo $myname; ?> ?page=edit&srcpage=easyadmin&id=<?php echo $topic["id"]; ?> &num=<?php echo $num; ?> &navigate=<?php echo $navigate; ?> &mythread=<?php echo $max; ?> ">Edit</a> | <a href="<?php echo $myname; ?> ?page=easyadmin&action=moderate&approved=<?php echo $approved; ?> &id=<?php echo $topic["id"]; ?> &num=<?php echo $num; ?> &navigate=<?php echo $navigate; ?> &mythread=<?php echo $max; ?> "><?php if ($approved == 'Y') { echo "Hide"; } else { echo "Approve"; } ?> </a> <?php if ($parent == 0) { if ($threadflags & FLG_FROZEN) { $newflags = $threadflags & ~FLG_FROZEN; echo " | <a href=\"{$myname}?page=easyadmin&action=flags&flags={$newflags}&mythread={$thread}&navigate={$navigate}&num={$num}\">Unfreeze</a>"; } else { $newflags = $threadflags | FLG_FROZEN; echo " | <a href=\"{$myname}?page=easyadmin&action=flags&flags={$newflags}&mythread={$thread}&navigate={$navigate}&num={$num}\">Freeze</a>"; } if ($threadflags & FLG_KEEPONTOP) { $newflags = $threadflags & ~FLG_KEEPONTOP; echo " | <a href=\"{$myname}?page=easyadmin&action=flags&flags={$newflags}&mythread={$thread}&navigate={$navigate}&num={$num}\">Unstick</a>"; } else { $newflags = $threadflags | FLG_KEEPONTOP; echo " | <a href=\"{$myname}?page=easyadmin&action=flags&flags={$newflags}&mythread={$thread}&navigate={$navigate}&num={$num}\">Stick</a>"; } } ?> </TD> </tr> <?php }
if (!$rec["folder"]) { $sSQL = "select count(*) as posts from {$rec['table_name']} where approved='Y'"; $tq = new query($DB, $sSQL); if ($tq->numrows()) { $trec = $tq->getrow(); $num_posts = $trec["posts"]; } else { $num_posts = '0'; } $sSQL = "select max(datestamp) as max_date from {$rec['table_name']} where approved='Y'"; $tq->query($DB, $sSQL); $trec = $tq->getrow(); if (empty($trec["max_date"])) { $last_post_date = ""; } else { $last_post_date = phorum_date_format($trec["max_date"]); } $posts = "{$lNumPosts}: <strong>{$num_posts}</strong> "; $last = "{$lLastPostDate}: <strong>{$last_post_date}</strong>"; $url = "{$list_page}.{$ext}?f={$num}{$GetVars}"; } else { $last = $lForumFolder; $url = "{$forum_page}.{$ext}?f={$num}{$GetVars}"; } ?> <tr> <td nowrap="nowrap" bgcolor="<?php echo $table_body_color_1; ?> "><FONT color="<?php echo $table_body_font_color_1;
<?php /* Phorum News v1.1 Original Author - Stephen VanDyke This is a fast news script, I need to update post.php and the admin stuff so that we can designate a forum as NEWS ONLY (ie- first posts are moderated, but the rest are not...) -Stephen */ // CONFIG $ShowLimit = 10; // this is how many stories to show on the page $f = "1"; // this is the forum id of the news forum. // set this to the right path to the Phorum dir. $path = "/PATH/TO/PHORUM"; $oldir = getcwd(); chdir($path); include "./common.php"; $SQL = "SELECT\n subject,\n author,\n email,\n datestamp,\n body\n FROM\n {$ForumTableName},\n {$ForumTableName}" . "_bodies\n WHERE\n {$ForumTableName}.id={$ForumTableName}" . "_bodies.id\n AND\n parent = '0'\n AND\n approved = 'Y'\n ORDER BY\n datestamp DESC\n LIMIT\n {$ShowLimit}"; $rSQL = $q->query($DB, $SQL); while (list($HEADLINE, $AUTHOR, $EMAIL, $DATESTAMP, $BODY) = mysql_fetch_row($rSQL)) { if (!empty($EMAIL)) { $AUTHOR = "<a href=\"mailto:" . htmlencode($EMAIL) . "\">{$AUTHOR}</a>"; } $DATESTAMP = phorum_date_format($DATESTAMP); echo "<p><strong>{$HEADLINE}</strong><br /><font size=\"-1\">By {$AUTHOR} on {$DATESTAMP}</font><br />{$BODY}</p>"; } // put the script back in the right dir. chdir($oldir);
$empty = false; $name = $rec["name"]; $table = $rec["table_name"]; $i++; $num = $rec["id"]; if (!$rec["folder"]) { $sSQL = "SELECT * from {$table} WHERE approved='N' ORDER BY datestamp DESC"; $pq = new query($DB, $sSQL); $pq->query($DB, $sSQL); $x = 1; while ($tam = $pq->getrow()) { $subject = $tam["subject"]; $id = $tam["id"]; $topic = $tam["thread"]; $person = $tam["author"]; $datestamp = phorum_date_format($tam["datestamp"]); $approved = $tam["approved"]; if ($x % 2 == 0) { $bgcolor = $ForumTableBodyColor1; } else { $bgcolor = $ForumTableBodyColor2; } $x++; $nav .= '<tr><td ' . bgcolor($bgcolor) . '>'; $nav .= "<a HREF=\"{$forum_url}/{$read_page}.{$ext}?admview=1&f={$num}&i=" . $tam["id"] . "&t={$topic}\">"; $nav .= "{$subject}</a></td>"; $nav .= '<td ' . bgcolor($bgcolor) . ">{$person}</td><td " . bgcolor($bgcolor) . ">"; $nav .= "{$datestamp}</td>"; $nav .= '<td ' . bgcolor($bgcolor) . "><a HREF=\"{$myname}?page=recentadmin&action=del&type=quick&id={$id}"; $nav .= "&num={$num}&navigate={$navigate}&thread={$topic}\">Delete</a> | "; $nav .= "<a HREF=\"{$myname}?page=edit&srcpage=recentadmin&id={$id}&num={$num}&navigate={$navigate}&mythread={$topic}\">";
function echo_data($image, $topic, $row_color) { global $ForumTableWidth, $ForumTableHeaderColor, $ForumTableHeaderFontColor; global $ForumTableBodyColor1, $ForumTableBodyFontColor1, $ForumTableBodyColor2, $ForumTableBodyFontColor2; global $read_page, $ext, $collapse, $id, $UseCookies, $phflat, ${$phflat}; global $space_gif, $num, $old_message, $haveread, $use_haveread; global $lNew, $lFrozen, $lSticky, $GetVars, $users, $moderators; $thread_total = ""; if ($row_color % 2 == 0) { $bgcolor = $ForumTableBodyColor1; $font_color = $ForumTableBodyFontColor1; } else { $bgcolor = $ForumTableBodyColor2; $font_color = $ForumTableBodyFontColor2; } $subject = "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" " . bgcolor($bgcolor) . ">\n"; $subject .= "<tr>\n<td>"; $subject .= $space_gif; $subject .= $image . "</td>\n<td><font color=\"{$font_color}\"> "; if (!empty($users[$topic["userid"]])) { $author = $users[$topic["userid"]]["name"]; if (isset($moderators[$topic["userid"]])) { $subject = "<strong>{$subject}</strong>"; $author = "<strong>{$author}</strong>"; } } else { $author = chop($topic["author"]); } $datestamp = phorum_date_format($topic["datestamp"]); if ($id == $topic["id"] && ($read = true)) { $subject .= "<strong>" . $topic["subject"] . "</strong>"; $author = "<strong>" . $author . "</strong>"; $datestamp = "<strong>" . $datestamp . "</strong>"; } else { $subject .= "<a href=\"{$read_page}.{$ext}?f={$num}&i=" . $topic["id"]; $reply_name = ''; if (${$phflat}) { $reply_name = "#reply_" . $topic["id"]; } $subject .= "&t=" . $topic["thread"] . "{$GetVars}{$reply_name}\">" . $topic["subject"] . "</a>"; } $subject .= " </font>"; if ($UseCookies) { $isnew = false; if ($use_haveread == true) { if ($old_message < $topic["id"]) { if (!isset($haveread[$topic["id"]])) { $isnew = true; } } } elseif ($old_message < $topic["id"]) { $isnew = true; } if ($isnew) { $subject .= "<font class=\"PhorumNewFlag\">" . $lNew . "</font>"; } if ($topic["threadflags"] & FLG_FROZEN && $topic["parent"] == 0) { $subject .= "<font class=\"PhorumFrozenFlag\">{$lFrozen}</font>"; } if ($topic["threadflags"] & FLG_KEEPONTOP && $topic["parent"] == 0) { $subject .= "<font class=\"PhorumStickyFlag\">{$lSticky}</font>"; } } $subject .= "</td>\n</tr>\n</table>"; ?> <tr valign=middle> <td class="PhorumListRow" <?php echo bgcolor($bgcolor); ?> ><?php echo $subject; ?> </td> <td class="PhorumListRow" <?php echo bgcolor($bgcolor); ?> nowrap="nowrap"><font color="<?php echo $font_color; ?> "><?php echo $author; ?> </font></td> <td class="PhorumListRow" <?php echo bgcolor($bgcolor); ?> nowrap="nowrap"><font color="<?php echo $font_color; ?> "><?php echo $datestamp; ?> </font></td> </tr> <?php }
</table> </td> </tr> </table> <?php } else { @reset($headers); @reset($bodies); $head_row = @current($headers); $body_row = @current($bodies); while (is_array($head_row) && is_array($body_row)) { if ($head_row["id"] == $body_row["id"]) { $rec_id = $head_row["id"]; $subject = chop($head_row["subject"]); $datestamp = phorum_date_format($head_row["datestamp"]); $body = $body_row["body"]; $host = ""; $profile_link = ""; $sig = ""; $reply_url = "{$read_page}.{$ext}?f={$f}&i={$rec_id}&t={$t}{$GetVars}#REPLY"; if ($head_row["userid"] > 0 && isset($users[$head_row["userid"]])) { $user = $users[$head_row["userid"]]; $author = $qauthor = $user["name"]; $email = $user["email"]; $host = ""; $author = "<a href=\"{$forum_url}/profile.{$ext}?f={$ForumId}&id={$head_row['userid']}{$GetVars}\">{$author}</a>"; // replace sig $sig = $user["signature"]; } else { $author = $qauthor = chop($head_row["author"]);
$t_id = $message["id"]; $t_thread = $message["thread"]; $t_subject = chop($message["subject"]); if (!empty($users[$message["userid"]])) { $t_author = $users[$message["userid"]]["name"]; if (isset($moderators[$message["userid"]])) { $t_subject = "<strong>{$t_subject}</strong>"; $t_author = "<strong>{$t_author}</strong>"; } } else { $t_author = chop($message["author"]); } $t_datestamp = phorum_date_format($message["datestamp"]); $t_flags = $message["threadflags"]; if (${$phcollapse} != 0 && !$read) { $t_latest = phorum_date_format($trec["latest"]); $t_maxid = $trec["maxid"]; } $message = next($headers); if ($t_thread != $t_id) { $img = '<img src="images/l.gif" border=0 width=12 align="top">'; if (is_array($message)) { if ($t_thread == $message["thread"]) { $img = '<img src="images/t.gif" border=0 width=12 align="top">'; } } } else { $img = "<img src=\"images/trans.gif\" border=0 width=1 height=21 align=\"absmiddle\">"; $loc = 0; } if (initvar("id") == $t_id && ($read = true)) {
<?php if ($rows > 0) { $message = current($messages); $count = $start_num; while (is_array($message)) { $count = $count + 1; if (!isset($top_id)) { $top_id = $message["id"]; } echo "<dl><dt><strong>{$count}. </strong><a href=\"{$read_page}.{$ext}?f={$num}&i=" . $message["id"] . "&t=" . $message["thread"] . "{$GetVars}\"><strong>" . chop($message["subject"]) . "</strong></a> - " . chop($message["author"]) . "<br />\n<dd>"; $text = format_body($message["body"]); $text = chop(substr($text, 0, 200)); $text = strip_tags($text); $text = str_replace(PHORUM_SIG_MARKER, "", $text); echo $text . "<br />"; echo "<font size=-2>{$lDate}: " . phorum_date_format($message["datestamp"]) . "</font><br />\n"; echo "</dl><p>\n"; $last_id = $message["id"]; $message = next($messages); } } else { echo $lNoMatches; } $prevmatch = ''; $morematch = ''; if ($start_num >= $ForumDisplay) { $start_num = $start_num - $ForumDisplay; $prevmatch = "<a href=\"{$search_page}.{$ext}?f={$num}&search=" . urlencode($search) . "&match={$match}&date={$date}&fldauthor={$fldauthor}&fldsubject={$fldsubject}&fldbody={$fldbody}&x=2,{$start_num}{$GetVars}\"><FONT color=\"{$ForumNavFontColor}\">{$lPrevMatches}</font></a>"; } if ($rows >= $ForumDisplay) { $morematch = "<a href=\"{$search_page}.{$ext}?f={$num}&search=" . urlencode($search) . "&match={$match}&date={$date}&fldauthor={$fldauthor}&fldsubject={$fldsubject}&fldbody={$fldbody}&x=1,{$count}{$GetVars}\"><FONT color=\"{$ForumNavFontColor}\">{$lMoreMatches}</font></a>";
krsort($messages); $message = current($messages); $count = $start - 1; while (is_array($message)) { $count = $count + 1; if (!isset($top_id)) { $top_id = $message["id"]; } $text = format_body($message["body"]); $text = chop(substr($text, 0, 200)); $text = strip_tags($text); $text = str_replace(PHORUM_SIG_MARKER, "", $text); $link = "{$read_page}.{$ext}?f={$message['forum']}&i={$message['id']}&t={$message['thread']}{$GetVars}"; $subject = chop($message["subject"]); $author = chop($message["author"]); $datestamp = phorum_date_format($message["datestamp"]); $forum = $forums[$message["forum"]]; echo "<tr><td {$bgcolor}>\n"; echo "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\">\n"; echo " <tr>\n"; echo " <td width=\"5%\" nowrap=\"nowrap\" {$bgcolor}><strong> {$count}.</strong></td>\n"; echo " <td width=\"47%\" {$bgcolor}><a href=\"{$link}\"><strong>{$subject}</strong></a></td>\n"; echo " <td width=\"24%\" {$bgcolor}>{$author} </td>\n"; echo " <td width=\"24%\" {$bgcolor}>{$datestamp}</td>\n"; echo " </tr>\n"; echo "</table>\n"; echo "<blockquote>\n"; echo "<font class=\"PhorumMessage\">{$text}</font><br /><br />\n"; echo "<strong>{$lBigForum}: <a HREF=\"{$list_page}.{$ext}?f={$message['forum']}{$GetVars}\">{$forum}</a></strong>\n"; echo "</blockquote>\n"; echo "</td></tr>\n";