CS fixes (mostly tab -> spaces)

pull/19/head
Aleksander Machniak 12 years ago
parent a7b32b61e6
commit 413df054ad

@ -33,33 +33,36 @@ require_once INSTALL_PATH . 'program/include/iniset.php';
*/
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;
}

@ -171,7 +171,7 @@ class html
$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 @@ class html_textarea extends html
{
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 @@ class html_textarea extends html
}
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 @@ class html_select extends html
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 @@ class html_table extends html
{
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 @@ class html_table extends html
*/
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 @@ class html_table extends html
*/
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 @@ class html_table extends html
*/
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;
}

@ -254,7 +254,7 @@ class rcube_cache
}
else if ($this->type == 'apc') {
$data = apc_fetch($this->ckey($key));
}
}
if ($data) {
$md5sum = md5($data);
@ -294,7 +294,7 @@ class rcube_cache
}
$this->cache[$key] = $data;
$this->cache_sums[$key] = $md5sum;
$this->cache_sums[$key] = $md5sum;
}
else {
$this->cache[$key] = null;

@ -324,7 +324,7 @@ class rcube_config
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 @@ class rcube_config
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);
}

@ -359,11 +359,11 @@ class rcube_imap extends rcube_storage
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 @@ class rcube_imap extends rcube_storage
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);
}

@ -2027,12 +2027,12 @@ class rcube_ldap extends rcube_addressbook
# 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 @@ class rcube_ldap extends rcube_addressbook
# 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 @@ class rcube_ldap extends rcube_addressbook
// 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;

@ -32,12 +32,12 @@ if (!defined('RCMAIL_PLUGINS_DIR'))
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();

@ -531,7 +531,7 @@ class rcube_session
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 @@ class rcube_session
{
return $this->ip;
}
/**
* Setter for cookie encryption secret
*/
@ -568,7 +568,8 @@ class rcube_session
{
$this->ip_check = $check;
}
/**
* Setter for the cookie name used for session cookie
*/
@ -605,7 +606,7 @@ class rcube_session
$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 @@ class rcube_session
}
/**
*
* Writes debug information to the log
*/
function log($line)
{

@ -423,7 +423,7 @@ class rcube_smtp
$lines[] = $key . ': ' . $value;
}
}
return array($from, join(SMTP_MIME_CRLF, $lines) . SMTP_MIME_CRLF);
}

@ -443,7 +443,7 @@ class rcube_user
}
$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'])

@ -84,9 +84,9 @@ class rcube_utils
// 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 @@ class rcube_utils
// %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;

Loading…
Cancel
Save