Do not pass the $key to sqimap_login, that takes care of that itself.
authorkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 5 Aug 2006 14:39:17 +0000 (14:39 +0000)
committerkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 5 Aug 2006 14:39:17 +0000 (14:39 +0000)
Also remove any globals that are not needed anymore because of this change,
or because they're already set in init.php.

I believe that we should move to a sqimap_login() without any parameters,
but this is a good first step.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11476 7612ce4b-ef26-0410-bec9-ea0150e637f0

15 files changed:
src/addrbook_search.php
src/compose.php
src/download.php
src/empty_trash.php
src/folders.php
src/left_main.php
src/printer_friendly_bottom.php
src/read_body.php
src/right_main.php
src/search.php
src/vcard.php
src/view_header.php
src/view_html.php
src/view_text.php
src/webmail.php

index 843303cc9e5815503b5b015bb85d7fa7151d143b..f75abff9ce2143422f44613f20f2b879b000fff4 100644 (file)
@@ -154,10 +154,6 @@ function display_result($res, $includesource = true) {
 /* ================= End of functions ================= */
 
 /** lets get the global vars we may need */
-sqgetGlobalVar('key',       $key,           SQ_COOKIE);
-sqgetGlobalVar('username',  $username,      SQ_SESSION);
-sqgetGlobalVar('onetimepad',$onetimepad,    SQ_SESSION);
-sqgetGlobalVar('base_uri',  $base_uri,      SQ_SESSION);
 
 if (! sqgetGlobalVar('show' , $show)) {
     $show = '';
index 059fd8f7b9b9278921d40fc231f3dd5b355a9975..80784195d5dd6fcff98a8a8d725ea4fa6be7d98f 100644 (file)
@@ -33,13 +33,8 @@ require_once(SM_PATH . 'functions/forms.php');
 require_once(SM_PATH . 'functions/identity.php');
 
 /* --------------------- Get globals ------------------------------------- */
-/** COOKIE VARS */
-sqgetGlobalVar('key',       $key,           SQ_COOKIE);
 
 /** SESSION VARS */
-sqgetGlobalVar('username',  $username,      SQ_SESSION);
-sqgetGlobalVar('onetimepad',$onetimepad,    SQ_SESSION);
-sqgetGlobalVar('base_uri',  $base_uri,      SQ_SESSION);
 sqgetGlobalVar('delimiter', $delimiter,     SQ_SESSION);
 
 sqgetGlobalVar('composesession',    $composesession,    SQ_SESSION);
@@ -382,7 +377,7 @@ if ($draft) {
         $draft_message = _("Draft Email Saved");
         /* If this is a resumed draft, then delete the original */
         if(isset($delete_draft)) {
-            $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, false);
+            $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, false);
             sqimap_mailbox_select($imap_stream, $draft_folder);
             // force bypass_trash=true because message should be saved when deliverMessage() returns true.
             // in current implementation of sqimap_msgs_list_flag() single message id can
@@ -481,7 +476,7 @@ if ($send) {
 
         /* if it is resumed draft, delete draft message */
         if ( isset($delete_draft)) {
-            $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, false);
+            $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, false);
             sqimap_mailbox_select($imap_stream, $draft_folder);
             // bypass_trash=true because message should be saved when deliverMessage() returns true.
             // in current implementation of sqimap_msgs_list_flag() single message id can
@@ -702,7 +697,7 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se
     $mailprio = 3;
 
     if ($passed_id) {
-        $imapConnection = sqimap_login($username, $key, $imapServerAddress,
+        $imapConnection = sqimap_login($username, false, $imapServerAddress,
                 $imapPort, 0);
 
         sqimap_mailbox_select($imapConnection, $mailbox);
@@ -1643,7 +1638,7 @@ function deliverMessage($composeMessage, $draft=false) {
     } elseif ($draft) {
         global $draft_folder;
         require_once(SM_PATH . 'class/deliver/Deliver_IMAP.class.php');
-        $imap_stream = sqimap_login($username, $key, $imapServerAddress,
+        $imap_stream = sqimap_login($username, false, $imapServerAddress,
                 $imapPort, 0);
         if (sqimap_mailbox_exists ($imap_stream, $draft_folder)) {
             require_once(SM_PATH . 'class/deliver/Deliver_IMAP.class.php');
@@ -1681,7 +1676,7 @@ function deliverMessage($composeMessage, $draft=false) {
     } else {
         unset ($deliver);
         $move_to_sent = getPref($data_dir,$username,'move_to_sent');
-        $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+        $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
 
         /* Move to sent code */
         if (isset($default_move_to_sent) && ($default_move_to_sent != 0)) {
index 1d5acca8af1e6830f0c75e4522b074c22aea437d..72b2c8bfa0c80a1d1a5ff90e06f15a75c8ed302a 100644 (file)
@@ -26,9 +26,6 @@ header('Pragma: ');
 header('Cache-Control: cache');
 
 /* globals */
-sqgetGlobalVar('key',        $key,          SQ_COOKIE);
-sqgetGlobalVar('username',   $username,     SQ_SESSION);
-sqgetGlobalVar('onetimepad', $onetimepad,   SQ_SESSION);
 sqgetGlobalVar('mailbox_cache',$mailbox_cache,SQ_SESSION);
 sqgetGlobalVar('messages',   $messages,     SQ_SESSION);
 sqgetGlobalVar('mailbox',    $mailbox,      SQ_GET);
@@ -46,7 +43,7 @@ set_my_charset();
 
 /* end globals */
 
-$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
 $aMailbox = sqm_api_mailbox_select($imapConnection, $account, $mailbox,array(),array());
 
 if (isset($aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT']) &&
index a099d66782fca0c856efe635e59e7b823bdbb751..c467a8bf03a38cf6940d2e1beac43e7fe6d0d713 100644 (file)
@@ -23,14 +23,11 @@ require(SM_PATH . 'functions/tree.php');
 
 /* get those globals */
 
-sqgetGlobalVar('username', $username, SQ_SESSION);
-sqgetGlobalVar('key', $key, SQ_COOKIE);
 sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
-sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
 
 /* finished globals */
 
-$imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+$imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
 
 $mailbox = $trash_folder;
 $boxes = sqimap_mailbox_list($imap_stream);
@@ -74,4 +71,4 @@ session_write_close();
 $location = get_location();
 header ("Location: $location/left_main.php");
 
-?>
\ No newline at end of file
+?>
index 559a284e6ed9ddeb7b7ea023c9315492cd9e65f1..afa2203292e0b306d47e9eb17c938f3af43328ac 100644 (file)
@@ -26,17 +26,12 @@ require_once(SM_PATH . 'functions/forms.php');
 displayPageHeader($color, 'None');
 
 /* get globals we may need */
-
-sqgetGlobalVar('username', $username, SQ_SESSION);
-sqgetGlobalVar('key', $key, SQ_COOKIE);
 sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
-sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
-
 sqgetGlobalVar('smaction', $action, SQ_POST);
 
 /* end of get globals */
 
-$imapConnection = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 0);
+$imapConnection = sqimap_login ($username, false, $imapServerAddress, $imapPort, 0);
 
 /* switch to the right function based on what the user selected */
 if ( sqgetGlobalVar('smaction', $action, SQ_POST) ) {
index 61af595db4431b83bec343eed968a74fadd6d8c3..cba10d1c7a98e95eece86a3c22002bb06a4a480f 100644 (file)
@@ -28,10 +28,7 @@ define('SM_BOX_UNCOLLAPSED', 0);
 define('SM_BOX_COLLAPSED',   1);
 
 /* get globals */
-sqgetGlobalVar('username', $username, SQ_SESSION);
-sqgetGlobalVar('key', $key, SQ_COOKIE);
 sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
-sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
 
 sqgetGlobalVar('fold', $fold, SQ_GET);
 sqgetGlobalVar('unfold', $unfold, SQ_GET);
@@ -39,7 +36,7 @@ sqgetGlobalVar('unfold', $unfold, SQ_GET);
 
 // open a connection on the imap port (143)
 // why hide the output?
-$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, true);
+$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, true);
 
 /**
  * Using stristr since very old preferences may contain "None" and "none".
@@ -209,4 +206,4 @@ $oTemplate->display('left_main.tpl');
 
 sqimap_logout($imapConnection);
 $oTemplate->display('footer.tpl');
-?>
\ No newline at end of file
+?>
index 350c466b637ca91a0ef3012e95ac856a4d281b66..00e416b42eefad5d342ef4108211a1b087a5d6a7 100644 (file)
@@ -27,10 +27,6 @@ require_once(SM_PATH . 'functions/mime.php');
 require_once(SM_PATH . 'functions/url_parser.php');
 
 /* get some of these globals */
-sqgetGlobalVar('username', $username, SQ_SESSION);
-sqgetGlobalVar('key', $key, SQ_COOKIE);
-sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
-
 sqgetGlobalVar('passed_id', $passed_id, SQ_GET);
 sqgetGlobalVar('mailbox', $mailbox, SQ_GET);
 
@@ -40,7 +36,7 @@ if (! sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET) ) {
 sqgetGlobalVar('show_html_default', $show_html_default, SQ_FORM);
 /* end globals */
 
-$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
 $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox);
 if (isset($messages[$mbx_response['UIDVALIDITY']][$passed_id])) {
     $message = $messages[$mbx_response['UIDVALIDITY']][$passed_id];
index e8a74a1582504c83f219a2ba4887fe1b76d9e885..b04812b0b355c3b144a18601b6902dfda46332fe 100644 (file)
@@ -816,11 +816,7 @@ function getButton($type, $name, $value, $js = '', $enabled = TRUE) {
 
 /* get the globals we may need */
 
-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('lastTargetMailbox', $lastTargetMailbox, SQ_SESSION);
 if (!sqgetGlobalVar('messages', $messages, SQ_SESSION) ) {
     $messages = array();
@@ -896,7 +892,7 @@ sqgetGlobalVar('mailbox_cache',$mailbox_cache,SQ_SESSION);
 /* end of get globals */
 global $sqimap_capabilities, $lastTargetMailbox;
 
-$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
 $aMailbox = sqm_api_mailbox_select($imapConnection, $iAccount, $mailbox,array('setindex' => $what, 'offset' => $startMessage),array());
 
 
index a2903eb4c02a7ca1180b7b85b4ca87b2809cfa36..e644d8d150465b57a98756bdac92a7d410f61b89 100644 (file)
@@ -30,9 +30,7 @@ require_once(SM_PATH . 'functions/mailbox_display.php');
 
 
 /* lets get the global vars we may need */
-sqgetGlobalVar('username',  $username,      SQ_SESSION);
 sqgetGlobalVar('delimiter', $delimiter,     SQ_SESSION);
-sqgetGlobalVar('base_uri',  $base_uri,      SQ_SESSION);
 sqgetGlobalVar('delayed_errors',  $delayed_errors,  SQ_SESSION);
 if (is_array($delayed_errors)) {
     $oErrorHandler->AssignDelayedErrors($delayed_errors);
index 427fb16e7ef63e0303aa0c1dfc7ffb8ac4de4f30..127a96b1041ab99b6a6c8de9fce0508e471bdd4a 100644 (file)
@@ -1162,10 +1162,7 @@ function sqimap_asearch_get_selectable_unformatted_mailboxes(&$boxes)
 
 /* ------------------------ main ------------------------ */
 /* get globals we will need */
-sqgetGlobalVar('username', $username, SQ_SESSION);
-sqgetGlobalVar('key', $key, SQ_COOKIE);
 sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
-sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
 
 if ( sqgetGlobalVar('checkall', $temp, SQ_GET) ) {
     $checkall = (int) $temp;
@@ -1572,7 +1569,7 @@ if ($search_advanced) {
 uasort($imap_asearch_options, 'asearch_unhtml_strcoll');
 
 /* open IMAP connection */
-$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
 
 
 /* get mailboxes once here */
index d22b9687b158fe44e2260b51f9283e5f0bf12128..8d61d4ea46000a93f0125904b870938ea901f873 100644 (file)
@@ -31,9 +31,6 @@ include_once(SM_PATH . 'functions/imap_general.php');
 include_once(SM_PATH . 'functions/imap_messages.php');
 
 /* globals */
-sqgetGlobalVar('username', $username, SQ_SESSION);
-sqgetGlobalVar('key', $key, SQ_COOKIE);
-sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
 
 sqgetGlobalVar('passed_id', $passed_id, SQ_GET);
 sqgetGlobalVar('mailbox', $mailbox, SQ_GET);
@@ -41,7 +38,7 @@ sqgetGlobalVar('ent_id', $ent_id, SQ_GET);
 sqgetGlobalVar('startMessage', $startMessage, SQ_GET);
 /* end globals */
 
-$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
 sqimap_mailbox_select($imapConnection, $mailbox);
 
 displayPageHeader($color, 'None');
@@ -252,4 +249,4 @@ echo '<a href="../src/download.php?absolute_dl=true&amp;passed_id=' .
 </td></tr></table>
 <?php
 $oTemplate->display('footer.tpl');
-?>
\ No newline at end of file
+?>
index d709eac09407cfca2b8fd8bf266201fdada6edf9..0feda56cf96015a42677f4aeda231f34e75371f1 100644 (file)
@@ -159,16 +159,13 @@ if ( sqgetGlobalVar('mailbox', $temp, SQ_GET) ) {
 if ( !sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET) ) {
   $passed_ent_id = '';
 }
-sqgetGlobalVar('key',        $key,          SQ_COOKIE);
-sqgetGlobalVar('username',   $username,     SQ_SESSION);
-sqgetGlobalVar('onetimepad', $onetimepad,   SQ_SESSION);
 sqgetGlobalVar('delimiter',  $delimiter,    SQ_SESSION);
 
-$imapConnection = sqimap_login($username, $key, $imapServerAddress,
+$imapConnection = sqimap_login($username, false, $imapServerAddress,
                                $imapPort, 0);
 $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox, false, false, true);
 
 $header = parse_viewheader($imapConnection,$passed_id, $passed_ent_id);
 view_header($header, $mailbox, $color);
 
-?>
\ No newline at end of file
+?>
index b33bd79c226b9e818d6465eab32c6cf90f45bbb5..5e7df7c6b15904c187e6c553dde2c9098289d7ac 100644 (file)
@@ -27,9 +27,6 @@ require_once(SM_PATH . 'functions/mime.php');
 require_once(SM_PATH . 'functions/date.php');
 
 /** Get globals */
-sqgetGlobalVar('key',        $key,          SQ_COOKIE);
-sqgetGlobalVar('username',   $username,     SQ_SESSION);
-sqgetGlobalVar('onetimepad', $onetimepad,   SQ_SESSION);
 sqgetGlobalVar('messages',   $messages,     SQ_SESSION);
 sqgetGlobalVar('mailbox',    $mailbox,      SQ_GET);
 sqgetGlobalVar('ent_id',     $ent_id,       SQ_GET);
@@ -40,7 +37,7 @@ if (sqgetGlobalVar('passed_id', $temp, SQ_GET)) {
 
 // TODO: add required var checks here.
 
-$imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+$imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
 $mbx_response = sqimap_mailbox_select($imap_stream, $mailbox);
 
 $message = &$messages[$mbx_response['UIDVALIDITY']][$passed_id];
@@ -78,4 +75,4 @@ $body = MagicHTML( $body, $passed_id, $message, $mailbox);
 /** TODO: charset might be part of html code. */
 header('Content-Type: text/html; charset=' . $charset);
 echo $body;
-?>
\ No newline at end of file
+?>
index 49626f4e0d095c36ba42816c10b8229ea7997a71..0b3aeb8a102157d519479a31867da1ebcacc6e4b 100644 (file)
@@ -1,11 +1,9 @@
 <?php
 
 /**
- * view_text.php -- Displays the main frameset
+ * view_text.php -- View a text attachment
  *
- * Who knows what this file does. However PUT IT HERE DID NOT PUT
- * A SINGLE FREAKING COMMENT IN! Whoever is responsible for this,
- * be very ashamed.
+ * Used by attachment_common code.
  *
  * @copyright &copy; 1999-2006 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
@@ -21,9 +19,6 @@ include(SM_PATH . 'functions/mime.php');
 include(SM_PATH . 'functions/date.php');
 include(SM_PATH . 'functions/url_parser.php');
 
-sqgetGlobalVar('key',        $key,          SQ_COOKIE);
-sqgetGlobalVar('username',   $username,     SQ_SESSION);
-sqgetGlobalVar('onetimepad', $onetimepad,   SQ_SESSION);
 sqgetGlobalVar('messages',   $messages,     SQ_SESSION);
 sqgetGlobalVar('mailbox',    $mailbox,      SQ_GET);
 sqgetGlobalVar('ent_id',     $ent_id,       SQ_GET);
@@ -33,7 +28,7 @@ if (sqgetGlobalVar('passed_id', $temp, SQ_GET)) {
     $passed_id = (int) $temp;
 }
 
-$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
 $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox);
 
 $message = &$messages[$mbx_response['UIDVALIDITY']][$passed_id];
@@ -96,4 +91,4 @@ echo '<a href="' . $dwnld_url . '">' . _("Download this as a file") . '</a>';
 </tt></td></tr></table>
 <?php
 $oTemplate->display('footer.tpl');
-?>
\ No newline at end of file
+?>
index 8a53880cca6736f1750217c43ab5ff5fab09d892..2da1f5a69af82c8c7c4c11f54de02f47eec5730c 100644 (file)
  */
 require('../include/init.php');
 
-sqgetGlobalVar('username', $username, SQ_SESSION);
-sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
-sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
-
 if (sqgetGlobalVar('sort', $sort)) {
     $sort = (int) $sort;
 }