<?php
/************************************************************************
- * MXChange v0.2.1 Start: 12/14/2003 *
- * ================ Last change: 08/22/2004 *
+ * Mailer v0.2.1-FINAL Start: 12/14/2003 *
+ * =================== Last change: 08/22/2004 *
* *
* -------------------------------------------------------------------- *
* File : what-stats.php *
* svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team *
* For more information visit: http://www.mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
addMenuDescription('guest', __FILE__);
// Derterminate which stats we want and set mode and title for the link below stats block
-if (!isGetRequestElementSet('mode')) setRequestGetElement('mode', strtolower(getConfig('guest_stats')));
+if (!isGetRequestParameterSet('mode')) setGetRequestParameter('mode', strtolower(getConfig('guest_stats')));
// Set config temporarily
-setConfigEntry('guest_stats', strtoupper(getRequestElement('mode')));
+setConfigEntry('guest_stats', strtoupper(getRequestParameter('mode')));
-switch (getRequestElement('mode')) {
+switch (getRequestParameter('mode')) {
case 'members' :
$lmode = 'modules';
break;
default:
// Unsupported mode
- debug_report_bug(sprintf("Unsupported mode <strong>%s</strong> detected.", secureString(getRequestElement('mode'))));
+ debug_report_bug(__FILE__, __LINE__, sprintf("Unsupported mode <span class=\"data\">%s</span> detected.", secureString(getRequestParameter('mode'))));
break;
}
// Set link title
-$ltitle = getMessage('GUEST_STATS_' . strtoupper($lmode));
+$ltitle = '{--GUEST_STATS_' . strtoupper($lmode) . '--}';
// @TODO This can be rewritten in a dynamic include
switch (getConfig('guest_stats')) {
case 'MEMBERS': // Statistics about your members
// Members yesterday / today online
- $ymem = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `last_online` >= ".getConfig('START_YDAY')." AND `last_online` < ".getConfig('START_TDAY')." AND `status`='CONFIRMED'", __FILE__, __LINE__));
- $tmem = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `last_online` >= ".getConfig('START_TDAY')." AND `status`='CONFIRMED'", __FILE__, __LINE__));
+ $ymem = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `last_online` >= {?START_YDAY?} AND `last_online` < {?START_TDAY?} AND `status`='CONFIRMED'", __FILE__, __LINE__));
+ $tmem = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `last_online` >= {?START_TDAY?} AND `status`='CONFIRMED'", __FILE__, __LINE__));
// Yesterday / today registered
- $yreg = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `joined` >= ".getConfig('START_YDAY')." AND `joined` < ".getConfig('START_TDAY'), __FILE__, __LINE__));
- $treg = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `joined` >= ".getConfig('START_TDAY'), __FILE__, __LINE__));
+ $yreg = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `joined` >= {?START_YDAY?} AND `joined` < {?START_TDAY?}", __FILE__, __LINE__));
+ $treg = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `joined` >= {?START_TDAY?}", __FILE__, __LINE__));
// Only males / females
$male = countSumTotalData('M', 'user_data', 'userid', 'gender', true, " AND `status`='CONFIRMED'");
$content['ltitle'] = $ltitle;
// Generate monthly stats
- $SW = 2; $r2 = ' right2'; $l = 'll'; $r = 'lr'; $OUT = '';
+ $SW = 2; $r2 = ' right'; $l = 'll'; $r = 'lr'; $OUT = '';
foreach ($months as $month => $cnt) {
- if ($SW == 2) $OUT .= "<tr>\n";
+ if ($SW == 2) $OUT .= '<tr>';
// Prepare data for template
$data = array(
$r2 = '';
$l = 'rl'; $r = 'rr';
} else {
- $OUT .= "</tr>\n";
- $r2 = ' right2';
+ $OUT .= '</tr>';
+ $r2 = ' right';
$l = 'll'; $r = 'lr';
}
$SW = 3 - $SW;
- }
+ } // END - foreach
$content['month_rows'] = $OUT;
// Generate category stats
- $OUT = ''; $SW = 2;
+ $OUT = '';
foreach ($cat_cnt as $id => $cnt) {
// Prepare data for the template
$data = array(
- 'sw' => $SW,
'cat' => $cats[$id],
'cnt' => $cnt,
);
// Load row template and switch colors
$OUT .= loadTemplate('guest_stats_cats_row', true, $data);
- $SW = 3 - $SW;
- }
+ } // END - foreach
$content['cats_rows'] = $OUT;
// Load final template
if (isAdmin()) $AND = '';
// Query for guest and member menus
- $guest_t10 = SQL_QUERY("SELECT `counter`, `title` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `counter` > 0".$AND." ORDER BY `counter` DESC LIMIT 0,10", __FILE__, __LINE__);
- $mem_t10 = SQL_QUERY("SELECT `counter`, `title` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `counter` > 0".$AND." ORDER BY `counter` DESC LIMIT 0,10", __FILE__, __LINE__);
+ $guest_t10 = SQL_QUERY('SELECT `counter`, `title` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `counter` > 0' . $AND . ' ORDER BY `counter` DESC LIMIT 0,10', __FILE__, __LINE__);
+ $mem_t10 = SQL_QUERY('SELECT `counter`, `title` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `counter` > 0' . $AND . ' ORDER BY `counter` DESC LIMIT 0,10', __FILE__, __LINE__);
$OUT = '';
- if (SQL_NUMROWS($guest_t10) > 0) {
+ if (!SQL_HASZERONUMS($guest_t10)) {
// Guest clicks
- $OUT .= loadTemplate('guest_stats_header', true, getMessage('GUEST_TOP_GUEST_STATS'));
- $SW = 2;
+ $OUT .= loadTemplate('guest_stats_header', true, '{--GUEST_TOP_GUEST_STATS--}');
while ($content = SQL_FETCHARRAY($guest_t10)) {
- $content['sw'] = $SW;
-
// Load row template
$OUT .= loadTemplate('guest_stats_row', true, $content);
- $SW = 3 - $SW;
} // END - while
} // END - if
- if (SQL_NUMROWS($mem_t10) > 0) {
+ if (!SQL_HASZERONUMS($mem_t10)) {
// Member clicks
- $OUT .= loadTemplate('guest_stats_header', true, getMessage('GUEST_TOP_MEMBER_STATS'));
- $SW = 2;
+ $OUT .= loadTemplate('guest_stats_header', true, '{--GUEST_TOP_MEMBER_STATS--}');
while ($content = SQL_FETCHARRAY($mem_t10)) {
- $content['sw'] = $SW;
-
// Load row template
$OUT .= loadTemplate('guest_stats_row', true, $content);
- $SW = 3 - $SW;
} // END - while
} // END - if
- if ((SQL_NUMROWS($guest_t10) > 0) || (SQL_NUMROWS($mem_t10) > 0)) {
+ if ((!SQL_HASZERONUMS($guest_t10)) || (!SQL_HASZERONUMS($mem_t10))) {
// Prepare content
$content = array(
'rows' => $OUT,
loadTemplate('guest_stats_table', false, $content);
} else {
// No clicks detected
- loadTemplate('admin_settings_saved', false, getMessage('GUEST_STATS_NO_CLICKS'));
+ loadTemplate('admin_settings_saved', false, '{--GUEST_STATS_NO_CLICKS--}');
}
break;
case 'INACTIVE': // Deactivated stats
- loadTemplate('admin_settings_saved', false, getMessage('GUEST_STATS_DEACTIVATED'));
+ loadTemplate('admin_settings_saved', false, '{--GUEST_STATS_DEACTIVATED--}');
break;
-}
+} // END - switch
// [EOF]
?>