1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-16 20:28:28 +01:00

Updated the log plugin. Updated the bootstrap preview.

This commit is contained in:
Cameron 2012-12-04 21:02:47 -08:00
parent f46d3a34cc
commit 956d0b2abd
8 changed files with 181 additions and 32 deletions

View File

@ -1,7 +1,16 @@
## e107 Content Management System - v2
## e107 [Content Management System][1] (CMS) - v2
Important: This is an unstable, developer version of e107.
For a stable earlier release see [www.e107.org][1]
Important: This is a developer version of e107.
For a stable release please see [www.e107.org][2]
### What is e107?
e107 is a free (open-source) content management system which allows you to easily manage and publish your content online. Developers can save time in building websites and powerful online applications. Users can avoid programming completely! Blogs, Websites, Intranets - e107 does it all.
### Requirements
* PHP v5.3 or higher
* MySQL 4.x or higher
### Installation
@ -12,13 +21,14 @@ For a stable earlier release see [www.e107.org][1]
### Reporting Bugs
Be sure you are using the most recent version prior to reporting an issue.
Your may report any bugs or feature requests on Github [here][2]
Your may report any bugs or feature requests on Github [here][3]
## Pull-Requests
### Pull-Requests
* Please submit 1 pull-request for each Github #issue you may work on.
* Make sure that only the lines you have changed actually show up in a file-comparison (diff) ie. some text-editors alter every line so this should be avoided.
[1]: http://www.e107.org
[2]: https://github.com/e107inc/e107/issues
[1]: http://e107.org
[2]: http://www.e107.org
[3]: https://github.com/e107inc/e107/issues

View File

