summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-01-28 11:27:16 +0000
committeralecpl <alec@alec.pl>2010-01-28 11:27:16 +0000
commit10eedbe75a2022d65ec349de5f3bd12400191974 (patch)
tree13df2e006a7cbbca30f464877493e4c3f0b67d21
parent4fc7a7e5f633f10dac29a9bd7e77bb23e3f9585e (diff)
- add file/line definitions to raise_error() calls
-rw-r--r--index.php2
-rw-r--r--program/include/rcmail.php21
-rw-r--r--program/include/rcube_config.php17
-rw-r--r--program/include/rcube_imap.php11
-rw-r--r--program/include/rcube_ldap.php12
-rw-r--r--program/include/rcube_mdb2.php8
-rw-r--r--program/include/rcube_plugin.php12
-rw-r--r--program/include/rcube_plugin_api.php28
-rwxr-xr-xprogram/include/rcube_template.php4
-rw-r--r--program/steps/mail/sendmail.inc6
-rw-r--r--program/steps/mail/spell_pspell.inc2
-rw-r--r--program/steps/mail/viewsource.inc4
12 files changed, 77 insertions, 50 deletions
diff --git a/index.php b/index.php
index a7dd0fe53..e3c542ba2 100644
--- a/index.php
+++ b/index.php
@@ -111,7 +111,7 @@ if ($RCMAIL->action=='login' && $RCMAIL->task=='mail') {
$RCMAIL->user->ID,
$_SERVER['REMOTE_ADDR']));
}
-
+
// restore original request parameters
$query = array();
if ($url = get_input_value('_url', RCUBE_INPUT_POST))
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 28ccb0cb0..1afb7d72a 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -506,17 +506,16 @@ class rcmail
}
else {
raise_error(array(
- 'code' => 600,
- 'type' => 'php',
+ 'code' => 600, 'type' => 'php',
+ 'file' => __FILE__, 'line' => __LINE__,
'message' => "Failed to create a user record. Maybe aborted by a plugin?"
- ), true, false);
+ ), true, false);
}
}
else {
raise_error(array(
- 'code' => 600,
- 'type' => 'php',
- 'file' => RCMAIL_CONFIG_DIR."/main.inc.php",
+ 'code' => 600, 'type' => 'php',
+ 'file' => __FILE__, 'line' => __LINE__,
'message' => "Acces denied for new user $username. 'auto_create_user' is disabled"
), true, false);
}
@@ -947,9 +946,8 @@ class rcmail
else
{
raise_error(array(
- 'code' => 500,
- 'type' => 'php',
- 'file' => __FILE__,
+ 'code' => 500, 'type' => 'php',
+ 'file' => __FILE__, 'line' => __LINE__,
'message' => "Could not perform encryption; make sure Mcrypt is installed or lib/des.inc is available"
), true, true);
}
@@ -993,9 +991,8 @@ class rcmail
else
{
raise_error(array(
- 'code' => 500,
- 'type' => 'php',
- 'file' => __FILE__,
+ 'code' => 500, 'type' => 'php',
+ 'file' => __FILE__, 'line' => __LINE__,
'message' => "Could not perform decryption; make sure Mcrypt is installed or lib/des.inc is available"
), true, true);
}
diff --git a/program/include/rcube_config.php b/program/include/rcube_config.php
index a4f3699d8..85ff714bf 100644
--- a/program/include/rcube_config.php
+++ b/program/include/rcube_config.php
@@ -180,7 +180,7 @@ class rcube_config
{
$this->prop = array_merge($this->prop, $prefs);
}
-
+
/**
* Getter for all config options
@@ -192,6 +192,7 @@ class rcube_config
return $this->prop;
}
+
/**
* Return requested DES crypto key.
*
@@ -204,9 +205,8 @@ class rcube_config
if (!array_key_exists($key, $this->prop))
{
raise_error(array(
- 'code' => 500,
- 'type' => 'php',
- 'file' => __FILE__,
+ 'code' => 500, 'type' => 'php',
+ 'file' => __FILE__, 'line' => __LINE__,
'message' => "Request for unconfigured crypto key \"$key\""
), true, true);
}
@@ -217,9 +217,8 @@ class rcube_config
if (strlen($key) != 24)
{
raise_error(array(
- 'code' => 500,
- 'type' => 'php',
- 'file' => __FILE__,
+ 'code' => 500, 'type' => 'php',
+ 'file' => __FILE__, 'line' => __LINE__,
'message' => "Configured crypto key \"$key\" is not exactly 24 bytes long"
), true, true);
}
@@ -227,6 +226,7 @@ class rcube_config
return $key;
}
+
/**
* Try to autodetect operating system and find the correct line endings
*
@@ -244,9 +244,8 @@ class rcube_config
else
return "\n";
}
-
-
+
/**
* Return the mail domain configured for the given host
*
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 8d200363b..9137ada99 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -105,8 +105,9 @@ class rcube_imap
if ($use_ssl && extension_loaded('openssl'))
$ICL_SSL = $use_ssl == 'imaps' ? 'ssl' : $use_ssl;
else if ($use_ssl) {
- raise_error(array('code' => 403, 'type' => 'imap', 'file' => __FILE__,
- 'message' => 'Open SSL not available;'), TRUE, FALSE);
+ raise_error(array('code' => 403, 'type' => 'imap',
+ 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => "Open SSL not available"), TRUE, FALSE);
$port = 143;
}
@@ -136,9 +137,9 @@ class rcube_imap
else if (!$this->conn && $GLOBALS['iil_error'])
{
$this->error_code = $GLOBALS['iil_errornum'];
- raise_error(array('code' => 403,
- 'type' => 'imap',
- 'message' => $GLOBALS['iil_error']), TRUE, FALSE);
+ raise_error(array('code' => 403, 'type' => 'imap',
+ 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => $GLOBALS['iil_error']), TRUE, FALSE);
}
// get server properties
diff --git a/program/include/rcube_ldap.php b/program/include/rcube_ldap.php
index 286bbff53..2b2bec280 100644
--- a/program/include/rcube_ldap.php
+++ b/program/include/rcube_ldap.php
@@ -84,7 +84,9 @@ class rcube_ldap extends rcube_addressbook
global $RCMAIL;
if (!function_exists('ldap_connect'))
- raise_error(array('code' => 100, 'type' => 'ldap', 'message' => "No ldap support in this installation of PHP"), true);
+ raise_error(array('code' => 100, 'type' => 'ldap',
+ 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => "No ldap support in this installation of PHP"), true);
if (is_resource($this->conn))
return true;
@@ -140,7 +142,9 @@ class rcube_ldap extends rcube_addressbook
$this->ready = $this->bind($this->prop['bind_dn'], $this->prop['bind_pass']);
}
else
- raise_error(array('code' => 100, 'type' => 'ldap', 'message' => "Could not connect to any LDAP server, tried $host:{$this->prop[port]} last"), true);
+ raise_error(array('code' => 100, 'type' => 'ldap',
+ 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => "Could not connect to any LDAP server, last tried $host:{$this->prop[port]}"), true);
// See if the directory is writeable.
if ($this->prop['writable']) {
@@ -173,8 +177,8 @@ class rcube_ldap extends rcube_addressbook
$this->_debug("S: ".ldap_error($this->conn));
raise_error(array(
- 'code' => ldap_errno($this->conn),
- 'type' => 'ldap',
+ 'code' => ldap_errno($this->conn), 'type' => 'ldap',
+ 'file' => __FILE__, 'line' => __LINE__,
'message' => "Bind failed for dn=$dn: ".ldap_error($this->conn)),
true);
diff --git a/program/include/rcube_mdb2.php b/program/include/rcube_mdb2.php
index 137ffb273..e8dd7e0a7 100644
--- a/program/include/rcube_mdb2.php
+++ b/program/include/rcube_mdb2.php
@@ -266,8 +266,9 @@ class rcube_mdb2
$this->db_error = TRUE;
$this->db_error_msg = $q->userinfo;
- raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__,
- 'message' => $this->db_error_msg), TRUE, TRUE);
+ raise_error(array('code' => 500, 'type' => 'db',
+ 'line' => __LINE__, 'file' => __FILE__,
+ 'message' => $this->db_error_msg), TRUE, TRUE);
}
else
{
@@ -626,7 +627,8 @@ class rcube_mdb2
{
$this->db_error = TRUE;
$this->db_error_msg = $res->getMessage();
- raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__,
+ raise_error(array('code' => 500, 'type' => 'db',
+ 'line' => __LINE__, 'file' => __FILE__,
'message' => $res->getMessage() . " Query: "
. substr(preg_replace('/[\r\n]+\s*/', ' ', $res->userinfo), 0, 512)),
TRUE, FALSE);
diff --git a/program/include/rcube_plugin.php b/program/include/rcube_plugin.php
index fac7db5a2..c5eb88439 100644
--- a/program/include/rcube_plugin.php
+++ b/program/include/rcube_plugin.php
@@ -60,7 +60,9 @@ abstract class rcube_plugin
$fpath = $this->home.'/'.$fname;
$rcmail = rcmail::get_instance();
if (is_file($fpath) && !$rcmail->config->load_from_file($fpath, false)) {
- raise_error(array('code' => 527, 'type' => 'php', 'message' => "Failed to load config from $fpath"), true, false);
+ raise_error(array('code' => 527, 'type' => 'php',
+ 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => "Failed to load config from $fpath"), true, false);
return false;
}
@@ -133,10 +135,14 @@ abstract class rcube_plugin
public function register_task($task)
{
if ($task != asciiwords($task)) {
- raise_error(array('code' => 526, 'type' => 'php', 'message' => "Invalid task name: $task. Only characters [a-z0-9_.-] are allowed"), true, false);
+ raise_error(array('code' => 526, 'type' => 'php',
+ 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => "Invalid task name: $task. Only characters [a-z0-9_.-] are allowed"), true, false);
}
else if (in_array(rcmail::$main_tasks, $task)) {
- raise_error(array('code' => 526, 'type' => 'php', 'message' => "Cannot register taks $task; already taken by another plugin or the application itself"), true, false);
+ raise_error(array('code' => 526, 'type' => 'php',
+ 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => "Cannot register taks $task; already taken by another plugin or the application itself"), true, false);
}
else {
rcmail::$main_tasks[] = $task;
diff --git a/program/include/rcube_plugin_api.php b/program/include/rcube_plugin_api.php
index 3a8ae524c..1eeadce3a 100644
--- a/program/include/rcube_plugin_api.php
+++ b/program/include/rcube_plugin_api.php
@@ -96,11 +96,15 @@ class rcube_plugin_api
}
}
else {
- raise_error(array('code' => 520, 'type' => 'php', 'message' => "No plugin class $plugin_name found in $fn"), true, false);
+ raise_error(array('code' => 520, 'type' => 'php',
+ 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => "No plugin class $plugin_name found in $fn"), true, false);
}
}
else {
- raise_error(array('code' => 520, 'type' => 'php', 'message' => "Failed to load plugin file $fn"), true, false);
+ raise_error(array('code' => 520, 'type' => 'php',
+ 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => "Failed to load plugin file $fn"), true, false);
}
}
@@ -136,7 +140,9 @@ class rcube_plugin_api
// trigger fatal error if still not loaded
if (!$loaded) {
- raise_error(array('code' => 520, 'type' => 'php', 'message' => "Requried plugin $plugin_name was not loaded"), true, true);
+ raise_error(array('code' => 520, 'type' => 'php',
+ 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => "Requried plugin $plugin_name was not loaded"), true, true);
}
}
@@ -167,7 +173,9 @@ class rcube_plugin_api
if (is_callable($callback))
$this->handlers[$hook][] = $callback;
else
- raise_error(array('code' => 521, 'type' => 'php', 'message' => "Invalid callback function for $hook"), true, false);
+ raise_error(array('code' => 521, 'type' => 'php',
+ 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => "Invalid callback function for $hook"), true, false);
}
@@ -220,7 +228,9 @@ class rcube_plugin_api
$this->actionmap[$action] = $owner;
}
else {
- raise_error(array('code' => 523, 'type' => 'php', 'message' => "Cannot register action $action; already taken by another plugin"), true, false);
+ raise_error(array('code' => 523, 'type' => 'php',
+ 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => "Cannot register action $action; already taken by another plugin"), true, false);
}
}
@@ -237,7 +247,9 @@ class rcube_plugin_api
call_user_func($this->actions[$action]);
}
else {
- raise_error(array('code' => 524, 'type' => 'php', 'message' => "No handler found for action $action"), true, true);
+ raise_error(array('code' => 524, 'type' => 'php',
+ 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => "No handler found for action $action"), true, true);
}
}
@@ -261,7 +273,9 @@ class rcube_plugin_api
$this->objectsmap[$name] = $owner;
}
else {
- raise_error(array('code' => 525, 'type' => 'php', 'message' => "Cannot register template handler $name; already taken by another plugin"), true, false);
+ raise_error(array('code' => 525, 'type' => 'php',
+ 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => "Cannot register template handler $name; already taken by another plugin"), true, false);
}
}
diff --git a/program/include/rcube_template.php b/program/include/rcube_template.php
index c583f740e..fef0eac2a 100755
--- a/program/include/rcube_template.php
+++ b/program/include/rcube_template.php
@@ -290,7 +290,9 @@ class rcube_template extends rcube_html_page
if ($templ != 'iframe') {
// prevent from endless loops
if ($exit != 'recur' && $this->app->plugins->is_processing('render_page')) {
- raise_error(array('code' => 505, 'type' => 'php', 'message' => 'Recursion alert: ignoring output->send()'), true, false);
+ raise_error(array('code' => 505, 'type' => 'php',
+ 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => 'Recursion alert: ignoring output->send()'), true, false);
return;
}
$this->parse($templ, false);
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index 230572f66..589c9af7f 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -30,8 +30,10 @@ $savedraft = !empty($_POST['_draft']) ? TRUE : FALSE;
/****** checks ********/
if (!isset($_SESSION['compose']['id'])) {
- raise_error(array('code' => 500, 'type' => 'smtp', 'file' => __FILE__, 'message' => "Invalid compose ID"), true, false);
- console("Sendmail error", $_SESSION['compose']);
+ raise_error(array('code' => 500, 'type' => 'smtp',
+ 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => "Invalid compose ID"), true, false);
+
$OUTPUT->show_message("An internal error occured. Please try again.", 'error');
$OUTPUT->send('iframe');
}
diff --git a/program/steps/mail/spell_pspell.inc b/program/steps/mail/spell_pspell.inc
index 578bfe523..b443ed525 100644
--- a/program/steps/mail/spell_pspell.inc
+++ b/program/steps/mail/spell_pspell.inc
@@ -23,7 +23,7 @@ if (!extension_loaded('pspell')) {
raise_error(array(
'code' => 500,
'type' => 'php',
- 'file' => __FILE__,
+ 'file' => __FILE__, 'line' => __LINE__,
'message' => "Pspell extension not available"), true, false);
header('HTTP/1.1 404 Not Found');
diff --git a/program/steps/mail/viewsource.inc b/program/steps/mail/viewsource.inc
index a61385df8..17e382456 100644
--- a/program/steps/mail/viewsource.inc
+++ b/program/steps/mail/viewsource.inc
@@ -50,9 +50,9 @@ else
raise_error(array(
'code' => 500,
'type' => 'php',
+ 'file' => __FILE__, 'line' => __LINE__,
'message' => 'Message UID '.$uid.' not found'),
- true,
- true);
+ true, true);
}
exit;