From 4ca45d7b7f2b2d2732a5f07b0c9af51dacf6a895 Mon Sep 17 00:00:00 2001 From: lkehresman Date: Tue, 22 Feb 2000 11:47:08 +0000 Subject: [PATCH] Updated documentation, fixed sorting problems in folder list. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@232 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 8 +- doc/index.html | 36 +++++++ doc/{message_array.doc => message_array.html} | 10 +- doc/sqimap.php3 | 49 ++++++++++ doc/sqimap_config.php3 | 94 +++++++++++++++++++ functions/imap_general.php | 2 +- functions/imap_mailbox.php | 20 +++- functions/imap_messages.php | 2 +- 8 files changed, 212 insertions(+), 9 deletions(-) create mode 100644 doc/index.html rename doc/{message_array.doc => message_array.html} (90%) create mode 100644 doc/sqimap.php3 create mode 100644 doc/sqimap_config.php3 diff --git a/ChangeLog b/ChangeLog index df3776a6..1d8dc1c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ -Version 0.3pre1 -- Development +Version 0.3pre2 -- Development ------------------------------ +- Rewrote all IMAP functions from scratch + +Version 0.3pre1 -- February 17, 2000 +------------------------------------ - Added user-specific preferences including: Full Name (for outbound messages) Reply-to address @@ -22,6 +26,7 @@ Version 0.3pre1 -- Development + Version 0.2.1 -- January 05, 2000 --------------------------------- - Rewrote how MULTIPART messages were handled and made it recursive @@ -38,6 +43,7 @@ Version 0.2 -- January 02, 2000 + Version 0.1.2 -- December 20, 1999 ----------------------------------- - Date translation to local time diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 00000000..bb570dfb --- /dev/null +++ b/doc/index.html @@ -0,0 +1,36 @@ +

SquirrelMail Documentation

+

+Sorry for the lack of cohesion in the SquirrelMail documentation, but here is a conglomeration +of all the docs that we have accumulated so far. Maybe some time in the future we will put +together a good documentation system. This is just meant to get you up and running. If you find +mistakes, please email them to lehresma@css.tayloru.edu. +

+ + + + + + + diff --git a/doc/message_array.doc b/doc/message_array.html similarity index 90% rename from doc/message_array.doc rename to doc/message_array.html index 00593b36..ccd105b5 100644 --- a/doc/message_array.doc +++ b/doc/message_array.html @@ -1,7 +1,10 @@ +

Here is a map of the message array that contains all the information about a message. A single part message is handled the same as a multipart message, except in the "ENTITIES" part, there would only be one entry (0). +

+
 $message     ["HEADER"]                    (array)
                 ["TO"]                     (array)
                 ["CC"]                     (array)
@@ -71,6 +74,7 @@ $message     ["HEADER"]
                      ["CHARSET"]             "us-ascii"
                      ["BOUNDARY"]            ""
                      ["PRIORITY"]            20
-                     ["BODY"]                "This is just a test to see
" - "how this will handle a message" - "for this example" + ["BODY"] "<B>This is just a test to see</B><BR>" + "<FONT FACE="Arial,Helvetica">how this will handle a message" + "for this example</FONT>" +
diff --git a/doc/sqimap.php3 b/doc/sqimap.php3 new file mode 100644 index 00000000..59afe6ef --- /dev/null +++ b/doc/sqimap.php3 @@ -0,0 +1,49 @@ + +

SquirrelMail IMAP functions

+\n"; + for ($i = 0; $i < count($name); $i++) { + echo "\n"; + } + echo "\n"; + + for ($i = 0; $i < count($name); $i++) { + ?> +
+
+ +

sqimap_

