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'] = "
".($thread_info['thread_sticky'] == 1 ? " " : " ")." @@ -732,32 +744,32 @@ function parse_thread($thread_info)
'; - $tVars->ADMINOPTIONS = fadminoptions($thread_info); + $tVars['ADMINOPTIONS'] = fadminoptions($thread_info); } if($thread_info['user_name']) { - $tVars->POSTER = " $thread_info['thread_user'], 'name' => $thread_info['user_name']))."'>".$thread_info['user_name'].""; + $tVars['POSTER'] = " $thread_info['thread_user'], 'name' => $thread_info['user_name']))."'>".$thread_info['user_name'].""; } else { if($thread_info['thread_user_anon']) { - $tVars->POSTER = $tp->toHTML($thread_info['thread_user_anon']); + $tVars['POSTER'] = $tp->toHTML($thread_info['thread_user_anon']); } else { - $tVars->POSTER = LAN_FORUM_1015; + $tVars['POSTER'] = LAN_FORUM_1015; } } - if (!$tVars->REPLIES) + if (!$tVars['REPLIES']) { - $tVars->REPLIES = '0'; - $tVars->REPLIESX = "0"; - $tVars->LASTPOST = ' - '; - $tVars->LASTPOSTDATE = ' - '; + $tVars['REPLIES'] = '0'; + $tVars['REPLIESX'] = "0"; + $tVars['LASTPOST'] = ' - '; + $tVars['LASTPOSTDATE'] = ' - '; } switch($thread_info['thread_sticky']) @@ -783,14 +795,14 @@ function parse_thread($thread_info) if(!deftrue('BOOTSTRAP')) { - $tVars->REPLIESX = $tVars->REPLIES; - $tVars->VIEWSX = $tVars->VIEWS; - $tVars->ADMINOPTIONS = $tVars->ADMIN_ICONS; + $tVars['REPLIESX'] = $tVars['REPLIES']; + $tVars['VIEWSX'] = $tVars['VIEWS']; + $tVars['ADMINOPTIONS'] = $tVars['ADMIN_ICONS']; } - + $tVars['_WRAPPER_'] = 'forum_viewforum'; - return $tp->simpleParse($_TEMPLATE, $tVars); + return $tp->parseTemplate($_TEMPLATE, true, $tVars); } @@ -798,31 +810,31 @@ function parse_sub($subInfo) { global $FORUM_VIEW_SUB, $gen, $newflag_list; $tp = e107::getParser(); - $tVars = new e_vars; +// $tVars = new e_vars; $forumName = $tp->toHTML($subInfo['forum_name'], true); - $tVars->SUB_FORUMTITLE = "{$forumName}"; - $tVars->SUB_DESCRIPTION = $tp->toHTML($subInfo['forum_description'], false, 'no_hook'); - $tVars->SUB_THREADS = $subInfo['forum_threads']; - $tVars->SUB_REPLIES = $subInfo['forum_replies']; + $tVars['SUB_FORUMTITLE'] = "{$forumName}"; + $tVars['SUB_DESCRIPTION'] = $tp->toHTML($subInfo['forum_description'], false, 'no_hook'); + $tVars['SUB_THREADS'] = $subInfo['forum_threads']; + $tVars['SUB_REPLIES'] = $subInfo['forum_replies']; $badgeReplies = ($subInfo['forum_replies']) ? "badge-info" : ""; $badgeThreads = ($subInfo['forum_replies']) ? "badge-info" : ""; - $tVars->SUB_THREADSX = "".$subInfo['forum_threads'].""; - $tVars->SUB_REPLIESX = "".$subInfo['forum_replies'].""; + $tVars['SUB_THREADSX'] = "".$subInfo['forum_threads'].""; + $tVars['SUB_REPLIESX'] = "".$subInfo['forum_replies'].""; -// $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(USER && is_array($newflag_list) && in_array($subInfo['forum_id'], $newflag_list)) { - $tVars->NEWFLAG = "".IMAGE_new.''; + $tVars['NEWFLAG'] = "".IMAGE_new.''; } else { - $tVars->NEWFLAG = IMAGE_nonew; + $tVars['NEWFLAG'] = IMAGE_nonew; } if($subInfo['forum_lastpost_info']) @@ -839,18 +851,21 @@ function parse_sub($subInfo) { $lp_name = $subInfo['forum_lastpost_user_anon']; } - $tVars->SUB_LASTPOST = $lp_date.'
'.$lp_name.' '.$lp_thread; + $tVars['SUB_LASTPOST'] = $lp_date.'
'.$lp_name.' '.$lp_thread; - $tVars->SUB_LASTPOSTDATE = $gen->computeLapse($tmp[0], time(), false, false, 'short'); - $tVars->SUB_LASTPOSTUSER = $lp_name; + $tVars['SUB_LASTPOSTDATE'] = $gen->computeLapse($tmp[0], time(), false, false, 'short'); + $tVars['SUB_LASTPOSTUSER'] = $lp_name; } else { - $tVars->SUB_LASTPOST = '-'; - $tVars->SUB_LASTPOSTUSER = ''; - $tVars->SUB_LASTPOSTDATE = ''; + $tVars['SUB_LASTPOST'] = '-'; + $tVars['SUB_LASTPOSTUSER'] = ''; + $tVars['SUB_LASTPOSTDATE'] = ''; } - return $tp->simpleParse($FORUM_VIEW_SUB, $tVars); + + $tVars['_WRAPPER_'] = 'forum_viewforum'; + + return $tp->parseTemplate($FORUM_VIEW_SUB, true, $tVars); } function forumjump() diff --git a/e107_plugins/forum/templates/forum_viewforum_template.php b/e107_plugins/forum/templates/forum_viewforum_template.php index 6dff6ca35..df34d66d6 100644 --- a/e107_plugins/forum/templates/forum_viewforum_template.php +++ b/e107_plugins/forum/templates/forum_viewforum_template.php @@ -284,11 +284,10 @@ $FORUM_CRUMB['forum']['value'] = "{FORUM_TITLE}"; // New in v2.x - requires a bootstrap theme be loaded. -// {BREADCRUMB} //FIXME Breadcrumb looks crummy -//TODO Find a good place to put a {SEARCH} dropdown. +//TODO Find a good place to put a {SEARCH} dropdown. $FORUM_VIEWFORUM_TEMPLATE['start'] = ""; -$FORUM_VIEWFORUM_TEMPLATE['header'] = "
{BACKLINK}
+$FORUM_VIEWFORUM_TEMPLATE['header'] = "
{BREADCRUMB}

{FORUMTITLE}

{NEWTHREADBUTTONX}
@@ -384,21 +383,9 @@ $FORUM_VIEWFORUM_TEMPLATE['iconkey'] = " +// $FORUM_VIEWFORUM_WRAPPER['THREADNAME'] = "{---}"; - - - - - - - - - - - - -?> \ No newline at end of file