mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 12:48:24 +01:00
This commit is contained in:
parent
75e61bb9f4
commit
8e25b97b1f
289
news.php
289
news.php
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/news.php,v $
|
||||
| $Revision: 1.6 $
|
||||
| $Date: 2007-05-21 19:18:40 $
|
||||
| $Revision: 1.7 $
|
||||
| $Date: 2007-06-07 20:34:02 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -21,60 +21,87 @@ require_once(e_HANDLER."news_class.php");
|
||||
require_once(e_HANDLER."comment_class.php");
|
||||
$cobj = new comment;
|
||||
|
||||
if (isset($NEWSHEADER)) {
|
||||
if (isset($NEWSHEADER))
|
||||
{
|
||||
require_once(HEADERF);
|
||||
require_once(FOOTERF);
|
||||
exit;
|
||||
}
|
||||
|
||||
$cacheString = 'news.php_'.e_QUERY;
|
||||
$action = '';
|
||||
if (!defined("ITEMVIEW")){
|
||||
if ($pref['newsposts']==""){
|
||||
define("ITEMVIEW", 15);
|
||||
} else {
|
||||
define("ITEMVIEW", $pref['newsposts']);
|
||||
}
|
||||
$sub_action = '';
|
||||
$order = "news_datestamp";
|
||||
$newsfrom = 0;
|
||||
|
||||
if (!defined("ITEMVIEW"))
|
||||
{
|
||||
define("ITEMVIEW", varset($pref['newsposts'],15));
|
||||
}
|
||||
|
||||
if (e_QUERY) {
|
||||
if (e_QUERY)
|
||||
{
|
||||
$tmp = explode(".", e_QUERY);
|
||||
$action = $tmp[0];
|
||||
$sub_action = $tmp[1];
|
||||
$id = $tmp[2];
|
||||
$action = $tmp[0]; // At least one parameter here
|
||||
$sub_action = varset($tmp[1],''); // Usually a numeric category, but don't presume yet
|
||||
$id = varset($tmp[2],''); // ID of specific news item where required
|
||||
$newsfrom = intval(varset($tmp[2],0)); // Item number for first item on multi-page lists
|
||||
}
|
||||
|
||||
$newsfrom = (!is_numeric($action) || !e_QUERY ? 0 : ($action ? $action : e_QUERY));
|
||||
if (isset($tmp[1]) && $tmp[1] == 'list') {
|
||||
$action = 'list';
|
||||
$newsfrom = intval($tmp[0]);
|
||||
$sub_action = intval($tmp[2]);
|
||||
//$newsfrom = (!is_numeric($action) || !e_QUERY ? 0 : ($action ? $action : e_QUERY));
|
||||
|
||||
// Usually the first query parameter is the action.
|
||||
// For any of the 'list' modes (inc month, day), the action being second is a legacy situation
|
||||
// .... which can hopefully go sometime
|
||||
if (is_numeric($action) && isset($tmp[1]) && (($tmp[1] == 'list') || ($tmp[1] == 'month') || ($tmp[1] == 'day')))
|
||||
{
|
||||
$action = $tmp[1];
|
||||
$sub_action = varset($tmp[0],'');
|
||||
}
|
||||
if ($action == 'all' || $action == 'cat') {
|
||||
$newsfrom = intval($tmp[2]);
|
||||
$sub_action = intval($tmp[1]);
|
||||
|
||||
|
||||
|
||||
if ($action == 'all' || $action == 'cat')
|
||||
{
|
||||
$sub_action = intval(varset($tmp[1],0));
|
||||
}
|
||||
|
||||
/*
|
||||
Variables Used:
|
||||
$action - the basic display format/filter
|
||||
$sub_action - category number or news item number
|
||||
$newsfrom - first item number in list (default 0) - derived from nextprev
|
||||
$order - sets the listing order for 'list' format
|
||||
*/
|
||||
|
||||
|
||||
$ix = new news;
|
||||
$nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";
|
||||
if ($action == 'cat' || $action == 'all'){
|
||||
|
||||
// --> Cache
|
||||
if($tmp = checkCache($cacheString)){
|
||||
//------------------------------------------------------
|
||||
// DISPLAY NEWS IN 'CATEGORY' FORMAT HERE
|
||||
//------------------------------------------------------
|
||||
// Just title and a few other details
|
||||
if ($action == 'cat' || $action == 'all')
|
||||
{ // --> Cache
|
||||
if($tmp = checkCache($cacheString))
|
||||
{
|
||||
require_once(HEADERF);
|
||||
renderCache($tmp, TRUE);
|
||||
}
|
||||
// <-- Cache
|
||||
|
||||
$qs = explode(".", e_QUERY);
|
||||
|
||||
$category = intval($qs[1]);
|
||||
if ($action == 'cat' && $category != 0) {
|
||||
$category = intval($sub_action);
|
||||
if ($action == 'cat' && $category != 0)
|
||||
{
|
||||
$gen = new convert;
|
||||
$sql->db_Select("news_category", "*", "category_id='$category'");
|
||||
$row = $sql->db_Fetch();
|
||||
extract($row); // still required for the table-render. :(
|
||||
}
|
||||
if ($action == 'all'){
|
||||
if ($action == 'all')
|
||||
{
|
||||
if(!defined("NEWSALL_LIMIT")) { define("NEWSALL_LIMIT",10); }
|
||||
// show archive of all news items using list-style template.
|
||||
$news_total = $sql->db_Count("news", "(*)", "WHERE news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().")");
|
||||
@ -82,26 +109,36 @@ if ($action == 'cat' || $action == 'all'){
|
||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
|
||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()."
|
||||
AND (n.news_end=0 || n.news_end>".time().") ORDER BY n.news_sticky DESC,n.news_datestamp DESC LIMIT ".intval($newsfrom).",".NEWSALL_LIMIT;
|
||||
AND (n.news_end=0 || n.news_end>".time().")
|
||||
ORDER BY n.news_sticky DESC, n.news_datestamp DESC
|
||||
LIMIT ".intval($newsfrom).",".NEWSALL_LIMIT;
|
||||
$category_name = "All";
|
||||
}
|
||||
elseif ($action == 'cat'){
|
||||
elseif ($action == 'cat')
|
||||
{
|
||||
// show archive of all news items in a particular category using list-style template.
|
||||
$news_total = $sql->db_Count("news", "(*)", "WHERE news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().") AND news_category=".intval($sub_action));
|
||||
if(!defined("NEWSLIST_LIMIT")) { define("NEWSLIST_LIMIT",10); }
|
||||
$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
|
||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
|
||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") AND n.news_category=".intval($sub_action)." ORDER BY n.news_datestamp DESC LIMIT ".intval($newsfrom).",".NEWSLIST_LIMIT;
|
||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
||||
AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")
|
||||
AND n.news_category=".intval($sub_action)."
|
||||
ORDER BY n.news_datestamp DESC
|
||||
LIMIT ".intval($newsfrom).",".NEWSLIST_LIMIT;
|
||||
}
|
||||
|
||||
if($category_name){
|
||||
define("e_PAGETITLE", $tp->toHTML($category_name,FALSE,"defs"));
|
||||
if($category_name)
|
||||
{
|
||||
// define("e_PAGETITLE", $tp->toHTML($category_name,FALSE,"defs"));
|
||||
define("e_PAGETITLE", $tp->toHTML($category_name,FALSE,"TITLE"));
|
||||
}
|
||||
|
||||
require_once(HEADERF);
|
||||
|
||||
if(!$NEWSLISTSTYLE){
|
||||
if(!$NEWSLISTSTYLE)
|
||||
{
|
||||
$NEWSLISTSTYLE = "
|
||||
<div style='padding:3px;width:100%'>
|
||||
<table style='border-bottom:1px solid black;width:100%' cellpadding='0' cellspacing='0'>
|
||||
@ -136,11 +173,13 @@ if ($action == 'cat' || $action == 'all'){
|
||||
$amount = ($action == "all") ? NEWSALL_LIMIT : NEWSLIST_LIMIT;
|
||||
|
||||
$icon = ($row['category_icon']) ? "<img src='".e_IMAGE."icons/".$row['category_icon']."' alt='' />" : "";
|
||||
$parms = $news_total.",".$amount.",".$newsfrom.",".e_SELF.'?'.$action.".".$sub_action.".[FROM]";
|
||||
$parms = $news_total.",".$amount.",".$newsfrom.",".e_SELF.'?'.$action.".".$category.".[FROM]";
|
||||
$text .= "<div class='nextprev'>".$tp->parseTemplate("{NEXTPREV={$parms}}")."</div>";
|
||||
|
||||
if(!$NEWSLISTTITLE){
|
||||
$NEWSLISTTITLE = LAN_NEWS_82." '".$tp->toHTML($category_name,FALSE,"defs")."'";
|
||||
if(!$NEWSLISTTITLE)
|
||||
{
|
||||
// $NEWSLISTTITLE = LAN_NEWS_82." '".$tp->toHTML($category_name,FALSE,"defs")."'";
|
||||
$NEWSLISTTITLE = LAN_NEWS_82." '".$tp->toHTML($category_name,FALSE,"TITLE")."'";
|
||||
}
|
||||
|
||||
ob_start();
|
||||
@ -151,9 +190,13 @@ if ($action == 'cat' || $action == 'all'){
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action == "extend") {
|
||||
|
||||
// --> Cache
|
||||
|
||||
//------------------------------------------------------
|
||||
// DISPLAY SINGLE ITEM IN EXTENDED FORMAT HERE
|
||||
//------------------------------------------------------
|
||||
if ($action == "extend")
|
||||
{ // --> Cache
|
||||
if($tmp = checkCache($cacheString)){
|
||||
require_once(HEADERF);
|
||||
renderCache($tmp, TRUE);
|
||||
@ -184,97 +227,108 @@ if ($action == "extend") {
|
||||
exit;
|
||||
}
|
||||
|
||||
if (empty($order)){
|
||||
|
||||
//------------------------------------------------------
|
||||
// DISPLAY NEWS IN LIST FORMAT HERE
|
||||
//------------------------------------------------------
|
||||
// Show title, author, first part of news item...
|
||||
if (empty($order))
|
||||
{
|
||||
$order = "news_datestamp";
|
||||
}
|
||||
$order = $tp -> toDB($order, true);
|
||||
|
||||
$interval = $pref['newsposts'];
|
||||
if ($action == "list"){
|
||||
$sub_action = intval($sub_action);
|
||||
$news_total = $sql->db_Count("news", "(*)", "WHERE news_category=$sub_action AND news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().")");
|
||||
$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
|
||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
|
||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()."
|
||||
AND (n.news_end=0 || n.news_end>".time().") AND n.news_category={$sub_action} ORDER BY n.news_sticky DESC,".$order." DESC LIMIT ".intval($newsfrom).",".ITEMVIEW;
|
||||
|
||||
}
|
||||
elseif($action == "item")
|
||||
switch ($action)
|
||||
{
|
||||
case "list" :
|
||||
$sub_action = intval($sub_action);
|
||||
// $news_total = $sql->db_Count("news", "(*)", "WHERE news_category={$sub_action} AND news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().")");
|
||||
$query = "SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
|
||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
|
||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
||||
AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")
|
||||
AND n.news_category={$sub_action}
|
||||
ORDER BY n.news_sticky DESC,".$order." DESC LIMIT ".intval($newsfrom).",".ITEMVIEW;
|
||||
break;
|
||||
|
||||
|
||||
case "item" :
|
||||
$sub_action = intval($sub_action);
|
||||
$news_total = 1;
|
||||
$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
|
||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
|
||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") AND n.news_id={$sub_action}";
|
||||
}
|
||||
elseif(strstr(e_QUERY, "month"))
|
||||
{
|
||||
$tmp = explode(".", e_QUERY);
|
||||
$item = $tp -> toDB($tmp[1]);
|
||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
||||
AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") AND n.news_id={$sub_action}";
|
||||
break;
|
||||
|
||||
case "month" :
|
||||
$item = $tp -> toDB($sub_action).'20000101';
|
||||
$year = substr($item, 0, 4);
|
||||
$month = substr($item, 4);
|
||||
$month = substr($item, 4,2);
|
||||
$startdate = mktime(0, 0, 0, $month, 1, $year);
|
||||
$lastday = date("t", $startdate);
|
||||
$enddate = mktime(23, 59, 59, $month, $lastday, $year);
|
||||
$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
|
||||
$query = "SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
|
||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
|
||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") AND n.news_render_type<2 AND n.news_datestamp > $startdate AND n.news_datestamp < $enddate ORDER BY ".$order." DESC LIMIT ".intval($newsfrom).",".ITEMVIEW;
|
||||
}
|
||||
elseif(strstr(e_QUERY, "day"))
|
||||
{
|
||||
$tmp = explode(".", e_QUERY);
|
||||
$item = $tp -> toDB($tmp[1]);
|
||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
||||
AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")
|
||||
AND n.news_render_type<2 AND n.news_datestamp > {$startdate} AND n.news_datestamp < {$enddate}
|
||||
ORDER BY ".$order." DESC LIMIT ".intval($newsfrom).",".ITEMVIEW;
|
||||
break;
|
||||
|
||||
case "day" :
|
||||
$item = $tp -> toDB($sub_action).'20000101';
|
||||
$year = substr($item, 0, 4);
|
||||
$month = substr($item, 4, 2);
|
||||
$day = substr($item, 6, 2);
|
||||
$startdate = mktime(0, 0, 0, $month, $day, $year);
|
||||
$lastday = date("t", $startdate);
|
||||
$enddate = mktime(23, 59, 59, $month, $day, $year);
|
||||
$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
|
||||
$query = "SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
|
||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
|
||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") AND n.news_render_type<2 AND n.news_datestamp > $startdate AND n.news_datestamp < $enddate ORDER BY ".$order." DESC LIMIT ".intval($newsfrom).",".ITEMVIEW;
|
||||
}
|
||||
else
|
||||
{
|
||||
$news_total = $sql->db_Count("news", "(*)", "WHERE news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().") AND news_render_type<2" );
|
||||
break;
|
||||
|
||||
default :
|
||||
$action = '';
|
||||
// $news_total = $sql->db_Count("news", "(*)", "WHERE news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().") AND news_render_type<2" );
|
||||
|
||||
if(!isset($pref['newsposts_archive']))
|
||||
{
|
||||
$pref['newsposts_archive'] = 0;
|
||||
}
|
||||
$interval = $pref['newsposts']-$pref['newsposts_archive'];
|
||||
$interval = $pref['newsposts']-$pref['newsposts_archive']; // Number of 'full' posts to show
|
||||
|
||||
// Get number of news item to show
|
||||
if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled']) {
|
||||
$query = "SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon, COUNT(*) AS tbcount FROM #news AS n
|
||||
$query = "SELECT SQL_CALC_FOUND_ROWS COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon, COUNT(*) AS tbcount FROM #news AS n
|
||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
|
||||
LEFT JOIN #trackback AS tb ON tb.trackback_pid = n.news_id
|
||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."'
|
||||
AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
||||
AND n.news_start < ".time()."
|
||||
AND (n.news_end=0 || n.news_end>".time().")
|
||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
||||
AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")
|
||||
AND n.news_render_type<2
|
||||
GROUP by n.news_id
|
||||
ORDER BY news_sticky DESC, ".$order." DESC LIMIT ".intval($newsfrom).",".$pref['newsposts'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
|
||||
$query = "SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
|
||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
|
||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."'
|
||||
AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
||||
AND n.news_start < ".time()."
|
||||
AND (n.news_end=0 || n.news_end>".time().")
|
||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
||||
AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")
|
||||
AND n.news_render_type<2
|
||||
ORDER BY n.news_sticky DESC, ".$order." DESC LIMIT ".intval($newsfrom).",".$pref['newsposts'];
|
||||
}
|
||||
// #### END ---------------------------------------------------------------------------------------------------
|
||||
}
|
||||
} // END - switch($action)
|
||||
|
||||
|
||||
if($tmp_cache = checkCache($cacheString)) // normal news front-page - with cache.
|
||||
{
|
||||
@ -300,7 +354,7 @@ if($tmp_cache = checkCache($cacheString)) // normal news front-page - with cache
|
||||
if($newsarchive = checkCache('newsarchive')){
|
||||
$tmp_cache = $tmp_cache.$newsarchive;
|
||||
}else{
|
||||
newsarchive($newsAr);
|
||||
show_newsarchive($newsAr,$interval);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -308,21 +362,30 @@ if($tmp_cache = checkCache($cacheString)) // normal news front-page - with cache
|
||||
}
|
||||
|
||||
|
||||
if (!$sql->db_Select_gen($query)) {
|
||||
if (!($news_total = $sql->db_Select_gen($query)))
|
||||
{ // No news items
|
||||
require_once(HEADERF);
|
||||
echo "<br /><br /><div style='text-align:center'><b>".(strstr(e_QUERY, "month") ? LAN_NEWS_462 : LAN_NEWS_83)."</b></div><br /><br />";
|
||||
require_once(FOOTERF);
|
||||
exit;
|
||||
} else {
|
||||
$newsAr = $sql -> db_getList();
|
||||
}
|
||||
|
||||
$newsAr = $sql -> db_getList();
|
||||
|
||||
$p_title = ($action == "item") ? $newsAr[1]['news_title'] : $tp->toHTML($newsAr[1]['category_name'],FALSE,"defs");
|
||||
// ***** CAUTION ! - DEBUG MUCKS THIS UP! *****
|
||||
$sql -> db_Query("SELECT FOUND_ROWS()");
|
||||
$frows = $sql -> db_Fetch();
|
||||
$news_total = $frows[0];
|
||||
|
||||
//echo "<br />Total ".$news_total." items found, ".count($newsAr)." displayed, Interval = {$interval}<br /><br />";
|
||||
|
||||
//$p_title = ($action == "item") ? $newsAr[1]['news_title'] : $tp->toHTML($newsAr[1]['category_name'],FALSE,"defs");
|
||||
$p_title = ($action == "item") ? $newsAr[1]['news_title'] : $tp->toHTML($newsAr[1]['category_name'],FALSE,"TITLE");
|
||||
|
||||
if($action != "" && !is_numeric($action))
|
||||
{
|
||||
if($action == "item" && $pref['meta_news_summary'] && $newsAr[1]['news_title']){
|
||||
if($action == "item" && $pref['meta_news_summary'] && $newsAr[1]['news_title'])
|
||||
{
|
||||
define("META_DESCRIPTION",SITENAME.": ".$newsAr[1]['news_title']." - ".$newsAr[1]['news_summary']);
|
||||
}
|
||||
define("e_PAGETITLE", $p_title);
|
||||
@ -340,17 +403,13 @@ if(!$action)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
changes by jalist 03/02/2005:
|
||||
news page templating
|
||||
|
||||
*/
|
||||
if(isset($pref['news_unstemplate']) && $pref['news_unstemplate'] && file_exists(THEME."news_template.php")) {
|
||||
if(isset($pref['news_unstemplate']) && $pref['news_unstemplate'] && file_exists(THEME."news_template.php"))
|
||||
{
|
||||
// theme specific template required ...
|
||||
require_once(THEME."news_template.php");
|
||||
|
||||
if($ALTERNATECLASS1){
|
||||
if($ALTERNATECLASS1)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -380,15 +439,16 @@ if(isset($pref['news_unstemplate']) && $pref['news_unstemplate'] && file_exists(
|
||||
$text = preg_replace("/\{(.*?)\}/e", '$\1', $NEWSCLAYOUT);
|
||||
|
||||
require_once(HEADERF);
|
||||
$parms = $news_total.",".ITEMVIEW.",".$newsfrom.",".e_SELF.'?'.($action ? $action : 'default' ).($sub_action ? ".".$sub_action : ".0").".[FROM]";
|
||||
$nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
|
||||
$text .= ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
|
||||
// $text=''.$text.'<center>'.$nextprev.'</center>';
|
||||
|
||||
echo $text;
|
||||
setNewsCache($cacheString, $text);
|
||||
|
||||
} else {
|
||||
/*
|
||||
changes by jalist 22/01/2005:
|
||||
added ability to add a new date header to news posts, turn on and off from news->prefs
|
||||
*/
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ob_start();
|
||||
|
||||
$newpostday = 0;
|
||||
@ -408,19 +468,21 @@ if(isset($pref['news_unstemplate']) && $pref['news_unstemplate'] && file_exists(
|
||||
$news = $newsAr[$i];
|
||||
// render new date header if pref selected ...
|
||||
$thispostday = strftime("%j", $news['news_datestamp']);
|
||||
if ($newpostday != $thispostday && (isset($pref['news_newdateheader']) && $pref['news_newdateheader'])) {
|
||||
if ($newpostday != $thispostday && (isset($pref['news_newdateheader']) && $pref['news_newdateheader']))
|
||||
{
|
||||
echo "<div class='".DATEHEADERCLASS."'>".strftime("%A %d %B %Y", $news['news_datestamp'])."</div>";
|
||||
}
|
||||
$newpostday = $thispostday;
|
||||
$news['category_id'] = $news['news_category'];
|
||||
if ($action == "item") {
|
||||
if ($action == "item")
|
||||
{
|
||||
unset($news['news_render_type']);
|
||||
}
|
||||
|
||||
$ix->render_newsitem($news);
|
||||
$i++;
|
||||
}
|
||||
$parms = $news_total.",".ITEMVIEW.",".$newsfrom.",".e_SELF.'?'."[FROM].".$action.(isset($sub_action) ? ".".$sub_action : "");
|
||||
$parms = $news_total.",".ITEMVIEW.",".$newsfrom.",".e_SELF.'?'.($action ? $action : 'default' ).($sub_action ? ".".$sub_action : ".0").".[FROM]";
|
||||
$nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
|
||||
echo ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
|
||||
|
||||
@ -432,15 +494,17 @@ if(isset($pref['news_unstemplate']) && $pref['news_unstemplate'] && file_exists(
|
||||
|
||||
// ##### --------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function newsarchive($newsAr){
|
||||
global $ns, $gen, $interval, $pref, $tp, $news_archive_shortcodes, $NEWSARCHIVE, $news2;
|
||||
function show_newsarchive($newsAr, $i = 1)
|
||||
{
|
||||
global $ns, $gen, $pref, $tp, $news_archive_shortcodes, $NEWSARCHIVE, $news2;
|
||||
|
||||
// do not show the news archive on the news.php?item.X page (but only on the news mainpage)
|
||||
require_once(e_FILE.'shortcode/batch/news_archives.php');
|
||||
|
||||
$textnewsarchive = '';
|
||||
ob_start();
|
||||
|
||||
$i = $interval + 1;
|
||||
$i++; // First entry to show
|
||||
while(isset($newsAr[$i]))
|
||||
{
|
||||
$news2 = $newsAr[$i];
|
||||
@ -476,8 +540,8 @@ function newsarchive($newsAr){
|
||||
</tr>
|
||||
</table>
|
||||
</div>";
|
||||
|
||||
}
|
||||
|
||||
$textnewsarchive .= $tp->parseTemplate($NEWSARCHIVE, FALSE, $news_archive_shortcodes);
|
||||
$i++;
|
||||
}
|
||||
@ -488,8 +552,9 @@ function newsarchive($newsAr){
|
||||
}
|
||||
|
||||
// #### new: news archive ---------------------------------------------------------------------------------------------
|
||||
if ($action != "item" && $action != 'list' && $pref['newsposts_archive']) {
|
||||
newsarchive($newsAr);
|
||||
if ($action != "item" && $action != 'list' && $pref['newsposts_archive'])
|
||||
{
|
||||
show_newsarchive($newsAr,$interval);
|
||||
}
|
||||
// #### END -----------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user