Renamed ifSqlHasZeroNums() to ifSqlHasZeroNumRows() and improved some queries.
[mailer.git] / inc / modules / guest / what-active.php
index cdeed4e5831c83ed5534143e7582b9a829762858..5c7c03c0a8763760218d1b092eb559bcf9c1730e 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Liste heutiger aktiver Mitglieder                *
  * -------------------------------------------------------------------- *
- * $Revision::                                                        $ *
- * $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                           *
- * For more information visit: http://www.mxchange.org                  *
+ * Copyright (c) 2009 - 2015 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 *
 
 // Some security stuff...
 if (!defined('__SECURITY')) {
-       die();
+       exit();
 } // END - if
 
 // Add description as navigation point
-addMenuDescription('guest', __FILE__);
+addYouAreHereLink('guest', __FILE__);
 
 if ((!isExtensionActive('active')) && (!isAdmin())) {
-       loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('active'));
+       displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=active%}');
        return;
 } // END - if
 
-// Extra field to include is by default userid
-$add = 'userid';
-
-// If nickname is installed the extra field is the nickname of the user
-if (isExtensionActive('nickname')) $add = 'nickname';
-
 // Check for members who were active only this day
-$result = SQL_QUERY("SELECT
-       `userid`, `".$add."`, `last_online`
+$result = sqlQuery("SELECT
+       `userid`,
+       `last_online`
 FROM
        `{?_MYSQL_PREFIX?}_user_data`
 WHERE
-       `last_online` >= {?START_TDAY?} AND `status`='CONFIRMED'
+       `last_online` >= {?START_TDAY?} AND
+       `status`='CONFIRMED'
+       " . runFilterChain('user_exclusion_sql', ' ') . "
 ORDER BY
        `last_online` DESC
 LIMIT {?active_limit?}", __FILE__, __LINE__);
 
 // Entries found?
-if (SQL_NUMROWS($result) > 0) {
+if (!ifSqlHasZeroNumRows($result)) {
        // At least one member was online so let's load them all
-       $OUT = ''; $SW = 2;
-       while (list($userid, $nick, $last) = SQL_FETCHROW($result)) {
-               $nick2 = '---';
-               if (($nick != $userid) && (!empty($nick))) $nick2 = $nick;
+       $OUT = '';
+       while ($content = sqlFetchArray($result)) {
+               // If ext-nickname is not installed, set 'nickname' to empty
+               if (!isExtensionActive('nickname')) {
+                       $content['nickname'] = '';
+               } // END - if
 
-               // Transfer data to array
-               $content = array(
-                       'sw'          => $SW,
-                       'userid'      => $userid,
-                       'nickname'    => $nick2,
-                       'points'      => translateComma(countSumTotalData($userid, 'user_points', 'points') - countSumTotalData($userid, 'user_data', 'used_points')),
-                       'last_online' => generateDateTime($last, 2),
-               );
+               // Translate comma
+               $content['last_online'] = generateDateTime($content['last_online'], '2');
 
                // Load template
-               $OUT .= loadTemplate('guest_active_row', true, $content);
-
-               // Switch colors
-               $SW = 3 - $SW;
-       }
+               $OUT .= loadTemplate('guest_list_active_row', TRUE, $content);
+       } // END - while
 } else {
        // No member was online today! :-(
-       $OUT = loadTemplate('guest_active_none_row', true);
+       $OUT = loadTemplate('guest_list_active_row_none', TRUE);
 }
 
 // Load template
-loadTemplate('guest_active_table', false, $OUT);
+loadTemplate('guest_list_active', FALSE, $OUT);
 
 // [EOF]
 ?>