* $Date:: $ *
* $Tag:: 0.2.1-FINAL $ *
* $Author:: $ *
- * Needs to be in all Files and every File needs "svn propset *
- * 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 *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team *
+ * For more information visit: http://mxchange.org *
* *
* 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 *
} // END - if
// Add description as navigation point
-addMenuDescription('guest', __FILE__);
+addYouAreHereLink('guest', __FILE__);
-// Derterminate which stats we want and set mode and title for the link below stats block
-if (!isGetRequestParameterSet('mode')) setGetRequestParameter('mode', strtolower(getConfig('guest_stats')));
+// This part only works if ext-user is active
+if ((!isExtensionActive('user')) && (!isAdmin())) {
+ displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=user%}');
+ return;
+} // END - if
+
+// Determine which stats we want and set mode and title for the link below stats block
+if (!isGetRequestElementSet('do')) {
+ setGetRequestElement('do', strtolower(getConfig('guest_stats')));
+} // END - if
// Set config temporarily
-setConfigEntry('guest_stats', strtoupper(getRequestParameter('mode')));
+setConfigEntry('guest_stats', strtoupper(getRequestElement('do')));
-switch (getRequestParameter('mode')) {
+switch (getRequestElement('do')) {
case 'members' :
$lmode = 'modules';
break;
default:
// Unsupported mode
- debug_report_bug(__FILE__, __LINE__, sprintf("Unsupported mode <span class=\"data\">%s</span> detected.", secureString(getRequestParameter('mode'))));
+ debug_report_bug(__FILE__, __LINE__, sprintf("Unsupported mode <span class=\"data\">%s</span> detected.", secureString(getRequestElement('do'))));
break;
}
// @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` >= {?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` >= {?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'");
$female = countSumTotalData('F', 'user_data', 'userid', 'gender', true, " AND `status`='CONFIRMED'");
- // Unconfirmed accounts
- $unconfirmed = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `status` != 'CONFIRMED'", __FILE__, __LINE__));
-
- // Total members
- $total = $male + $female;
-
// List every month
$months = array();
for ($idx = 1; $idx < 13; $idx++) {
} // END - for
// Members in categories
- $result = SQL_QUERY("SELECT `id`, `cat` FROM `{?_MYSQL_PREFIX?}_cats` WHERE `visible`='Y' ORDER BY `id` ASC", __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT `id`,`cat` FROM `{?_MYSQL_PREFIX?}_cats` WHERE `visible`='Y' ORDER BY `id` ASC", __FILE__, __LINE__);
// Load categories first
$cats = array(); $cat_cnt = array();
} // END - foreach
// Prepare data for the template
- $content['total_users'] = $total;
- $content['unconfirmed'] = $unconfirmed;
+ $content['total_users'] = ($male + $female);
+ $content['unconfirmed'] = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `status` != 'CONFIRMED'", __FILE__, __LINE__));
$content['total_males'] = $male;
$content['total_females'] = $female;
- $content['tmem_count'] = $tmem;
- $content['ymem_count'] = $ymem;
- $content['treg_count'] = $treg;
- $content['yreg_count'] = $yreg;
+ $content['tmem_count'] = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `last_online` >= {?START_TDAY?} AND `status`='CONFIRMED'", __FILE__, __LINE__));
+ $content['ymem_count'] = 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__));
+ $content['treg_count'] = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `joined` >= {?START_TDAY?}", __FILE__, __LINE__));
+ $content['yreg_count'] = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `joined` >= {?START_YDAY?} AND `joined` < {?START_TDAY?}", __FILE__, __LINE__));
$content['lmode'] = $lmode;
$content['ltitle'] = $ltitle;
// Generate monthly stats
$SW = 2; $r2 = ' right'; $l = 'll'; $r = 'lr'; $OUT = '';
- foreach ($months as $month => $cnt) {
+ foreach ($months as $month => $count) {
if ($SW == 2) $OUT .= '<tr>';
// Prepare data for template
'm_descr' => $GLOBALS['month_descr'][$month],
'r_class' => $r,
'r2_class' => $r2,
- 'cnt' => $cnt
+ 'count' => $count
);
// Load row template
// Generate category stats
$OUT = '';
- foreach ($cat_cnt as $id => $cnt) {
+ foreach ($cat_cnt as $id => $count) {
// Prepare data for the template
$data = array(
- 'cat' => $cats[$id],
- 'cnt' => $cnt,
+ 'cat' => $cats[$id],
+ 'count' => $count,
);
// Load row template and switch colors
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_HASZERONUMS($guest_t10)) {
loadTemplate('guest_stats_table', false, $content);
} else {
// No clicks detected
- loadTemplate('admin_settings_saved', false, '{--GUEST_STATS_NO_CLICKS--}');
+ displayMessage('{--GUEST_STATS_NO_CLICKS--}');
}
break;
case 'INACTIVE': // Deactivated stats
- loadTemplate('admin_settings_saved', false, '{--GUEST_STATS_DEACTIVATED--}');
+ displayMessage('{--GUEST_STATS_DEACTIVATED--}');
break;
} // END - switch