alecpl
2010-04-23 2eb7943f2aeaec8efc74b16b7bedb56da9913abf
- code cleanup (mostly identation fixes)


9 files modified
81 ■■■■ changed files
program/include/bugs.inc 19 ●●●●● patch | view | raw | blame | history
program/include/iniset.php 7 ●●●●● patch | view | raw | blame | history
program/include/rcube_addressbook.php 1 ●●●● patch | view | raw | blame | history
program/include/rcube_config.php 26 ●●●● patch | view | raw | blame | history
program/include/rcube_html_page.php patch | view | raw | blame | history
program/include/rcube_json_output.php 9 ●●●●● patch | view | raw | blame | history
program/include/rcube_result_set.php 5 ●●●●● patch | view | raw | blame | history
program/include/rcube_sqlite.inc 10 ●●●● patch | view | raw | blame | history
program/include/rcube_template.php 4 ●●●● patch | view | raw | blame | history
program/include/bugs.inc
@@ -5,7 +5,7 @@
 | program/include/bugs.inc                                              |
 |                                                                       |
 | This file is part of the RoudCube Webmail client                      |
 | Copyright (C) 2005-2009, RoudCube Dev - Switzerland                   |
 | Copyright (C) 2005-2010, RoudCube Dev - Switzerland                   |
 | Licensed under the GNU GPL                                            |
 |                                                                       |
 | PURPOSE:                                                              |
@@ -48,8 +48,7 @@
    log_bug($arg);
  // display error page and terminate script
  if ($terminate)
    {
    if ($terminate) {
    $ERROR_CODE = $arg['code'];
    $ERROR_MESSAGE = $arg['message'];
    include("program/steps/error.inc");
@@ -70,8 +69,7 @@
  $program = strtoupper($arg_arr['type']);
  // write error to local log file
  if ($CONFIG['debug_level'] & 1)
  {
    if ($CONFIG['debug_level'] & 1) {
    $post_query = ($_SERVER['REQUEST_METHOD'] == 'POST' ? '?_task='.urlencode($_POST['_task']).'&_action='.urlencode($_POST['_action']) : '');
    $log_entry = sprintf("%s Error: %s%s (%s %s)",
      $program,
@@ -80,28 +78,25 @@
      $_SERVER['REQUEST_METHOD'],
      $_SERVER['REQUEST_URI'] . $post_query);
    
    if (!write_log('errors', $log_entry))
    {
        if (!write_log('errors', $log_entry)) {
      // send error to PHPs error handler if write_log didn't succeed
      trigger_error($arg_arr['message']);
    }
  }
  // resport the bug to the global bug reporting system
  if ($CONFIG['debug_level'] & 2)
  {
    if ($CONFIG['debug_level'] & 2) {
    // TODO: Send error via HTTP
  }
  // show error if debug_mode is on
  if ($CONFIG['debug_level'] & 4)
  {
    if ($CONFIG['debug_level'] & 4) {
    print "<b>$program Error";
    if (!empty($arg_arr['file']) && !empty($arg_arr['line']))
      print " in $arg_arr[file] ($arg_arr[line])";
    print ":</b>&nbsp;";
        print ':</b>&nbsp;';
    print nl2br($arg_arr['message']);
    print '<br />';
    flush();
program/include/iniset.php
@@ -119,11 +119,10 @@
    $err->getUserinfo()), 0);
}
// set PEAR error handling (will also load the PEAR main class)
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'rcube_pear_error');
// include global functions
require_once 'include/bugs.inc';
require_once 'include/main.inc';
require_once 'include/rcube_shared.inc';
// set PEAR error handling (will also load the PEAR main class)
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'rcube_pear_error');
program/include/rcube_addressbook.php
@@ -242,4 +242,3 @@
      return 0;
    }
}
program/include/rcube_config.php
@@ -5,7 +5,7 @@
 | program/include/rcube_config.php                                      |
 |                                                                       |
 | This file is part of the RoundCube Webmail client                     |
 | Copyright (C) 2008-2009, RoundCube Dev. - Switzerland                 |
 | Copyright (C) 2008-2010, RoundCube Dev. - Switzerland                 |
 | Licensed under the GNU GPL                                            |
 |                                                                       |
 | PURPOSE:                                                              |
@@ -86,7 +86,8 @@
      if ($this->prop['log_driver'] == 'syslog') {
        ini_set('error_log', 'syslog');
      } else {
            }
            else {
        ini_set('error_log', $this->prop['log_dir'].'/errors');
      }
    }
