mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 21:27:25 +02:00
Issue #2610 Remove legacy SEF URL from forum plugin.
This commit is contained in:
@@ -626,8 +626,8 @@ class forumStats
|
|||||||
$POSTER = $row['thread_user_anon'];
|
$POSTER = $row['thread_user_anon'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$LINKTOTHREAD = e107::url('forum/thread/view', array('id' =>$row['thread_id'])); //$e107->url->getUrl('forum', 'thread', "func=view&id={$row['thread_id']}");
|
// $LINKTOTHREAD = e107::url('forum/thread/view', array('id' =>$row['thread_id'])); //$e107->url->getUrl('forum', 'thread', "func=view&id={$row['thread_id']}");
|
||||||
$LINKTOFORUM = e107::url('forum/forum/view', array('id' => $row['thread_forum_id'])); //$e107->url->getUrl('forum', 'forum', "func=view&id={$row['thread_forum_id']}");
|
// $LINKTOFORUM = e107::url('forum/forum/view', array('id' => $row['thread_forum_id'])); //$e107->url->getUrl('forum', 'forum', "func=view&id={$row['thread_forum_id']}");
|
||||||
|
|
||||||
$lastpost_datestamp = $gen->convert_date($row['thread_lastpost'], 'forum');
|
$lastpost_datestamp = $gen->convert_date($row['thread_lastpost'], 'forum');
|
||||||
|
|
||||||
|
@@ -646,9 +646,12 @@ function showmodoptions()
|
|||||||
$forum_id = $thread->threadInfo['forum_id'];
|
$forum_id = $thread->threadInfo['forum_id'];
|
||||||
if ($postInfo['thread_start'])
|
if ($postInfo['thread_start'])
|
||||||
{
|
{
|
||||||
|
|
||||||
$type = 'Thread';
|
$type = 'Thread';
|
||||||
// XXX _URL_ thread name?
|
// XXX _URL_ thread name?
|
||||||
$ret = "<form method='post' action='" . $e107->url->create('forum/thread/view', array('id' => $postInfo['post_thread']))."' id='frmMod_{$postInfo['post_forum']}_{$postInfo['post_thread']}'>";
|
// $formUrl = $e107->url->create('forum/thread/view', array('id' => $postInfo['post_thread']));
|
||||||
|
$formUrl = e_REQUEST_URI; // e107::url('forum', 'topic',
|
||||||
|
$ret = "<form method='post' action='" . $formUrl."' id='frmMod_{$postInfo['post_forum']}_{$postInfo['post_thread']}'>";
|
||||||
$delId = $postInfo['post_thread'];
|
$delId = $postInfo['post_thread'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -674,7 +677,9 @@ function showmodoptions()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$ret .= "<a href='" . $e107->url->create('forum/thread/split', array('id' => $postInfo['post_id']))."'>" . defset('IMAGE_admin_split') . '</a>';
|
// $splitUrl = $e107->url->create('forum/thread/split', array('id' => $postInfo['post_id']));
|
||||||
|
$splitUrl = e107::url('forum','split', array('thread_id'=>$postInfo['post_thread'], 'post_id'=>$postInfo['post_id']));
|
||||||
|
$ret .= "<a href='" .$splitUrl ."'>" . defset('IMAGE_admin_split') . '</a>';
|
||||||
|
|
||||||
}
|
}
|
||||||
$ret .= "
|
$ret .= "
|
||||||
|
@@ -554,7 +554,10 @@
|
|||||||
{
|
{
|
||||||
// global $gen;
|
// global $gen;
|
||||||
$tmp = explode('.', $this->var['forum_lastpost_info']);
|
$tmp = explode('.', $this->var['forum_lastpost_info']);
|
||||||
$lp_thread = "<a href='" . e107::getUrl()->create('forum/thread/last', array('id' => $tmp[1])) . "'>" . IMAGE_post2 . '</a>';
|
// $lp_url = e107::getUrl()->create('forum/thread/last', array('id' => $tmp[1]));
|
||||||
|
$lp_url = $threadUrl = e107::url('forum','topic',$this->var, array('query'=>array('last'=>1)));
|
||||||
|
|
||||||
|
$lp_thread = "<a href='" . $lp_url . "'>" . IMAGE_post2 . '</a>';
|
||||||
$lp_date = $this->gen->convert_date($tmp[0], 'forum');
|
$lp_date = $this->gen->convert_date($tmp[0], 'forum');
|
||||||
|
|
||||||
/*--
|
/*--
|
||||||
|
@@ -1,172 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (C) 2008-2011 e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
* Forum SEF URL configuration
|
|
||||||
* TODO - UNDER DEVELOPMENT
|
|
||||||
*/
|
|
||||||
class plugin_forum_rewrite_url extends eUrlConfig
|
|
||||||
{
|
|
||||||
public function config()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
|
|
||||||
'config' => array(
|
|
||||||
'noSingleEntry' => true, // [optional] default false; disallow this module to be shown via single entry point when this config is used
|
|
||||||
'legacy' => '{e_PLUGIN}forum/forum.php', // this config won't work in single entry point mod (legacy not used at all), so just set this to default plugin file to notify router it's legacy module
|
|
||||||
'format' => 'get', // get|path - notify core for the current URL format, if set to 'get' rules will be ignored
|
|
||||||
'selfParse' => false, // [optional] default false; use only this->parse() method, no core routine URL parsing
|
|
||||||
'selfCreate' => true, // [optional] default false; use only this->create() method, no core routine URL creating
|
|
||||||
'defaultRoute' => 'forum/main', // [optional] default empty; route (no leading module) used when module is found with no additional controller/action information e.g. /news/
|
|
||||||
'legacyQuery' => '' // default legacy query string template, null to disable, empty - use current QUERY_STRING
|
|
||||||
),
|
|
||||||
|
|
||||||
// rule set array
|
|
||||||
'rules' => array()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NOTE we have double 'forum' but this is the best way to map new-old forum URLs to the new routing engine
|
|
||||||
* Additionally, 'forum' controller is descriptive, and leading 'forum' module name could be easiely changed (URL aliases administration page)
|
|
||||||
*/
|
|
||||||
public function create($route, $params = array(), $options = array())
|
|
||||||
{
|
|
||||||
$amp = varset($options['encode']) ? '&' : '&';
|
|
||||||
if(is_string($route)) $route = explode('/', $route, 2);
|
|
||||||
if(!varset($route[0]) || 'index' == $route[0]) $route[0] = 'forum';
|
|
||||||
if(!varset($route[1])) $route[1] = 'main';
|
|
||||||
$base = e107::getInstance()->getFolder('plugins').'forum/';
|
|
||||||
//var_dump($options, $route, $params);
|
|
||||||
if($route[0] == 'forum')
|
|
||||||
{
|
|
||||||
if(!isset($params['id']) && isset($params['forum_id'])) $params['id'] = $params['forum_id'];
|
|
||||||
// if(isset($params['forum_name'])) $params['name'] = $params['forum_name']; - not used in this config
|
|
||||||
switch($route[1])
|
|
||||||
{
|
|
||||||
case 'view':
|
|
||||||
$page = (varset($params['page']) ? $amp.'p='.$params['page'] : '');
|
|
||||||
return $base."forum_viewforum.php?id={$params['id']}{$page}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'track':
|
|
||||||
return $base.'forum.php?track';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'index':
|
|
||||||
case 'main':
|
|
||||||
return $base.'forum.php';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'post':
|
|
||||||
return $base."forum_post.php?f={$params['type']}}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'rules':
|
|
||||||
return $base.'forum.php?f=rules';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'mfar':
|
|
||||||
return $base.'forum.php?f=mfar'.$amp.'id='.$params['id'];
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif($route[0] == 'thread')
|
|
||||||
{
|
|
||||||
if(!isset($params['id']) && isset($params['thread_id'])) $params['id'] = $params['thread_id'];
|
|
||||||
// if(isset($params['thread_name'])) $params['name'] = $params['thread_name']; - not used in this config
|
|
||||||
switch($route[1])
|
|
||||||
{
|
|
||||||
case 'new':
|
|
||||||
return $base."forum_post.php?f=nt{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'reply':
|
|
||||||
return $base."forum_post.php?f=rp{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'view':
|
|
||||||
$page = (varset($params['page']) ? $amp.'p='.$params['page'] : '');
|
|
||||||
return $base."forum_viewtopic.php?id={$params['id']}{$page}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'last':
|
|
||||||
return $base."forum_viewtopic.php?id={$params['id']}{$amp}last=1";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'post':
|
|
||||||
return $base."forum_viewtopic.php?f=post{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'report':
|
|
||||||
$page = (isset($params['page']) ? (int)$params['page'] : 0 );
|
|
||||||
return $base."forum_viewtopic.php?f=report{$amp}id={$params['id']}{$amp}post={$params['post']}{$amp}p={$page}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'edit':
|
|
||||||
return $base."forum_post.php?f=edit{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'move':
|
|
||||||
return $base."forum_conf.php?f=move{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'split':
|
|
||||||
return $base."forum_conf.php?f=split{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'quote':
|
|
||||||
return $base."forum_post.php?f=quote{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'next':
|
|
||||||
return $base."forum_viewtopic.php?f=next{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'prev':
|
|
||||||
return $base."forum_viewtopic.php?f=prev{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'track':
|
|
||||||
return $base."forum_viewtopic.php?f=track{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'untrack':
|
|
||||||
return $base."forum_viewtopic.php?f=untrack{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'track_toggle':
|
|
||||||
return $base."forum_viewtopic.php?f=track_toggle{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Admin callback
|
|
||||||
* Language file not loaded as all language data is inside the lan_eurl.php (loaded by default on administration URL page)
|
|
||||||
*/
|
|
||||||
public function admin()
|
|
||||||
{
|
|
||||||
// static may be used for performance
|
|
||||||
/*
|
|
||||||
e107::plugLan('forum', 'lan_forum_url');
|
|
||||||
static $admin = array(
|
|
||||||
'labels' => array(
|
|
||||||
'name' => LAN_PLUGIN_FORUM_NAME, // Module name
|
|
||||||
'label' => FORUM_LAN_URL_REWRITE_LABEL, // Current profile name
|
|
||||||
'description' => FORUM_LAN_URL_REWRITE_DESCR, //
|
|
||||||
'examples' => array("{e_PLUGIN_ABS}forum/forum.php")
|
|
||||||
),
|
|
||||||
'form' => array(), // Under construction - additional configuration options
|
|
||||||
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity
|
|
||||||
);
|
|
||||||
|
|
||||||
return $admin;*/
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,174 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (C) 2008-2011 e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
* Forum Default URL configuration
|
|
||||||
* TODO - SEF URL configuration
|
|
||||||
*/
|
|
||||||
class plugin_forum_url extends eUrlConfig
|
|
||||||
{
|
|
||||||
public function config()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
|
|
||||||
'config' => array(
|
|
||||||
'noSingleEntry' => true, // [optional] default false; disallow this module to be shown via single entry point when this config is used
|
|
||||||
'legacy' => '{e_PLUGIN}forum/forum.php', // this config won't work in single entry point mod (legacy not used at all), so just set this to default plugin file to notify router it's legacy module
|
|
||||||
'format' => 'get', // get|path - notify core for the current URL format, if set to 'get' rules will be ignored
|
|
||||||
'selfParse' => false, // [optional] default false; use only this->parse() method, no core routine URL parsing
|
|
||||||
'selfCreate' => true, // [optional] default false; use only this->create() method, no core routine URL creating
|
|
||||||
'defaultRoute' => 'forum/main', // [optional] default empty; route (no leading module) used when module is found with no additional controller/action information e.g. /news/
|
|
||||||
'legacyQuery' => '' // default legacy query string template, null to disable, empty - use current QUERY_STRING
|
|
||||||
),
|
|
||||||
|
|
||||||
// rule set array
|
|
||||||
'rules' => array()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NOTE we have double 'forum' but this is the best way to map new-old forum URLs to the new routing engine
|
|
||||||
* Additionally, 'forum' controller is descriptive, and leading 'forum' module name could be easiely changed (URL aliases administration page)
|
|
||||||
*/
|
|
||||||
public function create($route, $params = array(), $options = array())
|
|
||||||
{
|
|
||||||
$amp = varset($options['encode']) ? '&' : '&';
|
|
||||||
if(is_string($route)) $route = explode('/', $route, 2);
|
|
||||||
if(!varset($route[0]) || 'index' == $route[0]) $route[0] = 'forum';
|
|
||||||
if(!varset($route[1])) $route[1] = 'main';
|
|
||||||
$base = e107::getInstance()->getFolder('plugins').'forum/';
|
|
||||||
|
|
||||||
//var_dump($options, $route, $params);
|
|
||||||
if($route[0] == 'forum')
|
|
||||||
{
|
|
||||||
if(!isset($params['id']) && isset($params['forum_id'])) $params['id'] = $params['forum_id'];
|
|
||||||
// if(isset($params['forum_name'])) $params['name'] = $params['forum_name']; - not used in this config
|
|
||||||
switch($route[1])
|
|
||||||
{
|
|
||||||
case 'view':
|
|
||||||
$page = (varset($params['page']) ? $amp.'p='.$params['page'] : '');
|
|
||||||
return $base."forum_viewforum.php?id={$params['id']}{$page}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'track':
|
|
||||||
return $base.'forum.php?track';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'index':
|
|
||||||
case 'main':
|
|
||||||
return $base.'forum.php';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'post':
|
|
||||||
return $base."forum_post.php?f={$params['type']}{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'rules':
|
|
||||||
return $base.'forum.php?f=rules';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'mfar':
|
|
||||||
return $base.'forum.php?f=mfar'.$amp.'id='.$params['id'];
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif($route[0] == 'thread')
|
|
||||||
{
|
|
||||||
if(!isset($params['id']) && isset($params['thread_id'])) $params['id'] = $params['thread_id'];
|
|
||||||
// if(isset($params['thread_name'])) $params['name'] = $params['thread_name']; - not used in this config
|
|
||||||
switch($route[1])
|
|
||||||
{
|
|
||||||
case 'new':
|
|
||||||
return $base."forum_post.php?f=nt{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'reply':
|
|
||||||
return $base."forum_post.php?f=rp{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'view':
|
|
||||||
$page = (varset($params['page']) ? $amp.'p='.$params['page'] : '');
|
|
||||||
return $base."forum_viewtopic.php?id={$params['id']}{$page}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'last':
|
|
||||||
return $base."forum_viewtopic.php?id={$params['id']}{$amp}last=1";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'post':
|
|
||||||
return $base."forum_viewtopic.php?f=post{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'report':
|
|
||||||
$page = (isset($params['page']) ? (int)$params['page'] : 0 );
|
|
||||||
return $base."forum_viewtopic.php?f=report{$amp}id={$params['id']}{$amp}post={$params['post']}{$amp}p={$page}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'edit':
|
|
||||||
return $base."forum_post.php?f=edit{$amp}id={$params['id']}{$amp}post={$params['post']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'move':
|
|
||||||
return $base."forum_conf.php?f=move{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'split':
|
|
||||||
return $base."forum_conf.php?f=split{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'quote':
|
|
||||||
return $base."forum_post.php?f=quote{$amp}id={$params['id']}{$amp}post={$params['post']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'next':
|
|
||||||
return $base."forum_viewtopic.php?f=next{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'prev':
|
|
||||||
return $base."forum_viewtopic.php?f=prev{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'track':
|
|
||||||
return $base."forum_viewtopic.php?f=track{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'untrack':
|
|
||||||
return $base."forum_viewtopic.php?f=untrack{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'track_toggle':
|
|
||||||
return $base."forum_viewtopic.php?f=track_toggle{$amp}id={$params['id']}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Admin callback
|
|
||||||
* Language file not loaded as all language data is inside the lan_eurl.php (loaded by default on administration URL page)
|
|
||||||
*/
|
|
||||||
public function admin()
|
|
||||||
{
|
|
||||||
return false; // whole file deprecated.
|
|
||||||
/*
|
|
||||||
// static may be used for performance
|
|
||||||
e107::plugLan('forum', 'lan_forum_url');
|
|
||||||
static $admin = array(
|
|
||||||
'labels' => array(
|
|
||||||
'name' => LAN_PLUGIN_FORUM_NAME, // Module name
|
|
||||||
'label' => FORUM_LAN_URL_DEFAULT_LABEL, // Current profile name
|
|
||||||
'description' => FORUM_LAN_URL_DEFAULT_DESCR, //
|
|
||||||
'examples' => array("{e_PLUGIN_ABS}forum/forum_viewtopic.php?id=3&p=2")
|
|
||||||
),
|
|
||||||
'form' => array(), // Under construction - additional configuration options
|
|
||||||
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
return $admin;
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user