mirror of
https://github.com/e107inc/e107.git
synced 2025-08-10 08:34:09 +02:00
Save 'most online' counts in separate pref, use array-based $menu_pref and new prefs handler, global elimination, odd fixes
This commit is contained in:
@@ -9,9 +9,9 @@
|
||||
* e107 Main
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/online/online_shortcodes.php,v $
|
||||
* $Revision: 1.4 $
|
||||
* $Date: 2009-11-18 01:05:53 $
|
||||
* $Author: e107coders $
|
||||
* $Revision: 1.5 $
|
||||
* $Date: 2009-12-28 17:53:11 $
|
||||
* $Author: e107steved $
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
@@ -22,24 +22,30 @@ initShortcodeClass('online_shortcodes');
|
||||
class online_shortcodes
|
||||
{
|
||||
var $e107;
|
||||
var $memberInfo = array(); // Site stats
|
||||
var $currentMember = array('oid' => '0', 'oname' => '??', 'page' => 'lost');
|
||||
var $currentUser = array(); // Information about current user (for last seen)
|
||||
var $onlineMembersList = '';
|
||||
var $gen;
|
||||
|
||||
function online_shortcodes()
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->e107 = e107::getInstance();
|
||||
$this->memberInfo = e107::getConfig('history');
|
||||
$this->gen = e107::getDateConvert();
|
||||
}
|
||||
|
||||
// Last Seen Menu
|
||||
function sc_lastseen_userlink()
|
||||
{
|
||||
global $row;
|
||||
return "<a href='".e_BASE."user.php?id.".$row['user_id']."'>".$row['user_name']."</a>";
|
||||
return "<a href='".e_BASE."user.php?id.".$this->currentUser['user_id']."'>".$this->currentUser['user_name']."</a>";
|
||||
}
|
||||
|
||||
function sc_lastseen_date()
|
||||
{
|
||||
global $gen, $row;
|
||||
$seen_ago = $gen->computeLapse($row['user_currentvisit'], false, false, true, 'short');
|
||||
return ($seen_ago ? $seen_ago : "1 ".LANDT_09)." ".LANDT_AGO;
|
||||
$seen_ago = $this->gen->computeLapse($this->currentUser['user_currentvisit'], false, false, true, 'short');
|
||||
return ($seen_ago ? $seen_ago : '1 '.LANDT_09).' '.LANDT_AGO;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,8 +68,7 @@ class online_shortcodes
|
||||
|
||||
function sc_online_members_list()
|
||||
{
|
||||
global $menu_pref;
|
||||
if($menu_pref['online_show_memberlist'])
|
||||
if(e107::getConfig('menu')->get('online_show_memberlist', FALSE))
|
||||
{
|
||||
return (MEMBERS_ONLINE ? MEMBER_LIST : '');
|
||||
}
|
||||
@@ -96,7 +101,7 @@ class online_shortcodes
|
||||
$newest_member_sql = $this->e107->sql->db_Select('user', 'user_id, user_name', "user_ban='0' ORDER BY user_join DESC LIMIT 1");
|
||||
$row = $this->e107->sql->db_Fetch();
|
||||
$ret = "<a href='".e_HTTP."user.php?id.".$row['user_id']."'>".$row['user_name']."</a>";
|
||||
$this->e107->ecache->set("online_menu_member_newest", $ret);
|
||||
$this->e107->ecache->set('online_menu_member_newest', $ret);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
@@ -104,58 +109,52 @@ class online_shortcodes
|
||||
|
||||
function sc_online_most()
|
||||
{
|
||||
global $menu_pref;
|
||||
return intval($menu_pref['most_members_online'] + $menu_pref['most_guests_online']);
|
||||
return intval($this->memberInfo->get('most_members_online') + $this->memberInfo->get('most_guests_online'));
|
||||
}
|
||||
|
||||
|
||||
function sc_online_most_members()
|
||||
{
|
||||
global $menu_pref;
|
||||
return $menu_pref['most_members_online'];
|
||||
return $this->memberInfo->get('most_members_online');
|
||||
}
|
||||
|
||||
|
||||
function sc_online_most_guests()
|
||||
{
|
||||
global $menu_pref;
|
||||
return $menu_pref['most_guests_online'];
|
||||
return $this->memberInfo->get('most_guests_online');
|
||||
}
|
||||
|
||||
|
||||
function sc_online_most_datestamp()
|
||||
{
|
||||
global $menu_pref, $gen;
|
||||
return $gen->convert_date($menu_pref['most_online_datestamp'], "short");
|
||||
return $this->gen->convert_date($this->memberInfo->get('most_online_datestamp'), 'short');
|
||||
}
|
||||
|
||||
|
||||
|
||||
//##### ONLINE MEMBER LIST EXTENDED
|
||||
function sc_online_member_list_extended()
|
||||
function sc_online_members_list_extended()
|
||||
{
|
||||
global $ONLINE_MEMBERS_LIST_EXTENDED;
|
||||
return $ONLINE_MEMBERS_LIST_EXTENDED;
|
||||
return $this->onlineMembersList;
|
||||
}
|
||||
|
||||
|
||||
function sc_online_member_image()
|
||||
{
|
||||
return "<img src='".e_IMAGE."admin_images/users_16.png' alt='' style='vertical-align:middle' />";
|
||||
return "<img src='".e_IMAGE_ABS."admin_images/users_16.png' alt='' style='vertical-align:middle' />";
|
||||
}
|
||||
|
||||
|
||||
function sc_online_member_user()
|
||||
{
|
||||
global $oid, $oname;
|
||||
return "<a href='".e_BASE."user.php?id.$oid'>$oname</a>";
|
||||
return "<a href='".e_HTTP."user.php?id.{$this->currentMember['oid']}'>{$this->currentMember['oname']}</a>";
|
||||
}
|
||||
|
||||
|
||||
function sc_online_member_page()
|
||||
{
|
||||
global $pinfo, $ADMIN_DIRECTORY, $online_location_page;
|
||||
return (!strstr($pinfo, $ADMIN_DIRECTORY) ? "<a href='".$pinfo."'>".$online_location_page."</a>" : $online_location_page);
|
||||
global $ADMIN_DIRECTORY;
|
||||
return (!strstr($this->currentMember['pinfo'], $ADMIN_DIRECTORY) ? "<a href='".$this->currentMember['pinfo']."'>".$this->currentMember['page']."</a>" : $this->currentMember['page']);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user