From 413df054ad3235c59c24e897b616c569adc4f67b Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 12 Aug 2012 05:47:45 -0400
Subject: [PATCH] CS fixes (mostly tab -> spaces)

---
 program/include/rcube_smtp.php       |    2 
 program/include/html.php             |   26 +++++---
 program/include/rcube_cache.php      |    4 
 program/include/rcube_plugin_api.php |    4 
 program/include/rcube_utils.php      |   10 +-
 program/include/rcube_imap.php       |   22 +++---
 program/include/rcube_ldap.php       |    8 +-
 program/include/clisetup.php         |   49 ++++++++-------
 program/include/rcube_session.php    |   11 ++-
 program/include/rcube_user.php       |    2 
 program/include/rcube_config.php     |    4 
 11 files changed, 75 insertions(+), 67 deletions(-)

diff --git a/program/include/clisetup.php b/program/include/clisetup.php
index 039020b..a9af90a 100644
--- a/program/include/clisetup.php
+++ b/program/include/clisetup.php
@@ -33,33 +33,36 @@
  */
 function get_opt($aliases = array())
 {
-	$args = array();
-	for ($i=1; $i < count($_SERVER['argv']); $i++) {
-		$arg = $_SERVER['argv'][$i];
-		$value = true;
-		$key = null;
+    $args = array();
 
-		if ($arg[0] == '-') {
-			$key = preg_replace('/^-+/', '', $arg);
-			$sp = strpos($arg, '=');
-			if ($sp > 0) {
-				$key = substr($key, 0, $sp - 2);
-				$value = substr($arg, $sp+1);
-			}
-			else if (strlen($_SERVER['argv'][$i+1]) && $_SERVER['argv'][$i+1][0] != '-') {
-				$value = $_SERVER['argv'][++$i];
-			}
+    for ($i=1; $i < count($_SERVER['argv']); $i++) {
+        $arg   = $_SERVER['argv'][$i];
+        $value = true;
+        $key   = null;
 
-			$args[$key] = is_string($value) ? preg_replace(array('/^["\']/', '/["\']$/'), '', $value) : $value;
-		}
-		else
-			$args[] = $arg;
+        if ($arg[0] == '-') {
+            $key = preg_replace('/^-+/', '', $arg);
+            $sp  = strpos($arg, '=');
+            if ($sp > 0) {
+                $key   = substr($key, 0, $sp - 2);
+                $value = substr($arg, $sp+1);
+            }
+            else if (strlen($_SERVER['argv'][$i+1]) && $_SERVER['argv'][$i+1][0] != '-') {
+                $value = $_SERVER['argv'][++$i];
+            }
 
-		if ($alias = $aliases[$key])
-			$args[$alias] = $args[$key];
-	}
+            $args[$key] = is_string($value) ? preg_replace(array('/^["\']/', '/["\']$/'), '', $value) : $value;
+        }
+        else {
+            $args[] = $arg;
+        }
 
-	return $args;
+        if ($alias = $aliases[$key]) {
+            $args[$alias] = $args[$key];
+        }
+    }
+
+    return $args;
 }
 
 
diff --git a/program/include/html.php b/program/include/html.php
index b42da1d..880c904 100644
--- a/program/include/html.php
+++ b/program/include/html.php
@@ -171,7 +171,7 @@
             $attr = array('href' => $attr);
         }
         return self::tag('a', $attr, $cont, array_merge(self::$common_attrib,
-	    array('href','target','name','rel','onclick','onmouseover','onmouseout','onmousedown','onmouseup')));
+        array('href','target','name','rel','onclick','onmouseover','onmouseout','onmousedown','onmouseup')));
     }
 
     /**
@@ -532,7 +532,7 @@
 {
     protected $tagname = 'textarea';
     protected $allowed = array('name','rows','cols','wrap','tabindex',
-	'onchange','disabled','readonly','spellcheck');
+        'onchange','disabled','readonly','spellcheck');
 
     /**
      * Get HTML code for this object
@@ -563,7 +563,7 @@
         }
 
         return self::tag($this->tagname, $this->attrib, $value,
-	        array_merge(self::$common_attrib, $this->allowed));
+            array_merge(self::$common_attrib, $this->allowed));
     }
 }
 
@@ -591,7 +591,7 @@
     protected $tagname = 'select';
     protected $options = array();
     protected $allowed = array('name','size','tabindex','autocomplete',
-	'multiple','onchange','disabled','rel');
+        'multiple','onchange','disabled','rel');
 
     /**
      * Add a new option to this drop-down
@@ -655,7 +655,7 @@
 {
     protected $tagname = 'table';
     protected $allowed = array('id','class','style','width','summary',
-	    'cellpadding','cellspacing','border');
+        'cellpadding','cellspacing','border');
 
     private $header = array();
     private $rows = array();
@@ -705,8 +705,9 @@
      */
     public function add_header($attr, $cont)
     {
-        if (is_string($attr))
-    	    $attr = array('class' => $attr);
+        if (is_string($attr)) {
+            $attr = array('class' => $attr);
+        }
 
         $cell = new stdClass;
         $cell->attrib = $attr;
@@ -763,11 +764,13 @@
      */
     public function set_row_attribs($attr = array(), $index = null)
     {
-        if (is_string($attr))
-    	    $attr = array('class' => $attr);
+        if (is_string($attr)) {
+            $attr = array('class' => $attr);
+        }
 
-        if ($index === null)
+        if ($index === null) {
             $index = $this->rowindex;
+        }
 
         $this->rows[$index]->attrib = $attr;
     }
@@ -781,8 +784,9 @@
      */
     public function get_row_attribs($index = null)
     {
-        if ($index === null)
+        if ($index === null) {
             $index = $this->rowindex;
+        }
 
         return $this->rows[$index] ? $this->rows[$index]->attrib : null;
     }
diff --git a/program/include/rcube_cache.php b/program/include/rcube_cache.php
index cdb1dd5..4e60dea 100644
--- a/program/include/rcube_cache.php
+++ b/program/include/rcube_cache.php
@@ -254,7 +254,7 @@
             }
             else if ($this->type == 'apc') {
                 $data = apc_fetch($this->ckey($key));
-	        }
+            }
 
             if ($data) {
                 $md5sum = md5($data);
@@ -294,7 +294,7 @@
                 }
 
                 $this->cache[$key]      = $data;
