1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-15 10:02:02 +02:00

News eURL mod rewrite profile - ready for test

This commit is contained in:
secretr 2008-12-03 12:38:08 +00:00
parent e37dfcb1dc
commit 926e754a84
7 changed files with 87 additions and 85 deletions

View File

@ -9,7 +9,7 @@ RewriteRule ^news/?$ news.php
#item, default, cat actions
RewriteRule ^news/([a-z]+)-([0-9]+)-([0-9]+)(\.html)?$ news.php?$1.$2.$3 [L]
#extend, cat, list actions
RewriteRule ^news/([a-z]+)-([0-9]+)(\.html)?$ news.php?.$1.$2 [L]
RewriteRule ^news/([a-z]+)-([0-9]+)(\.html)?$ news.php?$1.$2 [L]
#ErrorDocument 400 /error.php?400
#ErrorDocument 401 /error.php?401

View File

@ -1,5 +1,10 @@
<?php
/*
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: main.php,v 1.2 2008-12-03 12:38:08 secretr Exp $
*
* eURL configuration script
*/
function url_news_main($parms)
{
$base = e_HTTP.'news/'.$parms['action'];
@ -15,7 +20,7 @@ function url_news_main($parms)
return $base.'-'.varsettrue($parms['value'],'0').'.html';
case 'item':
case 'default':
return $base."-{$parms['value1']}-{$parms['value2']}.html";
return $base."-{$parms['value1']}-".varset($parms['value2'], '0').".html";
case 'nextprev':
return e_HTTP."news/{$parms['to_action']}-{$parms['subaction']}-[FROM].html";

View File

@ -1,5 +1,10 @@
<?php
/*
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: main.php,v 1.3 2008-12-03 12:38:07 secretr Exp $
*
* eURL configuration script
*/
function url_news_main($parms)
{
$base = e_HTTP.'news.php?'.$parms['action'];
@ -15,7 +20,7 @@ function url_news_main($parms)
return $base.'.'.varsettrue($parms['value'],'0');
case 'item':
case 'default':
return $base.".{$parms['value1']}.{$parms['value2']}";
return $base.".{$parms['value1']}.".varset($parms['value2'], '0');
case 'nextprev':
return e_HTTP."news.php?{$parms['to_action']}.{$parms['subaction']}.[FROM]";

View File

@ -1,17 +1,9 @@
<?php
/*
* e107 website system
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: news_shortcodes.php,v 1.14 2008-12-03 12:38:07 secretr Exp $
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* News Shortcode Batch
*
* $Source: /cvs_backup/e107_0.8/e107_files/shortcode/batch/news_shortcodes.php,v $
* $Revision: 1.13 $
* $Date: 2008-12-02 23:44:19 $
* $Author: secretr $
* News shortcode batch
*/
if (!defined('e107_INIT')) { exit; }
include_once(e_HANDLER.'shortcode_handler.php');
@ -259,7 +251,7 @@ SC_BEGIN NEWSIMAGE
global $e107;
$news_item = getcachedvars('current_news_item');
$param = getcachedvars('current_news_param');
return (isset($news_item['news_thumbnail']) && $news_item['news_thumbnail']) ? "<a href='".$e107->url->getUrl('core:news', 'main', "action=item&value1={$news_item['news_id']}&value1={$news_item['news_category']}")."'><img class='news_image' src='".e_IMAGE_ABS."newspost_images/".$news_item['news_thumbnail']."' alt='' style='".$param['thumbnail']."' /></a>" : "";
return (isset($news_item['news_thumbnail']) && $news_item['news_thumbnail']) ? "<a href='".$e107->url->getUrl('core:news', 'main', "action=item&value1={$news_item['news_id']}&value2={$news_item['news_category']}")."'><img class='news_image' src='".e_IMAGE_ABS."newspost_images/".$news_item['news_thumbnail']."' alt='' style='".$param['thumbnail']."' /></a>" : "";
SC_END
SC_BEGIN STICKY_ICON
@ -282,7 +274,7 @@ $param = getcachedvars('current_news_param');
$category_icon = $e107->tp->parseTemplate('{NEWSHEADER}', FALSE, $news_shortcodes);
if (!$category_icon) return '';
if($param['caticon'] == ""){$param['caticon'] = "border:0px";}
return "<a href='".$e107->url->getUrl('core:news', 'main', "action=cat&value{$news_item['news_category']}")."'><img style='".$param['caticon']."' src='".$category_icon."' alt='' /></a>";
return "<a href='".$e107->url->getUrl('core:news', 'main', "action=cat&value={$news_item['news_category']}")."'><img style='".$param['caticon']."' src='".$category_icon."' alt='' /></a>";
SC_END
SC_BEGIN TRACKBACK

View File

@ -1,4 +1,10 @@
global $sql,$pref,$tp,$NEWSCAT,$NEWSCAT_ITEM;
/*
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: news_categories.sc,v 1.3 2008-12-03 12:38:08 secretr Exp $
*
* News Categories shortcode
*/
global $e107, $sql,$pref,$tp,$NEWSCAT,$NEWSCAT_ITEM;
require_once(e_HANDLER."news_class.php");
$ix = new news;
@ -76,10 +82,10 @@ $nbr_cols = (defined("NEWSCAT_COLS")) ? NEWSCAT_COLS : $nbr_cols;
extract($row3);
$search[0] = "/\{NEWSCATICON\}(.*?)/si";
$replace[0] = ($category_icon) ? "<a href='".e_BASE."news.php?cat.".$category_id."'><img src='".e_IMAGE."icons/".$category_icon."' alt='' style='".$param['caticon']."' /></a>" : "";
$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>" : "";
$search[1] = "/\{NEWSCATEGORY\}(.*?)/si";
$replace[1] = ($category_name) ? "<a href='".e_BASE."news.php?cat.".$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=cat&value='.$category_id)."' 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";

View File

@ -1,20 +1,17 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| ©Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/alt_news/alt_news.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:34:44 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Alternate News
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/alt_news/alt_news.php,v $
* $Revision: 1.2 $
* $Date: 2008-12-03 12:38:08 $
* $Author: secretr $
*/
if (!defined('e107_INIT')) { exit; }

View File

@ -1,20 +1,17 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| ©Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/news.php,v $
| $Revision: 1.14 $
| $Date: 2008-12-02 23:44:19 $
| $Author: secretr $
+----------------------------------------------------------------------------+
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* News frontend
*
* $Source: /cvs_backup/e107_0.8/news.php,v $
* $Revision: 1.15 $
* $Date: 2008-12-03 12:38:07 $
* $Author: secretr $
*/
require_once("class2.php");
@ -22,7 +19,7 @@ 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);
@ -40,7 +37,7 @@ if (!defined("ITEMVIEW"))
define("ITEMVIEW", varset($pref['newsposts'],15));
}
if (e_QUERY)
if (e_QUERY)
{
$tmp = explode(".", e_QUERY);
$action = $tmp[0]; // At least one parameter here
@ -62,7 +59,7 @@ if (is_numeric($action) && isset($tmp[1]) && (($tmp[1] == 'list') || ($tmp[1] ==
if ($action == 'all' || $action == 'cat')
if ($action == 'all' || $action == 'cat')
{
$sub_action = intval(varset($tmp[1],0));
}
@ -94,7 +91,7 @@ if ($action == 'cat' || $action == 'all')
$category = intval($sub_action);
if ($action == 'cat' && $category != 0)
if ($action == 'cat' && $category != 0)
{
$gen = new convert;
$sql->db_Select("news_category", "*", "category_id='$category'");
@ -110,8 +107,8 @@ 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
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";
}
@ -123,10 +120,10 @@ if ($action == 'cat' || $action == 'all')
$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
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;
}
@ -199,7 +196,7 @@ if ($action == 'cat' || $action == 'all')
//------------------------------------------------------
// DISPLAY SINGLE ITEM IN EXTENDED FORMAT HERE
//------------------------------------------------------
if ($action == "extend")
if ($action == "extend")
{ // --> Cache
if($newsCachedPage = checkCache($cacheString))
{
@ -208,15 +205,15 @@ if ($action == "extend")
}
// <-- Cache
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
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().")
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().")
GROUP by n.news_id";
}
else
@ -269,9 +266,9 @@ switch ($action)
$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}
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;
@ -279,22 +276,22 @@ switch ($action)
case "item" :
$sub_action = intval($sub_action);
$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
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={$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().")
GROUP by n.news_id";
}
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 #news_category AS nc ON n.news_category = nc.category_id
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().")";
}
break;
@ -319,9 +316,9 @@ switch ($action)
$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}
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;
@ -392,13 +389,13 @@ if($newsCachedPage = checkCache($cacheString)) // normal news front-page - with
}
if (!($news_total = $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;
}
}
$newsAr = $sql -> db_getList();
$news_total=$sql->total_results;
@ -432,7 +429,7 @@ if(!$action)
}
}
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");
@ -472,11 +469,11 @@ if(isset($pref['news_unstemplate']) && $pref['news_unstemplate'] && file_exists(
$nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
$text .= ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
// $text=''.$text.'<center>'.$nextprev.'</center>';
echo $text;
setNewsCache($cacheString, $text);
}
else
}
else
{
ob_start();
@ -497,13 +494,13 @@ else
$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']);
}
@ -582,7 +579,7 @@ function show_newsarchive($newsAr, $i = 1)
}
// #### new: news archive ---------------------------------------------------------------------------------------------
if ($action != "item" && $action != 'list' && $pref['newsposts_archive'])
if ($action != "item" && $action != 'list' && $pref['newsposts_archive'])
{
show_newsarchive($newsAr,$interval);
}