1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-13 00:52:07 +02:00

Forum: PHP7 parser fix.

This commit is contained in:
Cameron 2016-02-15 19:59:47 -08:00
parent 9f96a70e76
commit 1e9da76395
5 changed files with 39 additions and 23 deletions

View File

@ -724,7 +724,7 @@ if ($e107_popup != 1) {
// M: Send top of body for custom pages and for news
//
//XXX - remove all page detections
if (e_PAGE == 'news.php' && isset($NEWSHEADER))
if (defset('e_PAGE') == 'news.php' && isset($NEWSHEADER))
{
parseheader($NEWSHEADER);
}

View File

@ -891,17 +891,19 @@ class e_parse extends e_parser
protected function simpleReplace($tmp)
{
$unset = ($this->replaceUnset !== false ? $this->replaceUnset : $tmp[0]);
$key = $tmp[1];
if(is_array($this->replaceVars))
{
$this->replaceVars = new e_vars($this->replaceVars);
//return ($this->replaceVars[$key] !== null ? $this->replaceVars[$key]: $unset);
}
//
return ($this->replaceVars->$tmp[1] !== null ? $this->replaceVars->$tmp[1] : $unset); // Doesn't work.
$key = $tmp[1]; // PHP7 fix.
return ($this->replaceVars->$key !== null ? $this->replaceVars->$key : $unset); // Doesn't work.
}
function htmlwrap($str, $width, $break = "\n", $nobreak = "a", $nobr = "pre", $utf = FALSE)
{
/*

View File

@ -835,7 +835,8 @@ class e_parse_shortcode
{
if ($this->eVars->isVar($matches[1]))
{
return $this->eVars->$matches[1];
$match1 = $matches[1]; // php7 fix.
return $this->eVars->$match1;
}
}
if (strpos($matches[1], E_NL) !== false)

View File

@ -259,7 +259,8 @@ if (USER && vartrue($allread) != TRUE && $total_new_threads && $total_new_thread
$fVars->INFO .= "<br /><a href='".e_SELF."?mark.all.as.read'>".LAN_FORUM_0057.'</a>'.(e_QUERY != 'new' ? ", <a href='".e_SELF."?new'>".LAN_FORUM_0058."</a>" : '');
}
if (USER && vartrue($forum->prefs->get('track')) && e_QUERY != 'track')
$trackPref = $forum->prefs->get('track');
if (USER && vartrue($trackPref) && e_QUERY != 'track')
{
$fVars->INFO .= "<br /><a href='".e_SELF."?track'>".LAN_FORUM_0030.'</a>';
}
@ -421,8 +422,8 @@ function parse_forum($f, $restricted_string = '')
$fVars->REPLIESX = "<span class='badge {$badgeReplies}'>".$f['forum_replies']."</span>";
if(is_array($forumList['subs'][$f['forum_id']]))
$subId = $f['forum_id'];
if(!empty($forumList['subs']) && is_array($forumList['subs'][$subId]))
{
list($lastpost_datestamp, $lastpost_thread) = explode('.', $f['forum_lastpost_info']);
$ret = parse_subs($forumList, $f['forum_id'], $lastpost_datestamp);
@ -469,6 +470,8 @@ function parse_forum($f, $restricted_string = '')
$fVars->LASTPOSTDATE = "-";
$fVars->LASTPOST = '-';
}
return $tp->simpleParse($FORUM_MAIN_FORUM, $fVars);
}
@ -483,9 +486,13 @@ function parse_subs($forumList, $id ='', $lastpost_datestamp)
$subList = $forumList['subs'][$id];
$ret['text'] = '';
$ret['threads'] = 0;
$ret['replies'] = 0;
foreach($subList as $sub)
{
// print_a($sub);
$ret['text'] .= ($ret['text'] ? ', ' : '');
$urlData = $sub;
@ -501,7 +508,7 @@ function parse_subs($forumList, $id ='', $lastpost_datestamp)
{
$ret['lastpost_info'] = $sub['forum_lastpost_info'];
$ret['lastpost_user'] = $sub['forum_lastpost_user'];
$ret['lastpost_user_anon'] = $sub['lastpost_user_anon'];
$ret['lastpost_user_anon'] = $sub['forum_lastpost_user_anon'];
$ret['user_name'] = $sub['user_name'];
$lastpost_datestamp = $tmp[0];
}
@ -542,7 +549,7 @@ if (e_QUERY == 'new')
$forum_newstring .= $tp->simpleParse($FORUM_NEWPOSTS_MAIN, $nVars);
}
if (!$newThreadList)
if (empty($newThreadList))
{
$nVars->NEWSPOSTNAME = LAN_FORUM_0029;
$forum_newstring = $tp->simpleParse($FORUM_NEWPOSTS_MAIN, $nVars);
@ -574,7 +581,7 @@ $forum_main_end = $tp->simpleParse($FORUM_MAIN_END, $fVars);
if ($forum->prefs->get('enclose'))
{
$ns->tablerender($forum->prefs->get('title'), $forum_main_start.$forum_string.$forum_main_end, array('forum', 'main3'));
$ns->tablerender($forum->prefs->get('title'), $forum_main_start.$forum_string.$forum_main_end, 'forum');
}
else
{

View File

@ -13,7 +13,7 @@ if(!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
if (!$FORUM_VIEW_START)
if (empty($FORUM_VIEW_START))
{
$FORUM_VIEW_START = "
@ -55,7 +55,7 @@ $FORUM_VIEW_START = "
</tr>";
}
if(!$FORUM_VIEW_START_CONTAINER)
if(empty($FORUM_VIEW_START_CONTAINER))
{
$FORUM_VIEW_START_CONTAINER = "
<div style='text-align:center'>
@ -71,7 +71,7 @@ if(!$FORUM_VIEW_START_CONTAINER)
}
if (!$FORUM_VIEW_FORUM) {
if (empty($FORUM_VIEW_FORUM)) {
$FORUM_VIEW_FORUM = "
<tr>
<td style='vertical-align:middle; text-align:center; width:3%' class='forumheader3'>{ICON}</td>
@ -93,7 +93,8 @@ if (!$FORUM_VIEW_FORUM) {
</tr>";
}
if (!$FORUM_VIEW_FORUM_STICKY) {
if (empty($FORUM_VIEW_FORUM_STICKY))
{
$FORUM_VIEW_FORUM_STICKY = "
<tr>
<td style='vertical-align:middle; text-align:center; width:3%' class='forumheader3'>{ICON}</td>
@ -115,7 +116,8 @@ if (!$FORUM_VIEW_FORUM_STICKY) {
</tr>";
}
if (!$FORUM_VIEW_FORUM_ANNOUNCE) {
if (empty($FORUM_VIEW_FORUM_ANNOUNCE))
{
$FORUM_VIEW_FORUM_ANNOUNCE = "
<tr>
<td style='vertical-align:middle; text-align:center; width:3%' class='forumheader3'>{ICON}</td>
@ -137,7 +139,8 @@ if (!$FORUM_VIEW_FORUM_ANNOUNCE) {
</tr>";
}
if (!$FORUM_VIEW_END) {
if (empty($FORUM_VIEW_END))
{
$FORUM_VIEW_END = "
</table>
</div>
@ -191,7 +194,7 @@ if (!$FORUM_VIEW_END) {
}
if(!$FORUM_VIEW_END_CONTAINER)
if(empty($FORUM_VIEW_END_CONTAINER))
{
$FORUM_VIEW_END_CONTAINER = "
<table style='".USER_WIDTH."'>
@ -206,7 +209,7 @@ if(!$FORUM_VIEW_END_CONTAINER)
}
if (!$FORUM_VIEW_SUB_START)
if (empty($FORUM_VIEW_SUB_START))
{
$FORUM_VIEW_SUB_START = "
<tr>
@ -224,7 +227,8 @@ if (!$FORUM_VIEW_SUB_START)
";
}
if (!$FORUM_VIEW_SUB) {
if (empty($FORUM_VIEW_SUB))
{
$FORUM_VIEW_SUB = "
<tr>
<td class='forumheader3' style='text-align:center'>{NEWFLAG}</td>
@ -236,7 +240,8 @@ if (!$FORUM_VIEW_SUB) {
";
}
if (!$FORUM_VIEW_SUB_END) {
if (empty($FORUM_VIEW_SUB_END))
{
$FORUM_VIEW_SUB_END = "
</table><br /><br />
</div>
@ -245,12 +250,13 @@ if (!$FORUM_VIEW_SUB_END) {
";
}
if (!$FORUM_IMPORTANT_ROW) {
if (empty($FORUM_IMPORTANT_ROW)) {
$FORUM_IMPORTANT_ROW = "<tr><td class='forumheader'>&nbsp;</td><td colspan='5' class='forumheader'><span class='mediumtext'><b>".LAN_FORUM_1006."</b></span></td></tr>";
}
if (!$FORUM_NORMAL_ROW) {
if (empty($FORUM_NORMAL_ROW))
{
$FORUM_NORMAL_ROW = "<tr><td class='forumheader'>&nbsp;</td><td colspan='5' class='forumheader'><span class='mediumtext'><b>".LAN_FORUM_1007."</b></span></td></tr>";
}