-	            $this->cache_sums[$key] = $md5sum;
+                $this->cache_sums[$key] = $md5sum;
             }
             else {
                 $this->cache[$key] = null;
diff --git a/program/include/rcube_config.php b/program/include/rcube_config.php
index 2fe0d97..e299790 100644
--- a/program/include/rcube_config.php
+++ b/program/include/rcube_config.php
@@ -324,7 +324,7 @@
         if (strlen($key) != 24) {
             rcube::raise_error(array(
                 'code' => 500, 'type' => 'php',
-	            'file' => __FILE__, 'line' => __LINE__,
+                'file' => __FILE__, 'line' => __LINE__,
                 'message' => "Configured crypto key '$key' is not exactly 24 bytes long"
             ), true, true);
         }
@@ -348,7 +348,7 @@
             else
                 rcube::raise_error(array(
                     'code' => 500, 'type' => 'php',
-	                'file' => __FILE__, 'line' => __LINE__,
+                    'file' => __FILE__, 'line' => __LINE__,
                     'message' => "Invalid mail_header_delimiter setting"
                 ), true, false);
         }
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 4ab06cf..461ecb0 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -359,11 +359,11 @@
 
         return array(
             $this->search_string,
-	        $this->search_set,
-        	$this->search_charset,
-        	$this->search_sort_field,
-        	$this->search_sorted,
-	    );
+            $this->search_set,
+            $this->search_charset,
+            $this->search_sort_field,
+            $this->search_sorted,
+        );
     }
 
 
@@ -3847,12 +3847,12 @@
     protected function rsort($folder, $delimiter, &$list, &$out)
     {
         while (list($key, $name) = each($list)) {
-	        if (strpos($name, $folder.$delimiter) === 0) {
-	            // set the type of folder name variable (#1485527)
-    	        $out[] = (string) $name;
-	            unset($list[$key]);
-	            $this->rsort($name, $delimiter, $list, $out);
-	        }
+            if (strpos($name, $folder.$delimiter) === 0) {
+                // set the type of folder name variable (#1485527)
+                $out[] = (string) $name;
+                unset($list[$key]);
+                $this->rsort($name, $delimiter, $list, $out);
+            }
         }
         reset($list);
     }
diff --git a/program/include/rcube_ldap.php b/program/include/rcube_ldap.php
index 3a7fc18..7f51b8f 100644
--- a/program/include/rcube_ldap.php
+++ b/program/include/rcube_ldap.php
@@ -2027,12 +2027,12 @@
         # a0 = type context-specific/constructed with a length of 06 (6) bytes following
         # 02 = type integer with 2 bytes following (offset): 01 01 (ie 1)
         # 02 = type integer with 2 bytes following (contentCount):  01 00
-        
+
         # whith a search string present:
         # 81 = type context-specific/constructed with a length of 04 (4) bytes following (the length will change here)
         # 81 indicates a user string is present where as a a0 indicates just a offset search
         # 81 = type context-specific/constructed with a length of 06 (6) bytes following
-        
+
         # the following info was taken from the ISO/IEC 8825-1:2003 x.690 standard re: the
         # encoding of integer values (note: these values are in
         # two-complement form so since offset will never be negative bit 8 of the
@@ -2042,7 +2042,7 @@
         # of the second (to the left of first octet) octet:
         # a) shall not all be ones; and
         # b) shall not all be zero
