diff --git a/e107_core/shortcodes/single/nextprev.php b/e107_core/shortcodes/single/nextprev.php index f5250b22c..48691ba13 100644 --- a/e107_core/shortcodes/single/nextprev.php +++ b/e107_core/shortcodes/single/nextprev.php @@ -77,6 +77,13 @@ function nextprev_shortcode($parm = '') // Calculate $total_items = intval($parm['total']); + + if(empty($total_items)) + { + e107::getDebug()->log("Next Prev has zero total items"); + return null; + } + $check_render = true; if(vartrue($parm['glyphs']) && (deftrue('BOOTSTRAP'))) @@ -156,6 +163,8 @@ function nextprev_shortcode($parm = '') break; default: + var_dump($total_items); + $total_pages = ceil($total_items/$perpage); $last_page = ceil($total_pages*$perpage)-$perpage; $current_page = ($current_start/$perpage) + 1; diff --git a/e107_plugins/forum/forum_viewforum.php b/e107_plugins/forum/forum_viewforum.php index 97449aafb..0b4ae069a 100644 --- a/e107_plugins/forum/forum_viewforum.php +++ b/e107_plugins/forum/forum_viewforum.php @@ -127,6 +127,7 @@ if (!$forum->checkPerm($forumId, 'view')) } $forumInfo = $forum->forumGet($forumId); +$forumSCvars = array(); //----$threadsViewed = $forum->threadGetUserViewed(); if (empty($FORUM_VIEW_START)) @@ -253,7 +254,7 @@ if ($message) } --*/ -$threadCount = $forumInfo['forum_threads']; +$threadCount = (int) $forumInfo['forum_threads']; if ($threadCount > $view) { @@ -265,7 +266,6 @@ else } - if ($pages) { if(strpos($FORUM_VIEW_START, 'THREADPAGES') !== false || strpos($FORUM_VIEW_END, 'THREADPAGES') !== false) @@ -490,56 +490,63 @@ if(is_array($subList) && isset($subList[$forumInfo['forum_parent']][$forumId])) $fVars->SUBFORUMS = $FORUM_VIEW_SUB_START.$sub_info.$FORUM_VIEW_SUB_END; } --*/ -if (count($threadList) ) -{ - foreach($threadList as $thread_info) + if(count($threadList)) { - if($thread_info['thread_options']) + foreach($threadList as $thread_info) { - $thread_info['thread_options'] = unserialize($thread_info['thread_options']); - } - else - { - $thread_info['thread_options'] = array(); - } - if ($thread_info['thread_sticky']) - { - $sticky_threads ++; - } - if ($sticky_threads > 0 && !$stuck && $forum->prefs->get('hilightsticky')) - { - if($FORUM_IMPORTANT_ROW) + if($thread_info['thread_options']) { - $forum_view_forum .= $FORUM_IMPORTANT_ROW; + $thread_info['thread_options'] = unserialize($thread_info['thread_options']); } else { - $forum_view_forum .= " ".LAN_FORUM_1006.""; + $thread_info['thread_options'] = array(); } - $stuck = true; - } - if (!$thread_info['thread_sticky']) - { - $reg_threads ++; - } - if ($reg_threads == '1') // Removed as not needed in new template. && !$unstuck && $stuck - { - if($FORUM_NORMAL_ROW) + + if($thread_info['thread_sticky']) { - $forum_view_forum .= $FORUM_NORMAL_ROW; + $sticky_threads++; } - else + + if($sticky_threads > 0 && !$stuck && $forum->prefs->get('hilightsticky')) { - $forum_view_forum .= " ".LAN_FORUM_1007.""; + if(!empty($FORUM_IMPORTANT_ROW)) + { + $forum_view_forum .= $FORUM_IMPORTANT_ROW; + } + else + { + $forum_view_forum .= " " . LAN_FORUM_1006 . ""; + } + + $stuck = true; } - $unstuck = true; + + if(!$thread_info['thread_sticky']) + { + $reg_threads++; + } + + if($reg_threads === 1 && (THEME_LEGACY === true && $reg_threads === 1 && $stuck === true && $unstuck !== true)) // Removed as not needed in new template. && !$unstuck && $stuck + { + if(!empty($FORUM_NORMAL_ROW)) + { + $forum_view_forum .= $FORUM_NORMAL_ROW; + } + else + { + $forum_view_forum .= " " . LAN_FORUM_1007 . ""; + } + + $unstuck = true; + } + + $forum_view_forum .= parse_thread($thread_info); } - $forum_view_forum .= parse_thread($thread_info); } -} else { - $forum_view_forum .= deftrue('BOOTSTRAP')?"
".LAN_FORUM_1008."
": + $forum_view_forum .= deftrue('BOOTSTRAP') ? "
".LAN_FORUM_1008."
": "".LAN_FORUM_1008.""; } @@ -1033,8 +1040,12 @@ function fpages($thread_info, $replies) { global $forum; $tp = e107::getParser(); + + $replies = (int) $replies; + $postsPerPage = (int) $forum->prefs->get('postspage'); - $pages = ceil(($replies)/$forum->prefs->get('postspage')); + $pages = ceil(($replies)/$postsPerPage); + $thread_info['thread_sef'] = eHelper::title2sef($thread_info['thread_name'],'dashl'); $urlparms = $thread_info; $text = ''; @@ -1091,7 +1102,7 @@ function fpages($thread_info, $replies) } else { - $text = implode("",$opts); // .""; + $text = implode(" ",$opts); // .""; } } diff --git a/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php b/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php index 58f0a4fac..9d5c6a272 100644 --- a/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php +++ b/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php @@ -167,7 +167,7 @@ class forum_shortcodes extends e_shortcode function sc_search() { - if(!$srchIcon = e107::getParser()->toGlyph('fa-search')) + if(!deftrue('FONTAWESOME') || !$srchIcon = e107::getParser()->toGlyph('fa-search')) { $srchIcon = LAN_SEARCH; } diff --git a/e107_plugins/forum/shortcodes/batch/viewforum_shortcodes.php b/e107_plugins/forum/shortcodes/batch/viewforum_shortcodes.php index d5f2e4557..41b952369 100644 --- a/e107_plugins/forum/shortcodes/batch/viewforum_shortcodes.php +++ b/e107_plugins/forum/shortcodes/batch/viewforum_shortcodes.php @@ -57,6 +57,10 @@ function sc_threadpages() { + if(empty($this->var['parms'])) + { + return null; + } return e107::getParser()->parseTemplate("{NEXTPREV={$this->var['parms']}}"); } @@ -143,7 +147,7 @@ function sc_moderators() { - return $this->var['modUser']; + return is_array($this->var['modUser']) ? implode(", ",$this->var['modUser']) : $this->var['modUser']; } function sc_browsers() @@ -635,9 +639,15 @@ } - function sc_replies() + function sc_replies($parm='') { $val = ($this->var['thread_total_replies']) ? $this->var['thread_total_replies'] : '0'; + + if($parm === 'raw') + { + return $val; + } + return e107::getParser()->toBadge($val); } @@ -895,7 +905,14 @@ function sc_pages() { // $tVars['PAGES'] = fpages($thread_info, $tVars['REPLIES']); - return fpages($this->var, $this->sc_replies()); + $ret = fpages($this->var, $this->sc_replies('raw')); + + if(!empty($ret)) + { + return LAN_GOPAGE.": ".$ret; + } + + return null; } diff --git a/e107_plugins/forum/templates/forum_viewforum_template.php b/e107_plugins/forum/templates/forum_viewforum_template.php index f2ea0b965..9c84889b5 100644 --- a/e107_plugins/forum/templates/forum_viewforum_template.php +++ b/e107_plugins/forum/templates/forum_viewforum_template.php @@ -21,10 +21,6 @@ $FORUM_VIEW_START = "
- - - {SUBFORUMS} - @@ -165,7 +161,7 @@ if (empty($FORUM_VIEW_END))
{BREADCRUMB}
{FORUMTITLE}
- +
{MODERATORS}{LAN=LAN_FORUM_1009}: {MODERATORS} {BROWSERS}