Bläddra i källkod

use PAGE_NAME to switch on which page we are, rather than
sInitLocation

Thijs Kinkhorst 18 år sedan
förälder
incheckning
c9ff9f9e14
4 ändrade filer med 5 tillägg och 22 borttagningar
  1. 5 11
      include/init.php
  2. 0 4
      src/login.php
  3. 0 1
      src/redirect.php
  4. 0 6
      src/style.php

+ 5 - 11
include/init.php

@@ -49,9 +49,6 @@ if ((bool) ini_get('register_globals') &&
         case 'key':
         case 'key':
         case 'value':
         case 'value':
             break;
             break;
-        case 'sInitLocation':
-            // FIXME: variable must be set only in src/login.php
-            break;
         default:
         default:
             unset($GLOBALS[$key]);
             unset($GLOBALS[$key]);
         }
         }
@@ -294,15 +291,12 @@ if (! sqgetGlobalVar('squirrelmail_language',$squirrelmail_language,SQ_COOKIE))
     $squirrelmail_language = '';
     $squirrelmail_language = '';
 }
 }
 
 
-
 /**
 /**
- * @var $sInitlocation From where do we include.
+ * Do something special for some pages. This is based on the PAGE_NAME constand
+ * set at the top of every page.
  */
  */
-if (!isset($sInitLocation)) {
-    $sInitLocation=NULL;
-}
-
-switch ($sInitLocation) {
+if ( !defined('PAGE_NAME') ) define('PAGE_NAME', NULL);
+switch (PAGE_NAME) {
     case 'style':
     case 'style':
 
 
         // need to get the right template set up
         // need to get the right template set up
@@ -417,7 +411,7 @@ switch ($sInitLocation) {
             // signout page will deal with users who aren't logged
             // signout page will deal with users who aren't logged
             // in on its own; don't show error here
             // in on its own; don't show error here
             //
             //
-            if ( defined('PAGE_NAME') && PAGE_NAME == 'signout' ) {
+            if ( PAGE_NAME == 'signout' ) {
                 return;
                 return;
             }
             }
 
 

+ 0 - 4
src/login.php

@@ -15,15 +15,11 @@
 /** This is the login page */
 /** This is the login page */
 define('PAGE_NAME', 'login');
 define('PAGE_NAME', 'login');
 
 
-// reduces the files included in init.php
-$sInitLocation = 'login';
-
 /**
 /**
  * Include the SquirrelMail initialization file.
  * Include the SquirrelMail initialization file.
  */
  */
 require('../include/init.php');
 require('../include/init.php');
 
 
-
 /* SquirrelMail required files. */
 /* SquirrelMail required files. */
 require_once(SM_PATH . 'functions/imap_general.php');
 require_once(SM_PATH . 'functions/imap_general.php');
 require_once(SM_PATH . 'functions/forms.php');
 require_once(SM_PATH . 'functions/forms.php');

+ 0 - 1
src/redirect.php

@@ -10,7 +10,6 @@
  * @version $Id$
  * @version $Id$
  * @package squirrelmail
  * @package squirrelmail
  */
  */
-$sInitLocation = 'redirect';
 
 
 /** This is the redirect page */
 /** This is the redirect page */
 define('PAGE_NAME', 'redirect');
 define('PAGE_NAME', 'redirect');

+ 0 - 6
src/style.php

@@ -23,12 +23,6 @@
 /** This is the style page */
 /** This is the style page */
 define('PAGE_NAME', 'style');
 define('PAGE_NAME', 'style');
 
 
-/**
- * Set the location in order to skip unneeded validation and other includes
- * in the SquirrelMail initialisation file.
- */
-$sInitLocation = 'style';
-
 /**
 /**
  * Include the SquirrelMail initialization file.
  * Include the SquirrelMail initialization file.
  */
  */