]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/guest/what-stats.php
A lot has been rewritten, ext-teams added, ext-forced continued:
[mailer.git] / inc / modules / guest / what-stats.php
index bf0e3ea7d796e915a0763b424251254dc188f565..944337f45c62cf365ddd32f15ede95d671ae1b60 100644 (file)
@@ -43,8 +43,16 @@ if (!defined('__SECURITY')) {
 // Add description as navigation point
 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 (!isGetRequestParameterSet('mode')) {
+       setGetRequestParameter('mode', strtolower(getConfig('guest_stats')));
+} // END - if
 
 // Set config temporarily
 setConfigEntry('guest_stats', strtoupper(getRequestParameter('mode')));
@@ -92,7 +100,7 @@ switch (getConfig('guest_stats')) {
                } // 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();
@@ -132,7 +140,7 @@ switch (getConfig('guest_stats')) {
                                'm_descr'  => $GLOBALS['month_descr'][$month],
                                'r_class'  => $r,
                                'r2_class' => $r2,
-                               'cnt'      => $count
+                               'count'    => $count
                        );
 
                        // Load row template
@@ -155,8 +163,8 @@ switch (getConfig('guest_stats')) {
                foreach ($cat_cnt as $id => $count) {
                        // Prepare data for the template
                        $data = array(
-                               'cat' => $cats[$id],
-                               'cnt' => $count,
+                               'cat'   => $cats[$id],
+                               'count' => $count,
                        );
 
                        // Load row template and switch colors
@@ -174,8 +182,8 @@ switch (getConfig('guest_stats')) {
                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)) {
@@ -208,12 +216,12 @@ switch (getConfig('guest_stats')) {
                        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