1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

$online_shortcodes now loaded correctly using e107::getScBatch(). (Could break old plugins)

This commit is contained in:
Cameron 2021-01-08 13:47:54 -08:00
parent eec9a163cb
commit 0fabc9aa9c
4 changed files with 25 additions and 28 deletions

View File

@ -14,32 +14,26 @@
* $Author$
*/
if (!defined('e107_INIT')) { exit; }
e107::includeLan(e_PLUGIN.'online/languages/'.e_LANGUAGE.'.php');
if(class_exists('online_shortcodes'))
if(!defined('e107_INIT'))
{
$online_shortcodes = new online_shortcodes;
}
else
{
require_once(e_PLUGIN.'online/online_shortcodes.php');
exit;
}
$online_shortcodes = e107::getScBatch('online', true);
if(THEME_LEGACY !== true)
{
$LASTSEEN_TEMPLATE = e107::getTemplate('online','online_menu', 'lastseen'); // $ONLINE_MENU_TEMPLATE['lastseen'];
$LASTSEEN_TEMPLATE = e107::getTemplate('online', 'online_menu', 'lastseen'); // $ONLINE_MENU_TEMPLATE['lastseen'];
}
else
{
if (is_readable(THEME.'online_menu_template.php'))
if(is_readable(THEME . 'online_menu_template.php'))
{
require(THEME.'online_menu_template.php');
require(THEME . 'online_menu_template.php');
}
else
{
require(e_PLUGIN.'online/templates/online_menu_template.php');
require(e_PLUGIN . 'online/templates/online_menu_template.php');
$LASTSEEN_TEMPLATE = $ONLINE_MENU_TEMPLATE['lastseen'];
}
@ -48,21 +42,23 @@ else
$menu_pref = e107::getConfig('menu')->getPref();
$tp = e107::getParser();
$num = intval(vartrue($menu_pref['online_ls_amount'],10));
$num = intval(vartrue($menu_pref['online_ls_amount'], 10));
$sql->select('user', 'user_id, user_name, user_currentvisit', 'ORDER BY user_currentvisit DESC LIMIT 0,'.$num, 'nowhere');
$lslist = $sql -> db_getList();
$sql->select('user', 'user_id, user_name, user_currentvisit', 'ORDER BY user_currentvisit DESC LIMIT 0,' . $num, 'nowhere');
$lslist = $sql->db_getList();
$text = $tp->parseTemplate($LASTSEEN_TEMPLATE['start'], true);
$text = $tp -> parseTemplate($LASTSEEN_TEMPLATE['start'], true);
foreach($lslist as $row)
{
// setScVar('online_shortcodes', 'currentUser', $row);
// $online_shortcodes->setScVar('currentUser', $row);
$online_shortcodes->currentUser = $row;
$text .= $tp -> parseTemplate($LASTSEEN_TEMPLATE['item'],true, $online_shortcodes);
$text .= $tp->parseTemplate($LASTSEEN_TEMPLATE['item'], true, $online_shortcodes);
}
$text .= $tp -> parseTemplate($LASTSEEN_TEMPLATE['end'], true, $online_shortcodes);
$caption = vartrue($menu_pref['online_ls_caption'],LAN_LASTSEEN_1);
$text .= $tp->parseTemplate($LASTSEEN_TEMPLATE['end'], true, $online_shortcodes);
$caption = vartrue($menu_pref['online_ls_caption'], LAN_LASTSEEN_1);
e107::getRender()->tablerender($caption, $text, 'lastseen');

View File

@ -13,16 +13,16 @@
if (!defined('e107_INIT')) { exit; }
//global $pref;
global $menu_pref;
$menu_pref = e107::getConfig('menu')->getPref();
$tp = e107::getParser();
e107::includeLan(e_PLUGIN.'online/languages/'.e_LANGUAGE.'.php');
require_once(e_PLUGIN.'online/online_shortcodes.php');
// require_once(e_PLUGIN.'online/online_shortcodes.php');
$mode = empty($menu_pref['online_show_memberlist_extended']) ? 'default' : 'extended';
$online_shortcodes = new online_shortcodes;
$online_shortcodes = e107::getScBatch('online', true);
$online_shortcodes->wrapper('online_menu/'.$mode);
if(deftrue('BOOTSTRAP'))

View File

@ -12,8 +12,8 @@
if (!defined('e107_INIT')) { exit; }
register_shortcode('online_shortcodes', true);
$online_shortcodes = initShortcodeClass('online_shortcodes');
//register_shortcode('online_shortcodes', true);
// $online_shortcodes = initShortcodeClass('online_shortcodes');
e107::plugLan('online', null);
@ -73,6 +73,7 @@ class online_shortcodes extends e_shortcode
}
$seen_ago = $this->gen->computeLapse($this->currentUser['user_currentvisit'], false, false, true, 'short');
return $seen_ago;
// return ($seen_ago ? $seen_ago : '1 '.LANDT_09).' '.LANDT_AGO;
}

View File

@ -12,7 +12,7 @@ $ONLINE_MENU_TEMPLATE = array();
// Last seen Menu
$ONLINE_MENU_TEMPLATE['lastseen']['start'] = "<ul class='list-group lastseen-menu'>";
$ONLINE_MENU_TEMPLATE['lastseen']['item'] = "<li class='list-group-item d-flex justify-content-between align-items-center'>{LASTSEEN_USERLINK} <small class='muted'>{LASTSEEN_DATE}</small></li>";
$ONLINE_MENU_TEMPLATE['lastseen']['item'] = "<li class='list-group-item d-flex justify-content-between align-items-center'>{LASTSEEN_USERLINK} <small class='muted pull-right'>{LASTSEEN_DATE}</small></li>";
$ONLINE_MENU_TEMPLATE['lastseen']['end'] = "</ul>";