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

Forum $fVar, $tVar removal

Forum $fVar, $tVar removal

Added also some code clean up for previous submit #1677 (forum.php & forum_shortcodes.php)
This commit is contained in:
rica-carv
2016-06-14 13:34:52 +01:00
committed by GitHub
parent 904387332e
commit fe54bd0377
4 changed files with 154 additions and 63 deletions

View File

@@ -104,7 +104,7 @@ if(isset($_GET['f']))
//var_dump (is_array($sc)); //var_dump (is_array($sc));
//--$fVars = new e_vars; //--$fVars = new e_vars;
$gen = new convert; //--$gen = new convert;
/*-- /*--
// Gonne directly to shortcode file // Gonne directly to shortcode file

View File

@@ -2097,6 +2097,7 @@ class e107forum
// Function eventually to be reworked (move full function to shortcode file, or make a new breadcrumb function, like in downloads, maybe?)
/* /*
* set bread crumb * set bread crumb
* $forum_href override ONLY applies when template is missing FORUM_CRUMB * $forum_href override ONLY applies when template is missing FORUM_CRUMB
@@ -2229,12 +2230,20 @@ class e107forum
/*
$BACKLINK = $BREADCRUMB; $BACKLINK = $BREADCRUMB;
$templateVar->BREADCRUMB = $BREADCRUMB; $templateVar->BREADCRUMB = $BREADCRUMB;
$templateVar->BACKLINK = $BACKLINK; $templateVar->BACKLINK = $BACKLINK;
$templateVar->FORUM_CRUMB = $FORUM_CRUMB; $templateVar->FORUM_CRUMB = $FORUM_CRUMB;
*/
// Backlink shortcode is defined inside shortcode file....
//---- var_dump ($templateVar);
//---- echo "<hr>";
$templateVar['breadcrumb'] = $BREADCRUMB;
$templateVar['forum_crumb'] = $FORUM_CRUMB;
} }

View File

