<?php //**************************************************************************** //* File: news.php //* Author: G.A. Heath //* Date: August 1, 2005. //* License: GNU Public License (GPL) //* Last edit: September 15, 2005 //**************************************************************************** //===common code that should be run each time================================= //***includes***************************************************************** include "common.inc.php"; //***template loads*********************************************************** $MAIN = loadtmplate("main"); $NEWS = loadtmplate("news"); $NAVLINKS = GETNAVLINKS(); //===Functions================================================================ //*** function shownews ($category)*************************************** function shownews($category) { global $HTTP_GET_VARS, $NEWS, $list_prefix, $MAIN; $CONTENT = ""; if (isset($HTTP_GET_VARS['perpage']) && is_numeric($HTTP_GET_VARS['perpage'])) { $perpage = $HTTP_GET_VARS['perpage']; } else { $perpage = 3; } //lets see if the user has specified to show all requests on a single page. if (isset($HTTP_GET_VARS['onepage'])) { $onepage = 1; } else {
function filltemplate($TEMPLATE, $TITLE) { //this function will consolidate code in most pages. global $list_prefix; //lets process the page title. $WORK = insert_into_template($TEMPLATE, "{TITLE}", $TITLE); //lets process the links $WORK = insert_into_template($WORK, "{NAVLINKS}", GETNAVLINKS()); $WORK = insert_into_template($WORK, "{APPLINKS}", GETPLAPPLINKS(getuserinfo())); //lets process the sitename $sql = "SELECT * FROM " . $list_prefix . "config WHERE `key` = 'sitename';"; $result = db_query($sql); $rows = db_num_rows($result); if (isset($rows) && $rows > 0) { $row = db_fetch_array($result); $VALUE = $row['value']; } else { $VALUE = "localhost"; } $WORK = insert_into_template($WORK, "{SITENAME}", $VALUE); //lets process the site description $sql = "SELECT * FROM " . $list_prefix . "config WHERE `key` = 'sitedescription';"; $result = db_query($sql); $rows = db_num_rows($result); if (isset($rows) && $rows > 0) { $row = db_fetch_array($result); $VALUE = $row['value']; } else { $VALUE = "Another FishCMS site."; } $WORK = insert_into_template($WORK, "{SITEDESCRIPTION}", $VALUE); //lets process the site copyright notice. $sql = "SELECT * FROM " . $list_prefix . "config WHERE `key` = 'copyright';"; $result = db_query($sql); $rows = db_num_rows($result); if (isset($rows) && $rows > 0) { $row = db_fetch_array($result); $VALUE = $row['value']; } else { $VALUE = "FishCMS is licensed under the GNU Public License<BR>\n© 2005 by G.A. Heath and Michael Rice."; } $WORK = insert_into_template($WORK, "{COPYRIGHT}", $VALUE); //lets process the site email address. $sql = "SELECT * FROM " . $list_prefix . "config WHERE `key` = 'email';"; $result = db_query($sql); $rows = db_num_rows($result); if (isset($rows) && $rows > 0) { $row = db_fetch_array($result); $VALUE = $row['value']; } else { $VALUE = "FishCMS is licensed under the GNU Public License<BR>\n© 2005 by G.A. Heath and Michael Rice."; } $WORK = insert_into_template($WORK, "{EMAIL}", $VALUE); //lets process the blocks //for now we will support 4 sets of blocks in the templates, later this will be dynamic. //block 1 $WORK = insert_into_template($WORK, "{BLOCKS1}", getblocks(1)); //block 2 $WORK = insert_into_template($WORK, "{BLOCKS2}", getblocks(2)); //block 3 $WORK = insert_into_template($WORK, "{BLOCKS3}", getblocks(3)); //block 4 $WORK = insert_into_template($WORK, "{BLOCKS4}", getblocks(4)); // $WORK=insert_into_template ($WORK, "", ); return $WORK; }