Some fixup:
authorphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 20 Nov 2001 20:08:28 +0000 (20:08 +0000)
committerphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 20 Nov 2001 20:08:28 +0000 (20:08 +0000)
- Operation foo_once step 2 (and final)
- Create folders bugfix
- None folder bugfix
- Fixed some tabs, structs etc.
- Added some (c) stuff
- Removed some debug stuff

This changes should result in a faster SM.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1782 7612ce4b-ef26-0410-bec9-ea0150e637f0

38 files changed:
functions/addressbook.php
functions/array.php
functions/auth.php
functions/date.php
functions/db_prefs.php
functions/display_messages.php
functions/gettext.php
functions/i18n.php
functions/imap.php
functions/imap_general.php
functions/imap_mailbox.php
functions/imap_messages.php
functions/imap_search.php
functions/index.php
functions/mailbox_display.php
functions/mime.php
functions/page_header.php
functions/plugin.php
functions/prefs.php
functions/smtp.php
functions/strings.php
functions/tree.php
functions/url_parser.php
src/addressbook.php
src/compose.php
src/download.php
src/draft_actions.php
src/folders.php
src/folders_rename_getname.php
src/folders_subscribe.php
src/help.php
src/image.php
src/index.php
src/left_main.php
src/options.php
src/search.php
src/validate.php
src/vcard.php

index e1e13d8a512fa6bfab9bc5373972ad2a8e54588a..ca57150e08588187635b3d17445d2b997bec919f 100644 (file)
@@ -7,10 +7,7 @@
    **
    **  $Id$
    **/
-    
-   if (defined ('addressbook_php'))
-      return; 
-   define ('addressbook_php', true); 
+
 
    // This is the path to the global site-wide addressbook.
    // It looks and feels just like a user's .abook file
index e7d8237cf0df466e5b4cc0406e26b88c144ff610..d17662bbdb22bba67612bf1abbe30a124b49dc8a 100644 (file)
@@ -8,9 +8,6 @@
     *  $Id$
     */
 
