+
+ // Return the data
+ return $data;
+}
+
+// Filter to load include files
+function FILTER_loadIncludeLUDES () {
+ // Default is $data as inclusion list
+ $data = GET_INC_POOL();
+
+ // Is it an array?
+ if ((!isset($data)) || (!is_array($data))) {
+ // Then abort here
+ debug_report_bug(sprintf("INC_POOL is no array! Type: %s", gettype($data)));
+ } elseif (isset($data['inc_pool'])) {
+ // Use this as new inclusion pool!
+ SET_INC_POOL($data['inc_pool']);
+ }
+
+ // Check for added include files
+ if (COUNT_INC_POOL() > 0) {
+ // Loads every include file
+ foreach (GET_INC_POOL() as $FQFN) {
+ loadIncludeOnce($FQFN);
+ } // END - foreach
+
+ // Reset array
+ INIT_INC_POOL();
+ } // END - if
+
+ // Continue with processing
+ return $data;
+}
+
+// Filter for running SQL commands
+function FILTER_RUN_SQLS ($data) {
+ // Debug message
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " - Entered!");
+
+ // Is the array there?
+ if ((IS_SQLS_VALID()) && ((!isset($data['dry_run'])) || ($data['dry_run'] == false))) {
+ // Run SQL commands
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " - Found ".COUNT_SQLS()." queries to run.");
+ foreach (GET_SQLS() as $sql) {
+ // Trim spaces away
+ $sql = trim($sql);
+
+ // Is there still a query left?
+ if (!empty($sql)) {
+ // Do we have an "ALTER TABLE" command?
+ if (substr(strtolower($sql), 0, 11) == "alter table") {
+ // Analyse the alteration command
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "Alterting table: {$sql}");
+ SQL_ALTER_TABLE($sql, __FUNCTION__, __LINE__);
+ } else {
+ // Run regular SQL command
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "Running regular query: {$sql}");
+ SQL_QUERY($sql, __FUNCTION__, __LINE__, false);
+ }
+ } // END - if
+ } // END - foreach
+ } // END - if
+
+ // Debug message
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " - Left!");
+}
+
+// Filter for updating/validating login data
+function FILTER_UPDATE_LOGIN_DATA () {
+ // Add missing array
+ if ((!isset($GLOBALS['last'])) || (!is_array($GLOBALS['last']))) $GLOBALS['last'] = array();
+
+ // Recheck if logged in
+ if (!IS_MEMBER()) return false;
+
+ // Secure user ID
+ setUserId(getSession('userid'));
+
+ // 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(getUserId()), __FUNCTION__, __LINE__);
+
+ // Entry found?
+ if (SQL_NUMROWS($result) == 1) {
+ // Load last module and online time
+ list($mod, $onl) = SQL_FETCHROW($result);
+
+ // Maybe first login time?
+ if (empty($mod)) $mod = 'login';
+
+ // This will be displayed on welcome page! :-)
+ if (empty($GLOBALS['last']['module'])) {
+ $GLOBALS['last']['module'] = $mod; $GLOBALS['last']['online'] = $onl;
+ } // END - if
+
+ // 'what' not set?
+ if (!isWhatSet()) {
+ // Fix it to default
+ setWhat('welcome');
+ if (getConfig('index_home') != '') setWhatFromConfig('index_home');
+ } // END - if
+
+ // Update last module / online time
+ 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(getWhat(), detectRemoteAddr(), getUserId()), __FUNCTION__, __LINE__);
+ } else {
+ // Destroy session, we cannot update!
+ destroyUserSession();
+ }
+
+ // Free the result
+ SQL_FREERESULT($result);
+}
+
+// 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 ((GET_EXT_VERSION('admins') >= '0.3.0') && (EXT_IS_ACTIVE('admins'))) {
+ // Check if action GET variable was set
+ $action = getAction();
+ if (isWhatSet()) {
+ // Get action value by what-value
+ $action = getModeAction('admin', getWhat());
+ } // END - if
+
+ // Check for access control line of current menu entry
+ $ret = adminsCheckAdminAcl($action, getWhat());
+ } // END - if
+
+ // Return result
+ return $ret;
+}
+
+// Filter for initializing randomizer
+function FILTER_INIT_RANDOMIZER () {
+ // Simply init the randomizer with seed and _ADD value
+ mt_srand(generateSeed() + getConfig('_ADD'));
+}
+
+// Filter for removing updates
+function FILTER_REMOVE_UPDATES () {
+ // Init removal list
+ EXT_INIT_REMOVAL_LIST();
+
+ // Add the current extension to it
+ EXT_ADD_CURRENT_TO_REMOVAL_LIST();
+
+ // Simply remove it
+ UNSET_EXT_SQLS();
+
+ // Do we need to remove update depency?
+ if (EXT_COUNT_UPDATE_DEPENDS() > 0) {
+ // Then find all updates we shall no longer execute
+ foreach (EXT_GET_UPDATE_DEPENDS() as $id=>$ext_name) {
+ // Shall we remove this update?
+ if (in_array($ext_name, EXT_GET_REMOVAL_LIST())) {
+ // Then remove this extension!
+ EXT_REMOVE_UPDATE_DEPENDS($ext_name);
+ } // END - if
+ } // END - foreach
+ } // END - if