From 796f91d93100118bfa85d4256c8cd5023394d0b3 Mon Sep 17 00:00:00 2001 From: jervfors Date: Wed, 11 Aug 2004 08:40:19 +0000 Subject: [PATCH] XHTML fixes git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@7882 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/addressbook.php | 4 +- functions/mime.php | 6 +- .../message_details_bottom.php | 355 +++++++++--------- .../message_details/message_details_main.php | 6 +- src/image.php | 31 +- src/left_main.php | 10 +- 6 files changed, 204 insertions(+), 208 deletions(-) diff --git a/functions/addressbook.php b/functions/addressbook.php index 9bce2351..ab6b187b 100644 --- a/functions/addressbook.php +++ b/functions/addressbook.php @@ -639,7 +639,7 @@ function show_abook_sort_button($abook_sort_order, $alt_tag, $Down, $Up ) { return ' ' . $alt_tag . ''; + . _("Click here to change the sorting of the address list") .'" />'; } /* @@ -669,4 +669,4 @@ if((isset($addrbook_dsn) && !empty($addrbook_dsn)) || */ do_hook('abook_add_class'); -?> +?> \ No newline at end of file diff --git a/functions/mime.php b/functions/mime.php index e342f75b..0c16b034 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -1081,7 +1081,7 @@ function sq_getnxtag($body, $offset){ * 2. Closing tag, e.g.: * * 3. XHTML-style content-less tag, e.g.: - * + * */ $tagtype = false; switch (substr($body, $pos, 1)){ @@ -1139,7 +1139,7 @@ function sq_getnxtag($body, $offset){ case '/': /** * This is an xhtml-style tag with a closing / at the - * end, like so: . Check if it's followed + * end, like so: . Check if it's followed * by the closing bracket. If not, then this tag is invalid */ if (substr($body, $pos, 2) == "/>"){ @@ -1241,7 +1241,7 @@ function sq_getnxtag($body, $offset){ case '/': /** * This is an xhtml-style tag with a closing / at the - * end, like so: . Check if it's followed + * end, like so: . Check if it's followed * by the closing bracket. If not, then this tag is invalid */ if (substr($body, $pos, 2) == "/>"){ diff --git a/plugins/message_details/message_details_bottom.php b/plugins/message_details/message_details_bottom.php index ea69ca1d..be24a0b2 100644 --- a/plugins/message_details/message_details_bottom.php +++ b/plugins/message_details/message_details_bottom.php @@ -39,24 +39,24 @@ function CalcEntity($entString, $direction) { } 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); } @@ -96,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"; - $header = true; - $mimepart = false; - $encoding = ''; - } - } else { - if ($header) { - if (!$contentset && preg_match("/^.*(content-type:)\s*(\w+)\/(\w+).*/i",$line,$reg)) { - if (strtolower($reg[2]) == 'message' && strtolower($reg[3]) == 'rfc822') { - $messageheader = true; - } - $content[$content_indx]['type'] = "$reg[2]/$reg[3]"; - $contentset = true; - if ($reg[2] == 'image') { - $entities["$entStr"] = array(); - $entities["$entStr"]['entity'] = $entStr; - $entities["$entStr"]['contenttype']=$reg[2].'/'.$reg[3]; - } - } else if (!$nameset && preg_match("/^.*(name=\s*)\"(.*)\".*/i",$line,$reg)) { - $name = htmlspecialchars($reg[2]); - $content[$content_indx]['name'] = decodeHeader($name); - $nameset = true; - if (isset($entities["$entStr"])) { - $entities["$entStr"]['name'] = urlEncode($reg[2]); - } - } else if (preg_match("/^.*(content-transfer-encoding:)\s*(\w+-?(\w+)?).*/i",$line,$reg) ) { - $encoding = $reg[2]; - if (isset($entities["$entStr"])) { - $entities["$entStr"]['encoding']=$reg[2]; - } - $content[$content_indx]['encoding'] = $encoding; - $mimeentity = ''; - } + if ($line{$bndlen+2} == '-' && $line{$bndlen+3} == '-') + $bndend = true; + } + if ($bndend) { + $entStr = CalcEntity("$entStr",-1); + array_pop($boundaries); + $pre .= ''; + $end .= ''; + $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".'
'; + $end .= ''."\n"; + $header = true; + $mimepart = false; + $encoding = ''; + } + } else { + if ($header) { + if (!$contentset && preg_match("/^.*(content-type:)\s*(\w+)\/(\w+).*/i",$line,$reg)) { + if (strtolower($reg[2]) == 'message' && strtolower($reg[3]) == 'rfc822') { + $messageheader = true; + } + $content[$content_indx]['type'] = "$reg[2]/$reg[3]"; + $contentset = true; + if ($reg[2] == 'image') { + $entities["$entStr"] = array(); + $entities["$entStr"]['entity'] = $entStr; + $entities["$entStr"]['contenttype']=$reg[2].'/'.$reg[3]; + } + } else if (!$nameset && preg_match("/^.*(name=\s*)\"(.*)\".*/i",$line,$reg)) { + $name = htmlspecialchars($reg[2]); + $content[$content_indx]['name'] = decodeHeader($name); + $nameset = true; + if (isset($entities["$entStr"])) { + $entities["$entStr"]['name'] = urlEncode($reg[2]); + } + } else if (preg_match("/^.*(content-transfer-encoding:)\s*(\w+-?(\w+)?).*/i",$line,$reg) ) { + $encoding = $reg[2]; + if (isset($entities["$entStr"])) { + $entities["$entStr"]['encoding']=$reg[2]; + } + $content[$content_indx]['encoding'] = $encoding; + $mimeentity = ''; + } - $pre .= ''; - //$mimepart=false; - } - } - } + $pre .= ''; + $end .= ''; + //$mimepart=false; + } + } + } /* if ($mimepart) { - if (isset($entities["$entStr"])) { - if (isset($encoding) && $encoding == 'base64') { - if (!isset( $entities["$entStr"]['content'])) $entities[$entStr]['content'] = ''; - $entities["$entStr"]['content'] .= $line; - } + if (isset($entities["$entStr"])) { + if (isset($encoding) && $encoding == 'base64') { + if (!isset( $entities["$entStr"]['content'])) $entities[$entStr]['content'] = ''; + $entities["$entStr"]['content'] .= $line; + } } - } + } */ $line = htmlspecialchars($line); - $message_body .= "$pre"."$line"."$end".'
'."\r\n"; + $message_body .= "$pre"."$line"."$end".'
'."\r\n"; } -//echo returnTime($start).'
'; +//echo returnTime($start).'
'; $xtra = << + + ECHO; @@ -273,8 +273,8 @@ displayHtmlHeader( _("Message Details"), $xtra, FALSE ); /* body */ echo "\n"; echo ''."\n"; -echo ''."\n"; -echo '
'."\n"; +echo ''."\n"; +echo '
'."\n"; //session_register("entities"); @@ -283,7 +283,7 @@ echo '
'."\n"; //foreach ($keys as $key) { // if (isset($entities[$key])) { // if ($entities[$key]['encoding'] == 'base64') { -// echo '
'; +// echo '
'; // } // } //} @@ -291,32 +291,31 @@ echo '
'."\n"; if (count($content) > 0) { echo '

Bodystructure

'."\n\n"; - echo ''. - ''. - ''. - ''. - ''. - ''. - - ''. - ''; + echo '
EntityContent-TypeNameEncoding
'. + ''. + ''. + ''. + ''. + ''. + ''. + ''; for ($i = 0; $i < count($content);$i++) { - echo ''."\n"; + echo ''."\n"; } - echo '
EntityContent-TypeNameEncoding
'; - echo $content[$i]['ent'].''; - if (isset($content[$i]['type'])) { - echo $content[$i]['type']; - } else echo 'TEXT/PLAIN'; - echo ''; - if (isset($content[$i]['name'])) { - echo $content[$i]['name']; - } else echo ' '; - echo ''; - if (isset($content[$i]['encoding'])) { - echo $content[$i]['encoding']; - } else echo ' '; - echo '
'; + echo $content[$i]['ent'].''; + if (isset($content[$i]['type'])) { + echo $content[$i]['type']; + } else echo 'TEXT/PLAIN'; + echo ''; + if (isset($content[$i]['name'])) { + echo $content[$i]['name']; + } else echo ' '; + echo ''; + if (isset($content[$i]['encoding'])) { + echo $content[$i]['encoding']; + } else echo ' '; + echo '

'."\n"; + echo '
'."\n"; } echo '

RFC822 Message body

'."\n\n"; echo '
'."\n\n"; diff --git a/plugins/message_details/message_details_main.php b/plugins/message_details/message_details_main.php index 89ed7f31..41db82a8 100644 --- a/plugins/message_details/message_details_main.php +++ b/plugins/message_details/message_details_main.php @@ -28,7 +28,7 @@ sqgetGlobalVar('mailbox', $mailbox, SQ_GET); sqgetGlobalVar('passed_id', $passed_id, SQ_GET); echo "\n"; -echo ''; -echo ''; +echo ''; +echo ''; echo ''."\n"."\n"; -?> +?> \ No newline at end of file diff --git a/src/image.php b/src/image.php index 500d689c..09fa55be 100644 --- a/src/image.php +++ b/src/image.php @@ -37,11 +37,11 @@ sqgetGlobalVar('ent_id', $ent_id, SQ_GET); sqgetGlobalVar('QUERY_STRING', $QUERY_STRING, SQ_SERVER); /* end globals */ -echo '
' . - '' . +echo '
' . + '
' . "\n" . - ' +
' . - '
' . + '
' . + '
' . _("Viewing an image attachment") . " - "; $msg_url = 'read_body.php?' . $QUERY_STRING; @@ -52,18 +52,15 @@ echo ''. _("View message") . ''; $DownloadLink = '../src/download.php?passed_id=' . $passed_id . '&mailbox=' . urlencode($mailbox) . '&ent_id=' . urlencode($ent_id) . '&absolute_dl=true'; +?> +
+ +
 
-echo '
' . "\n" . - '' . - _("Download this as a file") . - '
 ' . "\n" . - '' . "\n" . - - '' . "\n" . - '
' . - '' . - - '
' . "\n"; - '' . "\n"; + +
+ -?> +
+ diff --git a/src/left_main.php b/src/left_main.php index fcac1e3e..45384f96 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -90,7 +90,7 @@ function formatMailboxName($imapConnection, $box_array) { /* Print unseen information. */ if ($unseen_string != '') { - $line .= " $unseen_string"; + $line .= " $unseen_string"; } /* If it's the trash folder, show a purge link when needed */ @@ -181,13 +181,13 @@ function create_collapse_link($boxnum) { 'href="left_main.php?'; if ($boxes[$boxnum]['collapse'] == SM_BOX_COLLAPSED) { if ($use_icons && $icon_theme != 'none') { - $link .= "unfold=$mailbox\">"; + $link .= "unfold=$mailbox\">'; } else { $link .= "unfold=$mailbox\">+"; } } else { if ($use_icons && $icon_theme != 'none') { - $link .= "fold=$mailbox\">"; + $link .= "fold=$mailbox\">'; } else { $link .= "fold=$mailbox\">-"; } @@ -355,13 +355,13 @@ function ListBoxes ($boxes, $j=0 ) { $link = '$leader "; + $link .= "unfold=$mailboxURL\">$leader '; } else { $link .= "unfold=$mailboxURL\">$leader+ "; } } else { if ($use_icons && $icon_theme != 'none') { - $link .= "fold=$mailboxURL\">$leader "; + $link .= "fold=$mailboxURL\">$leader '; } else { $link .= "fold=$mailboxURL\">$leader- "; } -- 2.25.1