-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()) && (isPostRequestParameterSet('id')) && (isPostRequestParameterSet('password'))) {
+ // Do the login procedure
+ $url = doUserLogin(postRequestParameter('id'), postRequestParameter('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 (isGetRequestParameterSet('code')) {
+ // Then generate an error message
+ displayMessage(getMessageFromErrorCode(getRequestParameter('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('modules.php?module=index');
+ }