1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 11:50:30 +02:00

More BC Fixes on forum templates.

This commit is contained in:
Cameron
2017-12-12 15:03:23 -08:00
parent ea073afe9a
commit 7e33124335
5 changed files with 81 additions and 48 deletions

View File

@@ -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;

View File

@@ -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 .= "<tr><td class='forumheader'>&nbsp;</td><td colspan='5' class='forumheader'><span class='mediumtext'><b>".LAN_FORUM_1006."</b></span></td></tr>";
$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 .= "<tr><td class='forumheader'>&nbsp;</td><td colspan='5' class='forumheader'><span class='mediumtext'><b>".LAN_FORUM_1007."</b></span></td></tr>";
if(!empty($FORUM_IMPORTANT_ROW))
{
$forum_view_forum .= $FORUM_IMPORTANT_ROW;
}
else
{
$forum_view_forum .= "<tr><td class='forumheader'>&nbsp;</td><td colspan='5' class='forumheader'><span class='mediumtext'><b>" . LAN_FORUM_1006 . "</b></span></td></tr>";
}
$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 .= "<tr><td class='forumheader'>&nbsp;</td><td colspan='5' class='forumheader'><span class='mediumtext'><b>" . LAN_FORUM_1007 . "</b></span></td></tr>";
}
$unstuck = true;
}
$forum_view_forum .= parse_thread($thread_info);
}
$forum_view_forum .= parse_thread($thread_info);
}
}
else
{
$forum_view_forum .= deftrue('BOOTSTRAP')?"<div class='alert alert-warning'>".LAN_FORUM_1008."</div>":
$forum_view_forum .= deftrue('BOOTSTRAP') ? "<div class='alert alert-warning'>".LAN_FORUM_1008."</div>":
"<tr><td class='forumheader alert alert-warning alert-block' colspan='6'>".LAN_FORUM_1008."</td></tr>";
}
@@ -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); // ."</div>";
$text = implode(" ",$opts); // ."</div>";
}
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -21,10 +21,6 @@ $FORUM_VIEW_START = "
<div class='spacer'>
<table style='".USER_WIDTH."' class='fborder table' >
<tr>
<td class='fcaption'>{BREADCRUMB}</td>
</tr>
{SUBFORUMS}
<tr>
<td style='width:80%' class='forumheader'>
<span class='mediumtext'>{FORUMTITLE}</span></td>
</tr>
@@ -165,7 +161,7 @@ if (empty($FORUM_VIEW_END))
<div class='spacer'>
<table class='fborder table' style='".USER_WIDTH."'>
<tr>
<td style='vertical-align:middle; width:50%' class='forumheader3'><span class='smalltext'>{MODERATORS}</span></td>
<td style='vertical-align:middle; width:50%' class='forumheader3'><span class='smalltext'>{LAN=LAN_FORUM_1009}: {MODERATORS}</span></td>
<td style='vertical-align:middle; width:50%' class='forumheader3'><span class='smalltext'>{BROWSERS}</span></td>
</tr>
</table>