+ // Should we display adverts in this menu?
+ if ((isExtensionInstalledAndNewer('menu', '0.0.1')) && (getConfig($mode . '_menu_advert_enabled') == 'Y')) {
+ // Add seperator again
+ $GLOBALS['rows'] .= loadTemplate('menu_seperator', true, $mode);
+
+ // Display advert template
+ $GLOBALS['rows'] .= loadTemplate('menu_' . $mode . '_advert_end', true);
+ } // END - if
+
+ // Prepare data
+ $content = array(
+ 'rows' => $GLOBALS['rows'],
+ 'mode' => $mode
+ );
+
+ // Load main template
+ //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*<br />");
+ loadTemplate('menu_table', false, $content);
+ } // END - if
+}
+
+// Checks wether the current user is a member
+function isMember () {
+ // By default no member
+ $ret = false;
+
+ // Fix missing 'last_online' array, damn stupid code :(((
+ // @TODO Try to rewrite this to one or more functions
+ if ((!isset($GLOBALS['last_online'])) || (!is_array($GLOBALS['last_online']))) $GLOBALS['last_online'] = array();
+
+ // is the cache entry there?
+ if (isset($GLOBALS['is_member'])) {
+ // Then return it
+ return $GLOBALS['is_member'];
+ } // END - if
+
+ // Init global 'status'
+ $GLOBALS['status'] = false;
+
+ // Fix "deleted" cookies first
+ fixDeletedCookies(array('userid', 'u_hash'));
+
+ // Are cookies set?
+ if ((isUserIdSet()) && (isSessionVariableSet('u_hash'))) {
+ // Cookies are set with values, but are they valid?
+ $result = SQL_QUERY_ESC("SELECT `password`, `status`, `last_module`, `last_online` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1",
+ array(getUserId()), __FUNCTION__, __LINE__);
+ if (SQL_NUMROWS($result) == 1) {
+ // Load data from cookies
+ list($password, $GLOBALS['status'], $mod, $onl) = SQL_FETCHROW($result);
+
+ // Validate password by created the difference of it and the secret key
+ $valPass = generatePassString($password);
+
+ // Transfer last module and online time
+ if ((!empty($mod)) && (empty($GLOBALS['last_online']['module']))) {
+ // @TODO Try to rewrite this to one or more functions
+ $GLOBALS['last_online']['module'] = $mod;
+ $GLOBALS['last_online']['online'] = $onl;
+ } // END - if
+
+ // So did we now have valid data and an unlocked user?
+ if (($GLOBALS['status'] == 'CONFIRMED') && ($valPass == getSession('u_hash'))) {
+ // Account is confirmed and all cookie data is valid so he is definely logged in! :-)
+ $ret = true;
+ } else {
+ // Maybe got locked etc.
+ //* DEBUG: */ outputHtml(__LINE__."!!!<br />");
+ destroyUserSession();
+ }
+ } else {
+ // Cookie data is invalid!
+ //* DEBUG: */ outputHtml(__LINE__."***<br />");
+ destroyUserSession();
+ }
+
+ // Free memory
+ SQL_FREERESULT($result);
+ } else {
+ // Cookie data is invalid!
+ //* DEBUG: */ outputHtml(__LINE__."///<br />");
+ destroyUserSession();