+ go to top + + +
+ diff --git a/doc/sqimap_config.php3 b/doc/sqimap_config.php3 new file mode 100644 index 00000000..75237e22 --- /dev/null +++ b/doc/sqimap_config.php3 @@ -0,0 +1,94 @@ +sqimap_login"; + +$name[0] = "read_data"; +$params[0] = "(\$imap_stream, \$pre, \$handle_errors, &\$response, &\$message)"; +$explain[0] = "This is used to read information from the imap server. This handles error correction, error notification, etc. It will return an array of strings that contains the output for your use."; +$params_desc[0][0]["name"] = "imap_stream"; +$params_desc[0][0]["desc"] = $imap_stream_def; +$params_desc[0][0]["type"] = "int"; +$params_desc[0][1]["name"] = "pre"; +$params_desc[0][1]["desc"] = "The string that goes before any commands. In the example below, it is a001."; +$params_desc[0][1]["type"] = "string"; +$params_desc[0][2]["name"] = "handle_errors"; +$params_desc[0][2]["desc"] = "Whether or not to handle all error messages for you"; +$params_desc[0][2]["type"] = "boolean"; +$params_desc[0][3]["name"] = "respone"; +$params_desc[0][3]["desc"] = "Returned if handle_errors is false. It is the server's response"; +$params_desc[0][3]["type"] = "string"; +$params_desc[0][4]["name"] = "message"; +$params_desc[0][4]["desc"] = "Returned if handle_errors is false. It is the error message"; +$params_desc[0][4]["type"] = "string"; +$example[0] = "fputs (\$imap_stream, \"a001 SELECT INBOX\\n\");
"; +$example[0] .="\$read_ary = sqimap_read_data(\$imap_stream, \"a001\", true, $response, $message);
"; +$example[0] .="for (\$i = 0; \$i < count(\$read_ary); \$i++) {
"; +$example[0] .="    echo \$read_ary[\$i];
"; +$example[0] .="}
"; + + +$name[1] = "login"; +$params[1] = "(\$username, \$password, \$imap_server_address, \$hide)"; +$explain[1] = "This function simply logs the specified user into the imap server."; +$params_desc[1][0]["name"] = "username"; +$params_desc[1][0]["type"] = "string"; +$params_desc[1][0]["desc"] = "The user who you wish to log in."; +$params_desc[1][1]["name"] = "password"; +$params_desc[1][1]["type"] = "string"; +$params_desc[1][1]["desc"] = "The password for the user."; +$params_desc[1][2]["name"] = "imap_server_address"; +$params_desc[1][2]["type"] = "string"; +$params_desc[1][2]["desc"] = "Address of the IMAP server."; +$params_desc[1][3]["name"] = "hide"; +$params_desc[1][3]["type"] = "boolean"; +$params_desc[1][3]["desc"] = "If set, this will hide all error messages from the login session."; +$example[1] = "sqimap_login (\"luke\", \"lkajskw\", \"mail.luke.com\", false);"; + + +$name[2] = "logout"; +$params[2] = "(\$imap_stream)"; +$explain[2] = "This simply logs out whoever is logged into the \$imap_stream."; +$params_desc[2][0]["name"] = "imap_stream"; +$params_desc[2][0]["type"] = "int"; +$params_desc[2][0]["desc"] = $imap_stream_def; +$example[2] = "sqimap_logout (\$imap_stream);"; + + +$name[3] = "get_delimiter"; +$params[3] = "(\$imap_stream)"; +$explain[3] = "Each mailbox is delimited differently between IMAP servers. Some would look like \"INBOX.Folder\", but others might look like \"INBOX/Folder\". This function returns what the delimiter is so you can create mailboxes of your own."; +$params_desc[3][0]["name"] = "imap_stream"; +$params_desc[3][0]["type"] = "int"; +$params_desc[3][0]["desc"] = $imap_stream_def; +$example[3] = "\$dm = sqimap_get_delimiter(\$imap_stream);"; + + +$name[4] = "get_num_messages"; +$params[4] = "(\$imap_stream, \$mailbox)"; +$explain[4] = "Returns the number of messages in the specified folder."; +$params_desc[4][0]["name"] = "imap_stream"; +$params_desc[4][0]["type"] = "int"; +$params_desc[4][0]["desc"] = $imap_stream_def; +$params_desc[4][1]["name"] = "mailbox"; +$params_desc[4][1]["type"] = "string"; +$params_desc[4][1]["desc"] = "The mailbox that you wish to check out."; +$example[4] = "$num = sqimap_get_num_messages (\$imap_stream, \"INBOX\");"; + +/* +$name[1] = ""; +$params[1] = ""; +$explain[1] = ""; +$params_desc[1][0]["name"] = ""; +$params_desc[1][0]["type"] = ""; +$params_desc[1][0]["desc"] = ""; +$params_desc[1][1]["name"] = ""; +$params_desc[1][1]["type"] = ""; +$params_desc[1][1]["desc"] = ""; +$params_desc[1][2]["name"] = ""; +$params_desc[1][2]["type"] = ""; +$params_desc[1][2]["desc"] = ""; +$params_desc[1][3]["name"] = ""; +$params_desc[1][3]["type"] = ""; +$params_desc[1][3]["desc"] = ""; +$example[0] = ""; +*/ +?> diff --git a/functions/imap_general.php b/functions/imap_general.php index fefae688..44da9665 100755 --- a/functions/imap_general.php +++ b/functions/imap_general.php @@ -227,4 +227,4 @@ return $unseen; } -?> +?> diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index 16b50a2e..f61b443f 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -107,6 +107,8 @@ ** The array returned looks like this: ******************************************************************************/ function sqimap_mailbox_list ($imap_stream) { + global $special_folders, $list_special_folders_first; + if (!function_exists ("ary_sort")) include ("../functions/array.php"); @@ -159,8 +161,16 @@ } $original = $boxes; + + /** Get the folders into lower case so sorting is not case sensative */ + for ($i = 0; $i < count($original); $i++) { + $boxes[$i]["unformatted"] = strtolower($boxes[$i]["unformatted"]); + } + + /** Sort them **/ $boxes = ary_sort($boxes, "unformatted", 1); - + + /** Get them back from the original array, still sorted by the id **/ for ($i = 0; $i < count($boxes); $i++) { for ($j = 0; $j < count($original); $j++) { if ($boxes[$i]["id"] == $original[$j]["id"]) { @@ -169,11 +179,14 @@ } } + for ($i = 0; $i < count($boxes); $i++) { if ($boxes[$i]["unformatted"] == $special_folders[0]) { $boxesnew[0] = $boxes[$i]; + $boxes[$i]["used"] = true; } } + if ($list_special_folders_first == true) { for ($i = 0; $i < count($boxes); $i++) { for ($j = 1; $j < count($special_folders); $j++) { @@ -185,6 +198,7 @@ } } } + for ($i = 0; $i < count($boxes); $i++) { if (($boxes[$i]["unformatted"] != $special_folders[0]) && ($boxes[$i]["used"] == false)) { @@ -194,7 +208,7 @@ } } - return $boxes; + return $boxesnew; } -?> +?> diff --git a/functions/imap_messages.php b/functions/imap_messages.php index ab986688..dbbdcce1 100755 --- a/functions/imap_messages.php +++ b/functions/imap_messages.php @@ -269,4 +269,4 @@ $body = $bodytmp; return decodeMime($body, $bound, $type0, $type1); } -?> +?> -- 2.25.1