/**
* Triggers an imap error. Utility function for sqm_trigger_error()
- * @param integer $iErrNo error number defined in errors.php
+ * @param string $sErrNo error string defined in errors.php
* @param string $sRequest imap request string
* @param string $sResponse tagged imap response
* @param string $sMessage tagged imap response message
* @author Marc Groot Koerkamp
* @since 1.5.1
*/
-function sqm_trigger_imap_error($iErrNo,$sRequest,$sResponse, $sMessage, $aExtra=array()) {
+function sqm_trigger_imap_error($sErrNo,$sRequest,$sResponse, $sMessage, $aExtra=array()) {
$aError = array(
'REQUEST' => $sRequest,
'RESPONSE' => $sResponse,
'MESSAGE' => $sMessage);
$aError = array_merge($aExtra,$aError);
- sqm_trigger_error($iErrNo,$aError);
+ sqm_trigger_error($sErrNo,$aError);
}
/**
* Trigger an error.
- * @param integer $iErrNo error number defined in errors.php
+ * @param string $sErrNo error string defined in errors.php
* @param array $aExtra optional associative array with extra error info
* @return void
* @author Marc Groot Koerkamp
* @since 1.5.1
*/
-function sqm_trigger_error($iErrNo,$aExtra=array()) {
- // Include the error definition file.
- include_once(SM_PATH.'include/errors.php');
+function sqm_trigger_error($sErrNo,$aExtra=array()) {
+ static $aErrors;
+ if (!isset($aErrors)) {
+ // Include the error definition file.
+ include_once(SM_PATH.'include/errors.php');
+ }
+
$iPhpErr = E_USER_NOTICE;
- if (is_array($aErrors) && isset($aErrors[$iErrNo]['level'])) {
+ if (is_array($aErrors) && isset($aErrors[$sErrNo]['level'])) {
if (is_array($aExtra) && count($aExtra)) {
- $aErrors[$iErrNo]['extra'] = $aExtra;
+ $aErrors[$sErrNo]['extra'] = $aExtra;
}
// because trigger_error can only handle a string argument for the error description
// we serialize the result.
- $sErrString = serialize($aErrors[$iErrNo]);
- $iPhpErr = $aErrors[$iErrNo]['level'];
+ $sErrString = serialize($aErrors[$sErrNo]);
+ $iPhpErr = $aErrors[$sErrNo]['level'];
} else {
- $sErrString = "Error number <$iErrNo> does not exist, fix the code or update the errors.php file";
+ sm_print_r($aErrors);
+ $sErrString = "Error <$sErrNo> does not exist, fix the code or update the errors.php file";
$iPhpErr = E_USER_ERROR;
}
trigger_error($sErrString, $iPhpErr);
define('SQM_ERROR_PLUGIN',32);
// define('SQM_ERROR_X',64); future error category
+
+
$aErrors['SQM_IMAP_NO_THREAD'] = array(
'level' => E_USER_ERROR,
'category' => SQM_ERROR_IMAP,
'message' => _("Thread sorting is not supported by your IMAP server.") . "\n" .
_("Please contact your system administrator and report this error."),
'link' => '',
- 'tip' => _("Run \"configure\", choose option 4 (General options) and set option 10 (Allow server thread sort to false).")
+ 'tip' => _("Run \"configure\", choose option 4 (General options) and set option 10 (Disable server thread sort) to true).")
);
$aErrors['SQM_IMAP_NO_SORT'] = array(
'message' => _( "Server-side sorting is not supported by your IMAP server.") . "\n" .
_("Please contact your system administrator and report this error."),
'link' => '',
- 'tip' => _("Run \"configure\", choose option 4 (General options) and set option 11 (Allow server-side sorting to false).")
+ 'tip' => _("Run \"configure\", choose option 4 (General options) and set option 11 (Disable server-side sorting) to true.")
);
+$aErrors['SQM_IMAP_BADCHARSET'] = array(
+ 'level' => E_USER_NOTICE,
+ 'category' => SQM_ERROR_IMAP,
+ 'message' => _( "Your used charset is not supported by your IMAP server.") . "\n" .
+ _("Please contact your system administrator and report this error."),
+ 'link' => '',
+ 'tip' => _("Run \"configure\", choose option 4 (General options) and set option 12 (Allow server charset search) to false) or choose option 10 (Language settings) and set option 2 (Default charset) to a charset supported by your IMAP server.")
+);
+
+$aErrors['SQM_IMAP_ERROR'] = array(
+ 'level' => E_USER_ERROR,
+ 'category' => SQM_ERROR_IMAP,
+ 'message' => _( "Your IMAP server returned an error.") . "\n" .
+ _("Please contact your system administrator and report this error."),
+ 'link' => ''
+);
//$aError['SQM_FS'] // Filesystem related errors
?>
\ No newline at end of file