Updated documentation, fixed sorting problems in folder list.
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 22 Feb 2000 11:47:08 +0000 (11:47 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 22 Feb 2000 11:47:08 +0000 (11:47 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@232 7612ce4b-ef26-0410-bec9-ea0150e637f0

ChangeLog
doc/index.html [new file with mode: 0644]
doc/message_array.html [moved from doc/message_array.doc with 90% similarity]
doc/sqimap.php3 [new file with mode: 0644]
doc/sqimap_config.php3 [new file with mode: 0644]
functions/imap_general.php
functions/imap_mailbox.php
functions/imap_messages.php

index df3776a695fe42dd0a4804daf19f56660715808d..1d8dc1c2075513793fecd8fd58c53fb4d32da6ab 100644 (file)
--- 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 (file)
index 0000000..bb570df
--- /dev/null
@@ -0,0 +1,36 @@
+<h2>SquirrelMail Documentation</h2>
+<p>
+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 <a href="lehresma@css.tayloru.edu">lehresma@css.tayloru.edu</a>.
+</p>
+
+
+<ul>
+   <a href="message_array.html">Message Array Format</a>
+   <ul>
+      When reading in a message from a mailbox, SquirrelMail shoves all the infomation into a
+      large array.  I have attempted to map out that array.  I have done my best to make this
+      accurate, but there probably are some inacuracies somewhere.
+   </ul>
+</ul>
+
+<ul>
+   <a href="sqimap.php3">SquirrelMail IMAP Functions</a>
+   <ul>
+      These are a collection of functions designed to replace the PHP imap functions so that you
+      don't have to compile in the UW IMAP server into your PHP distrobution.
+   </ul>
+</ul>
+
+<ul>
+   Basic documentation that comes with distrbution:
+   <ul>
+      <a href="../AUTHORS">AUTHORS</a><br>
+      <a href="../INSTALL">INSTALL</a><br>
+      <a href="../README">README</a><br>
+      <a href="../COPYING">COPYING</a><br>
+      <a href="../ChangeLog">ChangeLog</a><br>
+   </ul>
+</ul>   
similarity index 90%
rename from doc/message_array.doc
rename to doc/message_array.html
index 00593b360292b579f9d15a88c064e22ecf537931..ccd105b5c94efa4bd818181b455d083cfc1eec3c 100644 (file)
@@ -1,7 +1,10 @@
+<p>
 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).
+</p>
 
+<pre>
 $message     ["HEADER"]                    (array)
                 ["TO"]                     (array)
                 ["CC"]                     (array)
@@ -71,6 +74,7 @@ $message     ["HEADER"]
                      ["CHARSET"]             "us-ascii"
                      ["BOUNDARY"]            ""
                      ["PRIORITY"]            20
-                     ["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>"
+                     ["BODY"]                "&lt;B>This is just a test to see&lt;/B>&lt;BR>"
+                                             "&lt;FONT FACE="Arial,Helvetica">how this will handle a message"
+                                             "for this example&lt;/FONT>"
+</pre>                                             
diff --git a/doc/sqimap.php3 b/doc/sqimap.php3
new file mode 100644 (file)
index 0000000..59afe6e
--- /dev/null
@@ -0,0 +1,49 @@
+<a name="top"></a>
+<h1>SquirrelMail IMAP functions</h1>
+<?
+       include ("sqimap_config.php3");
+
+       echo "<ul>\n";
+       for ($i = 0; $i < count($name); $i++) {
+               echo "<ul>\n";
+               echo "   <a href=\"#$name[$i]\">sqimap_$name[$i]</a> $params[$i]\n";
+               echo "</ul>\n";
+       }
+       echo "</ul>\n";
+       
+       for ($i = 0; $i < count($name); $i++) {
+               ?>
+                       <br>
+                       <hr>
+                       <a name="<? echo $name[$i] ?>"></a>
+                       <h2>sqimap_<? echo $name[$i] ?></h2>
+         <a href="#top">go to top</a>
+                       <ul>
+                               Implementation:
+                               <ul>
+                                       <code>
+                                               sqimap_<? echo $name[$i] ?> <? echo $params[$i] ?> 
+                                       </code>
+                               </ul>
+                               Explanation:
+                               <ul>
+                                       <? echo $explain[$i] ?><br>
+                                       <br>
+                                       <?
+                                               for ($p = 0; $p < count($params_desc[$i]); $p++) {
+                                                       echo "<li><b>" . $params_desc[$i][$p]["name"] . "</b> - (".$params_desc[$i][$p]["type"].") &nbsp;&nbsp; " . $params_desc[$i][$p]["desc"] . "</li>\n";
+                                               }
+                                       ?>
+                               </ul>
+                               Example:
+                               <ul>
+                                       <code>
+                                               <? echo $example[$i] ?>
+                                       </code>
+                               </ul>
+                       </ul>
+                       
+                       <br>
+               <?
+       }
+?>
diff --git a/doc/sqimap_config.php3 b/doc/sqimap_config.php3
new file mode 100644 (file)
index 0000000..75237e2
--- /dev/null
@@ -0,0 +1,94 @@
+<?
+$imap_stream_def = "The imap stream returned from <a href=\"#login\">sqimap_login</a>";
+
+$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\");<br>";
+$example[0] .="\$read_ary = sqimap_read_data(\$imap_stream, \"a001\", true, $response, $message);<br>";
+$example[0] .="for (\$i = 0; \$i &lt; count(\$read_ary); \$i++) {<br>";
+$example[0] .="&nbsp;&nbsp;&nbsp;&nbsp;echo \$read_ary[\$i];<br>";
+$example[0] .="}<br>";
+
+
+$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] = "";
+*/
+?>
index fefae688a388328c03948b0d32b494df759d70dd..44da96654f8baa7ef51357574b06c160b89cee65 100755 (executable)
 
       return $unseen;
    }
-?>   
+?>
index 16b50a2e1d524f7fb0ee9241dbe55f7904ce3033..f61b443ff0941271dfab1d58eb531af52c39462e 100755 (executable)
     **  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");
       
       }
 
       $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"]) {
          }
       }     
  
+      
       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++) {
             }
          }
       }
+      
       for ($i = 0; $i < count($boxes); $i++) {
          if (($boxes[$i]["unformatted"] != $special_folders[0]) &&
              ($boxes[$i]["used"] == false))  {
          }
       }
 
-      return $boxes;
+      return $boxesnew;
    }
    
-?>   
+?>
index ab98668843ffcefffa0ed67fbf5b787cbd202dd1..dbbdcce13401148598d87ff48e1cc1995335326c 100755 (executable)
       $body = $bodytmp;
       return decodeMime($body, $bound, $type0, $type1);
    }
-?>   
+?>