mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 12:48:24 +01:00
Online Menu upgrades.
This commit is contained in:
parent
501514b06f
commit
3a74aea669
@ -321,8 +321,20 @@ class e_online
|
||||
}
|
||||
|
||||
|
||||
function userList()
|
||||
function userList($debug=false)
|
||||
{
|
||||
|
||||
if($debug === true)
|
||||
{
|
||||
//print_a($this->users);
|
||||
$data = e107::getDb()->retrieve('user', 'user_id,user_name,user_image, 1 as user_active, CONCAT_WS(".",user_id,user_name) as online_user_id', "LIMIT 7", true);
|
||||
|
||||
// print_a($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
return $this->users;
|
||||
}
|
||||
|
||||
|
@ -430,6 +430,12 @@ class e_parse_shortcode
|
||||
echo "<div class='alert alert-danger'>Couldn't Load: <b>".$path."</b> with class-name:<b> {$className}</b> and pluginName <b>{$pluginName}</b></div>";
|
||||
}
|
||||
}
|
||||
elseif(E107_DBG_INCLUDES)
|
||||
{
|
||||
// echo "<h3>Couldn't Find Class '".$className."' in <b>".$path."</b></h3>";
|
||||
}
|
||||
|
||||
e107::getDebug()->log( "<div class='alert alert-danger'>Couldn't Load: <b>".$path."</b> with class-name:<b> {$className}</b> and pluginName <b>{$pluginName}</b></div>");
|
||||
|
||||
|
||||
// TODO - throw exception?
|
||||
|
@ -24,24 +24,12 @@ require_once(e_ADMIN.'auth.php');
|
||||
$mes = e107::getMessage();
|
||||
$frm = e107::getForm();
|
||||
|
||||
$menu_pref = e107::getConfig('menu')->getPref('');
|
||||
|
||||
if (!isset($menu_pref['online_ls_caption']))
|
||||
{ // Assume that if one isn't set, none are set
|
||||
$menu_pref['online_ls_caption'] = 'LAN_LASTSEEN_1'; //caption for the lastseen_menu
|
||||
$menu_pref['online_ls_amount'] = 10; //amount of records to show in the lastseen_menu
|
||||
$menu_pref['online_caption'] = 'LAN_ONLINE_10'; //caption for the online_menu
|
||||
$menu_pref['online_show_memberlist'] = true; //toggle whether to show a simple member list of online members (shwoing user1, user2, user3)
|
||||
$menu_pref['online_show_memberlist_extended'] = false; //toggle whether to show the extended member list of online members (showing 'user viewing page')
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['update_menu']))
|
||||
if (isset($_POST['update_menu']))
|
||||
{
|
||||
$temp = array();
|
||||
while (list($key, $value) = each($_POST))
|
||||
while (list($key, $value) = each($_POST))
|
||||
{
|
||||
if ($value != LAN_UPDATE)
|
||||
if ($value != LAN_UPDATE)
|
||||
{
|
||||
$temp[$key] = $value;
|
||||
}
|
||||
@ -56,13 +44,31 @@ if (isset($_POST['update_menu']))
|
||||
$menuPref->setPref($k, $v);
|
||||
}
|
||||
$menuPref->save(false, true, false);
|
||||
$mes->addSuccess(LAN_SAVED);
|
||||
}
|
||||
//$ns->tablerender('', "<div style='text-align:center'><b>".LAN_UPDATED.'</b></div>');
|
||||
$ns->tablerender($caption, $mes->render() . $text);
|
||||
|
||||
echo $mes->render();
|
||||
}
|
||||
|
||||
$menu_pref = e107::getConfig('menu')->getPref('');
|
||||
|
||||
if (!isset($menu_pref['online_ls_caption']))
|
||||
{ // Assume that if one isn't set, none are set
|
||||
$menu_pref['online_ls_caption'] = 'LAN_LASTSEEN_1'; //caption for the lastseen_menu
|
||||
$menu_pref['online_ls_amount'] = 10; //amount of records to show in the lastseen_menu
|
||||
$menu_pref['online_caption'] = 'LAN_ONLINE_4'; //caption for the online_menu
|
||||
$menu_pref['online_show_memberlist'] = true; //toggle whether to show a simple member list of online members (shwoing user1, user2, user3)
|
||||
$menu_pref['online_show_memberlist_extended'] = false; //toggle whether to show the extended member list of online members (showing 'user viewing page')
|
||||
$menu_pref['online_show_guests'] = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$text = "
|
||||
<form method='post' action='".e_SELF."' id='menu_form'>
|
||||
<form method='post' action='".e_REQUEST_URI."' id='menu_form'>
|
||||
<fieldset id='core-menu-config-lastseen'>
|
||||
<legend>".LAN_ONLINE_ADMIN_1."</legend>
|
||||
<table class='table adminform'>
|
||||
@ -98,6 +104,10 @@ $text = "
|
||||
<td>".LAN_ONLINE_ADMIN_5.":</td>
|
||||
<td><input class='tbox' type='text' name='online_caption' size='30' value='".$tp->toHTML($menu_pref['online_caption'],"","defs")."' maxlength='200' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>".LAN_ONLINE_ADMIN_10."</td>
|
||||
<td>".$frm->radio_switch('online_show_guests', $menu_pref['online_show_guests'])."</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>".LAN_ONLINE_ADMIN_6."</td>
|
||||
<td>".$frm->radio_switch('online_show_memberlist', $menu_pref['online_show_memberlist'])."<span class='field-help'>".LAN_ONLINE_ADMIN_8."</span></td>
|
||||
|
@ -30,6 +30,8 @@ define("LAN_ONLINE_8", "Most ever online: ");
|
||||
define("LAN_ONLINE_9", "on ");
|
||||
define("LAN_ONLINE_10", "Online Menu");
|
||||
|
||||
define("LAN_ONLINE_11", "Total registered members:");
|
||||
|
||||
//admin
|
||||
//define("LAN_ONLINE_ADMIN_ENABLED", "enabled");
|
||||
//define("LAN_ONLINE_ADMIN_DISABLED", "disabled");
|
||||
@ -43,7 +45,8 @@ define("LAN_ONLINE_ADMIN_5", "Caption online menu");
|
||||
define("LAN_ONLINE_ADMIN_6", "Show list of members online?");
|
||||
define("LAN_ONLINE_ADMIN_7", "Show extended list of members online?");
|
||||
define("LAN_ONLINE_ADMIN_8", "Displays a comma seperated list of members.");
|
||||
define("LAN_ONLINE_ADMIN_9", "Displays a list of members viewing a page.")
|
||||
define("LAN_ONLINE_ADMIN_9", "Displays a list of members viewing a page.");
|
||||
define("LAN_ONLINE_ADMIN_10", "Display guests online.");
|
||||
|
||||
|
||||
?>
|
@ -17,33 +17,53 @@
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
include_lan(e_PLUGIN.'online/languages/'.e_LANGUAGE.'.php');
|
||||
require_once(e_PLUGIN.'online/online_shortcodes.php');
|
||||
if (is_readable(THEME.'online_menu_template.php'))
|
||||
|
||||
if(class_exists('online_shortcodes'))
|
||||
{
|
||||
require(THEME.'online_menu_template.php');
|
||||
}
|
||||
else
|
||||
$online_shortcodes = new online_shortcodes;
|
||||
}
|
||||
else
|
||||
{
|
||||
require(e_PLUGIN.'online/online_menu_template.php');
|
||||
require_once(e_PLUGIN.'online/online_shortcodes.php');
|
||||
}
|
||||
|
||||
$menu_pref = e107::getConfig('menu')->getPref('');
|
||||
if(deftrue('BOOTSTRAP'))
|
||||
{
|
||||
$LASTSEEN_TEMPLATE = e107::getTemplate('online','lastseen'); // $ONLINE_MENU_TEMPLATE['lastseen'];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (is_readable(THEME.'online_menu_template.php'))
|
||||
{
|
||||
require(THEME.'online_menu_template.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
require(e_PLUGIN.'online/templates/online_menu_template.php');
|
||||
$LASTSEEN_TEMPLATE = $ONLINE_MENU_TEMPLATE['lastseen'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$menu_pref = e107::getConfig('menu')->getPref();
|
||||
$tp = e107::getParser();
|
||||
|
||||
$num = intval(vartrue($menu_pref['online_ls_amount'],10));
|
||||
|
||||
$sql -> db_Select('user', 'user_id, user_name, user_currentvisit', 'ORDER BY user_currentvisit DESC LIMIT 0,'.$num, 'nowhere');
|
||||
$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);
|
||||
$text .= $tp -> parseTemplate($LASTSEEN_TEMPLATE['item'],TRUE);
|
||||
// setScVar('online_shortcodes', 'currentUser', $row);
|
||||
$online_shortcodes->currentUser = $row;
|
||||
$text .= $tp -> parseTemplate($LASTSEEN_TEMPLATE['item'],true, $online_shortcodes);
|
||||
}
|
||||
$text .= $tp -> parseTemplate($LASTSEEN_TEMPLATE['end'], TRUE);
|
||||
$text .= $tp -> parseTemplate($LASTSEEN_TEMPLATE['end'], true, $online_shortcodes);
|
||||
|
||||
$caption = vartrue($menu_pref['online_ls_caption'],LAN_LASTSEEN_1);
|
||||
$ns->tablerender($caption, $text, 'lastseen');
|
||||
|
||||
e107::getRender()->tablerender($caption, $text, 'lastseen');
|
||||
|
||||
?>
|
@ -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');
|
||||
|
||||
?>
|
@ -1,85 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* e107 Main
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/online/online_menu_template.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
global $sc_style;
|
||||
//##### LASTSEEN MENU ---------------------------------------------------------
|
||||
|
||||
$LASTSEEN_TEMPLATE['start'] = "<ul class='lastseen-menu '>";
|
||||
$LASTSEEN_TEMPLATE['item'] = "<li>{LASTSEEN_USERLINK} <small class='muted'>{LASTSEEN_DATE}</small></li>";
|
||||
$LASTSEEN_TEMPLATE['end'] = "</ul>";
|
||||
|
||||
//##### ONLINE MENU -----------------------------------------------------------
|
||||
|
||||
$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>";
|
||||
|
||||
?>
|
@ -13,16 +13,19 @@ if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
|
||||
register_shortcode('online_shortcodes', true);
|
||||
initShortcodeClass('online_shortcodes');
|
||||
$online_shortcodes = initShortcodeClass('online_shortcodes');
|
||||
|
||||
class online_shortcodes
|
||||
class online_shortcodes extends e_shortcode
|
||||
{
|
||||
protected $e107;
|
||||
public $memberInfo = array(); // Site stats
|
||||
public $currentMember = array('oid' => '0', 'oname' => '??', 'page' => 'lost');
|
||||
public $currentUser = array(); // Information about current user (for last seen)
|
||||
public $onlineMembersList = '';
|
||||
private $extendedMode;
|
||||
public $memberTemplate = '';
|
||||
protected $gen;
|
||||
private $menuPref = array();
|
||||
|
||||
|
||||
public function __construct()
|
||||
@ -30,6 +33,20 @@ class online_shortcodes
|
||||
$this->e107 = e107::getInstance();
|
||||
$this->memberInfo = e107::getConfig('history');
|
||||
$this->gen = e107::getDateConvert();
|
||||
$this->menuPref = e107::getConfig('menu')->getPref();
|
||||
|
||||
$this->extendedMode = e107::getConfig('menu')->get('online_show_memberlist_extended');
|
||||
|
||||
}
|
||||
|
||||
|
||||
function sc_online_style($parm=null)
|
||||
{
|
||||
if($this->extendedMode)
|
||||
{
|
||||
return 'list-unstyled online-menu-extended';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Last Seen Menu
|
||||
@ -67,7 +84,16 @@ class online_shortcodes
|
||||
// Online Menu
|
||||
function sc_online_guests()
|
||||
{
|
||||
return GUESTS_ONLINE;
|
||||
//var_dump($this->menuPref['online_show_guests']);
|
||||
|
||||
if(!isset($this->menuPref['online_show_guests']) || !empty($this->menuPref['online_show_guests']))
|
||||
{
|
||||
return GUESTS_ONLINE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function sc_online_members()
|
||||
@ -77,7 +103,7 @@ class online_shortcodes
|
||||
|
||||
function sc_online_members_list()
|
||||
{
|
||||
if(e107::getConfig('menu')->get('online_show_memberlist', FALSE))
|
||||
if(!empty($this->menuPref['online_show_memberlist']))
|
||||
{
|
||||
return (MEMBERS_ONLINE ? MEMBER_LIST : '');
|
||||
}
|
||||
@ -92,30 +118,49 @@ class online_shortcodes
|
||||
|
||||
function sc_online_members_total()
|
||||
{
|
||||
$total_members = $this->e107->ecache->retrieve("online_menu_member_total", 120);
|
||||
$total_members = e107::getCache()->retrieve("online_menu_member_total", 120);
|
||||
if($total_members == false)
|
||||
{
|
||||
$total_members = e107::getDb()->count('user','(*)',"where user_ban='0'");
|
||||
$this->e107->ecache->set("online_menu_member_total", $total_members);
|
||||
e107::getCache()->set("online_menu_member_total", $total_members);
|
||||
}
|
||||
return $total_members;
|
||||
}
|
||||
|
||||
|
||||
function sc_online_member_newest()
|
||||
function sc_online_member_newest($parm=null)
|
||||
{
|
||||
|
||||
$sql = e107::getDb();
|
||||
$ret = $this->e107->ecache->retrieve('online_menu_member_newest', 120);
|
||||
// $ret =e107::getCache()->retrieve('online_menu_member_newest', 120);
|
||||
if($ret == false)
|
||||
{
|
||||
$newest_member_sql = $sql->select('user', 'user_id, user_name', "user_ban='0' ORDER BY user_join DESC LIMIT 1");
|
||||
|
||||
$newest_member_sql = $sql->select('user', 'user_id, user_name,user_image', "user_ban='0' ORDER BY user_join DESC LIMIT 1");
|
||||
$row = $sql->fetch();
|
||||
//$ret = "<a href='".e_HTTP."user.php?id.".$row['user_id']."'>".$row['user_name']."</a>";
|
||||
$uparams = array('id' => $row['user_id'], 'name' => $row['user_name']);
|
||||
$link = e107::getUrl()->create('user/profile/view', $uparams);
|
||||
$ret = "<a href='".$link."'>".$row['user_name']."</a>";
|
||||
$this->e107->ecache->set('online_menu_member_newest', $ret);
|
||||
|
||||
if($parm['type'] == 'avatar')
|
||||
{
|
||||
$this->currentMember = array('oid' => $row['user_id'], 'oname'=> $row['user_name'], 'page' => null, 'pinfo' => null,'oimage' => $row['user_image'] );
|
||||
$ret = e107::getParser()->parseTemplate($this->newestTemplate, TRUE, $this);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$uparams = array('id' => $row['user_id'], 'name' => $row['user_name']);
|
||||
$link = e107::getUrl()->create('user/profile/view', $uparams);
|
||||
$ret = "<a href='".$link."'>".$row['user_name']."</a>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
e107::getCache()->set('online_menu_member_newest', $ret);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@ -138,9 +183,9 @@ class online_shortcodes
|
||||
}
|
||||
|
||||
|
||||
function sc_online_most_datestamp()
|
||||
function sc_online_most_datestamp($parm='short')
|
||||
{
|
||||
return $this->gen->convert_date($this->memberInfo->get('most_online_datestamp'), 'short');
|
||||
return $this->gen->convert_date($this->memberInfo->get('most_online_datestamp'), $parm);
|
||||
}
|
||||
|
||||
|
||||
@ -148,20 +193,108 @@ class online_shortcodes
|
||||
//##### ONLINE MEMBER LIST EXTENDED
|
||||
function sc_online_members_list_extended()
|
||||
{
|
||||
return $this->onlineMembersList;
|
||||
//display list of 'member viewing page'
|
||||
if($this->extendedMode == false)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$text = '';
|
||||
|
||||
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 = 'download';
|
||||
}
|
||||
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);
|
||||
//$online_shortcodes->setScVar('currentMember',$data);
|
||||
$this->currentMember = $data;
|
||||
$text .= e107::getParser()->parseTemplate($this->memberTemplate, TRUE, $this);
|
||||
|
||||
// print_a($ONLINE_TEMPLATE['online_members_list_extended']);
|
||||
|
||||
}
|
||||
|
||||
// $online_shortcodes->onlineMembersList = $ret; // setScVar('onlineMembersList', $ret);
|
||||
|
||||
//setScVar('online_shortcodes', 'onlineMembersList', $ret);
|
||||
}
|
||||
|
||||
|
||||
return $text;
|
||||
|
||||
}
|
||||
|
||||
function sc_online_members_registered()
|
||||
{
|
||||
return e107::getDb()->count('user','(*)','user_ban = 0');
|
||||
|
||||
}
|
||||
|
||||
|
||||
function sc_online_member_image($parm='')
|
||||
|
||||
function sc_online_member_image($parm=null)
|
||||
{
|
||||
if($parm == 'avatar')
|
||||
if(is_string($parm))
|
||||
{
|
||||
$parm= array('type'=> $parm);
|
||||
}
|
||||
|
||||
if($parm['type'] == 'avatar')
|
||||
{
|
||||
$userData = array(
|
||||
'user_image' => $this->currentMember['oimage'],
|
||||
'user_name' => $this->currentMember['oname']
|
||||
);
|
||||
|
||||
return e107::getParser()->toAvatar($userData);
|
||||
);
|
||||
|
||||
return e107::getParser()->toAvatar($userData, $parm);
|
||||
|
||||
// return e107::getParser()->parseTemplate("{USER_AVATAR=".$this->currentMember['oimage']."}",true);
|
||||
}
|
||||
|
129
e107_plugins/online/templates/online_menu_template.php
Normal file
129
e107_plugins/online/templates/online_menu_template.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2016 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
|
||||
*/
|
||||
|
||||
$ONLINE_MENU_TEMPLATE = array();
|
||||
|
||||
// Last seen Menu
|
||||
$ONLINE_MENU_TEMPLATE['lastseen']['start'] = "<ul class='lastseen-menu '>";
|
||||
$ONLINE_MENU_TEMPLATE['lastseen']['item'] = "<li>{LASTSEEN_USERLINK} <small class='muted'>{LASTSEEN_DATE}</small></li>";
|
||||
$ONLINE_MENU_TEMPLATE['lastseen']['end'] = "</ul>";
|
||||
|
||||
|
||||
$ONLINE_MENU_TEMPLATE['default']['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_MENU_TEMPLATE['default']['disabled'] = "{ONLINE_TRACKING_DISABLED}";
|
||||
|
||||
//##### ONLINE MEMBER LIST EXTENDED -------------------------------------------
|
||||
$ONLINE_MENU_TEMPLATE['default']['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>";
|
||||
|
||||
$ONLINE_MENU_WRAPPER['default']['ONLINE_GUESTS'] = "<li>".LAN_ONLINE_1."{---}</li>";
|
||||
$ONLINE_MENU_WRAPPER['default']['ONLINE_MEMBERS'] = "<li>".LAN_ONLINE_2."{---}</li>";
|
||||
$ONLINE_MENU_WRAPPER['default']['ONLINE_MEMBERS_LIST'] = "<ul>{---}</ul>";
|
||||
$ONLINE_MENU_WRAPPER['default']['ONLINE_MEMBERS_LIST_EXTENDED'] = "<ul class='unstyled list-unstyled'>{---}</ul>";
|
||||
$ONLINE_MENU_WRAPPER['default']['ONLINE_ONPAGE'] = "<li>".LAN_ONLINE_3."{---}</li>";
|
||||
$ONLINE_MENU_WRAPPER['default']['ONLINE_MEMBER_TOTAL'] = "<li>".LAN_ONLINE_2."<span class='label label-default pull-right'>{---}</span></li>";
|
||||
$ONLINE_MENU_WRAPPER['default']['ONLINE_MEMBER_NEWEST'] = "<li>".LAN_ONLINE_6."</li><li><ul class='unstyled list-unstyled'>{---}</ul></li>";
|
||||
$ONLINE_MENU_WRAPPER['default']['ONLINE_MOST'] = LAN_ONLINE_8."{---}<br />";
|
||||
$ONLINE_MENU_WRAPPER['default']['ONLINE_MOST_MEMBERS'] = LAN_ONLINE_2."{---}";
|
||||
$ONLINE_MENU_WRAPPER['default']['ONLINE_MOST_GUESTS'] = LAN_ONLINE_1."{---}";
|
||||
$ONLINE_MENU_WRAPPER['default']['ONLINE_MOST_DATESTAMP'] = "{---}";
|
||||
$ONLINE_MENU_WRAPPER['default']['ONLINE_MEMBERS_REGISTERED'] = "<li>".LAN_ONLINE_11."{---}";
|
||||
|
||||
|
||||
$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_MENU_TEMPLATE['extended']['enabled'] = "
|
||||
<ul class='online-menu online-menu-extended list-unstyled'>
|
||||
{ONLINE_GUESTS}
|
||||
{ONLINE_MEMBERS}
|
||||
{ONLINE_MEMBERS_LIST_EXTENDED}
|
||||
{ONLINE_ONPAGE}
|
||||
{ONLINE_MEMBER_TOTAL}
|
||||
{ONLINE_MEMBER_NEWEST: type=avatar}
|
||||
{ONLINE_MEMBERS_REGISTERED}
|
||||
<li class='online-menu-extended-label'>
|
||||
{ONLINE_MOST}
|
||||
<div id='online-menu-extended-most' class='text-muted text-right' style='display:none'>
|
||||
<small>
|
||||
{ONLINE_MOST_GUESTS}<br />
|
||||
{ONLINE_MOST_MEMBERS}<br />
|
||||
{ONLINE_MOST_DATESTAMP=long}
|
||||
</small>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
";
|
||||
|
||||
$ONLINE_MENU_TEMPLATE['extended']['online_members_list_extended'] = "{SETIMAGE: w=48&h=48&crop=1}<li class='media'><div class='media-left'>{ONLINE_MEMBER_IMAGE: type=avatar&shape=circle}</div><div class='media-body'><span class='online-menu-user'>{ONLINE_MEMBER_USER}</span><small class='text-muted'>".LAN_ONLINE_7." {ONLINE_MEMBER_PAGE}</small></div></li>";
|
||||
$ONLINE_MENU_TEMPLATE['extended']['online_member_newest'] = "{SETIMAGE: w=48&h=48&crop=1}<li class='media'><div class='media-left'>{ONLINE_MEMBER_IMAGE: type=avatar&shape=circle}</div><div class='media-body'><span class='online-menu-user'>{ONLINE_MEMBER_USER}</span></div></li>";
|
||||
|
||||
|
||||
|
||||
$ONLINE_MENU_WRAPPER['extended']['ONLINE_GUESTS'] = "<li class='online-menu-extended-label'>".LAN_ONLINE_1."<span class='label label-primary pull-right'>{---}</span></li>";
|
||||
$ONLINE_MENU_WRAPPER['extended']['ONLINE_MEMBERS'] = "<li class='online-menu-extended-label'>".LAN_ONLINE_2."<span class='label label-primary pull-right'>{---}</span></li>";
|
||||
$ONLINE_MENU_WRAPPER['extended']['ONLINE_MEMBERS_LIST'] = "<ul>{---}</ul>";
|
||||
$ONLINE_MENU_WRAPPER['extended']['ONLINE_MEMBERS_LIST_EXTENDED'] = "<ul class='unstyled list-unstyled'>{---}</ul>";
|
||||
$ONLINE_MENU_WRAPPER['extended']['ONLINE_ONPAGE'] = "<li>".LAN_ONLINE_3."<span class='label label-default pull-right'>{---}</span></li>";
|
||||
$ONLINE_MENU_WRAPPER['extended']['ONLINE_MEMBER_TOTAL'] = "<li>".LAN_ONLINE_2."<span class='label label-default pull-right'>{---}</span></li>";
|
||||
$ONLINE_MENU_WRAPPER['extended']['ONLINE_MEMBER_NEWEST'] = "<li class='online-menu-extended-label'>".LAN_ONLINE_6."</li><li><ul class='unstyled list-unstyled'>{---}</ul></li>";
|
||||
$ONLINE_MENU_WRAPPER['extended']['ONLINE_MOST'] = "<a class='e-expandit' href='#online-menu-extended-most'>".LAN_ONLINE_8."</a><span class='label label-default pull-right'>{---}</span><br />";
|
||||
$ONLINE_MENU_WRAPPER['extended']['ONLINE_MOST_MEMBERS'] = LAN_ONLINE_2."{---}";
|
||||
$ONLINE_MENU_WRAPPER['extended']['ONLINE_MOST_GUESTS'] = LAN_ONLINE_1."{---}";
|
||||
$ONLINE_MENU_WRAPPER['extended']['ONLINE_MOST_DATESTAMP'] = "{---}";
|
||||
$ONLINE_MENU_WRAPPER['extended']['ONLINE_MEMBERS_REGISTERED'] = "<li class='online-menu-extended-label'>".LAN_ONLINE_11."<span class='label label-default pull-right'>{---}</li>";
|
||||
|
@ -316,4 +316,9 @@ optgroup.level-1 { padding-left:0.1em }
|
||||
optgroup.level-2 { padding-left:0.7em }
|
||||
optgroup.level-3 { padding-left:2em }
|
||||
optgroup.level-4 { padding-left:3em }
|
||||
optgroup.level-5 { padding-left:4em }
|
||||
optgroup.level-5 { padding-left:4em }
|
||||
|
||||
.online-menu-extended li, .online-menu li ul li { min-height: 40px; padding-top:8px}
|
||||
.online-menu-extended ul { padding-bottom:20px}
|
||||
.online-menu-extended span.online-menu-user { display:block; font-size:1.1em;margin-top:4px; line-height:1}
|
||||
.online-menu-extended-label { font-size:1.2em; }
|
Loading…
x
Reference in New Issue
Block a user