aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin/images/monthly_visits.img.php121
-rw-r--r--admin/images/phpBarGraph.php391
-rw-r--r--admin/include/isadmin.inc.php2
-rw-r--r--admin/stats.php58
-rw-r--r--include/functions.inc.php4
-rw-r--r--install/phpwebgallery_structure.sql5
-rw-r--r--template/default/admin/stats.tpl3
-rw-r--r--template/default/admin/stats.vtp83
8 files changed, 527 insertions, 140 deletions
diff --git a/admin/images/monthly_visits.img.php b/admin/images/monthly_visits.img.php
new file mode 100644
index 000000000..21a89ef8f
--- /dev/null
+++ b/admin/images/monthly_visits.img.php
@@ -0,0 +1,121 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | monthly_visits.img.php |
+// +-----------------------------------------------------------------------+
+// | application : PhpWebGallery <http://phpwebgallery.net> |
+// | branch : BSF (Best So Far) |
+// +-----------------------------------------------------------------------+
+// | file : $RCSfile$
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+//----------------------------------------------------------- include
+define('PHPWG_ROOT_PATH','../../');
+define('IN_ADMIN', true);
+include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
+include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
+include_once( 'phpBarGraph.php' );
+
+//------------------------------------------------ variable definition
+$outputFormat = "png";
+$legend = $lang['stats_pages_seen_graph_title'];
+$imageHeight = 256;
+$imageWidth = 320;
+$sql = "SELECT DISTINCT COUNT(*), MONTH(date)
+ FROM phpwg_history
+ WHERE (date > DATE_SUB(CURRENT_DATE(), INTERVAL 12 MONTH))
+ GROUP BY DATE_FORMAT(date,'%Y-%m') DESC;";
+
+//------------------------------------------------ Image definition
+$image = ImageCreate($imageWidth, $imageHeight);
+//$image = ImageCreateTrueColor($imageWidth, $imageHeight);
+// Fill it with your favorite background color..
+$backgroundColor = ImageColorAllocate($image, 184, 184, 184);
+ImageFill($image, 0, 0, $backgroundColor);
+$white = ImageColorAllocate($image, 0, 0, 0);
+
+// Interlace the image..
+Imageinterlace($image, 1);
+
+// Create a new BarGraph..
+$myBarGraph = new PhpBarGraph;
+$myBarGraph->SetX(10); // Set the starting x position
+$myBarGraph->SetY(10); // Set the starting y position
+$myBarGraph->SetWidth($imageWidth-20); // Set how wide the bargraph will be
+$myBarGraph->SetHeight($imageHeight-20); // Set how tall the bargraph will be
+$myBarGraph->SetNumOfValueTicks(3); // Set this to zero if you don't want to show any. These are the vertical bars to help see the values.
+
+
+// You can try uncommenting these lines below for different looks.
+
+// $myBarGraph->SetShowLabels(false); // The default is true. Setting this to false will cause phpBarGraph to not print the labels of each bar.
+ $myBarGraph->SetShowValues(false); // The default is true. Setting this to false will cause phpBarGraph to not print the values of each bar.
+// $myBarGraph->SetBarBorder(false); // The default is true. Setting this to false will cause phpBarGraph to not print the border of each bar.
+// $myBarGraph->SetShowFade(false); // The default is true. Setting this to false will cause phpBarGraph to not print each bar as a gradient.
+// $myBarGraph->SetShowOuterBox(false); // The default is true. Setting this to false will cause phpBarGraph to not print the outside box.
+$myBarGraph->SetBarSpacing(5); // The default is 10. This changes the space inbetween each bar.
+
+
+// Add Values to the bargraph..
+$result = mysql_query($sql)
+or die(mysql_errno().": ".mysql_error()."<BR>".$sql);
+
+//$monthes =array_fill(1,12,0);
+$monthes =array();
+$date = getdate();
+$current_month = $date['mon'];
+for ($i=0;$i<12;$i++)
+{
+ $monthes[(($current_month-$i+11)%12)+1]=0;
+}
+
+while ($r = mysql_fetch_row($result))
+{
+ if (!$monthes[$r[1]]) $monthes[$r[1]]= $r[0];
+}
+$monthes = array_reverse($monthes,true);
+while (list ($key,$value) = each($monthes))
+{
+ $nls_key = substr($lang['month'][$key],0,3);
+ $myBarGraph->AddValue($nls_key, $value);
+}
+
+//$myBarGraph->SetDebug(true);
+// Set the colors of the bargraph..
+$myBarGraph->SetStartBarColor("6666ff"); // This is the color on the top of every bar.
+$myBarGraph->SetEndBarColor("2222aa"); // This is the color on the bottom of every bar. This is not used when SetShowFade() is set to false.
+$myBarGraph->SetLineColor("000000"); // This is the color all the lines and text are printed out with.
+
+// Print the BarGraph to the image..
+$myBarGraph->DrawBarGraph($image);
+Imagestring($image, 2, 2, $imageHeight-14, $legend, $white);
+
+//------------------------------------------------ Image output
+if ($outputFormat == "png")
+{
+ header("Content-type: image/png");
+ ImagePNG($image);
+}
+else if ($outputFormat == "jpg")
+{
+ header("Content-type: image/jpeg");
+ Imagejpeg($image);
+}
+// Destroy the image.
+Imagedestroy($image);
+?> \ No newline at end of file
diff --git a/admin/images/phpBarGraph.php b/admin/images/phpBarGraph.php
new file mode 100644
index 000000000..7b5fba243
--- /dev/null
+++ b/admin/images/phpBarGraph.php
@@ -0,0 +1,391 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | phpBarGraph.php |
+// +-----------------------------------------------------------------------+
+// | application : PhpWebGallery <http://phpwebgallery.net> |
+// | branch : BSF (Best So Far) |
+// +-----------------------------------------------------------------------+
+// | file : $RCSfile$
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+// Original PhpBarGraph Version 2.3
+// Written By TJ Hunter (tjhunter@ruistech.com)
+// http://www.ruistech.com/phpBarGraph
+// This class has been adapted to fill phpWG requirements
+
+class PhpBarGraph
+{
+ /* -------------------------------- */
+ /* Preference Variables */
+ /* -------------------------------- */
+ var $_debug;
+ var $_image; // The image to print the bargraph too.
+ var $_x; // The starting column of the bargraph
+ var $_y; // The starting row of the bargraph
+ var $_width; // The width of the bargraph
+ var $_height; // The height of the bargraph
+ var $_startBarColorHex; // The top color of the bargraph
+ var $_endBarColorHex; // The bottom color of the bargraph
+ var $_lineColorHex; // The color of the lines and text
+ var $_barSpacing; // The spacing width in between each bar
+ var $_numOfValueTicks; // The number of horizontal rule ticks
+ var $_values; // An array of arrays of the values of each bargraph and it's label
+ var $_showLabels; // If true, print the labels to the image
+ var $_showValues; // If true, print the values to the image
+ var $_showBarBorder; // If true, draws a box of around each bar
+ var $_showFade; // If true, draws each bar with a gradient
+ var $_showOuterBox; // If true, draws the box on the outside of the bargraph
+
+ /* -------------------------------- */
+ /* Private Variables */
+ /* -------------------------------- */
+ var $_topMargin;
+ var $_bottomMargin;
+ var $_leftMargin;
+ var $_rightMargin;
+ var $_barWidth;
+ var $_minBarHeight;
+ var $_maxBarHeight;
+ var $_realMinBarHeight;
+ var $_realMaxBarHeight;
+ var $_buffer;
+
+ function PhpBarGraph()
+ {
+ $this->_debug = false;
+ $this->_values = array();
+ $this->_startBarColorHex = "0000ff";
+ $this->_endBarColorHex = "ffffff";
+ $this->_lineColorHex = "000000";
+ $this->_barSpacing = 10;
+ $this->_numOfValueTicks = 4;
+ $this->_buffer = .5;
+ $this->_showLabels = true;
+ $this->_showValues = true;
+ $this->_showBarBorder = true;
+ $this->_showFade = true;
+ $this->_showOuterBox = true;
+ }
+
+ function AddValue($labelName, $theValue)
+ {
+ array_push($this->_values, array("label" => $labelName, "value" => $theValue));
+ }
+
+ function SetDebug($debug)
+ {
+ $this->_debug = $debug;
+ }
+
+ function SetX($x)
+ {
+ $this->_x = $x;
+ }
+
+ function SetY($y)
+ {
+ $this->_y = $y;
+ }
+
+ function SetWidth($width)
+ {
+ $this->_width = $width;
+ }
+
+ function SetHeight($height)
+ {
+ $this->_height = $height;
+ }
+
+ function SetStartBarColor($color)
+ {
+ $this->_startBarColorHex = $color;
+ }
+
+ function SetEndBarColor($color)
+ {
+ $this->_endBarColorHex = $color;
+ }
+
+ function SetLineColor($color)
+ {
+ $this->_lineColorHex = $color;
+ }
+
+ function SetBarSpacing($barSpacing)
+ {
+ $this->_barSpacing = $barSpacing;
+ }
+
+ function SetNumOfValueTicks($ticks)
+ {
+ $this->_numOfValueTicks = $ticks;
+ }
+
+ function SetShowLabels($labels)
+ {
+ $this->_showLabels = $labels;
+ }
+
+ function SetShowValues($values)
+ {
+ $this->_showValues = $values;
+ }
+
+ function SetBarBorder($border)
+ {
+ $this->_showBarBorder = $border;
+ }
+
+ function SetShowFade($fade)
+ {
+ $this->_showFade = $fade;
+ }
+
+ function SetShowOuterBox($box)
+ {
+ $this->_showOuterBox = $box;
+ }
+
+
+ function RGBColor($hexColor) // Returns an array of decimal values from a hex color
+ {
+ $r = hexdec(substr($hexColor, 0, 2));
+ $g = hexdec(substr($hexColor, 2, 2));
+ $b = hexdec(substr($hexColor, 4, 2));
+
+ $RGBColors = array("red" => $r, "green" => $g, "blue" => $b);
+
+ return $RGBColors;
+ }
+
+ function DebugPrint() // Prints a bunch of debug information.
+ {
+ foreach($this->_values as $value)
+ {
+ echo $value["label"] . "=" . $value["value"] . "<br>\n";
+ }
+
+ $startColor = $this->RGBColor($this->_startBarColorHex);
+ echo "StartColor: " . $startColor["red"] . ", " . $startColor["green"] . ", " . $startColor["blue"] . "<br>\n";
+
+ $endColor = $this->RGBColor($this->_endBarColorHex);
+ echo "EndColor: " . $endColor["red"] . ", " . $endColor["green"] . ", " . $endColor["blue"] . "<br>\n";
+
+ $lineColor = $this->RGBColor($this->_lineColorHex);
+ echo "LineColor: " . $lineColor["red"] . ", " . $lineColor["green"] . ", " . $lineColor["blue"] . "<br>\n";
+
+ echo "x=" . $this->_x . "<br>\n";
+ echo "y=" . $this->_y . "<br>\n";
+ echo "width=" . $this->_width . "<br>\n";
+ echo "height=" . $this->_height . "<br>\n";
+ echo "startBarColorHex=" . $this->_startBarColorHex . "<br>\n";
+ echo "endBarColorHex=" . $this->_endBarColorHex . "<br>\n";
+ echo "lineColorHex=" . $this->_lineColorHex . "<br>\n";
+ echo "barSpacing=" . $this->_barSpacing . "<br>\n";
+ echo "numOfValueTicks=" . $this->_numOfValueTicks . "<br>\n";
+
+ }
+
+ function dif ($start,$end)
+ {
+ if ($start >= $end)
+ $dif = $start - $end;
+ else
+ $dif = $end - $start;
+
+ return $dif;
+ }
+
+ function draw($start,$end,$pos,$step_width)
+ {
+ if ($start > $end)
+ $color = $start - $step_width * $pos;
+ else
+ $color = $start + $step_width * $pos;
+
+ return $color;
+ }
+
+ function fadeBar($image, $x1, $y1, $x2, $y2, $colorsStart, $colorsEnd, $height, $width) // Draws a rectangle with a gradient
+ {
+ $startColor = $this->RGBColor($colorsStart);
+ $red_start = $startColor["red"];
+ $green_start = $startColor["green"];
+ $blue_start = $startColor["blue"];
+
+ $endColor = $this->RGBColor($colorsEnd);
+ $red_end = $endColor["red"];
+ $green_end = $endColor["green"];
+ $blue_end = $endColor["blue"];
+
+ // difference between start and end
+ $dif_red = $this->dif($red_start,$red_end);
+ $dif_green = $this->dif($green_start,$green_end);
+ $dif_blue = $this->dif($blue_start,$blue_end);
+
+ $height = $height + 1;
+
+ // width of one color step
+ $step_red = $dif_red / $height;
+ $step_green = $dif_green / $height;
+ $step_blue = $dif_blue / $height;
+ $width = $width - 1;
+
+
+ for ($pos=0; $pos<=$height; $pos++)
+ {
+ $color = imagecolorexact ($image, $this->draw($red_start,$red_end,$pos,$step_red),
+ $this->draw($green_start,$green_end,$pos,$step_green),
+ $this->draw($blue_start,$blue_end,$pos,$step_blue));
+ if ($color == -1) // If this color is already allocatated, don't allocate it again.
+ {
+ $color = ImageColorAllocate($image,$this->draw($red_start,$red_end,$pos,$step_red),
+ $this->draw($green_start,$green_end,$pos,$step_green),
+ $this->draw($blue_start,$blue_end,$pos,$step_blue));
+ }
+ imageline($image,$x1,$pos+$y1,$x1+$width,$pos+$y1,$color);
+
+ }
+
+ }
+
+ function DrawBarGraph($image)
+ {
+ if ($this->_debug)
+ $this->DebugPrint();
+
+ // Setup the margins
+ $this->_topMargin = 0;
+ $this->_bottomMargin = 30;
+ $this->_leftMargin = 20;
+ $this->_rightMargin = $this->_barSpacing + 1 + 10;
+
+ // setup the color for the lines
+ $tempLineColor = $this->RGBColor($this->_lineColorHex);
+ $lineColor = ImageColorAllocate($image, $tempLineColor["red"], $tempLineColor["green"], $tempLineColor["blue"]);
+
+ $tempStartColor = $this->RGBColor($this->_startBarColorHex);
+ $startColor = ImageColorAllocate($image, $tempStartColor["red"], $tempStartColor["green"], $tempStartColor["blue"]);
+
+ // Figure out how wide each bar is going to be.
+ $this->_barWidth = ($this->_width - ($this->_leftMargin + $this->_rightMargin + 1) - (count($this->_values) * $this->_barSpacing)) / count($this->_values);
+
+ // Find out what the smallest and largest amount is.
+ $this->_minBarHeight = $this->_values[0]["value"];
+ $this->_maxBarHeight = $this->_values[0]["value"];
+ for ($i=1; $i < count($this->_values); $i++)
+ {
+ if ($this->_minBarHeight > $this->_values[$i]["value"])
+ {
+ $this->_minBarHeight = $this->_values[$i]["value"];
+ }
+ if ($this->_maxBarHeight < $this->_values[$i]["value"])
+ {
+ $this->_maxBarHeight = $this->_values[$i]["value"];
+ }
+ }
+
+ if ($this->_minBarHeight == 0 && $this->_maxBarHeight > 0) // Having the min value as 0 looks funny
+ {
+ $this->_minBarHeight = 1;
+ }
+ $buff = 1;
+ // Figure out how tall the tallest and smallest bar are going to be.
+ $this->_realMinBarHeight = $this->_minBarHeight - ($this->_minBarHeight * $buff + 1);
+ $this->_realMaxBarHeight = $this->_maxBarHeight * ($this->_buffer + 1);
+ $workArea = $this->_height - $this->_bottomMargin - $this->_topMargin - 1;
+
+ // Print out all the ticks
+ if ($this->_numOfValueTicks > $this->_maxBarHeight)
+ {
+ $this->_numOfValueTicks = $this->_maxBarHeight;
+ }
+
+ for ($i=1; $i<=$this->_numOfValueTicks; $i++)
+ {
+ $thisBarValue = floor((($this->_maxBarHeight - $this->_minBarHeight) / $this->_numOfValueTicks) * $i) + $this->_minBarHeight;
+ $myTickheight = ($workArea / ($this->_maxBarHeight - $this->_realMinBarHeight) * ($thisBarValue - $this->_realMinBarHeight));
+
+ // Figure out where we're going to put this tick..
+ $y1 = $this->_height - $this->_bottomMargin - 1 - ($myTickheight);
+
+ if ($thisBarValue >= $this->_minBarHeight)
+ {
+ imageline($image, $this->_leftMargin - 5 + $this->_x, $y1 + $this->_y, $this->_width - $this->_rightMargin + $this->_barSpacing + $this->_x, $y1 + $this->_y, $lineColor);
+ Imagestring($image, 1, $this->_leftMargin + $this->_x - 15, $y1 + $this->_y + 2, $thisBarValue, $lineColor);
+ }
+ }
+
+ // Print out all the bars
+ for ($i=1; $i<=count($this->_values); $i++)
+ {
+ // Get the bar height for this bar.
+ $myBarheight = ($workArea / ($this->_maxBarHeight - $this->_realMinBarHeight) * ($this->_values[$i-1]["value"] - $this->_realMinBarHeight));
+
+ // Figure out where we're going to put this bar..
+ $x1 = $this->_leftMargin + 1 + (($i-1) * $this->_barWidth) + ($i * $this->_barSpacing);
+ $y1 = $this->_height - $this->_bottomMargin - 1 - ($myBarheight);
+ $x2 = $this->_leftMargin + (($i-1) * $this->_barWidth) + ($i * $this->_barSpacing) + $this->_barWidth;
+ $y2 = $this->_height - $this->_bottomMargin - 1;
+
+ if ($this->_values[$i-1]["value"] != 0) // Don't print a bar if the value is 0
+ {
+ // Print the bar
+ if ($this->_showFade)
+ {
+ $this->fadeBar($image, $x1 + $this->_x, $y1 + $this->_y, $x2 + $this->_x, $y2 + $this->_y, $this->_startBarColorHex, $this->_endBarColorHex, $myBarheight, $this->_barWidth);
+ }
+ else
+ {
+ ImageFilledRectangle($image, $x1 + $this->_x, $y1 + $this->_y, $x2 + $this->_x, $y2 + $this->_y, $startColor);
+ }
+
+ if ($this->_showBarBorder)
+ {
+ ImageRectangle($image, $x1 + $this->_x, $y1 + $this->_y, $x2 + $this->_x, $y2 + $this->_y + 1, $lineColor);
+ }
+ }
+ // Print the amount of the bar
+ if ($this->_showValues)
+ {
+ Imagestring($image, 2, $x1 + $this->_x, $this->_height-($this->_bottomMargin/2)-10 + $this->_y, $this->_values[$i-1]["value"], $lineColor);
+ }
+
+ // Print out the label of the bar.
+ if ($this->_showLabels)
+ {
+ Imagestring($image, 2, $x1 + $this->_x, $this->_height-($this->_bottomMargin/2) + $this->_y, $this->_values[$i-1]["label"], $lineColor);
+ }
+ }
+
+ // draw the border box
+ if ($this->_showOuterBox)
+ {
+ ImageRectangle($image, $this->_leftMargin + $this->_x, $this->_topMargin + $this->_y, $this->_width - $this->_rightMargin + $this->_barSpacing + $this->_x, $this->_height - $this->_bottomMargin + $this->_y, $lineColor);
+ }
+
+
+
+ }
+}
+
+
+?>
diff --git a/admin/include/isadmin.inc.php b/admin/include/isadmin.inc.php
index be3b9e10f..af32efce0 100644
--- a/admin/include/isadmin.inc.php
+++ b/admin/include/isadmin.inc.php
@@ -31,7 +31,7 @@ $isadmin = true;
if ( $user['status'] != 'admin' )
{
echo '<div style="text-align:center;">'.$lang['access_forbiden'].'<br />';
- echo '<a href="./identification.php">'.$lang['ident_title'].'</a></div>';
+ echo '<a href="'.PHPWG_ROOT_PATH.'identification.php">'.$lang['ident_title'].'</a></div>';
exit();
}
?>
diff --git a/admin/stats.php b/admin/stats.php
index 3e13817c1..c98c38968 100644
--- a/admin/stats.php
+++ b/admin/stats.php
@@ -29,63 +29,17 @@ if( !defined("PHPWG_ROOT_PATH") )
die ("Hacking attempt!");
}
include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
-$max_pixels = 500;
-//------------------------------------------------------------ comment deletion
-if ( isset( $_GET['del'] ) and is_numeric( $_GET['del'] ) )
-{
- $query = 'DELETE FROM '.COMMENTS_TABLE;
- $query.= ' WHERE id = '.$_GET['del'];
- $query.= ';';
- mysql_query( $query );
-}
-//--------------------------------------------------------- history table empty
-if ( isset( $_GET['act'] ) and $_GET['act'] == 'empty' )
-{
- $query = 'DELETE FROM '.HISTORY_TABLE.';';
- mysql_query( $query );
-}
-// empty link
-$url_empty = PHPWG_ROOT_PATH.'admin.php?page=stats';
-if (isset($_GET['last_days']))
- $url_empty .='&amp;last_days='.$_GET['last_days'];
-$url_empty.= '&amp;act=empty';
+$url_img_monthly_report = PHPWG_ROOT_PATH.'/admin/images/monthly_visits.img.php';
//----------------------------------------------------- template initialization
$template->set_filenames( array('stats'=>'admin/stats.tpl') );
-if ( isset( $_GET['last_days'] ) ) define( 'MAX_DAYS', $_GET['last_days'] );
-else define( 'MAX_DAYS', 0 );
-
-foreach ( $conf['last_days'] as $option ) {
- $url = $_SERVER['PHP_SELF'].'?last_days='.($option - 1);
- $url.= '&amp;page=stats';
- $template->assign_block_vars(
- 'last_day_option',
- array(
- 'OPTION'=>$option,
- 'T_STYLE'=>(( $option == MAX_DAYS + 1 )?'text-decoration:underline;':''),
- 'U_OPTION'=>add_session_id( $url )
- )
- );
-}
-
$template->assign_vars(array(
- 'L_STAT_LASTDAYS'=>$lang['stats_last_days'],
- 'L_STAT_DATE'=>$lang['date'],
- 'L_STAT_LOGIN'=>$lang['login'],
- 'L_STAT_IP'=>$lang['IP'],
- 'L_STAT_FILE'=>$lang['file'],
- 'L_STAT_CATEGORY'=>$lang['category'],
- 'L_STAT_PICTURE'=>$lang['picture'],
- 'L_STAT_EMPTY'=>$lang['stats_empty'],
- 'L_STAT_SEEN'=>$lang['stats_pages_seen'],
- 'L_STAT_VISITOR'=>$lang['stats_visitors'],
-
- 'STAT_EMPTY_URL'=>$url_empty
+ 'L_STAT_TITLE'=>$lang['stats_last_days'],
+ 'L_STAT_MONTHLY_ALT'=>$lang['stats_pages_seen_graph_title'],
+ 'IMG_MONTHLY_REPORT'=>add_session_id($url_img_monthly_report)
));
-$tpl = array( 'stats_pages_seen_graph_title', 'stats_visitors_graph_title');
-
//---------------------------------------------------------------- log history
$days = array();
$max_nb_visitors = 0;
@@ -93,9 +47,9 @@ $max_pages_seen = 0;
$starttime = mktime( 0, 0, 0,date('n'),date('j'),date('Y') );
$endtime = mktime( 23,59,59,date('n'),date('j'),date('Y') );
-for ( $i = 0; $i <= MAX_DAYS; $i++ )
+//for ( $i = 0; $i <= MAX_DAYS; $i++ )
{
- $day = array();
+ /*$day = array();
$template->assign_block_vars('day',array(
));
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 1bd3abd07..841c86f74 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -345,9 +345,9 @@ function pwg_log( $file, $category, $picture = '' )
if ( $conf['log'] )
{
- $query = 'insert into '.PREFIX_TABLE.'history';
+ $query = 'insert into '.HISTORY_TABLE;
$query.= ' (date,login,IP,file,category,picture) values';
- $query.= " (".time().", '".$user['username']."'";
+ $query.= " (NOW(), '".$user['username']."'";
$query.= ",'".$_SERVER['REMOTE_ADDR']."'";
$query.= ",'".$file."','".$category."','".$picture."');";
mysql_query( $query );
diff --git a/install/phpwebgallery_structure.sql b/install/phpwebgallery_structure.sql
index 3a387603b..8ad3d1f7a 100644
--- a/install/phpwebgallery_structure.sql
+++ b/install/phpwebgallery_structure.sql
@@ -94,12 +94,13 @@ CREATE TABLE phpwebgallery_groups (
DROP TABLE IF EXISTS phpwebgallery_history;
CREATE TABLE phpwebgallery_history (
- date int(11) NOT NULL default '0',
+ date datetime NOT NULL default '0000-00-00 00:00:00',
login varchar(15) default NULL,
IP varchar(50) NOT NULL default '',
category varchar(150) default NULL,
file varchar(50) default NULL,
- picture varchar(150) default NULL
+ picture varchar(150) default NULL,
+ PRIMARY KEY `date` (`date`)
) TYPE=MyISAM;
--
diff --git a/template/default/admin/stats.tpl b/template/default/admin/stats.tpl
new file mode 100644
index 000000000..40b6078a1
--- /dev/null
+++ b/template/default/admin/stats.tpl
@@ -0,0 +1,3 @@
+<div class="admin">{L_STAT_TITLE}</div>
+
+<img src="{IMG_MONTHLY_REPORT}" alt="{L_STAT_MONTHLY_ALT}" /> \ No newline at end of file
diff --git a/template/default/admin/stats.vtp b/template/default/admin/stats.vtp
deleted file mode 100644
index e66c1ba18..000000000
--- a/template/default/admin/stats.vtp
+++ /dev/null
@@ -1,83 +0,0 @@
-<div style="text-align:center;margin-top:5px;">
- <!--VTP_last_day_option-->
- <a href="{#link}" style="{#style}">{#option}</a>{#separation}
- <!--/VTP_last_day_option-->
- {#stats_last_days}
-</div>
-
-<table width="100%">
- <tr>
- <th width="1%">{#date}</th>
- <th>{#login}</th>
- <th>{#IP}</th>
- <th>{#file}</th>
- <th>{#category}</th>
- <th>{#picture}</th>
- </tr>
- <tr>
- <td colspan="6" style="text-align:center;"><a href="{#emply_url}">{#stats_empty}</a></td>
- </tr>
- <!--VTP_day-->
- <tr>
- <td colspan="6">
- <a href="{#url}"><!--VTP_collapsed--><img src="./template/{#user_template}/admin/images/collapsed.gif" style="border:none;" /><!--/VTP_collapsed--><!--VTP_expanded--><img src="./template/{#user_template}/admin/images/expanded.gif" style="border:none;" /><!--/VTP_expanded--></a>
- <span style="font-weight:bold;">{#name}</span> [ {#nb_pages} {#stats_pages_seen} - {#nb_visitors} {#stats_visitors} ]
- [ <a href="{#url}">{#open_or_close}</a> ]
- </td>
- </tr>
- <!--VTP_line-->
- <tr>
- <td>{#date}</td>
- <td style="text-align:center;">{#login}</td>
- <td>{#IP}</td>
- <td>{#file}</td>
- <td>{#category}</td>
- <td>{#picture}</td>
- </tr>
- <!--/VTP_line-->
- <!--/VTP_day-->
-</table>
-
-<!-- Graph with the number of pages seen per day -->
-<table style="margin:auto;margin-top:10px;margin-bottom:10px;border:1px solid black;">
-<tr>
- <td colspan="3" style="text-align:center;font-weight:bold">{#stats_pages_seen_graph_title}</td>
-</tr>
-<!--VTP_pages_day-->
-<tr>
- <td>{#date}</td>
- <td>
- <table style="border-collapse:collapse;">
- <tr>
- <td style="padding:0;"><img src="./template/{#user_template}/admin/images/stat_left.gif" width="4" height="12" /></td>
- <td style="padding:0;"><img src="./template/{#user_template}/admin/images/stat_middle.gif" width="{#width}" height="12" /></td>
- <td style="padding:0;"><img src="./template/{#user_template}/admin/images/stat_right.gif" width="4" height="12" /></td>
- </tr>
- </table>
- </td>
- <td align="center">[ {#nb_pages} ]</td>
-</tr>
-<!--/VTP_pages_day-->
-</table>
-
-<!-- Graph with the number of visitors per day -->
-<table style="margin:auto;margin-top:10px;margin-bottom:10px;border:1px solid black;">
-<tr>
- <td colspan="3" style="text-align:center;font-weight:bold">{#stats_visitors_graph_title}</td>
-</tr>
-<!--VTP_visitors_day-->
-<tr>
- <td>{#date}</td>
- <td>
- <table style="border-collapse:collapse;">
- <tr>
- <td style="padding:0;"><img src="./template/{#user_template}/admin/images/stat_left.gif" width="4" height="12" /></td>
- <td style="padding:0;"><img src="./template/{#user_template}/admin/images/stat_middle.gif" width="{#width}" height="12" /></td>
- <td style="padding:0;"><img src="./template/{#user_template}/admin/images/stat_right.gif" width="4" height="12" /></td>
- </tr>
- </table>
- </td>
- <td align="center">[ {#nb_visitors} ]</td>
-</tr>
-<!--/VTP_visitors_day-->
-</table> \ No newline at end of file