2009-07-04 03:08:03 +00:00
|
|
|
<?php
|
|
|
|
/*
|
2010-10-28 11:12:45 +00:00
|
|
|
* e107 website system
|
|
|
|
*
|
2016-12-31 18:55:45 +00:00
|
|
|
* Copyright (C) 2008-2016 e107 Inc (e107.org)
|
2010-10-28 11:12:45 +00:00
|
|
|
* Released under the terms and conditions of the
|
|
|
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
|
|
|
*
|
|
|
|
* Info panel admin view
|
|
|
|
*
|
2009-09-03 01:27:27 +00:00
|
|
|
*/
|
2010-10-28 11:12:45 +00:00
|
|
|
|
2009-07-23 10:46:11 +00:00
|
|
|
if (!defined('e107_INIT'))
|
2009-07-04 13:36:15 +00:00
|
|
|
{
|
2009-07-23 10:46:11 +00:00
|
|
|
exit;
|
2009-07-04 13:36:15 +00:00
|
|
|
}
|
2009-09-03 01:27:27 +00:00
|
|
|
|
2016-02-16 13:08:15 -08:00
|
|
|
|
2013-09-11 11:08:50 -07:00
|
|
|
define('ADMINFEEDMORE', 'http://e107.org/blog');
|
2012-12-04 00:14:43 -08:00
|
|
|
|
2016-01-14 08:28:17 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-04 00:14:43 -08:00
|
|
|
class adminstyle_infopanel
|
2009-07-23 10:46:11 +00:00
|
|
|
{
|
2010-03-16 07:46:01 +00:00
|
|
|
|
2012-12-08 00:36:34 -08:00
|
|
|
private $iconlist = array();
|
|
|
|
|
2012-12-04 00:14:43 -08:00
|
|
|
function __construct()
|
2009-09-03 01:27:27 +00:00
|
|
|
{
|
2013-09-11 11:08:50 -07:00
|
|
|
$code = "
|
|
|
|
jQuery(function($){
|
2016-02-16 13:08:15 -08:00
|
|
|
$('#e-adminfeed').load('".e_ADMIN."admin.php?mode=core&type=feed');
|
2016-01-14 08:28:17 -08:00
|
|
|
$('#e-adminfeed-plugin').load('".e_ADMIN."admin.php?mode=addons&type=plugin');
|
|
|
|
$('#e-adminfeed-theme').load('".e_ADMIN."admin.php?mode=addons&type=theme');
|
2013-09-11 11:08:50 -07:00
|
|
|
});
|
2016-11-11 13:44:20 +01:00
|
|
|
";
|
2013-02-22 02:16:06 -08:00
|
|
|
|
2012-12-04 00:14:43 -08:00
|
|
|
e107::js('inline',$code,'jquery');
|
|
|
|
|
|
|
|
if (isset($_POST['submit-mye107']) || varset($_POST['submit-mymenus']))
|
|
|
|
{
|
2016-11-11 13:44:20 +01:00
|
|
|
$this->savePref('core-infopanel-mye107', $_POST['e-mye107']);
|
|
|
|
$this->savePref('core-infopanel-menus', $_POST['e-mymenus']);
|
2012-12-04 00:14:43 -08:00
|
|
|
}
|
2016-11-11 13:44:20 +01:00
|
|
|
|
2013-02-26 18:57:33 -08:00
|
|
|
$this->iconlist = e107::getNav()->adminLinks();
|
2009-09-03 01:27:27 +00:00
|
|
|
}
|
2016-11-07 14:12:19 +01:00
|
|
|
|
2016-11-11 13:44:20 +01:00
|
|
|
/**
|
|
|
|
* Save preferences.
|
|
|
|
*
|
|
|
|
* @param $key
|
|
|
|
* @param $value
|
|
|
|
*/
|
|
|
|
public function savePref($key, $value)
|
|
|
|
{
|
|
|
|
// Get "Apply dashboard preferences to all administrators" setting.
|
|
|
|
$adminPref = e107::getConfig()->get('adminpref', 0);
|
|
|
|
|
|
|
|
// If "Apply dashboard preferences to all administrators" is checked.
|
|
|
|
// Save as $pref.
|
|
|
|
if($adminPref == 1)
|
|
|
|
{
|
|
|
|
e107::getConfig()
|
|
|
|
->setPosted($key, $value)
|
|
|
|
->save();
|
|
|
|
}
|
|
|
|
// Save as $user_pref.
|
|
|
|
else
|
|
|
|
{
|
|
|
|
e107::getUser()
|
|
|
|
->getConfig()
|
|
|
|
->set($key, $value)
|
|
|
|
->save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get preferences.
|
|
|
|
*
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function getUserPref()
|
|
|
|
{
|
|
|
|
// Get "Apply dashboard preferences to all administrators" setting.
|
|
|
|
$adminPref = e107::getConfig()->get('adminpref', 0);
|
|
|
|
|
|
|
|
// If "Apply dashboard preferences to all administrators" is checked.
|
|
|
|
// Get $pref.
|
|
|
|
if($adminPref == 1)
|
|
|
|
{
|
|
|
|
$user_pref = e107::getPref();
|
|
|
|
}
|
|
|
|
// Get $user_pref.
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$user_pref = e107::getUser()->getPref();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $user_pref;
|
|
|
|
}
|
2016-11-07 14:12:19 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Allow to get Icon List.
|
|
|
|
*/
|
|
|
|
function getIconList()
|
|
|
|
{
|
|
|
|
return $this->iconlist;
|
|
|
|
}
|
2012-12-03 02:21:51 -08:00
|
|
|
|
2012-12-04 00:14:43 -08:00
|
|
|
function render()
|
|
|
|
{
|
|
|
|
$tp = e107::getParser();
|
|
|
|
$ns = e107::getRender();
|
|
|
|
$sql = e107::getDb();
|
|
|
|
$mes = e107::getMessage();
|
|
|
|
$pref = e107::getPref();
|
|
|
|
$frm = e107::getForm();
|
2016-11-07 14:12:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
// XXX Check Bootstrap bug is fixed.
|
|
|
|
/*
|
|
|
|
echo '
|
|
|
|
<ul class="thumbnails">
|
|
|
|
<li class="span4">
|
|
|
|
<a href="#" class="thumbnail">
|
|
|
|
<img src="http://placehold.it/360x270" alt="">
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="span4">
|
|
|
|
<a href="#" class="thumbnail">
|
|
|
|
<img src="http://placehold.it/360x270" alt="">
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="span4">
|
|
|
|
<a href="#" class="thumbnail">
|
|
|
|
<img src="http://placehold.it/360x270" alt="">
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="span4">
|
|
|
|
<a href="#" class="thumbnail">
|
|
|
|
<img src="http://placehold.it/360x270" alt="">
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="span4">
|
|
|
|
<a href="#" class="thumbnail">
|
|
|
|
<img src="http://placehold.it/360x270" alt="">
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="span4">
|
|
|
|
<a href="#" class="thumbnail">
|
|
|
|
<img src="http://placehold.it/360x270" alt="">
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
';
|
|
|
|
*/
|
2016-11-11 13:44:20 +01:00
|
|
|
|
|
|
|
$user_pref = $this->getUserPref();
|
2012-12-04 00:14:43 -08:00
|
|
|
|
2016-11-07 14:12:19 +01:00
|
|
|
// ---------------------- Start Panel --------------------------------
|
|
|
|
|
|
|
|
// $text = "<div >";
|
2016-11-16 21:21:12 +01:00
|
|
|
$myE107 = varset($user_pref['core-infopanel-mye107'], array());
|
|
|
|
if(empty($myE107)) // Set default icons.
|
2012-12-04 00:14:43 -08:00
|
|
|
{
|
2016-11-11 13:44:20 +01:00
|
|
|
$defArray = array(
|
|
|
|
0 => 'e-administrator',
|
|
|
|
1 => 'e-cpage',
|
|
|
|
2 => 'e-frontpage',
|
|
|
|
3 => 'e-mailout',
|
|
|
|
4 => 'e-image',
|
|
|
|
5 => 'e-menus',
|
|
|
|
6 => 'e-meta',
|
|
|
|
7 => 'e-newspost',
|
|
|
|
8 => 'e-plugin',
|
|
|
|
9 => 'e-prefs',
|
|
|
|
10 => 'e-links',
|
|
|
|
11 => 'e-theme',
|
|
|
|
12 => 'e-userclass2',
|
|
|
|
13 => 'e-users',
|
|
|
|
14 => 'e-wmessage'
|
|
|
|
);
|
|
|
|
$user_pref['core-infopanel-mye107'] = $defArray;
|
2012-12-04 00:14:43 -08:00
|
|
|
}
|
2016-11-07 14:12:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// "<form method='post' action='".e_SELF."?".e_QUERY."'>";
|
|
|
|
|
2012-12-04 00:14:43 -08:00
|
|
|
$tp->parseTemplate("{SETSTYLE=core-infopanel}");
|
2016-11-07 14:12:19 +01:00
|
|
|
|
|
|
|
// Personalized Panel
|
2009-09-03 01:27:27 +00:00
|
|
|
// Rendering the saved configuration.
|
2012-12-04 00:14:43 -08:00
|
|
|
|
2016-11-07 14:12:19 +01:00
|
|
|
$mainPanel = "
|
|
|
|
<div id='core-infopanel_mye107' >
|
|
|
|
";
|
|
|
|
|
|
|
|
/*
|
|
|
|
$mainPanel .= '<span class="pull-right">
|
|
|
|
<span class="options">
|
|
|
|
<div class="btn-group">
|
|
|
|
<a class="dropdown-toggle" data-toggle="dropdown"><i class="icon-cog"></i></a>
|
|
|
|
<ul class="dropdown-menu black-box-dropdown dropdown-right">
|
|
|
|
<li>'.$this->render_infopanel_icons().'</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</span>
|
|
|
|
</span>';
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
// print_a($user_pref['core-infopanel-mye107']);
|
|
|
|
|
|
|
|
$mainPanel .= "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class='left'>";
|
|
|
|
|
|
|
|
foreach ($this->iconlist as $key=>$val)
|
2012-12-04 00:14:43 -08:00
|
|
|
{
|
2016-11-07 14:12:19 +01:00
|
|
|
if (!vartrue($user_pref['core-infopanel-mye107']) || in_array($key, $user_pref['core-infopanel-mye107']))
|
|
|
|
{
|
|
|
|
$mainPanel .= e107::getNav()->renderAdminButton($val['link'], $val['title'], $val['caption'], $val['perms'], $val['icon_32'], "div");
|
|
|
|
}
|
2012-12-04 00:14:43 -08:00
|
|
|
}
|
2016-11-07 14:12:19 +01:00
|
|
|
|
|
|
|
// $mainPanel .= "<div class='clear'> </div>";
|
|
|
|
$mainPanel .= "</div>
|
|
|
|
|
|
|
|
</div>";
|
2015-11-12 15:07:50 -08:00
|
|
|
|
|
|
|
$caption = $tp->lanVars(LAN_CONTROL_PANEL, ucwords(USERNAME));
|
2016-11-07 14:12:19 +01:00
|
|
|
$text = $ns->tablerender($caption, $mainPanel, "core-infopanel_mye107",true);
|
2012-12-04 00:14:43 -08:00
|
|
|
|
|
|
|
|
2016-11-07 14:12:19 +01:00
|
|
|
// ------------------------------- e107 News --------------------------------
|
|
|
|
|
2016-01-14 08:28:17 -08:00
|
|
|
$newsTabs = array();
|
2016-08-27 12:03:23 +01:00
|
|
|
$newsTabs['coreFeed'] = array('caption'=>LAN_GENERAL,'text'=>"<div id='e-adminfeed' style='min-height:300px'></div><div class='right'><a rel='external' href='".ADMINFEEDMORE."'>".LAN_MORE."</a></div>");
|
|
|
|
$newsTabs['pluginFeed'] = array('caption'=>LAN_PLUGIN,'text'=>"<div id='e-adminfeed-plugin'></div>");
|
|
|
|
$newsTabs['themeFeed'] = array('caption'=>LAN_THEMES,'text'=>"<div id='e-adminfeed-theme'></div>");
|
2016-01-14 08:28:17 -08:00
|
|
|
|
2016-11-07 14:12:19 +01:00
|
|
|
$text2 = $ns->tablerender(LAN_LATEST_e107_NEWS,e107::getForm()->tabs($newsTabs, array('active'=>'coreFeed')),"core-infopanel_news",true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------Latest Stuff ---------------------------
|
|
|
|
|
|
|
|
//require_once (e_CORE."shortcodes/batch/admin_shortcodes.php");
|
|
|
|
e107::getScBatch('admin');
|
|
|
|
|
2016-11-04 18:06:36 +01:00
|
|
|
|
|
|
|
|
2016-11-07 14:12:19 +01:00
|
|
|
|
|
|
|
$text2 .= $ns->tablerender(LAN_WEBSITE_STATUS, $this->renderWebsiteStatus(),"",true);
|
|
|
|
|
|
|
|
|
|
|
|
// $text .= $ns->tablerender(ADLAN_LAT_1,$tp->parseTemplate("{ADMIN_LATEST=norender}"),"core-infopanel_latest",true);
|
|
|
|
// $text .= $ns->tablerender(LAN_STATUS,$tp->parseTemplate("{ADMIN_STATUS=norender}"),"core-infopanel_latest",true);
|
|
|
|
/*
|
|
|
|
|
|
|
|
$text .= "<li class='span6'>
|
|
|
|
".$tp->parseTemplate("{ADMIN_LATEST=norender}").
|
|
|
|
$tp->parseTemplate("{ADMIN_STATUS=norender}")."
|
|
|
|
</div>";
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
$text .= $this->renderLatestComments();
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------- Who's Online ------------------------
|
|
|
|
// TODO Could use a new _menu item instead.
|
|
|
|
|
|
|
|
|
|
|
|
// $text2 .= $ns->tablerender('Visitors Online : '.vartrue($nOnline), $panelOnline,'core-infopanel_online',true);
|
|
|
|
|
|
|
|
// --------------------- User Selected Menus -------------------
|
2016-11-07 15:56:47 +01:00
|
|
|
|
|
|
|
|
|
|
|
if(varset($user_pref['core-infopanel-menus']))
|
2012-12-04 00:14:43 -08:00
|
|
|
{
|
2016-11-07 15:56:47 +01:00
|
|
|
foreach($user_pref['core-infopanel-menus'] as $val)
|
2012-12-04 00:14:43 -08:00
|
|
|
{
|
2016-11-07 16:01:12 +01:00
|
|
|
// Custom menu (core).
|
2016-11-07 15:56:47 +01:00
|
|
|
if(is_numeric($val))
|
|
|
|
{
|
|
|
|
$inc = e107::getMenu()->renderMenu($val, null, null, true);
|
|
|
|
}
|
2016-11-07 16:01:12 +01:00
|
|
|
// Plugin defined menu.
|
2016-11-07 15:56:47 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
$inc = $tp->parseTemplate("{PLUGIN=$val|TRUE}");
|
|
|
|
}
|
|
|
|
|
2016-11-07 14:12:19 +01:00
|
|
|
$text .= $inc;
|
2012-12-04 00:14:43 -08:00
|
|
|
}
|
|
|
|
}
|
2016-11-07 14:12:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// $text .= "<div class='clear'> </div>";
|
|
|
|
|
|
|
|
$text .= $this->render_infopanel_options();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// $text .= "</div>";
|
2012-12-04 00:14:43 -08:00
|
|
|
|
2012-12-08 00:32:37 +01:00
|
|
|
if(vartrue($_GET['mode']) != 'customize')
|
2012-12-04 00:14:43 -08:00
|
|
|
{
|
2016-11-07 14:12:19 +01:00
|
|
|
// $ns->tablerender(ADLAN_47." ".ADMINNAME, $emessage->render().$text);
|
|
|
|
echo $mes->render().'
|
|
|
|
|
|
|
|
<!-- INFOPANEL -->
|
|
|
|
<div class="row">
|
|
|
|
<div class="span6 col-md-6">
|
|
|
|
'.$text.'
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="span6 col-md-6">
|
|
|
|
'.$text2.'
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- -->
|
|
|
|
|
|
|
|
|
|
|
|
';
|
2012-12-04 00:14:43 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-11-11 13:44:20 +01:00
|
|
|
echo $frm->open('infopanel','post', e_SELF);
|
2012-12-04 00:14:43 -08:00
|
|
|
echo $this->render_infopanel_options(true);
|
2012-12-04 17:02:01 -08:00
|
|
|
echo $frm->close();
|
2012-12-04 00:14:43 -08:00
|
|
|
}
|
2012-11-26 03:23:20 -08:00
|
|
|
|
2012-12-04 00:14:43 -08:00
|
|
|
}
|
2012-11-26 03:23:20 -08:00
|
|
|
|
2013-05-15 15:01:55 -07:00
|
|
|
private function renderChart()
|
2013-02-22 00:50:51 -08:00
|
|
|
{
|
2013-05-14 23:51:19 -07:00
|
|
|
|
2013-05-15 15:01:55 -07:00
|
|
|
|
2013-03-17 14:47:35 -07:00
|
|
|
// REQUIRES Log Plugin to be installed.
|
2013-02-22 00:50:51 -08:00
|
|
|
if (e107::isInstalled('log'))
|
|
|
|
{
|
2013-05-15 15:01:55 -07:00
|
|
|
return $this->renderStats('log');
|
2013-02-22 00:50:51 -08:00
|
|
|
}
|
|
|
|
elseif(e107::isInstalled('awstats'))
|
|
|
|
{
|
2013-05-15 15:01:55 -07:00
|
|
|
return $this->renderStats('awstats');
|
2013-02-22 00:50:51 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-15 15:01:55 -07:00
|
|
|
return $this->renderStats('demo');
|
2013-02-22 00:50:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function renderWebsiteStatus()
|
|
|
|
{
|
2014-01-17 06:49:55 -08:00
|
|
|
$tp = e107::getParser();
|
2013-02-22 00:50:51 -08:00
|
|
|
/*
|
|
|
|
// Settings button if needed.
|
|
|
|
<div class="tab-header">
|
|
|
|
<span class="pull-right">
|
|
|
|
<span class="options">
|
|
|
|
<div class="btn-group">
|
|
|
|
<a class="dropdown-toggle" data-toggle="dropdown"><i class="icon-cog"></i></a>
|
|
|
|
<ul class="dropdown-menu black-box-dropdown dropdown-left">
|
|
|
|
<li><a href="#">Action</a></li>
|
|
|
|
<li><a href="#">Another action</a></li>
|
|
|
|
<li><a href="#">Something else here</a></li>
|
|
|
|
<li class="divider"></li>
|
|
|
|
<li><a href="#">Separated link</a></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
*/
|
|
|
|
|
2015-01-09 21:43:16 -08:00
|
|
|
$tab = array();
|
2016-08-27 12:03:23 +01:00
|
|
|
$tab['e-stats'] = array('caption'=>$tp->toGlyph('fa-signal').' '.LAN_STATS, 'text'=>$this->renderChart());
|
|
|
|
$tab['e-online'] = array('caption'=>$tp->toGlyph('fa-user').' '.LAN_ONLINE.' ('.$this->renderOnlineUsers('count').')', 'text'=>$this->renderOnlineUsers());
|
2013-02-22 00:50:51 -08:00
|
|
|
|
2015-01-09 21:43:16 -08:00
|
|
|
|
|
|
|
|
|
|
|
if($plugs = e107::getAddonConfig('e_dashboard',null, 'chart'))
|
|
|
|
{
|
|
|
|
foreach($plugs as $plug => $val)
|
|
|
|
{
|
|
|
|
foreach($val as $item)
|
|
|
|
{
|
|
|
|
if(!empty($item))
|
|
|
|
{
|
|
|
|
$tab[] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return e107::getForm()->tabs($tab);
|
2013-02-22 00:50:51 -08:00
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-09-11 11:08:50 -07:00
|
|
|
function renderOnlineUsers($data=false)
|
2013-02-22 00:50:51 -08:00
|
|
|
{
|
|
|
|
|
|
|
|
$ol = e107::getOnline();
|
|
|
|
$tp = e107::getParser();
|
2016-01-14 08:28:17 -08:00
|
|
|
$multilan = e107::getPref('multilanguage');
|
2013-02-22 00:50:51 -08:00
|
|
|
|
|
|
|
$panelOnline = "
|
|
|
|
|
2015-08-14 18:12:19 -07:00
|
|
|
<table class='table table-condensed table-striped' >
|
2013-02-22 00:50:51 -08:00
|
|
|
<colgroup>
|
|
|
|
<col style='width: 10%' />
|
|
|
|
<col style='width: 25%' />
|
|
|
|
<col style='width: 10%' />
|
|
|
|
<col style='width: 40%' />
|
2016-01-14 08:28:17 -08:00
|
|
|
<col style='width: auto' />";
|
|
|
|
|
|
|
|
|
|
|
|
$panelOnline .= (!empty($multilan)) ? "<col style='width: auto' />" : "";
|
|
|
|
|
|
|
|
|
|
|
|
$panelOnline .= "
|
|
|
|
|
2013-02-22 00:50:51 -08:00
|
|
|
</colgroup>
|
|
|
|
<thead>
|
|
|
|
<tr class='first'>
|
2016-08-27 12:03:23 +01:00
|
|
|
<th>".LAN_TIMESTAMP."</th>
|
|
|
|
<th>".LAN_USER."</th>
|
|
|
|
<th>".LAN_IP."</th>
|
|
|
|
<th>".LAN_PAGE."</th>
|
|
|
|
<th class='center'>".LAN_AGENT."</th>";
|
2016-01-14 08:28:17 -08:00
|
|
|
|
2016-08-27 12:03:23 +01:00
|
|
|
$panelOnline .= (!empty($multilan)) ? "<th class='center'>".LAN_LANG."</th>" : "";
|
2016-01-14 08:28:17 -08:00
|
|
|
|
|
|
|
$panelOnline .= "
|
2013-02-22 00:50:51 -08:00
|
|
|
</tr>
|
|
|
|
</thead>
|
2016-01-14 08:28:17 -08:00
|
|
|
<tbody>";
|
|
|
|
|
|
|
|
|
2013-02-22 00:50:51 -08:00
|
|
|
|
|
|
|
$online = $ol->userList() + $ol->guestList();
|
2013-09-11 11:08:50 -07:00
|
|
|
|
|
|
|
if($data == 'count')
|
|
|
|
{
|
|
|
|
return count($online);
|
|
|
|
}
|
2013-02-22 00:50:51 -08:00
|
|
|
|
2016-01-14 08:28:17 -08:00
|
|
|
// echo "Users: ".print_a($online);
|
|
|
|
|
|
|
|
$lng = e107::getLanguage();
|
|
|
|
|
2013-02-22 00:50:51 -08:00
|
|
|
foreach ($online as $val)
|
|
|
|
{
|
|
|
|
$panelOnline .= "
|
|
|
|
<tr>
|
|
|
|
<td class='nowrap'>".e107::getDateConvert()->convert_date($val['user_currentvisit'],'%H:%M:%S')."</td>
|
|
|
|
<td>".$this->renderOnlineName($val['online_user_id'])."</td>
|
|
|
|
<td>".e107::getIPHandler()->ipDecode($val['user_ip'])."</td>
|
|
|
|
<td><a class='e-tip' href='".$val['user_location']."' title='".$val['user_location']."'>".$tp->html_truncate(basename($val['user_location']),50,"...")."</a></td>
|
2016-01-14 08:28:17 -08:00
|
|
|
<td class='center'><a class='e-tip' href='#' title='".$val['user_agent']."'>".$this->browserIcon($val)."</a></td>";
|
|
|
|
|
|
|
|
$panelOnline .= (!empty($multilan)) ? "<td class='center'><a class='e-tip' href='#' title=\"".$lng->convert($val['user_language'])."\">".$val['user_language']."</a></td>" : "";
|
|
|
|
|
|
|
|
|
|
|
|
$panelOnline .= "
|
2013-02-22 00:50:51 -08:00
|
|
|
</tr>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$panelOnline .= "</tbody></table>";
|
|
|
|
|
|
|
|
return $panelOnline;
|
|
|
|
}
|
|
|
|
|
2012-11-26 03:23:20 -08:00
|
|
|
|
2012-12-04 21:02:47 -08:00
|
|
|
function browserIcon($row)
|
|
|
|
{
|
|
|
|
|
|
|
|
$types = array(
|
|
|
|
"ie" => "MSIE",
|
|
|
|
'chrome' => 'Chrome',
|
|
|
|
'firefox' => 'Firefox',
|
|
|
|
'seamonkey' => 'Seamonkey',
|
|
|
|
// 'Chromium/xyz
|
|
|
|
'safari' => "Safari",
|
|
|
|
'opera' => "Opera"
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if($row['user_bot'] === true)
|
|
|
|
{
|
2013-01-15 18:01:51 -08:00
|
|
|
return "<i class='browser e-bot-16'></i>";
|
2012-12-04 21:02:47 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
foreach($types as $icon=>$b)
|
|
|
|
{
|
|
|
|
if(strpos($row['user_agent'], $b)!==false)
|
|
|
|
{
|
2013-01-15 18:01:51 -08:00
|
|
|
return "<i class='browsers e-".$icon."-16' ></i>";
|
2012-12-04 21:02:47 -08:00
|
|
|
}
|
|
|
|
}
|
2010-02-10 21:53:56 +00:00
|
|
|
|
2013-01-15 18:01:51 -08:00
|
|
|
return "<i class='browsers e-firefox-16'></i>"; // FIXME find a default icon.
|
2012-12-04 21:02:47 -08:00
|
|
|
}
|
2012-11-26 03:23:20 -08:00
|
|
|
|
2010-03-16 07:46:01 +00:00
|
|
|
|
2012-12-04 00:14:43 -08:00
|
|
|
function renderOnlineName($val)
|
2009-07-23 10:46:11 +00:00
|
|
|
{
|
2012-12-04 00:14:43 -08:00
|
|
|
if($val==0)
|
2009-09-03 01:27:27 +00:00
|
|
|
{
|
2015-02-15 19:56:58 -08:00
|
|
|
return LAN_GUEST;
|
2009-09-03 01:27:27 +00:00
|
|
|
}
|
2012-12-04 00:14:43 -08:00
|
|
|
return $val;
|
2009-07-04 03:08:03 +00:00
|
|
|
}
|
2012-11-26 03:23:20 -08:00
|
|
|
|
|
|
|
|
2013-02-22 00:50:51 -08:00
|
|
|
function renderLatestComments()
|
|
|
|
{
|
2013-05-17 19:45:39 -07:00
|
|
|
$sql = e107::getDb();
|
|
|
|
$tp = e107::getParser();
|
2013-02-22 00:50:51 -08:00
|
|
|
|
2013-05-17 19:45:39 -07:00
|
|
|
if(!check_class('B')) // XXX problems?
|
|
|
|
{
|
|
|
|
// return;
|
|
|
|
}
|
|
|
|
|
2013-05-20 13:37:39 -07:00
|
|
|
if(!$rows = $sql->retrieve('comments','*','comment_blocked=2 ORDER BY comment_id DESC LIMIT 25',true) )
|
2013-05-17 19:45:39 -07:00
|
|
|
{
|
2015-02-15 19:56:58 -08:00
|
|
|
return null;
|
2013-05-17 19:45:39 -07:00
|
|
|
}
|
|
|
|
|
2013-02-22 00:50:51 -08:00
|
|
|
|
2013-05-17 19:45:39 -07:00
|
|
|
$sc = e107::getScBatch('comment');
|
2013-05-20 13:37:39 -07:00
|
|
|
|
2013-05-17 19:45:39 -07:00
|
|
|
$text = '
|
2015-07-13 13:09:52 -07:00
|
|
|
<ul class="media-list unstyled list-unstyled">';
|
2013-05-17 19:45:39 -07:00
|
|
|
// <button class='btn btn-mini'><i class='icon-pencil'></i> Edit</button>
|
|
|
|
|
2013-05-20 13:37:39 -07:00
|
|
|
//XXX Always keep template hardcoded here - heavy use of ajax and ids.
|
|
|
|
$count = 1;
|
2016-08-30 11:19:12 -07:00
|
|
|
|
|
|
|
$lanVar = array('x' =>'{USERNAME}', 'y'=>'{TIMEDATE=relative}');
|
|
|
|
|
2013-05-20 13:37:39 -07:00
|
|
|
foreach($rows as $row)
|
|
|
|
{
|
|
|
|
$hide = ($count > 3) ? ' hide' : '';
|
|
|
|
|
2015-02-05 00:02:29 -08:00
|
|
|
$TEMPLATE = "{SETIMAGE: w=40&h=40}
|
2013-05-20 13:37:39 -07:00
|
|
|
<li id='comment-".$row['comment_id']."' class='media".$hide."'>
|
2013-05-17 19:45:39 -07:00
|
|
|
<span class='media-object pull-left'>{USER_AVATAR=".$row['comment_author_id']."}</span>
|
|
|
|
<div class='btn-group pull-right'>
|
2016-08-27 12:03:23 +01:00
|
|
|
<button data-target='".e_BASE."comment.php' data-comment-id='".$row['comment_id']."' data-comment-action='delete' class='btn btn-sm btn-mini btn-danger'><i class='icon-remove'></i> ".LAN_DELETE."</button>
|
|
|
|
<button data-target='".e_BASE."comment.php' data-comment-id='".$row['comment_id']."' data-comment-action='approve' class='btn btn-sm btn-mini btn-success'><i class='icon-ok'></i> ".LAN_APPROVE."</button>
|
2013-05-17 19:45:39 -07:00
|
|
|
</div>
|
2016-08-27 12:03:23 +01:00
|
|
|
<div class='media-body'>
|
2016-08-30 11:19:12 -07:00
|
|
|
<small class='muted smalltext'>".$tp->lanVars(LAN_POSTED_BY_X, $lanVar)."</small><br />
|
2013-05-17 19:45:39 -07:00
|
|
|
<p>{COMMENT}</p>
|
|
|
|
</div>
|
|
|
|
</li>";
|
|
|
|
|
|
|
|
$sc->setVars($row);
|
|
|
|
$text .= $tp->parseTemplate($TEMPLATE,true,$sc);
|
2013-05-20 13:37:39 -07:00
|
|
|
$count++;
|
2013-05-17 19:45:39 -07:00
|
|
|
}
|
|
|
|
|
2013-02-22 00:50:51 -08:00
|
|
|
|
2013-05-17 19:45:39 -07:00
|
|
|
$text .= '
|
2013-05-20 13:37:39 -07:00
|
|
|
</ul>
|
|
|
|
<div class="right">
|
2016-08-27 12:03:23 +01:00
|
|
|
<a class="btn btn-xs btn-mini btn-primary text-right" href="'.e_ADMIN.'comment.php?searchquery=&filter_options=comment_blocked__2">'.LAN_VIEW_ALL.'</a>
|
2013-05-20 13:37:39 -07:00
|
|
|
</div>
|
|
|
|
';
|
|
|
|
// $text .= "<small class='text-center text-warning'>Note: Not fully functional at the moment.</small>";
|
2013-02-22 00:50:51 -08:00
|
|
|
|
|
|
|
$ns = e107::getRender();
|
2016-09-14 11:19:18 +02:00
|
|
|
return $ns->tablerender(LAN_LATEST_COMMENTS,$text,'core-infopanel_online',true);
|
2013-02-22 00:50:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-26 14:41:32 -08:00
|
|
|
|
2012-12-04 00:14:43 -08:00
|
|
|
|
|
|
|
function render_info_panel($caption, $text)
|
2009-09-03 01:27:27 +00:00
|
|
|
{
|
2012-12-04 00:14:43 -08:00
|
|
|
return "<div class='main_caption bevel left'><b>".$caption."</b></div>
|
|
|
|
<div class='left block-text' >".$text."</div>";
|
2009-09-03 01:27:27 +00:00
|
|
|
}
|
2012-12-04 00:14:43 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-12-31 18:55:45 +00:00
|
|
|
function render_infopanel_options($render = false)
|
2009-10-22 23:43:21 +00:00
|
|
|
{
|
2012-12-04 00:14:43 -08:00
|
|
|
$frm = e107::getForm();
|
|
|
|
$mes = e107::getMessage();
|
|
|
|
$ns = e107::getRender();
|
|
|
|
|
|
|
|
if($render == false){ return ""; }
|
2016-11-09 16:06:53 +01:00
|
|
|
|
|
|
|
$text2 = $ns->tablerender(LAN_PERSONALIZE_ICONS, $this->render_infopanel_icons(),'personalize',true);
|
2012-12-04 00:14:43 -08:00
|
|
|
$text2 .= "<div class='clear'> </div>";
|
2016-09-14 11:55:37 -07:00
|
|
|
$text2 .= $ns->tablerender(LAN_PERSONALIZE_MENUS, $this->render_infopanel_menu_options(),'personalize',true);
|
2012-12-04 00:14:43 -08:00
|
|
|
$text2 .= "<div class='clear'> </div>";
|
|
|
|
$text2 .= "<div id='button' class='buttons-bar center'>";
|
2016-09-14 11:19:18 +02:00
|
|
|
$text2 .= $frm->admin_button('submit-mye107', LAN_SAVE, 'create');
|
2016-11-09 16:06:53 +01:00
|
|
|
$text2 .= "</div>";
|
|
|
|
|
2015-02-15 19:56:58 -08:00
|
|
|
return $mes->render().$text2;
|
2012-12-04 00:14:43 -08:00
|
|
|
}
|
2010-02-10 21:53:56 +00:00
|
|
|
|
2009-09-18 23:14:01 +00:00
|
|
|
|
2012-12-04 00:14:43 -08:00
|
|
|
function render_infopanel_icons()
|
2009-09-03 01:27:27 +00:00
|
|
|
{
|
2012-12-08 00:36:34 -08:00
|
|
|
|
|
|
|
$frm = e107::getForm();
|
2016-11-11 13:44:20 +01:00
|
|
|
$user_pref = $this->getUserPref();
|
2015-02-15 19:56:58 -08:00
|
|
|
|
2015-01-27 15:20:12 -08:00
|
|
|
$text = "<div style='padding-left:20px'>";
|
2016-11-11 13:44:20 +01:00
|
|
|
|
|
|
|
|
2016-11-16 21:21:12 +01:00
|
|
|
$myE107 = varset($user_pref['core-infopanel-mye107'], array());
|
|
|
|
if(empty($myE107)) // Set default icons.
|
2016-11-11 13:44:20 +01:00
|
|
|
{
|
|
|
|
$defArray = array(
|
|
|
|
0 => 'e-administrator',
|
|
|
|
1 => 'e-cpage',
|
|
|
|
2 => 'e-frontpage',
|
|
|
|
3 => 'e-mailout',
|
|
|
|
4 => 'e-image',
|
|
|
|
5 => 'e-menus',
|
|
|
|
6 => 'e-meta',
|
|
|
|
7 => 'e-newspost',
|
|
|
|
8 => 'e-plugin',
|
|
|
|
9 => 'e-prefs',
|
|
|
|
10 => 'e-links',
|
|
|
|
11 => 'e-theme',
|
|
|
|
12 => 'e-userclass2',
|
|
|
|
13 => 'e-users',
|
|
|
|
14 => 'e-wmessage'
|
|
|
|
);
|
|
|
|
$user_pref['core-infopanel-mye107'] = $defArray;
|
|
|
|
}
|
2012-12-04 00:14:43 -08:00
|
|
|
|
|
|
|
|
2012-12-08 00:36:34 -08:00
|
|
|
foreach ($this->iconlist as $key=>$icon)
|
2009-09-03 01:27:27 +00:00
|
|
|
{
|
|
|
|
if (getperms($icon['perms']))
|
|
|
|
{
|
2012-12-04 00:14:43 -08:00
|
|
|
$checked = (varset($user_pref['core-infopanel-mye107']) && in_array($key, $user_pref['core-infopanel-mye107'])) ? true : false;
|
2016-01-30 17:24:03 -08:00
|
|
|
$text .= "<div class='left f-left list field-spacer form-inline' style='display:block;height:24px;width:200px;'>
|
2012-12-04 00:14:43 -08:00
|
|
|
".$icon['icon'].' '.$frm->checkbox_label($icon['title'], 'e-mye107[]', $key, $checked)."</div>";
|
2012-12-08 00:36:34 -08:00
|
|
|
|
2012-12-04 00:14:43 -08:00
|
|
|
}
|
|
|
|
}
|
2012-12-08 00:36:34 -08:00
|
|
|
|
2016-11-11 13:44:20 +01:00
|
|
|
if (isset($pluglist) && is_array($pluglist))
|
2012-12-04 00:14:43 -08:00
|
|
|
{
|
|
|
|
foreach ($pluglist as $key=>$icon)
|
|
|
|
{
|
|
|
|
if (getperms($icon['perms']))
|
|
|
|
{
|
|
|
|
$checked = (in_array('p-'.$key, $user_pref['core-infopanel-mye107'])) ? true : false;
|
2016-01-30 17:24:03 -08:00
|
|
|
$text .= "<div class='left f-left list field-spacer form-inline' style='display:block;height:24px;width:200px;'>
|
2012-12-04 00:14:43 -08:00
|
|
|
".$icon['icon'].$frm->checkbox_label($icon['title'], 'e-mye107[]', $key, $checked)."</div>";
|
|
|
|
}
|
2009-09-03 01:27:27 +00:00
|
|
|
}
|
|
|
|
}
|
2015-01-27 15:20:12 -08:00
|
|
|
$text .= "</div><div class='clear'> </div>";
|
2012-12-04 00:14:43 -08:00
|
|
|
return $text;
|
2009-09-03 01:27:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-11-26 14:41:32 -08:00
|
|
|
|
2010-02-10 21:53:56 +00:00
|
|
|
|
2012-12-04 00:14:43 -08:00
|
|
|
function render_infopanel_menu_options()
|
2009-09-03 01:27:27 +00:00
|
|
|
{
|
2012-12-04 00:14:43 -08:00
|
|
|
if(!getperms('0'))
|
2009-09-03 01:27:27 +00:00
|
|
|
{
|
2012-12-04 00:14:43 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$frm = e107::getForm();
|
2016-11-11 13:44:20 +01:00
|
|
|
$user_pref = $this->getUserPref();
|
2012-12-04 00:14:43 -08:00
|
|
|
|
|
|
|
|
2015-01-27 15:20:12 -08:00
|
|
|
$text = "<div style='padding-left:20px'>";
|
2012-12-04 00:14:43 -08:00
|
|
|
$menu_qry = 'SELECT * FROM #menus WHERE menu_id!= 0 GROUP BY menu_name ORDER BY menu_name';
|
2016-11-07 15:56:47 +01:00
|
|
|
$settings = varset($user_pref['core-infopanel-menus'],array());
|
2012-12-04 00:14:43 -08:00
|
|
|
|
2016-02-15 00:14:45 -08:00
|
|
|
if (e107::getDb()->gen($menu_qry))
|
2012-12-04 00:14:43 -08:00
|
|
|
{
|
|
|
|
while ($row = e107::getDb()->db_Fetch())
|
2009-10-26 09:50:00 +00:00
|
|
|
{
|
2016-11-07 16:01:12 +01:00
|
|
|
// Custom menu (core).
|
2016-11-07 15:56:47 +01:00
|
|
|
if(is_numeric($row['menu_path']))
|
|
|
|
{
|
|
|
|
$path_to_menu = $row['menu_path'];
|
|
|
|
}
|
2016-11-07 16:01:12 +01:00
|
|
|
// Plugin defined menu.
|
2016-11-07 15:56:47 +01:00
|
|
|
else
|
2012-12-04 00:14:43 -08:00
|
|
|
{
|
|
|
|
$path_to_menu = $row['menu_path'].$row['menu_name'];
|
|
|
|
}
|
2016-11-07 15:56:47 +01:00
|
|
|
|
|
|
|
$label = str_replace("_menu","",$row['menu_name']);
|
|
|
|
$checked = ($settings && in_array($path_to_menu, $settings)) ? true : false;
|
|
|
|
$text .= "\n<div class='left f-left list field-spacer' style='display:block;height:24px;width:200px;'>";
|
|
|
|
$text .= $frm->checkbox_label($label, "e-mymenus[]",$path_to_menu, $checked);
|
|
|
|
$text .= "</div>";
|
2009-10-26 09:50:00 +00:00
|
|
|
}
|
2009-09-03 01:27:27 +00:00
|
|
|
}
|
2012-12-04 00:14:43 -08:00
|
|
|
|
2015-01-27 15:20:12 -08:00
|
|
|
$text .= "</div><div class='clear'> </div>";
|
2012-12-04 00:14:43 -08:00
|
|
|
return $text;
|
2009-09-03 01:27:27 +00:00
|
|
|
}
|
2012-12-04 17:02:01 -08:00
|
|
|
|
|
|
|
|
2013-05-15 15:01:55 -07:00
|
|
|
private function getStats($type)
|
2012-12-04 17:02:01 -08:00
|
|
|
{
|
2013-05-15 15:01:55 -07:00
|
|
|
|
|
|
|
|
|
|
|
if(file_exists(e_PLUGIN."awstats/awstats.graph.php"))
|
2013-01-15 18:01:51 -08:00
|
|
|
{
|
|
|
|
require_once(e_PLUGIN."awstats/awstats.graph.php");
|
2013-05-25 22:30:10 -07:00
|
|
|
$stat = new awstats;
|
2013-05-17 19:45:39 -07:00
|
|
|
|
2013-05-25 22:30:10 -07:00
|
|
|
if($data = $stat->getData())
|
2013-05-17 19:45:39 -07:00
|
|
|
{
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
2013-05-15 15:01:55 -07:00
|
|
|
// return;
|
2013-01-15 18:01:51 -08:00
|
|
|
}
|
2012-12-04 17:02:01 -08:00
|
|
|
|
2013-05-15 15:01:55 -07:00
|
|
|
if($type == 'demo')
|
2013-03-17 14:47:35 -07:00
|
|
|
{
|
2013-05-15 15:01:55 -07:00
|
|
|
$data = array();
|
2012-12-04 17:02:01 -08:00
|
|
|
|
2016-12-31 21:23:02 +00:00
|
|
|
$months = e107::getDate()->terms('month');
|
|
|
|
|
|
|
|
$data['labels'] = array($months[0], //"January",
|
|
|
|
$months[1], //"February",
|
|
|
|
$months[2], //"March",
|
|
|
|
$months[3], //"April",
|
|
|
|
$months[4], //"May",
|
|
|
|
$months[5], //"June",
|
|
|
|
$months[6] //"July"
|
|
|
|
);
|
2013-05-15 15:01:55 -07:00
|
|
|
|
|
|
|
$data['datasets'][] = array(
|
2016-12-31 18:55:45 +00:00
|
|
|
'fillColor' => "rgba(220,220,220,0.5)",
|
|
|
|
'strokeColor' => "rgba(220,220,220,1)",
|
|
|
|
'pointColor ' => "rgba(220,220,220,1)",
|
|
|
|
'pointStrokeColor' => "#fff",
|
|
|
|
'data' => array(65,59,90,81,56,55,40),
|
|
|
|
'title' => ADLAN_168// "Visits"
|
2013-05-15 15:01:55 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
$data['datasets'][] = array(
|
2016-12-31 18:55:45 +00:00
|
|
|
'fillColor' => "rgba(151,187,205,0.5)",
|
|
|
|
'strokeColor' => "rgba(151,187,205,1)",
|
|
|
|
'pointColor ' => "rgba(151,187,205,1)",
|
|
|
|
'pointStrokeColor' => "#fff",
|
|
|
|
'data' => array(28,48,40,19,96,27,100),
|
|
|
|
'title' => ADLAN_169 //"Unique Visits"
|
|
|
|
);
|
2013-05-15 15:01:55 -07:00
|
|
|
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-12-04 17:02:01 -08:00
|
|
|
|
|
|
|
$sql = e107::getDB();
|
|
|
|
|
|
|
|
$td = date("Y-m-j", time());
|
|
|
|
$dayarray[$td] = array();
|
|
|
|
$pagearray = array();
|
|
|
|
|
|
|
|
$qry = "
|
|
|
|
SELECT * from #logstats WHERE log_id REGEXP('[[:digit:]]+\-[[:digit:]]+\-[[:digit:]]+')
|
|
|
|
ORDER BY CONCAT(LEFT(log_id,4), SUBSTRING(log_id, 6, 2), LPAD(SUBSTRING(log_id, 9), 2, '0'))
|
2012-12-04 21:02:47 -08:00
|
|
|
DESC LIMIT 0,9
|
2012-12-04 17:02:01 -08:00
|
|
|
";
|
|
|
|
|
2013-05-16 13:12:29 -07:00
|
|
|
if($amount = $sql->gen($qry))
|
2012-12-04 17:02:01 -08:00
|
|
|
{
|
2013-05-16 13:12:29 -07:00
|
|
|
$array = $sql->db_getList();
|
2012-12-04 17:02:01 -08:00
|
|
|
|
|
|
|
$ttotal = 0;
|
|
|
|
$utotal = 0;
|
|
|
|
|
|
|
|
foreach($array as $key => $value)
|
|
|
|
{
|
|
|
|
extract($value);
|
2016-02-12 17:28:51 +01:00
|
|
|
$log_id = substr($log_id, 0, 4).'-'.substr($log_id, 5, 2).'-'.str_pad(substr($log_id, 8), 2, '0', STR_PAD_LEFT);
|
2012-12-04 17:02:01 -08:00
|
|
|
if(is_array($log_data)) {
|
|
|
|
$entries[0] = $log_data['host'];
|
|
|
|
$entries[1] = $log_data['date'];
|
|
|
|
$entries[2] = $log_data['os'];
|
|
|
|
$entries[3] = $log_data['browser'];
|
|
|
|
$entries[4] = $log_data['screen'];
|
|
|
|
$entries[5] = $log_data['referer'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$entries = explode(chr(1), $log_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
$dayarray[$log_id]['daytotal'] = $entries[0];
|
|
|
|
$dayarray[$log_id]['dayunique'] = $entries[1];
|
|
|
|
|
|
|
|
unset($entries[0]);
|
|
|
|
unset($entries[1]);
|
|
|
|
|
|
|
|
foreach($entries as $entry)
|
|
|
|
{
|
|
|
|
if($entry)
|
|
|
|
{
|
|
|
|
list($url, $total, $unique) = explode("|", $entry);
|
|
|
|
if(strstr($url, "/"))
|
|
|
|
{
|
|
|
|
$urlname = preg_replace("/\.php|\?.*/", "", substr($url, (strrpos($url, "/")+1)));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$urlname = preg_replace("/\.php|\?.*/", "", $url);
|
|
|
|
}
|
|
|
|
$dayarray[$log_id][$urlname] = array('url' => $url, 'total' => $total, 'unique' => $unique);
|
|
|
|
if (!isset($pagearray[$urlname]['total'])) $pagearray[$urlname]['total'] = 0;
|
|
|
|
if (!isset($pagearray[$urlname]['unique'])) $pagearray[$urlname]['unique'] = 0;
|
|
|
|
$pagearray[$urlname]['total'] += $total;
|
|
|
|
$pagearray[$urlname]['unique'] += $unique;
|
|
|
|
$ttotal += $total;
|
|
|
|
$utotal += $unique;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$logfile = e_LOG.'logp_'.date('z.Y', time()).'.php'; // was logi_ ??
|
|
|
|
if(is_readable($logfile))
|
|
|
|
{
|
|
|
|
require($logfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-06 14:16:55 -08:00
|
|
|
if(vartrue($pageInfo))
|
2012-12-04 17:02:01 -08:00
|
|
|
{
|
2012-12-06 14:16:55 -08:00
|
|
|
foreach($pageInfo as $fkey => $fvalue)
|
|
|
|
{
|
|
|
|
$dayarray[$td][$fkey]['total'] += $fvalue['ttl'];
|
|
|
|
$dayarray[$td][$fkey]['unique'] += $fvalue['unq'];
|
|
|
|
$dayarray[$td]['daytotal'] += $fvalue['ttl'];
|
|
|
|
$dayarray[$td]['dayunique'] += $fvalue['unq'];
|
|
|
|
$pagearray[$fkey]['total'] += $fvalue['ttl'];
|
|
|
|
$pagearray[$fkey]['unique'] += $fvalue['unq'];
|
|
|
|
$ttotal += $fvalue['ttl'];
|
|
|
|
$utotal += $fvalue['unq'];
|
|
|
|
}
|
2012-12-04 17:02:01 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-15 15:01:55 -07:00
|
|
|
$visitors = array();
|
|
|
|
$unique = array();
|
|
|
|
|
|
|
|
|
2012-12-04 17:02:01 -08:00
|
|
|
ksort($dayarray);
|
|
|
|
foreach($dayarray as $k=>$v)
|
|
|
|
{
|
|
|
|
$unix = strtotime($k);
|
|
|
|
|
2013-05-15 15:01:55 -07:00
|
|
|
$visitors[] = intval(vartrue($v['daytotal']));
|
|
|
|
$unique[] = intval(vartrue($v['dayunique']));
|
2012-12-04 17:02:01 -08:00
|
|
|
$label[] = "'".date("D",$unix)."'";
|
|
|
|
}
|
|
|
|
|
2013-05-15 15:01:55 -07:00
|
|
|
$data = array();
|
|
|
|
|
|
|
|
$data['labels'] = $label;
|
|
|
|
|
2013-05-16 13:12:29 -07:00
|
|
|
//visitors
|
2013-05-15 15:01:55 -07:00
|
|
|
$data['datasets'][] = array(
|
|
|
|
'fillColor' => "rgba(220,220,220,0.5)",
|
|
|
|
'strokeColor' => "rgba(220,220,220,1)",
|
|
|
|
'pointColor ' => "rgba(220,220,220,1)",
|
|
|
|
'pointStrokeColor' => "#fff",
|
|
|
|
'data' => $visitors
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2013-05-16 13:12:29 -07:00
|
|
|
//Unique Visitors
|
2013-05-15 15:01:55 -07:00
|
|
|
$data['datasets'][] = array(
|
|
|
|
'fillColor' => "rgba(151,187,205,0.5)",
|
|
|
|
'strokeColor' => "rgba(151,187,205,1)",
|
|
|
|
'pointColor ' => "rgba(151,187,205,1)",
|
|
|
|
'pointStrokeColor' => "#fff",
|
|
|
|
'data' => $unique
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $data;
|
2012-12-04 17:02:01 -08:00
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-15 15:01:55 -07:00
|
|
|
|
|
|
|
|
|
|
|
private function renderStats($type)
|
2012-12-04 17:02:01 -08:00
|
|
|
{
|
2013-05-15 15:01:55 -07:00
|
|
|
|
|
|
|
$data = $this->getStats($type);
|
|
|
|
|
2013-03-17 14:47:35 -07:00
|
|
|
|
2013-05-15 15:01:55 -07:00
|
|
|
$cht = e107::getChart();
|
|
|
|
$cht->setType('line');
|
2014-06-22 16:58:18 -07:00
|
|
|
$cht->setOptions(array(
|
|
|
|
'annotateDisplay' => true,
|
|
|
|
'annotateFontSize' => 8
|
|
|
|
));
|
2013-05-15 15:01:55 -07:00
|
|
|
$cht->setData($data,'canvas');
|
|
|
|
$text = $cht->render('canvas');
|
|
|
|
|
|
|
|
|
|
|
|
if($type == 'demo')
|
|
|
|
{
|
2016-12-31 18:55:45 +00:00
|
|
|
$text .= "<div class='center'><small>".ADLAN_170."<a class='btn btn-xs btn-mini' href='".e_ADMIN."plugin.php?avail'>".ADLAN_171."</a></small></div>";
|
2013-05-15 15:01:55 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$text .= "<div class='center'><small>
|
2016-12-31 18:55:45 +00:00
|
|
|
<span style='color:rgba(220,220,220,0.5)'>♦</span>".ADLAN_168."
|
|
|
|
<span style='color:rgba(151,187,205,1)'>♦</span>".ADLAN_169."
|
2013-05-15 15:01:55 -07:00
|
|
|
</small></div>";
|
|
|
|
}
|
2012-12-04 17:02:01 -08:00
|
|
|
|
|
|
|
|
2016-12-31 18:55:45 +00:00
|
|
|
return $text;
|
2012-12-04 17:02:01 -08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-09-03 01:27:27 +00:00
|
|
|
}
|
2009-07-04 03:08:03 +00:00
|
|
|
?>
|
2016-12-31 18:55:45 +00:00
|
|
|
|