2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 09/09/2008 *
4 * =================== Last change: 09/09/2008 *
6 * -------------------------------------------------------------------- *
7 * File : what-surfbar_stats.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Surfbar URL statistics *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : URL-Statistiken fuer die Surfbar *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2011 by Mailer Developer Team *
20 * For more information visit: http://www.mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if ((!defined('__SECURITY')) || (!isAdmin())) {
43 // Add description as navigation point
44 addYouAreHereLink('admin', __FILE__);
46 // Is the 'url_id' set?
47 if (isGetRequestParameterSet('url_id')) {
48 // Generate general statistics
49 $result = SQL_QUERY_ESC("SELECT
51 `stats_count` AS `total_visits`,
52 UNIX_TIMESTAMP(`stats_last_surfed`) AS `last_surfed`
54 `{?_MYSQL_PREFIX?}_surfbar_stats`
59 array(bigintval(getRequestParameter('url_id'))), __FILE__, __LINE__);
62 if (!SQL_HASZERONUMS($result)) {
64 $OUT = ''; $count = '0'; $visits = '0';
65 while ($content = SQL_FETCHARRAY($result)) {
67 $visits += $content['total_visits'];
69 // "Translate" some data
70 $content['last_surfed'] = generateDateTime($content['last_surfed'], 2);
73 $OUT .= loadTemplate('admin_surfbar_url_stats_row', true, $content);
86 loadTemplate('admin_surfbar_url_stats', false, $content);
88 // No statistics so far
89 displayMessage('{--ADMIN_SURFBAR_NO_URL_STATS--}');
92 // Generate general statistics
93 $result = SQL_QUERY("SELECT
95 COUNT(`stats_url_id`) AS `visited_urls`,
96 SUM(`stats_count`) AS `total_visits`
98 `{?_MYSQL_PREFIX?}_surfbar_stats`
102 `stats_userid` ASC", __FILE__, __LINE__);
105 if (!SQL_HASZERONUMS($result)) {
107 $OUT = ''; $urlArray = '0'; $visits = '0';
108 while ($content = SQL_FETCHARRAY($result)) {
110 $urlArray += $content['visited_urls'];
111 $visits += $content['total_visits'];
114 $OUT .= loadTemplate('admin_surfbar_stats_row', true, $content);
125 // Load main template
126 loadTemplate('admin_surfbar_stats', false, $content);
128 // No statistics so far
129 displayMessage('{--ADMIN_SURFBAR_NO_STATS--}');
134 SQL_FREERESULT($result);