mirror of
https://github.com/e107inc/e107.git
synced 2025-07-29 19:00:26 +02:00
Bugtracker #4137 - show trackback count on extended news
This commit is contained in:
66
news.php
66
news.php
@@ -11,8 +11,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/news.php,v $
|
| $Source: /cvs_backup/e107_0.8/news.php,v $
|
||||||
| $Revision: 1.7 $
|
| $Revision: 1.8 $
|
||||||
| $Date: 2007-06-07 20:34:02 $
|
| $Date: 2007-10-15 19:16:04 $
|
||||||
| $Author: e107steved $
|
| $Author: e107steved $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
@@ -131,7 +131,6 @@ if ($action == 'cat' || $action == 'all')
|
|||||||
|
|
||||||
if($category_name)
|
if($category_name)
|
||||||
{
|
{
|
||||||
// define("e_PAGETITLE", $tp->toHTML($category_name,FALSE,"defs"));
|
|
||||||
define("e_PAGETITLE", $tp->toHTML($category_name,FALSE,"TITLE"));
|
define("e_PAGETITLE", $tp->toHTML($category_name,FALSE,"TITLE"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,7 +177,6 @@ if ($action == 'cat' || $action == 'all')
|
|||||||
|
|
||||||
if(!$NEWSLISTTITLE)
|
if(!$NEWSLISTTITLE)
|
||||||
{
|
{
|
||||||
// $NEWSLISTTITLE = LAN_NEWS_82." '".$tp->toHTML($category_name,FALSE,"defs")."'";
|
|
||||||
$NEWSLISTTITLE = LAN_NEWS_82." '".$tp->toHTML($category_name,FALSE,"TITLE")."'";
|
$NEWSLISTTITLE = LAN_NEWS_82." '".$tp->toHTML($category_name,FALSE,"TITLE")."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,18 +201,33 @@ if ($action == "extend")
|
|||||||
}
|
}
|
||||||
// <-- Cache
|
// <-- Cache
|
||||||
|
|
||||||
$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
|
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 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_id=".intval($sub_action)." AND 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().") ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$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 #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 #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=".intval($sub_action);
|
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=".intval($sub_action);
|
||||||
|
}
|
||||||
$sql->db_Select_gen($query);
|
$sql->db_Select_gen($query);
|
||||||
$news = $sql->db_Fetch();
|
$news = $sql->db_Fetch();
|
||||||
|
|
||||||
if($news['news_title']){
|
if($news['news_title'])
|
||||||
if($pref['meta_news_summary'] && $news['news_title']){
|
{
|
||||||
define("META_DESCRIPTION",SITENAME.": ".$news['news_title']." - ".$news['news_summary']);
|
if($pref['meta_news_summary'] && $news['news_title'])
|
||||||
}
|
{
|
||||||
define("e_PAGETITLE",$news['news_title']);
|
define("META_DESCRIPTION",SITENAME.": ".$news['news_title']." - ".$news['news_summary']);
|
||||||
|
}
|
||||||
|
define("e_PAGETITLE",$news['news_title']);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once(HEADERF);
|
require_once(HEADERF);
|
||||||
@@ -266,11 +279,21 @@ switch ($action)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "month" :
|
case "month" :
|
||||||
|
case "day" :
|
||||||
$item = $tp -> toDB($sub_action).'20000101';
|
$item = $tp -> toDB($sub_action).'20000101';
|
||||||
$year = substr($item, 0, 4);
|
$year = substr($item, 0, 4);
|
||||||
$month = substr($item, 4,2);
|
$month = substr($item, 4,2);
|
||||||
$startdate = mktime(0, 0, 0, $month, 1, $year);
|
if ($action == 'day')
|
||||||
$lastday = date("t", $startdate);
|
{
|
||||||
|
$day = substr($item, 6, 2);
|
||||||
|
$lastday = $day;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // A month's worth
|
||||||
|
$day = 1;
|
||||||
|
$lastday = date("t", $startdate);
|
||||||
|
}
|
||||||
|
$startdate = mktime(0, 0, 0, $month, $day, $year);
|
||||||
$enddate = mktime(23, 59, 59, $month, $lastday, $year);
|
$enddate = mktime(23, 59, 59, $month, $lastday, $year);
|
||||||
$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
|
$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 #user AS u ON n.news_author = u.user_id
|
||||||
@@ -281,20 +304,6 @@ switch ($action)
|
|||||||
ORDER BY ".$order." DESC LIMIT ".intval($newsfrom).",".ITEMVIEW;
|
ORDER BY ".$order." DESC LIMIT ".intval($newsfrom).",".ITEMVIEW;
|
||||||
break;
|
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 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;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default :
|
default :
|
||||||
$action = '';
|
$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" );
|
// $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" );
|
||||||
@@ -372,14 +381,13 @@ if (!($news_total = $sql->db_Select_gen($query)))
|
|||||||
|
|
||||||
$newsAr = $sql -> db_getList();
|
$newsAr = $sql -> db_getList();
|
||||||
|
|
||||||
// ***** CAUTION ! - DEBUG MUCKS THIS UP! *****
|
// Get number of entries
|
||||||
$sql -> db_Query("SELECT FOUND_ROWS()");
|
$sql -> db_Select_gen("SELECT FOUND_ROWS()");
|
||||||
$frows = $sql -> db_Fetch();
|
$frows = $sql -> db_Fetch();
|
||||||
$news_total = $frows[0];
|
$news_total = $frows[0];
|
||||||
|
|
||||||
//echo "<br />Total ".$news_total." items found, ".count($newsAr)." displayed, Interval = {$interval}<br /><br />";
|
//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");
|
$p_title = ($action == "item") ? $newsAr[1]['news_title'] : $tp->toHTML($newsAr[1]['category_name'],FALSE,"TITLE");
|
||||||
|
|
||||||
if($action != "" && !is_numeric($action))
|
if($action != "" && !is_numeric($action))
|
||||||
|
Reference in New Issue
Block a user