Minor cleanups
authorjervfors <jervfors@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 24 Aug 2004 00:40:28 +0000 (00:40 +0000)
committerjervfors <jervfors@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 24 Aug 2004 00:40:28 +0000 (00:40 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@7948 7612ce4b-ef26-0410-bec9-ea0150e637f0

24 files changed:
functions/abook_database.php
functions/abook_global_file.php
functions/abook_ldap_server.php
functions/abook_local_file.php
functions/addressbook.php
functions/attachment_common.php
functions/auth.php
functions/constants.php
functions/db_prefs.php
functions/global.php
functions/html.php
functions/i18n.php
functions/identity.php
functions/imap.php
functions/imap_mailbox.php
functions/imap_search.php
functions/imap_utf7_local.php
functions/index.php
functions/mailbox_display.php
functions/options.php
functions/page_header.php
functions/prefs.php
functions/tree.php
functions/url_parser.php

index 0377691ced45d37f33ccd742de398d2f7c4724c3..20efeb65eec468c02407131b996b198d90deed1e 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-   
+
 /**
  * abook_database.php
  *
@@ -32,7 +32,7 @@
  * @subpackage addressbook
  */
 
-/** Needs the DB functions */   
+/** Needs the DB functions */
 if (!include_once('DB.php')) {
     // same error also in db_prefs.php
     require_once(SM_PATH . 'functions/display_messages.php');
@@ -51,31 +51,31 @@ if (!include_once('DB.php')) {
 class abook_database extends addressbook_backend {
     var $btype = 'local';
     var $bname = 'database';
-      
+
     var $dsn       = '';
     var $table     = '';
     var $owner     = '';
     var $dbh       = false;
-      
+
     var $writeable = true;
-      
+
     /* ========================== Private ======================= */
-      
+
     /* Constructor */
     function abook_database($param) {
         $this->sname = _("Personal address book");
-         
+
         if (is_array($param)) {
-            if (empty($param['dsn']) || 
-                empty($param['table']) || 
+            if (empty($param['dsn']) ||
+                empty($param['table']) ||
                 empty($param['owner'])) {
                 return $this->set_error('Invalid parameters');
             }
-            
+
             $this->dsn   = $param['dsn'];
             $this->table = $param['table'];
             $this->owner = $param['owner'];
-            
+
             if (!empty($param['name'])) {
                $this->sname = $param['name'];
             }
@@ -94,29 +94,29 @@ class abook_database extends addressbook_backend {
             return $this->set_error('Invalid argument to constructor');
         }
     }
-      
-      
+
+
     /* Open the database. New connection if $new is true */
     function open($new = false) {
         $this->error = '';
-         
+
         /* Return true is file is open and $new is unset */
         if ($this->dbh && !$new) {
             return true;
         }
-         
+
         /* Close old file, if any */
         if ($this->dbh) {
             $this->close();
         }
-         
+
         $dbh = DB::connect($this->dsn, true);
-         
+
         if (DB::isError($dbh)) {
             return $this->set_error(sprintf(_("Database error: %s"),
                                             DB::errorMessage($dbh)));
         }
-         
+
         $this->dbh = $dbh;
         return true;
     }
@@ -128,7 +128,7 @@ class abook_database extends addressbook_backend {
     }
 
     /* ========================== Public ======================== */
-     
+
     /* Search the file */
     function &search($expr) {
         $ret = array();
@@ -169,19 +169,19 @@ class abook_database extends addressbook_backend {
         }
         return $ret;
     }
-     
+
     /* Lookup alias */
     function &lookup($alias) {
         if (empty($alias)) {
             return array();
         }
-         
+
         $alias = strtolower($alias);
 
         if (!$this->open()) {
             return false;
         }
-         
+
         $query = sprintf("SELECT * FROM %s WHERE owner='%s' AND LOWER(nickname)='%s'",
                          $this->table, $this->owner, $this->dbh->quoteString($alias));
 
@@ -211,7 +211,7 @@ class abook_database extends addressbook_backend {
         if (!$this->open()) {
             return false;
         }
-       
+
        if(isset($this->listing) && !$this->listing) {
            return array();
        }
@@ -221,7 +221,7 @@ class abook_database extends addressbook_backend {
                          $this->table, $this->owner);
 
         $res = $this->dbh->query($query);
-        
+
         if (DB::isError($res)) {
             return $this->set_error(sprintf(_("Database error: %s"),
                                             DB::errorMessage($res)));
@@ -249,7 +249,7 @@ class abook_database extends addressbook_backend {
         if (!$this->open()) {
             return false;
         }
-         
+
         /* See if user exist already */
         $ret = $this->lookup($userdata['nickname']);
         if (!empty($ret)) {
@@ -263,9 +263,9 @@ class abook_database extends addressbook_backend {
                          "'%s','%s','%s')",
                          $this->table, $this->owner,
                          $this->dbh->quoteString($userdata['nickname']),
-                         $this->dbh->quoteString($userdata['firstname']), 
+                         $this->dbh->quoteString($userdata['firstname']),
                          $this->dbh->quoteString($userdata['lastname']),
-                         $this->dbh->quoteString($userdata['email']), 
+                         $this->dbh->quoteString($userdata['email']),
                          $this->dbh->quoteString($userdata['label']) );
 
          /* Do the insert */
@@ -288,7 +288,7 @@ class abook_database extends addressbook_backend {
         if (!$this->open()) {
             return false;
         }
-         
+
         /* Create query */
         $query = sprintf("DELETE FROM %s WHERE owner='%s' AND (",
                          $this->table, $this->owner);
@@ -321,7 +321,7 @@ class abook_database extends addressbook_backend {
         if (!$this->open()) {
             return false;
         }
-         
+
          /* See if user exist */
         $ret = $this->lookup($alias);
         if (empty($ret)) {
@@ -333,11 +333,11 @@ class abook_database extends addressbook_backend {
         $query = sprintf("UPDATE %s SET nickname='%s', firstname='%s', ".
                          "lastname='%s', email='%s', label='%s' ".
                          "WHERE owner='%s' AND nickname='%s'",
-                         $this->table, 
+                         $this->table,
                          $this->dbh->quoteString($userdata['nickname']),
-                         $this->dbh->quoteString($userdata['firstname']), 
+                         $this->dbh->quoteString($userdata['firstname']),
                          $this->dbh->quoteString($userdata['lastname']),
-                         $this->dbh->quoteString($userdata['email']), 
+                         $this->dbh->quoteString($userdata['email']),
                          $this->dbh->quoteString($userdata['label']),
                          $this->owner,
                          $this->dbh->quoteString($alias) );
@@ -354,6 +354,5 @@ class abook_database extends addressbook_backend {
     }
 } /* End of class abook_database */
 
-
 // vim: et ts=4
-?>
+?>
\ No newline at end of file
index 7a8987fa956257dc6f8829f5a78d047b8cebab21..ef1f30a54607bc52c11e7e677424e6a31c72a248 100644 (file)
@@ -37,15 +37,15 @@ class abook_global_file extends addressbook_backend {
     function abook_global_file() {
         global $address_book_global_filename;
         $this->global_filename = $address_book_global_filename;
-      
+
         $this->sname = _("Global address book");
+
         $this->open(true);
     }
 
     /* Open the addressbook file and store the file pointer.
-     * Use $file as the file to open, or the class' own 
-     * filename property. If $param is empty and file is  
+     * Use $file as the file to open, or the class' own
+     * filename property. If $param is empty and file is
      * open, do nothing. */
     function open($new = false) {
         $this->error = '';
@@ -54,27 +54,27 @@ class abook_global_file extends addressbook_backend {
         if($this->filehandle && !$new) {
             return true;
         }
+
         /* Check that new file exists */
-        if (! file_exists($this->global_filename) || 
+        if (! file_exists($this->global_filename) ||
             ! is_readable($this->global_filename)) {
             return $this->set_error($this->global_filename . ': ' .
                 _("No such file or directory"));
         }
+
         /* Close old file, if any */
         if ($this->filehandle) {
             $this->close();
         }
-        
+
         /* Open file, read only. */
         $fh = @fopen($this->global_filename, 'r');
         $this->writeable  = false;
         if(! $fh) {
-            return $this->set_error($this->global_filename . ': ' . 
+            return $this->set_error($this->global_filename . ': ' .
                 _("Open failed"));
         }
+
         $this->filehandle = &$fh;
         return true;
     }
@@ -88,7 +88,7 @@ class abook_global_file extends addressbook_backend {
     }
 
     /* ========================== Public ======================== */
-    
+
     /* Search the file */
     function search($expr) {
 
@@ -96,19 +96,19 @@ class abook_global_file extends addressbook_backend {
         if(is_array($expr)) {
             return;
         }
+
         /* Make regexp from glob'ed expression
          * May want to quote other special characters like (, ), -, [, ], etc. */
         $expr = str_replace('?', '.', $expr);
         $expr = str_replace('*', '.*', $expr);
+
         $res = array();
         if(!$this->open()) {
             return false;
         }
+
         @rewind($this->filehandle);
-        
+
         while ($row = @fgetcsv($this->filehandle, 2048, '|')) {
             $line = join(' ', $row);
             if (eregi($expr, $line)) {
@@ -122,21 +122,21 @@ class abook_global_file extends addressbook_backend {
                                'source'    => &$this->sname);
             }
         }
-        
+
         return $res;
     }
-    
+
     /* Lookup alias */
     function lookup($alias) {
         if (empty($alias)) {
             return array();
         }
+
         $alias = strtolower($alias);
-        
+
         $this->open();
         @rewind($this->filehandle);
-        
+
         while ($row = @fgetcsv($this->filehandle, 2048, '|')) {
             if (strtolower($row[0]) == $alias) {
                 return array('nickname'  => $row[0],
@@ -149,7 +149,7 @@ class abook_global_file extends addressbook_backend {
                              'source'    => &$this->sname);
             }
         }
-      
+
         return array();
     }
 
@@ -158,7 +158,7 @@ class abook_global_file extends addressbook_backend {
         $res = array();
         $this->open();
         @rewind($this->filehandle);
-        
+
         while ($row = @fgetcsv($this->filehandle, 2048, '|')) {
             $res[] = array('nickname'  => $row[0],
                            'name'      => $row[1] . ' ' . $row[2],
@@ -189,6 +189,6 @@ class abook_global_file extends addressbook_backend {
         $this->set_error(_("Can not modify global address book"));
         return false;
     }
-     
+
 } /* End of class abook_local_file */
-?>
+?>
\ No newline at end of file
index e60f8bd236b5d399ae08099a84774869bddeef73..b030c55f1c481570e5f12d5ea6988c82927d33b9 100644 (file)
@@ -90,7 +90,7 @@ class abook_ldap_server extends addressbook_backend {
             else {
                 $this->sname = $param['name'];
             }
-            
+
             $this->open(true);
         } else {
             $this->set_error('Invalid argument to constructor');
@@ -101,21 +101,21 @@ class abook_ldap_server extends addressbook_backend {
     /* Open the LDAP server. New connection if $new is true */
     function open($new = false) {
         $this->error = '';
-  
+
         /* Connection is already open */
         if($this->linkid != false && !$new) {
             return true;
         }
-  
+
         $this->linkid = @ldap_connect($this->server, $this->port);
         if(!$this->linkid) {
             if(function_exists('ldap_error')) {
-                return $this->set_error(ldap_error($this->linkid)); 
+                return $this->set_error(ldap_error($this->linkid));
             } else {
                 return $this->set_error('ldap_connect failed');
             }
         }
-       
+
        if(!empty($this->protocol)) {
             if(!@ldap_set_option($this->linkid, LDAP_OPT_PROTOCOL_VERSION, $this->protocol)) {
                 if(function_exists('ldap_error')) {
@@ -137,7 +137,7 @@ class abook_ldap_server extends addressbook_backend {
         } else {
            if(!@ldap_bind($this->linkid)) {
                if(function_exists('ldap_error')) {
-                   return $this->set_error(ldap_error($this->linkid)); 
+                   return $this->set_error(ldap_error($this->linkid));
                } else {
                    return $this->set_error('anonymous ldap_bind failed');
                }
@@ -145,7 +145,7 @@ class abook_ldap_server extends addressbook_backend {
         }
 
         $this->bound = true;
-        
+
         return true;
     }
 
@@ -177,64 +177,64 @@ class abook_ldap_server extends addressbook_backend {
         }
     }
 
-    
+
     /* ========================== Public ======================== */
 
     /* Search the LDAP server */
     function search($expr) {
-  
+
         /* To be replaced by advanded search expression parsing */
         if(is_array($expr)) return false;
-  
+
         /* Encode the expression */
         $expr = $this->charset_encode($expr);
         if(strstr($expr, '*') === false) {
             $expr = "*$expr*";
         }
         $expression = "cn=$expr";
-  
+
         /* Make sure connection is there */
         if(!$this->open()) {
             return false;
         }
-  
+
         $sret = @ldap_search($this->linkid, $this->basedn, $expression,
-            array('dn', 'o', 'ou', 'sn', 'givenname', 
+            array('dn', 'o', 'ou', 'sn', 'givenname',
             'cn', 'mail', 'telephonenumber'),
             0, $this->maxrows, $this->timeout);
-  
+
         /* Should get error from server using the ldap_error() function,
          * but it only exist in the PHP LDAP documentation. */
         if(!$sret) {
             if(function_exists('ldap_error')) {
-                return $this->set_error(ldap_error($this->linkid)); 
+                return $this->set_error(ldap_error($this->linkid));
             } else {
-                return $this->set_error('ldap_search failed');       
+                return $this->set_error('ldap_search failed');
             }
         }
-        
+
         if(@ldap_count_entries($this->linkid, $sret) <= 0) {
             return array();
         }
-  
+
         /* Get results */
         $ret = array();
         $returned_rows = 0;
         $res = @ldap_get_entries($this->linkid, $sret);
         for($i = 0 ; $i < $res['count'] ; $i++) {
             $row = $res[$i];
-           
+
             /* Extract data common for all e-mail addresses
              * of an object. Use only the first name */
             $nickname = $this->charset_decode($row['dn']);
             $fullname = $this->charset_decode($row['cn'][0]);
-           
+
             if(empty($row['telephonenumber'][0])) {
                 $phone = '';
             } else {
                 $phone = $this->charset_decode($row['telephonenumber'][0]);
             }
-           
+
             if(!empty($row['ou'][0])) {
                 $label = $this->charset_decode($row['ou'][0]);
             }
@@ -243,19 +243,19 @@ class abook_ldap_server extends addressbook_backend {
             } else {
                 $label = '';
             }
-           
+
             if(empty($row['givenname'][0])) {
                 $firstname = '';
             } else {
                 $firstname = $this->charset_decode($row['givenname'][0]);
             }
-           
+
             if(empty($row['sn'][0])) {
                 $surname = '';
             } else {
                 $surname = $this->charset_decode($row['sn'][0]);
             }
-           
+
             /* Add one row to result for each e-mail address */
             if(isset($row['mail']['count'])) {
                 for($j = 0 ; $j < $row['mail']['count'] ; $j++) {
@@ -268,10 +268,10 @@ class abook_ldap_server extends addressbook_backend {
                    'phone'     => $phone,
                    'backend'   => $this->bnum,
                    'source'    => &$this->sname));
-                    
+
                     // Limit number of hits
                     $returned_rows++;
-                    if(($returned_rows >= $this->maxrows) && 
+                    if(($returned_rows >= $this->maxrows) &&
                        ($this->maxrows > 0) ) {
                         ldap_free_result($sret);
                         return $ret;
@@ -280,9 +280,9 @@ class abook_ldap_server extends addressbook_backend {
                 } // for($j ...)
 
             } // isset($row['mail']['count'])
+
         }
-  
+
         ldap_free_result($sret);
         return $ret;
     } /* end search() */
@@ -297,4 +297,4 @@ class abook_ldap_server extends addressbook_backend {
      *
      * Careful with this -- it could get quite large for big sites. */
 }
-?>
+?>
\ No newline at end of file
index 379271009e239bd87bada20dcd9607168eb42692..04c1eaa2137a80766b2b6741b6b1aea14161ee27 100644 (file)
@@ -63,7 +63,7 @@ class abook_local_file extends addressbook_backend {
             if(!empty($param['name'])) {
                 $this->sname = $param['name'];
             }
-           
+
             $this->open(true);
         } else {
             $this->set_error('Invalid argument to constructor');
@@ -71,27 +71,27 @@ class abook_local_file extends addressbook_backend {
     }
 
     /* Open the addressbook file and store the file pointer.
-     * Use $file as the file to open, or the class' own 
-     * filename property. If $param is empty and file is  
+     * Use $file as the file to open, or the class' own
+     * filename property. If $param is empty and file is
      * open, do nothing. */
     function open($new = false) {
         $this->error = '';
         $file   = $this->filename;
         $create = $this->create;
-  
+
         /* Return true is file is open and $new is unset */
         if($this->filehandle && !$new) {
             return true;
         }
-  
+
         /* Check that new file exitsts */
         if((!(file_exists($file) && is_readable($file))) && !$create) {
             return $this->set_error("$file: " . _("No such file or directory"));
         }
-  
+
         /* Close old file, if any */
         if($this->filehandle) { $this->close(); }
-        
+
         /* Open file. First try to open for reading and writing,
          * but fall back to read only. */
         umask($this->umask);
@@ -124,7 +124,7 @@ class abook_local_file extends addressbook_backend {
     /* Lock the datafile - try 20 times in 5 seconds */
     function lock() {
         for($i = 0 ; $i < 20 ; $i++) {
-            if(flock($this->filehandle, 2 + 4)) 
+            if(flock($this->filehandle, 2 + 4))
                 return true;
             else
                 usleep(250000);
@@ -146,7 +146,7 @@ class abook_local_file extends addressbook_backend {
         if(!$newfh) {
             return $this->set_error($this->filename. '.tmp:' . _("Open failed"));
         }
-        
+
         for($i = 0, $cnt=sizeof($rows) ; $i < $cnt ; $i++) {
             if(is_array($rows[$i])) {
                 for($j = 0, $cnt_part=count($rows[$i]) ; $j < $cnt_part ; $j++) {
@@ -157,7 +157,7 @@ class abook_local_file extends addressbook_backend {
                     return $this->set_error($this->filename . '.tmp:' . _("Write failed"));
                 }
             }
-        }       
+        }
 
         fclose($newfh);
         if (!@copy($this->filename . '.tmp' , $this->filename)) {
@@ -168,26 +168,26 @@ class abook_local_file extends addressbook_backend {
         $this->open(true);
         return true;
     }
-    
+
     /* ========================== Public ======================== */
-    
+
     /* Search the file */
     function search($expr) {
 
         /* To be replaced by advanded search expression parsing */
         if(is_array($expr)) { return; }
-  
+
         /* Make regexp from glob'ed expression
          * May want to quote other special characters like (, ), -, [, ], etc. */
         $expr = str_replace('?', '.', $expr);
         $expr = str_replace('*', '.*', $expr);
-  
+
         $res = array();
         if(!$this->open()) {
             return false;
         }
         @rewind($this->filehandle);
-        
+
         while ($row = @fgetcsv($this->filehandle, 2048, '|')) {
             $line = join(' ', $row);
             if(eregi($expr, $line)) {
@@ -201,10 +201,10 @@ class abook_local_file extends addressbook_backend {
                     'source'    => &$this->sname));
             }
         }
-        
+
         return $res;
     }
-    
+
     /* Lookup alias */
     function lookup($alias) {
         if(empty($alias)) {
@@ -212,10 +212,10 @@ class abook_local_file extends addressbook_backend {
         }
 
         $alias = strtolower($alias);
-        
+
         $this->open();
         @rewind($this->filehandle);
-        
+
         while ($row = @fgetcsv($this->filehandle, 2048, '|')) {
             if(strtolower($row[0]) == $alias) {
                 return array('nickname'  => $row[0],
@@ -228,7 +228,7 @@ class abook_local_file extends addressbook_backend {
                   'source'    => &$this->sname);
             }
         }
-        
+
         return array();
     }
 
@@ -237,7 +237,7 @@ class abook_local_file extends addressbook_backend {
         $res = array();
         $this->open();
         @rewind($this->filehandle);
-      
+
         while ($row = @fgetcsv($this->filehandle, 2048, '|')) {
             array_push($res, array('nickname'  => $row[0],
                 'name'      => $row[1] . ' ' . $row[2],
@@ -262,7 +262,7 @@ class abook_local_file extends addressbook_backend {
             return $this->set_error(sprintf(_("User '%s' already exist"),
                    $ret['nickname']));
         }
-  
+
         /* Here is the data to write */
         $data = $this->quotevalue($userdata['nickname']) . '|' .
                 $this->quotevalue($userdata['firstname']) . '|' .
@@ -274,31 +274,31 @@ class abook_local_file extends addressbook_backend {
         $data = ereg_replace("[\r\n]", ' ', $data);
         /* Add linefeed at end */
         $data = $data . "\n";
-  
+
         /* Reopen file, just to be sure */
         $this->open(true);
         if(!$this->writeable) {
             return $this->set_error(_("Addressbook is read-only"));
         }
-  
+
         /* Lock the file */
         if(!$this->lock()) {
             return $this->set_error(_("Could not lock datafile"));
         }
-  
+
         /* Write */
         $r = sq_fwrite($this->filehandle, $data);
-  
+
         /* Unlock file */
         $this->unlock();
-  
+
         /* Test write result */
         if($r === FALSE) {
                /* Fail */
                $this->set_error(_("Write to addressbook failed"));
                return FALSE;
        }
-  
+
         return TRUE;
     }
 
@@ -307,13 +307,13 @@ class abook_local_file extends addressbook_backend {
         if(!$this->writeable) {
             return $this->set_error(_("Addressbook is read-only"));
         }
-        
+
         /* Lock the file to make sure we're the only process working
          * on it. */
         if(!$this->lock()) {
             return $this->set_error(_("Could not lock datafile"));
         }
-  
+
         /* Read file into memory, ignoring nicknames to delete */
         @rewind($this->filehandle);
         $i = 0;
@@ -323,13 +323,13 @@ class abook_local_file extends addressbook_backend {
                 $rows[$i++] = $row;
             }
         }
-  
+
         /* Write data back */
         if(!$this->overwrite($rows)) {
             $this->unlock();
             return false;
         }
-  
+
         $this->unlock();
         return true;
     }
@@ -339,21 +339,21 @@ class abook_local_file extends addressbook_backend {
         if(!$this->writeable) {
             return $this->set_error(_("Addressbook is read-only"));
         }
-  
+
         /* See if user exists */
         $ret = $this->lookup($alias);
         if(empty($ret)) {
             return $this->set_error(sprintf(_("User '%s' does not exist"),
                 $alias));
         }
-  
+
         /* Lock the file to make sure we're the only process working
          * on it. */
         if(!$this->lock()) {
             return $this->set_error(_("Could not lock datafile"));
         }
-  
-        /* Read file into memory, modifying the data for the 
+
+        /* Read file into memory, modifying the data for the
          * user identified by $alias */
         $this->open(true);
         @rewind($this->filehandle);
@@ -366,21 +366,21 @@ class abook_local_file extends addressbook_backend {
                 $rows[$i++] = array(0 => $userdata['nickname'],
                                     1 => $userdata['firstname'],
                                     2 => $userdata['lastname'],
-                                    3 => $userdata['email'], 
+                                    3 => $userdata['email'],
                                     4 => $userdata['label']);
             }
         }
-  
+
         /* Write data back */
         if(!$this->overwrite($rows)) {
             $this->unlock();
             return false;
         }
-  
+
         $this->unlock();
         return true;
     }
-     
+
     /* Function for quoting values before saving */
     function quotevalue($value) {
         /* Quote the field if it contains | or ". Double quotes need to
@@ -392,4 +392,4 @@ class abook_local_file extends addressbook_backend {
     }
 
 } /* End of class abook_local_file */
-?>
+?>
\ No newline at end of file
index 18cf590cceca6908045a6b4670ffb1d5399d7487..22cc1c01e2f16af4a5247c8e334bc42e381032ab 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * addressbook.php
  *
@@ -105,7 +106,7 @@ function addressbook_init($showerr = true, $onlylocal = false) {
     $hookReturn = do_hook('abook_init', $abook, $r);
     $abook = $hookReturn[1];
     $r = $hookReturn[2];
-    
+
     if ($onlylocal) {
         return $abook;
     }
@@ -135,7 +136,7 @@ function addressbook_init($showerr = true, $onlylocal = false) {
  *   Had to move this function outside of the Addressbook Class
  *   PHP 4.0.4 Seemed to be having problems with inline functions.
  *   Note: this can return now since we don't support 4.0.4 anymore.
- */    
+ */
 function addressbook_cmp($a,$b) {
 
     if($a['backend'] > $b['backend']) {
@@ -143,7 +144,7 @@ function addressbook_cmp($a,$b) {
     } else if($a['backend'] < $b['backend']) {
         return -1;
     }
-    
+
     return (strtolower($a['name']) > strtolower($b['name'])) ? 1 : -1;
 
 }
@@ -162,7 +163,7 @@ class AddressBook {
     var $error       = '';
     var $localbackend = 0;
     var $localbackendname = '';
-    
+
       // Constructor function.
     function AddressBook() {
         $localbackendname = _("Personal address book");
@@ -203,7 +204,7 @@ class AddressBook {
 
         $newback->bnum = $this->numbackends;
         $this->backends[$this->numbackends] = $newback;
-        
+
         /* Store ID of first local backend added */
         if ($this->localbackend == 0 && $newback->btype == 'local') {
             $this->localbackend = $this->numbackends;
@@ -215,7 +216,7 @@ class AddressBook {
 
 
     /*
-     * This function takes a $row array as returned by the addressbook 
+     * This function takes a $row array as returned by the addressbook
      * search and returns an e-mail address with the full name or
      * nickname optionally prepended.
      */
@@ -278,11 +279,11 @@ class AddressBook {
 
     /* Return a sorted search */
     function s_search($expression, $bnum = -1) {
-    
+
         $ret = $this->search($expression, $bnum);
         if ( is_array( $ret ) ) {
             usort($ret, 'addressbook_cmp');
-        }    
+        }
         return $ret;
     }
 
@@ -292,9 +293,9 @@ class AddressBook {
      *  local backends.
      */
     function lookup($alias, $bnum = -1) {
-    
+
         $ret = array();
-    
+
         if ($bnum > -1) {
             $res = $this->backends[$bnum]->lookup($alias);
             if (is_array($res)) {
@@ -304,7 +305,7 @@ class AddressBook {
                return false;
             }
         }
-    
+
         $sel = $this->get_backend_list('local');
         for ($i = 0 ; $i < sizeof($sel) ; $i++) {
             $backend = &$sel[$i];
@@ -318,7 +319,7 @@ class AddressBook {
                return false;
             }
         }
-        
+
         return $ret;
     }
 
@@ -326,13 +327,13 @@ class AddressBook {
     /* Return all addresses */
     function list_addr($bnum = -1) {
         $ret = array();
-        
+
         if ($bnum == -1) {
             $sel = $this->get_backend_list('local');
         } else {
             $sel = array(0 => &$this->backends[$bnum]);
         }
-        
+
         for ($i = 0 ; $i < sizeof($sel) ; $i++) {
             $backend = &$sel[$i];
             $backend->error = '';
@@ -344,7 +345,7 @@ class AddressBook {
                return false;
             }
         }
-        
+
         return $ret;
     }
 
@@ -354,7 +355,7 @@ class AddressBook {
      * to, or false if it failed.
      */
     function add($userdata, $bnum) {
-    
+
         /* Validate data */
         if (!is_array($userdata)) {
             $this->error = _("Invalid input data");
@@ -371,18 +372,18 @@ class AddressBook {
         if (empty($userdata['nickname'])) {
             $userdata['nickname'] = $userdata['email'];
         }
-        
+
         if (eregi('[ \\:\\|\\#\\"\\!]', $userdata['nickname'])) {
             $this->error = _("Nickname contains illegal characters");
             return false;
         }
-        
+
         /* Check that specified backend accept new entries */
         if (!$this->backends[$bnum]->writeable) {
             $this->error = _("Addressbook is read-only");
             return false;
         }
-        
+
         /* Add address to backend */
         $res = $this->backends[$bnum]->add($userdata);
         if ($res) {
@@ -391,7 +392,7 @@ class AddressBook {
             $this->error = $this->backends[$bnum]->error;
             return false;
         }
-        
+
         return false;  // Not reached
     } /* end of add() */
 
@@ -401,23 +402,23 @@ class AddressBook {
      * If $alias is an array, all users in the array are removed.
      */
     function remove($alias, $bnum) {
-    
+
         /* Check input */
         if (empty($alias)) {
             return true;
         }
-        
+
         /* Convert string to single element array */
         if (!is_array($alias)) {
             $alias = array(0 => $alias);
         }
-        
-        /* Check that specified backend is writeable */
+
+        /* Check that specified backend is writable */
         if (!$this->backends[$bnum]->writeable) {
             $this->error = _("Addressbook is read-only");
             return false;
         }
-        
+
         /* Remove user from backend */
         $res = $this->backends[$bnum]->remove($alias);
         if ($res) {
@@ -426,7 +427,7 @@ class AddressBook {
             $this->error = $this->backends[$bnum]->error;
             return false;
         }
-        
+
         return FALSE;  /* Not reached */
     } /* end of remove() */
 
@@ -436,12 +437,12 @@ class AddressBook {
      * If $alias is an array, all users in the array are removed.
      */
     function modify($alias, $userdata, $bnum) {
-    
+
         /* Check input */
         if (empty($alias) || !is_string($alias)) {
             return true;
         }
-        
+
         /* Validate data */
         if(!is_array($userdata)) {
             $this->error = _("Invalid input data");
@@ -455,22 +456,22 @@ class AddressBook {
             $this->error = _("E-mail address is missing");
             return false;
         }
-        
+
         if (eregi('[\\: \\|\\#"\\!]', $userdata['nickname'])) {
             $this->error = _("Nickname contains illegal characters");
             return false;
         }
-        
+
         if (empty($userdata['nickname'])) {
             $userdata['nickname'] = $userdata['email'];
         }
-        
-        /* Check that specified backend is writeable */
+
+        /* Check that specified backend is writable */
         if (!$this->backends[$bnum]->writeable) {
             $this->error = _("Addressbook is read-only");;
             return false;
         }
-        
+
         /* Modify user in backend */
         $res = $this->backends[$bnum]->modify($alias, $userdata);
         if ($res) {
@@ -479,11 +480,11 @@ class AddressBook {
             $this->error = $this->backends[$bnum]->error;
             return false;
         }
-        
+
         return FALSE;  /* Not reached */
     } /* end of modify() */
-    
-    
+
+
 } /* End of class Addressbook */
 
 /**
@@ -496,7 +497,7 @@ class addressbook_backend {
     var $btype      = 'dummy';
     var $bname      = 'dummy';
     var $sname      = 'Dummy backend';
-    
+
     /*
      * Variables common for all backends, but that
      * should not be changed by the backends.
@@ -504,40 +505,40 @@ class addressbook_backend {
     var $bnum       = -1;
     var $error      = '';
     var $writeable  = false;
-    
+
     function set_error($string) {
         $this->error = '[' . $this->sname . '] ' . $string;
         return false;
     }
-    
-    
+
+
     /* ========================== Public ======================== */
-    
+
     function search($expression) {
         $this->set_error('search not implemented');
         return false;
     }
-    
+
     function lookup($alias) {
         $this->set_error('lookup not implemented');
         return false;
     }
-    
+
     function list_addr() {
         $this->set_error('list_addr not implemented');
         return false;
     }
-    
+
     function add($userdata) {
         $this->set_error('add not implemented');
         return false;
     }
-    
+
     function remove($alias) {
         $this->set_error('delete not implemented');
         return false;
     }
-    
+
     function modify($alias, $newuserdata) {
         $this->set_error('modify not implemented');
         return false;
@@ -618,7 +619,7 @@ function get_abook_sort() {
  * @param string $alt_tag alt tag value (string visible to text only browsers)
  * @param integer $Down sort value when list is sorted ascending
  * @param integer $Up sort value when list is sorted descending
- * @return string html code with sorting images and urls 
+ * @return string html code with sorting images and urls
  */
 function show_abook_sort_button($abook_sort_order, $alt_tag, $Down, $Up ) {
     global $form_url;
@@ -656,7 +657,7 @@ if (isset($address_book_global_filename)) {
 }
 
 /* Only load database backend if database is configured */
-if((isset($addrbook_dsn) && !empty($addrbook_dsn)) || 
+if((isset($addrbook_dsn) && !empty($addrbook_dsn)) ||
  (isset($addrbook_global_dsn) && !empty($addrbook_global_dsn)) ) {
   include_once(SM_PATH . 'functions/abook_database.php');
 }
index dcb700c9bd3fe4b90c6e1e79a6f2e6d00d25c193..65bfba0d8615ebdb85da8a77a62bf3d8a56695ca 100644 (file)
@@ -91,23 +91,23 @@ function attachment_common_link_text(&$Args)
 {
     /* If there is a text attachment, we would like to create a 'view' button
        that links to the text attachment viewer.
-      
+
        $Args[1] = the array of actions
-      
+
        Use our plugin name for adding an action
        $Args[1]['attachment_common'] = array for href and text
-      
+
        $Args[1]['attachment_common']['text'] = What is displayed
        $Args[1]['attachment_common']['href'] = Where it links to
-      
+
        This sets the 'href' of this plugin for a new link. */
     sqgetGlobalVar('QUERY_STRING', $QUERY_STRING, SQ_SERVER);
 
     $Args[1]['attachment_common']['href'] = SM_PATH . 'src/view_text.php?'. $QUERY_STRING;
     $Args[1]['attachment_common']['href'] =
-          set_url_var($Args[1]['attachment_common']['href'], 
+          set_url_var($Args[1]['attachment_common']['href'],
          'ent_id',$Args[5]);
-  
+
     /* The link that we created needs a name.  "view" will be displayed for
        all text attachments handled by this plugin. */
     $Args[1]['attachment_common']['text'] = _("view");
@@ -116,7 +116,7 @@ function attachment_common_link_text(&$Args)
        Where that link points to can be changed.  Just in case the link above
        for viewing text attachments is not the same as the default link for
        this file, we'll change it.
-      
+
        This is a lot better in the image links, since the defaultLink will just
        download the image, but the one that we set it to will format the page
        to have an image tag in the center (looking a lot like this text viewer) */
@@ -132,11 +132,11 @@ function attachment_common_link_message(&$Args)
        all text attachments handled by this plugin. */
     $Args[1]['attachment_common']['text'] = _("view");
 
-    $Args[6] = $Args[1]['attachment_common']['href'];    
+    $Args[6] = $Args[1]['attachment_common']['href'];
 }
 
 
-function attachment_common_link_html(&$Args) 
+function attachment_common_link_html(&$Args)
 {
     sqgetGlobalVar('QUERY_STRING', $QUERY_STRING, SQ_SERVER);
 
@@ -144,7 +144,7 @@ function attachment_common_link_html(&$Args)
        /* why use the overridetype? can this be removed */
        '&amp;override_type0=text&amp;override_type1=html';
     $Args[1]['attachment_common']['href'] =
-          set_url_var($Args[1]['attachment_common']['href'], 
+          set_url_var($Args[1]['attachment_common']['href'],
          'ent_id',$Args[5]);
 
     $Args[1]['attachment_common']['text'] = _("view");
@@ -157,20 +157,20 @@ function attachment_common_link_image(&$Args)
     global $attachment_common_show_images, $attachment_common_show_images_list;
 
     sqgetGlobalVar('QUERY_STRING', $QUERY_STRING, SQ_SERVER);
-   
+
     $info['passed_id'] = $Args[3];
     $info['mailbox'] = $Args[4];
     $info['ent_id'] = $Args[5];
-    
+
     $attachment_common_show_images_list[] = $info;
-    
+
     $Args[1]['attachment_common']['href'] = SM_PATH . 'src/image.php?'. $QUERY_STRING;
     $Args[1]['attachment_common']['href'] =
-          set_url_var($Args[1]['attachment_common']['href'], 
+          set_url_var($Args[1]['attachment_common']['href'],
          'ent_id',$Args[5]);
-  
+
     $Args[1]['attachment_common']['text'] = _("view");
-    
+
     $Args[6] = $Args[1]['attachment_common']['href'];
 
 }
@@ -179,14 +179,14 @@ function attachment_common_link_image(&$Args)
 function attachment_common_link_vcard(&$Args)
 {
     sqgetGlobalVar('QUERY_STRING', $QUERY_STRING, SQ_SERVER);
+
     $Args[1]['attachment_common']['href'] = SM_PATH . 'src/vcard.php?'. $QUERY_STRING;
     $Args[1]['attachment_common']['href'] =
-          set_url_var($Args[1]['attachment_common']['href'], 
+          set_url_var($Args[1]['attachment_common']['href'],
          'ent_id',$Args[5]);
-  
+
     $Args[1]['attachment_common']['text'] = _("Business Card");
-  
+
     $Args[6] = $Args[1]['attachment_common']['href'];
 }
 
@@ -194,23 +194,23 @@ function attachment_common_link_vcard(&$Args)
 function attachment_common_octet_stream(&$Args)
 {
     global $FileExtensionToMimeType;
-   
+
     do_hook('attachment_common-load_mime_types');
-   
+
     ereg('\\.([^\\.]+)$', $Args[7], $Regs);
-  
+
     $Ext = strtolower($Regs[1]);
-   
+
     if ($Ext == '' || ! isset($FileExtensionToMimeType[$Ext]))
-        return;       
-   
-    $Ret = do_hook('attachment ' . $FileExtensionToMimeType[$Ext], 
-        $Args[1], $Args[2], $Args[3], $Args[4], $Args[5], $Args[6], 
+        return;
+
+    $Ret = do_hook('attachment ' . $FileExtensionToMimeType[$Ext],
+        $Args[1], $Args[2], $Args[3], $Args[4], $Args[5], $Args[6],
         $Args[7], $Args[8], $Args[9]);
-       
+
     foreach ($Ret as $a => $b) {
         $Args[$a] = $b;
     }
 }
 
-?>
+?>
\ No newline at end of file
index 72a7b75eca5c6f6b38479f5eb168ac2672e98799..caef3b5e937b1a39bb58e7936f365ebb42387c9f 100644 (file)
@@ -42,16 +42,16 @@ function is_logged_in() {
     if ( sqsession_is_registered('user_is_logged_in') ) {
         return;
     } else {
-        global $PHP_SELF, $session_expired_post, 
+        global $PHP_SELF, $session_expired_post,
               $session_expired_location, $squirrelmail_language;
 
         /*  First we store some information in the new session to prevent
          *  information-loss.
          */
-        
+
        $session_expired_post = $_POST;
         $session_expired_location = $PHP_SELF;
-        if (!sqsession_is_registered('session_expired_post')) {    
+        if (!sqsession_is_registered('session_expired_post')) {
            sqsession_register($session_expired_post,'session_expired_post');
         }
         if (!sqsession_is_registered('session_expired_location')) {
@@ -98,7 +98,7 @@ function cram_md5_response ($username,$password,$challenge) {
  */
 function digest_md5_response ($username,$password,$challenge,$service,$host) {
   $result=digest_md5_parse_challenge($challenge);
-  
+
 // verify server supports qop=auth
   // $qop = explode(",",$result['qop']);
   //if (!in_array("auth",$qop)) {
@@ -139,7 +139,7 @@ function digest_md5_response ($username,$password,$challenge,$service,$host) {
   $reply .= ',qop=' . $qop_value;
   $reply = base64_encode($reply);
   return $reply . "\r\n";
+
 }
 
 /**
@@ -219,14 +219,14 @@ function hmac_md5($data, $key='') {
     return $hmac;
 }
 
-/** 
+/**
  * Fillin user and password based on SMTP auth settings.
  *
  * @param string $user Reference to SMTP username
  * @param string $pass Reference to SMTP password (unencrypted)
  */
 function get_smtp_user(&$user, &$pass) {
-    global $username, $smtp_auth_mech, 
+    global $username, $smtp_auth_mech,
            $smtp_sitewide_user, $smtp_sitewide_pass;
 
     if ($smtp_auth_mech == 'none') {
@@ -242,4 +242,4 @@ function get_smtp_user(&$user, &$pass) {
     }
 }
 
-?>
+?>
\ No newline at end of file
index d4b1d9b870cf8664f298bdf1a257e3f2c8d964a3..382d3cc9e21a1d26acbd7f16e7bc78d23598c167 100644 (file)
@@ -55,4 +55,4 @@ define('SMPREF_JS_AUTODETECT', 2);
 
 do_hook('loading_constants');
 
-?>
+?>
\ No newline at end of file
index 2e54bed2c22ff9ce5744b73b762d8558dfa2a12b..91805d21611dfc16c572d13e6e81040157d41eb2 100644 (file)
@@ -397,4 +397,4 @@ function getSig($data_dir, $username, $number) {
 }
 
 // vim: et ts=4
-?>
+?>
\ No newline at end of file
index bed433d2c0824ad89ebd037e01ed7bee7874a368..1330022c647bfb297b8cf26a43a1fda65ced18cc 100644 (file)
@@ -6,9 +6,9 @@
  * Copyright (c) 1999-2004 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
- * This includes code to update < 4.1.0 globals to the newer format 
+ * This includes code to update < 4.1.0 globals to the newer format
  * It also has some session register functions that work across various
- * php versions. 
+ * php versions.
  *
  * @version $Id$
  * @package squirrelmail
 require_once(SM_PATH . 'config/config.php');
 
 /** set the name of the session cookie */
-if(isset($session_name) && $session_name) {  
-    ini_set('session.name' , $session_name);  
-} else {  
-    ini_set('session.name' , 'SQMSESSID');  
+if(isset($session_name) && $session_name) {
+    ini_set('session.name' , $session_name);
+} else {
+    ini_set('session.name' , 'SQMSESSID');
 }
 
 /** If magic_quotes_runtime is on, SquirrelMail breaks in new and creative ways.
@@ -54,23 +54,23 @@ if (get_magic_quotes_gpc()) {
 
 $_SERVER['PHP_SELF'] = strip_tags($_SERVER['PHP_SELF']);
 
-/** 
- * returns true if current php version is at mimimum a.b.c 
- * 
+/**
+ * returns true if current php version is at mimimum a.b.c
+ *
  * Called: check_php_version(4,1)
  * @param int a major version number
  * @param int b minor version number
  * @param int c release number
  * @return bool
  */
-function check_php_version ($a = '0', $b = '0', $c = '0')             
+function check_php_version ($a = '0', $b = '0', $c = '0')
 {
     return version_compare ( PHP_VERSION, "$a.$b.$c", 'ge' );
 }
 
 /**
- * returns true if the current internal SM version is at minimum a.b.c 
- * These are plain integer comparisons, as our internal version is 
+ * returns true if the current internal SM version is at minimum a.b.c
+ * These are plain integer comparisons, as our internal version is
  * constructed by us, as an array of 3 ints.
  *
  * Called: check_sm_version(1,3,3)
@@ -90,8 +90,8 @@ function check_sm_version($a = 0, $b = 0, $c = 0)
            $SQM_INTERNAL_VERSION[1] == $b &&
            $SQM_INTERNAL_VERSION[2] < $c ) ) {
         return FALSE;
-    } 
-    return TRUE;  
+    }
+    return TRUE;
 }
 
 
@@ -123,8 +123,8 @@ function sqsession_register ($var, $name) {
 
     sqsession_is_active();
 
-    $_SESSION["$name"] = $var; 
-    
+    $_SESSION["$name"] = $var;
+
     session_register("$name");
 }
 
@@ -138,7 +138,7 @@ function sqsession_unregister ($name) {
     sqsession_is_active();
 
     unset($_SESSION[$name]);
-    
+
     session_unregister("$name");
 }
 
@@ -151,11 +151,11 @@ function sqsession_unregister ($name) {
 function sqsession_is_registered ($name) {
     $test_name = &$name;
     $result = false;
-    
+
     if (isset($_SESSION[$test_name])) {
         $result = true;
     }
-    
+
     return $result;
 }
 
@@ -170,14 +170,14 @@ define('SQ_FORM',6);
 
 /**
  * Search for the var $name in $_SESSION, $_POST, $_GET,
- * $_COOKIE, or $_SERVER and set it in provided var. 
+ * $_COOKIE, or $_SERVER and set it in provided var.
  *
  * If $search is not provided,  or == SQ_INORDER, it will search
  * $_SESSION, then $_POST, then $_GET. Otherwise,
- * use one of the defined constants to look for 
+ * use one of the defined constants to look for
  * a var in one place specifically.
  *
- * Note: $search is an int value equal to one of the 
+ * Note: $search is an int value equal to one of the
  * constants defined above.
  *
  * example:
@@ -196,8 +196,8 @@ function sqgetGlobalVar($name, &$value, $search = SQ_INORDER) {
        enclosing them in quotes will cause them to evaluate
        as strings. */
     switch ($search) {
-        /* we want the default case to be first here,  
-          so that if a valid value isn't specified, 
+        /* we want the default case to be first here,
+          so that if a valid value isn't specified,
           all three arrays will be searched. */
       default:
       case SQ_INORDER: // check session, post, get
@@ -220,13 +220,13 @@ function sqgetGlobalVar($name, &$value, $search = SQ_INORDER) {
         if ( isset($_GET[$name]) ) {
             $value = $_GET[$name];
             return TRUE;
-        } 
+        }
         /* NO IF HERE. FOR SQ_INORDER CASE, EXIT after GET */
         break;
       case SQ_COOKIE:
         if ( isset($_COOKIE[$name]) ) {
             $value = $_COOKIE[$name];
-            return TRUE; 
+            return TRUE;
         }
         break;
       case SQ_SERVER:
@@ -278,7 +278,7 @@ function sqsession_destroy() {
  */
 
 function sqsession_is_active() {
-    
+
     $sessid = session_id();
     if ( empty( $sessid ) ) {
         session_start();
@@ -286,4 +286,4 @@ function sqsession_is_active() {
 }
 
 // vim: et ts=4
-?>
+?>
\ No newline at end of file
index 01e3ab1524aec26c0322cffdc03cc51082aecc17..91acef9542da20b5b00dde4b667b2a8bb19f127f 100644 (file)
@@ -51,7 +51,7 @@ function html_tag( $tag,                // Tag to output
         }
 
         if ( $bgcolor <> '' ) {
-            $bgc = " bgcolor=\"$bgcolor\""; 
+            $bgc = " bgcolor=\"$bgcolor\"";
         }
 
         switch ( $align ) {
@@ -84,7 +84,7 @@ function html_tag( $tag,                // Tag to output
             $ret .= ">$val</$tag>";
         } else {
             $ret .= '>';
-        } 
+        }
 
         return( $ret );
     }
@@ -100,7 +100,7 @@ function html_tag( $tag,                // Tag to output
                        '/.+(\\?'.$var.')=(.*)$/AU',     /* at front and only var */
                        '/.+(\\&'.$var.')=(.*)$/AU'      /* at the end */
                      );
-       preg_replace('/&amp;/','&',$url);            
+       preg_replace('/&amp;/','&',$url);
         switch (true) {
             case (preg_match($pat_a[0],$url,$regs)):
                 $k = $regs[1];
@@ -151,7 +151,7 @@ function html_tag( $tag,                // Tag to output
     function echo_template_var($var, $format_ar = array() ) {
         $frm_last = count($format_ar) -1;
 
-        if (isset($format_ar[0])) echo $format_ar[0]; 
+        if (isset($format_ar[0])) echo $format_ar[0];
             $i = 1;
 
         switch (true) {
@@ -179,4 +179,4 @@ function html_tag( $tag,                // Tag to output
             echo $format_ar[$frm_last];
         }
     }
-?>
+?>
\ No newline at end of file
index 83dfe3063cef78140383525d1f661ba17bfc8c18..58ab06ce95c9aff4cdc7c685692b022961c289ef 100644 (file)
@@ -27,7 +27,7 @@ require_once(SM_PATH . 'functions/global.php');
  * If Japanese translation is used - function returns string converted to euc-jp
  * If iconv or recode functions are enabled and translation uses utf-8 - function returns utf-8 encoded string.
  * If $charset is not supported - function returns unconverted string.
- * 
+ *
  * sanitizing of html tags is also done by this function.
  *
  * @param string $charset
@@ -62,8 +62,8 @@ function charset_decode ($charset, $string) {
               $charset = "iso-8859-8";
 
     /*
-     * Recode converts html special characters automatically if you use 
-     * 'charset..html' decoding. There is no documented way to put -d option 
+     * Recode converts html special characters automatically if you use
+     * 'charset..html' decoding. There is no documented way to put -d option
      * into php recode function call.
      */
     if ( $use_php_recode ) {
@@ -89,7 +89,7 @@ function charset_decode ($charset, $string) {
     // If we don't use recode and iconv, we'll do it old way.
 
     /* All HTML special characters are 7 bit and can be replaced first */
-    
+
     $string = htmlspecialchars ($string);
 
     /* controls cpu and memory intensive decoding cycles */
@@ -112,7 +112,7 @@ function charset_decode ($charset, $string) {
  * @param string $string
  * @param string $charset
  * @param boolean $htmlencode keep htmlspecialchars encoding
- * @param string 
+ * @param string
  */
 function charset_encode($string,$charset,$htmlencode=true) {
   global $default_charset;
@@ -159,7 +159,7 @@ function charset_convert($in_charset,$string,$out_charset,$htmlencode=true) {
 function fixcharset($charset) {
     // minus removed from function names
     $charset=str_replace('-','_',$charset);
-    
+
     // windows-125x and cp125x charsets
     $charset=str_replace('windows_','cp',$charset);
 
@@ -178,18 +178,18 @@ function fixcharset($charset) {
  * if $do_search is true, then scan the browser information
  * for a possible language that we know
  *
- * Function sets system locale environment (LC_ALL, LANG, LANGUAGE), 
+ * Function sets system locale environment (LC_ALL, LANG, LANGUAGE),
  * gettext translation bindings and html header information.
  *
  * Function returns error codes, if there is some fatal error.
- *  0 = no error, 
- *  1 = mbstring support is not present, 
+ *  0 = no error,
+ *  1 = mbstring support is not present,
  *  2 = mbstring support is not present, user's translation reverted to en_US.
  *
  * @param string $sm_language translation used by user's interface
  * @param bool $do_search use browser's preferred language detection functions. Defaults to false.
  * @param bool $default set $sm_language to $squirrelmail_default_language if language detection fails or language is not set. Defaults to false.
- * @return int function execution error codes. 
+ * @return int function execution error codes.
  */
 function set_up_language($sm_language, $do_search = false, $default = false) {
 
@@ -208,13 +208,13 @@ function set_up_language($sm_language, $do_search = false, $default = false) {
     if ($do_search && ! $sm_language && isset($accept_lang)) {
         $sm_language = substr($accept_lang, 0, 2);
     }
-    
+
     if ((!$sm_language||$default) && isset($squirrelmail_default_language)) {
         $squirrelmail_language = $squirrelmail_default_language;
         $sm_language = $squirrelmail_default_language;
     }
     $sm_notAlias = $sm_language;
+
     // Catching removed translation
     // System reverts to English translation if user prefs contain translation
     // that is not available in $languages array
@@ -253,7 +253,7 @@ function set_up_language($sm_language, $do_search = false, $default = false) {
         setlocale(LC_ALL, $longlocale);
 
         // Set text direction/alignment variables
-        if (isset($languages[$sm_notAlias]['DIR']) && 
+        if (isset($languages[$sm_notAlias]['DIR']) &&
             $languages[$sm_notAlias]['DIR'] == 'rtl') {
           /**
            * Text direction
@@ -350,7 +350,7 @@ if (! isset($squirrelmail_language)) {
  *
  * Structure of array:
  * $languages['language']['variable'] = 'value'
- * 
+ *
  * Possible 'variable' names:
  *  NAME      - Translation name in English
  *  CHARSET   - Encoding used by translation
@@ -359,7 +359,7 @@ if (! isset($squirrelmail_language)) {
  *  LOCALE    - Full locale name (in xx_XX.charset format)
  *  DIR       - Text direction. Used to define Right-to-Left languages. Possible values 'rtl' or 'ltr'. If undefined - defaults to 'ltr'
  *  XTRA_CODE - translation uses special functions. See doc/i18n.txt
- * 
+ *
  * Each 'language' definition requires NAME+CHARSET or ALIAS variables.
  *
  * @name $languages
@@ -713,7 +713,7 @@ function japanese_xtra() {
                 $detect_encoding == 'EUC-JP' ||
                 $detect_encoding == 'SJIS' ||
                 $detect_encoding == 'UTF-8') {
-                
+
                 $ret = mb_convert_kana(mb_convert_encoding($ret, 'EUC-JP', 'AUTO'), "KV");
             }
             break;
@@ -723,13 +723,13 @@ function japanese_xtra() {
                 $detect_encoding == 'EUC-JP' ||
                 $detect_encoding == 'SJIS' ||
                 $detect_encoding == 'UTF-8') {
-                
+
                 $ret = mb_convert_encoding(mb_convert_kana($ret, "KV"), 'JIS', 'AUTO');
             }
             break;
         case 'strimwidth':
             $width = func_get_arg(2);
-            $ret = mb_strimwidth($ret, 0, $width, '...'); 
+            $ret = mb_strimwidth($ret, 0, $width, '...');
             break;
         case 'encodeheader':
             $result = '';
@@ -744,7 +744,7 @@ function japanese_xtra() {
                         if ($prevcsize == 1) {
                             $result .= $tmpstr;
                         } else {
-                            $result .= str_replace(' ', '', 
+                            $result .= str_replace(' ', '',
                                                    mb_encode_mimeheader($tmpstr,'iso-2022-jp','B',''));
                         }
                         $tmpstr = $tmp;
@@ -788,23 +788,23 @@ function japanese_xtra() {
             $no_end = "\x5c\x24\x28\x5b\x7b\xa1\xf2\x5c\xa1\xc6\xa1\xc8\xa1\xd2\xa1" .
                 "\xd4\xa1\xd6\xa1\xd8\xa1\xda\xa1\xcc\xa1\xf0\xa1\xca\xa1\xce\xa1\xd0\xa1\xef";
             $wrap = func_get_arg(2);
-            
-            if (strlen($ret) >= $wrap && 
+
+            if (strlen($ret) >= $wrap &&
                 substr($ret, 0, 1) != '>' &&
                 strpos($ret, 'http://') === FALSE &&
                 strpos($ret, 'https://') === FALSE &&
                 strpos($ret, 'ftp://') === FALSE) {
-                
+
                 $ret = mb_convert_kana($ret, "KV");
 
                 $line_new = '';
                 $ptr = 0;
-                
+
                 while ($ptr < strlen($ret) - 1) {
                     $l = mb_strcut($ret, $ptr, $wrap);
                     $ptr += strlen($l);
                     $tmp = $l;
-                    
+
                     $l = mb_strcut($ret, $ptr, 2);
                     while (strlen($l) != 0 && mb_strpos($no_begin, $l) !== FALSE ) {
                         $tmp .= $l;
@@ -836,7 +836,7 @@ function japanese_xtra() {
 /**
  * Japanese decoding function
  *
- * converts string to euc-jp, if string uses JIS, EUC-JP, ShiftJIS or UTF-8 
+ * converts string to euc-jp, if string uses JIS, EUC-JP, ShiftJIS or UTF-8
  * charset. Needs mbstring support in php.
  * @param string $ret text, that has to be converted
  * @return string converted string
@@ -872,7 +872,7 @@ function japanese_xtra_encode($ret) {
             $detect_encoding == 'EUC-JP' ||
             $detect_encoding == 'SJIS' ||
             $detect_encoding == 'UTF-8') {
-            
+
             $ret = mb_convert_encoding(mb_convert_kana($ret, "KV"), 'JIS', 'AUTO');
         }
     }
@@ -901,7 +901,7 @@ function japanese_xtra_encodeheader($ret) {
                     if ($prevcsize == 1) {
                         $result .= $tmpstr;
                     } else {
-                        $result .= str_replace(' ', '', 
+                        $result .= str_replace(' ', '',
                                                mb_encode_mimeheader($tmpstr,'iso-2022-jp','B',''));
                     }
                     $tmpstr = $tmp;
@@ -924,7 +924,7 @@ function japanese_xtra_encodeheader($ret) {
 /**
  * Japanese header decoding function
  *
- * return human readable string from mime header. string is returned in euc-jp 
+ * return human readable string from mime header. string is returned in euc-jp
  * charset.
  * @param string $ret header string
  * @return string decoded header string
@@ -963,7 +963,7 @@ function japanese_xtra_downloadfilename($ret,$useragent) {
 
 /**
  * Japanese wordwrap function
- * 
+ *
  * wraps text at set number of symbols
  * @param string $ret text
  * @param integer $wrap number of symbols per line
@@ -982,23 +982,23 @@ function japanese_xtra_wordwrap($ret,$wrap) {
             "\xa8\xa1\xa9\xa1\xcf\xa1\xd1";
         $no_end = "\x5c\x24\x28\x5b\x7b\xa1\xf2\x5c\xa1\xc6\xa1\xc8\xa1\xd2\xa1" .
             "\xd4\xa1\xd6\xa1\xd8\xa1\xda\xa1\xcc\xa1\xf0\xa1\xca\xa1\xce\xa1\xd0\xa1\xef";
-        if (strlen($ret) >= $wrap && 
+
+        if (strlen($ret) >= $wrap &&
             substr($ret, 0, 1) != '>' &&
             strpos($ret, 'http://') === FALSE &&
             strpos($ret, 'https://') === FALSE &&
             strpos($ret, 'ftp://') === FALSE) {
 
             $ret = mb_convert_kana($ret, "KV");
-           
+
             $line_new = '';
             $ptr = 0;
-        
+
             while ($ptr < strlen($ret) - 1) {
                 $l = mb_strcut($ret, $ptr, $wrap);
                 $ptr += strlen($l);
                 $tmp = $l;
-            
+
                 $l = mb_strcut($ret, $ptr, 2);
                 while (strlen($l) != 0 && mb_strpos($no_begin, $l) !== FALSE ) {
                     $tmp .= $l;
@@ -1069,7 +1069,7 @@ function japanese_xtra_strimwidth($ret,$width) {
  * Korean downloaded filename processing functions
  *
  * @param string default return value
- * @return string 
+ * @return string
  */
 function korean_xtra_downloadfilename($ret) {
     $ret = str_replace("\x0D\x0A", '', $ret);  /* Hanmail's CR/LF Clear */
@@ -1090,9 +1090,9 @@ function korean_xtra_downloadfilename($ret) {
 
 /**
  * Replaces non-braking spaces inserted by some browsers with regular space
- * 
- * This function can be used to replace non-braking space symbols 
- * that are inserted in forms by some browsers instead of normal 
+ *
+ * This function can be used to replace non-braking space symbols
+ * that are inserted in forms by some browsers instead of normal
  * space symbol.
  *
  * @param string $string Text that needs to be cleaned
@@ -1133,14 +1133,14 @@ switch($output_charset):
    return $string;
 endswitch;
 
-// return space instead of non-braking space. 
+// return space instead of non-braking space.
  return str_replace($nbsp,' ',$string);
 }
 
 /**
  * Function informs if it is safe to convert given charset to the one that is used by user.
  *
- * It is safe to use conversion only if user uses utf-8 encoding and when 
+ * It is safe to use conversion only if user uses utf-8 encoding and when
  * converted charset is similar to the one that is used by user.
  *
  * @param string $input_charset Charset of text that needs to be converted
@@ -1160,7 +1160,7 @@ function is_conversion_safe($input_charset) {
  // Charsets that are similar
 switch ($default_charset):
 case "windows-1251":
-      if ( $input_charset == "iso-8859-5" || 
+      if ( $input_charset == "iso-8859-5" ||
            $input_charset == "koi8-r" ||
            $input_charset == "koi8-u" ) {
         return true;
@@ -1168,22 +1168,22 @@ case "windows-1251":
         return false;
      }
 case "windows-1257":
-  if ( $input_charset == "iso-8859-13" || 
+  if ( $input_charset == "iso-8859-13" ||
        $input_charset == "iso-8859-4" ) {
     return true;
   } else {
     return false;
   }
 case "iso-8859-4":
-  if ( $input_charset == "iso-8859-13" || 
+  if ( $input_charset == "iso-8859-13" ||
        $input_charset == "windows-1257" ) {
      return true;
   } else {
      return false;
   }
 case "iso-8859-5":
-  if ( $input_charset == "windows-1251" || 
-       $input_charset == "koi8-r" || 
+  if ( $input_charset == "windows-1251" ||
+       $input_charset == "koi8-r" ||
        $input_charset == "koi8-u" ) {
      return true;
   } else {
@@ -1198,7 +1198,7 @@ case "iso-8859-13":
   }
 case "koi8-r":
   if ( $input_charset == "windows-1251" ||
-       $input_charset == "iso-8859-5" || 
+       $input_charset == "iso-8859-5" ||
        $input_charset == "koi8-u" ) {
      return true;
   } else {
index e4e0d4d1f1dd0d8ba7b2c1191d8e3919a97a6082..a400321a355ea362e7ca7ad734c81c9c78275513 100644 (file)
@@ -51,4 +51,4 @@ function get_identities() {
     return $identities;
 }
 
-?>
+?>
\ No newline at end of file
index 0f0bfb8f09ff4830876b9bbe45c2dd683ea3c93c..cd2e55ba25fa55f01332b7507f8c4b7a9df98201 100644 (file)
@@ -20,4 +20,4 @@ require_once(SM_PATH . 'functions/imap_messages.php');
 require_once(SM_PATH . 'functions/imap_general.php');
 require_once(SM_PATH . 'functions/imap_search.php');
 
-?>
+?>
\ No newline at end of file
index e7b456e241853a65bb1a06d4fe0a02ebaabf1e49..4faef27bd36a3fef123a1ac50f000a1a665ffcae 100755 (executable)
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * imap_mailbox.php
  *
index 29ad63bbe4e0641484aee3056a27625e03f2656c..7995b30a4e43bb0cfc517c3168eb9aa72796bd08 100644 (file)
@@ -25,7 +25,7 @@ function sqimap_search($imapConnection, $search_where, $search_what, $mailbox,
                        $color, $search_position = '', $search_all, $count_all) {
 
     global $message_highlight_list, $squirrelmail_language, $languages,
-           $index_order, $pos, $allow_charset_search, 
+           $index_order, $pos, $allow_charset_search,
           $imap_server_type;
 
     $pos = $search_position;
@@ -39,7 +39,7 @@ function sqimap_search($imapConnection, $search_where, $search_what, $mailbox,
     $multi_search = explode(' ', $search_what);
     $search_string = '';
 
-    /* it seems macosx does not support the prefered search 
+    /* it seems macosx does not support the prefered search
        syntax so we fall back to the older style. This IMAP
        server has a problem with multiple search terms. Instead
        of returning the messages that match all the terms it
@@ -71,7 +71,7 @@ function sqimap_search($imapConnection, $search_where, $search_what, $mailbox,
     if ($allow_charset_search && isset($languages[$squirrelmail_language]['CHARSET']) &&
         $languages[$squirrelmail_language]['CHARSET']) {
         $ss = "SEARCH CHARSET "
-            . strtoupper($languages[$squirrelmail_language]['CHARSET']) 
+            . strtoupper($languages[$squirrelmail_language]['CHARSET'])
             . " ALL $search_string";
     } else {
         $ss = "SEARCH ALL $search_string";
@@ -81,10 +81,10 @@ function sqimap_search($imapConnection, $search_where, $search_what, $mailbox,
     $readin = sqimap_run_command($imapConnection, $ss, false, $result, $message, TRUE);
 
     /* try US-ASCII charset if search fails */
-    if (isset($languages[$squirrelmail_language]['CHARSET']) 
+    if (isset($languages[$squirrelmail_language]['CHARSET'])
         && strtolower($result) == 'no') {
         $ss = "SEARCH CHARSET \"US-ASCII\" ALL $search_string";
-        $readin = sqimap_run_command ($imapConnection, $ss, true, 
+        $readin = sqimap_run_command ($imapConnection, $ss, true,
                                       $result, $message);
     }
 
@@ -126,4 +126,4 @@ function sqimap_search($imapConnection, $search_where, $search_what, $mailbox,
 
 
 
-?>
+?>
\ No newline at end of file
index 17961e14a590d021558937fb8b9f859eb52d254f..86acabb73c328c4e998486832afec439cf5bfd66 100644 (file)
  */
 function sqimap_mb_convert_encoding($str, $to_encoding, $from_encoding, $default_charset)
 {
-  // Allows mbstring functions only with iso-8859-*, utf-8 and 
+  // Allows mbstring functions only with iso-8859-*, utf-8 and
   // iso-2022-jp (Japanese)
   // koi8-r and gb2312 can be added only in php 4.3+
   if ( stristr($default_charset, 'iso-8859-') ||
-       stristr($default_charset, 'utf-8') || 
+       stristr($default_charset, 'utf-8') ||
        stristr($default_charset, 'iso-2022-jp') ) {
     if (function_exists('mb_convert_encoding')) {
       return mb_convert_encoding($str, $to_encoding, $from_encoding);
@@ -37,7 +37,7 @@ function sqimap_mb_convert_encoding($str, $to_encoding, $from_encoding, $default
 
 function imap_utf7_encode_local($s) {
     global $languages, $squirrelmail_language;
-    
+
     if (isset($languages[$squirrelmail_language]['XTRA_CODE']) &&
         function_exists($languages[$squirrelmail_language]['XTRA_CODE'].'_utf7_imap_encode')) {
         return call_user_func($languages[$squirrelmail_language]['XTRA_CODE'] . '_utf7_imap_encode', $s);
@@ -54,8 +54,8 @@ function imap_utf7_encode_local($s) {
         return $utf7_s;
     }
 
-    // Later code works only for ISO-8859-1 
-    
+    // Later code works only for ISO-8859-1
+
        $b64_s = '';    // buffer for substring to be base64-encoded
        $utf7_s = '';   // imap-utf7-encoded string
        for ($i = 0; $i < strlen($s); $i++) {
@@ -90,7 +90,7 @@ function imap_utf7_encode_local($s) {
 
 function imap_utf7_decode_local($s) {
     global $languages, $squirrelmail_language;
-    
+
     if (isset($languages[$squirrelmail_language]['XTRA_CODE']) &&
         function_exists($languages[$squirrelmail_language]['XTRA_CODE'] . '_utf7_imap_decode')) {
         return call_user_func($languages[$squirrelmail_language]['XTRA_CODE'] . '_utf7_imap_decode', $s);
@@ -108,7 +108,7 @@ function imap_utf7_decode_local($s) {
     }
 
     // Later code works only for ISO-8859-1
-    
+
        $b64_s = '';
        $iso_8859_1_s = '';
        for ($i = 0, $len = strlen($s); $i < $len; $i++) {
@@ -223,4 +223,4 @@ function decodeBASE64($s) {
        return $d;
 }
 
-?>
+?>
\ No newline at end of file
index cd42c7b2fdc8f1dc4bfd7a9351b94529ec600efd..53a4e6bc5333132fe2d7489258285b6bf8bf4d8f 100644 (file)
@@ -20,4 +20,4 @@ header("Location:../index.php");
 
 /* pretty impressive huh? */
 
-?>
+?>
\ No newline at end of file
index 53b67c41e73466ee7c7699abcf2f73fa7da490c9..08a513130b575747409682f59df4bd28e5bb6817 100644 (file)
@@ -1,17 +1,17 @@
 <?php
 
 /**
-* mailbox_display.php
-*
-* Copyright (c) 1999-2004 The SquirrelMail Project Team
-* Licensed under the GNU GPL. For full terms see the file COPYING.
-*
-* This contains functions that display mailbox information, such as the
-* table row that has sender, date, subject, etc...
-*
-* @version $Id$
-* @package squirrelmail
-*/
+ * mailbox_display.php
+ *
+ * Copyright (c) 1999-2004 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * This contains functions that display mailbox information, such as the
+ * table row that has sender, date, subject, etc...
+ *
+ * @version $Id$
+ * @package squirrelmail
+ */
 
 /** The standard includes.. */
 require_once(SM_PATH . 'functions/strings.php');
@@ -24,18 +24,18 @@ require_once(SM_PATH . 'functions/mime.php');
 require_once(SM_PATH . 'functions/forms.php');
 
 /**
-* default value for page_selector_max
-*/
+ * default value for page_selector_max
+ */
 define('PG_SEL_MAX', 10);
 
 /**
-* The number of pages to cache msg headers
-*/
+ * The number of pages to cache msg headers
+ */
 define('SQM_MAX_PAGES_IN_CACHE',5);
 
 /**
-* Sort constants used for sorting of messages
-*/
+ * Sort constants used for sorting of messages
+ */
 define('SQSORT_NONE',0);
 define('SQSORT_DATE_ASC',1);
 define('SQSORT_DATE_DEC',2);
@@ -63,8 +63,8 @@ define('SQM_MAX_MBX_IN_CACHE',3);
 // define('MBX_PREF_FUTURE',unique integer key);
 
 /**
-* @param mixed $start UNDOCUMENTED
-*/
+ * @param mixed $start UNDOCUMENTED
+ */
 function elapsed($start) {
 
     $end = microtime();
@@ -80,11 +80,11 @@ function elapsed($start) {
 }
 
 /**
-* Displays message header row in messages list
-*
-* @param  array $aMsg contains all message related parameters
-* @return void
-*/
+ * Displays message header row in messages list
+ *
+ * @param  array $aMsg contains all message related parameters
+ * @return void
+ */
 
 function printMessageInfo($aMsg) {
     // FIX ME, remove these globals as well by adding an array as argument for the user settings
@@ -710,12 +710,12 @@ function sqm_api_mailbox_select($imapConnection,$mailbox,$aConfig,$aProps) {
 
 
 /**
-* Does the $srt $_GET var to field mapping
-*
-* @param int $srt Field to sort on
-* @param bool $bServerSort Server sorting is true
-* @return string $sSortField Field to sort on
-*/
+ * Does the $srt $_GET var to field mapping
+ *
+ * @param int $srt Field to sort on
+ * @param bool $bServerSort Server sorting is true
+ * @return string $sSortField Field to sort on
+ */
 function getSortField($sort,$bServerSort) {
     switch($sort) {
         case SQSORT_NONE:
@@ -932,10 +932,10 @@ function fetchMessageHeaders($imapConnection, &$aMailbox) {
             }
 
             /**
-            * retrieve messages by sequence id's and fetch the UID to retrieve
-            * the UID. for sorted lists this is not needed because a UID FETCH
-            * automaticly add the UID value in fetch results
-            **/
+             * retrieve messages by sequence id's and fetch the UID to retrieve
+             * the UID. for sorted lists this is not needed because a UID FETCH
+             * automaticly add the UID value in fetch results
+             **/
             $aFetchItems[] = 'UID';
 
             //create id range
@@ -999,12 +999,12 @@ function fetchMessageHeaders($imapConnection, &$aMailbox) {
 }
 
 /**
-* This function loops through a group of messages in the mailbox
-* and shows them to the user.
-*
-* @param mixed $imapConnection
-* @param array $aMailbox associative array with mailbox related vars
-*/
+ * This function loops through a group of messages in the mailbox
+ * and shows them to the user.
+ *
+ * @param mixed $imapConnection
+ * @param array $aMailbox associative array with mailbox related vars
+ */
 function showMessagesForMailbox($imapConnection, &$aMailbox) {
     global $color;
 
@@ -1063,15 +1063,15 @@ function showMessagesForMailbox($imapConnection, &$aMailbox) {
 }
 
 /**
-* Function to map an uid list with a msg header array by uid
-* The mapped headers are printed with printMessage
-* aMailbox parameters contains info about the page we are on, the
-* used search criteria, the number of messages to show
-*
-* @param resource $imapConnection socket handle to imap
-* @param array    $aMailbox array with required elements MSG_HEADERS, UIDSET, OFFSET, LIMIT
-* @return void
-**/
+ * Function to map an uid list with a msg header array by uid
+ * The mapped headers are printed with printMessage
+ * aMailbox parameters contains info about the page we are on, the
+ * used search criteria, the number of messages to show
+ *
+ * @param resource $imapConnection socket handle to imap
+ * @param array    $aMailbox array with required elements MSG_HEADERS, UIDSET, OFFSET, LIMIT
+ * @return void
+ **/
 function displayMessageArray($imapConnection, $aMailbox) {
     $iSetIndx    = $aMailbox['SETINDEX'];
     $aId         = $aMailbox['UIDSET'][$iSetIndx];
@@ -1123,15 +1123,15 @@ function displayMessageArray($imapConnection, $aMailbox) {
 }
 
 /**
-* Displays the standard message list header.
-*
-* To finish the table, you need to do a "</table></table>";
-*
-* @param resource $imapConnection
-* @param array    $aMailbox associative array with mailbox related information
-* @param string   $msg_cnt_str
-* @param string   $paginator Paginator string
-*/
+ * Displays the standard message list header.
+ *
+ * To finish the table, you need to do a "</table></table>";
+ *
+ * @param resource $imapConnection
+ * @param array    $aMailbox associative array with mailbox related information
+ * @param string   $msg_cnt_str
+ * @param string   $paginator Paginator string
+ */
 function mail_message_listing_beginning ($imapConnection,
                                          $aMailbox,
                                          $msg_cnt_str = '',
@@ -1256,13 +1256,13 @@ function mail_message_listing_beginning ($imapConnection,
 }
 
 /**
-* Function to add the last row in a message list, it contains the paginator and info about
-* the number of messages.
-*
-* @param integer $num_msgs number of messages in a mailbox
-* @param string  $paginator_str Paginator string  [Prev | Next]  [ 1 2 3 ... 91 92 94 ]  [Show all]
-* @param string  $msg_cnt_str   Message count string Viewing Messages: 21 to 1861 (20 total)
-*/
+ * Function to add the last row in a message list, it contains the paginator and info about
+ * the number of messages.
+ *
+ * @param integer $num_msgs number of messages in a mailbox
+ * @param string  $paginator_str Paginator string  [Prev | Next]  [ 1 2 3 ... 91 92 94 ]  [Show all]
+ * @param string  $msg_cnt_str   Message count string Viewing Messages: 21 to 1861 (20 total)
+ */
 function mail_message_listing_end($num_msgs, $paginator_str, $msg_cnt_str) {
 global $color;
 if ($num_msgs) {
@@ -1294,10 +1294,10 @@ if ($num_msgs) {
 }
 
 /**
-* Prints the table header for the messages list view
-*
-* @param array $aMailbox
-*/
+ * Prints the table header for the messages list view
+ *
+ * @param array $aMailbox
+ */
 function printHeader($aMailbox) {
     global $index_order, $internal_date_sort, $color;
 
@@ -1310,7 +1310,7 @@ function printHeader($aMailbox) {
     echo html_tag( 'tr' ,'' , 'center', $color[5] );
 
     /* calculate the width of the subject column based on the
-    * widths of the other columns */
+     * widths of the other columns */
     $widths = array(1=>1,2=>25,3=>5,4=>0,5=>1,6=>5);
     $subjectwidth = 100;
     foreach($index_order as $item) {
@@ -1376,12 +1376,12 @@ function printHeader($aMailbox) {
 
 
 /**
-* This function shows the sort button. Isn't this a good comment?
-*
-* @param array $aMailbox
-* @param integer $Down
-* @param integer $Up
-*/
+ * This function shows the sort button. Isn't this a good comment?
+ *
+ * @param array $aMailbox
+ * @param integer $Down
+ * @param integer $Up
+ */
 function ShowSortButton($aMailbox, $Down, $Up ) {
     global $PHP_SELF;
 
@@ -1412,10 +1412,10 @@ function ShowSortButton($aMailbox, $Down, $Up ) {
 }
 
 /**
-* FIXME: Undocumented function
-*
-* @param array $aMailbox
-*/
+ * FIXME: Undocumented function
+ *
+ * @param array $aMailbox
+ */
 function get_selectall_link($aMailbox) {
     global $checkall, $javascript_on;
     global $PHP_SELF;
@@ -1469,13 +1469,13 @@ function get_selectall_link($aMailbox) {
 }
 
 /**
-* This function computes the "Viewing Messages..." string.
-*
-* @param integer $start_msg first message number
-* @param integer $end_msg last message number
-* @param integer $num_msgs total number of message in folder
-* @return string
-*/
+ * This function computes the "Viewing Messages..." string.
+ *
+ * @param integer $start_msg first message number
+ * @param integer $end_msg last message number
+ * @param integer $num_msgs total number of message in folder
+ * @return string
+ */
 function get_msgcnt_str($start_msg, $end_msg, $num_msgs) {
     /* Compute the $msg_cnt_str. */
     $result = '';
@@ -1492,14 +1492,14 @@ function get_msgcnt_str($start_msg, $end_msg, $num_msgs) {
 }
 
 /**
-* Generate a paginator link.
-*
-* @param mixed $box Mailbox name
-* @param mixed $start_msg Message Offset
-* @param mixed $use
-* @param string $text text used for paginator link
-* @return string
-*/
+ * Generate a paginator link.
+ *
+ * @param mixed $box Mailbox name
+ * @param mixed $start_msg Message Offset
+ * @param mixed $use
+ * @param string $text text used for paginator link
+ * @return string
+ */
 function get_paginator_link($box, $start_msg, $text) {
     sqgetGlobalVar('PHP_SELF',$php_self,SQ_SERVER);
     $result = "<a href=\"$php_self?startMessage=$start_msg&amp;mailbox=$box\" "
@@ -1509,15 +1509,15 @@ function get_paginator_link($box, $start_msg, $text) {
 }
 
 /**
-* This function computes the paginator string.
-*
-* @param string  $box      mailbox name
-* @param integer $iOffset  offset in total number of messages
-* @param integer $iTotal   total number of messages
-* @param integer $iLimit   maximum number of messages to show on a page
-* @param bool    $bShowAll show all messages at once (non paginate mode)
-* @return string $result   paginate string with links to pages
-*/
+ * This function computes the paginator string.
+ *
+ * @param string  $box      mailbox name
+ * @param integer $iOffset  offset in total number of messages
+ * @param integer $iTotal   total number of messages
+ * @param integer $iLimit   maximum number of messages to show on a page
+ * @param bool    $bShowAll show all messages at once (non paginate mode)
+ * @return string $result   paginate string with links to pages
+ */
 function get_paginator_str($box, $iOffset, $iTotal, $iLimit, $bShowAll) {
     global $username, $data_dir;
     sqgetGlobalVar('PHP_SELF',$php_self,SQ_SERVER);
@@ -1680,9 +1680,9 @@ function get_paginator_str($box, $iOffset, $iTotal, $iLimit, $bShowAll) {
 
     /* Put all the pieces of the paginator string together. */
     /**
-    * Hairy code... But let's leave it like it is since I am not certain
-    * a different approach would be any easier to read. ;)
-    */
+     * Hairy code... But let's leave it like it is since I am not certain
+     * a different approach would be any easier to read. ;)
+     */
     $result = '';
     if ( $prv_str || $nxt_str ) {
 
@@ -1710,8 +1710,8 @@ function get_paginator_str($box, $iOffset, $iTotal, $iLimit, $bShowAll) {
 }
 
 /**
-* FIXME: Undocumented function
-*/
+ * FIXME: Undocumented function
+ */
 function truncateWithEntities($subject, $trim_at)
 {
     $ent_strlen = strlen($subject);
@@ -1721,11 +1721,11 @@ function truncateWithEntities($subject, $trim_at)
     global $languages, $squirrelmail_language;
 
     /*
-    * see if this is entities-encoded string
-    * If so, Iterate through the whole string, find out
-    * the real number of characters, and if more
-    * than $trim_at, substr with an updated trim value.
-    */
+     * see if this is entities-encoded string
+     * If so, Iterate through the whole string, find out
+     * the real number of characters, and if more
+     * than $trim_at, substr with an updated trim value.
+     */
     $trim_val = $trim_at;
     $ent_offset = 0;
     $ent_loc = 0;
@@ -1753,8 +1753,8 @@ function truncateWithEntities($subject, $trim_at)
 }
 
 /**
-* FIXME: Undocumented function
-*/
+ * FIXME: Undocumented function
+ */
 function processSubject($subject, $threadlevel = 0) {
     /* Shouldn't ever happen -- caught too many times in the IMAP functions */
     if ($subject == '') {
@@ -1773,15 +1773,15 @@ function processSubject($subject, $threadlevel = 0) {
 
 
 /**
-* Creates button
-*
-* @deprecated see form functions available in 1.5.1 and 1.4.3.
-* @param string $type
-* @param string $name
-* @param string $value
-* @param string $js
-* @param bool $enabled
-*/
+ * Creates button
+ *
+ * @deprecated see form functions available in 1.5.1 and 1.4.3.
+ * @param string $type
+ * @param string $name
+ * @param string $value
+ * @param string $js
+ * @param bool $enabled
+ */
 function getButton($type, $name, $value, $js = '', $enabled = TRUE) {
     $disabled = ( $enabled ? '' : 'disabled ' );
     $js = ( $js ? $js.' ' : '' );
@@ -1793,11 +1793,11 @@ function getButton($type, $name, $value, $js = '', $enabled = TRUE) {
 }
 
 /**
-* Puts string into cell, aligns it and adds <small> tag
-*
-* @param string $string string
-* @param string $align alignment
-*/
+ * Puts string into cell, aligns it and adds <small> tag
+ *
+ * @param string $string string
+ * @param string $align alignment
+ */
 function getSmallStringCell($string, $align) {
     return html_tag('td',
                     '<small>' . $string . ':&nbsp; </small>',
@@ -1807,9 +1807,9 @@ function getSmallStringCell($string, $align) {
 }
 
 /**
-* This should go in imap_mailbox.php
-* @param string $mailbox
-*/
+ * This should go in imap_mailbox.php
+ * @param string $mailbox
+ */
 function handleAsSent($mailbox) {
     global $handleAsSent_result;
 
index dd64ca8ec1a36fe45ffb8edebec40674232f5d26..f70fbf66f252407031ad2425df289cb7f7dac337 100644 (file)
@@ -154,7 +154,7 @@ class SquirrelOption {
     function createHTMLWidget() {
         global $javascript_on;
 
-        // Use new value if available 
+        // Use new value if available
         if (!empty($this->new_value)) {
             $tempValue = $this->value;
             $this->value = $this->new_value;
@@ -197,7 +197,7 @@ class SquirrelOption {
 
         /* Add the "post script" for this option. */
         $result .= $this->post_script;
-        
+
         // put correct value back if need be
         if (!empty($this->new_value)) {
             $this->value = $tempValue;
@@ -227,7 +227,7 @@ class SquirrelOption {
         }
 
         $result = "<input type=\"text\" name=\"new_$this->name\" value=\"" .
-            htmlspecialchars($this->value) . 
+            htmlspecialchars($this->value) .
             "\" size=\"$width\" $this->script />$this->trailing_text\n";
         return ($result);
     }
@@ -239,7 +239,7 @@ class SquirrelOption {
         /* Add each possible value to the select list. */
         foreach ($this->possible_values as $real_value => $disp_value) {
             /* Start the next new option string. */
-            $new_option = '<option value="' . 
+            $new_option = '<option value="' .
                 htmlspecialchars($real_value) . '"';
 
             /* If this value is the current value, select it. */
@@ -267,24 +267,24 @@ class SquirrelOption {
 
         /* Add each possible value to the select list. */
         foreach ($this->possible_values as $real_value => $disp_value) {
-            if ( is_array($disp_value) ) { 
+            if ( is_array($disp_value) ) {
               /* For folder list, we passed in the array of boxes.. */
               $new_option = sqimap_mailbox_option_list(0, $selected, 0, $disp_value);
             } else {
               /* Start the next new option string. */
               $new_option = '<option value="' . htmlspecialchars($real_value) . '"';
-  
+
               /* If this value is the current value, select it. */
               if ($real_value == $this->value) {
                  $new_option .= ' selected="selected"';
               }
-  
+
               /* Add the display value to our option string. */
               $new_option .= '>' . htmlspecialchars($disp_value) . "</option>\n";
             }
             /* And add the new option string to our select tag. */
             $result .= $new_option;
-        }        
+        }
         /* Close the select tag and return our happy result. */
         $result .= "</select>\n";
         return ($result);
@@ -322,11 +322,11 @@ class SquirrelOption {
     }
 
     function createWidget_Float() {
-        
+
         global $javascript_on;
 
         // add onChange javascript handler to a regular string widget
-        // which will strip out all non-numeric (period also OK) chars 
+        // which will strip out all non-numeric (period also OK) chars
         if ($javascript_on)
            return preg_replace('/\/>/', ' onChange="origVal=this.value; newVal=\'\'; '
                     . 'for (i=0;i<origVal.length;i++) { if ((origVal.charAt(i)>=\'0\' '
@@ -340,11 +340,11 @@ class SquirrelOption {
     function createWidget_Boolean() {
         /* Do the whole current value thing. */
         if ($this->value != SMPREF_NO) {
-            $yes_chk = ' checked=""';
+            $yes_chk = ' checked="checked"';
             $no_chk = '';
         } else {
             $yes_chk = '';
-            $no_chk = ' checked=""';
+            $no_chk = ' checked="checked"';
         }
 
         /* Build the yes choice. */
index fd072dc954176397bdc3dd8fa116a00aa9f2831a..afbe6b897ad19f093ba74f3e821a6ca9a5572bc7 100644 (file)
@@ -46,16 +46,16 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE
         echo '<link rel="stylesheet" type="text/css" href="' .
              $base_uri . 'themes/css/'.$custom_css.'" />';
     }
-    
+
     if ($squirrelmail_language == 'ja_JP') {
         echo "<!-- \xfd\xfe -->\n";
         echo '<meta http-equiv="Content-type" content="text/html; charset=euc-jp" />' . "\n";
     }
-    
+
     if ($do_hook) {
         do_hook('generic_header');
     }
-    
+
     echo "\n<title>$title</title>$xtra\n";
 
     /* work around IE6's scrollbar bug */
@@ -63,9 +63,9 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE
 <style type="text/css">
 <!--
   /* avoid stupid IE6 bug with frames and scrollbars */
-  body { 
-      voice-family: "\"}\""; 
-      voice-family: inherit; 
+  body {
+      voice-family: "\"}\"";
+      voice-family: inherit;
       width: expression(document.documentElement.clientWidth - 30);
   }
 -->
@@ -139,8 +139,8 @@ function displayPageHeader($color, $mailbox, $xtra='', $session=false) {
         $compose_uri = $base_uri.'src/compose.php?newmessage=1';
     $session = 0;
     }
-  
-    if($javascript_on) { 
+
+    if($javascript_on) {
 
       switch ( $module ) {
         case 'src/read_body.php':
@@ -232,12 +232,12 @@ function displayPageHeader($color, $mailbox, $xtra='', $session=false) {
                         "document.forms[i-1].elements[pos].focus();\n".
                     "}\n".
                 "}\n";
-        
+
             $js .= "// -->\n".
                  "</script>\n";
             $onload = 'onload="checkForm();"';
             displayHtmlHeader ('SquirrelMail', $js);
-            break;   
+            break;
 
         default:
             $js = '<script language="JavaScript" type="text/javascript">' .
@@ -263,7 +263,7 @@ function displayPageHeader($color, $mailbox, $xtra='', $session=false) {
                     "}\n".
             "$xtra\n".
                 "}\n";
-        
+
                 if ($compose_new_win == '1') {
                     if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) {
                         $compose_width = '640';
@@ -283,10 +283,10 @@ function displayPageHeader($color, $mailbox, $xtra='', $session=false) {
 
                 }
             $js .= "// -->\n". "</script>\n";
-    
+
             $onload = 'onload="checkForm();"';
             displayHtmlHeader ('SquirrelMail', $js);
-            break;   
+            break;
 
         }
     } else {
@@ -416,7 +416,7 @@ function compose_Header($color, $mailbox) {
                  "</script>\n";
             $onload = 'onload="checkForm();"';
             displayHtmlHeader (_("Compose"), $js);
-            break;   
+            break;
         }
     } else {
         /* javascript off */
@@ -427,4 +427,4 @@ function compose_Header($color, $mailbox) {
     echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\" $onload>\n\n";
 }
 
-?>
+?>
\ No newline at end of file
index 79416cba3ec7e19b932391b400914fe5658397d5..aaa12f0378b4ead34dcb38d4b72033c8c3d3c96f 100644 (file)
@@ -20,7 +20,7 @@ sqgetGlobalVar('prefs_are_cached', $prefs_are_cached, SQ_SESSION );
 
 if ( !sqsession_is_registered('prefs_are_cached') ||
      !isset( $prefs_cache) ||
-     !is_array( $prefs_cache) 
+     !is_array( $prefs_cache)
    ) {
     $prefs_are_cached = false;
     $prefs_cache = array();
@@ -53,7 +53,7 @@ function getHashedFile($username, $dir, $datafile, $hash_search = true) {
     if (substr($dir, -1) == '/') {
         $dir = substr($dir, 0, strlen($dir) - 1);
     }
-    
+
     /* Compute the hash for this user and extract the hash directories. */
     $hash_dirs = computeHashDirs($username);
 
@@ -82,7 +82,7 @@ function getHashedFile($username, $dir, $datafile, $hash_search = true) {
             }
         }
     }
-     
+
     /* Return the full hashed datafile path. */
     return ($result);
 }
@@ -103,7 +103,7 @@ function getHashedDir($username, $dir, $hash_dirs = '') {
     if (substr($dir, -1) == '/') {
         $dir = substr($dir, 0, strlen($dir) - 1);
     }
-    
+
     /* If necessary, populate the hash dir variable. */
     if ($hash_dirs == '') {
         $hash_dirs = computeHashDirs($username);
index e4f39977cebff3408d25b52e16aca6931ed84b54..6fc75fc2e415e1e60aa930bb99727704e2a6034d 100644 (file)
@@ -143,7 +143,7 @@ function walkTreeInPostOrderCreatingFoldersUnderTrash($index, $imap_stream, $tre
 
     if ($tree[$index]['doIHaveChildren']) {
         sqimap_mailbox_create($imap_stream, $trash_folder . $delimiter . $subFolderName, "");
-        $mbx_response = sqimap_mailbox_select($imap_stream, $tree[$index]['value']);       
+        $mbx_response = sqimap_mailbox_select($imap_stream, $tree[$index]['value']);
         $messageCount = $mbx_response['EXISTS'];
         if ($messageCount > 0) {
             sqimap_messages_copy($imap_stream, 1, '*', $trash_folder . $delimiter . $subFolderName);
index 1a0a50d8d143033d7398f69083bd598a9b8752b0..ca1b52d10ce155a86eecc772c24952e0ad8a9eb0 100644 (file)
@@ -85,8 +85,8 @@ $url_parser_url_tokens = array(
     'news://');
 
 global $url_parser_poss_ends;
-$url_parser_poss_ends = array(' ', "\n", "\r", '<', '>', ".\r", ".\n", 
-    '.&nbsp;', '&nbsp;', ')', '(', '&quot;', '&lt;', '&gt;', '.<', 
+$url_parser_poss_ends = array(' ', "\n", "\r", '<', '>', ".\r", ".\n",
+    '.&nbsp;', '&nbsp;', ')', '(', '&quot;', '&lt;', '&gt;', '.<',
     ']', '[', '{', '}', "\240", ', ', '. ', ",\n", ",\r");
 
 
@@ -197,5 +197,5 @@ function parseUrl (&$body) {
         $start   = $target_pos;
         $blength = strlen($body);
     }
-} 
-?>
+}
+?>
\ No newline at end of file