<?php
/************************************************************************
- * MXChange v0.2.1 Start: 11/26/2004 *
- * ================ Last change: 11/26/2004 *
+ * Mailer v0.2.1-FINAL Start: 11/26/2004 *
+ * =================== Last change: 11/26/2004 *
* *
* -------------------------------------------------------------------- *
* File : what-active.php *
* -------------------------------------------------------------------- *
* Kurzbeschreibung : Liste heutiger aktiver Mitglieder *
* -------------------------------------------------------------------- *
- * *
+ * $Revision:: $ *
+ * $Date:: $ *
+ * $Tag:: 0.2.1-FINAL $ *
+ * $Author:: $ *
* -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder *
- * For more information visit: http://www.mxchange.org *
+ * Copyright (c) 2003 - 2009 by Roland Haeder *
+ * Copyright (c) 2009 - 2012 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 (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
-{
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
- require($INC);
-}
- elseif ((!EXT_IS_ACTIVE("active")) && (!IS_ADMIN()))
-{
- ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "active");
- return;
-}
+if (!defined('__SECURITY')) {
+ exit();
+} // END - if
// Add description as navigation point
-ADD_DESCR("guest", basename(__FILE__));
+addYouAreHereLink('guest', __FILE__);
-// The day normally starts on 00:00:00, so let's subtract current hours/minutes/seconds from current time stamp!
-$START = time() - date("H", time())*60*60 - date("m", time())*60 - date("s", time());
+if ((!isExtensionActive('active')) && (!isAdmin())) {
+ displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=active%}');
+ return;
+} // END - if
// Check for members who were active only this day
-$ADD = "uid";
-if (EXT_IS_ACTIVE("nickname")) $ADD = "nickname";
+$result = SQL_QUERY("SELECT
+ `userid`,
+ `last_online`
+FROM
+ `{?_MYSQL_PREFIX?}_user_data`
+WHERE
+ `last_online` >= {?START_TDAY?} AND
+ `status`='CONFIRMED'
+ " . runFilterChain('user_exclusion_sql', ' ') . "
+ORDER BY
+ `last_online` DESC
+LIMIT {?active_limit?}", __FILE__, __LINE__);
-$result = SQL_QUERY_ESC("SELECT userid, ".$ADD.", last_online
-FROM "._MYSQL_PREFIX."_user_data
-WHERE last_online >= %s AND status='CONFIRMED'
-ORDER BY last_online DESC LIMIT %s",
- array($START, $CONFIG['active_limit']), __FILE__, __LINE__);
-
-if (SQL_NUMROWS($result) > 0)
-{
+// Entries found?
+if (!SQL_HASZERONUMS($result)) {
// At least one member was online so let's load them all
- $OUT = ""; $SW = 2;
- while(list($uid, $nick, $last) = SQL_FETCHROW($result))
- {
- $nick2 = "---";
- if (($nick != $uid) && (!empty($nick))) $nick2 = $nick;
+ $OUT = '';
+ while ($content = SQL_FETCHARRAY($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,
- 'uid' => $uid,
- 'nick' => $nick2,
- 'points' => TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_points", "points") - GET_TOTAL_DATA($uid, "user_data", "used_points")),
- 'last' => MAKE_DATETIME($last, "2"),
- );
+ // Translate comma
+ $content['last_online'] = generateDateTime($content['last_online'], '2');
// Load template
- $OUT .= LOAD_TEMPLATE("guest_active_row", true, $content);
-
- // Switch colors
- $SW = 3 - $SW;
- }
-}
- else
-{
+ $OUT .= loadTemplate('guest_list_active_row', TRUE, $content);
+ } // END - while
+} else {
// No member was online today! :-(
- $OUT = LOAD_TEMPLATE("guest_active_none_row", true);
+ $OUT = loadTemplate('guest_list_active_row_none', TRUE);
}
-// Remember output in constant
-define('__ACTIVE_ROWS', $OUT);
-
// Load template
-LOAD_TEMPLATE("guest_active_table");
+loadTemplate('guest_list_active', FALSE, $OUT);
-//
+// [EOF]
?>