* Copyright 2001-2012 Strangecode, LLC * * This file is part of The Strangecode Codebase. * * The Strangecode Codebase 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 3 of the License, or (at your option) * any later version. * * The Strangecode Codebase 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 * The Strangecode Codebase. If not, see . */ /** * %PUBLIC_SCRIPT% * * Generated by module_maker.cli.php on %DATE% */ require_once dirname(__FILE__) . '/_config.inc.php'; require_once 'codebase/lib/PageNumbers.inc.php'; require_once 'codebase/lib/SortOrder.inc.php'; /****************************************************************************** * CODE CONFIG *****************************************************************************/ // Titles and navigation header. $nav->add(sprintf(_("%TITLE%"), null)); $nav->setParam(array( 'title' => true, )); // Instantiate page numbers. Total items are set and calculation is done in the getRecordList function. $page = new PageNumbers(); $page->setPerPage(getFormData('per_page'), 50); $page->setPageNumber(getFormData('page_number')); %SORT_ORDER% /******************************************************************** * MAIN ********************************************************************/ if (getFormData('%PRIMARY_KEY%', false)) { // Get requested record. $qid = $db->query(" SELECT * FROM %DB_TBL% WHERE %PRIMARY_KEY% = '" . $db->escapeString(getFormData('%PRIMARY_KEY%')) . "' AND publish = 'true' __///__AND (publish_date <= CURDATE() OR publish_date = '0000-00-00') __///__AND (expire_date > CURDATE() OR expire_date = '0000-00-00') "); if (!$item = mysql_fetch_assoc($qid)) { $app->raiseMsg(_("Sorry that %ITEM_TITLE% could not be found"), MSG_WARNING, __FILE__, __LINE__); $app->dieBoomerangURL(); } // Update the hit counter for this record. $db->query(" UPDATE %DB_TBL% SET hit_count = hit_count + 1 WHERE %PRIMARY_KEY% = '" . $db->escapeString(getFormData('%PRIMARY_KEY%')) . "' "); // Set title and main template. $nav->add($item['__///__']); $main_template = '%PUBLIC_DETAIL_TEMPLATE%'; } else { // Get the DEFAULT list. $%NAME_SINGULAR%_list = array(); $qid = $db->query(" SELECT * FROM %DB_TBL% WHERE publish = 'true' " . $so->getSortOrderSQL() . " LIMIT 100 "); while ($row = mysql_fetch_assoc($qid)) { $%NAME_SINGULAR%_list[] = $row; } // Set page numbers for default list. $page->setTotalItems(sizeof($%NAME_SINGULAR%_list)); $page->calculate(); // Get the FEATURED list. $featured_list = array(); $qid = $db->query(" SELECT * FROM %DB_TBL% WHERE publish = 'true' AND featured = 'true' ORDER BY %PRIMARY_KEY% DESC LIMIT 10 "); while ($row = mysql_fetch_assoc($qid)) { $featured_list[] = $row; } // Get the POPULAR list. $popular_list = array(); $qid = $db->query(" SELECT * FROM %DB_TBL% WHERE publish = 'true' ORDER BY hit_count DESC LIMIT 10 "); while ($row = mysql_fetch_assoc($qid)) { $popular_list[] = $row; } // Get the RECENT list. $recent_list = array(); $qid = $db->query(" SELECT * FROM %DB_TBL% WHERE publish = 'true' ORDER BY added_datetime DESC LIMIT 10 "); while ($row = mysql_fetch_assoc($qid)) { $recent_list[] = $row; } // Set main template. $main_template = '%PUBLIC_LIST_TEMPLATE%'; } // We have the data, and no errors, so here come the templates. include 'header.ihtml'; include $main_template; include 'footer.ihtml'; ?>