+// Filter for updating/validating login data
+function FILTER_UPDATE_LOGIN_DATA () {
+ // Add missing array
+ if ((!isset($GLOBALS['last_online'])) || (!is_array($GLOBALS['last_online']))) $GLOBALS['last_online'] = array();
+
+ // Recheck if logged in
+ if (!isMember()) return false;
+
+ // Secure user id
+ setMemberId(getSession('userid'));
+
+ // Found a userid?
+ if (fetchUserData(getMemberId())) {
+ // Load last module and online time
+ $content = getUserDataArray();
+
+ // Maybe first login time?
+ if (empty($content['last_module'])) $content['last_module'] = 'login';
+
+ // This will be displayed on welcome page! :-)
+ if (empty($GLOBALS['last_online']['module'])) {
+ $GLOBALS['last_online']['module'] = $content['last_module'];
+ $GLOBALS['last_online']['online'] = $content['last_online'];
+ } // 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(),
+ getMemberId()
+ ), __FUNCTION__, __LINE__);
+ } else {
+ // Destroy session, we cannot update!
+ destroyMemberSession();
+ }
+}
+
+// Filter for initializing randomizer
+function FILTER_INIT_RANDOMIZER () {
+ // Only execute this filter if installed
+ if ((!isInstalled()) || (!isExtensionInstalledAndNewer('other', '0.2.5'))) return;
+
+ // Take a prime number which is long (if you know a longer one please try it out!)
+ setConfigEntry('_PRIME', 591623);
+
+ // Calculate "entropy" with the prime number (for code generation)
+ setConfigEntry('_ADD', (getConfig('_PRIME') * getConfig('_PRIME') / (pi() * getConfig('code_length') + 1)));
+
+ // Simply init the randomizer with seed and _ADD value
+ mt_srand(generateSeed() + getConfig('_ADD'));
+}
+
+// Filter for removing updates
+function FILTER_REMOVE_UPDATES ($data) {
+ // Init removal list
+ initExtensionRemovalList();
+
+ // Add the current extension to it
+ addCurrentExtensionToRemovalList();
+
+ // Simply remove it
+ unsetExtensionSqls();
+
+ // Do we need to remove update depency?
+ if (countExtensionUpdateDependencies() > 0) {
+ // Then find all updates we shall no longer execute
+ foreach (getExtensionUpdateDependencies() as $id=>$ext_name) {
+ // Shall we remove this update?
+ if (in_array($ext_name, getExtensionRemovalList())) {
+ // Then remove this extension!
+ removeExtensionUpdateDependency($ext_name);
+ } // END - if
+ } // END - foreach