- code cleanup (mostly identation fixes)
| | |
| | | | 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: | |
| | |
| | | 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"); |
| | |
| | | $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, |
| | |
| | | $_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> "; |
| | | print ':</b> '; |
| | | print nl2br($arg_arr['message']); |
| | | print '<br />'; |
| | | flush(); |
| | |
| | | $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_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: | |
| | |
| | | |
| | | if ($this->prop['log_driver'] == 'syslog') { |
| | | ini_set('error_log', 'syslog'); |
| | | } else { |
| | | } |
| | | else { |
| | | ini_set('error_log', $this->prop['log_dir'].'/errors'); |
| | | } |
| | | } |
| | |
| | | // export config data |
| | | $GLOBALS['CONFIG'] = &$this->prop; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Load a host-specific config file if configured |
| | |
| | | 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__, |
| | |
| | | $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); |
| | | } |
| | | |
| | |
| | | // 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"; |
| | | } |
| | | |
| | |
| | | return empty($this->errors) ? false : join("\n", $this->errors); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | | 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: | |
| | |
| | | $this->env[$name] = $value; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Issue command to set page title |
| | | * |
| | |
| | | $name = $this->config->get('product_name'); |
| | | $this->command('set_pagetitle', empty($name) ? $title : $name.' :: '.$title); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @ignore |
| | |
| | | { |
| | | // ignore |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Register a list of template object handlers |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Delete all stored env variables and commands |
| | | */ |
| | |
| | | $this->texts = array(); |
| | | $this->commands = array(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Redirect to a certain url |
| | |
| | | return $out; |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | | 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: | |
| | |
| | | var $current = 0; |
| | | var $records = array(); |
| | | |
| | | |
| | | function __construct($c=0, $f=0) |
| | | { |
| | | $this->count = (int)$c; |
| | |
| | | return $this->records[$this->current++]; |
| | | } |
| | | |
| | | // alias |
| | | // alias for iterate() |
| | | function next() |
| | | { |
| | | return $this->iterate(); |
| | |
| | | | 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: | |
| | |
| | | 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 | |
| | | | | |
| | | | 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: | |
| | |
| | | |
| | | |
| | | /** |
| | | * |
| | | * Inserts hidden field with CSRF-prevention-token into POST forms |
| | | */ |
| | | private function alter_form_tag($matches) |
| | | { |