Added a check in sqimap_login to verify $onetimepad is set. Not sure why
[squirrelmail.git] / src / right_main.php
index 8470069f43f3eed1b6d14d03f1ab29b23de304a8..dd53d45922c12d4f05f8108753375a6c9c7cac79 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');
@@ -49,9 +48,9 @@ $base_uri = $_SESSION['base_uri'];
 $delimiter = $_SESSION['delimiter'];
  
 if (isset($_GET['startMessage'])) {
-    $startMessage = $_GET['startMessage'];
+    $startMessage = (int) $_GET['startMessage'];
 } elseif (isset($_POST['startMessage'])) {
-    $startMessage = $_POST['startMessage'];
+    $startMessage = (int) $_POST['startMessage'];
 }
 if (isset($_GET['mailbox'])) {
     $mailbox = $_GET['mailbox'];
@@ -59,27 +58,38 @@ if (isset($_GET['mailbox'])) {
     $mailbox = $_POST['mailbox'];
 }
 if (isset($_GET['PG_SHOWNUM'])) {
-    $PG_SHOWNUM = $_GET['PG_SHOWNUM'];
+    $PG_SHOWNUM = (int) $_GET['PG_SHOWNUM'];
 }
 elseif (isset($_SESSION['PG_SHOWNUM'])) {
-    $PG_SHOWNUM = $_SESSION['PG_SHOWNUM'];
+    $PG_SHOWNUM = (int) $_SESSION['PG_SHOWNUM'];
 }
 if (isset($_GET['PG_SHOWALL'])) {
-    $PG_SHOWALL = $_GET['PG_SHOWALL'];
+    $PG_SHOWALL = (int) $_GET['PG_SHOWALL'];
 }
 if (isset($_GET['newsort'])) {
-    $newsort = $_GET['newsort'];
+    $newsort = (int) $_GET['newsort'];
 }
+if (isset($_GET['composenew'])) {
+    $composenew = $_GET['composenew'];
+} else {
+    $composenew = false;
+}
+
 if (isset($_GET['checkall'])) {
-    $checkall = $_GET['checkall'];
+    $checkall = (int) $_GET['checkall'];
 }
 if (isset($_GET['set_thread'])) {
-    $set_thread = $_GET['set_thread'];
+    $set_thread = (int) $_GET['set_thread'];
 }
 if (isset($_SESSION['lastTargetMailbox'])) {
     $lastTargetMailbox =$_SESSION['lastTargetMailbox'];
 }
 
+if (isset($_GET['session'])) {
+    $session = $_GET['session'];
+}
+
+
 /* end of get globals */
 
 
@@ -150,9 +160,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 +208,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 +229,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;
     }