1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-08 07:36:32 +02:00

Issue #2016 Fix: Forum Topic/Thread Move link was failing when SEF Urls not in use.

This commit is contained in:
Cameron
2016-11-18 15:45:38 -08:00
parent 74221c1cd5
commit 1f3cb0d47b
2 changed files with 857 additions and 781 deletions

View File

@@ -52,10 +52,12 @@ class forum_url // plugin-folder + '_url'
// only create url - parsed above. // only create url - parsed above.
$config['move'] = array( $config['move'] = array(
'sef' => 'forum/post/?f=move&id={thread_id}', 'sef' => 'forum/post/?f=move&id={thread_id}',
'legacy' => '{e_PLUGIN}forum/forum_post.php?f=move&id={thread_id}'
); );
$config['split'] = array( $config['split'] = array(
'sef' => 'forum/post/?f=split&id={thread_id}&post={post_id}', 'sef' => 'forum/post/?f=split&id={thread_id}&post={post_id}',
'legacy' => '{e_PLUGIN}forum/forum_post.php?f=split&id={thread_id}&post={post_id}'
); );
$config['topic'] = array( $config['topic'] = array(

View File

@@ -5,33 +5,60 @@
* Forum plugin - view shortcodess * Forum plugin - view shortcodess
* *
*/ */
if (!defined('e107_INIT')) { exit; } if(!defined('e107_INIT'))
{
exit;
}
class plugin_forum_viewforum_shortcodes extends e_shortcode class plugin_forum_viewforum_shortcodes extends e_shortcode
{ {
private $gen; private $gen;
function __construct() function __construct()
{ {
$this->gen = new convert; $this->gen = new convert; // TODO replace all usage with e107::getParser()->toDate();
// $this->forum_rules = forum_rules('check'); // $this->forum_rules = forum_rules('check');
} }
// LEGACY shortcodes, to be deprecated & directly handled in template file??? // LEGACY shortcodes, to be deprecated & directly handled in template file???
function sc_startertitle() {return LAN_FORUM_1004;} function sc_startertitle()
{
return LAN_FORUM_1004;
}
function sc_threadtitle() {return LAN_FORUM_1003;} function sc_threadtitle()
{
return LAN_FORUM_1003;
}
function sc_replytitle() {return LAN_FORUM_0003;} function sc_replytitle()
{
return LAN_FORUM_0003;
}
function sc_lastpostitle() {return LAN_FORUM_0004;} function sc_lastpostitle()
{
return LAN_FORUM_0004;
}
function sc_viewtitle()
{
return LAN_FORUM_1005;
}
function sc_viewtitle() {return LAN_FORUM_1005;}
// End of LEGACY shortcodes... // End of LEGACY shortcodes...
function sc_message() {return $this->var['message'];} function sc_message()
{
return $this->var['message'];
}
function sc_threadpages() {return e107::getParser()->parseTemplate("{NEXTPREV={$this->var['parms']}}");} function sc_threadpages()
{
return e107::getParser()->parseTemplate("{NEXTPREV={$this->var['parms']}}");
}
function sc_newthreadbutton() function sc_newthreadbutton()
{ {
@@ -43,16 +70,25 @@ class plugin_forum_viewforum_shortcodes extends e_shortcode
if(!BOOTSTRAP) if(!BOOTSTRAP)
{ {
return sc_newthreadbutton; return $this->sc_newthreadbutton();
} }
//--function newthreadjump($url) //--function newthreadjump($url)
//--{ //--{
global $forum; global $forum;
$jumpList = $forum->forumGetAllowed('view'); $jumpList = $forum->forumGetAllowed('view');
$text = '<div class="btn-group"> $text = '<div class="btn-group">';
<a href="'.$this->var['ntUrl'].'" class="btn btn-primary">'.LAN_FORUM_1018.'</a>
if(!empty($this->var['ntUrl']))
{
$text .= '<a href="' . $this->var['ntUrl'] . '" class="btn btn-primary">' . LAN_FORUM_1018 . '</a>';
}
$text .= '
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown"> <button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span> <span class="caret"></span>
</button> </button>
@@ -78,7 +114,6 @@ if(!BOOTSTRAP)
function sc_breadcrumb() function sc_breadcrumb()
{ {
// var_dump ($this->var);
return $this->var['breadcrumb']; return $this->var['breadcrumb'];
} }
@@ -104,11 +139,13 @@ if(!BOOTSTRAP)
function sc_browsers() function sc_browsers()
{ {
global $member_users, $users, $guest_users;
if($this->var['track_online']) if($this->var['track_online'])
{ {
return $users . ' ' . ($users == 1 ? LAN_FORUM_0059 : LAN_FORUM_0060) . ' (' . $member_users . ' ' . ($member_users == 1 ? LAN_FORUM_0061 : LAN_FORUM_0062) . ", " . $guest_users . " " . ($guest_users == 1 ? LAN_FORUM_0063 : LAN_FORUM_0064) . ')'; return $users . ' ' . ($users == 1 ? LAN_FORUM_0059 : LAN_FORUM_0060) . ' (' . $member_users . ' ' . ($member_users == 1 ? LAN_FORUM_0061 : LAN_FORUM_0062) . ", " . $guest_users . " " . ($guest_users == 1 ? LAN_FORUM_0063 : LAN_FORUM_0064) . ')';
} }
} }
function sc_iconkey() function sc_iconkey()
@@ -232,6 +269,7 @@ if(!empty($viewable))
return empty($viewable) ? '' : $viewable; return empty($viewable) ? '' : $viewable;
} }
function sc_search() function sc_search()
{ {
return " return "
@@ -246,6 +284,7 @@ return "
} }
function sc_perms() function sc_perms()
{ {
global $forum, $forumId; global $forum, $forumId;
@@ -406,7 +445,6 @@ global $FORUM_VIEW_SUB, $FORUM_VIEW_SUB_START, $FORUM_VIEW_SUB_END;
//var_dump ($sc); //var_dump ($sc);
} }
//var_dump ("----------->".$FORUM_VIEW_SUB_START.$sub_info.$FORUM_VIEW_SUB_END."<-----------"); //var_dump ("----------->".$FORUM_VIEW_SUB_START.$sub_info.$FORUM_VIEW_SUB_END."<-----------");
@@ -432,39 +470,47 @@ class plugin_forum_viewsubforum_shortcodes extends plugin_forum_viewforum_shortc
// $this->forum_rules = forum_rules('check'); // $this->forum_rules = forum_rules('check');
} }
------*/ ------*/
function sc_sub_forumtitle() function sc_sub_forumtitle()
{ {
$forumName = e107::getParser()->toHTML($this->var['forum_name'], true); $forumName = e107::getParser()->toHTML($this->var['forum_name'], true);
return "<a href='" . e107::getUrl()->create('forum/forum/view', $this->var) . "'>{$forumName}</a>"; return "<a href='" . e107::getUrl()->create('forum/forum/view', $this->var) . "'>{$forumName}</a>";
} }
function sc_sub_description() function sc_sub_description()
{ {
return e107::getParser()->toHTML($this->var['forum_description'], false, 'no_hook'); return e107::getParser()->toHTML($this->var['forum_description'], false, 'no_hook');
} }
function sc_sub_threads() function sc_sub_threads()
{ {
return $this->var['forum_threads']; return $this->var['forum_threads'];
} }
function sc_sub_replies() function sc_sub_replies()
{ {
return $this->var['forum_replies']; return $this->var['forum_replies'];
} }
function sc_sub_threadsx() function sc_sub_threadsx()
{ {
$badgeThreads = ($this->var['forum_replies']) ? "badge-info" : ""; $badgeThreads = ($this->var['forum_replies']) ? "badge-info" : "";
return "<span class='badge {$badgeThreads}'>" . $this->var['forum_threads'] . "</span>"; return "<span class='badge {$badgeThreads}'>" . $this->var['forum_threads'] . "</span>";
} }
function sc_sub_repliesx() function sc_sub_repliesx()
{ {
$badgeReplies = ($this->var['forum_replies']) ? "badge-info" : ""; $badgeReplies = ($this->var['forum_replies']) ? "badge-info" : "";
return "<span class='badge {$badgeReplies}'>" . $this->var['forum_replies'] . "</span>"; return "<span class='badge {$badgeReplies}'>" . $this->var['forum_replies'] . "</span>";
} }
function sc_newflag() function sc_newflag()
{ {
//-- global $newflag_list; //-- global $newflag_list;
@@ -481,10 +527,15 @@ class plugin_forum_viewsubforum_shortcodes extends plugin_forum_viewforum_shortc
} }
function sc__wrapper_() { return 'forum_viewforum';}
function sc__wrapper_() // TODO XXX ??
{
return 'forum_viewforum';
}
function subinfo() { function subinfo()
{
$caller = debug_backtrace()[1]['function']; $caller = debug_backtrace()[1]['function'];
if($this->var['forum_lastpost_info']) if($this->var['forum_lastpost_info'])
{ {
@@ -527,16 +578,19 @@ class plugin_forum_viewsubforum_shortcodes extends plugin_forum_viewforum_shortc
return ($caller == 'sc_sub_lastpost' ? '-' : ''); return ($caller == 'sc_sub_lastpost' ? '-' : '');
} }
function sc_sub_lastpostuser() function sc_sub_lastpostuser()
{ {
return $this->subinfo(); return $this->subinfo();
} }
function sc_sub_lastpostdate() function sc_sub_lastpostdate()
{ {
return $this->subinfo(); return $this->subinfo();
} }
function sc_sub_lastpost() function sc_sub_lastpost()
{ {
return $this->subinfo(); return $this->subinfo();
@@ -557,16 +611,19 @@ class plugin_forum_viewforumthread_shortcodes extends plugin_forum_viewforum_sho
} }
------*/ ------*/
function sc_views() function sc_views()
{ {
return $this->var['thread_views']; return $this->var['thread_views'];
} }
function sc_replies() function sc_replies()
{ {
return ($this->var['thread_total_replies'] ?: "0"); return ($this->var['thread_total_replies'] ?: "0");
} }
function sc_viewsx() function sc_viewsx()
{ {
/*-- /*--
@@ -581,6 +638,7 @@ class plugin_forum_viewforumthread_shortcodes extends plugin_forum_viewforum_sho
return deftrue('BOOTSTRAP') ? "<span class='badge {$badge}'>" . $this->sc_views() . "</span>" : $this->sc_views(); return deftrue('BOOTSTRAP') ? "<span class='badge {$badge}'>" . $this->sc_views() . "</span>" : $this->sc_views();
} }
function sc_repliesx() function sc_repliesx()
{ {
/*-- /*--
@@ -597,7 +655,8 @@ class plugin_forum_viewforumthread_shortcodes extends plugin_forum_viewforum_sho
// function sc__wrapper_() { return 'forum_viewforum';} // function sc__wrapper_() { return 'forum_viewforum';}
function threadlastpostdata() { function threadlastpostdata()
{
$caller = debug_backtrace()[1]['function']; $caller = debug_backtrace()[1]['function'];
// if($this->var['thread_views']) // if($this->var['thread_views'])
//($this->var['thread_total_replies']?:"0") //($this->var['thread_total_replies']?:"0")
@@ -660,33 +719,39 @@ $LASTPOSTUSER = $this->var['lastpost_username'];
return ($caller == 'sc_lastpostuser' ? '' : '-'); return ($caller == 'sc_lastpostuser' ? '' : '-');
} }
function sc_lastpostuser() function sc_lastpostuser()
{ {
return $this->threadlastpostdata(); return $this->threadlastpostdata();
} }
function sc_lastpostdate() function sc_lastpostdate()
{ {
return $this->threadlastpostdata(); return $this->threadlastpostdata();
} }
function sc_lastpost() function sc_lastpost()
{ {
return $this->threadlastpostdata(); return $this->threadlastpostdata();
} }
function sc_threaddate() function sc_threaddate()
{ {
// global $gen; // global $gen;
return $this->gen->convert_date($this->var['thread_datestamp'], 'forum'); return $this->gen->convert_date($this->var['thread_datestamp'], 'forum');
} }
function sc_threadtimelapse() function sc_threadtimelapse()
{ {
// global $gen; // global $gen;
return $this->gen->computeLapse($this->var['thread_datestamp'], time(), false, false, 'short'); // convert_date($thread_info['thread_datestamp'], 'forum'); return $this->gen->computeLapse($this->var['thread_datestamp'], time(), false, false, 'short'); // convert_date($thread_info['thread_datestamp'], 'forum');
} }
function sc_icon() function sc_icon()
{ {
global $forum; global $forum;
@@ -722,6 +787,7 @@ $LASTPOSTUSER = $this->var['lastpost_username'];
return $ICON; return $ICON;
} }
function sc_threadtype() function sc_threadtype()
{ {
//-- CANDIDATE FOR TERNARY IF //-- CANDIDATE FOR TERNARY IF
@@ -737,6 +803,7 @@ $LASTPOSTUSER = $this->var['lastpost_username'];
return ''; return '';
} }
function sc_threadname() function sc_threadname()
{ {
global $menu_pref, $forum; global $menu_pref, $forum;
@@ -783,18 +850,21 @@ $LASTPOSTUSER = $this->var['lastpost_username'];
return "<a {$title} href='" . $url . "'>{$thread_name}</a>"; return "<a {$title} href='" . $url . "'>{$thread_name}</a>";
} }
function sc_pages() function sc_pages()
{ {
// $tVars['PAGES'] = fpages($thread_info, $tVars['REPLIES']); // $tVars['PAGES'] = fpages($thread_info, $tVars['REPLIES']);
return fpages($this->var, $this->sc_replies()); return fpages($this->var, $this->sc_replies());
} }
function sc_pagesx() function sc_pagesx()
{ {
// $tVars['PAGESX'] = fpages($thread_info, $tVars['REPLIES']); // $tVars['PAGESX'] = fpages($thread_info, $tVars['REPLIES']);
return $this->sc_pages(); return $this->sc_pages();
} }
function sc_admin_icons() function sc_admin_icons()
{ {
@@ -820,6 +890,7 @@ $LASTPOSTUSER = $this->var['lastpost_username'];
return ''; return '';
} }
function sc_adminoptions() function sc_adminoptions()
{ {
/*-- /*--
@@ -836,6 +907,7 @@ $LASTPOSTUSER = $this->var['lastpost_username'];
return (!deftrue('BOOTSTRAP') ? $this->sc_admin_icons() : ((MODERATOR) ? fadminoptions($this->var) : '')); return (!deftrue('BOOTSTRAP') ? $this->sc_admin_icons() : ((MODERATOR) ? fadminoptions($this->var) : ''));
} }
function sc_poster() function sc_poster()
{ {
/*-- /*--
@@ -906,4 +978,6 @@ $LASTPOSTUSER = $this->var['lastpost_username'];
return ''; return '';
} }
} }
?> ?>