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

PHP8 Fixes. Only attempt to load plugin language files when the languages folder exists. BC avatar function fix.

This commit is contained in:
Cameron
2021-01-09 09:09:12 -08:00
parent c8ba5fe30a
commit fa4900e2c4
4 changed files with 82 additions and 66 deletions

View File

@@ -26,7 +26,7 @@ function avatar($avatar)
$data = array('user_image' => $avatar); $data = array('user_image' => $avatar);
return e107::getParser()->toAvatar($data, array('type'=>'url')); return e107::getParser()->toAvatar($data, array('type'=>'url', 'w'=>100, 'h'=>100));
} }

View File

@@ -3123,10 +3123,13 @@ class e107
* "front" and "global" LANs might not be loaded come self::_getTemplate(), * "front" and "global" LANs might not be loaded come self::_getTemplate(),
* so the following calls to self::plugLan() fix that. * so the following calls to self::plugLan() fix that.
*/ */
self::plugLan($plug_name, null, true); if(is_dir(e_PLUGIN.$plug_name."/languages"))
self::plugLan($plug_name, null); {
self::plugLan($plug_name, 'global', true); self::plugLan($plug_name, null, true);
self::plugLan($plug_name, 'global'); self::plugLan($plug_name, null);
self::plugLan($plug_name, 'global', true);
self::plugLan($plug_name, 'global');
}
$id = str_replace('/', '_', $id); $id = str_replace('/', '_', $id);
$ret = self::_getTemplate($id, $key, $reg_path, $path, $info); $ret = self::_getTemplate($id, $key, $reg_path, $path, $info);
@@ -3568,9 +3571,10 @@ class e107
$ret = self::includeLan($path); $ret = self::includeLan($path);
if(($ret === false) && defset('E107_DEBUG_LEVEL') > 0) if(($ret === false) && defset('E107_DEBUG_LEVEL') > 0 && strpos($path, '_global.php') === false )
{ {
self::getMessage()->addError("Couldn't load: ".$path); $result = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 4);
self::getMessage()->addError("Couldn't load: ".$path.print_a($result,true));
} }
return $ret; return $ret;

View File

