mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
news rewrite related fixes
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id: news_shortcodes.php,v 1.27 2009-09-14 18:22:15 secretr Exp $
|
||||
* $Id: news_shortcodes.php,v 1.28 2009-09-15 15:08:49 secretr Exp $
|
||||
*
|
||||
* News shortcode batch
|
||||
*/
|
||||
@@ -57,10 +57,9 @@ class news_shortcodes
|
||||
function sc_newsbody($parm)
|
||||
{
|
||||
$news_body = $this->e107->tp->toHTML($this->news_item['news_body'], true, 'BODY, fromadmin', $this->news_item['news_author']);
|
||||
if($this->news_item['news_extended'] && (isset($_POST['preview']) || strpos(e_QUERY, 'extend') !== FALSE) && $parm != 'noextend')
|
||||
if($this->news_item['news_extended'] && (isset($_POST['preview']) || $this->param['current_action'] == 'extend') && $parm != 'noextend')
|
||||
{
|
||||
$news_extended = $this->e107->tp->toHTML($this->news_item['news_extended'], true, 'BODY, fromadmin', $this->news_item['news_author']);
|
||||
$news_body .= '<br /><br />'.$news_extended;
|
||||
$news_body .= $this->e107->tp->toHTML($this->news_item['news_extended'], true, 'BODY, fromadmin', $this->news_item['news_author']);
|
||||
}
|
||||
|
||||
return $news_body;
|
||||
@@ -113,7 +112,7 @@ class news_shortcodes
|
||||
return '';
|
||||
}
|
||||
|
||||
if (varsettrue($pref['multilanguage']))
|
||||
if (vartrue($pref['multilanguage']))
|
||||
{ // Can have multilanguage news table, monlingual comment table. If the comment table is multilingual, it'll only count entries in the current language
|
||||
$news_item['news_comment_total'] = $sql->db_Count("comments", "(*)", "WHERE comment_item_id='".$news_item['news_id']."' AND comment_type='0' ");
|
||||
}
|
||||
@@ -238,7 +237,8 @@ class news_shortcodes
|
||||
|
||||
function sc_extended($parm)
|
||||
{
|
||||
if ($this->news_item['news_extended'] && (strpos(e_QUERY, 'extend') === FALSE || $parm == 'force'))
|
||||
|
||||
if ($this->news_item['news_extended'] && ($this->param['current_action'] != 'extend' || $parm == 'force'))
|
||||
{
|
||||
if (defined('PRE_EXTENDEDSTRING'))
|
||||
{
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id: news_categories.sc,v 1.4 2009-06-06 17:03:25 e107steved Exp $
|
||||
* $Id: news_categories.sc,v 1.5 2009-09-15 15:08:50 secretr Exp $
|
||||
*
|
||||
* News Categories shortcode
|
||||
*/
|
||||
@@ -70,7 +70,14 @@ $nbr_cols = (defined("NEWSCAT_COLS")) ? NEWSCAT_COLS : $nbr_cols;
|
||||
$param['caticon'] = NEWSCAT_CATICON;
|
||||
|
||||
$sql2 = new db;
|
||||
$sql2->db_Select("news_category", "*", "category_id!='' ORDER BY category_name ASC");
|
||||
$qry = "SELECT nc.*, ncr.news_rewrite_string AS news_category_rewrite_string, ncr.news_rewrite_id AS news_category_rewrite_id FROM #news_category AS nc
|
||||
LEFT JOIN #news_rewrite AS ncr ON nc.category_id=ncr.news_rewrite_source AND ncr.news_rewrite_type=2
|
||||
ORDER BY nc.category_order
|
||||
";
|
||||
if(!$sql2->db_Select_gen($qry))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
$text3 = "\n\n\n
|
||||
<div style='width:100%;text-align:center;margin-left:auto;margin-right:auto'>
|
||||
@@ -82,24 +89,35 @@ $nbr_cols = (defined("NEWSCAT_COLS")) ? NEWSCAT_COLS : $nbr_cols;
|
||||
extract($row3);
|
||||
|
||||
$search[0] = "/\{NEWSCATICON\}(.*?)/si";
|
||||
$replace[0] = ($category_icon) ? "<a href='".$e107->url->getUrl('core:news', 'main', 'action=cat&value='.$category_id)."'><img src='".e_IMAGE_ABS."icons/".$category_icon."' alt='' style='".$param['caticon']."' /></a>" : "";
|
||||
$replace[0] = ($category_icon) ? "<a href='".$e107->url->getUrl('core:news', 'main', 'action=list&id='.$category_id.'&sef='.$news_category_rewrite_string)."'><img src='".e_IMAGE_ABS."icons/".$category_icon."' alt='' style='".$param['caticon']."' /></a>" : "";
|
||||
|
||||
$search[1] = "/\{NEWSCATEGORY\}(.*?)/si";
|
||||
$replace[1] = ($category_name) ? "<a href='".$e107->url->getUrl('core:news', 'main', 'action=cat&value='.$category_id)."' style='".$param['catlink']."' >".$tp->toHTML($category_name,TRUE,"defs")."</a>" : "";
|
||||
$replace[1] = ($category_name) ? "<a href='".$e107->url->getUrl('core:news', 'main', 'action=list&id='.$category_id.'&sef='.$news_category_rewrite_string)."' style='".$param['catlink']."' >".$tp->toHTML($category_name,TRUE,"defs")."</a>" : "";
|
||||
|
||||
$text3 .= ($t % $nbr_cols == 0) ? "<tr>" : "";
|
||||
$text3 .= "\n<td style='".NEWSCAT_CELL."; width:$wid%;'>\n";
|
||||
|
||||
// Grab each news item.--------------
|
||||
$cqry = "SELECT n.*, nr.* FROM #news AS n
|
||||
LEFT JOIN #news_rewrite AS nr ON n.news_id=nr.news_rewrite_source AND nr.news_rewrite_type=1
|
||||
WHERE news_category='".intval($category_id)."'
|
||||
AND news_class IN (".USERCLASS_LIST.")
|
||||
AND (news_start=0 || news_start < ".time().")
|
||||
AND (news_end=0 || news_end>".time().")
|
||||
ORDER BY news_datestamp DESC LIMIT 0,".NEWSCAT_AMOUNT;
|
||||
|
||||
$count = $sql->db_Select("news", "*", "news_category='".intval($category_id)."' AND news_class IN (".USERCLASS_LIST.") AND (news_start=0 || news_start < ".time().") AND (news_end=0 || news_end>".time().") ORDER BY news_datestamp DESC LIMIT 0,".NEWSCAT_AMOUNT);
|
||||
while ($row = $sql->db_Fetch()) {
|
||||
|
||||
$row['category_name'] = $category_name;
|
||||
$row['category_icon'] = $category_icon;
|
||||
|
||||
$textbody .= $ix -> render_newsitem($row, 'return', '', $NEWSCAT_ITEM, $param);
|
||||
|
||||
$count = $sql->db_Select_gen($cqry);
|
||||
//$count = $sql->db_Select("news", "*", "news_category='".intval($category_id)."' AND news_class IN (".USERCLASS_LIST.") AND (news_start=0 || news_start < ".time().") AND (news_end=0 || news_end>".time().") ORDER BY news_datestamp DESC LIMIT 0,".NEWSCAT_AMOUNT);
|
||||
if($count)
|
||||
{
|
||||
while ($row = $sql->db_Fetch()) {
|
||||
|
||||
//$row['category_name'] = $category_name;
|
||||
//$row['category_icon'] = $category_icon;
|
||||
$row = array_merge($row, $row3);
|
||||
$textbody .= $ix -> render_newsitem($row, 'return', '', $NEWSCAT_ITEM, $param);
|
||||
|
||||
}
|
||||
}
|
||||
// ----------------------------------
|
||||
|
||||
|
Reference in New Issue
Block a user