1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-07 15:16:30 +02:00

Infopanel tweaks

This commit is contained in:
Cameron
2013-01-15 18:01:51 -08:00
parent 608208544c
commit b33a298067
3 changed files with 44 additions and 22 deletions

View File

@@ -193,6 +193,10 @@ EOF;
{ {
$text2 .= $ns->tablerender("Visitors Last 10 Days", $this->renderStats(),"core-infopanel_stats",true); $text2 .= $ns->tablerender("Visitors Last 10 Days", $this->renderStats(),"core-infopanel_stats",true);
} }
elseif(e107::isInstalled('awstats'))
{
$text2 .= $ns->tablerender("Visitors this Month", $this->renderStats(),"core-infopanel_stats",true);
}
else else
{ {
$text2 .= $ns->tablerender("Visitors This Week", "Log Statistics Plugin Not Installed","core-infopanel_stats",true); $text2 .= $ns->tablerender("Visitors This Week", "Log Statistics Plugin Not Installed","core-infopanel_stats",true);
@@ -220,11 +224,11 @@ EOF;
$ol = e107::getOnline(); $ol = e107::getOnline();
// echo "Users: ".print_a($ol->userList());
$panelOnline = " $panelOnline = "
<table class='table adminlist'> <table class='table table-condensed adminlist'>
<colgroup> <colgroup>
<col style='width: 10%' /> <col style='width: 10%' />
<col style='width: 25%' /> <col style='width: 25%' />
@@ -241,13 +245,12 @@ EOF;
<th class='center'>Agent</th> <th class='center'>Agent</th>
</tr> </tr>
</thead> </thead>
<tbody>"; <tbody>";
$online = $ol->userList(); $online = $ol->userList() + $ol->guestList();
// echo "Users: ".print_a($online);
foreach ($online as $val) foreach ($online as $val)
{ {
$panelOnline .= "<tr> $panelOnline .= "<tr>
@@ -339,18 +342,18 @@ EOF;
if($row['user_bot'] === true) if($row['user_bot'] === true)
{ {
return "<i class='browser e-bot-32'></i>"; return "<i class='browser e-bot-16'></i>";
} }
foreach($types as $icon=>$b) foreach($types as $icon=>$b)
{ {
if(strpos($row['user_agent'], $b)!==false) if(strpos($row['user_agent'], $b)!==false)
{ {
return "<i class='browsers e-".$icon."-32' ></i>"; return "<i class='browsers e-".$icon."-16' ></i>";
} }
} }
return "<i class='browsers e-firefox-32'></i>"; // FIXME find a default icon. return "<i class='browsers e-firefox-16'></i>"; // FIXME find a default icon.
} }
@@ -490,7 +493,11 @@ EOF;
function getStats() function getStats()
{ {
if(file_exists(e_PLUGIN."awstats/awstats.graph.php")) //FIXME Cam: Find a generic solution.
{
require_once(e_PLUGIN."awstats/awstats.graph.php");
return;
}

View File

@@ -60,6 +60,7 @@ class e_online
{ {
public $users = array(); public $users = array();
public $guests = array();
function __construct() function __construct()
@@ -242,20 +243,16 @@ class e_online
$sql->db_Delete('online', '`online_timestamp` < '.(time() - $online_timeout)); $sql->db_Delete('online', '`online_timestamp` < '.(time() - $online_timeout));
// FIXME - don't use constants below, save data in class vars, call e_online signleton - e107::getOnline() // FIXME - don't use constants below, save data in class vars, call e_online signleton - e107::getOnline()
$total_online = $sql->db_Count('online'); // $total_online = $sql->db_Count('online'); // 1 less query! :-)
if ($members_online = $sql->db_Select('online', '*', 'online_user_id != 0')) if ($total_online = $sql->db_Select_gen('SELECT * FROM #online WHERE online_pagecount > 0 ORDER BY online_timestamp DESC'))
{ {
$member_list = ''; $member_list = '';
$members_online = 0;
$listuserson = array(); $listuserson = array();
while ($row = $sql->db_Fetch()) while ($row = $sql->db_Fetch())
{ {
$row['online_bot'] = $this->isBot($row['online_agent']); $row['online_bot'] = $this->isBot($row['online_agent']);
$vals = explode('.', $row['online_user_id'], 2);
$member_list .= "<a href='".SITEURL."user.php?id.{$vals[0]}'>{$vals[1]}</a> ";
$listuserson[$row['online_user_id']] = $row['online_location'];
// Sort into usable format and add bot field. // Sort into usable format and add bot field.
$user = array( $user = array(
'user_id' => $vals[0], 'user_id' => $vals[0],
@@ -271,7 +268,20 @@ class e_online
'online_user_id' => $row['online_user_id'] 'online_user_id' => $row['online_user_id']
); );
$this->users[] = $user; if($row['online_user_id'] != 0)
{
$vals = explode('.', $row['online_user_id'], 2);
$member_list .= "<a href='".SITEURL."user.php?id.{$vals[0]}'>{$vals[1]}</a> ";
$listuserson[$row['online_user_id']] = $row['online_location'];
$this->users[] = $user;
$members_online++;
}
else
{
$this->guests[] = $user;
}
} }
} }
@@ -310,6 +320,11 @@ class e_online
} }
function guestList()
{
return $this->guests;
}

View File

@@ -221,7 +221,7 @@ $ADMIN_HEADER .= '<div class="container-fluid">
{ADMIN_LOG=request} {ADMIN_LOG=request}
{ADMIN_MSG} {ADMIN_MSG}
{ADMIN_PLUGINS} {ADMIN_PLUGINS}
{ADMIN_UPDATE}
{SETSTYLE=site_info} {SETSTYLE=site_info}
{ADMIN_SITEINFO} {ADMIN_SITEINFO}