Add compatibility with Dovecot's bigint UIDs
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 1 Feb 2009 02:24:32 +0000 (02:24 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 1 Feb 2009 02:24:32 +0000 (02:24 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13399 7612ce4b-ef26-0410-bec9-ea0150e637f0

16 files changed:
ChangeLog
functions/imap_messages.php
functions/mailbox_display.php
plugins/message_details/message_details_bottom.php
plugins/message_details/message_details_main.php
plugins/message_details/message_details_top.php
plugins/spamcop/functions.php
plugins/spamcop/spamcop.php
src/compose.php
src/download.php
src/image.php
src/read_body.php
src/vcard.php
src/view_header.php
src/view_html.php
src/view_text.php

index 480a4d037b94f91efa90f9844efebe14857b7f8b..c861340e1df88f504f97e4b56c186bc8e2ad83df 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -269,6 +269,7 @@ Version 1.5.2 - SVN
   - Add password type option widget
   - Make all submit button names unique on compose screen
   - Make address book file permissions 0600 - same as preference files
+  - Added compatibility with Dovecot's bigint UIDs
 
 Version 1.5.1 (branched on 2006-02-12)
 --------------------------------------
index af49b5767d00b80fb1ab834f1089f94836485e03..8a89940a0c9dfeb1381d57461611b21079ee162a 100755 (executable)
@@ -895,7 +895,10 @@ function sqimap_parse_address($read, &$i) {
  */
 function sqimap_get_message($imap_stream, $id, $mailbox, $hide=0) {
     // typecast to int to prohibit 1:* msgs sets
-    $id = (int) $id;
+    // Update: $id should always be sanitized into a BIGINT so this
+    // is being removed; leaving this code here in case something goes
+    // wrong, however
+    //$id = (int) $id;
     $flags = array();
     $read = sqimap_run_command($imap_stream, "FETCH $id (FLAGS BODYSTRUCTURE)", true, $response, $message, TRUE);
     if ($read) {
index 1468e80f460be6c0ba15ca3a4722c1462ab98977..9fb3725cf0ffbbed200071e9f0c018736a8a7b6f 100644 (file)
@@ -1334,6 +1334,11 @@ function handleMessageListForm($imapConnection, &$aMailbox, $sButton='',
     /* retrieve the check boxes */
     $aUid = (isset($msg) && is_array($msg)) ? array_values($msg) : $aUid;
     if (count($aUid) && $sButton != 'expunge') {
+
+        // make sure message UIDs are sanitized (BIGINT)
+        foreach ($aUid as $i => $uid)
+           $aUid[$i] = (preg_match('/^[0-9]+$/', $uid) ? $uid : '0');
+
         $aUpdatedMsgs = false;
         $bExpunge = false;
         switch ($sButton) {
index b9cd0f6a260eaa8ba09eeba6e47f45a9c00a9e0d..c4dcc8df1dbb226a472a6eeccd054db324d6320c 100644 (file)
@@ -33,7 +33,7 @@ global $msgd_8bit_in_hex;
 $msgd_8bit_in_hex=false;
 
 if (!empty($md_action)) {
-    sqgetGlobalVar('passed_id', $passed_id, SQ_GET);
+    sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT);
     if (!sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET))
         $passed_ent_id = 0;
     sqgetGlobalVar('mailbox', $mailbox, SQ_GET);
index 72f309e04ee15d945f15458c2f7b290a01df2b3f..5abe46cc0c771e643ced4bb6a9afeaaaf28bfcd9 100644 (file)
@@ -22,7 +22,7 @@ require('../../include/init.php');
 displayHtmlHeader( _("Message Details"), '', FALSE );
 
 sqgetGlobalVar('mailbox', $mailbox, SQ_GET);
-sqgetGlobalVar('passed_id', $passed_id, SQ_GET);
+sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT);
 if (!sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET))
     $passed_ent_id = 0;
 
index 3263d258c90376a64b577df950cb41b39cf7bd24..9b8efd543091121a519fe33a396050e4f0a4489d 100644 (file)
@@ -30,7 +30,7 @@ displayHtmlHeader( _("Message Details"),
              "-->\n".
              "</script>\n", FALSE );
 
-sqgetGlobalVar('passed_id', $passed_id, SQ_GET);
+sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT);
 if (!sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET))
     $passed_ent_id = 0;
 sqgetGlobalVar('mailbox', $mailbox, SQ_GET);
index 590785c247e1cf4a14f5e0d55798aba0f94e2aff..1a5ed9d5523241203313cc50091d275620cb6746 100644 (file)
@@ -66,7 +66,7 @@ function spamcop_show_link_function(&$links) {
         return;
 
     /* GLOBALS */
-    sqgetGlobalVar('passed_id',    $passed_id,    SQ_FORM);
+    sqgetGlobalVar('passed_id',    $passed_id,    SQ_FORM, NULL, SQ_TYPE_BIGINT);
     sqgetGlobalVar('passed_ent_id',$passed_ent_id,SQ_FORM);
     sqgetGlobalVar('mailbox',      $mailbox,      SQ_FORM);
     if ( sqgetGlobalVar('startMessage', $startMessage, SQ_FORM) ) {
index 75adadf0887c40ef574bc3cfcc8b226f9f0bc878..9e9ee06416e8deefb34337ecc5e355ea4e0e7952 100644 (file)
@@ -28,7 +28,7 @@ include_once(SM_PATH . 'functions/compose.php');
 /* GLOBALS */
 
 sqgetGlobalVar('mailbox', $mailbox, SQ_GET);
-sqgetGlobalVar('passed_id', $passed_id, SQ_GET);
+sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT);
 sqgetGlobalVar('js_web', $js_web, SQ_GET);
 
 if (! sqgetGlobalVar('startMessage', $startMessage, SQ_GET) ) {
index ed6c0e6a1f8d11281027a1eeddd165b9553fb54e..189b65a84499979ac562e8a3eeeb6fda0011abc9 100644 (file)
@@ -85,7 +85,7 @@ sqgetGlobalVar('request_mdn',$request_mdn, $SQ_GLOBAL);
 sqgetGlobalVar('request_dr',$request_dr, $SQ_GLOBAL);
 sqgetGlobalVar('html_addr_search',$html_addr_search, $SQ_GLOBAL);
 sqgetGlobalVar('mail_sent',$mail_sent, $SQ_GLOBAL);
-sqgetGlobalVar('passed_id',$passed_id, $SQ_GLOBAL);
+sqgetGlobalVar('passed_id',$passed_id, $SQ_GLOBAL, NULL, SQ_TYPE_BIGINT);
 sqgetGlobalVar('passed_ent_id',$passed_ent_id, $SQ_GLOBAL);
 
 sqgetGlobalVar('attach',$attach, SQ_POST);
index 896e86be9d1241f566549a9ee9630e676e0eb7b0..65a56dd88c24372df4a6a82ea9aeaaf190686778 100644 (file)
@@ -48,9 +48,7 @@ sqgetGlobalVar('mailbox',    $mailbox,      SQ_GET);
 sqgetGlobalVar('ent_id',     $ent_id,       SQ_GET);
 sqgetGlobalVar('absolute_dl',$absolute_dl,  SQ_GET);
 sqgetGlobalVar('force_crlf', $force_crlf,   SQ_GET);
-if ( sqgetGlobalVar('passed_id', $temp, SQ_GET) ) {
-    $passed_id = (int) $temp;
-}
+sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT);
 if (!sqgetGlobalVar('account', $account, SQ_GET) ) {
     $account = 0;
 }
index a2ef223b5d73bbece7dbc8d3f1e7cf747ffec459..9dc8d897082777d10e801d735ff46c4ad2783add 100644 (file)
@@ -22,9 +22,7 @@ require('../include/init.php');
 displayPageHeader($color);
 
 /* globals */
-if ( sqgetGlobalVar('passed_id', $temp, SQ_GET) ) {
-  $passed_id = (int) $temp;
-}
+sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT);
 sqgetGlobalVar('mailbox',       $mailbox,       SQ_GET);
 sqgetGlobalVar('ent_id',        $ent_id,        SQ_GET);
 sqgetGlobalVar('QUERY_STRING',  $QUERY_STRING,  SQ_SERVER);
index b04b47383a4417afe74473915c5e32522f94ca6d..fb93be43c14b1a13b145d555650cffb393e57109 100644 (file)
@@ -781,12 +781,10 @@ if ( sqgetGlobalVar('account', $temp,  SQ_GET) ) {
 }
 
 /** GET/POST VARS */
+sqgetGlobalVar('passed_id',     $passed_id, SQ_INORDER, NULL, SQ_TYPE_BIGINT);
 sqgetGlobalVar('passed_ent_id', $passed_ent_id);
 sqgetGlobalVar('mailbox',       $mailbox);
 
-if ( sqgetGlobalVar('passed_id', $temp) ) {
-    $passed_id = (int) $temp;
-}
 if ( sqgetGlobalVar('sort', $temp) ) {
     $sort = (int) $temp;
 }
index a1f8005e366aa9133cb55f42177967894305eb29..2a9de1201231f156aac26b621489dd7958009faa 100644 (file)
@@ -35,7 +35,7 @@ include_once(SM_PATH . 'functions/imap_messages.php');
 
 /* globals */
 
-sqgetGlobalVar('passed_id', $passed_id, SQ_GET);
+sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT);
 sqgetGlobalVar('mailbox', $mailbox, SQ_GET);
 sqgetGlobalVar('ent_id', $ent_id, SQ_GET);
 sqgetGlobalVar('startMessage', $startMessage, SQ_GET);
index 0e0b2e218901a711b90ab472364ab7017f44bbf9..aeebe577a342da08f6d20517fedd9f77b770ca75 100644 (file)
@@ -83,9 +83,7 @@ function parse_viewheader($imapConnection,$id, $passed_ent_id) {
 }
 
 /* get global vars */
-if ( sqgetGlobalVar('passed_id', $temp, SQ_GET) ) {
-  $passed_id = (int) $temp;
-}
+sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT);
 if ( sqgetGlobalVar('mailbox', $temp, SQ_GET) ) {
   $mailbox = $temp;
 }
index c0d2932a02446e988f19b83c21a7b086e27b4cd7..5a657d8163647f3c01e466b74aa4a4651f5c9fbd 100644 (file)
@@ -34,9 +34,7 @@ sqgetGlobalVar('messages',   $messages,     SQ_SESSION);
 sqgetGlobalVar('mailbox',    $mailbox,      SQ_GET);
 sqgetGlobalVar('ent_id',     $ent_id,       SQ_GET);
 sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET);
-if (sqgetGlobalVar('passed_id', $temp, SQ_GET)) {
-    $passed_id = (int) $temp;
-}
+sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT);
 
 // TODO: add required var checks here.
 
index dbdc16b89bf42173e1f73af12265f2f069845142..89b252300acac70917390f63e52245ce24c498ca 100644 (file)
@@ -27,9 +27,7 @@ sqgetGlobalVar('mailbox',    $mailbox,      SQ_GET);
 sqgetGlobalVar('ent_id',     $ent_id,       SQ_GET);
 sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET);
 sqgetGlobalVar('QUERY_STRING', $QUERY_STRING, SQ_SERVER);
-if (sqgetGlobalVar('passed_id', $temp, SQ_GET)) {
-    $passed_id = (int) $temp;
-}
+sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT);
 
 $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
 $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox);