-/*****************************************************************/
-/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/
-/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/
-/*** + Base level indent should begin at left margin, as ***/
-/*** the require_once below looks. ***/
-/*** + All identation should consist of four space blocks ***/
-/*** + Tab characters are evil. ***/
-/*** + all comments should use "slash-star ... star-slash" ***/
-/*** style -- no pound characters, no slash-slash style ***/
-/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/
-/*** ALWAYS USE { AND } CHARACTERS!!! ***/
-/*** + Please use ' instead of ", when possible. Note " ***/
-/*** should always be used in _( ) function calls. ***/
-/*** Thank you for your help making the SM code more readable. ***/
-/*****************************************************************/
+/**
+ * Path for SquirrelMail required files.
+ * @ignore
+ */
+define('SM_PATH','../');
+
+/* check if we're already logged out (e.g. when this page is reloaded),
+ * so we can skip to the output and not give error messages */
+if( ! isset($_SESSION) || empty($_SESSION['user_is_logged_in']) ) {
+ $loggedin = false;
+} else {
+ $loggedin = true;
+}
+
+if($loggedin) {
+ require_once(SM_PATH . 'include/validate.php');
+ require_once(SM_PATH . 'functions/prefs.php');
+} else {
+ // this comes in through validate.php usually
+ require_once(SM_PATH . 'config/config.php');
+ require_once(SM_PATH . 'functions/i18n.php');
+ require_once(SM_PATH . 'functions/page_header.php');
+ if (@file_exists($theme[$theme_default]['PATH'])) {
+ @include ($theme[$theme_default]['PATH']);
+ }
+}
+require_once(SM_PATH . 'functions/plugin.php');
+require_once(SM_PATH . 'functions/strings.php');
+require_once(SM_PATH . 'functions/html.php');