+
+ // Return the data
+ return $data;
+}
+
+// Filter to load include files
+function FILTER_LOAD_INCLUDES ($data) {
+ global $INC_POOL;
+
+ // Is it an array?
+ if ((!isset($INC_POOL)) || (!is_array($INC_POOL))) {
+ // Then abort here
+ DEBUG_LOG(__FILE__, __LINE__, "INC_POOL is no array!");
+ return $data;
+ } // END - if
+
+ // Check for added include files
+ if (count($INC_POOL) > 0) {
+ // Loads every include file
+ foreach ($INC_POOL as $fqfn) {
+ require_once($fqfn);
+ } // END - foreach
+
+ // Remove array
+ unset($INC_POOL);
+ } // END - if
+
+ // Return $data
+ return $data;
+}
+
+// Filter for running SQL commands
+function FILTER_RUN_SQLS ($dry_run) {
+ global $SQLs;
+
+ // Is the array there?
+ if ((is_array($SQLs)) && (!$dry_run)) {
+ // Run SQL commands
+ foreach ($SQLs as $sql) {
+ $sql = trim($sql);
+ if (!empty($sql)) {
+ // Do we have an "ALTER TABLE" command?
+ if (substr(strtolower($sql), 0, 11) == "alter table") {
+ // Analyse the alteration command
+ SQL_ALTER_TABLE($sql, __FILE__, __LINE__);
+ } else {
+ // Run regular SQL command
+ $result = SQL_QUERY($sql, __FILE__, __LINE__, false);
+ }
+ } // END - if
+ } // END - foreach
+ } elseif (GET_EXT_VERSION("sql_patches") == "") {
+ // Remove SQLs if extension is not installed
+ $SQLs = array();
+ }
+}
+
+// Filter for updating/validating login data
+function FILTER_UPDATE_LOGIN_DATA () {
+ global $LAST;
+ if (!is_array($LAST)) $LAST = array();
+
+ // Recheck if logged in
+ if (!IS_MEMBER()) return false;
+
+ // Secure user ID
+ $GLOBALS['userid'] = bigintval(get_session('userid'));
+
+ // Extract last online time (life) and how long is auto-login valid (time)
+ $newl = time() + bigintval(get_session('lifetime'));
+
+ // Load last module and last online time
+ $result = SQL_QUERY_ESC("SELECT last_module, last_online FROM `"._MYSQL_PREFIX."_user_data` WHERE userid=%s LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) == 1) {
+ // Load last module and online time
+ list($mod, $onl) = SQL_FETCHROW($result);
+ SQL_FREERESULT($result);
+
+ // Maybe first login time?
+ if (empty($mod)) $mod = "login";
+
+ if (set_session("userid", $GLOBALS['userid'], $newl, COOKIE_PATH) && set_session("u_hash", get_session('u_hash'), $newl, COOKIE_PATH) && set_session("lifetime", bigintval(get_session('lifetime')), $newl, COOKIE_PATH)) {
+ // This will be displayed on welcome page! :-)
+ if (empty($LAST['module'])) {
+ $LAST['module'] = $mod; $LAST['online'] = $onl;
+ } // END - if
+
+ // "what" not set?
+ if (empty($GLOBALS['what'])) {
+ // Fix it to default
+ $GLOBALS['what'] = "welcome";
+ if (getConfig('index_home') != "") $GLOBALS['what'] = getConfig('index_home');
+ } // END - if
+
+ // Update last module / online time
+ $result = SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_user_data` SET last_module='%s', last_online=UNIX_TIMESTAMP(), REMOTE_ADDR='%s' WHERE userid=%s LIMIT 1",
+ array($GLOBALS['what'], GET_REMOTE_ADDR(), $GLOBALS['userid']), __FILE__, __LINE__);
+ }
+ } else {
+ // Destroy session, we cannot update!
+ destroy_user_session();
+ }
+}
+
+// Filter for checking admin ACL
+function FILTER_CHECK_ADMIN_ACL () {
+ // Extension not installed so it's always allowed to access everywhere!
+ $ret = true;
+
+ // Ok, Cookie-Update done
+ if ((EXT_IS_ACTIVE("admins")) && (GET_EXT_VERSION("admins") > "0.2")) {
+ // Check if action GET variable was set
+ $action = SQL_ESCAPE($GLOBALS['action']);
+ if (!empty($GLOBALS['what'])) {
+ // Get action value by what-value
+ $action = GET_ACTION("admin", $GLOBALS['what']);
+ } // END - if
+
+ // Check for access control line of current menu entry
+ $ret = ADMINS_CHECK_ACL($action, $GLOBALS['what']);
+ } // END - if
+
+ // Return result
+ return $ret;