diff --git a/e107_handlers/shortcode_handler.php b/e107_handlers/shortcode_handler.php
index 1e683ae76..736f75de6 100644
--- a/e107_handlers/shortcode_handler.php
+++ b/e107_handlers/shortcode_handler.php
@@ -813,6 +813,14 @@ class e_parse_shortcode
{
$this->addedCodes = &$extraCodes;
+ if(isset($extraCodes['_WRAPPER_']))
+ {
+ $tmpWrap = e107::templateWrapper($extraCodes['_WRAPPER_']);
+ $this->wrappers = array_merge($this->wrappers,$tmpWrap);
+ $this->wrapper = $extraCodes['_WRAPPER_'];
+ unset($extraCodes['_WRAPPER_']);
+ }
+
/*
foreach ($extraCodes as $sc => $code)
{
@@ -1177,7 +1185,13 @@ class e_parse_shortcode
{
list($wrapTmpl, $wrapID1, $wrapID2) = explode('/',$this->wrapper,3);
- $wrapActive = strtoupper($wrapTmpl)."_WRAPPER['".$wrapID1."']";
+ $wrapActive = strtoupper($wrapTmpl)."_WRAPPER";
+
+ if(!empty($wrapID1))
+ {
+ $wrapActive .= "['".$wrapID1."']";
+ }
+
if(!empty($wrapID2))
{
$wrapActive .= "['".$wrapID2."']";
diff --git a/e107_plugins/forum/forum_viewforum.php b/e107_plugins/forum/forum_viewforum.php
index c939cf3f7..2e857a404 100644
--- a/e107_plugins/forum/forum_viewforum.php
+++ b/e107_plugins/forum/forum_viewforum.php
@@ -125,28 +125,38 @@ if (!$forum->checkPerm($forumId, 'view'))
$forumInfo = $forum->forumGet($forumId);
$threadsViewed = $forum->threadGetUserViewed();
-if (!vartrue($FORUM_VIEW_START))
+if (empty($FORUM_VIEW_START))
{
- if(file_exists(THEME.'templates/forum/forum_viewforum_template.php'))
+ if(deftrue('BOOTSTRAP'))
{
- require_once(THEME.'templates/forum/forum_viewforum_template.php');
- }
- elseif (file_exists(THEME.'forum_viewforum_template.php'))
- {
- require_once(THEME.'forum_viewforum_template.php');
- }
- elseif (file_exists(THEME.'forum_template.php'))
- {
- require_once(THEME.'forum_template.php');
+ $FORUM_VIEWFORUM_TEMPLATE = e107::getTemplate('forum','forum_viewforum');
}
else
{
- require_once(e_PLUGIN.'forum/templates/forum_viewforum_template.php');
+ if(file_exists(THEME.'templates/forum/forum_viewforum_template.php'))
+ {
+ require_once(THEME.'templates/forum/forum_viewforum_template.php');
+ }
+ elseif (file_exists(THEME.'forum_viewforum_template.php'))
+ {
+ require_once(THEME.'forum_viewforum_template.php');
+ }
+ elseif (file_exists(THEME.'forum_template.php'))
+ {
+ require_once(THEME.'forum_template.php');
+ }
+ else
+ {
+ require_once(e_PLUGIN.'forum/templates/forum_viewforum_template.php');
+ }
+
}
+
+
}
-if(is_array($FORUM_VIEWFORUM_TEMPLATE) && deftrue('BOOTSTRAP',false)) // New v2.x bootstrap Template.
+if(!empty($FORUM_VIEWFORUM_TEMPLATE) && is_array($FORUM_VIEWFORUM_TEMPLATE) && deftrue('BOOTSTRAP',false)) // New v2.x bootstrap Template.
{
$FORUM_VIEW_START_CONTAINER = $FORUM_VIEWFORUM_TEMPLATE['start'];
@@ -541,40 +551,42 @@ function parse_thread($thread_info)
$threadId = $thread_info['thread_id'];
$forumId = $thread_info['thread_forum_id'];
- $tVars->VIEWS = $thread_info['thread_views'];
- $tVars->REPLIES = $thread_info['thread_total_replies'];
+ $tVars = array();
+
+ $tVars['VIEWS'] = $thread_info['thread_views'];
+ $tVars['REPLIES'] = $thread_info['thread_total_replies'];
$badge = ($thread_info['thread_views'] > 0) ? "badge-info" : "";
- $tVars->REPLIESX = "".$thread_info['thread_total_replies']."";
- $tVars->VIEWSX = "".$thread_info['thread_views']."";
+ $tVars['REPLIESX'] = "".$thread_info['thread_total_replies']."";
+ $tVars['VIEWSX'] = "".$thread_info['thread_views']."";
- if ($tVars->REPLIES)
+ if ($tVars['REPLIES'])
{
$lastpost_datestamp = $gen->convert_date($thread_info['thread_lastpost'], 'forum');
if($thread_info['lastpost_username'])
{
// XXX hopefully & is not allowed in user name - it would break parsing of url parameters, change to array if something wrong happens
$url = e107::getUrl()->create('user/profile/view', "name={$thread_info['lastpost_username']}&id={$thread_info['thread_lastuser']}");
- $tVars->LASTPOST = "".$thread_info['lastpost_username']."";
- $tVars->LASTPOSTUSER = "".$thread_info['lastpost_username']."";
+ $tVars['LASTPOST'] = "".$thread_info['lastpost_username']."";
+ $tVars['LASTPOSTUSER'] = "".$thread_info['lastpost_username']."";
}
else
{
if(!$thread_info['thread_lastuser'])
{
- $tVars->LASTPOST = $tp->toHTML($thread_info['thread_lastuser_anon']);
- $tVars->LASTPOSTUSER = $tp->toHTML($thread_info['thread_lastuser_anon']);
+ $tVars['LASTPOST'] = $tp->toHTML($thread_info['thread_lastuser_anon']);
+ $tVars['LASTPOSTUSER'] = $tp->toHTML($thread_info['thread_lastuser_anon']);
}
else
{
- $tVars->LASTPOST = LAN_FORUM_1015;
- $tVars->LASTPOSTUSER = LAN_FORUM_1015;
+ $tVars['LASTPOST'] = LAN_FORUM_1015;
+ $tVars['LASTPOSTUSER'] = LAN_FORUM_1015;
}
}
- $tVars->LASTPOST .= '
'.$lastpost_datestamp;
+ $tVars['LASTPOST'] .= '
'.$lastpost_datestamp;
- $tVars->LASTPOSTUSER = $thread_info['lastpost_username']; // $lastpost_name;
+ $tVars['LASTPOSTUSER'] = $thread_info['lastpost_username']; // $lastpost_name;
$thread_info['thread_sef'] = eHelper::title2sef($thread_info['thread_name'],'dashl');
@@ -583,46 +595,46 @@ function parse_thread($thread_info)
$url .= (strpos($url,'?')!==false) ? '&' : '?';
$url .= "last=1#post-".$thread_info['lastpost_id'];
- $tVars->LASTPOSTDATE .= "". $gen->computeLapse($thread_info['thread_lastpost'],time(), false, false, 'short')."";
+ $tVars['LASTPOSTDATE'] .= "". $gen->computeLapse($thread_info['thread_lastpost'],time(), false, false, 'short')."";
}
$newflag = (USER && $thread_info['thread_lastpost'] > USERLV && !in_array($thread_info['thread_id'], $threadsViewed));
- $tVars->THREADDATE = $gen->convert_date($thread_info['thread_datestamp'], 'forum');
+ $tVars['THREADDATE'] = $gen->convert_date($thread_info['thread_datestamp'], 'forum');
- $tVars->THREADTIMELAPSE = $gen->computeLapse($thread_info['thread_datestamp'],time(), false, false, 'short'); // convert_date($thread_info['thread_datestamp'], 'forum');
+ $tVars['THREADTIMELAPSE'] = $gen->computeLapse($thread_info['thread_datestamp'],time(), false, false, 'short'); // convert_date($thread_info['thread_datestamp'], 'forum');
/// ---------- Icon ----------------
- $tVars->ICON = ($newflag ? IMAGE_new : IMAGE_nonew);
- if ($tVars->REPLIES >= $forum->prefs->get('popular', 10))
+ $tVars['ICON'] = ($newflag ? IMAGE_new : IMAGE_nonew);
+ if ($tVars['REPLIES'] >= $forum->prefs->get('popular', 10))
{
- $tVars->ICON = ($newflag ? IMAGE_new_popular : IMAGE_nonew_popular);
+ $tVars['ICON'] = ($newflag ? IMAGE_new_popular : IMAGE_nonew_popular);
}
- elseif(empty($tVars->REPLIES) && defined('IMAGE_noreplies'))
+ elseif(empty($tVars['REPLIES']) && defined('IMAGE_noreplies'))
{
- $tVars->ICON = IMAGE_noreplies;
+ $tVars['ICON'] = IMAGE_noreplies;
}
- $tVars->THREADTYPE = '';
+ $tVars['THREADTYPE'] = '';
if ($thread_info['thread_sticky'] == 1)
{
- $tVars->ICON = ($thread_info['thread_active'] ? IMAGE_sticky : IMAGE_stickyclosed);
- $tVars->THREADTYPE = '['.LAN_FORUM_1011.']
';
+ $tVars['ICON'] = ($thread_info['thread_active'] ? IMAGE_sticky : IMAGE_stickyclosed);
+ $tVars['THREADTYPE'] = '['.LAN_FORUM_1011.']
';
}
elseif($thread_info['thread_sticky'] == 2)
{
- $tVars->ICON = IMAGE_announce;
- $tVars->THREADTYPE = '['.LAN_FORUM_1013.']
';
+ $tVars['ICON'] = IMAGE_announce;
+ $tVars['THREADTYPE'] = '['.LAN_FORUM_1013.']
';
}
elseif(!$thread_info['thread_active'])
{
- $tVars->ICON = IMAGE_closed;
+ $tVars['ICON'] = IMAGE_closed;
}
-// $tVars->ICON = $tVars->REPLIES;
+// $tVars['ICON'] = $tVars['REPLIES'];
// ------------------------------------------------------
@@ -657,18 +669,18 @@ function parse_thread($thread_info)
{
$title = '';
}
- // $tVars->THREADNAME = " $threadId, 'name' => $thread_name))."'>{$thread_name}";
+ // $tVars['THREADNAME'] = " $threadId, 'name' => $thread_name))."'>{$thread_name}";
// $url = e107::getUrl()->create('forum/thread/view', array('id' => $threadId, 'name' => $thread_name));
$thread_info['thread_sef'] = eHelper::title2sef($thread_info['thread_name'],'dashl');
$url = e107::url('forum','topic', $thread_info);
- $tVars->THREADNAME = "{$thread_name}";
+ $tVars['THREADNAME'] = "{$thread_name}";
// FIXME - pages -> convert to nextprev shortcode
/*
- $pages = ceil(($tVars->REPLIES)/$forum->prefs->get('postspage'));
+ $pages = ceil(($tVars['REPLIES'])/$forum->prefs->get('postspage'));
$urlparms = $thread_info;
if ($pages > 1)
{
@@ -677,19 +689,19 @@ function parse_thread($thread_info)
for($a = 0; $a <= 2; $a++)
{
$aa = $a + 1;
- $tVars->PAGES .= $tVars->PAGES ? ' ' : '';
+ $tVars['PAGES'] .= $tVars['PAGES'] ? ' ' : '';
$urlparms['page'] = $aa;
$url = e107::getUrl()->create('forum/thread/view', $urlparms);
- $tVars->PAGES .= "{$aa}";
+ $tVars['PAGES'] .= "{$aa}";
}
- $tVars->PAGES .= ' ... ';
+ $tVars['PAGES'] .= ' ... ';
for($a = $pages-3; $a <= $pages-1; $a++)
{
$aa = $a + 1;
- $tVars->PAGES .= $tVars->PAGES ? ' ' : '';
+ $tVars['PAGES'] .= $tVars['PAGES'] ? ' ' : '';
$urlparms['page'] = $aa;
$url = e107::getUrl()->create('forum/thread/view', $urlparms);
- $tVars->PAGES .= "{$aa}";
+ $tVars['PAGES'] .= "{$aa}";
}
}
else
@@ -697,23 +709,23 @@ function parse_thread($thread_info)
for($a = 0; $a <= ($pages-1); $a++)
{
$aa = $a + 1;
- $tVars->PAGES .= $tVars->PAGES ? ' ' : '';
+ $tVars['PAGES'] .= $tVars['PAGES'] ? ' ' : '';
$urlparms['page'] = $aa;
$url = e107::getUrl()->create('forum/thread/view', $urlparms);
- $tVars->PAGES .= "{$aa}";
+ $tVars['PAGES'] .= "{$aa}";
}
}
- $tVars->PAGES = LAN_GOTO.' [ '.$tVars->PAGES.' ]';
+ $tVars['PAGES'] = LAN_GOTO.' [ '.$tVars['PAGES'].' ]';
}
else
{
- $tVars->PAGES = '';
+ $tVars['PAGES'] = '';
}
*/
- $tVars->PAGES = fpages($thread_info, $tVars->REPLIES);
- $tVars->PAGESX = fpages($thread_info, $tVars->REPLIES);
+ $tVars['PAGES'] = fpages($thread_info, $tVars['REPLIES']);
+ $tVars['PAGESX'] = fpages($thread_info, $tVars['REPLIES']);
if (MODERATOR)
{
@@ -723,7 +735,7 @@ function parse_thread($thread_info)
$moveUrl = e107::url('forum','move', $thread_info);
- $tVars->ADMIN_ICONS = "
+ $tVars['ADMIN_ICONS'] = "