The logout_above_text hook was misplaced. Got it back where it should be.
[squirrelmail.git] / src / right_main.php
index 8470069f43f3eed1b6d14d03f1ab29b23de304a8..1a99b0bdd77f52276133d3cd0853c135a212cb15 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * right_main.php
  *
- * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Copyright (c) 1999-2003 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * This is where the mailboxes are listed. This controls most of what
@@ -19,7 +19,6 @@ define('SM_PATH','../');
 require_once(SM_PATH . 'include/validate.php');
 require_once(SM_PATH . 'functions/imap.php');
 require_once(SM_PATH . 'functions/date.php');
-require_once(SM_PATH . 'functions/array.php');
 require_once(SM_PATH . 'functions/mime.php');
 require_once(SM_PATH . 'functions/mailbox_display.php');
 require_once(SM_PATH . 'functions/display_messages.php');
@@ -42,44 +41,38 @@ require_once(SM_PATH . 'functions/html.php');
 
 
 /* lets get the global vars we may need */
-$username = $_SESSION['username'];
-$key  = $_COOKIE['key'];
-$onetimepad = $_SESSION['onetimepad'];
-$base_uri = $_SESSION['base_uri'];
-$delimiter = $_SESSION['delimiter'];
-if (isset($_GET['startMessage'])) {
-    $startMessage = $_GET['startMessage'];
-} elseif (isset($_POST['startMessage'])) {
-    $startMessage = $_POST['startMessage'];
-}
-if (isset($_GET['mailbox'])) {
-    $mailbox = $_GET['mailbox'];
-} else if (isset($_POST['mailbox'])) {
-    $mailbox = $_POST['mailbox'];
-}
-if (isset($_GET['PG_SHOWNUM'])) {
-    $PG_SHOWNUM = $_GET['PG_SHOWNUM'];
+sqgetGlobalVar('key',       $key,           SQ_COOKIE);
+sqgetGlobalVar('username',  $username,      SQ_SESSION);
+sqgetGlobalVar('onetimepad',$onetimepad,    SQ_SESSION);
+sqgetGlobalVar('delimiter', $delimiter,     SQ_SESSION);
+sqgetGlobalVar('base_uri',  $base_uri,      SQ_SESSION);
+
+sqgetGlobalVar('mailbox',   $mailbox);
+sqgetGlobalVar('lastTargetMailbox', $lastTargetMailbox, SQ_SESSION);
+sqgetGlobalVar('session',           $session,           SQ_GET);
+sqgetGlobalVar('note',              $note,              SQ_GET);
+
+if ( sqgetGlobalVar('startMessage', $temp) ) {
+  $startMessage = (int) $temp;
 }
-elseif (isset($_SESSION['PG_SHOWNUM'])) {
-    $PG_SHOWNUM = $_SESSION['PG_SHOWNUM'];
+if ( sqgetGlobalVar('PG_SHOWNUM', $temp) ) {
+  $PG_SHOWNUM = (int) $temp;
 }
-if (isset($_GET['PG_SHOWALL'])) {
-    $PG_SHOWALL = $_GET['PG_SHOWALL'];
+if ( sqgetGlobalVar('PG_SHOWALL', $temp, SQ_GET) ) {
+  $PG_SHOWALL = (int) $temp;
 }
-if (isset($_GET['newsort'])) {
-    $newsort = $_GET['newsort'];
+if ( sqgetGlobalVar('newsort', $temp, SQ_GET) ) {
+  $newsort = (int) $temp;
 }
-if (isset($_GET['checkall'])) {
-    $checkall = $_GET['checkall'];
+if ( sqgetGlobalVar('checkall', $temp, SQ_GET) ) {
+  $checkall = (int) $temp;
 }
-if (isset($_GET['set_thread'])) {
-    $set_thread = $_GET['set_thread'];
+if ( sqgetGlobalVar('set_thread', $temp, SQ_GET) ) {
+  $set_thread = (int) $temp;
 }
-if (isset($_SESSION['lastTargetMailbox'])) {
-    $lastTargetMailbox =$_SESSION['lastTargetMailbox'];
+if ( !sqgetGlobalVar('composenew', $composenew, SQ_GET) ) {
+    $composenew = false;
 }
-
 /* end of get globals */
 
 
@@ -150,9 +143,9 @@ do_hook ('generic_header');
 
 sqimap_mailbox_select($imapConnection, $mailbox);
 
-if (isset($composenew) && $composenew) {
-    $comp_uri = '../src/compose.php?mailbox='. urlencode($mailbox).
-               "&session=$composesession";
+if ($composenew) {
+    $comp_uri = SM_PATH . 'src/compose.php?mailbox='. urlencode($mailbox).
+               "&session=$session";
     displayPageHeader($color, $mailbox, "comp_in_new('$comp_uri');", false);
 } else {
     displayPageHeader($color, $mailbox);
@@ -198,18 +191,18 @@ if (! isset($use_mailbox_cache)) {
     $use_mailbox_cache = 0;
 }
 
-if ($use_mailbox_cache && session_is_registered('msgs')) {
+if ($use_mailbox_cache && sqsession_is_registered('msgs')) {
     showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache);
 } else {
-    if (session_is_registered('msgs')) {
+    if (sqsession_is_registered('msgs')) {
         unset($msgs);
     }
 
-    if (session_is_registered('msort')) {
+    if (sqsession_is_registered('msort')) {
         unset($msort);
     }
 
-    if (session_is_registered('numMessages')) {
+    if (sqsession_is_registered('numMessages')) {
         unset($numMessages);
     }
 
@@ -219,12 +212,12 @@ if ($use_mailbox_cache && session_is_registered('msgs')) {
                            $startMessage, $sort, $color, $show_num,
                            $use_mailbox_cache);
 
-    if (session_is_registered('msgs') && isset($msgs)) {
+    if (sqsession_is_registered('msgs') && isset($msgs)) {
         sqsession_register($msgs, 'msgs');
         $_SESSION['msgs'] = $msgs;
     }
 
-    if (session_is_registered('msort') && isset($msort)) {
+    if (sqsession_is_registered('msort') && isset($msort)) {
         sqsession_register($msort, 'msort');
         $_SESSION['msort'] = $msort;
     }