Contributions by Keith Gable This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. In addition to being restricted by the GNU General Public License, Essence Engine may not be sold, rented, sublicensed, or leased; you are not permitted to generate revenue with the Essence Engine source code. You may, however, use Essence Engine to run a website that generates revenue via other means. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA $Id$ */ // Home // Main page for the site //$pagetitle = "Home"; include("mainheader.php"); include("themeheader.php"); // Query forum database for news posts $perpage = 15; // Todo: Make configurable if ($_GET["page"]) $pagenum = mysql_escape_string($_GET["page"]); else $pagenum = 1; if (!$userinfo["showhidden"]) $hide = "AND opt_hide=0"; if ($_GET["newsid"]) $result = mysql_query("SELECT * FROM forum_posts WHERE topic_id=0 AND forum_id=$newsforum $hide AND post_id='" . mysql_escape_string($_GET["newsid"]) . "' ORDER BY post_id DESC", $db); elseif ($_GET["userid"]) $result = mysql_query("SELECT * FROM forum_posts WHERE topic_id=0 AND forum_id=$newsforum $hide AND post_username='" . mysql_escape_string($_GET["userid"]) . "' ORDER BY post_id DESC", $db); else $result = mysql_query("SELECT * FROM forum_posts WHERE topic_id=0 AND forum_id=$newsforum $hide ORDER BY post_id DESC LIMIT " . $perpage . " OFFSET " . (($pagenum - 1) * $perpage), $db); // Initialize lastday to an impossible date $lastday = "bleh"; // If the user is Poster or higher if ($usertype >= 4) echo "
Post new news
\n"; // Loop through applicable news posts while ($news = mysql_fetch_array($result)) { if ($lastday != date("ndY",$news["post_time"])) { echo "

" . safetext(date("F j, Y",$news["post_time"])) . "

\n\n"; $lastday = date("ndY",$news["post_time"]); } $newsuser = mysql_query("SELECT * FROM users WHERE username='". $news["post_username"] . "'", $db); if (mysql_affected_rows() >= 0) $newsuser = mysql_fetch_array($newsuser); else unset($newsuser); // Write update header echo "
\n

"; if ($newsuser) if ($newsuser["postlogo"]) echo ' - '; else echo ' - '; else echo "Posted by a deleted user - "; echo safetext(date("g:i A",$news["post_time"])) . " - " . safetext($news["post_head"]) . "

\n"; /* $posttext = stripslashes($news["post_text"]); if (!$news["opt_html"]) $posttext = safetext($news["post_text"]); if (!$news["opt_html"]) $posttext = nl2pbr($posttext); if (!$news["opt_bbcode"]) $posttext = process_bbcode($posttext,$newsuser["dispname"]); //$posttext = applyacronyms($posttext); if (!$news["opt_emoticons"]) $posttext = applyemotes($posttext); */ echo "

" . process_post($news,$newsuser["dispname"]) . "

\n"; echo " \n
\n
\n"; } if (!$userinfo["showhidden"]) $hide = "AND opt_hide=0"; $result = mysql_query("SELECT count(*) FROM forum_posts WHERE forum_id=$newsforum AND topic_id=0 $hide", $db); $totalnews= mysql_fetch_array($result); $totalnews = $totalnews["count(*)"]; $totalpages = ceil($totalnews / $perpage); if ($totalpages > 1) { echo "
Go to page: \n"; for ($curpage = 1; $curpage <= $totalpages; ++$curpage) { if ($curpage == $pagenum) echo $curpage; else echo '' . $curpage . "\n"; if ($curpage != $totalpages) echo " - "; } echo "\n
\n
\n"; } include("themefooter.php"); ?>