@@ -103,7 +104,6 @@
    // export config data
    $GLOBALS['CONFIG'] = &$this->prop;
  }
  
  /**
   * Load a host-specific config file if configured
@@ -216,8 +216,7 @@
  public function get_crypto_key($key)
  {
    // Bomb out if the requested key does not exist
    if (!array_key_exists($key, $this->prop))
    {
        if (!array_key_exists($key, $this->prop)) {
      raise_error(array(
        'code' => 500, 'type' => 'php',
        'file' => __FILE__, 'line' => __LINE__,
@@ -228,12 +227,11 @@
    $key = $this->prop[$key];
  
    // Bomb out if the configured key is not exactly 24 bytes long
    if (strlen($key) != 24)
    {
        if (strlen($key) != 24) {
      raise_error(array(
        'code' => 500, 'type' => 'php',
    'file' => __FILE__, 'line' => __LINE__,
        'message' => "Configured crypto key \"$key\" is not exactly 24 bytes long"
                'message' => "Configured crypto key '$key' is not exactly 24 bytes long"
      ), true, true);
    }
@@ -251,11 +249,15 @@
    // use the configured delimiter for headers
    if (!empty($this->prop['mail_header_delimiter']))
      return $this->prop['mail_header_delimiter'];
    else if (strtolower(substr(PHP_OS, 0, 3)) == 'win')
        $php_os = strtolower(substr(PHP_OS, 0, 3));
        if ($php_os == 'win')
      return "\r\n";
    else if (strtolower(substr(PHP_OS, 0, 3)) == 'mac')
        if ($php_os == 'mac')
      return "\r\n";
    else
      return "\n";
  }
  
@@ -291,6 +293,4 @@
    return empty($this->errors) ? false : join("\n", $this->errors);
  }
}
program/include/rcube_html_page.php
program/include/rcube_json_output.php
@@ -5,7 +5,7 @@
 | program/include/rcube_json_output.php                                 |
 |                                                                       |
 | This file is part of the RoundCube Webmail client                     |
 | Copyright (C) 2008-2009, RoundCube Dev. - Switzerland                 |
 | Copyright (C) 2008-2010, RoundCube Dev. - Switzerland                 |
 | Licensed under the GNU GPL                                            |
 |                                                                       |
 | PURPOSE:                                                              |
@@ -60,6 +60,7 @@
        $this->env[$name] = $value;
    }
    
    /**
     * Issue command to set page title
     *
@@ -70,6 +71,7 @@
        $name = $this->config->get('product_name');
        $this->command('set_pagetitle', empty($name) ? $title : $name.' :: '.$title);
    }
    /**
     * @ignore
@@ -102,6 +104,7 @@
    {
        // ignore
    }
    /**
     * Register a list of template object handlers
@@ -168,6 +171,7 @@
        }
    }
    
    /**
     * Delete all stored env variables and commands
     */
@@ -177,6 +181,7 @@
        $this->texts = array();
        $this->commands = array();
    }
    
    /**
     * Redirect to a certain url
@@ -267,5 +272,3 @@
        return $out;
    }
}
program/include/rcube_result_set.php
@@ -5,7 +5,7 @@
 | program/include/rcube_result_set.php                                  |
 |                                                                       |
 | This file is part of the RoundCube Webmail client                     |
 | Copyright (C) 2006-2009, RoundCube Dev. - Switzerland                 |
 | Copyright (C) 2006-2010, RoundCube Dev. - Switzerland                 |
 | Licensed under the GNU GPL                                            |
 |                                                                       |
 | PURPOSE:                                                              |
@@ -33,6 +33,7 @@
  var $current = 0;
  var $records = array();
  
  function __construct($c=0, $f=0)
  {
    $this->count = (int)$c;
@@ -55,7 +56,7 @@
    return $this->records[$this->current++];
  }
  
  // alias
    // alias for iterate()
  function next()
  {
    return $this->iterate();
program/include/rcube_sqlite.inc
@@ -5,7 +5,7 @@
 | program/include/rcube_sqlite.inc                                      |
 |                                                                       |
 | This file is part of the RoundCube Webmail client                     |
 | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland                 |
 | Copyright (C) 2005-2010, RoundCube Dev. - Switzerland                 |
 | Licensed under the GNU GPL                                            |
 |                                                                       |
 | PURPOSE:                                                              |
@@ -30,23 +30,23 @@
function rcube_sqlite_from_unixtime($timestamp)
  {
  $timestamp = trim($timestamp);
  if (!preg_match("/^[0-9]+$/is", $timestamp))
    if (!preg_match('/^[0-9]+$/is', $timestamp))
    $ret = strtotime($timestamp);
  else
    $ret = $timestamp;
    
  $ret = date("Y-m-d H:i:s", $ret);
    $ret = date('Y-m-d H:i:s', $ret);
  rcube_sqlite_debug("FROM_UNIXTIME ($timestamp) = $ret");
  return $ret;
  }
function rcube_sqlite_unix_timestamp($timestamp="")
function rcube_sqlite_unix_timestamp($timestamp='')
  {
  $timestamp = trim($timestamp);
  if (!$timestamp)
    $ret = time();
  else if (!preg_match("/^[0-9]+$/is", $timestamp))
    else if (!preg_match('/^[0-9]+$/is', $timestamp))
    $ret = strtotime($timestamp);
  else
    $ret = $timestamp;
program/include/rcube_template.php
@@ -5,7 +5,7 @@
 | program/include/rcube_template.php                                    |
 |                                                                       |
 | This file is part of the RoundCube Webmail client                     |
 | Copyright (C) 2006-2009, RoundCube Dev. - Switzerland                 |
 | Copyright (C) 2006-2010, RoundCube Dev. - Switzerland                 |
 | Licensed under the GNU GPL                                            |
 |                                                                       |
 | PURPOSE:                                                              |
@@ -536,7 +536,7 @@
    
    
    /**
     *
     * Inserts hidden field with CSRF-prevention-token into POST forms
     */
    private function alter_form_tag($matches)
    {