@ -176,7 +176,7 @@ EOF;
// REQUIRES Log Plugin to be installed.
if (e107::isInstalled('log'))
{
$text2 .= $ns->tablerender("Visitors This Week", $this->renderStats(),"core-infopanel_stats",true);
$text2 .= $ns->tablerender("Visitors Last 10 Days", $this->renderStats(),"core-infopanel_stats",true);
}
else
{
@ -203,8 +203,10 @@ EOF;
// ---------------------- Who's Online ------------------------
// TODO Could use a new _menu item instead.
$nOnline = e107::getDB()->db_Select('online', '*');
$ol = e107::getOnline();
// echo "Users: ".print_a($ol->userList());
$panelOnline = "
<table class='table adminlist'>
@ -228,22 +230,21 @@ EOF;
if (e107::getDB()->db_Select('online', '*',"online_ip !='' LIMIT 20"))
{
$newsarray = e107::getDB()->db_getList();
foreach ($newsarray as $key=>$val)
$online = $ol->userList();
foreach ($online as $val)
{
$panelOnline .= "<tr>
<td class='nowrap'>".e107::getDateConvert()->convert_date($val['online_timestamp'],'%H:%M:%S')."</td>
<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['online_ip'])."</td>
<td><a href='".$val['online_location']."' title='".$val['online_location']."'>".$tp->text_truncate($val['online_location'],50,'...')."</a></td>
<td>".$tp->text_truncate(str_replace("/"," / ",$val['online_agent']),20,'...')."</td>
<td>".e107::getIPHandler()->ipDecode($val['user_ip'])."</td>
<td><a class='e-tip' href='".$val['user_location']."' title='".$val['user_location']."'>".basename($val['user_location'])."</a></td>
<td><a class='e-tip' href='#' title='".$val['user_agent']."'>".$this->browserIcon($val)."</a></td>
</tr>
";
}
}
//$tp->text_truncate(str_replace("/"," / ",$val['user_agent']),20,'...')
$panelOnline .= "</tbody></table>
";
@ -307,7 +308,35 @@ EOF;
}
function browserIcon($row)
{
$types = array(
"ie" => "MSIE",
'chrome' => 'Chrome',
'firefox' => 'Firefox',
'seamonkey' => 'Seamonkey',
// 'Chromium/xyz
'safari' => "Safari",
'opera' => "Opera"
);
if($row['user_bot'] === true)
{
return "<i class='browser e-bot-32'></i>";
}
foreach($types as $icon=>$b)
{
if(strpos($row['user_agent'], $b)!==false)
{
return "<i class='browsers e-".$icon."-32' ></i>";
}
}
return "<i class='browsers e-firefox-32'></i>"; // FIXME find a default icon.
}
function renderOnlineName($val)
@ -457,7 +486,7 @@ EOF;
$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'))
DESC LIMIT 0,6
DESC LIMIT 0,9
";
if($amount = $sql -> db_Select_gen($qry))
@ -549,21 +578,24 @@ EOF;
e107::js('inline',"
function drawMyChart()
{
if(!!document.createElement('canvas').getContext){ //check that the canvas
// element is supported
if(!!document.createElement('canvas').getContext) //check that the canvas element is supported
{
var mychart = new AwesomeChart('canvas1');
// mychart.title = 'Product Sales - 2010';
// mychart.chartType = 'pareto';
// mychart.data = [1532, 3251, 3460, 1180, 6543];
// mychart.labels = ['Desktops', 'Laptops', 'Netbooks','Tablets','Smartphones'];
// mychart.colors = ['#006CFF', '#FF6600', '#34A038', '#945D59', '#93BBF4', '#F493B8'];
mychart.chartType = 'pareto';
mychart.data = [".implode(", ",$day)."];
mychart.labels = [".implode(", ",$label)."];
mychart.colors = ['#0088CC', '#FF6600','#0088CC', '#FF6600','#0088CC', '#FF6600','#0088CC', '#FF6600'];
mychart.data = [".implode(", ",$day)."];
mychart.labels = [".implode(", ",$label)."];
mychart.colors = ['#0088CC', '#FF6600','#0088CC', '#FF6600','#0088CC', '#FF6600','#0088CC', '#FF6600','#0088CC'];
mychart.animate = true;
mychart.animationFrames = 30;
// mychart.randomColors = true;
// mychart.dataValueFontHeight = 20;
mychart.yAxisLabelFontHeight = 15;
mychart.chartMarkerSize = 20;
mychart.chartHorizontalLineStrokeStyle = '#999';
mychart.chartHorizontalLineWidth = 1;
mychart.draw();
}
}

View File

@ -58,6 +58,18 @@ SELECT COUNT(`online_user_id`) AS ol_count, `online_user_id` FROM `#online` GROU
*/
class e_online
{
public $users = array();
function __construct()
{
}
/**
* Go online
* @param boolean $online_tracking
@ -231,15 +243,36 @@ class e_online
// FIXME - don't use constants below, save data in class vars, call e_online signleton - e107::getOnline()
$total_online = $sql->db_Count('online');
if ($members_online = $sql->db_Select('online', 'online_user_id, online_location', 'online_user_id != 0'))
if ($members_online = $sql->db_Select('online', '*', 'online_user_id != 0'))
{
$member_list = '';
$listuserson = array();
while ($row = $sql->db_Fetch())
{
$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.
$user = array(
'user_id' => $vals[0],
'user_name' => $vals[1],
'user_location' => $row['online_location'],
'user_bot' => $this->isBot($row['online_agent']),
'user_agent' => $row['online_agent'],
'user_ip' => $row['online_ip'],
'user_currentvisit' => $row['online_timestamp'],
'user_online' => $row['online_flag'],
'user_pagecount' => $row['online_pagecount'],
'user_active' => $row['online_active'],
'online_user_id' => $row['online_user_id']
);
$this->users[] = $user;
}
}
define('TOTAL_ONLINE', $total_online);
@ -269,4 +302,39 @@ class e_online
define('MEMBER_LIST', '');
}
}
function userList()
{
return $this->users;
}
function isBot($userAgent='')
{
if(!$userAgent){ return false; }
$botlist = array("Teoma", "alexa", "froogle", "Gigabot", "inktomi",
"looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory",
"Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot",
"crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp",
"msnbot", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz",
"Baiduspider", "Feedfetcher-Google", "TechnoratiSnoop", "Rankivabot",
"Mediapartners-Google", "Sogou web spider", "WebAlta Crawler","TweetmemeBot",
"Butterfly","Twitturls","Me.dium","Twiceler");
foreach($botlist as $bot)
{
if(strpos($userAgent, $bot) !== false){ return true; }
}
return false;
}
}

View File

@ -474,6 +474,8 @@ function AwesomeChart(canvasElementId){
context.rotate(Math.PI/2);
context.translate(-this.width/2, -this.height/2);
//Calculate bar size:
var n = this.data.length;
@ -562,6 +564,8 @@ function AwesomeChart(canvasElementId){
context.restore();
context.stroke();
//Draw the label:
context.font = this.labelFontStyle + ' ' + this.labelFontHeight + 'px '+ this.labelFont;
@ -606,6 +610,8 @@ function AwesomeChart(canvasElementId){
x = x + barWidth + this.barHGap;
}
context.restore();
}
@ -687,6 +693,9 @@ function AwesomeChart(canvasElementId){
changeOfMarginBottom = belowZeroMaxBarHeight / numFrames;
changeOfMarginTop = (chartAreaHeight - belowZeroMaxBarHeight) / numFrames;
var updateVerticalBarChart = function() {
if(currentFrame++ < numFrames) {
@ -724,6 +733,9 @@ function AwesomeChart(canvasElementId){
}
}
updateVerticalBarChart();
}

View File

@ -1903,7 +1903,7 @@ class siteStats
$utotal += $fvalue['unq'];
}
print_a($dayarray);;
// print_a($dayarray);;
$text = "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 30%;'>".ADSTAT_L33." ".($amount+1)." ".ADSTAT_L40."</td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L34."</td>\n</tr>\n";

View File

@ -553,3 +553,30 @@ i.e-users-32{ background-position: -740px -37px; width: 32px; height: 32px; }
i.e-warning-32{ background-position: -777px -37px; width: 32px; height: 32px; }
i.e-welcome-32{ background-position: -814px -37px; width: 32px; height: 32px; }
i.browsers {
background: url(images/browsers.png) no-repeat top left;
display:inline-block;
*margin-right: .3em;
line-height: 14px;
vertical-align: text-top;
}
i.e-bot-16{ background-position: 0 0; width: 16px; height: 16px; }
i.e-bot-32{ background-position: -21px 0; width: 32px; height: 32px; }
i.e-camino-16{ background-position: -58px 0; width: 16px; height: 16px; }
i.e-camino-32{ background-position: -79px 0; width: 32px; height: 32px; }
i.e-chrome-16{ background-position: -116px 0; width: 16px; height: 16px; }
i.e-chrome-32{ background-position: -137px 0; width: 32px; height: 32px; }
i.e-firefox-16{ background-position: -174px 0; width: 16px; height: 16px; }
i.e-firefox-32{ background-position: -195px 0px; width: 32px; height: 32px; }
i.e-ie-16{ background-position: -232px 0; width: 16px; height: 16px; }
i.e-ie-32{ background-position: -253px 0; width: 32px; height: 32px; }
i.e-konqueror-16{ background-position: -290px 0; width: 16px; height: 16px; }
i.e-konqueror-32{ background-position: -311px 0; width: 32px; height: 32px; }
i.e-opera-16{ background-position: -348px 0; width: 16px; height: 16px; }
i.e-opera-32{ background-position: -369px 0; width: 32px; height: 32px; }
i.e-safari-16{ background-position: -406px 0; width: 16px; height: 16px; }
i.e-safari-32{ background-position: -427px 0; width: 32px; height: 32px; }
i.e-seamonkey-16{ background-position: -464px 0; width: 16px; height: 16px; }
i.e-seamonkey-32{ background-position: -485px 0; width: 32px; height: 32px; }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB