- code cleanup (mostly identation fixes)

release-0.6
alecpl 14 years ago
parent 6319670243
commit 2eb7943f2a

@ -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 @@ function raise_error($arg=array(), $log=false, $terminate=false)
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 @@ function log_bug($arg_arr)
$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 @@ function log_bug($arg_arr)
$_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();

@ -119,11 +119,10 @@ function rcube_pear_error($err)
$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');

@ -242,4 +242,3 @@ abstract class rcube_addressbook
return 0;
}
}

@ -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 @@ class rcube_config
if ($this->prop['log_driver'] == 'syslog') {
ini_set('error_log', 'syslog');
} else {
}
else {
ini_set('error_log', $this->prop['log_dir'].'/errors');
}
}
@ -104,7 +105,6 @@ class rcube_config
$GLOBALS['CONFIG'] = &$this->prop;
}
/**
* Load a host-specific config file if configured
* This will merge the host specific configuration with the given one
@ -216,8 +216,7 @@ class rcube_config
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 @@ class rcube_config
$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 @@ class rcube_config
// 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 @@ class rcube_config
return empty($this->errors) ? false : join("\n", $this->errors);
}
}

@ -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 @@ class rcube_json_output
$this->env[$name] = $value;
}
/**
* Issue command to set page title
*
@ -71,6 +72,7 @@ class rcube_json_output
$this->command('set_pagetitle', empty($name) ? $title : $name.' :: '.$title);
}
/**
* @ignore
*/
@ -103,6 +105,7 @@ class rcube_json_output
// ignore
}
/**
* Register a list of template object handlers
*
@ -168,6 +171,7 @@ class rcube_json_output
}
}
/**
* Delete all stored env variables and commands
*/
@ -178,6 +182,7 @@ class rcube_json_output
$this->commands = array();
}
/**
* Redirect to a certain url
*
@ -267,5 +272,3 @@ class rcube_json_output
return $out;
}
}

@ -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 @@ class rcube_result_set
var $current = 0;
var $records = array();
function __construct($c=0, $f=0)
{
$this->count = (int)$c;
@ -55,7 +56,7 @@ class rcube_result_set
return $this->records[$this->current++];
}
// alias
// alias for iterate()
function next()
{
return $this->iterate();

@ -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;

@ -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 @@ class rcube_template extends rcube_html_page
/**
*
* Inserts hidden field with CSRF-prevention-token into POST forms
*/
private function alter_form_tag($matches)
{

Loading…
Cancel
Save