@@ -82,23 +82,27 @@ $page = (varset($_GET['p']) ? $_GET['p'] : 1);
$threadFrom = ($page - 1) * $view; $threadFrom = ($page - 1) * $view;
global $forum_info, $FORUM_CRUMB; global $forum_info, $FORUM_CRUMB;
$fVars = new e_vars;
$sc = e107::getScBatch('viewforum', 'forum');
//----$fVars = new e_vars;
/*--
$fVars->STARTERTITLE = LAN_FORUM_1004; $fVars->STARTERTITLE = LAN_FORUM_1004;
$fVars->THREADTITLE = LAN_FORUM_1003; $fVars->THREADTITLE = LAN_FORUM_1003;
$fVars->REPLYTITLE = LAN_FORUM_0003; $fVars->REPLYTITLE = LAN_FORUM_0003;
$fVars->LASTPOSTITLE = LAN_FORUM_0004; $fVars->LASTPOSTITLE = LAN_FORUM_0004;
$fVars->VIEWTITLE = LAN_FORUM_1005; $fVars->VIEWTITLE = LAN_FORUM_1005;
--*/
$forumId = (int)$_REQUEST['id']; $forumId = (int)$_REQUEST['id'];
if(!$forumId && e_QUERY) // BC Fix for old links. if(!$forumId && e_QUERY) // BC Fix for old links.
{ {
list($id,$from) = explode(".",e_QUERY); list($id,$from) = explode(".",e_QUERY);
$forumId = intval($id); $forumId = intval($id);
$threadFrom = intval($from); $threadFrom = intval($from);
unset($id,$from); unset($id,$from);
} }
if (!$forum->checkPerm($forumId, 'view')) if (!$forum->checkPerm($forumId, 'view'))
@@ -123,7 +127,7 @@ if (!$forum->checkPerm($forumId, 'view'))
} }
$forumInfo = $forum->forumGet($forumId); $forumInfo = $forum->forumGet($forumId);
$threadsViewed = $forum->threadGetUserViewed(); //----$threadsViewed = $forum->threadGetUserViewed();
if (empty($FORUM_VIEW_START)) if (empty($FORUM_VIEW_START))
{ {
@@ -194,16 +198,18 @@ if(!empty($forumInfo['forum_description']))
//define('MODERATOR', $forum_info['forum_moderators'] != '' && check_class($forum_info['forum_moderators'])); //define('MODERATOR', $forum_info['forum_moderators'] != '' && check_class($forum_info['forum_moderators']));
//$modArray = $forum->forum_getmods($forum_info['forum_moderators']); //$modArray = $forum->forum_getmods($forum_info['forum_moderators']);
// $thread???
$modArray = $forum->forumGetMods($thread->forum_info['forum_moderators']); $modArray = $forum->forumGetMods($thread->forum_info['forum_moderators']);
define('MODERATOR', (USER && is_array($modArray) && in_array(USERID, array_keys($modArray)))); define('MODERATOR', (USER && is_array($modArray) && in_array(USERID, array_keys($modArray))));
$message = ''; //----$message = '';
if (MODERATOR) if (MODERATOR)
{ {
if ($_POST) if ($_POST)
{ {
require_once(e_PLUGIN.'forum/forum_mod.php'); require_once(e_PLUGIN.'forum/forum_mod.php');
$message = forum_thread_moderate($_POST); //-- $message = forum_thread_moderate($_POST);
$forumSCvars['message']=forum_thread_moderate($_POST);
} }
} }
@@ -237,12 +243,14 @@ require_once(HEADERF);
$text=''; $text='';
// TODO - message batch shortcode // TODO - message batch shortcode
/*--
if ($message) if ($message)
{ {
//$ns->tablerender('', $message, array('forum_viewforum', 'msg')); //$ns->tablerender('', $message, array('forum_viewforum', 'msg'));
//e107::getMessage()->add($thread->message); //e107::getMessage()->add($thread->message);
$fVars->MESSAGE = $message; $fVars->MESSAGE = $message;
} }
--*/
$threadCount = $forumInfo['forum_threads']; $threadCount = $forumInfo['forum_threads'];
@@ -262,24 +270,32 @@ if ($pages)
if(strpos($FORUM_VIEW_START, 'THREADPAGES') !== false || strpos($FORUM_VIEW_END, 'THREADPAGES') !== false) if(strpos($FORUM_VIEW_START, 'THREADPAGES') !== false || strpos($FORUM_VIEW_END, 'THREADPAGES') !== false)
{ {
$url = e107::url('forum','forum',$forumInfo, array('query'=>array('p'=>'[FROM]'))); $url = e107::url('forum','forum',$forumInfo, array('query'=>array('p'=>'[FROM]')));
/*--
$parms = "total={$pages}&type=page&current={$page}&url=".$url."&caption=off"; $parms = "total={$pages}&type=page&current={$page}&url=".$url."&caption=off";
$fVars->THREADPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}"); $fVars->THREADPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");
--*/
$forumSCvars['parms'] = "total={$pages}&type=page&current={$page}&url=".$url."&caption=off";
//-- ?????????? unset $ulrparms????
unset($urlparms); unset($urlparms);
} }
} }
if($forum->checkPerm($forumId, 'thread')) //new thread access only. if($forum->checkPerm($forumId, 'thread')) //new thread access only.
{ {
$forumSCvars['ntUrl']= e107::url('forum','post')."?f=nt&amp;id=". $forumId;
/*--
$ntUrl = e107::url('forum','post')."?f=nt&amp;id=". $forumId; $ntUrl = e107::url('forum','post')."?f=nt&amp;id=". $forumId;
$fVars->NEWTHREADBUTTON = "<a href='".$ntUrl."'>".IMAGE_newthread.'</a>'; $fVars->NEWTHREADBUTTON = "<a href='".$ntUrl."'>".IMAGE_newthread.'</a>';
$fVars->NEWTHREADBUTTONX = newthreadjump($ntUrl); $fVars->NEWTHREADBUTTONX = newthreadjump($ntUrl);
} }
if(!BOOTSTRAP) if(!BOOTSTRAP)
{ {
$fVars->NEWTHREADBUTTONX = $fVars->NEWTHREADBUTTON; $fVars->NEWTHREADBUTTONX = $fVars->NEWTHREADBUTTON;
} }
--*/
}
if(substr($forumInfo['forum_name'], 0, 1) == '*') if(substr($forumInfo['forum_name'], 0, 1) == '*')
{ {
@@ -296,18 +312,26 @@ if(substr($forum_info['sub_parent'], 0, 1) == '*')
$forum_info['sub_parent'] = substr($forum_info['sub_parent'], 1); $forum_info['sub_parent'] = substr($forum_info['sub_parent'], 1);
} }
$forum->set_crumb(true, '', $fVars); // set $BREADCRUMB (and $BACKLINK) //----$forum->set_crumb(true, '', $fVars); // set $BREADCRUMB (and $BACKLINK)
//-- Function eventually to be reworked (move full function to shortcode file, or make a new breadcrumb function, like in downloads, maybe?)
$forum->set_crumb(true, '', $forumSCvars); // set $BREADCRUMB (and $BACKLINK)
$modUser = array(); $modUser = array();
foreach ( $modArray as $user) foreach ( $modArray as $user)
{ {
$modUser[] = "<a href='".e107::getUrl()->create('user/profile/view', $user)."'>".$user['user_name']."</a>"; $modUser[] = "<a href='".e107::getUrl()->create('user/profile/view', $user)."'>".$user['user_name']."</a>";
} }
/*--
$fVars->FORUMTITLE = $forumInfo['forum_name']; $fVars->FORUMTITLE = $forumInfo['forum_name'];
$fVars->MODERATORS = LAN_FORUM_1009.': '.implode(', ', $modUser); $fVars->MODERATORS = LAN_FORUM_1009.': '.implode(', ', $modUser);
$fVars->BROWSERS = ''; $fVars->BROWSERS = '';
--*/
$forumSCvars['forum_name']= $forumInfo['forum_name'];
$forumSCvars['modUser']= $modUser;
$forumSCvars['track_online']= varset($pref['track_online']);
/*--
if(varset($pref['track_online'])) if(varset($pref['track_online']))
{ {
$fVars->BROWSERS = $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).')'; $fVars->BROWSERS = $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).')';
@@ -346,10 +370,10 @@ else // v1.x
</table>"; </table>";
} }
--*/
// ----------------- { VIEWABLE_BY } --------------------------- // ----------------- { VIEWABLE_BY } ---------------------------
/*--
if($users = $forum->getForumClassMembers($forumId)) if($users = $forum->getForumClassMembers($forumId))
{ {
$userList = array(); $userList = array();
@@ -391,13 +415,12 @@ else
{ {
$fVars->VIEWABLE_BY = ''; $fVars->VIEWABLE_BY = '';
} }
--*/
// ------------------------------------------------------------ // ------------------------------------------------------------
///TODO XXX All these $fVars items need to be put into a shortcode class so they can be parsed with parms and wrappers. Big Job! ///TODO XXX All these $fVars items need to be put into a shortcode class so they can be parsed with parms and wrappers. Big Job!
/*--
$fVars->SEARCH = " $fVars->SEARCH = "
<form method='get' class='form-inline input-append' action='".e_BASE."search.php'> <form method='get' class='form-inline input-append' action='".e_BASE."search.php'>
<p> <p>
@@ -407,8 +430,9 @@ $fVars->SEARCH = "
<input type='hidden' name='ref' value='forum' /> <input type='hidden' name='ref' value='forum' />
</p> </p>
</form>"; </form>";
--*/
/*--
// ----- Perm Display --- // ----- Perm Display ---
$permDisplay = array(); $permDisplay = array();
@@ -427,12 +451,11 @@ $fVars->SEARCH = "
$fVars->PERMS = implode("<span class='forum-perms-separator'><!-- --></span>", $permDisplay); $fVars->PERMS = implode("<span class='forum-perms-separator'><!-- --></span>", $permDisplay);
--*/
// ------------------------------- // -------------------------------
$sticky_threads = 0; $sticky_threads = 0;
$stuck = false; $stuck = false;
$reg_threads = 0; $reg_threads = 0;
@@ -446,9 +469,12 @@ if(!empty($_GET['srch']))
} }
$threadList = $forum->forumGetThreads($forumId, $threadFrom, $view, $threadFilter); $threadList = $forum->forumGetThreads($forumId, $threadFrom, $view, $threadFilter);
/*--
$subList = $forum->forumGetSubs(vartrue($forum_id)); $subList = $forum->forumGetSubs(vartrue($forum_id));
$gen = new convert; --*/
//------$gen = new convert;
$forumSCvars['forum_parent']= $forumInfo['forum_parent'];
/*--
$fVars->SUBFORUMS = ''; $fVars->SUBFORUMS = '';
if(is_array($subList) && isset($subList[$forumInfo['forum_parent']][$forumId])) if(is_array($subList) && isset($subList[$forumInfo['forum_parent']][$forumId]))
{ {
@@ -460,7 +486,7 @@ if(is_array($subList) && isset($subList[$forumInfo['forum_parent']][$forumId]))
} }
$fVars->SUBFORUMS = $FORUM_VIEW_SUB_START.$sub_info.$FORUM_VIEW_SUB_END; $fVars->SUBFORUMS = $FORUM_VIEW_SUB_START.$sub_info.$FORUM_VIEW_SUB_END;
} }
--*/
if (count($threadList) ) if (count($threadList) )
{ {
foreach($threadList as $thread_info) foreach($threadList as $thread_info)
@@ -513,8 +539,8 @@ else
$forum_view_forum .= "<tr><td class='forumheader alert alert-warning alert-block' colspan='6'>".LAN_FORUM_1008."</td></tr>"; $forum_view_forum .= "<tr><td class='forumheader alert alert-warning alert-block' colspan='6'>".LAN_FORUM_1008."</td></tr>";
} }
$fVars->FORUMJUMP = forumjump(); //--$fVars->FORUMJUMP = forumjump();
$fVars->TOPLINK = "<a href='".e_SELF.'?'.e_QUERY."#top' onclick=\"window.scrollTo(0,0);\">".LAN_GO.'</a>'; // FIXME - TOPLINK not used anymore? //--$fVars->TOPLINK = "<a href='".e_SELF.'?'.e_QUERY."#top' onclick=\"window.scrollTo(0,0);\">".LAN_GO.'</a>'; // FIXME - TOPLINK not used anymore?
if($container_only) if($container_only)
{ {
@@ -523,13 +549,21 @@ if($container_only)
$forum_view_forum = ''; $forum_view_forum = '';
} }
$forum_view_start = $tp->simpleParse($FORUM_VIEW_START, $fVars);
$forum_view_end = $tp->simpleParse($FORUM_VIEW_END, $fVars);
$sc->setVars($forumSCvars);
//var_dump ($FORUM_VIEW_START);
// var_dump ($FORUM_VIEW_SUB);
$forum_view_start = $tp->parseTemplate($FORUM_VIEW_START, false, $sc);
$forum_view_end = $tp->parseTemplate($FORUM_VIEW_END, false, $sc);
//$forum_view_start .= "<hr><hr>FVARS FORUM<hr><hr>".$tp->simpleParse($FORUM_VIEW_START, $fVars);
//$forum_view_end = $tp->simpleParse($FORUM_VIEW_END, $fVars);
if ($forum->prefs->get('enclose')) if ($forum->prefs->get('enclose'))
{ {
// $forum_view_subs????
$ns->tablerender($forum->prefs->get('title'), $forum_view_start.$forum_view_subs.$forum_view_forum.$forum_view_end, array('forum_viewforum', 'main1')); $ns->tablerender($forum->prefs->get('title'), $forum_view_start.$forum_view_subs.$forum_view_forum.$forum_view_end, array('forum_viewforum', 'main1'));
} }
else else
@@ -546,10 +580,10 @@ echo "<script type=\"text/javascript\">
require_once(FOOTERF); require_once(FOOTERF);
function parse_thread($thread_info) function parse_thread($thread_info)
{ {
//var_dump ($thread_info);
/* OLD CODE
global $forum, $FORUM_VIEW_FORUM, $FORUM_VIEW_FORUM_STICKY, $FORUM_VIEW_FORUM_ANNOUNCE, $gen, $menu_pref, $threadsViewed; global $forum, $FORUM_VIEW_FORUM, $FORUM_VIEW_FORUM_STICKY, $FORUM_VIEW_FORUM_ANNOUNCE, $gen, $menu_pref, $threadsViewed;
$tp = e107::getParser(); $tp = e107::getParser();
$tVars = new e_vars; $tVars = new e_vars;
@@ -728,7 +762,7 @@ function parse_thread($thread_info)
$tVars['PAGES'] = ''; $tVars['PAGES'] = '';
} }
*/ */
/* OLD CODE
$tVars['PAGES'] = fpages($thread_info, $tVars['REPLIES']); $tVars['PAGES'] = fpages($thread_info, $tVars['REPLIES']);
$tVars['PAGESX'] = fpages($thread_info, $tVars['REPLIES']); $tVars['PAGESX'] = fpages($thread_info, $tVars['REPLIES']);
@@ -809,9 +843,45 @@ function parse_thread($thread_info)
$tVars['_WRAPPER_'] = 'forum_viewforum'; $tVars['_WRAPPER_'] = 'forum_viewforum';
return $tp->parseTemplate($_TEMPLATE, true, $tVars); return $tp->parseTemplate($_TEMPLATE, true, $tVars);
*/
// NEW REWRITTEN CODE
global $sc, $FORUM_VIEW_FORUM, $FORUM_VIEW_FORUM_STICKY, $FORUM_VIEW_FORUM_ANNOUNCE;
$tp = e107::getParser();
// Initial ideia, to have a separate shortcode var ($threadsc)....
// $threadsc = e107::getScBatch('viewforum', 'forum', 'viewforumthread');
// $threadsc->setVars($thread_info);
$sc->setVars($thread_info);
switch($thread_info['thread_sticky'])
{
case 1:
$_TEMPLATE = ($FORUM_VIEW_FORUM_STICKY ? $FORUM_VIEW_FORUM_STICKY : $FORUM_VIEW_FORUM);
break;
case 2:
$_TEMPLATE = ($FORUM_VIEW_FORUM_ANNOUNCE ? $FORUM_VIEW_FORUM_ANNOUNCE : $FORUM_VIEW_FORUM);
break;
default:
$_TEMPLATE = $FORUM_VIEW_FORUM;
break;
}
if(substr($_TEMPLATE,0,4) == '<tr>') // Inject id into table row. //XXX Find a better way to do this without placing in template. .
{
$threadId = $thread_info['thread_id'];
$_TEMPLATE = "<tr id='thread-{$threadId}'>".substr($_TEMPLATE,4);
}
return $tp->parseTemplate($_TEMPLATE, true, $sc);
} }
/*----
function parse_sub($subInfo) function parse_sub($subInfo)
{ {
global $FORUM_VIEW_SUB, $gen, $newflag_list; global $FORUM_VIEW_SUB, $gen, $newflag_list;
@@ -873,6 +943,7 @@ function parse_sub($subInfo)
return $tp->parseTemplate($FORUM_VIEW_SUB, true, $tVars); return $tp->parseTemplate($FORUM_VIEW_SUB, true, $tVars);
} }
----*/
function forumjump() function forumjump()
{ {
@@ -887,10 +958,10 @@ function forumjump()
return $text; return $text;
} }
function fadminoptions($thread_info) function fadminoptions($thread_info)
{ {
$tVars = new e_vars; //-- $tVars here???
//---- $tVars = new e_vars;
$e107 = e107::getInstance(); $e107 = e107::getInstance();
$tp = e107::getParser(); $tp = e107::getParser();
@@ -904,6 +975,7 @@ function fadminoptions($thread_info)
//FIXME - not fully working. //FIXME - not fully working.
$moveUrl = e107::url('forum','move', $thread_info); $moveUrl = e107::url('forum','move', $thread_info);
// What's the use of $splitUrl?????
$splitUrl = e107::url('forum','split', $thread_info); $splitUrl = e107::url('forum','split', $thread_info);
$lockUnlock = ($thread_info['thread_active'] ) ? 'lock' : 'unlock'; $lockUnlock = ($thread_info['thread_active'] ) ? 'lock' : 'unlock';
@@ -1014,9 +1086,6 @@ function fpages($thread_info, $replies)
{ {
$text = implode("",$opts); // ."</div>"; $text = implode("",$opts); // ."</div>";
} }
} }
else else
@@ -1024,24 +1093,14 @@ function fpages($thread_info, $replies)
$text = ''; $text = '';
} }
return $text; return $text;
} }
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="'.$url.'" class="btn btn-primary">'.LAN_FORUM_1018.'</a> <a href="'.$url.'" class="btn btn-primary">'.LAN_FORUM_1018.'</a>
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown"> <button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
@@ -1060,7 +1119,5 @@ function newthreadjump($url)
</div>'; </div>';
return $text; return $text;
} }
?> ?>