@@ -9,53 +9,60 @@
* Forum e_list Handler * Forum e_list Handler
* *
*/ */
if (!defined('e107_INIT')) { exit; } if(!defined('e107_INIT'))
{
exit;
}
//TODO: Investigate queries - needs some more sorting //TODO: Investigate queries - needs some more sorting
class list_forum class list_forum
{ {
function __construct($parent) function __construct($parent)
{ {
$this->parent = $parent; $this->parent = $parent;
} }
function getListData() function getListData()
{ {
$list_data = array();
$list_caption = $this->parent->settings['caption']; $list_caption = $this->parent->settings['caption'];
$list_display = ($this->parent->settings['open'] ? "" : "none"); $list_display = ($this->parent->settings['open'] ? "" : "none");
$bullet = $this->parent->getBullet($this->parent->settings['icon']); $bullet = $this->parent->getBullet($this->parent->settings['icon']);
if($this->parent->mode == 'new_page' || $this->parent->mode == 'new_menu' ) if($this->parent->mode == 'new_page' || $this->parent->mode == 'new_menu')
{ // New posts since last visit, up to limit { // New posts since last visit, up to limit
$lvisit = $this->parent->getlvisit(); $lvisit = $this->parent->getlvisit();
$qry = " $qry = "
SELECT t.thread_name AS parent_name, t.thread_id as parent_id, SELECT t.thread_name AS parent_name, t.thread_id as parent_id,
f.forum_id, f.forum_name, f.forum_class, f.forum_sef, f.forum_id, f.forum_name, f.forum_class, f.forum_sef,
u.user_name, lp.user_name AS lp_name, u.user_name, lp.user_name AS lp_name,
t.thread_id, t.thread_views as tviews, t.thread_name, t.thread_datestamp, t.thread_user, t.thread_id, t.thread_views, t.thread_name, t.thread_datestamp, t.thread_user,
tp.post_thread, tp.post_user, t.thread_lastpost, t.thread_lastuser, t.thread_total_replies tp.post_thread, tp.post_user, t.thread_lastpost, t.thread_lastuser, t.thread_total_replies
FROM #forum_thread AS t FROM #forum_thread AS t
LEFT JOIN #forum_post AS tp ON t.thread_id = tp.post_thread LEFT JOIN #forum_post AS tp ON t.thread_id = tp.post_thread
LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id
LEFT JOIN #user AS u ON tp.post_user = u.user_id LEFT JOIN #user AS u ON tp.post_user = u.user_id
LEFT JOIN #user AS lp ON t.thread_lastuser = lp.user_id LEFT JOIN #user AS lp ON t.thread_lastuser = lp.user_id
WHERE find_in_set(forum_class, '".USERCLASS_LIST."') WHERE find_in_set(forum_class, '" . USERCLASS_LIST . "')
AND t.thread_lastpost > {$lvisit} AND t.thread_lastpost > {$lvisit}
ORDER BY tp.post_datestamp DESC LIMIT 0,".intval($this->parent->settings['amount']); ORDER BY tp.post_datestamp DESC LIMIT 0," . intval($this->parent->settings['amount']);
} }
else else
{ // Most recently updated threads up to limit { // Most recently updated threads up to limit
$qry = " $qry = "
SELECT t.thread_id, t.thread_name AS parent_name, t.thread_datestamp, t.thread_user, t.thread_views, t.thread_lastpost, SELECT t.thread_id, t.thread_name AS parent_name, t.thread_datestamp, t.thread_user, t.thread_views, t.thread_views, t.thread_lastpost,
t.thread_lastuser, t.thread_total_replies, f.forum_id, f.forum_name, f.forum_class, f.forum_sef, u.user_name, lp.user_name AS lp_name t.thread_lastuser, t.thread_total_replies, f.forum_id, f.forum_name, f.forum_class, f.forum_sef, u.user_name, lp.user_name AS lp_name
FROM #forum_thread AS t FROM #forum_thread AS t
LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id
LEFT JOIN #user AS u ON t.thread_user = u.user_id LEFT JOIN #user AS u ON t.thread_user = u.user_id
LEFT JOIN #user AS lp ON t.thread_lastuser = lp.user_id LEFT JOIN #user AS lp ON t.thread_lastuser = lp.user_id
WHERE find_in_set(f.forum_class, '".USERCLASS_LIST."') WHERE find_in_set(f.forum_class, '" . USERCLASS_LIST . "')
ORDER BY t.thread_lastpost DESC LIMIT 0,".intval($this->parent->settings['amount']); ORDER BY t.thread_lastpost DESC LIMIT 0," . intval($this->parent->settings['amount']);
} }
@@ -66,32 +73,33 @@ class list_forum
else else
{ {
$forumArray = $this->parent->e107->sql->db_getList(); $forumArray = $this->parent->e107->sql->db_getList();
$path = e_PLUGIN."forum/"; $path = e_PLUGIN . "forum/";
foreach($forumArray as $forumInfo) foreach($forumArray as $row)
{ {
extract($forumInfo);
// extract($row);
$record = array(); $record = array();
/* Fixes #3601 Removed unused vars, fixed userid extraction /* Fixes #3601 Removed unused vars, fixed userid extraction
//last user //last user
$r_id = substr($thread_lastuser, 0, strpos($thread_lastuser, ".")); $r_id = substr($thread_lastuser, 0, strpos($thread_lastuser, "."));
$r_name = substr($thread_lastuser, (strpos($thread_lastuser, ".")+1)); $r_name = substr($thread_lastuser, (strpos($thread_lastuser, ".")+1));
if (strstr($thread_lastuser, chr(1))) { if (strstr($thread_lastuser, chr(1))) {
$tmp = explode(chr(1), $thread_lastuser); $tmp = explode(chr(1), $thread_lastuser);
$r_name = $tmp[0]; $r_name = $tmp[0];
} }
$thread_lastuser = $r_id; $thread_lastuser = $r_id;
//user //user
$u_id = substr($thread_user, 0, strpos($thread_user, ".")); $u_id = substr($thread_user, 0, strpos($thread_user, "."));
$u_name = substr($thread_user, (strpos($thread_user, ".")+1)); $u_name = substr($thread_user, (strpos($thread_user, ".")+1));
$thread_user = $u_id; $thread_user = $u_id;
*/ */
if (isset($thread_anon)) if(isset($thread_anon))
{ {
/* /*
$tmp = explode(chr(1), $thread_anon); $tmp = explode(chr(1), $thread_anon);
@@ -100,31 +108,32 @@ class list_forum
*/ */
$thread_user = $thread_anon; $thread_user = $thread_anon;
} }
$gen = new convert; $r_datestamp = e107::getDate()->convert_date($row['thread_lastpost'], "short");
$r_datestamp = $gen->convert_date($thread_lastpost, "short");
if($thread_total_replies) if($row['thread_total_replies'])
{ {
$LASTPOST = ""; $LASTPOST = "";
if($lp_name) if($row['lp_name'])
{ {
//$LASTPOST = "<a href='".e_HTTP."user.php ?id.{$thread_lastuser}'>$lp_name</a>"; //$LASTPOST = "<a href='".e_HTTP."user.php ?id.{$thread_lastuser}'>$lp_name</a>";
$uparams = array('id' => $thread_lastuser, 'name' => $lp_name); $uparams = array('id' => $row['thread_lastuser'], 'name' => $row['lp_name']);
$link = e107::getUrl()->create('user/profile/view', $uparams); $link = e107::getUrl()->create('user/profile/view', $uparams);
$LASTPOST = "<a href='".$link."'>".$lp_name."</a>"; $LASTPOST = "<a href='" . $link . "'>" . $row['lp_name'] . "</a>";
} }
else else
{ {
if($thread_lastuser[0] == "0") if($row['thread_lastuser'][0] == "0")
{ {
$LASTPOST = substr($thread_lastuser, 2); $LASTPOST = substr($row['thread_lastuser'], 2);
} }
//else //else
// { // {
//$LASTPOST = NFPM_L16; //$LASTPOST = NFPM_L16;
// } // }
} }
$LASTPOST .= " ".LIST_FORUM_6." <span class='smalltext'>$r_datestamp</span>";
$LASTPOST .= " " . LIST_FORUM_6 . " <span class='smalltext'>$r_datestamp</span>";
} }
else else
{ {
@@ -132,42 +141,45 @@ class list_forum
$LASTPOSTDATE = ''; $LASTPOSTDATE = '';
} }
if($parent_name == '') if(empty($row['parent_name']))
{ {
$parent_name = $thread_name; $row['parent_name'] = $row['thread_name'];
} }
$rowheading = $this->parent->parse_heading($parent_name);
$rowheading = $this->parent->parse_heading($row['parent_name']);
//$lnk = ($parent_id ? $thread_id.".post" : $thread_id); //$lnk = ($parent_id ? $thread_id.".post" : $thread_id);
//"<a href='".e_HTTP."user.php ?id.$thread_user'>$user_name</a>" //"<a href='".e_HTTP."user.php ?id.$thread_user'>$user_name</a>"
$uparams = array('id' => $thread_user, 'name' => $user_name); $uparams = array('id' => $row['thread_user'], 'name' => $row['user_name']);
$link = e107::getUrl()->create('user/profile/view', $uparams); $link = e107::getUrl()->create('user/profile/view', $uparams);
$userlink = "<a href='".$link."'>".$user_name."</a>"; $userlink = "<a href='" . $link . "'>" . $row['user_name'] . "</a>";
//$record['heading'] = "<a href='".$path."forum_viewtopic.php?$lnk'>".$rowheading."</a>"; //$record['heading'] = "<a href='".$path."forum_viewtopic.php?$lnk'>".$rowheading."</a>";
$record['heading'] = '<a href="'.e107::url('forum', 'topic', array('thread_id' => $thread_id, 'thread_sef' => eHelper::title2sef($parent_name), 'forum_sef' => $forum_sef)).'">'.$rowheading.'</a>'; $record['heading'] = '<a href="' . e107::url('forum', 'topic', array('thread_id' => $row['thread_id'], 'thread_sef' => eHelper::title2sef($row['parent_name']), 'forum_sef' => $row['forum_sef'])) . '">' . $rowheading . '</a>';
$record['author'] = ($this->parent->settings['author'] ? ($thread_anon ? $thread_user : $userlink) : ""); $record['author'] = ($this->parent->settings['author'] ? ($row['thread_anon'] ? $row['thread_user'] : $userlink) : "");
//$record['category'] = ($this->parent->settings['category'] ? "<a href='".$path."forum_viewforum.php?$forum_id'>$forum_name</a>" : ""); //$record['category'] = ($this->parent->settings['category'] ? "<a href='".$path."forum_viewforum.php?$forum_id'>$forum_name</a>" : "");
$record['category'] = ($this->parent->settings['category'] ? '<a href="'.e107::url('forum', 'forum', array('forum_sef' => $forum_sef)).'">'.$forum_name.'</a>' : ""); $record['category'] = ($this->parent->settings['category'] ? '<a href="' . e107::url('forum', 'forum', array('forum_sef' => $row['forum_sef'])) . '">' . $row['forum_name'] . '</a>' : "");
$record['date'] = ($this->parent->settings['date'] ? $this->parent->getListDate($thread_datestamp) : ""); $record['date'] = ($this->parent->settings['date'] ? $this->parent->getListDate($row['thread_datestamp']) : "");
$record['icon'] = $bullet; $record['icon'] = $bullet;
$VIEWS = $thread_views; $VIEWS = $row['thread_views'];
$REPLIES = $thread_total_replies; $REPLIES = $row['thread_total_replies'];
if($thread_total_replies)
if($row['thread_total_replies'])
{ {
$record['info'] = "[ ".LIST_FORUM_3." ".$VIEWS.", ".LIST_FORUM_4." ".$REPLIES.", ".LIST_FORUM_5." ".$LASTPOST." ]"; $record['info'] = "[ " . LIST_FORUM_3 . " " . $VIEWS . ", " . LIST_FORUM_4 . " " . $REPLIES . ", " . LIST_FORUM_5 . " " . $LASTPOST . " ]";
} }
else else
{ {
$record['info'] = "[ ".LIST_FORUM_3." ".intval($tviews)." ]"; $record['info'] = "[ " . LIST_FORUM_3 . " " . intval($row['thread_views']) . " ]";
} }
$list_data[] = $record; $list_data[] = $record;
} }
} }
//return array with 'records', (global)'caption', 'display' //return array with 'records', (global)'caption', 'display'
return array( return array(
'records'=>$list_data, 'records' => $list_data,
'caption'=>$list_caption, 'caption' => $list_caption,
'display'=>$list_display 'display' => $list_display
); );
} }
} }

View File

@@ -260,7 +260,7 @@ class online_shortcodes extends e_shortcode
$online_location_page = 'comment'; $online_location_page = 'comment';
} }
list($oid, $oname) = explode('.', $uinfo, 2); // list($oid, $oname) = explode('.', $uinfo, 2);
$data = array( $data = array(
'oid' => $row['user_id'], 'oid' => $row['user_id'],