function modules() { global $list_prefix; $MAIN = loadtmplate("main"); //lets get our module list from the DB. $sql = "SELECT * FROM " . $list_prefix . "config WHERE `key` = 'indexmodule' ORDER BY `order`;"; $result = db_query($sql); if ($result) { //lets see how many modules we have and initialize our variables. $rows = db_num_rows($result); $i = 0; $CONTENT = ""; $perpage = 3; //lets read our modules, load them, add their content to our main content. while ($i < $rows) { $row = db_fetch_array($result); include_once $row['value'] . ".mod.php"; $CONTENT .= "<H2>" . $MOD['title'] . "</H2><BR>\r\n"; $CONTENT .= $MOD['content']; $i++; } //lets insert our content into the template. $WORK = insert_into_template($MAIN, "{CONTENT}", $CONTENT); $WORK = filltemplate($WORK, "{SITENAME}"); //this is an ugly hack but it works. //when we output this lets make sure that the output is stripped of any template elements that are not used. printf("%s", striptemplate($WORK)); } }
function showlist($perpage) { global $list_prefix; $PRAYERLISTMOD = loadtmplate("prayerlist.mod"); //lets set our content to be blank. $CONTENT = ""; //lets setup our query $sql = "SELECT * FROM " . $list_prefix . "prayer_list WHERE `expired` = '0' LIMIT 0," . $perpage . ";"; //now lets show the prayerlist entries. $result = db_query($sql); @($rows = db_num_rows($result)); if ($rows != 0) { $j = 0; while ($j < $rows) { //lets fetch our prayer request from the database. $row = db_fetch_array($result); //lets insert the prayerrequest into our working copy of this template. $WORK = insert_into_template($PRAYERLISTMOD, "{REQUESTFOR}", striphtml($row['request_for'])); $WORK = insert_into_template($WORK, "{REQUEST}", striphtml($row['request'])); if ($admin == 1) { $WORK = insert_into_template($WORK, "{DELETE}", "<a href='prayerlist.php?delete=" . $row['id'] . "'>Delete</a>"); } $j++; //now lets add this request to the CONTENT. $WORK = insert_into_template($WORK, "{REQUESTID}", $row['id']); $CONTENT .= $WORK; } } else { $CONTENT .= "There are no active prayer requests at this time.<BR>\r\n"; } //when we output this lets make sure that the output is stripped of any template elements that are not used. return striptemplate($CONTENT); }
function getarticles($perpage) { global $list_prefix; $ARTICLES = loadtmplate("articles.mod"); $CONTENT = ""; //lets calculate our query $sql = "SELECT * FROM " . $list_prefix . "articles ORDER BY `date` DESC LIMIT 0," . $perpage . ";"; //now lets show the prayerlist entries. $result = db_query($sql); if ($result) { $rows = db_num_rows($result); } else { $rows = 0; } if ($rows != 0) { $j = 0; while ($j < $rows) { //lets fetch our prayer request from the database. $row = db_fetch_array($result); $postedby = getuser($row['posted_by']); //lets insert the prayerrequest into our working copy of this template. $WORK = insert_into_template($ARTICLES, "{ARTICLETITLE}", stripslashes($row['article_title'])); $WORK = insert_into_template($WORK, "{TEASER}", stripslashes($row['teaser'])); $WORK = insert_into_template($WORK, "{ARTICLEID}", $row['id']); $WORK = insert_into_template($WORK, "{POSTEDBY}", $postedby); $WORK = insert_into_template($WORK, "{BYLINE}", $row['byline']); $WORK = insert_into_template($WORK, "{DATE}", date("m/d/Y", $row['date'])); $WORK = insert_into_template($WORK, "{CATEGORY}", getcatname($row['category'])); $j++; //now lets add this request to the CONTENT. $CONTENT .= $WORK; } } else { $CONTENT .= "There are no active articles at this time.<BR>\r\n"; } //when we output this lets make sure that the output is stripped of any template elements that are not used. return striptemplate($CONTENT); }
<?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 {
<?php //**************************************************************************** //* File: plsubmission.php //* Author: G.A. Heath //* Date: July 7, 2005. //* License: GNU Public License (GPL) //* Last edit: September 11, 2005 //**************************************************************************** //===common code that should be run each time================================= include "common.inc.php"; //***template loads*********************************************************** $MAIN = loadtmplate(main); $PRAISE = loadtmplate(praise); $SUBMISSION = loadtmplate(plsubmission); $APP = "prayerlist"; //===Functions================================================================ //***function submissionform ()*********************************************** function submissionform() { global $logged_in, $user, $MAIN, $SUBMISSION; $WORK = loggedin(); //lets draw the submission form $WORK = insert_into_template($SUBMISSION, "{LOGGEDIN}", $WORK); $WORK = insert_into_template($MAIN, "{CONTENT}", $WORK); $WORK = filltemplate($WORK, "Submit a Prayer Request"); printf("%s", striptemplate($WORK)); } //***function submissionform_redo ()****************************************** function submissionform_redo() {
$prevmonth = $month - 1; $prevyear = $year; if ($nextmonth > 12) { $nextmonth = 1; $nextyear += 1; } if ($prevmonth < 1) { $prevmonth = 12; $prevyear -= 1; } //lets load the month template $MAIN = loadtmplate("main"); $MONTH = loadtmplate("month"); $WEEK = loadtmplate("week"); $DAY = loadtmplate("calday"); $LINK_DAY = loadtmplate("callink_day"); //lets do the calendar $DAYS = ""; $WEEKS = ""; while ($i < $firstofmonth) { $DAYS .= $DAY; $i++; } $iday = 0; //lets put the days into our calendar while ($iday < $daysinmonth) { $iday++; //check the db for anything that may be on this day //if there is activity on this day we will make a link available $event = 0; $sql = "SELECT * FROM " . $list_prefix . "calendar WHERE `weekly`='" . dayofweek($month, $iday, $year) . "';";
<?php //**************************************************************************** //* File: article.php //* Author: G.A. Heath //* Date: August 1, 2005. //* License: GNU Public License (GPL) //* Last edit: September 11, 2005 //**************************************************************************** //===common code that should be run each time================================= //***includes***************************************************************** include "common.inc.php"; //***template loads*********************************************************** $MAIN = loadtmplate("main"); $ARTICLE = loadtmplate("article"); $NAVLINKS = GETNAVLINKS(); //===Functions================================================================ //***function showarticle ($id)*********************************************** function showarticle($id) { global $list_prefix, $ARTICLE, $MAIN; $sql = "SELECT * FROM " . $list_prefix . "articles WHERE id = '" . $id . "';"; $result = db_query($sql); $rows = db_num_rows($result); if ($rows != 0) { $row = db_fetch_array($result); $postedby = getuser($row['posted_by']); //lets insert the prayerrequest into our working copy of this template. $WORK = insert_into_template($ARTICLE, "{ARTICLETITLE}", stripslashes($row['article_title'])); $WORK = insert_into_template($WORK, "{TEASER}", stripslashes($row['teaser'])); $WORK = insert_into_template($WORK, "{ARTICLEID}", $row['id']);
<?php //**************************************************************************** //* File: prayerlist_history.php //* Author: G.A. Heath //* Date: July 9, 2005. //* License: GNU Public License (GPL) //* Last edit: September 15, 2005 //**************************************************************************** //===common code that should be run each time================================= include "common.inc.php"; //***template loads*********************************************************** $MAIN = loadtmplate(main); $PRAYERLIST = loadtmplate(prayerlist); $APP = "prayerlist"; //===Functions================================================================ //***function showlist ()***************************************************** function showlist() { global $HTTP_GET_VARS, $user, $list_prefix, $MAIN, $LINKS, $PRAYERLIST; //lets set our content to be blank. $CONTENT = ""; //lets see if the user has specified how many requests per page. 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;
<?php //**************************************************************************** //* File: day.php //* Author: G.A. Heath //* Date: August 23, 2005. //* License: GNU Public License (GPL) //* Last edit: September 11, 2005 //**************************************************************************** include "common.inc.php"; include "calendar.inc.php"; //===functions================================================================ //===main code================================================================ $MAIN = loadtmplate("main"); $DAY = loadtmplate("day"); $EVENTS = loadtmplate("events"); //now lets get to work. if (isset($HTTP_GET_VARS['month']) && isset($HTTP_GET_VARS['day']) && isset($HTTP_GET_VARS['year']) && is_numeric($HTTP_GET_VARS['month']) && is_numeric($HTTP_GET_VARS['day']) && is_numeric($HTTP_GET_VARS['year'])) { //lets initialize our variables $CONTENT = ""; $day = $HTTP_GET_VARS['day']; $month = $HTTP_GET_VARS['month']; $year = $HTTP_GET_VARS['year']; if ($day < 10) { $day = "0" . 1 * $day; } if ($month < 10) { $month = "0" . 1 * $month; } //lets get the weekly events $sql = "SELECT * FROM " . $list_prefix . "calendar WHERE (`weekly`='" . dayofweek($month, $day, $year) . "' OR `monthly`='" . $day . "' OR `yearly`='" . $month . $day . "' OR `date`='" . $year . $month . $day . "') ORDER BY `time`;";
<?php //**************************************************************************** //* File: news_item.php //* Author: G.A. Heath //* Date: August 1, 2005. //* License: GNU Public License (GPL) //* Last edit: September 11, 2005 //**************************************************************************** //===common code that should be run each time================================= //***includes***************************************************************** include "common.inc.php"; //***template loads*********************************************************** $MAIN = loadtmplate("main"); $NEWS = loadtmplate("news_item"); $NAVLINKS = GETNAVLINKS(); //===Functions================================================================ //***function shownews ($id)*********************************************** function shownews($id) { global $list_prefix, $NEWS, $MAIN; $sql = "SELECT * FROM " . $list_prefix . "news WHERE id = '" . $id . "';"; $result = db_query($sql); $rows = db_num_rows($result); if ($rows != 0) { $row = db_fetch_array($result); $postedby = getuser($row['posted_by']); //lets insert the prayerrequest into our working copy of this template. $WORK = insert_into_template($NEWS, "{NEWSTITLE}", stripslashes($row['news_title'])); $WORK = insert_into_template($WORK, "{TEASER}", stripslashes($row['teaser'])); $WORK = insert_into_template($WORK, "{NEWSID}", $row['id']);
<?php //**************************************************************************** //* File: leavepraise.php //* Author: G.A. Heath //* Date: July 9, 2005. //* License: GNU Public License (GPL) //* Last edit: September 11, 2005 //**************************************************************************** //===common code that should be run each time================================= include "common.inc.php"; //***template loads*********************************************************** $MAIN = loadtmplate(main); $LEAVEPRAISE = loadtmplate(leavepraise); $APP = "prayerlist"; //===Functions================================================================ //***function submissionform ()*********************************************** function submissionform() { global $logged_in, $user, $HTTP_POST_VARS, $HTTP_GET_VARS, $MAIN, $LINKS, $LEAVEPRAISE; $WORK = loggedin(); //lets draw the request form. $WORK = insert_into_template($LEAVEPRAISE, "{LOGGEDIN}", $WORK); $WORK = insert_into_template($WORK, "{REQUESTID}", $HTTP_GET_VARS['request']); $WORK = insert_into_template($MAIN, "{CONTENT}", $WORK); $WORK = filltemplate($WORK, "Leave Praise"); printf("%s", striptemplate($WORK)); } //***function submissionform_redo ()****************************************** function submissionform_redo() {
//**************************************************************************** //* File: index.php //* Author: G.A. Heath //* Date: July 8, 2005. //* License: GNU Public License (GPL) //* Last edit: September 11, 2005 //**************************************************************************** //===common code that should be run each time================================= include "common.inc.php"; //===Functions================================================================ //===Main code================================================================ //lets figure out what our categories are.. $MAIN = loadtmplate("main"); $CATEGORIES = loadtmplate("linkcats"); $LINKS = loadtmplate("linklist"); $WORK = ""; $sql = "SELECT * FROM " . $list_prefix . "category WHERE `id` > '0' ORDER BY `order`;"; $result = db_query($sql); if ($result) { //if its in the db we will go with the db's configured value. $rows = db_num_rows($result); } else { $rows = 0; } $i = 0; while ($i < $rows) { $row = db_fetch_array($result); $i++; $sql = "SELECT * FROM " . $list_prefix . "links WHERE `category` = '" . $row['id'] . "' ORDER BY `order`;"; $result2 = db_query($sql);
function getblocks($blockset) { global $list_prefix; $BLOCK_TEMPLATE = loadtmplate("block"); $sql = "SELECT * FROM " . $list_prefix . "blocks WHERE `blockset` = '" . $blockset . "' ORDER BY `order`;"; $result = db_query($sql); if ($result) { $rows = db_num_rows($result); } else { $rows = 0; } $blocks = 0; $CONTENT = ""; while ($blocks < $rows) { $row = db_fetch_array($result); if ($row['name'] == "test") { $WORK = insert_into_template($BLOCK_TEMPLATE, "{BLOCK_TITLE}", "TEST BLOCK"); $WORK = insert_into_template($WORK, "{BLOCK_CONTENT}", "this is a test block"); } else { if (file_exists("./blocks/" . $row['name'] . ".php")) { include "blocks/" . $row['name'] . ".php"; $WORK = insert_into_template($BLOCK_TEMPLATE, "{BLOCK_TITLE}", $BLOCK['title']); $WORK = insert_into_template($WORK, "{BLOCK_CONTENT}", $BLOCK['content']); } } $CONTENT .= $WORK; $blocks++; } return $CONTENT; }
<?php //**************************************************************************** //* File: articles.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"); $ARTICLES = loadtmplate("articles"); //===Functions================================================================ //*** function showarticles ($category)*************************************** function showarticles($category) { global $HTTP_GET_VARS, $ARTICLES, $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 { $onepage = 0;