View File

@@ -46,7 +46,7 @@ if (!e107::isInstalled('forum'))
exit; exit;
} }
//---- orphan $highlight_search??????
$highlight_search = isset($_POST['highlight_search']); $highlight_search = isset($_POST['highlight_search']);
if (!e_QUERY) if (!e_QUERY)
@@ -129,8 +129,10 @@ if(!empty($_GET['f']))
} }
//---- getScBatch here??????
e107::getScBatch('view', 'forum')->setScVar('thread', $thread); e107::getScBatch('view', 'forum')->setScVar('thread', $thread);
//---- orphan $pm_installed??????
$pm_installed = e107::isInstalled('pm'); $pm_installed = e107::isInstalled('pm');
//Only increment thread views if not being viewed by thread starter //Only increment thread views if not being viewed by thread starter
@@ -166,6 +168,7 @@ if(count($postList))
), 250, '...')); ), 250, '...'));
} }
//---- Orphan $gen????
$gen = new convert; $gen = new convert;
if($thread->message) if($thread->message)
{ {
@@ -241,14 +244,19 @@ else
//TODO Clean up this mess!! //TODO Clean up this mess!!
// get info for main thread ------------------------------------------------------------------------------------------------------------------------------------------------------------------- // get info for main thread -------------------------------------------------------------------------------------------------------------------------------------------------------------------
$tVars = new e_vars; //---- Moved here to enclose $tVars.....
$forum->set_crumb(true, '', $tVars); // Set $BREADCRUMB (and BACKLINK) $sc = e107::getScBatch('view', 'forum');
//---- $tVars = new e_vars;
//---- $forum->set_crumb(true, '', $tVars); // Set $BREADCRUMB (and BACKLINK)
$forum->set_crumb(true, '', $thread->threadInfo); // Set $BREADCRUMB (and BACKLINK)
//$tVars->BREADCRUMB = $crumbs['breadcrumb']; //$tVars->BREADCRUMB = $crumbs['breadcrumb'];
//$tVars->BACKLINK = $tVars->BREADCRUMB; //$tVars->BACKLINK = $tVars->BREADCRUMB;
//$tVars->FORUM_CRUMB = $crumbs['forum_crumb']; //$tVars->FORUM_CRUMB = $crumbs['forum_crumb'];
$tVars->THREADNAME = $tp->toHTML($thread->threadInfo['thread_name'], true, 'no_hook, emotes_off'); //---- $tVars->THREADNAME = $tp->toHTML($thread->threadInfo['thread_name'], true, 'no_hook, emotes_off');
/*----
$prev = $forum->threadGetNextPrev('prev', $thread->threadId,$thread->threadInfo['forum_id'], $thread->threadInfo['thread_lastpost']); $prev = $forum->threadGetNextPrev('prev', $thread->threadId,$thread->threadInfo['forum_id'], $thread->threadInfo['thread_lastpost']);
$next = $forum->threadGetNextPrev('next', $thread->threadId,$thread->threadInfo['forum_id'], $thread->threadInfo['thread_lastpost']); $next = $forum->threadGetNextPrev('next', $thread->threadId,$thread->threadInfo['forum_id'], $thread->threadInfo['thread_lastpost']);
@@ -264,6 +272,7 @@ $tVars->THREADNAME = $tp->toHTML($thread->threadInfo['thread_name'], true, 'no_h
} }
$tVars->NEXTPREV = implode(" | ", $options); $tVars->NEXTPREV = implode(" | ", $options);
----*/
/* /*
$tVars->NEXTPREV = "<a class='btn btn-default btn-sm btn-small' href='" . $e107->url->create('forum/thread/prev', array('id' => $thread->threadId)) . "'>&laquo; " . LAN_FORUM_2001 . "</a>"; $tVars->NEXTPREV = "<a class='btn btn-default btn-sm btn-small' href='" . $e107->url->create('forum/thread/prev', array('id' => $thread->threadId)) . "'>&laquo; " . LAN_FORUM_2001 . "</a>";
@@ -271,6 +280,7 @@ $tVars->NEXTPREV .= ' | '; // enabled to make it look better on v1 templates
$tVars->NEXTPREV .= "<a class='btn btn-default btn-sm btn-small' href='" . $e107->url->create('forum/thread/prev', array('id' => $thread->threadId)) . "'>" . LAN_FORUM_2002 . " &raquo;</a>"; $tVars->NEXTPREV .= "<a class='btn btn-default btn-sm btn-small' href='" . $e107->url->create('forum/thread/prev', array('id' => $thread->threadId)) . "'>" . LAN_FORUM_2002 . " &raquo;</a>";
*/ */
/*----
if ($forum->prefs->get('track') && USER) if ($forum->prefs->get('track') && USER)
{ {
// BC Fix for old template. // BC Fix for old template.
@@ -314,13 +324,16 @@ if ($forum->prefs->get('track') && USER)
";*/ ";*/
/*----
$trackDiz = ($forum->prefs->get('trackemail',true)) ? LAN_FORUM_3040 : LAN_FORUM_3041; $trackDiz = ($forum->prefs->get('trackemail',true)) ? LAN_FORUM_3040 : LAN_FORUM_3041;
$tVars->TRACK = "<a id='forum-track-button' href='#' title=\"".$trackDiz."\" data-token='".deftrue('e_TOKEN','')."' data-forum-insert='forum-track-button' data-forum-post='".$thread->threadInfo['thread_forum_id']."' data-forum-thread='".$thread->threadInfo['thread_id']."' data-forum-action='track' name='track' class='e-tip btn btn-default' >".$img."</a> $tVars->TRACK = "<a id='forum-track-button' href='#' title=\"".$trackDiz."\" data-token='".deftrue('e_TOKEN','')."' data-forum-insert='forum-track-button' data-forum-post='".$thread->threadInfo['thread_forum_id']."' data-forum-thread='".$thread->threadInfo['thread_id']."' data-forum-action='track' name='track' class='e-tip btn btn-default' >".$img."</a>
"; ";
} }
----*/
/*----
$modUser = array(); $modUser = array();
foreach ( $forum->modArray as $user) foreach ( $forum->modArray as $user)
{ {
@@ -329,9 +342,11 @@ foreach ( $forum->modArray as $user)
$tVars->MODERATORS = LAN_FORUM_2003.": ". implode(', ', $modUser); $tVars->MODERATORS = LAN_FORUM_2003.": ". implode(', ', $modUser);
unset($modUser); unset($modUser);
----*/
$tVars->THREADSTATUS = (!$thread->threadInfo['thread_active'] ? LAN_FORUM_2004 : ''); //---- $tVars->THREADSTATUS = (!$thread->threadInfo['thread_active'] ? LAN_FORUM_2004 : '');
/*----
if ($thread->pages > 1) if ($thread->pages > 1)
{ {
if(!$thread->page) $thread->page = 1; if(!$thread->page) $thread->page = 1;
@@ -347,9 +362,11 @@ if ($thread->pages > 1)
$tVars->GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}"); $tVars->GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");
/* /*
$parms = ($thread->pages).",1,{$thread->page},url::forum::thread::func=view&id={$thread->threadId}&page=[FROM],off"; $parms = ($thread->pages).",1,{$thread->page},url::forum::thread::func=view&id={$thread->threadId}&page=[FROM],off";
$tVars->GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");*/ $tVars->GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");
} }
----*/
/*----
$tVars->BUTTONS = ''; $tVars->BUTTONS = '';
if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread->threadInfo['thread_active']) if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread->threadInfo['thread_active'])
{ {
@@ -364,8 +381,8 @@ if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'thread'))
// $ntUrl = $e107->url->create('forum/thread/new', array('id' => $thread->threadInfo['thread_forum_id'])); // $ntUrl = $e107->url->create('forum/thread/new', array('id' => $thread->threadInfo['thread_forum_id']));
$tVars->BUTTONS .= "<a href='" . $ntUrl . "'>" . IMAGE_newthread . "</a>"; $tVars->BUTTONS .= "<a href='" . $ntUrl . "'>" . IMAGE_newthread . "</a>";
} }
----*/
/*----
$tVars->BUTTONSX = forumbuttons($thread); $tVars->BUTTONSX = forumbuttons($thread);
function forumbuttons($thread) function forumbuttons($thread)
@@ -432,17 +449,20 @@ function forumbuttons($thread)
return $text; return $text;
} }
----*/
//---- $tVars->POLL = vartrue($pollstr);
$tVars->POLL = vartrue($pollstr); //---- $tVars->FORUMJUMP = forumjump();
$tVars->FORUMJUMP = forumjump(); //---- $tVars->MESSAGE = $thread->message;
$tVars->MESSAGE = $thread->message; $sc->setVars($thread->threadInfo);
//$forum->set_crumb(true, '', $sc); // Set $BREADCRUMB (and BACKLINK)
//---- $forstr = $tp->simpleParse($FORUMSTART, $tVars);
$forstr = $tp->simpleParse($FORUMSTART, $tVars); $forstr = $tp->parseTemplate($FORUMSTART, true, $sc);
unset($forrep); unset($forrep);
if (!$FORUMREPLYSTYLE) $FORUMREPLYSTYLE = $FORUMTHREADSTYLE; if (!$FORUMREPLYSTYLE) $FORUMREPLYSTYLE = $FORUMTHREADSTYLE;
@@ -450,7 +470,8 @@ $alt = false;
$i = $thread->page; $i = $thread->page;
$sc = e107::getScBatch('view', 'forum'); //---- Moved upwards, to enclose $tVars...
//---- $sc = e107::getScBatch('view', 'forum');
@@ -462,6 +483,7 @@ foreach ($postList as $c => $postInfo)
} }
$loop_uid = (int)$postInfo['post_user']; $loop_uid = (int)$postInfo['post_user'];
//---- Orphan $tnum????
$tnum = $i; $tnum = $i;
$i++; $i++;
@@ -564,6 +586,7 @@ $forend = $tp->simpleParse($FORUMEND, $tVars);
$forumstring = $forstr . $forthr . vartrue($forrep) . $forend; $forumstring = $forstr . $forthr . vartrue($forrep) . $forend;
//If last post came after USERLV and not yet marked as read, mark the thread id as read //If last post came after USERLV and not yet marked as read, mark the thread id as read
//---- Orphan $currentUser???
$threadsViewed = explode(',', $currentUser['user_plugin_forum_viewed']); $threadsViewed = explode(',', $currentUser['user_plugin_forum_viewed']);
if ($thread->threadInfo['thread_lastpost'] > USERLV && !in_array($thread->threadId, $threadsViewed)) if ($thread->threadInfo['thread_lastpost'] > USERLV && !in_array($thread->threadId, $threadsViewed))
@@ -610,6 +633,7 @@ function showmodoptions()
global $thread, $postInfo; global $thread, $postInfo;
$e107 = e107::getInstance(); $e107 = e107::getInstance();
//---- Orphan $forum_id????
$forum_id = $thread->threadInfo['forum_id']; $forum_id = $thread->threadInfo['forum_id'];
if ($postInfo['thread_start']) if ($postInfo['thread_start'])
{ {
@@ -650,6 +674,7 @@ function showmodoptions()
return $ret; return $ret;
} }
/*----
function forumjump() function forumjump()
{ {
global $forum; global $forum;
@@ -662,7 +687,7 @@ function forumjump()
$text .= "</select> <input class='btn btn-default button' type='submit' name='fjsubmit' value='" . LAN_GO . "' /></p></form>"; $text .= "</select> <input class='btn btn-default button' type='submit' name='fjsubmit' value='" . LAN_GO . "' /></p></form>";
return $text; return $text;
} }
----*/
function rpg($user_join, $user_forums) function rpg($user_join, $user_forums)
{ {
global $FORUMTHREADSTYLE; global $FORUMTHREADSTYLE;