1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-13 18:14:26 +02:00

Online Menu upgrades.

This commit is contained in:
Cameron
2016-04-28 13:17:36 -07:00
parent 501514b06f
commit 3a74aea669
10 changed files with 469 additions and 217 deletions

View File

@@ -24,92 +24,112 @@ $tp = e107::getParser();
include_lan(e_PLUGIN.'online/languages/'.e_LANGUAGE.'.php');
require_once(e_PLUGIN.'online/online_shortcodes.php');
$mode = empty($menu_pref['online_show_memberlist_extended']) ? 'default' : 'extended';
$online_shortcodes->wrapper('online_menu/'.$mode);
if (is_readable(THEME.'templates/online/online_menu_template.php'))
if(deftrue('BOOTSTRAP'))
{
require(THEME.'templates/online/online_menu_template.php');
}
elseif (is_readable(THEME.'online_menu_template.php'))
{
require(THEME.'online_menu_template.php');
}
else
{
require(e_PLUGIN.'online/online_menu_template.php');
$ONLINE_TEMPLATE = e107::getTemplate('online', 'online_menu', $mode);
}
else
{
// legacy default ------------------------
global $sc_style;
$sc_style['ONLINE_GUESTS']['pre'] = "<li>".LAN_ONLINE_1;
$sc_style['ONLINE_GUESTS']['post'] = "</li>";
$sc_style['ONLINE_MEMBERS']['pre'] = "<li>".LAN_ONLINE_2;
$sc_style['ONLINE_MEMBERS']['post'] = "</li>";
$sc_style['ONLINE_MEMBERS_LIST']['pre'] = "<ul>";
$sc_style['ONLINE_MEMBERS_LIST']['post'] = "</ul>";
$sc_style['ONLINE_MEMBERS_LIST_EXTENDED']['pre'] = "<ul class='unstyled list-unstyled'>";
$sc_style['ONLINE_MEMBERS_LIST_EXTENDED']['post'] = "</ul>";
$sc_style['ONLINE_ONPAGE']['pre'] = "<li>".LAN_ONLINE_3;
$sc_style['ONLINE_ONPAGE']['post'] = "</li>";
$sc_style['ONLINE_MEMBER_TOTAL']['pre'] = "<li>".LAN_ONLINE_2;
$sc_style['ONLINE_MEMBER_TOTAL']['post'] = "</li>";
$sc_style['ONLINE_MEMBER_NEWEST']['pre'] = "<li>".LAN_ONLINE_6;
$sc_style['ONLINE_MEMBER_NEWEST']['post'] = "</li>";
$sc_style['ONLINE_MOST']['pre'] = LAN_ONLINE_8;
$sc_style['ONLINE_MOST']['post'] = "<br />";
$sc_style['ONLINE_MOST_MEMBERS']['pre'] = LAN_ONLINE_2;
$sc_style['ONLINE_MOST_MEMBERS']['post'] = "";
$sc_style['ONLINE_MOST_GUESTS']['pre'] = "".LAN_ONLINE_1;
$sc_style['ONLINE_MOST_GUESTS']['post'] = ", ";
$sc_style['ONLINE_MOST_DATESTAMP']['pre'] = "".LAN_ONLINE_9;
$sc_style['ONLINE_MOST_DATESTAMP']['post'] = "";
$ONLINE_TEMPLATE['enabled'] = "
<ul class='online-menu'>
{ONLINE_GUESTS}
{ONLINE_MEMBERS}
{ONLINE_MEMBERS_LIST_EXTENDED}
{ONLINE_ONPAGE}
{ONLINE_MEMBER_TOTAL}
{ONLINE_MEMBER_NEWEST}
<li>
{ONLINE_MOST}
<small class='muted'>
{ONLINE_MOST_GUESTS}
{ONLINE_MOST_MEMBERS}
{ONLINE_MOST_DATESTAMP}
</small>
</li>
</ul>
";
//##### ONLINE TRACKING DISABLED ----------------------------------------------
$ONLINE_TEMPLATE['disabled'] = "{ONLINE_TRACKING_DISABLED}";
//##### ONLINE MEMBER LIST EXTENDED -------------------------------------------
$ONLINE_TEMPLATE['online_members_list_extended'] = "{SETIMAGE: w=40}<li class='media'><span class='media-object pull-left'>{ONLINE_MEMBER_IMAGE=avatar}</span><span class='media-body'>{ONLINE_MEMBER_USER} ".LAN_ONLINE_7." {ONLINE_MEMBER_PAGE}</span></li>";
if (is_readable(THEME.'templates/online/online_menu_template.php'))
{
require(THEME.'templates/online/online_menu_template.php');
}
elseif (is_readable(THEME.'online_menu_template.php'))
{
require(THEME.'online_menu_template.php');
}
else
{
require(e_PLUGIN.'online/templates/online_menu_template.php');
}
}
$online_shortcodes->memberTemplate = $ONLINE_TEMPLATE['online_members_list_extended'];
$online_shortcodes->newestTemplate = $ONLINE_TEMPLATE['online_member_newest'];
//if(!defined('e_TRACKING_DISABLED') && varsettrue($pref['track_online']))
if(!defined('e_TRACKING_DISABLED'))
{
//display list of 'member viewing page'
if (e107::getConfig('menu')->get('online_show_memberlist_extended'))
{
if (MEMBERS_ONLINE)
{
// global $listuserson;
$listuserson = e107::getOnline()->userList();
$ret='';
foreach($listuserson as $uinfo => $row)
{
if($row['user_active'] != 1)
{
continue;
}
$pinfo = $row['user_location'];
$online_location_page = str_replace('.php', '', substr(strrchr($pinfo, '/'), 1));
if ($pinfo == 'log.php' || $pinfo == 'error.php')
{
$pinfo = 'news.php';
$online_location_page = 'news';
}
elseif ($online_location_page == 'request.php')
{
$pinfo = 'download.php';
$online_location_page = 'news';
}
elseif (strstr($online_location_page, 'forum'))
{
$pinfo = e_PLUGIN.'forum/forum.php';
$online_location_page = 'forum';
}
elseif (strstr($online_location_page, 'content'))
{
$pinfo = 'content.php';
$online_location_page = 'content';
}
elseif (strstr($online_location_page, 'comment'))
{
$pinfo = 'comment.php';
$online_location_page = 'comment';
}
list($oid, $oname) = explode('.', $uinfo, 2);
$data = array(
'oid' => $row['user_id'],
'oname' =>$row['user_name'],
'page' => $online_location_page,
'pinfo' => $pinfo,
'oimage' => $row['user_image']
);
setScVar('online_shortcodes', 'currentMember', $data);
$ret .= $tp->parseTemplate($ONLINE_TEMPLATE['online_members_list_extended'], TRUE);
}
setScVar('online_shortcodes', 'onlineMembersList', $ret);
}
}
$text = $tp->parseTemplate($ONLINE_TEMPLATE['enabled'], TRUE);
$text = $tp->parseTemplate($ONLINE_TEMPLATE['enabled'], TRUE, $online_shortcodes);
}
else
{
if (ADMIN)
{
$text = $tp->parseTemplate($ONLINE_TEMPLATE['disabled'], TRUE);
$text = $tp->parseTemplate($ONLINE_TEMPLATE['disabled'], TRUE, $online_shortcodes);
}
else
{
@@ -119,15 +139,14 @@ else
$img = (is_readable(THEME.'images/online_menu.png') ? "<img src='".THEME_ABS."images/online_menu.png' alt='' />" : '');
$caption = $img.' '.vartrue($menu_pref['online_caption'],LAN_ONLINE_10);
$caption = $img.' '.vartrue($menu_pref['online_caption'], LAN_ONLINE_4);
if (getperms('1'))
{
$path = e_PLUGIN_ABS."online/config.php";
$caption .= "<a class='pull-right' href='".$path."' title='Configure'><i class='icon-cog'></i></a>";
$path = e_PLUGIN_ABS."online/config.php?iframe=1";
$caption .= "<a class='e-modal pull-right' href='".$path."' title='Configure'><i class='glyphicon glyphicon-cog'></i></a>";
}
$ns->tablerender($caption, $text, 'online_extended');
e107::getRender()->tablerender($caption, $text, 'online_extended');
?>