]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/guest/what-stats.php
More usage of EL
[mailer.git] / inc / modules / guest / what-stats.php
index a5165082ba5b18a4dda7a4c5fc724c1500e276e7..6e6c88e2843d980d32a995f99b4ee29a2f933df6 100644 (file)
@@ -71,7 +71,7 @@ switch (getRequestParameter('mode')) {
 }
 
 // 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')) {
@@ -140,7 +140,7 @@ switch (getConfig('guest_stats')) {
                // Generate monthly stats
                $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(
@@ -158,28 +158,26 @@ switch (getConfig('guest_stats')) {
                                $r2 = '';
                                $l = 'rl'; $r = 'rr';
                        } else {
-                               $OUT .= "</tr>\n";
+                               $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
@@ -192,37 +190,29 @@ 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_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,
@@ -234,12 +224,12 @@ switch (getConfig('guest_stats')) {
                        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