X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=plugins%2Fmessage_details%2Fmessage_details_bottom.php;h=be24a0b21e162a9207b3e480781936a96a4a2320;hb=b8923d209c409f5830808aa697a1c8923c1e6f01;hp=2c2eab8b7e6fe0e0b471b2371949a92f85c0de8b;hpb=dcbe45970e887b505092085899a0a83dcb570e3d;p=squirrelmail.git
diff --git a/plugins/message_details/message_details_bottom.php b/plugins/message_details/message_details_bottom.php
index 2c2eab8b..be24a0b2 100644
--- a/plugins/message_details/message_details_bottom.php
+++ b/plugins/message_details/message_details_bottom.php
@@ -8,9 +8,11 @@
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* $Id$
+ * @package plugins
+ * @subpackage message_details
*/
-#chdir ('..');
+/** @ignore */
define('SM_PATH','../../');
/* SquirrelMail required files. */
@@ -20,34 +22,41 @@ require_once(SM_PATH . 'functions/mime.php');
require_once(SM_PATH . 'config/config.php');
require_once(SM_PATH . 'functions/prefs.php');
-global $color, $uid_support;
+global $color;
+
+sqgetGlobalVar('passed_id', $passed_id, SQ_GET);
+sqgetGlobalVar('mailbox', $mailbox, SQ_GET);
+
+sqgetGlobalVar('username', $username, SQ_SESSION);
+sqgetGlobalVar('key', $key, SQ_COOKIE);
+sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
function CalcEntity($entString, $direction) {
$result = $entString;
if ($direction == -1) {
- $pos = strrpos($entString,'.');
- $result = substr($entString,0,$pos);
+ $pos = strrpos($entString,'.');
+ $result = substr($entString,0,$pos);
}
switch ($direction) {
- case 0:
- $pos = strrpos($entString,'.');
- if ($pos === false) {
- $entString++;
- $result= $entString;
- }
- else {
- $level = substr($entString,0,$pos);
- $sublevel = substr($entString,$pos+1);
- $sublevel++;
- $result = "$level".'.'."$sublevel";
- }
- break;
- case 1:
- $result = "$entString".".0";
- break;
- default:
- break;
+ case 0:
+ $pos = strrpos($entString,'.');
+ if ($pos === false) {
+ $entString++;
+ $result= $entString;
+ }
+ else {
+ $level = substr($entString,0,$pos);
+ $sublevel = substr($entString,$pos+1);
+ $sublevel++;
+ $result = "$level".'.'."$sublevel";
+ }
+ break;
+ case 1:
+ $result = "$entString".".0";
+ break;
+ default:
+ break;
}
return ($result);
}
@@ -64,7 +73,7 @@ function GetMimeProperties($header) {
$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
$read = sqimap_mailbox_select($imapConnection, $mailbox);
$start = gettimeofday();
-$body = sqimap_run_command($imapConnection, "FETCH $passed_id RFC822",true, $response, $readmessage, $uid_support);
+$body = sqimap_run_command($imapConnection, "FETCH $passed_id RFC822",true, $response, $readmessage, TRUE);
$message_body = '';
$header = false;
$mimepart = false;
@@ -87,159 +96,159 @@ $body[$count-1] = substr($body[$count-1], -1);
for ($i=1; $i < $count; $i++) {
$line = trim($body[$i]);
if ($line == '') {
- $pre = '';
- $end = '';
+ $pre = '';
+ $end = '';
if ($bnd_end) {
- $header = true;
- $mimepart = false;
- } else if ($messageheader) {
- if ($header) {
- $header=false;
- $end = "\n \n".''."\n \n".'
'."\n \n";
- }
- $mimepart = -$header;
- $bnd_end = false;
- if ($messageheaderstart) {
- $messageheaderstart=false;
- }
- } else if ($messageheaderstart) {
- $messageheader= false;
- } else {
- if ($header) {
- $pre = '';
- $end = "\n \n".'
'."\n \n".''."\n \n";
- }
- $header = false;
- $mimepart=true;
- }
- $contentset = false;
- $nameset = false;
+ $header = true;
+ $mimepart = false;
+ } else if ($messageheader) {
+ if ($header) {
+ $header=false;
+ $end = "\n \n".'
'."\n \n".''."\n \n";
+ }
+ $mimepart = -$header;
+ $bnd_end = false;
+ if ($messageheaderstart) {
+ $messageheaderstart=false;
+ }
+ } else if ($messageheaderstart) {
+ $messageheader= false;
+ } else {
+ if ($header) {
+ $pre = '';
+ $end = "\n \n".'
'."\n \n".''."\n \n";
+ }
+ $header = false;
+ $mimepart=true;
+ }
+ $contentset = false;
+ $nameset = false;
} else {
if (!$header && $messageheader) {
- $messageheaderstart=true;
- if ($pre != '
') {
- $pre = '';
- }
- }
- if (!$messageheader && !$header ) {
- $mimepart=true;
- } else {
- $mimepart=false;
- }
- $pre = '';
- $end = '';
+ $messageheaderstart=true;
+ if ($pre != '') {
+ $pre = '';
+ $end = '';
+ }
+ }
+ if (!$messageheader && !$header ) {
+ $mimepart=true;
+ } else {
+ $mimepart=false;
+ }
+ $pre = '';
+ $end = '';
}
if ( ( $header || $messageheader) && (preg_match("/^.*boundary=\"?(.+(?=\")|.+).*/i",$line,$reg)) ) {
- $bnd = $reg[1];
- $bndreg = $bnd;
- $bndreg = str_replace("\\","\\\\",$bndreg);
- $bndreg = str_replace("?","\\?",$bndreg);
- $bndreg = str_replace("+","\\+",$bndreg);
- $bndreg = str_replace(".","\\.",$bndreg);
- $bndreg = str_replace("/","\\/",$bndreg);
- $bndreg = str_replace("-","\\-",$bndreg);
- $bndreg = str_replace("(","\\(",$bndreg);
- $bndreg = str_replace(")","\\)",$bndreg);
+ $bnd = $reg[1];
+ $bndreg = $bnd;
+ $bndreg = str_replace("\\","\\\\",$bndreg);
+ $bndreg = str_replace("?","\\?",$bndreg);
+ $bndreg = str_replace("+","\\+",$bndreg);
+ $bndreg = str_replace(".","\\.",$bndreg);
+ $bndreg = str_replace("/","\\/",$bndreg);
+ $bndreg = str_replace("-","\\-",$bndreg);
+ $bndreg = str_replace("(","\\(",$bndreg);
+ $bndreg = str_replace(")","\\)",$bndreg);
- $boundaries[] = array( 'bnd' => $bnd, 'bndreg' => $bndreg);
- $messageheader = false;
- $messageheaderstart=false;
- $mimepart=false;
- if ($entStr=='') {
- $entStr='0';
- } else {
- $entStr = CalcEntity("$entStr",1);
- }
+ $boundaries[] = array( 'bnd' => $bnd, 'bndreg' => $bndreg);
+ $messageheader = false;
+ $messageheaderstart=false;
+ $mimepart=false;
+ if ($entStr=='') {
+ $entStr='0';
+ } else {
+ $entStr = CalcEntity("$entStr",1);
+ }
}
if (($line != '' && $line{0} == '-' || $header) && isset($boundaries[0])) {
$cnt=count($boundaries)-1;
- $bnd = $boundaries[$cnt]['bnd'];
- $bndreg = $boundaries[$cnt]['bndreg'];
+ $bnd = $boundaries[$cnt]['bnd'];
+ $bndreg = $boundaries[$cnt]['bndreg'];
- $regstr = '/^--'."($bndreg)".".*".'/';
- if (preg_match($regstr,$line,$reg) ) {
- $bndlen = strlen($reg[1]);
- $bndend = false;
+ $regstr = '/^--'."($bndreg)".".*".'/';
+ if (preg_match($regstr,$line,$reg) ) {
+ $bndlen = strlen($reg[1]);
+ $bndend = false;
if (strlen($line) > ($bndlen + 3)) {
- if ($line{$bndlen+2} == '-' && $line{$bndlen+3} == '-')
- $bndend = true;
- }
- if ($bndend) {
- $entStr = CalcEntity("$entStr",-1);
- array_pop($boundaries);
- $pre .= '';
- $header = true;
- $mimepart = false;
- $bnd_end = true;
- $encoding = '';
- } else {
- $header = true;
- $bnd_end = false;
- $entStr = CalcEntity("$entStr",0);
- $content_indx++;
- $content[$content_indx]=array();
- $content[$content_indx]['ent'] = '$entStr".'';
- $pre .= "\n \n".' '."\n \n".''."\n \n".'