-require("inc/config.php");
-
-// Is the script installed?
-if (isBooleanConstantAndTrue('mxchange_installed')) {
- // Only logged in users may use this surfbar!
- if (!EXT_IS_ACTIVE("surfbar")) {
- // Surfbar deactivated
- LOAD_URL("modules.php?module=login&msg=".CODE_EXTENSION_PROBLEM."&ext=surfbar");
- } elseif (!IS_MEMBER()) {
+require('inc/config-global.php');
+
+// Set content type
+setContentType('text/html');
+
+// Is a frame active?
+if (isGetRequestParameterSet('frame')) {
+ // Then we need to set header_sent to 0
+ $GLOBALS['header_sent'] = '0';
+} // END - if
+
+// Only logged in users may use this surfbar!
+redirectOnUninstalledExtension('surfbar');
+
+// No member?
+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 {