mirror of
https://github.com/e107inc/e107.git
synced 2025-01-16 20:28:28 +01:00
eURL news mod rewrite profile - work in progress
This commit is contained in:
parent
1eb6f7386c
commit
35d36f61c5
@ -1,5 +1,18 @@
|
||||
ErrorDocument 400 /error.php?400
|
||||
ErrorDocument 401 /error.php?401
|
||||
ErrorDocument 403 /error.php?403
|
||||
ErrorDocument 404 /error.php?404
|
||||
ErrorDocument 500 /error.php?500
|
||||
Options +FollowSymlinks
|
||||
RewriteEngine On
|
||||
|
||||
### Set this to your e107 site root
|
||||
RewriteBase /
|
||||
|
||||
### NEWS ###
|
||||
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]
|
||||
|
||||
#ErrorDocument 400 /error.php?400
|
||||
#ErrorDocument 401 /error.php?401
|
||||
#ErrorDocument 403 /error.php?403
|
||||
#ErrorDocument 404 /error.php?404
|
||||
#ErrorDocument 500 /error.php?500
|
@ -9,8 +9,8 @@
|
||||
* URL Management
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_admin/eurl.php,v $
|
||||
* $Revision: 1.4 $
|
||||
* $Date: 2008-12-02 12:27:10 $
|
||||
* $Revision: 1.5 $
|
||||
* $Date: 2008-12-02 23:44:19 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
|
||||
@ -259,7 +259,8 @@ class admin_url_config {
|
||||
{
|
||||
$core_def = array(
|
||||
'news' => array("core_name" => LAN_EURL_CORE_NEWS, 'core_path' => 'news'),
|
||||
'downloads' => array("core_name" => LAN_EURL_CORE_DOWNLOADS, 'core_path' => 'downloads')
|
||||
'download' => array("core_name" => LAN_EURL_CORE_DOWNLOADS, 'core_path' => 'download'),
|
||||
'user' => array("core_name" => LAN_EURL_CORE_USERS, 'core_path' => 'user')
|
||||
);
|
||||
|
||||
return $core_def;
|
||||
|
28
e107_files/e_url/core/news/apache_mod_rewrite/main.php
Normal file
28
e107_files/e_url/core/news/apache_mod_rewrite/main.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
function url_news_main($parms)
|
||||
{
|
||||
$base = e_HTTP.'news/'.$parms['action'];
|
||||
switch ($parms['action'])
|
||||
{
|
||||
case 'all':
|
||||
return $base;
|
||||
case 'cat':
|
||||
case 'extend':
|
||||
case 'list'://TODO - find out what are list params
|
||||
case 'month': //TODO - find out what are month params
|
||||
case 'day': //TODO - find out what are day params
|
||||
return $base.'-'.varsettrue($parms['value'],'0').'.html';
|
||||
case 'item':
|
||||
case 'default':
|
||||
return $base."-{$parms['value1']}-{$parms['value2']}.html";
|
||||
case 'nextprev':
|
||||
return e_HTTP."news/{$parms['to_action']}-{$parms['subaction']}-[FROM].html";
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -12,9 +12,13 @@ function url_news_main($parms)
|
||||
case 'list'://TODO - find out what are list params
|
||||
case 'month': //TODO - find out what are month params
|
||||
case 'day': //TODO - find out what are day params
|
||||
return $base.'.'.$parms['value'];
|
||||
return $base.'.'.varsettrue($parms['value'],'0');
|
||||
case 'item':
|
||||
return $base.".{$parms['id']}.{$parms['cat']}";
|
||||
case 'default':
|
||||
return $base.".{$parms['value1']}.{$parms['value2']}";
|
||||
case 'nextprev':
|
||||
return e_HTTP."news.php?{$parms['to_action']}.{$parms['subaction']}.[FROM]";
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -9,8 +9,8 @@
|
||||
* News Shortcode Batch
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_files/shortcode/batch/news_shortcodes.php,v $
|
||||
* $Revision: 1.12 $
|
||||
* $Date: 2008-12-02 16:50:15 $
|
||||
* $Revision: 1.13 $
|
||||
* $Date: 2008-12-02 23:44:19 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
@ -251,15 +251,15 @@ SC_END
|
||||
SC_BEGIN NEWSTHUMBNAIL
|
||||
global $e107;
|
||||
$news_item = getcachedvars('current_news_item');
|
||||
$param = getcachedvars('current_news_param'); echo
|
||||
return (isset($news_item['news_thumbnail']) && $news_item['news_thumbnail']) ? "<a href='".$e107->url->getUrl('core:news', 'main', "action=item&id={$news_item['news_id']}&cat={$news_item['news_category']}")."'><img class='news_image' src='".e_IMAGE_ABS."newspost_images/".$news_item['news_thumbnail']."' alt='' style='".$param['thumbnail']."' /></a>" : "";
|
||||
$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']}&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 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&id={$news_item['news_id']}&cat={$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']}&value1={$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
|
||||
@ -272,7 +272,7 @@ SC_BEGIN NEWSTITLELINK
|
||||
global $e107;
|
||||
$news_item = getcachedvars('current_news_item');
|
||||
$param = getcachedvars('current_news_param');
|
||||
return "<a style='".(isset($param['itemlink']) ? $param['itemlink'] : "null")."' href='".$e107->url->getUrl('core:news', 'main', "action=item&id={$news_item['news_id']}&cat={$news_item['news_category']}")."'>".$news_item['news_title']."</a>";
|
||||
return "<a style='".(isset($param['itemlink']) ? $param['itemlink'] : "null")."' href='".$e107->url->getUrl('core:news', 'main', "action=item&value1={$news_item['news_id']}&value2={$news_item['news_category']}")."'>".$news_item['news_title']."</a>";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN NEWSCATICON
|
||||
|
@ -9,8 +9,8 @@
|
||||
* Administration Language File
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_eurl.php,v $
|
||||
* $Revision: 1.2 $
|
||||
* $Date: 2008-12-02 12:27:10 $
|
||||
* $Revision: 1.3 $
|
||||
* $Date: 2008-12-02 23:44:19 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
if (!defined("PAGE_NAME")) { define("PAGE_NAME", "Manage Site URLs"); }
|
||||
@ -28,10 +28,10 @@ define("LAN_EURL_LOCATION", "Profile Location:");
|
||||
|
||||
|
||||
define("LAN_EURL_CORE_NEWS", "News");
|
||||
define("LAN_EURL_CORE_DOWNLOADS", "News");
|
||||
define("LAN_EURL_CORE_DOWNLOADS", "Downloads");
|
||||
define("LAN_EURL_CORE_USERS", "Users");
|
||||
define("LAN_EURL_MODREWR_TITLE", "SEF URLs");
|
||||
define("LAN_EURL_MODREWR_DESCR", "You'll need mod_rewrite isntalled and running on your server (Apache Web Server). After enabling this profile go to your site root folder, rename htaccess.txt to .htaccess and uncomment the corresponding line.");
|
||||
define("LAN_EURL_COREPR_DOWNLOADS", "Downloads SEF URLs");
|
||||
|
||||
//define("LAN_EURL_", "");
|
||||
//define("LAN_EURL_", "");
|
||||
|
13
news.php
13
news.php
@ -11,11 +11,12 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/news.php,v $
|
||||
| $Revision: 1.13 $
|
||||
| $Date: 2008-12-02 20:51:52 $
|
||||
| $Revision: 1.14 $
|
||||
| $Date: 2008-12-02 23:44:19 $
|
||||
| $Author: secretr $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
require_once("class2.php");
|
||||
require_once(e_HANDLER."news_class.php");
|
||||
require_once(e_HANDLER."comment_class.php");
|
||||
@ -172,7 +173,8 @@ if ($action == 'cat' || $action == 'all')
|
||||
$amount = ($action == "all") ? NEWSALL_LIMIT : NEWSLIST_LIMIT;
|
||||
|
||||
$icon = ($row['category_icon']) ? "<img src='".e_IMAGE."icons/".$row['category_icon']."' alt='' />" : "";
|
||||
$parms = $news_total.",".$amount.",".$newsfrom.",".e_SELF.'?'.$action.".".$category.".[FROM]";
|
||||
|
||||
$parms = $news_total.",".$amount.",".$newsfrom.",".$e107->url->getUrl('core:news', 'main', "action=nextprev&to_action={$action}&subaction={$category}");
|
||||
$text .= "<div class='nextprev'>".$tp->parseTemplate("{NEXTPREV={$parms}}")."</div>";
|
||||
|
||||
if(!$NEWSLISTTITLE)
|
||||
@ -466,7 +468,7 @@ if(isset($pref['news_unstemplate']) && $pref['news_unstemplate'] && file_exists(
|
||||
$text = preg_replace("/\{(.*?)\}/e", '$\1', $NEWSCLAYOUT);
|
||||
|
||||
require_once(HEADERF);
|
||||
$parms = $news_total.",".ITEMVIEW.",".$newsfrom.",".e_SELF.'?'.($action ? $action : 'default' ).($sub_action ? ".".$sub_action : ".0").".[FROM]";
|
||||
$parms = $news_total.",".ITEMVIEW.",".$newsfrom.",".$e107->url->getUrl('core:news', 'main', "action=nextprev&to_action=".($action ? $action : 'default' )."&subaction=".($sub_action ? $sub_action : "0"));
|
||||
$nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
|
||||
$text .= ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
|
||||
// $text=''.$text.'<center>'.$nextprev.'</center>';
|
||||
@ -509,7 +511,8 @@ else
|
||||
$ix->render_newsitem($news);
|
||||
$i++;
|
||||
}
|
||||
$parms = $news_total.",".ITEMVIEW.",".$newsfrom.",".e_SELF.'?'.($action ? $action : 'default' ).($sub_action ? ".".$sub_action : ".0").".[FROM]";
|
||||
|
||||
$parms = $news_total.",".ITEMVIEW.",".$newsfrom.",".$e107->url->getUrl('core:news', 'main', "action=nextprev&to_action=".($action ? $action : 'default' )."&subaction=".($sub_action ? $sub_action : "0"));
|
||||
$nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
|
||||
echo ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user