From 0f700bd2b9e033aad0990f42739cd75d41e372ff Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 12 Oct 2008 19:03:18 +0000 Subject: [PATCH] Admin surfbar stats finished --- .gitattributes | 4 + inc/databases.php | 2 +- inc/language/surfbar_de.php | 7 ++ inc/libs/rallye_functions.php | 1 + inc/modules/admin/what-surfbar_stats.php | 85 +++++++++++++++++++ .../de/html/admin/admin_surfbar_stats.tpl | 30 +++++++ .../de/html/admin/admin_surfbar_stats_row.tpl | 5 ++ .../de/html/admin/admin_surfbar_url_stats.tpl | 30 +++++++ .../admin/admin_surfbar_url_stats_row.tpl | 5 ++ 9 files changed, 168 insertions(+), 1 deletion(-) create mode 100644 templates/de/html/admin/admin_surfbar_stats.tpl create mode 100644 templates/de/html/admin/admin_surfbar_stats_row.tpl create mode 100644 templates/de/html/admin/admin_surfbar_url_stats.tpl create mode 100644 templates/de/html/admin/admin_surfbar_url_stats_row.tpl diff --git a/.gitattributes b/.gitattributes index 4d8da6f023..75e81371aa 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1102,6 +1102,10 @@ templates/de/html/admin/admin_settings_saved.tpl -text templates/de/html/admin/admin_sponsor_paytypes.tpl -text templates/de/html/admin/admin_sub_points.tpl -text templates/de/html/admin/admin_sub_points_all.tpl -text +templates/de/html/admin/admin_surfbar_stats.tpl -text +templates/de/html/admin/admin_surfbar_stats_row.tpl -text +templates/de/html/admin/admin_surfbar_url_stats.tpl -text +templates/de/html/admin/admin_surfbar_url_stats_row.tpl -text templates/de/html/admin/admin_task_holiday.tpl -text templates/de/html/admin/admin_theme_404.tpl -text templates/de/html/admin/admin_theme_edit.tpl -text diff --git a/inc/databases.php b/inc/databases.php index 2bd89166f6..938ce9ee6f 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -113,7 +113,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // This current patch level -define('CURR_SVN_REVISION', "507"); +define('CURR_SVN_REVISION', "508"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/language/surfbar_de.php b/inc/language/surfbar_de.php index 294e2c016e..b31300bfb4 100644 --- a/inc/language/surfbar_de.php +++ b/inc/language/surfbar_de.php @@ -94,6 +94,13 @@ define('ADMIN_SURFBAR_URL_ADDED', "URL wurde der Surfbar hinzugefügt."); define('ADMIN_SURFBAR_URL_NOT_ADDED', "URL wurde wegen Fehler nicht hinzugefügt. Ist die URL bereits vorhanden?"); define('ADMIN_SURFBAR_ADD_URL', "URL hinzufügen"); define('ADMIN_BUILD_STATUS_HANDLER', "Status-Handler"); +define('ADMIN_SURFBAR_NO_STATS', "Keine Surfbar-Statistiken vorhanden!"); +define('ADMIN_SURFBAR_STATS_TITLE', "Mitglieder-Statistik der Surfbar"); +define('ADMIN_SURFBAR_VISITED_URLS', "Aufgerufene URLs"); +define('ADMIN_SURFBAR_TOTAL_VISITS', "Gesamtbesuche"); +define('ADMIN_SURFBAR_TOTALS', "Zusammenfassung"); +define('ADMIN_SURFBAR_LAST_ONLINE', "Letzter Aufruf der URL"); +define('ADMIN_SURFBAR_URL_STATS_TITLE', "URL-bezogene Statistik der Surfbar"); // Admin titles define('ADMIN_SURFBAR_LIST_URLS_TITLE', "Surfbar - URLs aufisten"); diff --git a/inc/libs/rallye_functions.php b/inc/libs/rallye_functions.php index 3faa726f6c..700d0ca4d0 100644 --- a/inc/libs/rallye_functions.php +++ b/inc/libs/rallye_functions.php @@ -740,6 +740,7 @@ function RALLYE_TEMPLATE_SELECTION($name="template", $default="") // function RALLYE_GET_REFCOUNT($uid, $old=0) { global $_CONFIG, $cacheArray; + // Check current refs if (GET_EXT_VERSION("cache") >= "0.1.2") { // Get refs from cache diff --git a/inc/modules/admin/what-surfbar_stats.php b/inc/modules/admin/what-surfbar_stats.php index c758fdb18f..12f405332d 100644 --- a/inc/modules/admin/what-surfbar_stats.php +++ b/inc/modules/admin/what-surfbar_stats.php @@ -40,5 +40,90 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { // Add description as navigation point ADD_DESCR("admin", __FILE__); +// Is the 'url_id' set? +if (isset($_GET['url_id'])) { + // Generate general statistics + $result = SQL_QUERY_ESC("SELECT `userid`, `count` AS `total_visits`, UNIX_TIMESTAMP(`last_online`) AS `last_online` +FROM `"._MYSQL_PREFIX."_surfbar_stats` +WHERE `url_id`=%s +ORDER BY `userid` ASC", + array(bigintval($_GET['url_id'])), __FILE__, __LINE__); + + // Entries found? + if (SQL_NUMROWS($result) > 0) { + // Get all rows + $OUT = ""; $SW = 2; $cnt = 0; $visits = 0; + while ($content = SQL_FETCHARRAY($result)) { + // Count totals + $visits += $content['total_visits']; + + // "Translate" some data + $content['userid'] = ADMIN_USER_PROFILE_LINK($content['userid']); + $content['total_visits'] = TRANSLATE_COMMA($content['total_visits']); + $content['last_online'] = MAKE_DATETIME($content['last_online'], "2"); + + // Load row template + $OUT .= LOAD_TEMPLATE("admin_surfbar_url_stats_row", true, $content); + $cnt++; + } // END - while + + // Prepare content + $content = array( + 'rows' => $OUT, + 'userids' => $cnt, + 'visits' => $visits + ); + + + // Load main template + LOAD_TEMPLATE("admin_surfbar_url_stats", false, $content); + } else { + // No statistics so far + LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_SURFBAR_NO_URL_STATS); + } +} else { + // Generate general statistics + $result = SQL_QUERY("SELECT `userid`, COUNT(`url_id`) AS `visited_urls`, SUM(`count`) AS `total_visits` +FROM `"._MYSQL_PREFIX."_surfbar_stats` +GROUP BY `userid` +ORDER BY `userid` ASC", __FILE__, __LINE__); + + // Entries found? + if (SQL_NUMROWS($result) > 0) { + // Get all rows + $OUT = ""; $SW = 2; $urls = 0; $visits = 0; + while ($content = SQL_FETCHARRAY($result)) { + // Count totals + $urls += $content['visited_urls']; + $visits += $content['total_visits']; + + // "Translate" some data + $content['userid'] = ADMIN_USER_PROFILE_LINK($content['userid']); + $content['visited_urls'] = TRANSLATE_COMMA($content['visited_urls']); + $content['total_visits'] = TRANSLATE_COMMA($content['total_visits']); + + // Load row template + $OUT .= LOAD_TEMPLATE("admin_surfbar_stats_row", true, $content); + } // END - while + + // Prepare content + $content = array( + 'rows' => $OUT, + 'urls' => $urls, + 'visits' => $visits + ); + + + // Load main template + LOAD_TEMPLATE("admin_surfbar_stats", false, $content); + } else { + // No statistics so far + LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_SURFBAR_NO_STATS); + } +} + +// Free result +SQL_FREERESULT($result); + // ?> diff --git a/templates/de/html/admin/admin_surfbar_stats.tpl b/templates/de/html/admin/admin_surfbar_stats.tpl new file mode 100644 index 0000000000..744fb5120a --- /dev/null +++ b/templates/de/html/admin/admin_surfbar_stats.tpl @@ -0,0 +1,30 @@ + + + + + + + + + +$content[rows] + + + + + +
+ {--ADMIN_SURFBAR_STATS_TITLE--} +
+ {--_UID--}: + + {--ADMIN_SURFBAR_VISITED_URLS--}: + + {--ADMIN_SURFBAR_TOTAL_VISITS--}: +
diff --git a/templates/de/html/admin/admin_surfbar_stats_row.tpl b/templates/de/html/admin/admin_surfbar_stats_row.tpl new file mode 100644 index 0000000000..3bb5028a3b --- /dev/null +++ b/templates/de/html/admin/admin_surfbar_stats_row.tpl @@ -0,0 +1,5 @@ + + [$content[userid]] + $content[visited_urls] + $content[total_visits] + diff --git a/templates/de/html/admin/admin_surfbar_url_stats.tpl b/templates/de/html/admin/admin_surfbar_url_stats.tpl new file mode 100644 index 0000000000..5ab1bec9fb --- /dev/null +++ b/templates/de/html/admin/admin_surfbar_url_stats.tpl @@ -0,0 +1,30 @@ + + + + + + + + + +$content[rows] + + + + + +
+ {--ADMIN_SURFBAR_URL_STATS_TITLE--} +
+ {--_UID--}: + + {--ADMIN_SURFBAR_TOTAL_VISITS--}: + + {--ADMIN_SURFBAR_LAST_ONLINE--}: +
diff --git a/templates/de/html/admin/admin_surfbar_url_stats_row.tpl b/templates/de/html/admin/admin_surfbar_url_stats_row.tpl new file mode 100644 index 0000000000..925ee649a5 --- /dev/null +++ b/templates/de/html/admin/admin_surfbar_url_stats_row.tpl @@ -0,0 +1,5 @@ + + [$content[userid]] + $content[total_visits] + $content[last_online] + -- 2.39.5