-if (!IS_MEMBER()) {
- // Redirect
- // @TODO Display quick login form here or redirect as configured
- redirectToUrl('modules.php?module=index');
+if (!isMember()) {
+ // Should we display login window or redirect to main page?
+ if ((getConfig('surfbar_guest_login_form') == 'Y') && (isExtensionActive('user'))) {
+ // Is the form sent?
+ if ((isFormSent()) && (isPostRequestElementSet('id')) && (isPostRequestElementSet('password'))) {
+ // Do the login procedure
+ $URL = doUserLogin(postRequestElement('id'), postRequestElement('password'), basename(__FILE__), basename(__FILE__) . '?code=');
+
+ // And redirect to the URL
+ redirectToUrl($URL);
+ } else {
+ // Load header
+ loadIncludeOnce('inc/header.php');
+
+ // Is there a 'code' provided?
+ if (isGetRequestElementSet('code')) {
+ // Then generate an error message
+ loadTemplate('admin_settings_saved', false, getMessageFromErrorCode(getRequestElement('code')));
+ } // END - if
+
+ // Display login form
+ loadTemplate('surfbar_login_form');
+
+ // Allow footer here
+ $GLOBALS['header_sent'] = 2;
+
+ // Load footer
+ loadIncludeOnce('inc/footer.php');
+ }
+ } else {
+ // Redirect
+ redirectToUrl('index.php');
+ }