mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 20:57:26 +02:00
News front-end done - SEO, real SEF URLs (category list, item view), default item view changed to 'extend', default category list changed to 'list', comments are rendered now by news code, new and improved news shortcodes
This commit is contained in:
@@ -9,8 +9,8 @@
|
|||||||
* General purpose file
|
* General purpose file
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/class2.php,v $
|
* $Source: /cvs_backup/e107_0.8/class2.php,v $
|
||||||
* $Revision: 1.142 $
|
* $Revision: 1.143 $
|
||||||
* $Date: 2009-09-13 10:29:56 $
|
* $Date: 2009-09-14 18:22:15 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -84,7 +84,7 @@ if($register_globals == true)
|
|||||||
}
|
}
|
||||||
|
|
||||||
define('e_AJAX_REQUEST', isset($_REQUEST['ajax_used']));
|
define('e_AJAX_REQUEST', isset($_REQUEST['ajax_used']));
|
||||||
$_REQUEST['ajax_used'] = ''; unset($_REQUEST['ajax_used']);
|
unset($_REQUEST['ajax_used']);
|
||||||
|
|
||||||
if(isset($_E107['minimal']) || e_AJAX_REQUEST)
|
if(isset($_E107['minimal']) || e_AJAX_REQUEST)
|
||||||
{
|
{
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
Options +FollowSymLinks
|
Options +FollowSymLinks
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
|
|
||||||
### Set this to your e107 site root
|
### Set this to your e107 site root, path relative to web root
|
||||||
RewriteBase /
|
RewriteBase /
|
||||||
|
|
||||||
### send 404 on missing files in these folders
|
### send 404 on missing files in these folders
|
||||||
@@ -15,15 +15,18 @@
|
|||||||
RewriteCond %{REQUEST_FILENAME} !-l
|
RewriteCond %{REQUEST_FILENAME} !-l
|
||||||
|
|
||||||
### NEWS SEF URLs - set 'news' to the 'URL identifier' value (news Administration area) ###
|
### NEWS SEF URLs - set 'news' to the 'URL identifier' value (news Administration area) ###
|
||||||
|
RewriteRule ^news/?$ news.php [L]
|
||||||
RewriteRule ^news/(.*)$ news.php?rewrite=$1 [L]
|
RewriteRule ^news/(.*)$ news.php?rewrite=$1 [L]
|
||||||
|
|
||||||
### REMOVE ###
|
## Use this on your own risk.
|
||||||
RewriteRule ^news/?$ news.php
|
## Quick & dirty solution for news rewrite without (empty) 'URL identifier',
|
||||||
#item, default, cat actions
|
## extremely useful for blog site owners
|
||||||
#RewriteRule ^news/([a-z]+)-([0-9]+)-([0-9]+)(\.html)?$ news.php?$1.$2.$3 [L]
|
## Keep in mind it should be your last RewriteRule!
|
||||||
#extend, cat, list actions
|
## You also might want to change your Front page (administration) to your site root, e.g. '/'
|
||||||
#RewriteRule ^news/([a-z]+)-([0-9]+)(\.html)?$ news.php?$1.$2 [L]
|
#DirectoryIndex news.php index.php index.html
|
||||||
### REMOVE END ###
|
#RewriteRule ^(.*)$ news.php?rewrite=$1 [L]
|
||||||
|
|
||||||
|
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
|
||||||
#ErrorDocument 400 /error.php?400
|
#ErrorDocument 400 /error.php?400
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
* News Administration
|
* News Administration
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $
|
||||||
* $Revision: 1.52 $
|
* $Revision: 1.53 $
|
||||||
* $Date: 2009-09-13 16:37:17 $
|
* $Date: 2009-09-14 18:22:15 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
require_once("../class2.php");
|
require_once("../class2.php");
|
||||||
@@ -1133,7 +1133,7 @@ class admin_newspost
|
|||||||
$row = e107::getDb()->db_Fetch();
|
$row = e107::getDb()->db_Fetch();
|
||||||
|
|
||||||
$_POST['news_title'] = $row['news_title'];
|
$_POST['news_title'] = $row['news_title'];
|
||||||
$_POST['data'] = $row['news_body'];
|
$_POST['news_body'] = $row['news_body'];
|
||||||
$_POST['news_author'] = $row['news_author'];
|
$_POST['news_author'] = $row['news_author'];
|
||||||
$_POST['news_extended'] = $row['news_extended'];
|
$_POST['news_extended'] = $row['news_extended'];
|
||||||
$_POST['news_allow_comments'] = $row['news_allow_comments'];
|
$_POST['news_allow_comments'] = $row['news_allow_comments'];
|
||||||
@@ -1194,23 +1194,23 @@ class admin_newspost
|
|||||||
{
|
{
|
||||||
if ($sql->db_Select("submitnews", "*", "submitnews_id=".$this->getId(), TRUE))
|
if ($sql->db_Select("submitnews", "*", "submitnews_id=".$this->getId(), TRUE))
|
||||||
{
|
{
|
||||||
//list($id, $submitnews_name, $submitnews_email, $_POST['news_title'], $submitnews_category, $_POST['data'], $submitnews_datestamp, $submitnews_ip, $submitnews_auth, $submitnews_file) = $sql->db_Fetch();
|
//list($id, $submitnews_name, $submitnews_email, $_POST['news_title'], $submitnews_category, $_POST['news_body'], $submitnews_datestamp, $submitnews_ip, $submitnews_auth, $submitnews_file) = $sql->db_Fetch();
|
||||||
$row = $sql->db_Fetch();
|
$row = $sql->db_Fetch();
|
||||||
$_POST['news_title'] = $row['submitnews_title'];
|
$_POST['news_title'] = $row['submitnews_title'];
|
||||||
$_POST['data'] = $row['submitnews_item'];
|
$_POST['news_body'] = $row['submitnews_item'];
|
||||||
$_POST['cat_id'] = $row['submitnews_category'];
|
$_POST['cat_id'] = $row['submitnews_category'];
|
||||||
|
|
||||||
if (defsettrue('e_WYSIWYG'))
|
if (defsettrue('e_WYSIWYG'))
|
||||||
{
|
{
|
||||||
if (substr($_POST['data'],-7,7) == '[/html]') $_POST['data'] = substr($_POST['data'],0,-7);
|
if (substr($_POST['news_body'],-7,7) == '[/html]') $_POST['news_body'] = substr($_POST['news_body'],0,-7);
|
||||||
if (substr($_POST['data'],0,6) == '[html]') $_POST['data'] = substr($_POST['data'],6);
|
if (substr($_POST['news_body'],0,6) == '[html]') $_POST['news_body'] = substr($_POST['news_body'],6);
|
||||||
$_POST['data'] .= "<br /><b>".NWSLAN_49." {$row['submitnews_name']}</b>";
|
$_POST['news_body'] .= "<br /><b>".NWSLAN_49." {$row['submitnews_name']}</b>";
|
||||||
$_POST['data'] .= ($row['submitnews_file'])? "<br /><br /><img src='{e_NEWSIMAGE}{$row['submitnews_file']}' class='f-right' />": '';
|
$_POST['news_body'] .= ($row['submitnews_file'])? "<br /><br /><img src='{e_NEWSIMAGE}{$row['submitnews_file']}' class='f-right' />": '';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$_POST['data'] .= "\n[[b]".NWSLAN_49." {$row['submitnews_name']}[/b]]";
|
$_POST['news_body'] .= "\n[[b]".NWSLAN_49." {$row['submitnews_name']}[/b]]";
|
||||||
$_POST['data'] .= ($row['submitnews_file'])?"\n\n[img]{e_NEWSIMAGE}{$row['submitnews_file']}[/img]": "";
|
$_POST['news_body'] .= ($row['submitnews_file'])?"\n\n[img]{e_NEWSIMAGE}{$row['submitnews_file']}[/img]": "";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1226,7 +1226,7 @@ class admin_newspost
|
|||||||
//XXX DB UPLOADS STILL SUPPORTED?
|
//XXX DB UPLOADS STILL SUPPORTED?
|
||||||
$upload_file = "pub_" . (preg_match('#Binary\s(.*?)\/#', $row['upload_file'], $match) ? $match[1] : $row['upload_file']);
|
$upload_file = "pub_" . (preg_match('#Binary\s(.*?)\/#', $row['upload_file'], $match) ? $match[1] : $row['upload_file']);
|
||||||
$_POST['news_title'] = LAN_UPLOAD.": ".$row['upload_name'];
|
$_POST['news_title'] = LAN_UPLOAD.": ".$row['upload_name'];
|
||||||
$_POST['data'] = $row['upload_description']."\n[b]".NWSLAN_49." [link=".$e107->url->getUrl('core:user', 'main', 'id='.$post_author_id)."]".$post_author_name."[/link][/b]\n\n[file=request.php?".$upload_file."]{$row['upload_name']}[/file]\n";
|
$_POST['news_body'] = $row['upload_description']."\n[b]".NWSLAN_49." [link=".$e107->url->getUrl('core:user', 'main', 'id='.$post_author_id)."]".$post_author_name."[/link][/b]\n\n[file=request.php?".$upload_file."]{$row['upload_name']}[/file]\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1353,8 +1353,8 @@ class admin_newspost
|
|||||||
<td class='label'>".NWSLAN_13.":<br /></td>
|
<td class='label'>".NWSLAN_13.":<br /></td>
|
||||||
<td class='control'>";
|
<td class='control'>";
|
||||||
|
|
||||||
$val = (strstr($tp->post_toForm($_POST['data']), "[img]http") ? $tp->post_toForm($_POST['data']) : str_replace("[img]../", "[img]", $tp->post_toForm($_POST['data'])));
|
$val = (strstr($tp->post_toForm($_POST['news_body']), "[img]http") ? $tp->post_toForm($_POST['news_body']) : str_replace("[img]../", "[img]", $tp->post_toForm($_POST['news_body'])));
|
||||||
$text .= $frm->bbarea('data', $val, 'news', 'helpb');
|
$text .= $frm->bbarea('news_body', $val, 'news', 'helpb');
|
||||||
|
|
||||||
// Extended news form textarea
|
// Extended news form textarea
|
||||||
// Fixes Firefox issue with hidden wysiwyg textarea.
|
// Fixes Firefox issue with hidden wysiwyg textarea.
|
||||||
@@ -1751,7 +1751,7 @@ class admin_newspost
|
|||||||
$_POST['comment_total'] = $id ? $e107->sql->db_Count("comments", "(*)", " WHERE comment_item_id={$id} AND comment_type='0'") : 0;
|
$_POST['comment_total'] = $id ? $e107->sql->db_Count("comments", "(*)", " WHERE comment_item_id={$id} AND comment_type='0'") : 0;
|
||||||
$_PR = $_POST;
|
$_PR = $_POST;
|
||||||
|
|
||||||
$_PR['news_body'] = $e107->tp->post_toHTML($_PR['data'],FALSE);
|
$_PR['news_body'] = $e107->tp->post_toHTML($_PR['news_body'],FALSE);
|
||||||
$_PR['news_title'] = $e107->tp->post_toHTML($_PR['news_title'],FALSE,"emotes_off, no_make_clickable");
|
$_PR['news_title'] = $e107->tp->post_toHTML($_PR['news_title'],FALSE,"emotes_off, no_make_clickable");
|
||||||
$_PR['news_summary'] = $e107->tp->post_toHTML($_PR['news_summary']);
|
$_PR['news_summary'] = $e107->tp->post_toHTML($_PR['news_summary']);
|
||||||
$_PR['news_extended'] = $e107->tp->post_toHTML($_PR['news_extended']);
|
$_PR['news_extended'] = $e107->tp->post_toHTML($_PR['news_extended']);
|
||||||
|
@@ -1,14 +1,30 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||||
* $Id: main.php,v 1.3 2009-09-13 16:37:18 secretr Exp $
|
* $Id: main.php,v 1.4 2009-09-14 18:22:16 secretr Exp $
|
||||||
*
|
*
|
||||||
* eURL configuration script
|
* eURL configuration script
|
||||||
*/
|
*/
|
||||||
function url_news_main($parms)
|
|
||||||
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
|
require_once(e_HANDLER.'news_class.php');
|
||||||
|
define('NEWS_REWRITE', true);
|
||||||
|
|
||||||
|
function url_news_main($parms = array())
|
||||||
{
|
{
|
||||||
//$base = e_HTTP.$sefbase.$parms['action'];
|
//$base = e_HTTP.$sefbase.$parms['action'];
|
||||||
$base = e_HTTP.(e107::getPref('news_sefbase') ? e107::getPref('news_sefbase').'/' : '');
|
$base = e_HTTP.(e107::getPref('news_sefbase') ? e107::getPref('news_sefbase').'/' : '');
|
||||||
|
|
||||||
|
if(isset($parms['sef']))
|
||||||
|
{
|
||||||
|
$parms['sef'] = urlencode($parms['sef']);
|
||||||
|
}
|
||||||
|
elseif(vartrue($parms['id']))
|
||||||
|
{
|
||||||
|
//'sef' is not set, which means we don't know it!
|
||||||
|
$parms['sef'] = urlencode(news::retrieveRewriteString($parms['id'], $parms['action']));
|
||||||
|
}
|
||||||
switch ($parms['action'])
|
switch ($parms['action'])
|
||||||
{
|
{
|
||||||
//Main news page
|
//Main news page
|
||||||
@@ -48,3 +64,72 @@ function url_news_main($parms)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parse_url_news_main($request)
|
||||||
|
{
|
||||||
|
static $_parsed_request = array();
|
||||||
|
$known_actions = array('cat', 'list', 'item', 'extend', 'default', 'month', 'day');
|
||||||
|
|
||||||
|
//runtime cache
|
||||||
|
if(isset($_parsed_request[$request]))
|
||||||
|
{
|
||||||
|
return $_parsed_request[$request];
|
||||||
|
}
|
||||||
|
|
||||||
|
$request_str = $request;
|
||||||
|
parse_str($request, $request);
|
||||||
|
if(!isset($request['rewrite']))
|
||||||
|
{
|
||||||
|
$_parsed_request[''] = array();
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$chunks = explode('/', $request['rewrite']);
|
||||||
|
|
||||||
|
//action found in the request
|
||||||
|
if(in_array($chunks[0], $known_actions))
|
||||||
|
{
|
||||||
|
$_parsed_request[$request_str] = $chunks;
|
||||||
|
return $_parsed_request[$request_str];
|
||||||
|
}
|
||||||
|
|
||||||
|
//sef string
|
||||||
|
if(!($sefdata = news::getRewriteCache($chunks[0])))
|
||||||
|
{
|
||||||
|
$sefdata = news::retrieveRewriteData($chunks[0], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//not found - redirect
|
||||||
|
if(empty($sefdata))
|
||||||
|
{
|
||||||
|
if(!session_id()) session_start();
|
||||||
|
$_SESSION['e107_http_referer'] = ltrim(SITEURL, '/').url_news_main().$request['rewrite'];
|
||||||
|
$_SESSION['e107_error_return'] = array(url_news_main() => 'Go to News front page'); //TODO - LANs
|
||||||
|
session_write_close();
|
||||||
|
header('HTTP/1.1 404 Not Found', true);
|
||||||
|
header('Location: '.SITEURL.'error.php?404');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$parsed = array();
|
||||||
|
switch($sefdata['news_rewrite_type'])
|
||||||
|
{
|
||||||
|
case '2': //Category list
|
||||||
|
$parsed = array('list', $sefdata['news_rewrite_source']);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '1': //Item view
|
||||||
|
$parsed = array('extend', $sefdata['news_rewrite_source']);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($chinks) > 1)
|
||||||
|
{
|
||||||
|
|
||||||
|
$parsed = array_merge($parsed, array_slice($chunks, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
$_parsed_request[$request_str] = $parsed;
|
||||||
|
return $_parsed_request[$request_str];
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1,10 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||||
* $Id: main.php,v 1.4 2009-09-13 16:37:17 secretr Exp $
|
* $Id: main.php,v 1.5 2009-09-14 18:22:15 secretr Exp $
|
||||||
*
|
*
|
||||||
* eURL configuration script
|
* eURL configuration script
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
|
define('NEWS_REWRITE', false);
|
||||||
|
|
||||||
function url_news_main($parms)
|
function url_news_main($parms)
|
||||||
{
|
{
|
||||||
$base = e_HTTP.'news.php?'.$parms['action'];
|
$base = e_HTTP.'news.php?'.$parms['action'];
|
||||||
@@ -47,3 +52,8 @@ function url_news_main($parms)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parse_url_news_main($request)
|
||||||
|
{
|
||||||
|
return explode('.', $request);
|
||||||
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||||
* $Id: news_shortcodes.php,v 1.26 2009-09-13 16:37:17 secretr Exp $
|
* $Id: news_shortcodes.php,v 1.27 2009-09-14 18:22:15 secretr Exp $
|
||||||
*
|
*
|
||||||
* News shortcode batch
|
* News shortcode batch
|
||||||
*/
|
*/
|
||||||
@@ -62,6 +62,7 @@ class news_shortcodes
|
|||||||
$news_extended = $this->e107->tp->toHTML($this->news_item['news_extended'], true, 'BODY, fromadmin', $this->news_item['news_author']);
|
$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 .= '<br /><br />'.$news_extended;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $news_body;
|
return $news_body;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,11 +108,17 @@ class news_shortcodes
|
|||||||
$news_item = $this->news_item;
|
$news_item = $this->news_item;
|
||||||
$param = $this->param;
|
$param = $this->param;
|
||||||
|
|
||||||
if (varsettrue($pref['multilanguage']))
|
if($param['current_action'] == 'extend')
|
||||||
{ // 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_Select("comments", "*", "comment_item_id='".$news_item['news_id']."' AND comment_type='0' ");
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (varsettrue($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' ");
|
||||||
|
}
|
||||||
|
|
||||||
|
//XXX - ??? - another query? We should cache it in news table.
|
||||||
if ($pref['comments_icon'] && $news_item['news_comment_total'])
|
if ($pref['comments_icon'] && $news_item['news_comment_total'])
|
||||||
{
|
{
|
||||||
$sql->db_Select('comments', 'comment_datestamp', "comment_item_id='".intval($news_item['news_id'])."' AND comment_type='0' ORDER BY comment_datestamp DESC LIMIT 0,1");
|
$sql->db_Select('comments', 'comment_datestamp', "comment_item_id='".intval($news_item['news_id'])."' AND comment_type='0' ORDER BY comment_datestamp DESC LIMIT 0,1");
|
||||||
@@ -130,7 +137,7 @@ class news_shortcodes
|
|||||||
{
|
{
|
||||||
$NEWIMAGE = $param['image_nonew_small'];
|
$NEWIMAGE = $param['image_nonew_small'];
|
||||||
}
|
}
|
||||||
return (!$news_item['news_allow_comments'] ? ''.($pref['comments_icon'] ? $NEWIMAGE : '')." <a href='".e_HTTP."comment.php?comment.news.".$news_item['news_id']."'>".$param['commentlink'].$news_item['news_comment_total'].'</a>' : $param['commentoffstring']);
|
return (!$news_item['news_allow_comments'] ? ''.($pref['comments_icon'] ? $NEWIMAGE : '')." <a href='".e107::getUrl()->create('core:news', 'main', 'action=extend&id='.$news_item['news_id'].'&sef='.$news_item['news_rewrite_string'])."'>".$param['commentlink'].$news_item['news_comment_total'].'</a>' : $param['commentoffstring']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_trackback($parm)
|
function sc_trackback($parm)
|
||||||
@@ -184,7 +191,7 @@ class news_shortcodes
|
|||||||
|
|
||||||
function sc_newscommentlink($parm)
|
function sc_newscommentlink($parm)
|
||||||
{
|
{
|
||||||
return ($this->news_item['news_allow_comments'] ? $this->param['commentoffstring'] : " <a href='".e_HTTP."comment.php?comment.news.".$this->news_item['news_id']."'>".$this->param['commentlink'].'</a>');
|
return ($this->news_item['news_allow_comments'] ? $this->param['commentoffstring'] : " <a href='".e107::getUrl()->create('core:news', 'main', 'action=extend&id='.$this->news_item['news_id'].'&sef='.$this->news_item['news_rewrite_string'])."'>".$this->param['commentlink'].'</a>');
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_newscommentcount($parm)
|
function sc_newscommentcount($parm)
|
||||||
@@ -220,8 +227,8 @@ class news_shortcodes
|
|||||||
{
|
{
|
||||||
if (ADMIN && getperms('H'))
|
if (ADMIN && getperms('H'))
|
||||||
{
|
{
|
||||||
$adop_icon = (file_exists(THEME."images/newsedit.png") ? THEME_ABS."images/newsedit.png" : e_IMAGE_ABS."generic/newsedit.png");
|
$adop_icon = (file_exists(THEME."images/newsedit.png") ? THEME_ABS."images/newsedit.png" : e_IMAGE_ABS."admin_images/edit_16.png");
|
||||||
return " <a href='".e_ADMIN_ABS."newspost.php?create.edit.".$this->news_item['news_id']."'><img src='".$adop_icon."' alt='' class='icon' /></a>\n";
|
return " <a href='".e_ADMIN_ABS."newspost.php?create.edit.".$this->news_item['news_id']."'><img src='".$adop_icon."' alt='".LAN_NEWS_25."' class='icon' /></a>\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -256,19 +263,19 @@ class news_shortcodes
|
|||||||
function sc_captionclass()
|
function sc_captionclass()
|
||||||
{
|
{
|
||||||
$news_title = $this->e107->tp->toHTML($this->news_item['news_title'], TRUE,'no_hook,emotes_off, no_make_clickable');
|
$news_title = $this->e107->tp->toHTML($this->news_item['news_title'], TRUE,'no_hook,emotes_off, no_make_clickable');
|
||||||
return "<div class='category".$this->news_item['news_category']."'>".($this->news_item['news_render_type'] == 1 ? "<a href='".e_HTTP."comment.php?comment.news.".$this->news_item['news_id']."'>".$news_title."</a>" : $news_title)."</div>";
|
return "<div class='category".$this->news_item['news_category']."'>".($this->news_item['news_render_type'] == 1 ? "<a href='".e107::getUrl()->create('core:news', 'main', 'action=extend&id='.$this->news_item['news_id'].'&sef='.$this->news_item['news_rewrite_string'])."'>".$news_title."</a>" : $news_title)."</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_admincaption()
|
function sc_admincaption()
|
||||||
{
|
{
|
||||||
$news_title = $this->e107->tp->toHTML($this->news_item['news_title'], TRUE,'no_hook,emotes_off, no_make_clickable');
|
$news_title = $this->e107->tp->toHTML($this->news_item['news_title'], TRUE,'no_hook,emotes_off, no_make_clickable');
|
||||||
return "<div class='".(defined(ADMINNAME) ? ADMINNAME : "null")."'>".($this->news_item['news_render_type'] == 1 ? "<a href='".e_HTTP."comment.php?comment.news.".$this->news_item['news_id']."'>".$news_title."</a>" : $news_title)."</div>";
|
return "<div class='".(defined('ADMINNAME') ? ADMINNAME : "null")."'>".($this->news_item['news_render_type'] == 1 ? "<a href='".e107::getUrl()->create('core:news', 'main', 'action=extend&id='.$this->news_item['news_id'].'&sef='.$this->news_item['news_rewrite_string'])."'>".$news_title."</a>" : $news_title)."</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_adminbody($parm)
|
function sc_adminbody($parm)
|
||||||
{
|
{
|
||||||
$news_body = $this->sc_newsbody($parm);
|
$news_body = $this->sc_newsbody($parm);
|
||||||
return "<div class='".(defined(ADMINNAME) ? ADMINNAME : 'null')."'>".$news_body.'</div>';
|
return "<div class='".(defined('ADMINNAME') ? ADMINNAME : 'null')."'>".$news_body.'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_newssummary()
|
function sc_newssummary()
|
||||||
@@ -360,6 +367,26 @@ class news_shortcodes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example usage: {NEWSITEM_SCHOOK=mysc_name|my_var1=val1&myvar2=myval2}
|
||||||
|
* will fire {MYSC_NAME=news_id=1&my_var1=val1&myvar2=myval2}
|
||||||
|
* Inside your 'MYSC_NAME' shortcode you are also able to access current item data this way
|
||||||
|
* <code>
|
||||||
|
* $newsdata = e107::getRegistry('core/news/schook_data');
|
||||||
|
* //returns array('data' => (array) $current_news_data, 'params' => array() $current_params)
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param string $parm
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function sc_newsitem_schook($parm)
|
||||||
|
{
|
||||||
|
$parm = explode('|', $parm, 2);
|
||||||
|
$parm[1] = 'news_id='.$this->news_item['news_id'].(varset($parm[1]) ? '&'.$parm[1] : '');
|
||||||
|
e107::setRegistry('core/news/schook_data', array('data' => $this->news_item, 'params' => $this->param));
|
||||||
|
return $this->e107->tp->parseTemplate('{'.strtoupper($parm[0]).'='.$parm[1].'}');
|
||||||
|
}
|
||||||
|
|
||||||
function sc_newsinfo()
|
function sc_newsinfo()
|
||||||
{
|
{
|
||||||
$news_item = $this->news_item;
|
$news_item = $this->news_item;
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
* e107 Main
|
* e107 Main
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/e107_class.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/e107_class.php,v $
|
||||||
* $Revision: 1.49 $
|
* $Revision: 1.50 $
|
||||||
* $Date: 2009-09-13 16:37:18 $
|
* $Date: 2009-09-14 18:22:15 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -119,7 +119,8 @@ class e107
|
|||||||
'e_menu' => '{e_HANDLER}menu_class.php',
|
'e_menu' => '{e_HANDLER}menu_class.php',
|
||||||
'e107plugin' => '{e_HANDLER}plugin_class.php',
|
'e107plugin' => '{e_HANDLER}plugin_class.php',
|
||||||
'xmlClass' => '{e_HANDLER}xml_class.php',
|
'xmlClass' => '{e_HANDLER}xml_class.php',
|
||||||
'e107_traffic' => '{e_HANDLER}traffic_class.php'
|
'e107_traffic' => '{e_HANDLER}traffic_class.php',
|
||||||
|
'comment' => '{e_HANDLER}comment_class.php'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
* News handler
|
* News handler
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/news_class.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/news_class.php,v $
|
||||||
* $Revision: 1.22 $
|
* $Revision: 1.23 $
|
||||||
* $Date: 2009-09-13 16:37:18 $
|
* $Date: 2009-09-14 18:22:15 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -341,6 +341,9 @@ class e_news_tree extends e_model
|
|||||||
|
|
||||||
class news {
|
class news {
|
||||||
|
|
||||||
|
protected static $_rewrite_data = array();
|
||||||
|
protected static $_rewrite_map = null;
|
||||||
|
|
||||||
//FIXME - LANs
|
//FIXME - LANs
|
||||||
//TODO - synch WIKI docs, add rewrite data to the event data
|
//TODO - synch WIKI docs, add rewrite data to the event data
|
||||||
function submit_item($news, $smessages = false)
|
function submit_item($news, $smessages = false)
|
||||||
@@ -718,6 +721,97 @@ class news {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function retrieveRewriteString($news_id, $type = 1)
|
||||||
|
{
|
||||||
|
//XXX - Best way we have now, discuss
|
||||||
|
if(null === self::$_rewrite_map)
|
||||||
|
{
|
||||||
|
$tmp = e107::getCache()->retrieve_sys('nomd5_news_rewrite_map');
|
||||||
|
if(false !== $tmp && ($tmp = e107::getArrayStorage()->ReadArray($tmp)))
|
||||||
|
{
|
||||||
|
self::$_rewrite_map = $tmp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
self::$_rewrite_map = array();
|
||||||
|
if(e107::getDb()->db_Select('news_rewrite'))
|
||||||
|
{
|
||||||
|
while ($tmp = e107::getDb()->db_Fetch())
|
||||||
|
{
|
||||||
|
self::$_rewrite_map[$tmp['news_rewrite_type']][$tmp['news_rewrite_source']] = $tmp['news_rewrite_string'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
e107::getCache()->set_sys('nomd5_news_rewrite_map', e107::getArrayStorage()->WriteArray(self::$_rewrite_map, false));
|
||||||
|
}
|
||||||
|
unset($tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
//convert type if needed
|
||||||
|
if(is_string($type))
|
||||||
|
{
|
||||||
|
switch($type)
|
||||||
|
{
|
||||||
|
case 'item':
|
||||||
|
case 'extend':
|
||||||
|
$type = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$type = 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (isset(self::$_rewrite_map[$type][$news_id]) ? self::$_rewrite_map[$type][$news_id] : '');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function retrieveRewriteData($sefstr, $force = true)
|
||||||
|
{
|
||||||
|
//check runtime cache
|
||||||
|
if(isset(self::$_rewrite_data[$sefstr]))
|
||||||
|
{
|
||||||
|
return self::$_rewrite_data[$sefstr];
|
||||||
|
}
|
||||||
|
|
||||||
|
//check server cache if allowed
|
||||||
|
if(!$force && ($ret = self::getRewriteCache($sefstr, true)))
|
||||||
|
{
|
||||||
|
self::$_rewrite_data[$sefstr] = $ret;
|
||||||
|
return self::$_rewrite_data[$sefstr];
|
||||||
|
}
|
||||||
|
|
||||||
|
//search DB
|
||||||
|
$ret = array();
|
||||||
|
if(e107::getDb()->db_Select('news_rewrite', '*', "news_rewrite_string='".e107::getParser()->toDB($sefstr)."'"))
|
||||||
|
{
|
||||||
|
$ret = e107::getDb()->db_Fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
//set runtime cache
|
||||||
|
self::$_rewrite_data[$sefstr] = $ret;
|
||||||
|
|
||||||
|
//set server cache
|
||||||
|
if($ret)
|
||||||
|
{
|
||||||
|
self::setRewriteCache($sefstr, $ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$_rewrite_data[$sefstr];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getRewriteCache($sefstr, $toArray = true)
|
||||||
|
{
|
||||||
|
$sefstr = md5($sefstr);
|
||||||
|
|
||||||
|
$ret = ecache::retrieve_sys('news_sefurl'.$sefstr, false, true);
|
||||||
|
|
||||||
|
if($ret && $toArray)
|
||||||
|
{
|
||||||
|
return e107::getArrayStorage()->ReadArray($ret);
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
public static function clearRewriteCache($sefstr = '')
|
public static function clearRewriteCache($sefstr = '')
|
||||||
{
|
{
|
||||||
if($sefstr) $sefstr = md5($sefstr);
|
if($sefstr) $sefstr = md5($sefstr);
|
||||||
@@ -731,7 +825,7 @@ class news {
|
|||||||
ecache::set_sys("news_sefurl".$sefstr, $data, true);
|
ecache::set_sys("news_sefurl".$sefstr, $data, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function render_newsitem($news, $mode = 'default', $n_restrict = '', $NEWS_TEMPLATE = '', $param='')
|
function render_newsitem($news, $mode = 'default', $n_restrict = '', $NEWS_TEMPLATE = '', $param = array())
|
||||||
{
|
{
|
||||||
global $e107, $tp, $sql, $override, $pref, $ns, $NEWSSTYLE, $NEWSLISTSTYLE, $news_shortcodes, $loop_uid;
|
global $e107, $tp, $sql, $override, $pref, $ns, $NEWSSTYLE, $NEWSLISTSTYLE, $news_shortcodes, $loop_uid;
|
||||||
if ($override_newsitem = $override -> override_check('render_newsitem')) {
|
if ($override_newsitem = $override -> override_check('render_newsitem')) {
|
||||||
@@ -756,19 +850,21 @@ class news {
|
|||||||
$news['comment_total'] = 0;
|
$news['comment_total'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$param)
|
$tmp = array();
|
||||||
{
|
$tmp['caticon'] = ICONSTYLE;
|
||||||
$param['caticon'] = ICONSTYLE;
|
$tmp['commentoffstring'] = COMMENTOFFSTRING;
|
||||||
$param['commentoffstring'] = COMMENTOFFSTRING;
|
$tmp['commentlink'] = COMMENTLINK;
|
||||||
$param['commentlink'] = COMMENTLINK;
|
$tmp['trackbackstring'] = (defined("TRACKBACKSTRING") ? TRACKBACKSTRING : "");
|
||||||
$param['trackbackstring'] = (defined("TRACKBACKSTRING") ? TRACKBACKSTRING : "");
|
$tmp['trackbackbeforestring'] = (defined("TRACKBACKBEFORESTRING") ? TRACKBACKBEFORESTRING : "");
|
||||||
$param['trackbackbeforestring'] = (defined("TRACKBACKBEFORESTRING") ? TRACKBACKBEFORESTRING : "");
|
$tmp['trackbackafterstring'] = (defined("TRACKBACKAFTERSTRING") ? TRACKBACKAFTERSTRING : "");
|
||||||
$param['trackbackafterstring'] = (defined("TRACKBACKAFTERSTRING") ? TRACKBACKAFTERSTRING : "");
|
$tmp['itemlink'] = (defined("NEWSLIST_ITEMLINK")) ? NEWSLIST_ITEMLINK : "";
|
||||||
$param['itemlink'] = (defined("NEWSLIST_ITEMLINK")) ? NEWSLIST_ITEMLINK : "";
|
$tmp['thumbnail'] =(defined("NEWSLIST_THUMB")) ? NEWSLIST_THUMB : "border:0px";
|
||||||
$param['thumbnail'] =(defined("NEWSLIST_THUMB")) ? NEWSLIST_THUMB : "border:0px";
|
$tmp['catlink'] = (defined("NEWSLIST_CATLINK")) ? NEWSLIST_CATLINK : "";
|
||||||
$param['catlink'] = (defined("NEWSLIST_CATLINK")) ? NEWSLIST_CATLINK : "";
|
$tmp['caticon'] = (defined("NEWSLIST_CATICON")) ? NEWSLIST_CATICON : ICONSTYLE;
|
||||||
$param['caticon'] = (defined("NEWSLIST_CATICON")) ? NEWSLIST_CATICON : ICONSTYLE;
|
|
||||||
}
|
if(!$param) $param = array();
|
||||||
|
$param = array_merge($tmp, $param);
|
||||||
|
|
||||||
|
|
||||||
// Next three images aren't always defined by the caller, even if most of $param is.
|
// Next three images aren't always defined by the caller, even if most of $param is.
|
||||||
if (!isset($param['image_nonew_small']))
|
if (!isset($param['image_nonew_small']))
|
||||||
|
@@ -4,9 +4,9 @@
|
|||||||
| e107 website system - Language File.
|
| e107 website system - Language File.
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_languages/English/lan_news.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/lan_news.php,v $
|
||||||
| $Revision: 1.1.1.1 $
|
| $Revision: 1.2 $
|
||||||
| $Date: 2006-12-02 04:34:39 $
|
| $Date: 2009-09-14 18:22:16 $
|
||||||
| $Author: mcfly_e107 $
|
| $Author: secretr $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
define("PAGE_NAME", "News");
|
define("PAGE_NAME", "News");
|
||||||
@@ -36,6 +36,7 @@ define("LAN_NEWS_21", "News updated in database.");
|
|||||||
// define("LAN_NEWS_22", "Go to page: ");
|
// define("LAN_NEWS_22", "Go to page: ");
|
||||||
define("LAN_NEWS_23", "News Categories");
|
define("LAN_NEWS_23", "News Categories");
|
||||||
define("LAN_NEWS_24", "create pdf of this news item");
|
define("LAN_NEWS_24", "create pdf of this news item");
|
||||||
|
define("LAN_NEWS_25", "Edit");
|
||||||
|
|
||||||
define("LAN_NEWS_82", "News - Category");
|
define("LAN_NEWS_82", "News - Category");
|
||||||
define("LAN_NEWS_83", "No news items at the moment - please check back soon.");
|
define("LAN_NEWS_83", "No news items at the moment - please check back soon.");
|
||||||
|
213
news.php
213
news.php
@@ -9,8 +9,8 @@
|
|||||||
* News frontend
|
* News frontend
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/news.php,v $
|
* $Source: /cvs_backup/e107_0.8/news.php,v $
|
||||||
* $Revision: 1.19 $
|
* $Revision: 1.20 $
|
||||||
* $Date: 2009-09-13 16:37:18 $
|
* $Date: 2009-09-14 18:22:15 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -39,17 +39,9 @@ if (!defined("ITEMVIEW"))
|
|||||||
define("ITEMVIEW", varset($pref['newsposts'],15));
|
define("ITEMVIEW", varset($pref['newsposts'],15));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
WORK IN PROGRESS
|
|
||||||
if(isset($_GET['rewrite']))
|
|
||||||
{
|
|
||||||
$query = $_GET['rewrite'];
|
|
||||||
}
|
|
||||||
var_dump($query);*/
|
|
||||||
|
|
||||||
if (e_QUERY)
|
if (e_QUERY)
|
||||||
{
|
{
|
||||||
$tmp = explode(".", e_QUERY);
|
$tmp = e107::getUrl()->parseRequest('core:news', 'main', urldecode(e_QUERY));
|
||||||
$action = $tmp[0]; // At least one parameter here
|
$action = $tmp[0]; // At least one parameter here
|
||||||
$sub_action = varset($tmp[1],''); // Usually a numeric category, but don't presume yet
|
$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
|
$id = varset($tmp[2],''); // ID of specific news item where required
|
||||||
@@ -62,6 +54,7 @@ if (e_QUERY)
|
|||||||
// Usually the first query parameter is the action.
|
// 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
|
// For any of the 'list' modes (inc month, day), the action being second is a legacy situation
|
||||||
// .... which can hopefully go sometime
|
// .... which can hopefully go sometime
|
||||||
|
//SecretR: Gone, gone...
|
||||||
if (is_numeric($action) && isset($tmp[1]) && (($tmp[1] == 'list') || ($tmp[1] == 'month') || ($tmp[1] == 'day')))
|
if (is_numeric($action) && isset($tmp[1]) && (($tmp[1] == 'list') || ($tmp[1] == 'month') || ($tmp[1] == 'day')))
|
||||||
{
|
{
|
||||||
$action = $tmp[1];
|
$action = $tmp[1];
|
||||||
@@ -87,6 +80,19 @@ Variables Used:
|
|||||||
$ix = new news;
|
$ix = new news;
|
||||||
$nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";
|
$nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";
|
||||||
|
|
||||||
|
//Add rewrite search to db queries only if needed
|
||||||
|
$rewrite_join = $rewrite_cols = $rewrite_join_cat = $rewrite_cols_cat = '';
|
||||||
|
if(NEWS_REWRITE)
|
||||||
|
{
|
||||||
|
//item
|
||||||
|
$rewrite_join = 'LEFT JOIN #news_rewrite AS nr ON n.news_id=nr.news_rewrite_source AND nr.news_rewrite_type=1';
|
||||||
|
$rewrite_cols = ', nr.*';
|
||||||
|
|
||||||
|
//category
|
||||||
|
$rewrite_join_cat = 'LEFT JOIN #news_rewrite AS ncr ON n.news_category=ncr.news_rewrite_source AND ncr.news_rewrite_type=2';
|
||||||
|
$rewrite_cols_cat = ', ncr.news_rewrite_id AS news_category_rewrite_id, ncr.news_rewrite_string AS news_category_rewrite_string ';
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
// DISPLAY NEWS IN 'CATEGORY' FORMAT HERE
|
// DISPLAY NEWS IN 'CATEGORY' FORMAT HERE
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
@@ -114,9 +120,14 @@ if ($action == 'cat' || $action == 'all')
|
|||||||
if(!defined("NEWSALL_LIMIT")) { define("NEWSALL_LIMIT",10); }
|
if(!defined("NEWSALL_LIMIT")) { define("NEWSALL_LIMIT",10); }
|
||||||
// show archive of all news items using list-style template.
|
// 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().")");
|
$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().")");
|
||||||
$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
|
$query = "
|
||||||
|
SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon,
|
||||||
|
nc.category_meta_keywords, nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
|
||||||
|
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
|
||||||
|
{$rewrite_join}
|
||||||
|
{$rewrite_join_cat}
|
||||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".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_end=0 || n.news_end>".time().")
|
||||||
ORDER BY n.news_sticky DESC, n.news_datestamp DESC
|
ORDER BY n.news_sticky DESC, n.news_datestamp DESC
|
||||||
@@ -128,17 +139,29 @@ if ($action == 'cat' || $action == 'all')
|
|||||||
// show archive of all news items in a particular category using list-style template.
|
// 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));
|
$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); }
|
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
|
$query = "
|
||||||
|
SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon, nc.category_meta_keywords,
|
||||||
|
nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
|
||||||
|
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.")
|
{$rewrite_join}
|
||||||
|
{$rewrite_join_cat}
|
||||||
|
WHERE n.news_category=".intval($sub_action)."
|
||||||
AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")
|
AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")
|
||||||
AND n.news_category=".intval($sub_action)."
|
AND n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
||||||
ORDER BY n.news_datestamp DESC
|
ORDER BY n.news_datestamp DESC
|
||||||
LIMIT ".intval($newsfrom).",".NEWSLIST_LIMIT;
|
LIMIT ".intval($newsfrom).",".NEWSLIST_LIMIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($category_name)
|
$newsList = array();
|
||||||
|
if($sql->db_Select_gen($query))
|
||||||
|
{
|
||||||
|
$newsList = $sql->db_getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($action == 'cat') setNewsFrontMeta($newsList[1], 'category');
|
||||||
|
elseif($category_name)
|
||||||
{
|
{
|
||||||
define("e_PAGETITLE", $tp->toHTML($category_name,FALSE,"TITLE"));
|
define("e_PAGETITLE", $tp->toHTML($category_name,FALSE,"TITLE"));
|
||||||
}
|
}
|
||||||
@@ -167,12 +190,14 @@ if ($action == 'cat' || $action == 'all')
|
|||||||
</div>\n";
|
</div>\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$param = array();
|
||||||
$param['itemlink'] = (defined("NEWSLIST_ITEMLINK")) ? NEWSLIST_ITEMLINK : "";
|
$param['itemlink'] = (defined("NEWSLIST_ITEMLINK")) ? NEWSLIST_ITEMLINK : "";
|
||||||
$param['thumbnail'] =(defined("NEWSLIST_THUMB")) ? NEWSLIST_THUMB : "border:0px";
|
$param['thumbnail'] =(defined("NEWSLIST_THUMB")) ? NEWSLIST_THUMB : "border:0px";
|
||||||
$param['catlink'] = (defined("NEWSLIST_CATLINK")) ? NEWSLIST_CATLINK : "";
|
$param['catlink'] = (defined("NEWSLIST_CATLINK")) ? NEWSLIST_CATLINK : "";
|
||||||
$param['caticon'] = (defined("NEWSLIST_CATICON")) ? NEWSLIST_CATICON : ICONSTYLE;
|
$param['caticon'] = (defined("NEWSLIST_CATICON")) ? NEWSLIST_CATICON : ICONSTYLE;
|
||||||
$sql->db_Select_gen($query);
|
$param['current_action'] = $action;
|
||||||
$newsList = $sql->db_getList();
|
|
||||||
foreach($newsList as $row)
|
foreach($newsList as $row)
|
||||||
{
|
{
|
||||||
$text .= $ix->render_newsitem($row, 'return', '', $NEWSLISTSTYLE, $param);
|
$text .= $ix->render_newsitem($row, 'return', '', $NEWSLISTSTYLE, $param);
|
||||||
@@ -218,10 +243,15 @@ if ($action == "extend")
|
|||||||
|
|
||||||
if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled'])
|
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
|
$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, nc.category_meta_keywords, nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
|
||||||
|
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
|
||||||
LEFT JOIN #trackback AS tb ON tb.trackback_pid = n.news_id
|
LEFT JOIN #trackback AS tb ON tb.trackback_pid = n.news_id
|
||||||
|
{$rewrite_join}
|
||||||
|
{$rewrite_join_cat}
|
||||||
WHERE n.news_id=".intval($sub_action)." AND n.news_class REGEXP '".e_CLASS_REGEXP."'
|
WHERE n.news_id=".intval($sub_action)." AND n.news_class REGEXP '".e_CLASS_REGEXP."'
|
||||||
AND NOT (n.news_class REGEXP ".$nobody_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_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")
|
||||||
@@ -229,14 +259,38 @@ if ($action == "extend")
|
|||||||
}
|
}
|
||||||
else
|
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 n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon, nc.category_meta_keywords,
|
||||||
|
nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
|
||||||
|
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);
|
{$rewrite_join}
|
||||||
|
{$rewrite_join_cat}
|
||||||
|
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();
|
||||||
|
|
||||||
|
//***NEW [SecretR] - comments handled inside now
|
||||||
|
if(!$news['news_allow_comments'] && isset($_POST['commentsubmit']))
|
||||||
|
{
|
||||||
|
$pid = intval(varset($_POST['pid'], 0)); // ID of the specific comment being edited (nested comments - replies)
|
||||||
|
|
||||||
|
$clean_authorname = $_POST['author_name'];
|
||||||
|
$clean_comment = $_POST['comment'];
|
||||||
|
$clean_subject = $_POST['subject'];
|
||||||
|
|
||||||
|
e107::getSingleton('comment')->enter_comment($clean_authorname, $clean_comment, 'news', $sub_action, $pid, $clean_subject);
|
||||||
|
}
|
||||||
|
|
||||||
|
//More SEO
|
||||||
|
setNewsFrontMeta($news);
|
||||||
|
/*
|
||||||
if($news['news_title'])
|
if($news['news_title'])
|
||||||
{
|
{
|
||||||
if($pref['meta_news_summary'] && $news['news_title'])
|
if($pref['meta_news_summary'] && $news['news_title'])
|
||||||
@@ -244,11 +298,21 @@ if ($action == "extend")
|
|||||||
define("META_DESCRIPTION",SITENAME.": ".$news['news_title']." - ".$news['news_summary']);
|
define("META_DESCRIPTION",SITENAME.": ".$news['news_title']." - ".$news['news_summary']);
|
||||||
}
|
}
|
||||||
define("e_PAGETITLE",$news['news_title']);
|
define("e_PAGETITLE",$news['news_title']);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
require_once(HEADERF);
|
require_once(HEADERF);
|
||||||
|
|
||||||
|
$param = array();
|
||||||
|
$param['current_action'] = $action;
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
$ix->render_newsitem($news, "extend");
|
$ix->render_newsitem($news, 'extend', '', '', $param);
|
||||||
|
if(!$news['news_allow_comment'])
|
||||||
|
{
|
||||||
|
global $comment_edit_query; //FIXME - kill me
|
||||||
|
$comment_edit_query = 'comment.news.'.$news['news_id'];
|
||||||
|
e107::getSingleton('comment')->compose_comment('news', 'comment', $news['news_id'], null, $news['news_title'], FALSE);
|
||||||
|
}
|
||||||
$cache_data = ob_get_contents();
|
$cache_data = ob_get_contents();
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
setNewsCache($cacheString, $cache_data);
|
setNewsCache($cacheString, $cache_data);
|
||||||
@@ -274,9 +338,14 @@ switch ($action)
|
|||||||
case "list" :
|
case "list" :
|
||||||
$sub_action = intval($sub_action);
|
$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().")");
|
// $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
|
$query = "
|
||||||
|
SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name,
|
||||||
|
nc.category_icon, nc.category_meta_keywords, nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
|
||||||
|
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
|
||||||
|
{$rewrite_join}
|
||||||
|
{$rewrite_join_cat}
|
||||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
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_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")
|
||||||
AND n.news_category={$sub_action}
|
AND n.news_category={$sub_action}
|
||||||
@@ -289,19 +358,29 @@ switch ($action)
|
|||||||
$news_total = 1;
|
$news_total = 1;
|
||||||
if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled'])
|
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
|
$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, nc.category_meta_keywords, nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
|
||||||
|
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
|
||||||
LEFT JOIN #trackback AS tb ON tb.trackback_pid = n.news_id
|
LEFT JOIN #trackback AS tb ON tb.trackback_pid = n.news_id
|
||||||
|
{$rewrite_join}
|
||||||
|
{$rewrite_join_cat}
|
||||||
WHERE n.news_id={$sub_action} AND n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
WHERE n.news_id={$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().")
|
AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")
|
||||||
GROUP by n.news_id";
|
GROUP by n.news_id";
|
||||||
}
|
}
|
||||||
else
|
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 n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon,
|
||||||
|
nc.category_meta_keywords, nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
|
||||||
|
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
|
||||||
|
{$rewrite_join}
|
||||||
|
{$rewrite_join_cat}
|
||||||
WHERE n.news_id={$sub_action} AND n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
WHERE n.news_id={$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().")";
|
AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")";
|
||||||
}
|
}
|
||||||
@@ -324,9 +403,14 @@ switch ($action)
|
|||||||
}
|
}
|
||||||
$startdate = mktime(0, 0, 0, $month, $day, $year);
|
$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, nc.category_meta_keywords, nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
|
||||||
|
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
|
||||||
|
{$rewrite_join}
|
||||||
|
{$rewrite_join_cat}
|
||||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
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_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}
|
AND n.news_render_type<2 AND n.news_datestamp > {$startdate} AND n.news_datestamp < {$enddate}
|
||||||
@@ -347,10 +431,16 @@ switch ($action)
|
|||||||
|
|
||||||
// Get number of news item to show
|
// Get number of news item to show
|
||||||
if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled']) {
|
if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled']) {
|
||||||
$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
|
$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, nc.category_meta_keywords, nc.category_meta_description,
|
||||||
|
COUNT(*) AS tbcount{$rewrite_cols_cat}{$rewrite_cols}
|
||||||
|
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
|
||||||
LEFT JOIN #trackback AS tb ON tb.trackback_pid = n.news_id
|
LEFT JOIN #trackback AS tb ON tb.trackback_pid = n.news_id
|
||||||
|
{$rewrite_join}
|
||||||
|
{$rewrite_join_cat}
|
||||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
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_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")
|
||||||
AND n.news_render_type<2
|
AND n.news_render_type<2
|
||||||
@@ -359,9 +449,14 @@ switch ($action)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$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,
|
||||||
|
nc.category_meta_keywords, nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
|
||||||
|
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
|
||||||
|
{$rewrite_join}
|
||||||
|
{$rewrite_join_cat}
|
||||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
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_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")
|
||||||
AND n.news_render_type<2
|
AND n.news_render_type<2
|
||||||
@@ -421,14 +516,24 @@ $frows = $sql -> db_Fetch();
|
|||||||
|
|
||||||
$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))
|
switch($action)
|
||||||
|
{
|
||||||
|
case 'item':
|
||||||
|
setNewsFrontMeta($newsAr[1]);
|
||||||
|
break;
|
||||||
|
case 'list':
|
||||||
|
setNewsFrontMeta($newsAr[1], 'category');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*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("META_DESCRIPTION",SITENAME.": ".$newsAr[1]['news_title']." - ".$newsAr[1]['news_summary']);
|
||||||
}
|
}
|
||||||
define("e_PAGETITLE", $p_title);
|
define("e_PAGETITLE", $p_title);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
require_once(HEADERF);
|
require_once(HEADERF);
|
||||||
if(!$action)
|
if(!$action)
|
||||||
@@ -456,13 +561,15 @@ if(isset($pref['news_unstemplate']) && $pref['news_unstemplate'] && file_exists(
|
|||||||
$newspercolumn = (isset($NEWSITEMSPERCOLUMN) ? $NEWSITEMSPERCOLUMN : 10);
|
$newspercolumn = (isset($NEWSITEMSPERCOLUMN) ? $NEWSITEMSPERCOLUMN : 10);
|
||||||
$newsdata = array();
|
$newsdata = array();
|
||||||
$loop = 1;
|
$loop = 1;
|
||||||
|
$param = array();
|
||||||
|
$param['current_action'] = $action;
|
||||||
foreach($newsAr as $news) {
|
foreach($newsAr as $news) {
|
||||||
|
|
||||||
if(is_array($ALTERNATECLASSES)) {
|
if(is_array($ALTERNATECLASSES)) {
|
||||||
$newsdata[$loop] .= "<div class='{$ALTERNATECLASSES[0]}'>".$ix->render_newsitem($news, "return")."</div>";
|
$newsdata[$loop] .= "<div class='{$ALTERNATECLASSES[0]}'>".$ix->render_newsitem($news, "return")."</div>";
|
||||||
$ALTERNATECLASSES = array_reverse($ALTERNATECLASSES);
|
$ALTERNATECLASSES = array_reverse($ALTERNATECLASSES);
|
||||||
} else {
|
} else {
|
||||||
$newsdata[$loop] .= $ix->render_newsitem($news, "return");
|
$newsdata[$loop] .= $ix->render_newsitem($news, 'return', '', '', $param);
|
||||||
}
|
}
|
||||||
$loop ++;
|
$loop ++;
|
||||||
if($loop > $newscolumns) {
|
if($loop > $newscolumns) {
|
||||||
@@ -501,6 +608,8 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// #### normal newsitems, rendered via render_newsitem(), the $query is changed above (no other changes made) ---------
|
// #### normal newsitems, rendered via render_newsitem(), the $query is changed above (no other changes made) ---------
|
||||||
|
$param = array();
|
||||||
|
$param['current_action'] = $action;
|
||||||
|
|
||||||
$i= 1;
|
$i= 1;
|
||||||
while(isset($newsAr[$i]) && $i <= $interval) {
|
while(isset($newsAr[$i]) && $i <= $interval) {
|
||||||
@@ -518,7 +627,7 @@ else
|
|||||||
unset($news['news_render_type']);
|
unset($news['news_render_type']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$ix->render_newsitem($news);
|
$ix->render_newsitem($news, 'default', '', '', $param);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -679,4 +788,42 @@ function render_newscats(){ // -- CNN Style Categories. ----
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setNewsFrontMeta($news, $type='news')
|
||||||
|
{
|
||||||
|
if($type == 'news')
|
||||||
|
{
|
||||||
|
if($news['news_title'] && !defined('e_PAGETITLE'))
|
||||||
|
{
|
||||||
|
define('e_PAGETITLE', $news['news_title']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($news['news_meta_keywords'] && !defined('META_KEYWORDS'))
|
||||||
|
{
|
||||||
|
define('META_KEYWORDS', $news['news_meta_keywords']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($news['news_meta_description'] && !defined('META_DESCRIPTION'))
|
||||||
|
{
|
||||||
|
define('META_DESCRIPTION', $news['news_meta_description']);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($news['category_name'] && !defined('e_PAGETITLE'))
|
||||||
|
{
|
||||||
|
define('e_PAGETITLE', $news['category_name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($news['category_meta_keywords'] && !defined('META_KEYWORDS'))
|
||||||
|
{
|
||||||
|
define('META_KEYWORDS', $news['category_meta_keywords']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($news['category_meta_description'] && !defined('META_DESCRIPTION'))
|
||||||
|
{
|
||||||
|
define('META_DESCRIPTION', $news['category_meta_description']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
Reference in New Issue
Block a user