From 65c3ec94c897fb098598f3843e371020deb2226b Mon Sep 17 00:00:00 2001 From: philippe_mingo Date: Wed, 23 Jan 2002 18:12:37 +0000 Subject: [PATCH] Code Cleaning git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2221 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_mailbox.php | 14 +- functions/tree.php | 208 +++++++++--------- src/delete_message.php | 46 ++-- src/download.php | 432 ++++++++++++++++++------------------- src/empty_trash.php | 84 ++++---- src/move_messages.php | 228 +++++++++----------- src/vcard.php | 286 ++++++++++++------------ src/webmail.php | 24 +-- 8 files changed, 615 insertions(+), 707 deletions(-) diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index 746a438b..375b97bf 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -43,8 +43,7 @@ function isBoxBelow( $box2, $box1 ) { function isSpecialMailbox( $box ) { global $trash_folder, $sent_folder, $draft_folder, - $move_to_trash, $move_to_sent, $save_as_draft, - $delimiter, $folder_prefix, $imap_server_type; + $move_to_trash, $move_to_sent, $save_as_draft; $ret = ( (strtolower($box) == 'inbox') || ( $move_to_trash && isBoxBelow( $box, $trash_folder ) ) || @@ -357,13 +356,13 @@ function user_strcasecmp($a, $b) { ** See comment on sqimap_mailbox_parse() for info about the returned array. ******************************************************************************/ function sqimap_mailbox_list ($imap_stream) { + global $data_dir, $username, $list_special_folders_first, $folder_prefix, $trash_folder, $sent_folder, $draft_folder, $move_to_trash, $move_to_sent, $save_as_draft, $delimiter; - $inbox_in_list = false; - $inbox_subscribed = false; + $inbox_in_list = $inbox_subscribed = FALSE; require_once('../src/load_prefs.php'); require_once('../functions/array.php'); @@ -495,6 +494,7 @@ function sqimap_mailbox_list ($imap_stream) { } return( $boxesnew ); + } /* @@ -505,9 +505,7 @@ function sqimap_mailbox_list_all ($imap_stream) global $list_special_folders_first, $folder_prefix; global $delimiter; - if (!function_exists('ary_sort')) { - include_once('../functions/array.php'); - } + require_once('../functions/array.php'); $ssid = sqimap_session_id(); $lsid = strlen( $ssid ); @@ -529,7 +527,7 @@ function sqimap_mailbox_list_all ($imap_stream) if (substr($read_ary[$i], 0, $lsid) != $ssid ) { /* Store the raw IMAP reply */ - $boxes[$g]["raw"] = $read_ary[$i]; + $boxes[$g]['raw'] = $read_ary[$i]; /* Count number of delimiters ($delimiter) in folder name */ $mailbox = find_mailbox_name($read_ary[$i]); diff --git a/functions/tree.php b/functions/tree.php index 5d965794..e9de9f00 100644 --- a/functions/tree.php +++ b/functions/tree.php @@ -12,22 +12,6 @@ * $Id$ */ -/*****************************************************************/ -/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ -/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ -/*** + Base level indent should begin at left margin, as ***/ -/*** the require_once below. ***/ -/*** + All identation should consist of four space blocks ***/ -/*** + Tab characters are evil. ***/ -/*** + all comments should use "slash-star ... star-slash" ***/ -/*** style -- no pound characters, no slash-slash style ***/ -/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ -/*** ALWAYS USE { AND } CHARACTERS!!! ***/ -/*** + Please use ' instead of ", when possible. Note " ***/ -/*** should always be used in _( ) function calls. ***/ -/*** Thank you for your help making the SM code more readable. ***/ -/*****************************************************************/ - require_once('../functions/imap.php'); /** @@ -36,121 +20,121 @@ require_once('../functions/imap.php'); * Recursive function to find the correct parent for a new node */ - function findParentForChild($value, $treeIndexToStart, $tree) { - // is $value in $tree[$treeIndexToStart]['value'] - if ((isset($tree[$treeIndexToStart])) && (strstr($value, $tree[$treeIndexToStart]['value']))) { - // do I have children, if not then must be a childnode of the current node - if ($tree[$treeIndexToStart]['doIHaveChildren']) { +function findParentForChild($value, $treeIndexToStart, $tree) { + // is $value in $tree[$treeIndexToStart]['value'] + if ((isset($tree[$treeIndexToStart])) && (strstr($value, $tree[$treeIndexToStart]['value']))) { + // do I have children, if not then must be a childnode of the current node + if ($tree[$treeIndexToStart]['doIHaveChildren']) { // loop through each subNode checking to see if we are a subNode of one of them for ($i=0;$i< count($tree[$treeIndexToStart]['subNodes']);$i++) { - $result = findParentForChild($value, $tree[$treeIndexToStart]['subNodes'][$i], $tree); - if ($result > -1) - return $result; + $result = findParentForChild($value, $tree[$treeIndexToStart]['subNodes'][$i], $tree); + if ($result > -1) + return $result; } // if we aren't a child of one of the subNodes, must be a child of current node return $treeIndexToStart; - } else + } else return $treeIndexToStart; - } else { - // we aren't a child of this node at all - return -1; - } - } - - function addChildNodeToTree($comparisonValue, $value, &$tree) { - $parentNode = findParentForChild($comparisonValue, 0, $tree); - - // create a new subNode - $newNodeIndex = count($tree); - $tree[$newNodeIndex]['value'] = $value; - $tree[$newNodeIndex]['doIHaveChildren'] = false; - - if ($tree[$parentNode]['doIHaveChildren'] == false) { - // make sure the parent knows it has children - $tree[$parentNode]['subNodes'][0] = $newNodeIndex; - $tree[$parentNode]['doIHaveChildren'] = true; - } else { - $nextSubNode = count($tree[$parentNode]['subNodes']); - // make sure the parent knows it has children - $tree[$parentNode]['subNodes'][$nextSubNode] = $newNodeIndex; - } - } - - function walkTreeInPreOrderEmptyTrash($index, $imap_stream, $tree) { - global $trash_folder; - if ($tree[$index]['doIHaveChildren']) { - for ($j = 0; $j < count($tree[$index]['subNodes']); $j++) { + } else { + // we aren't a child of this node at all + return -1; + } +} + +function addChildNodeToTree($comparisonValue, $value, &$tree) { + $parentNode = findParentForChild($comparisonValue, 0, $tree); + + // create a new subNode + $newNodeIndex = count($tree); + $tree[$newNodeIndex]['value'] = $value; + $tree[$newNodeIndex]['doIHaveChildren'] = false; + + if ($tree[$parentNode]['doIHaveChildren'] == false) { + // make sure the parent knows it has children + $tree[$parentNode]['subNodes'][0] = $newNodeIndex; + $tree[$parentNode]['doIHaveChildren'] = true; + } else { + $nextSubNode = count($tree[$parentNode]['subNodes']); + // make sure the parent knows it has children + $tree[$parentNode]['subNodes'][$nextSubNode] = $newNodeIndex; + } +} + +function walkTreeInPreOrderEmptyTrash($index, $imap_stream, $tree) { + global $trash_folder; + if ($tree[$index]['doIHaveChildren']) { + for ($j = 0; $j < count($tree[$index]['subNodes']); $j++) { walkTreeInPreOrderEmptyTrash($tree[$index]['subNodes'][$j], $imap_stream, $tree); - } - if ($tree[$index]['value'] != $trash_folder) { + } + if ($tree[$index]['value'] != $trash_folder) { sqimap_mailbox_delete($imap_stream, $tree[$index]['value']); - } else { + } else { $numMessages = sqimap_get_num_messages($imap_stream, $trash_folder); if ($numMessages > 0) { - sqimap_mailbox_select($imap_stream, $trash_folder); - sqimap_messages_flag ($imap_stream, 1, $numMessages, 'Deleted'); - sqimap_mailbox_expunge($imap_stream, $trash_folder, true); + sqimap_mailbox_select($imap_stream, $trash_folder); + sqimap_messages_flag ($imap_stream, 1, $numMessages, 'Deleted'); + sqimap_mailbox_expunge($imap_stream, $trash_folder, true); } - } - } else { - if ($tree[$index]['value'] != $trash_folder) { + } + } else { + if ($tree[$index]['value'] != $trash_folder) { sqimap_mailbox_delete($imap_stream, $tree[$index]['value']); - } else { + } else { $numMessages = sqimap_get_num_messages($imap_stream, $trash_folder); if ($numMessages > 0) { - sqimap_mailbox_select($imap_stream, $trash_folder); - sqimap_messages_flag ($imap_stream, 1, $numMessages, 'Deleted'); - sqimap_mailbox_expunge($imap_stream, $trash_folder, true); + sqimap_mailbox_select($imap_stream, $trash_folder); + sqimap_messages_flag ($imap_stream, 1, $numMessages, 'Deleted'); + sqimap_mailbox_expunge($imap_stream, $trash_folder, true); } - } - } - } - - function walkTreeInPreOrderDeleteFolders($index, $imap_stream, $tree) { - if ($tree[$index]['doIHaveChildren']) { - for ($j = 0; $j < count($tree[$index]['subNodes']); $j++) { + } + } +} + +function walkTreeInPreOrderDeleteFolders($index, $imap_stream, $tree) { + if ($tree[$index]['doIHaveChildren']) { + for ($j = 0; $j < count($tree[$index]['subNodes']); $j++) { walkTreeInPreOrderDeleteFolders($tree[$index]['subNodes'][$j], $imap_stream, $tree); - } - sqimap_mailbox_delete($imap_stream, $tree[$index]['value']); - } else { - sqimap_mailbox_delete($imap_stream, $tree[$index]['value']); - } - } - - function walkTreeInPostOrderCreatingFoldersUnderTrash($index, $imap_stream, $tree, $topFolderName) { - global $trash_folder, $delimiter; - - $position = strrpos($topFolderName, $delimiter) + 1; - $subFolderName = substr($tree[$index]['value'], $position); - - if ($tree[$index]['doIHaveChildren']) { - sqimap_mailbox_create($imap_stream, $trash_folder . $delimiter . $subFolderName, ""); - sqimap_mailbox_select($imap_stream, $tree[$index]['value']); - - $messageCount = sqimap_get_num_messages($imap_stream, $tree[$index]['value']); - if ($messageCount > 0) + } + sqimap_mailbox_delete($imap_stream, $tree[$index]['value']); + } else { + sqimap_mailbox_delete($imap_stream, $tree[$index]['value']); + } +} + +function walkTreeInPostOrderCreatingFoldersUnderTrash($index, $imap_stream, $tree, $topFolderName) { + global $trash_folder, $delimiter; + + $position = strrpos($topFolderName, $delimiter) + 1; + $subFolderName = substr($tree[$index]['value'], $position); + + if ($tree[$index]['doIHaveChildren']) { + sqimap_mailbox_create($imap_stream, $trash_folder . $delimiter . $subFolderName, ""); + sqimap_mailbox_select($imap_stream, $tree[$index]['value']); + + $messageCount = sqimap_get_num_messages($imap_stream, $tree[$index]['value']); + if ($messageCount > 0) sqimap_messages_copy($imap_stream, 1, $messageCount, $trash_folder . $delimiter . $subFolderName); - - for ($j = 0;$j < count($tree[$index]['subNodes']); $j++) + + for ($j = 0;$j < count($tree[$index]['subNodes']); $j++) walkTreeInPostOrderCreatingFoldersUnderTrash($tree[$index]['subNodes'][$j], $imap_stream, $tree, $topFolderName); - } else { - sqimap_mailbox_create($imap_stream, $trash_folder . $delimiter . $subFolderName, ''); - sqimap_mailbox_select($imap_stream, $tree[$index]['value']); - - $messageCount = sqimap_get_num_messages($imap_stream, $tree[$index]['value']); - if ($messageCount > 0) + } else { + sqimap_mailbox_create($imap_stream, $trash_folder . $delimiter . $subFolderName, ''); + sqimap_mailbox_select($imap_stream, $tree[$index]['value']); + + $messageCount = sqimap_get_num_messages($imap_stream, $tree[$index]['value']); + if ($messageCount > 0) sqimap_messages_copy($imap_stream, 1, $messageCount, $trash_folder . $delimiter . $subFolderName); - } - } + } +} - function simpleWalkTreePre($index, $tree) { - if ($tree[$index]['doIHaveChildren']) { - for ($j = 0; $j < count($tree[$index]['subNodes']); $j++) { +function simpleWalkTreePre($index, $tree) { + if ($tree[$index]['doIHaveChildren']) { + for ($j = 0; $j < count($tree[$index]['subNodes']); $j++) { simpleWalkTreePre($tree[$index]['subNodes'][$j], $tree); - } - echo $tree[$index]['value'] . '
'; - } else { - echo $tree[$index]['value'] . '
'; - } - } + } + echo $tree[$index]['value'] . '
'; + } else { + echo $tree[$index]['value'] . '
'; + } +} ?> diff --git a/src/delete_message.php b/src/delete_message.php index ba73607e..18629228 100644 --- a/src/delete_message.php +++ b/src/delete_message.php @@ -6,44 +6,32 @@ * Copyright (c) 1999-2002 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * - * Deletes a meesage from the IMAP server + * Deletes a meesage from the IMAP server * * $Id$ */ -/*****************************************************************/ -/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ -/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ -/*** + Base level indent should begin at left margin, as ***/ -/*** the require_once below looks. ***/ -/*** + All identation should consist of four space blocks ***/ -/*** + Tab characters are evil. ***/ -/*** + all comments should use "slash-star ... star-slash" ***/ -/*** style -- no pound characters, no slash-slash style ***/ -/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ -/*** ALWAYS USE { AND } CHARACTERS!!! ***/ -/*** + Please use ' instead of ", when possible. Note " ***/ -/*** should always be used in _( ) function calls. ***/ -/*** Thank you for your help making the SM code more readable. ***/ -/*****************************************************************/ - require_once('../src/validate.php'); require_once('../functions/display_messages.php'); require_once('../functions/imap.php'); - $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); +$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); + +sqimap_mailbox_select($imapConnection, $mailbox); - sqimap_mailbox_select($imapConnection, $mailbox); - - sqimap_messages_delete($imapConnection, $message, $message, $mailbox); - if ($auto_expunge) - sqimap_mailbox_expunge($imapConnection, $mailbox, true); +sqimap_messages_delete($imapConnection, $message, $message, $mailbox); +if ($auto_expunge) { + sqimap_mailbox_expunge($imapConnection, $mailbox, true); +} - $location = get_location(); - if (isset($where) && isset($what)) - header ("Location: $location/search.php?where=".urlencode($where)."&what=".urlencode($what)."&mailbox=".urlencode($mailbox)); - else - header ("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=".urlencode($mailbox)); +$location = get_location(); +if (isset($where) && isset($what)) { + header("Location: $location/search.php?where=" . urlencode($where) . + '&what=' . urlencode($what) . '&mailbox=' . urlencode($mailbox)); +} else { + header("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=" . + urlencode($mailbox)); +} - sqimap_logout($imapConnection); +sqimap_logout($imapConnection); ?> diff --git a/src/download.php b/src/download.php index abbadcbd..d78999d1 100644 --- a/src/download.php +++ b/src/download.php @@ -12,238 +12,222 @@ * $Id$ */ -/*****************************************************************/ -/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ -/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ -/*** + Base level indent should begin at left margin, as ***/ -/*** the require_once below looks. ***/ -/*** + All identation should consist of four space blocks ***/ -/*** + Tab characters are evil. ***/ -/*** + all comments should use "slash-star ... star-slash" ***/ -/*** style -- no pound characters, no slash-slash style ***/ -/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ -/*** ALWAYS USE { AND } CHARACTERS!!! ***/ -/*** + Please use ' instead of ", when possible. Note " ***/ -/*** should always be used in _( ) function calls. ***/ -/*** Thank you for your help making the SM code more readable. ***/ -/*****************************************************************/ - -define('download_php', true); // Used for preferences - require_once('../src/validate.php'); require_once('../functions/imap.php'); require_once('../functions/mime.php'); require_once('../functions/date.php'); - header("Pragma: "); - header("Cache-Control: cache"); - - function viewText($color, $body, $id, $entid, $mailbox, $type1, $wrap_at) { - global $where, $what, $charset; - global $startMessage; - - displayPageHeader($color, 'None'); - - echo "
"; - echo "
"; - echo _("Viewing a text attachment") . " - "; - if ($where && $what) { - // from a search - echo "". _("View message") . ""; - } else { - echo "". _("View message") . ""; - } - - $urlmailbox = urlencode($mailbox); - echo "
"; - echo _("Download this as a file"); - echo "

"; - echo ""; - echo "
"; - - echo "
"; - echo "
"; - - if ($type1 == 'html') { - $body = MagicHTML( $body, $id ); - } else { - translateText($body, $wrap_at, $charset); - } - - flush(); - echo $body; - - echo "
"; - } - - $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); - sqimap_mailbox_select($imapConnection, $mailbox); - - // $message contains all information about the message - // including header and body - $message = sqimap_get_message($imapConnection, $passed_id, $mailbox); - $top_header = $message->header; - - // lets redefine message as this particular entity that we wish to display. - // it should hold only the header for this entity. We need to fetch the body - // yet before we can display anything. - $message = getEntity($message, $passed_ent_id); - - $header = $message->header; - - $charset = $header->charset; - $type0 = $header->type0; - $type1 = $header->type1; - if (isset($override_type0)) - $type0 = $override_type0; - if (isset($override_type1)) - $type1 = $override_type1; - $filename = decodeHeader($header->filename); - if (!$filename) { - $filename = decodeHeader($header->name); - } - - if (strlen($filename) < 1) { - if ($type1 == 'plain' && $type0 == 'text') { - $suffix = 'txt'; - } else if ($type1 == 'richtext' && $type0 == 'text') { - $suffix = 'rtf'; - } else if ($type1 == 'postscript' && $type0 == 'application') { - $suffix = 'ps'; - } else if ($type1 == 'message' && $type0 == 'rfc822') { - $suffix = 'msg'; - } else { - $suffix = $type1; - } - - $filename = "untitled$passed_ent_id.$suffix"; - } - - // Note: - // The following sections display the attachment in different - // ways depending on how they choose. The first way will download - // under any circumstance. This sets the Content-type to be - // applicatin/octet-stream, which should be interpreted by the - // browser as "download me". - // The second method (view) is used for images or other formats - // that should be able to be handled by the browser. It will - // most likely display the attachment inline inside the browser. - // And finally, the third one will be used by default. If it - // is displayable (text or html), it will load them up in a text - // viewer (built in to squirrelmail). Otherwise, it sets the - // content-type as application/octet-stream - - if (isset($absolute_dl) && $absolute_dl == "true") { - switch($type0) { - case "text": - DumpHeaders($type0, $type1, $filename, 1); +header('Pragma: '); +header('Cache-Control: cache'); + +function viewText($color, $body, $id, $entid, $mailbox, $type1, $wrap_at) { + global $where, $what, $charset; + global $startMessage; + + displayPageHeader($color, 'None'); + + echo "
". + "
". + _("Viewing a text attachment") . " - "; + if ($where && $what) { + // from a search + echo "". _("View message") . ""; + } else { + echo "". _("View message") . ""; + } + + $urlmailbox = urlencode($mailbox); + echo "
". + _("Download this as a file"). + "

". + "". + "
". + "
". + "
"; + + if ($type1 == 'html') { + $body = MagicHTML( $body, $id ); + } else { + translateText($body, $wrap_at, $charset); + } + + flush(); + echo $body . + "
"; +} + +$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); +sqimap_mailbox_select($imapConnection, $mailbox); + +/* + * $message contains all information about the message + * including header and body + */ +$message = sqimap_get_message($imapConnection, $passed_id, $mailbox); +$top_header = $message->header; + +/* + * lets redefine message as this particular entity that we wish to display. + * it should hold only the header for this entity. We need to fetch the body + * yet before we can display anything. + */ +$message = getEntity($message, $passed_ent_id); + +$header = $message->header; + +$charset = $header->charset; +$type0 = $header->type0; +$type1 = $header->type1; +if (isset($override_type0)) { + $type0 = $override_type0; +} +if (isset($override_type1)) { + $type1 = $override_type1; +} +$filename = decodeHeader($header->filename); +if (!$filename) { + $filename = decodeHeader($header->name); +} + +if (strlen($filename) < 1) { + if ($type1 == 'plain' && $type0 == 'text') { + $suffix = 'txt'; + } else if ($type1 == 'richtext' && $type0 == 'text') { + $suffix = 'rtf'; + } else if ($type1 == 'postscript' && $type0 == 'application') { + $suffix = 'ps'; + } else if ($type1 == 'message' && $type0 == 'rfc822') { + $suffix = 'msg'; + } else { + $suffix = $type1; + } + + $filename = "untitled$passed_ent_id.$suffix"; +} + +/* + * Note: + * The following sections display the attachment in different + * ways depending on how they choose. The first way will download + * under any circumstance. This sets the Content-type to be + * applicatin/octet-stream, which should be interpreted by the + * browser as "download me". + * The second method (view) is used for images or other formats + * that should be able to be handled by the browser. It will + * most likely display the attachment inline inside the browser. + * And finally, the third one will be used by default. If it + * is displayable (text or html), it will load them up in a text + * viewer (built in to squirrelmail). Otherwise, it sets the + * content-type as application/octet-stream + */ +if (isset($absolute_dl) && $absolute_dl == 'true') { + switch($type0) { + case 'text': + DumpHeaders($type0, $type1, $filename, 1); + $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id); + $body = decodeBody($body, $header->encoding); + if ($type1 == 'plain' && isset($showHeaders)) { + echo _("Subject") . ": " . decodeHeader($top_header->subject) . "\n". + " " . _("From") . ": " . decodeHeader($top_header->from) . "\n". + " " . _("To") . ": " . decodeHeader(getLineOfAddrs($top_header->to)) . "\n". + " " . _("Date") . ": " . getLongDateString($top_header->date) . "\n\n"; + } elseif ($type1 == 'html' && isset($showHeaders)) { + echo '\n\n\n\n
' . _("Subject"). + ':' . decodeHeader($top_header->subject). + "
" . _("From"). + ':' . decodeHeader($top_header->from). + "
" . _("To"). + ':' . decodeHeader(getLineOfAddrs($top_header->to)). + "
" . _("Date"). + ':' . getLongDateString($top_header->date). + "
\n
\n"; + } + echo $body; + break; + default: + DumpHeaders($type0, $type1, $filename, 1); + mime_print_body_lines ($imapConnection, $passed_id, $passed_ent_id, $header->encoding); + break; + } +} else { + switch ($type0) { + case 'text': + if ($type1 == 'plain' || $type1 == 'html') { $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id); $body = decodeBody($body, $header->encoding); - if ($type1 == "plain" && isset($showHeaders)) { - echo _("Subject") . ": " . decodeHeader($top_header->subject) . "\n"; - echo " " . _("From") . ": " . decodeHeader($top_header->from) . "\n"; - echo " " . _("To") . ": " . decodeHeader(getLineOfAddrs($top_header->to)) . "\n"; - echo " " . _("Date") . ": " . getLongDateString($top_header->date) . "\n\n"; - } - elseif ($type1 == "html" && isset($showHeaders)) { - echo '\n\n\n\n
' . _("Subject"); - echo ':' . decodeHeader($top_header->subject); - echo "
" . _("From"); - echo ':' . decodeHeader($top_header->from); - echo "
" . _("To"); - echo ':' . decodeHeader(getLineOfAddrs($top_header->to)); - echo "
" . _("Date"); - echo ':' . getLongDateString($top_header->date); - echo "
\n
\n"; - } - echo $body; - break; - default: - DumpHeaders($type0, $type1, $filename, 1); - mime_print_body_lines ($imapConnection, $passed_id, $passed_ent_id, $header->encoding); - break; - } - } else { - switch ($type0) { - case "text": - if ($type1 == "plain" || $type1 == "html") { - $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id); - $body = decodeBody($body, $header->encoding); - viewText($color, $body, $passed_id, $passed_ent_id, $mailbox, $type1, $wrap_at); - } else { - DumpHeaders($type0, $type1, $filename, 0); - $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id); - $body = decodeBody($body, $header->encoding); - echo $body; - } - break; - case "message": + viewText($color, $body, $passed_id, $passed_ent_id, $mailbox, $type1, $wrap_at); + } else { + DumpHeaders($type0, $type1, $filename, 0); $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id); $body = decodeBody($body, $header->encoding); - viewText($color, $body, $passed_id, $passed_ent_id, $mailbox, $type1, $wrap_at); - break; - default: - DumpHeaders($type0, $type1, $filename, 0); - mime_print_body_lines ($imapConnection, $passed_id, $passed_ent_id, $header->encoding); - break; - } - } - - - // This function is verified to work with Netscape and the *very latest* - // version of IE. I don't know if it works with Opera, but it should now. - function DumpHeaders($type0, $type1, $filename, $force) - { - global $HTTP_USER_AGENT; - - $isIE = 0; - if (strstr($HTTP_USER_AGENT, 'compatible; MSIE ') !== false && - strstr($HTTP_USER_AGENT, 'Opera') === false) { + echo $body; + } + break; + case 'message': + $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id); + $body = decodeBody($body, $header->encoding); + viewText($color, $body, $passed_id, $passed_ent_id, $mailbox, $type1, $wrap_at); + break; + default: + DumpHeaders($type0, $type1, $filename, 0); + mime_print_body_lines ($imapConnection, $passed_id, $passed_ent_id, $header->encoding); + break; + } +} + + +/* + * This function is verified to work with Netscape and the *very latest* + * version of IE. I don't know if it works with Opera, but it should now. + */ +function DumpHeaders($type0, $type1, $filename, $force) { + global $HTTP_USER_AGENT; + + $isIE = 0; + if (strstr($HTTP_USER_AGENT, 'compatible; MSIE ') !== false && + strstr($HTTP_USER_AGENT, 'Opera') === false) { $isIE = 1; - } - - $filename = ereg_replace('[^-a-zA-Z0-9\.]', '_', $filename); - - // A Pox on Microsoft and it's Office! - if (! $force) - { - // Try to show in browser window - header("Content-Disposition: inline; filename=\"$filename\""); - header("Content-Type: $type0/$type1; name=\"$filename\""); - } - else - { - // Try to pop up the "save as" box - // IE makes this hard. It pops up 2 save boxes, or none. - // http://support.microsoft.com/support/kb/articles/Q238/5/88.ASP - // But, accordint to Microsoft, it is "RFC compliant but doesn't - // take into account some deviations that allowed within the - // specification." Doesn't that mean RFC non-compliant? - // http://support.microsoft.com/support/kb/articles/Q258/4/52.ASP - // - // The best thing you can do for IE is to upgrade to the latest - // version - if ($isIE) { - // http://support.microsoft.com/support/kb/articles/Q182/3/15.asp - // Do not have quotes around filename, but that applied to - // "attachment"... does it apply to inline too? - // - // This combination seems to work mostly. IE 5.5 SP 1 has - // known issues (see the Microsoft Knowledge Base) - header("Content-Disposition: inline; filename=$filename"); - - // This works for most types, but doesn't work with Word files - header("Content-Type: application/download; name=\"$filename\""); - - // These are spares, just in case. :-) - //header("Content-Type: $type0/$type1; name=\"$filename\""); - //header("Content-Type: application/x-msdownload; name=\"$filename\""); - //header("Content-Type: application/octet-stream; name=\"$filename\""); - } else { - header("Content-Disposition: attachment; filename=\"$filename\""); - // application/octet-stream forces download for Netscape - header("Content-Type: application/octet-stream; name=\"$filename\""); - } - } - } + } + + $filename = ereg_replace('[^-a-zA-Z0-9\.]', '_', $filename); + + // A Pox on Microsoft and it's Office! + if (! $force) { + // Try to show in browser window + header("Content-Disposition: inline; filename=\"$filename\""); + header("Content-Type: $type0/$type1; name=\"$filename\""); + } else { + // Try to pop up the "save as" box + // IE makes this hard. It pops up 2 save boxes, or none. + // http://support.microsoft.com/support/kb/articles/Q238/5/88.ASP + // But, accordint to Microsoft, it is "RFC compliant but doesn't + // take into account some deviations that allowed within the + // specification." Doesn't that mean RFC non-compliant? + // http://support.microsoft.com/support/kb/articles/Q258/4/52.ASP + // + // The best thing you can do for IE is to upgrade to the latest + // version + if ($isIE) { + // http://support.microsoft.com/support/kb/articles/Q182/3/15.asp + // Do not have quotes around filename, but that applied to + // "attachment"... does it apply to inline too? + // + // This combination seems to work mostly. IE 5.5 SP 1 has + // known issues (see the Microsoft Knowledge Base) + header("Content-Disposition: inline; filename=$filename"); + + // This works for most types, but doesn't work with Word files + header("Content-Type: application/download; name=\"$filename\""); + + // These are spares, just in case. :-) + //header("Content-Type: $type0/$type1; name=\"$filename\""); + //header("Content-Type: application/x-msdownload; name=\"$filename\""); + //header("Content-Type: application/octet-stream; name=\"$filename\""); + } else { + header("Content-Disposition: attachment; filename=\"$filename\""); + // application/octet-stream forces download for Netscape + header("Content-Type: application/octet-stream; name=\"$filename\""); + } + } +} ?> diff --git a/src/empty_trash.php b/src/empty_trash.php index 0e845c57..18d89d94 100644 --- a/src/empty_trash.php +++ b/src/empty_trash.php @@ -12,63 +12,51 @@ * $Id$ */ -/*****************************************************************/ -/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ -/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ -/*** + Base level indent should begin at left margin, as ***/ -/*** the require_once below looks. ***/ -/*** + All identation should consist of four space blocks ***/ -/*** + Tab characters are evil. ***/ -/*** + all comments should use "slash-star ... star-slash" ***/ -/*** style -- no pound characters, no slash-slash style ***/ -/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ -/*** ALWAYS USE { AND } CHARACTERS!!! ***/ -/*** + Please use ' instead of ", when possible. Note " ***/ -/*** should always be used in _( ) function calls. ***/ -/*** Thank you for your help making the SM code more readable. ***/ -/*****************************************************************/ - require_once('../src/validate.php'); require_once('../functions/display_messages.php'); require_once('../functions/imap.php'); require_once('../functions/array.php'); require_once('../functions/tree.php'); - $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); +$imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); + +sqimap_mailbox_list($imap_stream); - sqimap_mailbox_list($imap_stream); +$mailbox = $trash_folder; +$boxes = sqimap_mailbox_list($imap_stream); +global $delimiter; - $mailbox = $trash_folder; - $boxes = sqimap_mailbox_list($imap_stream); - global $delimiter; - - // According to RFC2060, a DELETE command should NOT remove inferiors (sub folders) - // so lets go through the list of subfolders and remove them before removing the - // parent. +/* + * According to RFC2060, a DELETE command should NOT remove inferiors (sub folders) + * so lets go through the list of subfolders and remove them before removing the + * parent. + */ + +/** First create the top node in the tree **/ +for ($i = 0;$i < count($boxes);$i++) { + if (($boxes[$i]["unformatted"] == $mailbox) && (strlen($boxes[$i]["unformatted"]) == strlen($mailbox))) { + $foldersTree[0]["value"] = $mailbox; + $foldersTree[0]["doIHaveChildren"] = false; + continue; + } +} +/* + * Now create the nodes for subfolders of the parent folder + * You can tell that it is a subfolder by tacking the mailbox delimiter + * on the end of the $mailbox string, and compare to that. + */ +$j = 0; +for ($i = 0;$i < count($boxes);$i++) { + if (substr($boxes[$i]["unformatted"], 0, strlen($mailbox . $delimiter)) == ($mailbox . $delimiter)) { + addChildNodeToTree($boxes[$i]["unformatted"], $boxes[$i]["unformatted-dm"], $foldersTree); + } +} - /** First create the top node in the tree **/ - for ($i = 0;$i < count($boxes);$i++) { - if (($boxes[$i]["unformatted"] == $mailbox) && (strlen($boxes[$i]["unformatted"]) == strlen($mailbox))) { - $foldersTree[0]["value"] = $mailbox; - $foldersTree[0]["doIHaveChildren"] = false; - continue; - } - } - // Now create the nodes for subfolders of the parent folder - // You can tell that it is a subfolder by tacking the mailbox delimiter - // on the end of the $mailbox string, and compare to that. - $j = 0; - for ($i = 0;$i < count($boxes);$i++) { - if (substr($boxes[$i]["unformatted"], 0, strlen($mailbox . $delimiter)) == ($mailbox . $delimiter)) { - addChildNodeToTree($boxes[$i]["unformatted"], $boxes[$i]["unformatted-dm"], $foldersTree); - } - } - - // now lets go through the tree and delete the folders - walkTreeInPreOrderEmptyTrash(0, $imap_stream, $foldersTree); +// now lets go through the tree and delete the folders +walkTreeInPreOrderEmptyTrash(0, $imap_stream, $foldersTree); - $location = get_location(); - header ("Location: $location/left_main.php"); +$location = get_location(); +header ("Location: $location/left_main.php"); - sqimap_logout($imap_stream); +sqimap_logout($imap_stream); ?> diff --git a/src/move_messages.php b/src/move_messages.php index fb46544b..74320bf3 100644 --- a/src/move_messages.php +++ b/src/move_messages.php @@ -11,155 +11,141 @@ * $Id$ */ -/*****************************************************************/ -/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ -/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ -/*** + Base level indent should begin at left margin, as ***/ -/*** the require_once below looks. ***/ -/*** + All identation should consist of four space blocks ***/ -/*** + Tab characters are evil. ***/ -/*** + all comments should use "slash-star ... star-slash" ***/ -/*** style -- no pound characters, no slash-slash style ***/ -/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ -/*** ALWAYS USE { AND } CHARACTERS!!! ***/ -/*** + Please use ' instead of ", when possible. Note " ***/ -/*** should always be used in _( ) function calls. ***/ -/*** Thank you for your help making the SM code more readable. ***/ -/*****************************************************************/ - require_once('../src/validate.php'); require_once('../functions/display_messages.php'); require_once('../functions/imap.php'); - function putSelectedMessagesIntoString($msg) { - $j = 0; - $i = 0; - $firstLoop = true; - - // If they have selected nothing msg is size one still, but will - // be an infinite loop because we never increment j. so check to - // see if msg[0] is set or not to fix this. - while (($j < count($msg)) && ($msg[0])) { - if ($msg[$i]) { +function putSelectedMessagesIntoString($msg) { + $j = 0; + $i = 0; + $firstLoop = true; + + // If they have selected nothing msg is size one still, but will + // be an infinite loop because we never increment j. so check to + // see if msg[0] is set or not to fix this. + while (($j < count($msg)) && ($msg[0])) { + if ($msg[$i]) { if ($firstLoop != true) - $selectedMessages .= "&"; + $selectedMessages .= "&"; else - $firstLoop = false; + $firstLoop = false; $selectedMessages .= "selMsg[$j]=$msg[$i]"; - + $j++; - } - $i++; - } - } - - $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); - sqimap_mailbox_select($imapConnection, $mailbox); - - // expunge-on-demand if user isn't using move_to_trash or auto_expunge - if(isset($expungeButton)) { - sqimap_mailbox_expunge($imapConnection, $mailbox, true); - $location = get_location(); - if ($where && $what) - header ("Location: $location/search.php?mailbox=".urlencode($mailbox)."&what=".urlencode($what)."&where=".urlencode($where)); - else - header ("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=". urlencode($mailbox)); - } - // undelete messages if user isn't using move_to_trash or auto_expunge - elseif(isset($undeleteButton)) { - if (is_array($msg) == 1) { - // Removes \Deleted flag from selected messages - $j = 0; - $i = 0; - - // If they have selected nothing msg is size one still, but will be an infinite - // loop because we never increment j. so check to see if msg[0] is set or not to fix this. - while ($j < count($msg)) { + } + $i++; + } +} + +$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); +sqimap_mailbox_select($imapConnection, $mailbox); + +// expunge-on-demand if user isn't using move_to_trash or auto_expunge +if(isset($expungeButton)) { + sqimap_mailbox_expunge($imapConnection, $mailbox, true); + $location = get_location(); + if ($where && $what) { + header ("Location: $location/search.php?mailbox=".urlencode($mailbox)."&what=".urlencode($what)."&where=".urlencode($where)); + } else { + header ("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=". urlencode($mailbox)); + } + +} elseif(isset($undeleteButton)) { + // undelete messages if user isn't using move_to_trash or auto_expunge + + if (is_array($msg) == 1) { + // Removes \Deleted flag from selected messages + $j = 0; + $i = 0; + + // If they have selected nothing msg is size one still, but will be an infinite + // loop because we never increment j. so check to see if msg[0] is set or not to fix this. + while ($j < count($msg)) { if ($msg[$i]) { - sqimap_messages_remove_flag ($imapConnection, $msg[$i], $msg[$i], "Deleted"); - $j++; + sqimap_messages_remove_flag ($imapConnection, $msg[$i], $msg[$i], "Deleted"); + $j++; } $i++; - } - $location = get_location(); + } + $location = get_location(); - if ($where && $what) + if ($where && $what) header ("Location: $location/search.php?mailbox=".urlencode($mailbox)."&what=".urlencode($what)."&where=".urlencode($where)); - else + else header ("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=". urlencode($mailbox)); - } else { - displayPageHeader($color, $mailbox); - error_message(_("No messages were selected."), $mailbox, $sort, $startMessage, $color); - } - } - // If the delete button was pressed, the moveButton variable will not be set. - elseif (!isset($moveButton)) { - if (is_array($msg) == 1) { - // Marks the selected messages as 'Deleted' - $j = 0; - $i = 0; - - // If they have selected nothing msg is size one still, but will be an infinite - // loop because we never increment j. so check to see if msg[0] is set or not to fix this. - while ($j < count($msg)) { + } else { + displayPageHeader($color, $mailbox); + error_message(_("No messages were selected."), $mailbox, $sort, $startMessage, $color); + } +} elseif (!isset($moveButton)) { + // If the delete button was pressed, the moveButton variable will not be set. + if (is_array($msg) == 1) { + // Marks the selected messages as 'Deleted' + $j = 0; + $i = 0; + + // If they have selected nothing msg is size one still, but will be an infinite + // loop because we never increment j. so check to see if msg[0] is set or not to fix this. + while ($j < count($msg)) { if (isset($msg[$i])) { - if (isset($markRead)) { - sqimap_messages_flag($imapConnection, $msg[$i], $msg[$i], "Seen"); - } else if (isset($markUnread)) { - sqimap_messages_remove_flag($imapConnection, $msg[$i], $msg[$i], "Seen"); - } else { - sqimap_messages_delete($imapConnection, $msg[$i], $msg[$i], $mailbox); - } - $j++; + if (isset($markRead)) { + sqimap_messages_flag($imapConnection, $msg[$i], $msg[$i], "Seen"); + } else if (isset($markUnread)) { + sqimap_messages_remove_flag($imapConnection, $msg[$i], $msg[$i], "Seen"); + } else { + sqimap_messages_delete($imapConnection, $msg[$i], $msg[$i], $mailbox); + } + $j++; } $i++; - } - if ($auto_expunge) { + } + if ($auto_expunge) { sqimap_mailbox_expunge($imapConnection, $mailbox, true); - } - $location = get_location(); - if (isset($where) && isset($what)) + } + $location = get_location(); + if (isset($where) && isset($what)) { header ("Location: $location/search.php?mailbox=".urlencode($mailbox)."&what=".urlencode($what)."&where=".urlencode($where)); - else + } else { header ("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=". urlencode($mailbox)); - } else { - displayPageHeader($color, $mailbox); - error_message(_("No messages were selected."), $mailbox, $sort, $startMessage, $color); - } - } else { // Move messages - // lets check to see if they selected any messages - if (is_array($msg) == 1) { - $j = 0; - $i = 0; - - // If they have selected nothing msg is size one still, but will be an infinite - // loop because we never increment j. so check to see if msg[0] is set or not to fix this. - while ($j < count($msg)) { + } + } else { + displayPageHeader($color, $mailbox); + error_message(_("No messages were selected."), $mailbox, $sort, $startMessage, $color); + } +} else { // Move messages + // lets check to see if they selected any messages + if (is_array($msg) == 1) { + $j = 0; + $i = 0; + + // If they have selected nothing msg is size one still, but will be an infinite + // loop because we never increment j. so check to see if msg[0] is set or not to fix this. + while ($j < count($msg)) { if (isset($msg[$i])) { - /** check if they would like to move it to the trash folder or not */ - sqimap_messages_copy($imapConnection, $msg[$i], $msg[$i], $targetMailbox); - sqimap_messages_flag($imapConnection, $msg[$i], $msg[$i], "Deleted"); - $j++; + /** check if they would like to move it to the trash folder or not */ + sqimap_messages_copy($imapConnection, $msg[$i], $msg[$i], $targetMailbox); + sqimap_messages_flag($imapConnection, $msg[$i], $msg[$i], "Deleted"); + $j++; } $i++; - } - if ($auto_expunge == true) + } + if ($auto_expunge == true) sqimap_mailbox_expunge($imapConnection, $mailbox, true); - $location = get_location(); - if (isset($where) && isset($what)) + $location = get_location(); + if (isset($where) && isset($what)) header ("Location: $location/search.php?mailbox=".urlencode($mailbox)."&what=".urlencode($what)."&where=".urlencode($where)); - else + else header ("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=". urlencode($mailbox)); - } else { - displayPageHeader($color, $mailbox); - error_message(_("No messages were selected."), $mailbox, $sort, $startMessage, $color); - } - } - - // Log out this session - sqimap_logout($imapConnection); + } else { + displayPageHeader($color, $mailbox); + error_message(_("No messages were selected."), $mailbox, $sort, $startMessage, $color); + } +} + +// Log out this session +sqimap_logout($imapConnection); ?> diff --git a/src/vcard.php b/src/vcard.php index b070dd58..8aa55c2d 100644 --- a/src/vcard.php +++ b/src/vcard.php @@ -11,138 +11,113 @@ * $Id$ */ -/*****************************************************************/ -/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ -/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ -/*** + Base level indent should begin at left margin, as ***/ -/*** the require_once below looks. ***/ -/*** + All identation should consist of four space blocks ***/ -/*** + Tab characters are evil. ***/ -/*** + all comments should use "slash-star ... star-slash" ***/ -/*** style -- no pound characters, no slash-slash style ***/ -/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ -/*** ALWAYS USE { AND } CHARACTERS!!! ***/ -/*** + Please use ' instead of ", when possible. Note " ***/ -/*** should always be used in _( ) function calls. ***/ -/*** Thank you for your help making the SM code more readable. ***/ -/*****************************************************************/ - require_once('../src/validate.php'); require_once('../functions/date.php'); require_once('../functions/page_header.php'); require_once('../functions/mime.php'); require_once('../src/load_prefs.php'); - $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); - sqimap_mailbox_select($imapConnection, $mailbox); +$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); +sqimap_mailbox_select($imapConnection, $mailbox); - displayPageHeader($color, 'None'); +displayPageHeader($color, 'None'); - echo '
' . "\n" . +echo '
' . "\n" . ''; - - $message = sqimap_get_message($imapConnection, $passed_id, $mailbox); - - $entity_vcard = getEntity($message,$passed_ent_id); - - $vcard = mime_fetch_body ($imapConnection, $passed_id, $passed_ent_id); - $vcard = decodeBody($vcard, $entity_vcard->header->encoding); - $vcard = explode ("\n",$vcard); - foreach ($vcard as $l) - { - $k = substr($l, 0, strpos($l, ':')); - $v = substr($l, strpos($l, ':') + 1); - $attributes = explode(';', $k); - $k = strtolower(array_shift($attributes)); - foreach ($attributes as $attr) - { - if ($attr == 'quoted-printable') - $v = quoted_printable_decode($v); - else +} else { + echo '' . _("View message") . ''; +} +echo ''; + +$message = sqimap_get_message($imapConnection, $passed_id, $mailbox); + +$entity_vcard = getEntity($message,$passed_ent_id); + +$vcard = mime_fetch_body ($imapConnection, $passed_id, $passed_ent_id); +$vcard = decodeBody($vcard, $entity_vcard->header->encoding); +$vcard = explode ("\n",$vcard); +foreach ($vcard as $l) { + $k = substr($l, 0, strpos($l, ':')); + $v = substr($l, strpos($l, ':') + 1); + $attributes = explode(';', $k); + $k = strtolower(array_shift($attributes)); + foreach ($attributes as $attr) { + if ($attr == 'quoted-printable') + $v = quoted_printable_decode($v); + else $k .= ';' . $attr; - } - - $v = ereg_replace(';', "\n", $v); - $vcard_nice[$k] = $v; - } - - if ($vcard_nice['version'] == '2.1') - { - // get firstname and lastname for sm addressbook - $vcard_nice["firstname"] = substr($vcard_nice["n"], - strpos($vcard_nice["n"], "\n") + 1, strlen($vcard_nice["n"])); - $vcard_nice["lastname"] = substr($vcard_nice["n"], 0, - strpos($vcard_nice["n"], "\n")); - } - else - { - echo '\n"; - } - - foreach ($vcard_nice as $k => $v) - { - $v = htmlspecialchars($v); - $v = trim($v); - $vcard_safe[$k] = trim(nl2br($v)); - } - - $ShowValues = array( - 'fn' => _("Name"), - 'title' => _("Title"), - 'email;internet' => _("Email"), - 'url' => _("Web Page"), - 'org' => _("Organization / Department"), - 'adr' => _("Address"), - 'tel;work' => _("Work Phone"), - 'tel;home' => _("Home Phone"), - 'tel;cell' => _("Cellular Phone"), - 'tel;fax' => _("Fax"), - 'note' => _("Note")); - - echo '\n"; +} + +foreach ($vcard_nice as $k => $v) { + $v = htmlspecialchars($v); + $v = trim($v); + $vcard_safe[$k] = trim(nl2br($v)); +} + +$ShowValues = array( + 'fn' => _("Name"), + 'title' => _("Title"), + 'email;internet' => _("Email"), + 'url' => _("Web Page"), + 'org' => _("Organization / Department"), + 'adr' => _("Address"), + 'tel;work' => _("Work Phone"), + 'tel;home' => _("Home Phone"), + 'tel;cell' => _("Cellular Phone"), + 'tel;fax' => _("Fax"), + 'note' => _("Note")); + +echo '
' . '
' . _("Viewing a Business Card") . " - "; - if (isset($where) && isset($what)) { - // from a search - echo '' . _("View message") . ''; - } else { - echo '' . _("View message") . ''; - } - echo '
vCard Version ' . $vcard_nice['version'] . - ' is not supported. Some information might not be converted ' . - "correctly.

' . + } + + $v = ereg_replace(';', "\n", $v); + $vcard_nice[$k] = $v; +} + +if ($vcard_nice['version'] == '2.1') { + // get firstname and lastname for sm addressbook + $vcard_nice["firstname"] = substr($vcard_nice["n"], + strpos($vcard_nice["n"], "\n") + 1, strlen($vcard_nice["n"])); + $vcard_nice["lastname"] = substr($vcard_nice["n"], 0, + strpos($vcard_nice["n"], "\n")); +} else { + echo '
vCard Version ' . $vcard_nice['version'] . + ' is not supported. Some information might not be converted ' . + "correctly.

' . '' . "\n"; - - if (isset($vcard_safe['email;internet'])) { - $vcard_safe['email;internet'] = '' . $vcard_safe['email;internet'] . - ''; - } - if (isset($vcard_safe['url'])) { - $vcard_safe['url'] = '' . - $vcard_safe['url'] . ''; - } - - foreach ($ShowValues as $k => $v) - { - if (isset($vcard_safe[$k]) && $vcard_safe[$k]) - { - echo "\n"; - } - } + } +} - echo '
$v:" . $vcard_safe[$k] . + +if (isset($vcard_safe['email;internet'])) { $vcard_safe['email;internet'] = '' . $vcard_safe['email;internet'] . + ''; +} +if (isset($vcard_safe['url'])) { + $vcard_safe['url'] = '' . + $vcard_safe['url'] . ''; +} + +foreach ($ShowValues as $k => $v) { + if (isset($vcard_safe[$k]) && $vcard_safe[$k]) { + echo "
$v:" . $vcard_safe[$k] . "
' . +echo '
' . '
' . '' . '' . + 'align="center">' . '' . '' . '' . '
' . '
' . @@ -158,49 +133,58 @@ require_once('../src/load_prefs.php'); '
Note Field Contains:' . '' . +if (isset($vcard_nice['url'])) { + echo '\n"; +} +if (isset($vcard_nice['adr'])) { + echo '\n"; +} +if (isset($vcard_nice['title'])) { + echo '\n"; +} +if (isset($vcard_nice['org'])) { + echo '\n"; +} +if (isset($vcard_nice['title'])) { + echo '\n"; +} +if (isset($vcard_nice['tel;work'])) { + echo '\n"; +} +if (isset($vcard_nice['tel;home'])) { + echo '\n"; +} +if (isset($vcard_nice['tel;cell'])) { + echo '\n"; +} +if (isset($vcard_nice['tel;fax'])) { + echo '\n"; +} +if (isset($vcard_nice['note'])) { + echo '\n"; +} +echo '' . '
' . '' . + htmlspecialchars($vcard_nice['email;internet']) . '">' . '' . + $vcard_safe['firstname'] . '">' . '' . + $vcard_safe['lastname'] . '">' . '' . + 'VALUE="Add to Address Book">' . '
' . '' . @@ -208,7 +192,7 @@ require_once('../src/load_prefs.php'); '' . '' . + '&passed_ent_id=' . $passed_ent_id . '">' . _("Download this as a file") . '' . '' . @@ -216,3 +200,5 @@ require_once('../src/load_prefs.php'); '' . '' . ''; + +?> \ No newline at end of file diff --git a/src/webmail.php b/src/webmail.php index 3f9c1119..596a4ccc 100644 --- a/src/webmail.php +++ b/src/webmail.php @@ -41,11 +41,9 @@ if ($my_language != $squirrelmail_language) { set_up_language(getPref($data_dir, $username, 'language')); -echo "\n"; -echo ''; -echo $org_title; -echo ''; - +echo "\n" . + "$org_title"; + $left_size = getPref($data_dir, $username, 'left_size'); $location_of_bar = getPref($data_dir, $username, 'location_of_bar'); if ($location_of_bar == '') { @@ -58,8 +56,8 @@ if ($left_size == "") { else { $left_size = 200; } -} - +} + if ($location_of_bar == 'right') { echo ""; } @@ -87,17 +85,13 @@ if ($right_frame == 'right_main.php') { $urlMailbox = urlencode($mailbox); $right_frame_url = "right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage"; -} -elseif ($right_frame == 'options.php') { +} elseif ($right_frame == 'options.php') { $right_frame_url = 'options.php'; -} -elseif ($right_frame == 'folders.php') { +} elseif ($right_frame == 'folders.php') { $right_frame_url = 'folders.php'; -} -elseif ($right_frame == 'compose.php') { +} elseif ($right_frame == 'compose.php') { $right_frame_url = "compose.php?send_to=$rcptaddress"; -} -else { +} else { $right_frame_url = 'right_main.php'; } -- 2.25.1