-   if (defined ('array_php'))
-       return; 
-   define ('array_php', true); 
 
    function ary_sort($ary,$col, $dir = 1){
       // The globals are used because USORT determines what is passed to comp2
index 8cddd0024bde4860ca5deb4a99115fbdde26b3a0..7dd58a7a14a636405097bdb2564d8dd452b64c39 100644 (file)
@@ -1,33 +1,28 @@
 <?php
 
-/**
- ** auth.php
- **
- ** Contains functions used to do authentication.
- **
- ** $Id$
- **/
+    /**
   ** auth.php
   **
   ** Contains functions used to do authentication.
   **
   ** $Id$
   **/
 
-   if (defined ('auth_php'))
-      return; 
-   define ('auth_php', true);
-   
-   function is_logged_in () {
-      global $squirrelmail_language;
-      
-      if (session_is_registered('user_is_logged_in'))
-         return;
 
-      set_up_language($squirrelmail_language, true);
-      
-      echo "<html><body bgcolor=\"ffffff\">\n";
-      echo "<br><br>";
-      echo "<center>";
-      echo "<b>"._("You must be logged in to access this page.")."</b><br>";
-      echo "<a href=\"../src/login.php\" target=\"_top\">"._("Go to the login page")."</a>\n";
-      echo "</center>";
-      echo "</body></html>\n";
-      exit;
-   }
+    function is_logged_in () {
+        global $squirrelmail_language;
+
+        if ( session_is_registered('user_is_logged_in') )
+            return;
+
+        set_up_language($squirrelmail_language, true);
+
+        echo "<html><body bgcolor=\"ffffff\">\n" .
+            '<br><br>echo "<center><b>'.
+            _("You must be logged in to access this page.").'</b><br>'.
+            "<a href=\"../src/login.php\" target=\"_top\">"._("Go to the login page")."</a>\n".
+            "</center></body></html>\n";
+        exit;
+    }
 
 ?>
index e4c9b62a1c7739bf3cc70f48d96bc2876402d306..d822396b248bd63c647f2507d84f7e361bed6ad7 100644 (file)
     **  $Id$
     **/
 
-   if (defined ('date_php'))
-      return; 
-   define ('date_php', true);
-   
    // corrects a time stamp to be the local time
    function getGMTSeconds($stamp, $gmt) {
       global $invert_time;
index 6a606db74eebf50b652d392ec6a0a32a76c55d1b..e23f320f8b681023b16f03ca0a7bf702ac854a85 100644 (file)
     **  $Id$
     **/
 
-   if (defined('prefs_php'))
-       return;
-   define('prefs_php', true);
-
    require_once('DB.php');
 
    class dbPrefs {
       var $DSN   = 'mysql://user@host/database';
       var $table = 'userprefs';
-      
+
       var $dbh   = NULL;
       var $error = NULL;
 
       var $default = Array('chosen_theme'      => '../themes/default_theme.php',
-                          'show_html_default' => '0');
-      
+                           'show_html_default' => '0');
+
       function dbPrefs() {
-        $this->open();
+         $this->open();
       }
-      
+
       function open() {
-        if(isset($this->dbh)) return true;
-        $dbh = DB::connect($this->DSN, true);
-        
-        if(DB::isError($dbh) || DB::isWarning($dbh)) {
-           $this->error = DB::errorMessage($dbh);
-           return false;
-        }
-        
-        $this->dbh = $dbh;
-        return true;
+        if(isset($this->dbh)) return true;
+        $dbh = DB::connect($this->DSN, true);
+
+        if(DB::isError($dbh) || DB::isWarning($dbh)) {
+            $this->error = DB::errorMessage($dbh);
+            return false;
+        }
+
+        $this->dbh = $dbh;
+        return true;
       }
-      
+
 
       function failQuery($res = NULL) {
-        if($res == NULL) {
-           printf(_("Preference database error (%s). Exiting abnormally"),
-                  $this->error);
-        } else {
-           printf(_("Preference database error (%s). Exiting abnormally"),
-                  DB::errorMessage($res));
-        }
-        exit;
+        if($res == NULL) {
+            printf(_("Preference database error (%s). Exiting abnormally"),
+            $this->error);
+        } else {
+            printf(_("Preference database error (%s). Exiting abnormally"),
+            DB::errorMessage($res));
+        }
+        exit;
       }
 
 
       function getKey($user, $key) {
-        $this->open();
-        $query = sprintf("SELECT prefval FROM %s ".
-                         "WHERE user='%s' AND prefkey='%s'",
-                         $this->table, 
-                         $this->dbh->quoteString($user),
-                         $this->dbh->quoteString($key));
-
-        $res = $this->dbh->query($query);
-        if(DB::isError($res))
-           $this->failQuery($res);
-
-        if($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
-           return $row['prefval'];
-        } else {
-           if(isset($this->default[$key])) {
-              return $this->default[$key];
-           } else {
-              return '';
-           }
-        }
-
-        return '';
+        $this->open();
+        $query = sprintf("SELECT prefval FROM %s ".
+                "WHERE user='%s' AND prefkey='%s'",
+                $this->table,
+                $this->dbh->quoteString($user),
+                $this->dbh->quoteString($key));
+
+        $res = $this->dbh->query($query);
+        if(DB::isError($res))
+            $this->failQuery($res);
+
+        if($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
+            return $row['prefval'];
+        } else {
+            if(isset($this->default[$key])) {
+            return $this->default[$key];
+            } else {
+            return '';
+            }
+        }
+
+        return '';
       }
 
       function deleteKey($user, $key) {
-        $this->open();
-        $query = sprintf("DELETE FROM %s WHERE user='%s' AND prefkey='%s'",
-                         $this->table, 
-                         $this->dbh->quoteString($user),
-                         $this->dbh->quoteString($key));
+        $this->open();
+        $query = sprintf("DELETE FROM %s WHERE user='%s' AND prefkey='%s'",
+                $this->table,
+                $this->dbh->quoteString($user),
+                $this->dbh->quoteString($key));
 
-        $res = $this->dbh->simpleQuery($query);
-         if(DB::isError($res))
-           $this->failQuery($res);
+        $res = $this->dbh->simpleQuery($query);
+            if(DB::isError($res))
+            $this->failQuery($res);
 
-        if(substr($key, 0, 9) == 'highlight') {
-           $this->renumberHighlightList($user);
-        }
+        if(substr($key, 0, 9) == 'highlight') {
+            $this->renumberHighlightList($user);
+        }
 
-        return true;
+        return true;
       }
 
       function setKey($user, $key, $value) {
-        $this->open();
-        $query = sprintf("REPLACE INTO %s (user,prefkey,prefval) ".
-                         "VALUES('%s','%s','%s')",
-                         $this->table, 
-                         $this->dbh->quoteString($user),
-                         $this->dbh->quoteString($key),
-                         $this->dbh->quoteString($value));
-
-         $res = $this->dbh->simpleQuery($query);
-         if(DB::isError($res)) 
-           $this->failQuery($res);
-
-        return true;
+        $this->open();
+        $query = sprintf("REPLACE INTO %s (user,prefkey,prefval) ".
+                "VALUES('%s','%s','%s')",
+                $this->table,
+                $this->dbh->quoteString($user),
+                $this->dbh->quoteString($key),
+                $this->dbh->quoteString($value));
+
+            $res = $this->dbh->simpleQuery($query);
+            if(DB::isError($res))
+            $this->failQuery($res);
+
+        return true;
       }
 
-      
+
       /**
        ** When a highlight option is deleted the preferences module
        ** must renumber the list.  This should be done somewhere else,
-       ** but it is not, so....  
+       ** but it is not, so....
        **/
       function renumberHighlightList($user) {
-        $this->open();
-        $query = sprintf("SELECT * FROM %s WHERE user='%s' ".
-                         "AND prefkey LIKE 'highlight%%' ORDER BY prefkey",
-                         $this->table, 
-                         $this->dbh->quoteString($user));
-
-        $res = $this->dbh->query($query);
-         if(DB::isError($res))
-           $this->failQuery($res);
-
-        // Store old data in array
-        $rows = Array();
-        while($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) 
-           $rows[] = $row;
-
-        // Renumber keys of old data
-        $hilinum = 0;
-        for($i = 0; $i < count($rows) ; $i++) {
-           $oldkey = $rows[$i]['prefkey'];
-           $newkey = substr($oldkey, 0, 9) . $hilinum;
-           $hilinum++;
-
-           if($oldkey != $newkey) {
-              $query = sprintf("UPDATE %s SET prefkey='%s' WHERE user='%s' ".
-                               "AND prefkey='%s'", 
-                               $this->table,
-                               $this->dbh->quoteString($newkey),
-                               $this->dbh->quoteString($user),
-                               $this->dbh->quoteString($oldkey));
-              
-              $res = $this->dbh->simpleQuery($query);
-              if(DB::isError($res))
-                 $this->failQuery($res);
-           }
-        }
-
-        return;
+        $this->open();
+        $query = sprintf("SELECT * FROM %s WHERE user='%s' ".
+                "AND prefkey LIKE 'highlight%%' ORDER BY prefkey",
+                $this->table,
+                $this->dbh->quoteString($user));
+
+        $res = $this->dbh->query($query);
+            if(DB::isError($res))
+            $this->failQuery($res);
+
+        // Store old data in array
+        $rows = Array();
+        while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
+            $rows[] = $row;
+
+        // Renumber keys of old data
+        $hilinum = 0;
+        for($i = 0; $i < count($rows) ; $i++) {
+            $oldkey = $rows[$i]['prefkey'];
+            $newkey = substr($oldkey, 0, 9) . $hilinum;
+            $hilinum++;
+
+            if($oldkey != $newkey) {
+            $query = sprintf("UPDATE %s SET prefkey='%s' WHERE user='%s' ".
+                    "AND prefkey='%s'",
+                    $this->table,
+                    $this->dbh->quoteString($newkey),
+                    $this->dbh->quoteString($user),
+                    $this->dbh->quoteString($oldkey));
+
+            $res = $this->dbh->simpleQuery($query);
+            if(DB::isError($res))
+            $this->failQuery($res);
+            }
+        }
+
+        return;
       }
 
    } // end class dbPrefs
    function getPref($data_dir, $username, $string, $default ) {
       $db = new dbPrefs;
       if(isset($db->error)) {
-        printf(_("Preference database error (%s). Exiting abnormally"),
-               $db->error);
-        exit;
+        printf( _("Preference database error (%s). Exiting abnormally"),
+                $db->error);
+        exit;
       }
 
       return $db->getKey($username, $string);
       $db->deleteKey($username, $string);
       return;
    }
-   
+
    /** sets the pref, $string, to $set_to **/
    function setPref($data_dir, $username, $string, $set_to) {
       $db = new dbPrefs;
       if(isset($db->error))
-        $db->failQuery();
+         $db->failQuery();
 
       $db->setKey($username, $string, $set_to);
       return;
    function checkForPrefs($data_dir, $username) {
       $db = new dbPrefs;
       if(isset($db->error))
-        $db->failQuery();
+         $db->failQuery();
    }
 
    /** Writes the Signature **/
    function setSig($data_dir, $username, $string) {
       $db = new dbPrefs;
-      if(isset($db->error)) 
-        $db->failQuery();
+      if(isset($db->error))
+         $db->failQuery();
 
       $db->setKey($username, "___signature___", $string);
       return;
    function getSig($data_dir, $username) {
       $db = new dbPrefs;
       if(isset($db->error))
-        $db->failQuery();
+         $db->failQuery();
 
       return $db->getKey($username, "___signature___");
    }
index 7c787d3bc283345833de9c0fc5af6e8852c0231b..06bc2fcbbe2ac747b861cfd13dd3696954b91e64 100644 (file)
@@ -8,10 +8,6 @@
     ** $Id$
     **/
 
-    if (defined ('display_messages_php'))
-       return; 
-    define ('display_messages_php', true); 
-
     function error_username_password_incorrect($color) {
       echo '<BR>';
       echo " <TABLE COLS=1 WIDTH=75% NOBORDER BGCOLOR=\"$color[4]\" ALIGN=CENTER>";
index af05df9ad99279e0d1f5457aac7bd92f5ce87629..90da1db65fed1d77b44e95671c379131c8d64772 100644 (file)
@@ -9,10 +9,6 @@
     * Very special thanks to Konstantin Riabitsev for letting me use a
     * server that didn't already have gettext on it!
     */
-     
-   if (defined('gettext_php'))
-      return;
-   define('gettext_php', true);
    
    global $gettext_php_domain, $gettext_php_dir, $gettext_php_loaded,
       $gettext_php_translateStrings, $gettext_php_loaded_language,
index 992178de406c05838cd6c073168e8a102c05e7d7..22d83a8b82cb081a46366bf7798b0f6db909113c 100644 (file)
  ** $Id$
  **/
 
-   if (defined ('i18n_php'))
-      return; 
-   define ('i18n_php', true);
-
    global $squirrelmail_language, $languages;
    if (! isset($squirrelmail_language)) { $squirrelmail_language = ''; }
 
@@ -26,9 +22,9 @@
 
    /* PLEASE DON'T TOUCH!!!
     * Correct locale name, which should be set by setlocale and/or putenv('LC_ALL='...)
-       * is 'cs_CZ' and NOT 'cs', this applies to all locale names, look into docs, if you
-       * don't believe me.  Ondrej Sury, czech and slovak translator.
-       */
+    * is 'cs_CZ' and NOT 'cs', this applies to all locale names, look into docs, if you
+    * don't believe me.  Ondrej Sury, czech and slovak translator.
+    */
    $languages['cs_CZ']['NAME']    = 'Czech';
    $languages['cs_CZ']['CHARSET'] = 'iso-8859-2';
    $languages['cs']['ALIAS']      = 'cs_CZ';
      if ($my_charset) $default_charset=$my_charset;
    }
 
-?>
+?>
\ No newline at end of file
index fc65a68163ef76c96bec0d4378fa09cec282b246..384753f76886e45960307c56fe8e2a3af5ffc6e5 100644 (file)
@@ -1,18 +1,16 @@
 <?php
+
    /**  This just includes the different sections of the imap functions.
     **  They have been organized into these sections for simplicity sake.
     **
     **  $Id$
     **/
 
-   if (defined ('imap_php'))
-      return; 
-   define ('imap_php', true); 
-
    $imap_backend = 'imap';
-   
+
    require_once('../functions/' . $imap_backend . '_mailbox.php');
    require_once('../functions/' . $imap_backend . '_messages.php');
    require_once('../functions/' . $imap_backend . '_general.php');
    require_once('../functions/' . $imap_backend . '_search.php');
+
 ?>
\ No newline at end of file
index df3cf24dee11e82b2bcf79eac59a6bda3aff63c4..16f19b0ccb2bddc7526223e1846db17ab7e86fa2 100755 (executable)
     **  $Id$
     **/
 
-   if (defined ('imap_general_php'))
-      return;
-   define ('imap_general_php', true);
-
 global $imap_general_debug;
 $imap_general_debug = false;
 
index a0d3e7b602249bbe679db21e7536480200e48f33..35fe479e8fb098dac5bb540bf05b5588de2c3a8c 100755 (executable)
@@ -40,9 +40,9 @@
    function sqimap_mailbox_select ($imap_stream, $mailbox, $hide=true, $recent=false) {
       global $auto_expunge;
 
-      if( $mailbox == _("None") )
+      if( $mailbox == 'None' )
           return;
-      
+
       fputs ($imap_stream, sqimap_session_id() . " SELECT \"$mailbox\"\r\n");
              $read = sqimap_read_data($imap_stream, sqimap_session_id(), true, $response, $message);
       if ($recent) {
@@ -66,7 +66,7 @@
     ******************************************************************************/
    function sqimap_mailbox_create ($imap_stream, $mailbox, $type) {
       global $delimiter;
-      if (strtolower($type) == "noselect") {
+      if (strtolower($type) == 'noselect') {
          $mailbox = $mailbox.$delimiter;
       }
       fputs ($imap_stream, sqimap_session_id() . " CREATE \"$mailbox\"\r\n");
index 8cbf6ae2ef44fe9b28f718d132b89f361994e39d..8a1956c4e82d77efe5a561961d34fc766f1e1d8f 100755 (executable)
@@ -7,10 +7,6 @@
     **  $Id$
     **/
 
-   if (defined ('imap_messages_php'))
-       return;
-   define ('imap_messages_php', true);
-
    /******************************************************************************
     **  Copies specified messages to specified folder
     ******************************************************************************/
index a546b4e649801647573716a264e8f41ea7abc5e1..e65126fc06e24c16ddc5a08cf992cf4709061b03 100644 (file)
@@ -3,10 +3,6 @@
     ** IMAP SEARCH ROUTIES
     ** $Id$
     *****************************************************************/
-    
-   if (defined ('imap_search_php'))
-      return;
-   define ('imap_search_php', true);
    
    require_once('../functions/imap.php');
    require_once('../functions/date.php');
index 9d9ed2ca6618c108a7fac708dc9415edd07d972a..a7e265088bad49796e37fd55793094819dadebb8 100644 (file)
@@ -1,14 +1,14 @@
 <?php
-/**
- ** index.php
- **
- ** This file simply takes any attempt to view source files
- ** and sends those people to the login screen. At this
- ** point no attempt is made to see if the person is logged
- ** or not.
- **/
+    /**
   ** index.php
   **
   ** This file simply takes any attempt to view source files
   ** and sends those people to the login screen. At this
   ** point no attempt is made to see if the person is logged
   ** or not.
   **/
 
-header("Location:../index.php");
+    header("Location:../index.php");
 
-/** pretty impressive huh? **/
+    /** pretty impressive huh? **/
 ?>
index 7aa739e61f21818420b16f78ceddb0285d94065a..d0f620131b93e1d91b6daa048bb0c9514107d8da 100644 (file)
     * $Id$
     */
 
-   if (defined('mailbox_display_php'))
-       return;
-   define('mailbox_display_php', true);
-
    define('PG_SEL_MAX', 10);  /* Default value for page_selector_max. */
 
    function printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $start_msg, $where, $what) {
@@ -39,7 +35,7 @@
       $msg = $msgs[$key];
 
       $senderName = htmlspecialchars(sqimap_find_displayable_name($msg['FROM']));
-      if( $mailbox == _("None") ) {
+      if( $mailbox == 'None' ) {
          // $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
          $boxes = sqimap_mailbox_list($imapConnection);
          // sqimap_logout($imapConnection);
index 74dd9258d1d25ac2c39710b7ded9d5e8a5e6ffc0..750a48ae4eb81e8236cc74ad5a035d5ff3b89fea 100644 (file)
@@ -7,10 +7,6 @@
     ** $Id$
     **/
 
-   if (defined('mime_php'))
-      return;
-   define('mime_php', true);
-
    require_once('../functions/imap.php');
    require_once('../functions/attachment_common.php');
 
index f6ab137fc41a9fb016b5b305c0b6f079f6522592..e664170e26bbfeec19b360a492fdbd594bbcf6a3 100644 (file)
@@ -7,10 +7,6 @@
     **  $Id$
     **/
 
-   if (defined('page_header_php'))
-       return;
-   define('page_header_php', true);
-
    // Always set up the language before calling these functions
 
    function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE ) {
index de8d4687eceddd5a94c660b607774c6aadb4fa5e..7d209e844818d68e3feeca9676d0921db57f561b 100644 (file)
@@ -1,90 +1,63 @@
 <?php
 
-/**
- ** plugin.php
- **
- ** This file provides the framework for a plugin architecture.
- **
- ** Plugins will eventually be a way to provide added functionality
- ** without having to patch the SquirrelMail source code. Have some
- ** patience, though, as the these funtions might change in the near
- ** future.
- **
- ** Documentation on how to write plugins might show up some time.
- **
- ** $Id$
- **/
-
-
-   if (defined('plugin_php'))
-      return;
-   define('plugin_php', true);
-
-   global $plugin_general_debug, $squirrelmail_plugin_hooks;
-   $plugin_general_debug = false;
-   
-   $squirrelmail_plugin_hooks = array();
-
-   // This function adds a plugin
-   function use_plugin ($name) {
-      global $plugin_general_debug;
-      
-      if (file_exists('../plugins/'.$name.'/setup.php')) {
-         if ($plugin_general_debug)
-           echo "plugin:  --  Loading $name/setup.php<br>\n";
-         include_once('../plugins/'.$name.'/setup.php');
-         $function = 'squirrelmail_plugin_init_'.$name;
-         if (function_exists($function))
-        {
-           if ($plugin_general_debug)
-              echo "plugin:  ---- Executing $function to init plugin<br>\n";
-            $function($plugin_general_debug);
-        }
-        elseif ($plugin_general_debug)
-           echo "plugin:  -- Init function $function doesn't exist.<br>\n";
-      }
-      elseif ($plugin_general_debug)
-         echo "plugin:  Couldn't find $name/setup.php<br>\n";
-   }
-
-   // This function executes a hook
-   function do_hook ($name) {
-      global $squirrelmail_plugin_hooks;
-      $Data = func_get_args();
-      if (isset($squirrelmail_plugin_hooks[$name]) && 
-          is_array($squirrelmail_plugin_hooks[$name])) {
-         foreach ($squirrelmail_plugin_hooks[$name] as $id => $function) {
-            // Add something to set correct gettext domain for plugin
+    /**
+    ** plugin.php
+    **
+    ** This file provides the framework for a plugin architecture.
+    **
+    ** Plugins will eventually be a way to provide added functionality
+    ** without having to patch the SquirrelMail source code. Have some
+    ** patience, though, as the these funtions might change in the near
+    ** future.
+    **
+    ** Documentation on how to write plugins might show up some time.
+    **
+    ** $Id$
+    **/
+
+    global $squirrelmail_plugin_hooks;
+
+    $squirrelmail_plugin_hooks = array();
+
+    // This function adds a plugin
+    function use_plugin ($name) {
+
+        if (file_exists('../plugins/'.$name.'/setup.php')) {
+            include_once('../plugins/'.$name.'/setup.php');
+            $function = 'squirrelmail_plugin_init_'.$name;
             if (function_exists($function)) {
-                $function($Data);
+                $function();
+            }
+        }
+
+    }
+
+    // This function executes a hook
+    function do_hook ($name) {
+        global $squirrelmail_plugin_hooks;
+        $Data = func_get_args();
+        if (isset($squirrelmail_plugin_hooks[$name]) &&
+            is_array($squirrelmail_plugin_hooks[$name])) {
+            foreach ($squirrelmail_plugin_hooks[$name] as $function) {
+                // Add something to set correct gettext domain for plugin
+                if (function_exists($function)) {
+                    $function($Data);
+                }
             }
-         }
-      }
-      
-      // Variable-length argument lists have a slight problem when
-      // passing values by reference.  Pity.  This is a workaround.
-      return $Data;
-  }
+        }
+
+        // Variable-length argument lists have a slight problem when
+        // passing values by reference.  Pity.  This is a workaround.
+        return $Data;
+    }
 
-   // On startup, register all plugins configured for use
-   if (isset($plugins) && is_array($plugins))
-      foreach ($plugins as $id => $name)
-      {
-         if ($plugin_general_debug)
-           echo "plugin:  Attempting load of plugin $name<br>\n";
-         use_plugin($name);
-      }
+    /* -------------------- MAIN --------------------- */
 
-   if ($plugin_general_debug)
-   {
-      echo "plugin:  Hook list<br>\n";
-      foreach ($squirrelmail_plugin_hooks as $Hook => $Plugins)
-      {
-          foreach ($Plugins as $Name => $Func)
-         {
-             echo "[$Hook][$Name] = $Func<br>\n";
-         }
-      }
-   }
+    // On startup, register all plugins configured for use
+    if (isset($plugins) && is_array($plugins)) {
+        foreach ($plugins as $name) {
+            use_plugin($name);
+        }
+    }
 
 ?>
\ No newline at end of file
index 4f9d2a6871b81b03e75a8d6925760a686e8ea8b9..210e9e3cdee59da7dd3cdd73a5270660d10c180b 100644 (file)
@@ -7,10 +7,6 @@
     **  $Id$
     **/
 
-   if (defined('prefs_php'))
-      return;
-   define('prefs_php', true);
-
    global $prefs_are_cached, $prefs_cache;
    if (!session_is_registered('prefs_are_cached')) {
       $prefs_are_cached = false;
index 92ab7f72a91538a4a1740c9cad233c7e6b80a55c..c2b433078c08fcf3e7bae13351c0a2abe3aa6024 100644 (file)
@@ -7,10 +7,6 @@
     ** $Id$
     **/
 
-   if (defined('smtp_php'))
-      return;
-   define('smtp_php', true);
-
    require_once('../functions/addressbook.php');
    require_once('../functions/plugin.php');
 
index b3c2f763be77b5858d16f00a8e5a882ee0ef6af6..4cd1388ae304e4b7f00f1c3fc0682742d36cb8a0 100644 (file)
@@ -10,9 +10,6 @@
     * $Id$
     */
 
-    if (defined('strings_php')) { return; }
-    define('strings_php', true);
-
    /**
     * SquirrelMail version number -- DO NOT CHANGE
     */
index d218e29b71a76ec666da324fdbea82cae16727ec..3e139252a3b261827406b9b9208fa6aac3026768 100644 (file)
@@ -1,10 +1,15 @@
 <?php
 
-   /* $Id$ */
-
-   if (defined('tree_php'))
-       return;
-   define('tree_php', true);
+   /**
+    * tree.php
+    * Copyright (c) 1999-2001 The Squirrelmail Development Team
+    * Licensed under the GNU GPL. For full terms see the file COPYING.
+    *
+    * This code provides various string manipulation functions that are
+    * used by the rest of the Squirrelmail code.
+    *
+    * $Id$
+    */
 
    require_once('../functions/imap.php');
 
index 2fb2d3a67450725354f0384b08b6023a9fea1257..37b022c4d29738e98a30891a64438bbfe8c89620 100644 (file)
@@ -1,10 +1,15 @@
 <?php
-   /* URL Passing code to allow links from with in emails */
-   /* $Id$ */
 
-   if (defined('url_parser_php'))
-      return;
-   define('url_parser_php', true);
+   /**
+    * url_parser.php
+    * Copyright (c) 1999-2001 The Squirrelmail Development Team
+    * Licensed under the GNU GPL. For full terms see the file COPYING.
+    *
+    * This code provides various string manipulation functions that are
+    * used by the rest of the Squirrelmail code.
+    *
+    * $Id$
+    */
 
    function replaceBlock (&$in, $replace, $start, $end) {
       $begin = substr($in,0,$start);
index e769db09bada5a444dbb70959b2a598304e6f3d2..818c0b120cb2657c4ec45a6238240ffbed753af5 100644 (file)
@@ -18,9 +18,9 @@
    // Sort array by the key "name"
    function alistcmp($a,$b) {   
       if($a['backend'] > $b['backend']) 
-        return 1;
-      else if($a['backend'] < $b['backend']) 
-        return -1;
+         return 1;
+      else if($a['backend'] < $b['backend'])
+         return -1;
       
       return (strtolower($a['name']) > strtolower($b['name'])) ? 1 : -1;
    }
index 5e1e910eeead1a2b0193d9e856457bba01c36f42..b2bae15f448a1cbc6d74d5be09261467f64c7228 100644 (file)
       $attachments[] = $newAttachment;
     }
 
-   if (!isset($mailbox) || $mailbox == "" || ($mailbox == "None"))
+   if (!isset($mailbox) || $mailbox == '' || ($mailbox == 'None'))
       $mailbox = "INBOX";
 
    if (isset($draft)) {
index 1d73a47b061edc8c0baf503eada29a3f64d3d27f..820ac207d2c608b0639302684badc4cb5d27fc09 100644 (file)
@@ -25,7 +25,7 @@
       global $where, $what, $charset;
       global $startMessage;
       
-      displayPageHeader($color, "None");
+      displayPageHeader($color, 'None');
 
       echo "<BR><TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER><TR><TD BGCOLOR=\"$color[0]\">";
       echo "<B><CENTER>";
index dff29f790c9727e6d13739475b1fc6a512864a70..76869cf2e289d25796a5478118c451fc4f44b8e1 100644 (file)
@@ -1,5 +1,16 @@
 <?php
-require_once ('../src/validate.php');
+
+   /**
+    **  draft_actions.php
+    **
+    **  Copyright (c) 1999-2000 The SquirrelMail development team
+    **  Licensed under the GNU GPL. For full terms see the file COPYING.
+    **
+    **
+    **  $Id$
+    **/
+
+    require_once ('../src/validate.php');
 
    /* Print all the needed RFC822 headers */
    function write822HeaderForDraft ($fp, $t, $c, $b, $subject, $more_headers) {
index 34dc7f45906da04a55419a0b582e3cba5a1d80ae..8d7c9c875f47917fe04d7f0e0a6b4bbddd36700a 100644 (file)
@@ -17,7 +17,7 @@
    require_once('../functions/array.php');
    require_once('../functions/plugin.php');
 
-   displayPageHeader($color, _("None"));
+   displayPageHeader($color, 'None');
 
 ?>
 
index c297f146e3b4d932b3d42bd1397e6cfa882e7881..d86bd4fb7d17c74ad15547995fb9aa63b0c843ff 100644 (file)
@@ -30,7 +30,7 @@
       $old_parent = "";
    }
 
-   displayPageHeader($color, "None");
+   displayPageHeader($color, 'None');
    echo "<br><TABLE align=center border=0 WIDTH=95% COLS=1>";
    echo "<TR><TD BGCOLOR=\"$color[0]\" ALIGN=CENTER><B>";
    echo _("Rename a folder");
index 6f3879860359dc618b49c69a0e8c01eaa495c315..c000722cbc37d2b191b23394a854d1e61e2d88c0 100644 (file)
@@ -37,7 +37,7 @@
    sqimap_logout($imapConnection);
 
    /*
-   displayPageHeader($color, "None");
+   displayPageHeader($color, 'None');
    echo "<BR><BR><BR><CENTER><B>";
    if ($method == "sub") {
       echo _("Subscribed Successfully!");
index 67aa1c0d530ac7dfc0f3dc423f9b4eaecfdabdfe..262d2979ee0ee839e4a6e53f82fb5811f5f46303 100644 (file)
    require_once('../functions/array.php');
 
 
-   displayPageHeader($color, "None");
-
-       $helpdir[0] = "basic.hlp";
-       $helpdir[1] = "main_folder.hlp";
-       $helpdir[2] = "read_mail.hlp";
-       $helpdir[3] = "compose.hlp";
-       $helpdir[4] = "addresses.hlp";
-       $helpdir[5] = "folders.hlp";
-       $helpdir[6] = "options.hlp";
-       $helpdir[7] = "search.hlp";
-       $helpdir[8] = "FAQ.hlp";
+   displayPageHeader($color, 'None' );
+
+   $helpdir[0] = 'basic.hlp';
+   $helpdir[1] = 'main_folder.hlp';
+   $helpdir[2] = 'read_mail.hlp';
+   $helpdir[3] = 'compose.hlp';
+   $helpdir[4] = 'addresses.hlp';
+   $helpdir[5] = 'folders.hlp';
+   $helpdir[6] = 'options.hlp';
+   $helpdir[7] = 'search.hlp';
+   $helpdir[8] = 'FAQ.hlp';
 
    /****************[ HELP FUNCTIONS ]********************/
-   // parses through and gets the information from the different documents.  
+   // parses through and gets the information from the different documents.
    // this returns one section at a time.  You must keep track of the position
    // so that it knows where to start to look for the next section.
 
                   $ary[0] = trim($doc[$n]);
                }
                if (trim(strtolower($doc[$n])) == "<description>") {
-                 $ary[1] = "";
+                  $ary[1] = "";
                   for ($n++;$n < count($doc) && (trim(strtolower($doc[$n])) != "</description>"); $n++) {
                      $ary[1] .= $doc[$n];
                   }
                }
                if (trim(strtolower($doc[$n])) == "<summary>") {
-                 $ary[2] = "";
+                  $ary[2] = "";
                   for ($n++;$n < count($doc) && (trim(strtolower($doc[$n])) != "</summary>"); $n++) {
                      $ary[2] .= $doc[$n];
                   }
                }
-            }   
+            }
             if (isset($ary)) {
                $ary[3] = $n;
                return $ary;
                $ary[1] = "ERROR: Help files are not in the right format!";
                $ary[2] = "ERROR: Help files are not in the right format!";
                return $ary;
-            }   
+            }
          }
       }
       $ary[0] = "ERROR: Help files are not in the right format!";
       $ary[1] = "ERROR: Help files are not in the right format!";
       return $ary;
    }
-   
+
    /**************[ END HELP FUNCTIONS ]******************/
 
 ?>
    if ($HTTP_REFERER) {
       $ref = strtolower($HTTP_REFERER);
       if (strpos($ref, "src/compose"))
-         $context = "compose"; 
+         $context = "compose";
       else if (strpos($ref, "src/addr"))
-         $context = "address"; 
+         $context = "address";
       else if (strpos($ref, "src/folders"))
-         $context = "folders"; 
+         $context = "folders";
       else if (strpos($ref, "src/options"))
-         $context = "options"; 
+         $context = "options";
       else if (strpos($ref, "src/right_main"))
-         $context = "index"; 
+         $context = "index";
       else if (strpos($ref, "src/read_body"))
-         $context = "read"; 
+         $context = "read";
       else if (strpos($ref, "src/search"))
-         $context = "search"; 
+         $context = "search";
    }
-   
+
    if (!$squirrelmail_language)
       $squirrelmail_language = "en";
 
       echo "</td></tr></table>";
       exit;
    }
-   
+
    if ($help_exists) {
       if (! isset($context))
           $context = '';
          echo "<font size=5><b>$chapter - $help_info[0]</b></font><br><br>\n";
          if (isset($help_info[1]))
             echo "$help_info[1]\n";
-         else   
+         else
             echo "<p>$help_info[2]</p>\n";
 
          $section = 0;
          echo "<br><center><a href=\"#pagetop\">" . _("Top") . "</a></center>\n";
       }
    }
-   do_hook("help_bottom"); 
+   do_hook("help_bottom");
 ?>
 <tr><td bgcolor="<?php echo $color[0] ?>">&nbsp;</td></tr></table>
 <td></tr></table>
index 8ae17e0a886c2ced884bb153dea725219f516ac4..b575dc14659af4f5fe37dede71b4640f33bbb945 100644 (file)
@@ -1,11 +1,14 @@
 <?php
-/**
- ** image.php
- **
- ** This file shows an attached image
- **
- ** $Id$
- **/
+    /**
+    ** image.php
+    **
+    **  Copyright (c) 1999-2000 The SquirrelMail development team
+    **  Licensed under the GNU GPL. For full terms see the file COPYING.
+    **
+    ** This file shows an attached image
+    **
+    ** $Id$
+    **/
 
    require_once('../src/validate.php');
    require_once('../functions/date.php');
index 1a4ae4455ae7ea1482c963da745b53316c62d0a5..0ed708928a236b511d88976297845775319d744c 100644 (file)
@@ -1,14 +1,14 @@
 <?php
-/**
- ** index.php
- **
- ** This file simply takes any attempt to view index of files
- ** and sends those people to the login screen. At this
- ** point no attempt is made to see if the person is logged
- ** or not.
- **/
+    /**
   ** index.php
   **
   ** This file simply takes any attempt to view index of files
   ** and sends those people to the login screen. At this
   ** point no attempt is made to see if the person is logged
   ** or not.
   **/
 
-header("Location:../index.php");
+    header("Location:../index.php");
 
-/** pretty impressive huh? **/
+    /** pretty impressive huh? **/
 ?>
index 0d48932ea693ab729378f09fb8d2534eed105bd1..af7d09ff78b86c2b12c3840f6257917f34d9d0b5 100644 (file)
@@ -1,6 +1,7 @@
 <?php
    /**
     * left_main.php
+    *
     * Copyright (c) 1999-2001 The Squirrelmail Development Team
     * Licensed under the GNU GPL. For full terms see the file COPYING.
     *
     require_once('../functions/array.php');
     require_once('../functions/imap.php');
     require_once('../functions/plugin.php');
+    require_once('../functions/page_header.php');
 
     /* These constants are used for folder stuff. */
     define('SM_BOX_UNCOLLAPSED', 0);
     define('SM_BOX_COLLAPSED',   1);
 
-    global $delimiter;
+/* --------------------- FUNCTIONS ------------------------- */
 
-    // open a connection on the imap port (143)
-    $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output
+    function formatMailboxName($imapConnection, $box_array) {
+        global $folder_prefix, $trash_folder, $sent_folder;
+        global $color, $move_to_sent, $move_to_trash;
+        global $unseen_notify, $unseen_type, $collapse_folders;
+        global $draft_folder, $save_as_draft;
+        global $use_special_folder_color;
 
-    displayHtmlHeader();
+        $real_box = $box_array['unformatted'];
+        $mailbox = str_replace('&nbsp;','',$box_array['formatted']);
+        $mailboxURL = urlencode($real_box);
 
-    /* If requested and not yet complete, attempt to autocreate folders. */
-    if ($auto_create_special && ! isset($auto_create_done)) {
-        /* Autocreate the sent folder, if needed. */
-        if (isset ($sent_folder) && $sent_folder != 'none') {
-            if (!sqimap_mailbox_exists ($imapConnection, $sent_folder)) {
-                sqimap_mailbox_create ($imapConnection, $sent_folder, '');
-            } else if (! sqimap_mailbox_is_subscribed($imapConnection, $sent_folder)) {
-                sqimap_subscribe($imapConnection, $sent_folder);
-            }
+        /* Strip down the mailbox name. */
+        if (ereg("^( *)([^ ]*)$", $mailbox, $regs)) {
+            $mailbox = $regs[2];
         }
 
-            /* Autocreate the trash folder, if needed. */
-        if (isset ($trash_folder) && $trash_folder != 'none') {
-            if (!sqimap_mailbox_exists ($imapConnection, $trash_folder)) {
-                sqimap_mailbox_create ($imapConnection, $trash_folder, '');
-            } else if (! sqimap_mailbox_is_subscribed($imapConnection, $trash_folder)) {
-                sqimap_subscribe($imapConnection, $trash_folder);
+        $unseen = 0;
+
+        if (($unseen_notify == 2 && $real_box == 'INBOX') ||
+            $unseen_notify == 3) {
+            $unseen = sqimap_unseen_messages($imapConnection, $real_box);
+            if ($unseen_type == 1 && $unseen > 0) {
+                $unseen_string = "($unseen)";
+                $unseen_found = true;
+            } else if ($unseen_type == 2) {
+                $numMessages = sqimap_get_num_messages($imapConnection, $real_box);
+                $unseen_string = "<font color=\"$color[11]\">($unseen/$numMessages)</font>";
+                $unseen_found = true;
             }
         }
 
-        /* Autocreate the drafts folder, if needed. */
-        if (isset ($draft_folder) && $draft_folder != 'none') {
-            if (!sqimap_mailbox_exists ($imapConnection, $draft_folder)) {
-                sqimap_mailbox_create ($imapConnection, $draft_folder, '');
-            } else if (! sqimap_mailbox_is_subscribed($imapConnection, $draft_folder)) {
-                sqimap_subscribe($imapConnection, $draft_folder);
+        $special_color = false;
+        if ($use_special_folder_color) {
+            if ((strtolower($real_box) == 'inbox')
+                    || (($real_box == $trash_folder) && ($move_to_trash))
+                    || (($real_box == $sent_folder) && ($move_to_sent))
+                    || (($real_box == $draft_folder) && ($save_as_draft))) {
+                $special_color = true;
             }
         }
 
-          /* Let the world know that autocreation is complete! Hurrah! */
-        $auto_create_done = true;
-        session_register('auto_create_done');
-    }
+        /* Start off with a blank line. */
+        $line = '';
 
-   function formatMailboxName($imapConnection, $box_array) {
-      global $folder_prefix, $trash_folder, $sent_folder;
-      global $color, $move_to_sent, $move_to_trash;
-      global $unseen_notify, $unseen_type, $collapse_folders;
-      global $draft_folder, $save_as_draft;
-      global $use_special_folder_color;
-
-      $real_box = $box_array['unformatted'];
-      $mailbox = str_replace('&nbsp;','',$box_array['formatted']);
-      $mailboxURL = urlencode($real_box);
-
-      /* Strip down the mailbox name. */
-      if (ereg("^( *)([^ ]*)$", $mailbox, $regs)) {
-          $mailbox = $regs[2];
-      }
-
-      $unseen = 0;
-
-      if (($unseen_notify == 2 && $real_box == 'INBOX') ||
-          $unseen_notify == 3) {
-         $unseen = sqimap_unseen_messages($imapConnection, $real_box);
-         if ($unseen_type == 1 && $unseen > 0) {
-            $unseen_string = "($unseen)";
-            $unseen_found = true;
-         } else if ($unseen_type == 2) {
-            $numMessages = sqimap_get_num_messages($imapConnection, $real_box);
-            $unseen_string = "<font color=\"$color[11]\">($unseen/$numMessages)</font>";
-            $unseen_found = true;
-         }
-      }
-      
-      $special_color = false;
-      if ($use_special_folder_color) {
-          if ((strtolower($real_box) == 'inbox')
-                || (($real_box == $trash_folder) && ($move_to_trash))
-                || (($real_box == $sent_folder) && ($move_to_sent))
-                || (($real_box == $draft_folder) && ($save_as_draft))) {
-              $special_color = true;
-          }
-      }
-         
-      /* Start off with a blank line. */
-      $line = '';
-
-      /* If there are unseen message, bold the line. */      
-      if ($unseen > 0) { $line .= '<B>'; }
-
-      /* Crate the link for this folder. */
-      $line .= "<A HREF=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" TARGET=\"right\" STYLE=\"text-decoration:none\">";
-      if ($special_color == true)
-         $line .= "<FONT COLOR=\"$color[11]\">";
-      $line .= str_replace(' ','&nbsp;',$mailbox);
-      if ($special_color == true)
-         $line .= "</FONT>";
-      $line .= '</A>';
-
-      /* If there are unseen message, close bolding. */
-      if ($unseen > 0) { $line .= "</B>"; }
-
-      /* Print unseen information. */
-      if (isset($unseen_found) && $unseen_found) {
-         $line .= "&nbsp;<SMALL>$unseen_string</SMALL>";
-      }
-
-      if (($move_to_trash == true) && ($real_box == $trash_folder)) {
-         if (! isset($numMessages)) {
-            $numMessages = sqimap_get_num_messages($imapConnection, $real_box);
-         }
-
-         if ($numMessages > 0) {
-            $urlMailbox = urlencode($real_box);
-            $line .= "\n<small>\n";
-            $line .= "&nbsp;&nbsp;(<A HREF=\"empty_trash.php\" style=\"text-decoration:none\">"._("empty")."</A>)";
-            $line .= "\n</small>\n";
-         }
-      }
-
-      /* Return the final product. */
-      return ($line);
-   }
-
-   /**********************************/
-   /* END OF FUNCTION - BACK TO MAIN */
-   /**********************************/
+        /* If there are unseen message, bold the line. */
+        if ($unseen > 0) { $line .= '<B>'; }
 
-    if (isset($left_refresh) && ($left_refresh != 'none') && ($left_refresh != '')) {
-        echo "<META HTTP-EQUIV=\"Expires\" CONTENT=\"Thu, 01 Dec 1994 16:00:00 GMT\">\n";
-        echo "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n"; 
-        echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"$left_refresh;URL=left_main.php\">\n";
-    }
-   
-    echo "\n<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" LINK=\"$color[6]\" VLINK=\"$color[6]\" ALINK=\"$color[6]\">\n";
+        /* Crate the link for this folder. */
+        $line .= "<A HREF=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" TARGET=\"right\" STYLE=\"text-decoration:none\">";
+        if ($special_color == true)
+            $line .= "<FONT COLOR=\"$color[11]\">";
+        $line .= str_replace(' ','&nbsp;',$mailbox);
+        if ($special_color == true)
+            $line .= "</FONT>";
+        $line .= '</A>';
 
-    do_hook("left_main_before");
+        /* If there are unseen message, close bolding. */
+        if ($unseen > 0) { $line .= "</B>"; }
 
-    $boxes = sqimap_mailbox_list($imapConnection);
+        /* Print unseen information. */
+        if (isset($unseen_found) && $unseen_found) {
+            $line .= "&nbsp;<SMALL>$unseen_string</SMALL>";
+        }
 
-    echo '<CENTER><FONT SIZE=4><B>';
-    echo _("Folders") . "</B><BR></FONT>\n\n";
+        if (($move_to_trash == true) && ($real_box == $trash_folder)) {
+            if (! isset($numMessages)) {
+                $numMessages = sqimap_get_num_messages($imapConnection, $real_box);
+            }
 
-    if ($date_format != 6) { 
-        /* First, display the clock. */
-        if ($hour_format == 1) {
-          if ($date_format == 4) {
-             $hr = "G:i:s";
-          } else {
-             $hr = "G:i";
-          }
-        } else {  
-          if ($date_format == 4) {
-             $hr = "g:i:s a";
-          } else {
-             $hr = "g:i a";
-          }
+            if ($numMessages > 0) {
+                $urlMailbox = urlencode($real_box);
+                $line .= "\n<small>\n" .
+                        "&nbsp;&nbsp;(<A HREF=\"empty_trash.php\" style=\"text-decoration:none\">"._("empty")."</A>)" .
+                        "\n</small>\n";
+            }
         }
-    
-       switch( $date_format ) {
-       case 1:
-         $clk = date("m/d/y ".$hr, time()); 
-         break;
-       case 2:
-         $clk = date("d/m/y ".$hr, time()); 
-         break;
-       case 4:
-       case 5:
-         $clk = date($hr, time()); 
-         break;
-       default:   
-         $clk = date("D, ".$hr, time());
-       }
-       $clk = str_replace(' ','&nbsp;',$clk);
-
-       echo '<CENTER><SMALL>' . str_replace(' ','&nbsp;',_("Last Refresh"))
-         .  ": $clk</SMALL></CENTER>";
+
+        /* Return the final product. */
+        return ($line);
     }
 
-    /* Next, display the refresh button. */
-    echo '<SMALL>(<A HREF="../src/left_main.php" TARGET="left">';
-    echo _("refresh folder list");
-    echo '</A>)</SMALL></CENTER><BR>';
+    /**
+     * Recursive function that computes the collapsed status and parent
+     * (or not parent) status of this box, and the visiblity and collapsed
+     * status and parent (or not parent) status for all children boxes.
+     */
+    function compute_folder_children(&$parbox, $boxcount) {
+        global $boxes, $data_dir, $username, $collapse_folders;
+        $nextbox = $parbox + 1;
 
-    /* Lastly, display the folder list. */
-    if (isset($collapse_folders) && $collapse_folders ) {
-        /* If directed, collapse or uncollapse a folder. */
-        if (isset($fold)) {
-            setPref($data_dir, $username, 'collapse_folder_' . $fold, SM_BOX_COLLAPSED);
-        } else if (isset($unfold)) {
-            setPref($data_dir, $username, 'collapse_folder_' . $unfold, $SM_BOX_UNCOLLAPSED);
+        /* Retreive the name for the parent box. */
+        $parbox_name = $boxes[$parbox]['unformatted'];
+
+        /* 'Initialize' this parent box to childless. */
+        $boxes[$parbox]['parent'] = false;
+
+        /* Compute the collapse status for this box. */
+        if( isset($collapse_folders) && $collapse_folders ) {
+            $collapse = getPref($data_dir, $username, 'collapse_folder_' . $parbox_name);
+            $collapse = ($collapse == '' ? SM_BOX_UNCOLLAPSED : $collapse);
+        } else {
+            $collapse = SM_BOX_UNCOLLAPSED;
         }
-    }
+        $boxes[$parbox]['collapse'] = $collapse;
 
-    /* Prepare do do out collapsedness and visibility computation. */
-    $curbox = 0;
-    $boxcount = count($boxes);
+        /* Otherwise, get the name of the next box. */
+        if (isset($boxes[$nextbox]['unformatted']))
+            $nextbox_name = $boxes[$nextbox]['unformatted'];
+        else
+            $nextbox_name = '';
 
-    /* Compute the collapsedness and visibility of each box. */
-    while ($curbox < $boxcount) {
-        $boxes[$curbox]['visible'] = true;
-        compute_folder_children($curbox, $boxcount);
-    }
-  
-    for ($i = 0;$i < count($boxes); $i++) {
-        if ($boxes[$i]['visible'] == true) {
-            $mailbox = $boxes[$i]['formatted'];
-            $mblevel = substr_count($boxes[$i]['unformatted'], $delimiter) + 1;
+        /* Compute any children boxes for this box. */
+        while (($nextbox < $boxcount) &&
+               (is_parent_box($boxes[$nextbox]['unformatted'], $parbox_name))) {
 
-            /* Create the prefix for the folder name and link. */
-            $prefix = str_repeat('  ',$mblevel);
-            if (isset($collapse_folders) && $collapse_folders && $boxes[$i]['parent']) {
-                $prefix = str_replace(' ','&nbsp;',substr($prefix,0,strlen($prefix)-2));
-                $prefix .= create_collapse_link($i) . '&nbsp;';
-            } else {
-                $prefix = str_replace(' ','&nbsp;',$prefix);
-            }
-            $line = "<NOBR><TT>$prefix</TT>";
+            /* Note that this 'parent' box has at least one child. */
+            $boxes[$parbox]['parent'] = true;
 
-            /* Add the folder name and link. */
-            if (in_array('noselect', $boxes[$i]['flags'])) {
-                $line .= "<FONT COLOR=\"$color[10]\">";
-                if (ereg("^( *)([^ ]*)", $mailbox, $regs)) {
-                    $mailbox = str_replace('&nbsp;','',$mailbox);
-                    $line .= str_replace(' ', '&nbsp;', $mailbox);
-                }
-                $line .= '</FONT>';
+            /* Compute the visiblity of this box. */
+            if ($boxes[$parbox]['visible'] &&
+                ($boxes[$parbox]['collapse'] != SM_BOX_COLLAPSED)) {
+                $boxes[$nextbox]['visible'] = true;
             } else {
-                $line .= formatMailboxName($imapConnection, $boxes[$i]);
+                $boxes[$nextbox]['visible'] = false;
             }
 
-            /* Put the final touches on our folder line. */
-            $line .= "</NOBR><BR>\n";
-
-            /* Output the line for this folder. */
-            echo $line;
+            /* Compute the visibility of any child boxes. */
+            compute_folder_children($nextbox, $boxcount);
         }
+
+        /* Set the parent box to the current next box. */
+        $parbox = $nextbox;
     }
-    sqimap_logout($imapConnection);
-    do_hook("left_main_after");
 
     /**
      * Create the link for a parent folder that will allow that
         /* Return the finished product. */
         return ($link);
     }
-   
+
     /**
      * This simple function checks if a box is another box's parent.
      */
         return ($parbox_name == $actual_parname);
     }
 
-    /**
-     * Recursive function that computes the collapsed status and parent
-     * (or not parent) status of this box, and the visiblity and collapsed
-     * status and parent (or not parent) status for all children boxes.
-     */
-    function compute_folder_children(&$parbox, $boxcount) {
-        global $boxes, $data_dir, $username, $collapse_folders;
-        $nextbox = $parbox + 1;
 
-        /* Retreive the name for the parent box. */
-        $parbox_name = $boxes[$parbox]['unformatted'];
+    /* -------------------- MAIN ------------------------ */
 
-        /* 'Initialize' this parent box to childless. */
-        $boxes[$parbox]['parent'] = false;
+    global $delimiter, $default_folder_prefix;
 
-        /* Compute the collapse status for this box. */
-        if( isset($collapse_folders) && $collapse_folders ) {
-            $collapse = getPref($data_dir, $username, 'collapse_folder_' . $parbox_name);
-            $collapse = ($collapse == '' ? SM_BOX_UNCOLLAPSED : $collapse);
-        } else {
-            $collapse = SM_BOX_UNCOLLAPSED;
+    // open a connection on the imap port (143)
+    $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output
+
+
+    if (isset($left_refresh) && ($left_refresh != 'none') && ($left_refresh != '')) {
+        $xtra =  "\n<META HTTP-EQUIV=\"Expires\" CONTENT=\"Thu, 01 Dec 1994 16:00:00 GMT\">\n" .
+                 "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n".
+                 "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"$left_refresh;URL=left_main.php\">\n";
+    } else {
+        $xtra = '';
+    }
+
+    displayHtmlHeader( 'SquirrelMail', $xtra );
+
+    /* If requested and not yet complete, attempt to autocreate folders. */
+    if ($auto_create_special && !isset($auto_create_done)) {
+        $autocreate = array( $sent_folder,
+                             $trash_folder,
+                             $draft_folder );
+        foreach( $autocreate as $folder ) {
+            if ($folder != '' && $folder != 'none') {
+                if ( !sqimap_mailbox_exists($imapConnection, $folder)) {
+                    sqimap_mailbox_create($imapConnection, $default_folder_prefix.$folder, '');
+                } elseif ( !sqimap_mailbox_is_subscribed($imapConnection, $folder)) {
+                    sqimap_subscribe($imapConnection, $folder);
+                }
+            }
         }
-        $boxes[$parbox]['collapse'] = $collapse;
 
-        /* Otherwise, get the name of the next box. */
-       if (isset($boxes[$nextbox]['unformatted']))
-               $nextbox_name = $boxes[$nextbox]['unformatted'];
-       else
-          $nextbox_name = '';
+        /* Let the world know that autocreation is complete! Hurrah! */
+        $auto_create_done = true;
+        session_register('auto_create_done');
+    }
 
-        /* Compute any children boxes for this box. */
-        while (($nextbox < $boxcount) &&
-               (is_parent_box($boxes[$nextbox]['unformatted'], $parbox_name))) {
+    echo "\n<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" LINK=\"$color[6]\" VLINK=\"$color[6]\" ALINK=\"$color[6]\">\n";
 
-            /* Note that this 'parent' box has at least one child. */
-            $boxes[$parbox]['parent'] = true;
+    do_hook('left_main_before');
 
-            /* Compute the visiblity of this box. */
-            if ($boxes[$parbox]['visible'] &&
-                ($boxes[$parbox]['collapse'] != SM_BOX_COLLAPSED)) {
-                $boxes[$nextbox]['visible'] = true;
+    $boxes = sqimap_mailbox_list($imapConnection);
+
+    echo '<CENTER><FONT SIZE=4><B>'. _("Folders") . "</B><BR></FONT>\n\n";
+
+    if ($date_format != 6) {
+        /* First, display the clock. */
+        if ($hour_format == 1) {
+            $hr = 'G:i';
+            if ($date_format == 4) {
+                $hr .= ':s';
+            }
+        } else {
+            if ($date_format == 4) {
+                $hr = 'g:i:s a';
             } else {
-                $boxes[$nextbox]['visible'] = false;
+                $hr = 'g:i a';
             }
+        }
 
-            /* Compute the visibility of any child boxes. */
-            compute_folder_children($nextbox, $boxcount);
+        switch( $date_format ) {
+        case 1:
+            $clk = date('m/d/y '.$hr, time());
+            break;
+        case 2:
+            $clk = date('d/m/y '.$hr, time());
+            break;
+        case 4:
+        case 5:
+            $clk = date($hr, time());
+            break;
+        default:
+            $clk = date('D, '.$hr, time());
         }
+        $clk = str_replace(' ','&nbsp;',$clk);
 
-        /* Set the parent box to the current next box. */
-        $parbox = $nextbox;
+        echo '<CENTER><SMALL>' . str_replace(' ','&nbsp;',_("Last Refresh")) .
+             ": $clk</SMALL></CENTER>";
     }
+
+    /* Next, display the refresh button. */
+    echo '<SMALL>(<A HREF="../src/left_main.php" TARGET="left">'.
+         _("refresh folder list") . '</A>)</SMALL></CENTER><BR>';
+
+    /* Lastly, display the folder list. */
+    if ( $collapse_folders ) {
+        /* If directed, collapse or uncollapse a folder. */
+        if (isset($fold)) {
+            setPref($data_dir, $username, 'collapse_folder_' . $fold, SM_BOX_COLLAPSED);
+        } else if (isset($unfold)) {
+            setPref($data_dir, $username, 'collapse_folder_' . $unfold, SM_BOX_UNCOLLAPSED);
+        }
+    }
+
+    /* Prepare do do out collapsedness and visibility computation. */
+    $curbox = 0;
+    $boxcount = count($boxes);
+
+    /* Compute the collapsedness and visibility of each box. */
+    while ($curbox < $boxcount) {
+        $boxes[$curbox]['visible'] = TRUE;
+        compute_folder_children($curbox, $boxcount);
+    }
+
+    for ($i = 0;$i < count($boxes); $i++) {
+        if ( $boxes[$i]['visible'] ) {
+            $mailbox = $boxes[$i]['formatted'];
+            $mblevel = substr_count($boxes[$i]['unformatted'], $delimiter) + 1;
+
+            /* Create the prefix for the folder name and link. */
+            $prefix = str_repeat('  ',$mblevel);
+            if (isset($collapse_folders) && $collapse_folders && $boxes[$i]['parent']) {
+                $prefix = str_replace(' ','&nbsp;',substr($prefix,0,strlen($prefix)-2)).
+                          create_collapse_link($i) . '&nbsp;';
+            } else {
+                $prefix = str_replace(' ','&nbsp;',$prefix);
+            }
+            $line = "<NOBR><TT>$prefix</TT>";
+
+            /* Add the folder name and link. */
+            if (in_array('noselect', $boxes[$i]['flags'])) {
+                $line .= "<FONT COLOR=\"$color[10]\">";
+                if (ereg("^( *)([^ ]*)", $mailbox, $regs)) {
+                    $mailbox = str_replace('&nbsp;','',$mailbox);
+                    $line .= str_replace(' ', '&nbsp;', $mailbox);
+                }
+                $line .= '</FONT>';
+            } else {
+                $line .= formatMailboxName($imapConnection, $boxes[$i]);
+            }
+
+            /* Put the final touches on our folder line. */
+            $line .= "</NOBR><BR>\n";
+
+            /* Output the line for this folder. */
+            echo $line;
+        }
+    }
+
+    sqimap_logout($imapConnection);
+    do_hook('left_main_after');
+
     echo "</BODY></HTML>\n";
-?>
+
+?>
\ No newline at end of file
index 4594d5b7842aa9e0adeb3db92e52b137dc8de88e..91503a708f0a7796bb4ffaf79ae63c944486ac80 100644 (file)
@@ -34,7 +34,7 @@ if (isset($language)) {
 /*** Build the resultant page. ***/
 /*********************************/
 
-displayPageHeader($color, _("None"));
+displayPageHeader($color, 'None');
 
 define('SMOPT_MODE_DISPLAY', 'display');
 define('SMOPT_MODE_SUBMIT', 'submit');
index e090e887a925d5d2dd3248ee02908a72f89309b8..47c962095c4f85c3c74f54c8e1135dbe566457cf 100644 (file)
@@ -1,6 +1,15 @@
 <?php
 
-   /* $Id$ */
+
+    /**
+     * right_main.php
+     *
+     * Copyright (c) 1999-2001 The Squirrelmail Development Team
+     * Licensed under the GNU GPL. For full terms see the file COPYING.
+     *
+     * $Id$
+     */
+
 
    require_once('../src/validate.php');
    require_once('../functions/imap.php');
index 0c0688c18e40e7e827444423670220e2630ddb49..89785705b2503ff4512d81047bbd60df4cf65c05 100644 (file)
@@ -1,12 +1,12 @@
 <?php
     /**
-     * validate.php
-     *
-     * Copyright (c) 1999-2000 The SquirrelMail Development Team
-     * Licensed under the GNU GPL. For full terms see the file COPYING.
-     *
-     * $Id$
-     */
+     ** validate.php
+     **
+     ** Copyright (c) 1999-2001 The SquirrelMail Development Team
+     ** Licensed under the GNU GPL. For full terms see the file COPYING.
+     **
+     ** $Id$
+     **/
 
     if (defined ('validate_php')) { return; }
     define ('validate_php', true);
index af3695ae54e0579b9493d9dc714cef2e357375ab..688f6ca3b5a8a0e09bc4bc7a2c4ead174b8ddad5 100644 (file)
@@ -2,6 +2,9 @@
 /**
  ** vcard.php
  **
+ ** Copyright (c) 1999-2001 The SquirrelMail Development Team
+ ** Licensed under the GNU GPL. For full terms see the file COPYING.
+ **
  ** This file shows an attched vcard
  **
  ** $Id$