-        
+
         if ($search)
         {
             $search = preg_replace('/[^-[:alpha:] ,.()0-9]+/', '', $search);
@@ -2062,7 +2062,7 @@
             // now compute length over $str
             $str = self::_ber_addseq($str, 'a0');
         }
-        
+
         // now tack on records per page
         $str = "020100" . self::_ber_addseq(self::_ber_encode_int($rpp-1), '02') . $str;
 
diff --git a/program/include/rcube_plugin_api.php b/program/include/rcube_plugin_api.php
index 8c1e125..9ef68ca 100644
--- a/program/include/rcube_plugin_api.php
+++ b/program/include/rcube_plugin_api.php
@@ -32,12 +32,12 @@
 class rcube_plugin_api
 {
   static private $instance;
-  
+
   public $dir;
   public $url = 'plugins/';
   public $task = '';
   public $output;
-  
+
   public $handlers = array();
   private $plugins = array();
   private $tasks = array();
diff --git a/program/include/rcube_session.php b/program/include/rcube_session.php
index b6a0ccf..6192466 100644
--- a/program/include/rcube_session.php
+++ b/program/include/rcube_session.php
@@ -531,7 +531,7 @@
   public function set_keep_alive($keep_alive)
   {
     $this->keep_alive = $keep_alive;
-    
+
     if ($this->lifetime < $keep_alive)
         $this->set_lifetime($keep_alive + 30);
   }
@@ -551,7 +551,7 @@
   {
     return $this->ip;
   }
-  
+
   /**
    * Setter for cookie encryption secret
    */
@@ -568,7 +568,8 @@
   {
     $this->ip_check = $check;
   }
-  
+
+
   /**
    * Setter for the cookie name used for session cookie
    */
@@ -605,7 +606,7 @@
           $result = true;
         }
       }
-	}
+    }
 
     if (!$result)
       $this->log("Session authentication failed for " . $this->key . "; invalid auth cookie sent; timeslot = " . date('Y-m-d H:i:s', $prev));
@@ -637,7 +638,7 @@
   }
 
   /**
-   * 
+   * Writes debug information to the log
    */
   function log($line)
   {
diff --git a/program/include/rcube_smtp.php b/program/include/rcube_smtp.php
index e574824..b28be52 100644
--- a/program/include/rcube_smtp.php
+++ b/program/include/rcube_smtp.php
@@ -423,7 +423,7 @@
         $lines[] = $key . ': ' . $value;
       }
     }
-    
+
     return array($from, join(SMTP_MIME_CRLF, $lines) . SMTP_MIME_CRLF);
   }
 
diff --git a/program/include/rcube_user.php b/program/include/rcube_user.php
index 644d24b..29eb0f2 100644
--- a/program/include/rcube_user.php
+++ b/program/include/rcube_user.php
@@ -443,7 +443,7 @@
         }
 
         $data = $rcube->plugins->exec_hook('user_create',
-	        array('user'=>$user, 'user_name'=>$user_name, 'user_email'=>$user_email, 'host'=>$host));
+            array('user'=>$user, 'user_name'=>$user_name, 'user_email'=>$user_email, 'host'=>$host));
 
         // plugin aborted this operation
         if ($data['abort'])
diff --git a/program/include/rcube_utils.php b/program/include/rcube_utils.php
index 9344a92..d1a8315 100644
--- a/program/include/rcube_utils.php
+++ b/program/include/rcube_utils.php
@@ -84,9 +84,9 @@
 
         // from PEAR::Validate
         $regexp = '&^(?:
-	        ("\s*(?:[^"\f\n\r\t\v\b\s]+\s*)+")| 			 	            #1 quoted name
-	        ([-\w!\#\$%\&\'*+~/^`|{}=]+(?:\.[-\w!\#\$%\&\'*+~/^`|{}=]+)*)) 	#2 OR dot-atom (RFC5322)
-	        $&xi';
+            ("\s*(?:[^"\f\n\r\t\v\b\s]+\s*)+")|                             #1 quoted name
+            ([-\w!\#\$%\&\'*+~/^`|{}=]+(?:\.[-\w!\#\$%\&\'*+~/^`|{}=]+)*))  #2 OR dot-atom (RFC5322)
+            $&xi';
 
         if (!preg_match($regexp, $local_part)) {
             return false;
@@ -617,8 +617,8 @@
         // %n - host
         $n = preg_replace('/:\d+$/', '', $_SERVER['SERVER_NAME']);
         // %t - host name without first part, e.g. %n=mail.domain.tld, %t=domain.tld
-	$t = preg_replace('/^[^\.]+\./', '', $n);
-	// %d - domain name without first part
+        $t = preg_replace('/^[^\.]+\./', '', $n);
+        // %d - domain name without first part
         $d = preg_replace('/^[^\.]+\./', '', $_SERVER['HTTP_HOST']);
         // %h - IMAP host
         $h = $_SESSION['storage_host'] ? $_SESSION['storage_host'] : $host;

--
Gitblit v1.9.1