* @return object address book object.
*/
function addressbook_init($showerr = true, $onlylocal = false) {
- global $data_dir, $username, $color, $ldap_server, $address_book_global_filename;
+ global $data_dir, $username, $ldap_server, $address_book_global_filename;
global $addrbook_dsn, $addrbook_table;
global $abook_global_file, $abook_global_file_writeable, $abook_global_file_listing;
global $addrbook_global_dsn, $addrbook_global_table, $addrbook_global_writeable, $addrbook_global_listing;
* display address book init errors.
*/
if ($abook_init_error!='' && $showerr) {
- error_box($abook_init_error,$color);
+ error_box($abook_init_error);
}
/* Return the initialized object */
* Displays error message
*
* Since 1.4.1 function checks if page header is already displayed.
+ *
* Since 1.4.3 and 1.5.1 function contains error_box hook.
* Use plain_error_message() and make sure that page header is created,
* if you want compatibility with 1.4.0 and older.
+ *
+ * In 1.5.2 second function argument is changed. Older functions used it
+ * for $color array, new function uses it for optional link data. Function
+ * will ignore color array and use standard colors instead.
* @param string $string Error message to be displayed
- * @param mixed $link Optional array containing link details to be displayed
+ * @param array $link Optional array containing link details to be displayed.
+ * Array uses three keys. 'URL' key is required and should contain link URL.
+ * 'TEXT' key is optional and should contain link name. 'FRAME' key is
+ * optional and should contain link target attribute.
* @since 1.3.2
*/
function error_box($string, $link=NULL) {
// Double check the link for everything we need
if (!is_null($link)) {
- if (!isset($link['FRAME']))
- $link['FRAME'] = '';
- if (!isset($link['TEXT']))
- $link['TEXT'] = $link['URL'];
+ // safety check for older code
+ if (isset($link['URL'])) {
+ if (!isset($link['FRAME'])) $link['FRAME'] = '';
+ if (!isset($link['TEXT'])) $link['TEXT'] = $link['URL'];
+ } else {
+ // somebody used older error_box() code
+ $link=null;
+ }
}
/** ERROR is pre-translated to avoid multiple translation calls. **/
if (substr_count($folder_name, '"') || substr_count($folder_name, "\\") ||
substr_count($folder_name, $delimiter) || ($folder_name == '')) {
- global $color;
+ global $color, $oTemplate;
error_box(_("Illegal folder name.") . "<br />\n" .
sprintf(_("The name may not contain any of the following: %s"), '<tt>" \\ '.$delimiter.'</tt>')
. "<br />\n" .
_("Please select a different name.").
'<br /><a href="folders.php">'.
- _("Click here to go back") . '</a>.', $color);
+ _("Click here to go back") . '</a>.');
sqimap_logout($imapConnection);
+ $oTemplate->display('footer.tpl');
exit;
}
}
$string = "<b><font color=\"$color[2]\">\n" .
_("ERROR: No available IMAP stream.") .
"</b></font>\n";
- error_box($string,$color);
+ error_box($string);
return false;
}
}
$string = "<b><font color=\"$color[2]\">\n" .
_("ERROR: No available IMAP stream.") .
"</b></font>\n";
- error_box($string,$color);
+ error_box($string);
return false;
}
}
*/
function sqimap_read_data_list($imap_stream, $tag, $handle_errors,
&$response, &$message, $query = '') {
- global $color, $squirrelmail_language;
+ global $color, $oTemplate, $squirrelmail_language;
set_up_language($squirrelmail_language);
$string = "<b><font color=\"$color[2]\">\n" .
_("ERROR: Bad function call.") .
'sqimap_run_command or sqimap_run_command_list instead<br /><br />'.
'The following query was issued:<br />'.
htmlspecialchars($query) . '<br />' . "</font><br />\n";
- error_box($string,$color);
- echo '</body></html>';
+ error_box($string);
+ $oTemplate->display('footer.tpl');
exit;
}
$string .= "</font><br />\n";
if ($link != '')
$string .= $link;
- error_box($string,$color);
+ error_box($string);
}
/**
$string .= htmlspecialchars($line) . "<br />\n";
}
}
- error_box($string,$color);
+ error_box($string);
exit;
} else {
/*
/** is bug_report plugin disabled or called by wrong user */
if (! is_plugin_enabled('bug_report') || ! bug_report_check_user()) {
- error_box(_("Plugin is disabled."),$color);
- echo "\n</body></html>\n";
+ error_box(_("Plugin is disabled."));
+ $oTemplate->display('footer.tpl');
exit();
}
/** is bug_report plugin disabled or called by wrong user */
if (! is_plugin_enabled('bug_report') || ! bug_report_check_user()) {
- error_box(_("Plugin is disabled."),$color);
- echo "\n</body></html>\n";
+ error_box(_("Plugin is disabled."));
+ $oTemplate->display('footer.tpl');
exit();
}
?>
$calstr = "$calfoo[key]|$calbar[key]|$calfoobar[length]|$calfoobar[priority]|$calfoobar[title]|$calfoobar[message]|$calfoobar[reminder]\n";
if(sq_fwrite($fp, $calstr, 4096) === FALSE) {
- error_box(_("Could not write calendar file %s", "$username.$year.cal.tmp"), $color);
+ error_box(_("Could not write calendar file %s", "$username.$year.cal.tmp"));
}
}
* Makes sure that required functions and configuration options are set.
*/
function cpw_ldap_init() {
- global $color;
- global $cpw_ldap_basedn;
+ global $oTemplate, $cpw_ldap_basedn;
// set initial value for error tracker
$cpw_ldap_initerr=false;
// check for ldap support in php
if (! function_exists('ldap_connect')) {
- error_box(_("Current configuration requires LDAP support in PHP."),$color);
+ error_box(_("Current configuration requires LDAP support in PHP."));
$cpw_ldap_initerr=true;
}
// chech required configuration settings.
if ($cpw_ldap_basedn=='') {
- error_box(_("Plugin is not configured correctly."),$color);
+ error_box(_("Plugin is not configured correctly."));
$cpw_ldap_initerr=true;
}
// if error var is positive, close html and stop execution
if ($cpw_ldap_initerr) {
- echo '</body></html>';
+ $oTemplate->display('footer.tpl');
exit;
}
}
* Check if php install has all required extensions.
*/
function cpw_merak_init() {
- global $color;
+ global $oTemplate;
if (!function_exists('curl_init')) {
// user_error('Curl module NOT available!', E_USER_ERROR);
- error_box(_("PHP Curl extension is NOT available! Unable to change password!"),$color);
+ error_box(_("PHP Curl extension is NOT available! Unable to change password!"));
// close html and stop script execution
- echo "</body></html>\n";
+ $oTemplate->display('footer.tpl');
exit();
}
}
* Checks if configuration is correct
*/
function cpw_peardb_init() {
- global $color, $cpw_peardb_detect, $cpw_peardb_dsn, $cpw_peardb_table;
+ global $oTemplate, $cpw_peardb_detect, $cpw_peardb_dsn, $cpw_peardb_table;
if (! $cpw_peardb_detect) {
- error_box(_("Plugin is unable to use PHP Pear DB libraries. PHP Pear includes must be available in your PHP include_path setting."),$color);
- echo "</body></html>\n";
+ error_box(_("Plugin is unable to use PHP Pear DB libraries. PHP Pear includes must be available in your PHP include_path setting."));
+ $oTemplate->display('footer.tpl');
exit();
}
// Test required settings
if ((is_string($cpw_peardb_dsn) && trim($cpw_peardb_dsn)=='')
|| trim($cpw_peardb_table)=='' ) {
- error_box(_("Required change password backend configuration options are missing."),$color);
- echo "</body></html>\n";
+ error_box(_("Required change password backend configuration options are missing."));
+ $oTemplate->display('footer.tpl');
exit();
}
}
*/
function cpw_template_init()
{
- global $color;
+ global $oTemplate;
// plugin is not configured. Handle error gracefully.
- error_box(_("No valid backend defined."),$color);
+ error_box(_("No valid backend defined."));
// close html and stop script execution
- echo "</body></html>\n";
+ $oTemplate->display('footer.tpl');
exit();
}
* is displayed to the user.
*/
function cpw_vmailmgrd_init(){
- global $vmail_inc_path, $color, $username;
+ global $vmail_inc_path, $username, $oTemplate;
if ($vmail_inc_path=='' || ! file_exists($vmail_inc_path)) {
// $vmail_inc_path is not set or file does not exist
- error_box(_("Incorrent path to vmail.inc file."),$color);
+ error_box(_("Incorrent path to vmail.inc file."));
// close html and stop script execution
- echo "</body></html>\n";
+ $oTemplate->display('footer.tpl');
exit();
}
if (! function_exists('vchpass')) {
// included vmail.inc does not have required functions.
- error_box(_("Invalid or corrupted vmail.inc file."),$color);
+ error_box(_("Invalid or corrupted vmail.inc file."));
// close html and stop script execution
- echo "</body></html>\n";
+ $oTemplate->display('footer.tpl');
exit();
}
if (! preg_match("/(.*)\@(.*)/", $username)) {
// username does not match vmailmgr syntax
- error_box(_("Invalid user."),$color);
+ error_box(_("Invalid user."));
// close html and stop script execution
- echo "</body></html>\n";
+ $oTemplate->display('footer.tpl');
exit();
}
}
* prevent use of plugin if it is not enabled
*/
if (! is_plugin_enabled('info')) {
- error_box(_("Plugin is disabled."),$color);
- echo '</body></html>';
+ error_box(_("Plugin is disabled."));
+ // display footer (closes html) and stop script execution
+ $oTemplate->display('footer.tpl');
exit;
}
$out_string = _("This will send a message to %s requesting that you will be unsubscribed from this list. It will try to unsubscribe the adress below.");
break;
default:
- error_box(sprintf(_("Unknown action: %s"),htmlspecialchars($action)), $color);
+ error_box(sprintf(_("Unknown action: %s"),htmlspecialchars($action)));
+ // display footer (closes html tags) and stop script execution
+ $oTemplate->display('footer.tpl');
exit;
}
if (sqimap_mailbox_is_noselect($ic,$sent_subfolder,$boxes) ||
($level==2 && sqimap_mailbox_is_noinferiors($ic,$year_folder,$boxes)) ||
sqimap_mailbox_is_noinferiors($ic,$sent_subfolders_base,$boxes)) {
- error_box(_("Sent Subfolders plugin is misconfigured."),$color);
+ error_box(_("Sent Subfolders plugin is misconfigured."));
} else {
if ($level==2) {
/* Auto-create the year folder, if it does not yet exist. */
/** is spamcop plugin disabled */
if (! is_plugin_enabled('spamcop')) {
- error_box(_("Plugin is disabled."),$color);
- echo "\n</body></html>\n";
+ error_box(_("Plugin is disabled."));
+ // display footer (closes html tags) and stop script execution
+ $oTemplate->display('footer.tpl');
exit();
}
if ( ! is_resource ( $spell_proc ) ) {
// TODO: replace error_box() with sqspell_makeWindow()
error_box ( sprintf(_("Could not run the spellchecker command (%s)."),
- htmlspecialchars($sqspell_command) ) , $color );
- // close html tags and abort script.
- echo "</body></html>";
+ htmlspecialchars($sqspell_command) ) );
+ // display footer (closes html tags) and stop script execution
+ $oTemplate->display('footer.tpl');
exit();
}
if ( ! @fwrite($pipes[0], $sqspell_new_text) ) {
// TODO: replace error_box() with sqspell_makeWindow()
- error_box ( _("Error while writing to pipe.") , $color );
+ error_box ( _("Error while writing to pipe.") );
// close all three $pipes here.
for($i=0; $i<=2; $i++) {
// disable all fclose error messages
@fclose($pipes[$i]);
}
// close html tags and abort script.
- echo "</body></html>";
+ $oTemplate->display('footer.tpl');
exit();
}
fclose($pipes[0]);
if ( ! is_resource ($fp) ) {
// TODO: replace error_box() with sqspell_makeWindow()
error_box ( sprintf(_("Could not open temporary file '%s'."),
- htmlspecialchars($floc) ) , $color );
+ htmlspecialchars($floc) ) );
// failed to open temp file. abort script.
- echo "</body></html>";
+ $oTemplate->display('footer.tpl');
exit();
}
if ( ! @fwrite($fp, $sqspell_new_text) ) {
// TODO: replace error_box() with sqspell_makeWindow()
error_box ( sprintf(_("Error while writing to temporary file '%s'."),
- htmlspecialchars($floc) ) , $color );
+ htmlspecialchars($floc) ) );
// close file descriptor
fclose($fp);
// failed writing to temp file. abort script.
- echo "</body></html>";
+ $oTemplate->display('footer.tpl');
exit();
}
fclose($fp);
if (file_exists(SM_PATH . $SQSPELL_DIR . "modules/$MOD.mod")) {
require_once(SM_PATH . $SQSPELL_DIR . "modules/$MOD.mod");
} else {
- error_box(_("Invalid SquirrelSpell module."),$color);
- echo '</body></html>';
+ error_box(_("Invalid SquirrelSpell module."));
+ // display sm footer (closes html tags)
+ $oTemplate->display('footer.tpl');
}
?>
\ No newline at end of file
if (file_exists(SM_PATH . $SQSPELL_DIR . "modules/$MOD.mod")) {
require_once(SM_PATH . $SQSPELL_DIR . "modules/$MOD.mod");
} else {
- error_box(_("Invalid SquirrelSpell module."),$color);
- echo '</body></html>';
+ error_box(_("Invalid SquirrelSpell module."));
+ // display footer (closes html tags)
+ $oTemplate->display('footer.tpl');
}
?>
\ No newline at end of file
$translate_server_option='translate_' . $translate_server . '_enabled';
if ($translate_server=='gpltrans' && $translate_gpltrans_url=='' ||
! $$translate_server_option || ! function_exists('translate_form_' . $translate_server)) {
- error_box(_("Selected translation engine is disabled. Please update your translation preferences."),$color);
+ error_box(_("Selected translation engine is disabled. Please update your translation preferences."));
return;
}
$translate_dir = 'to';
* Include the SquirrelMail initialization file.
*/
include('../include/init.php');
-error_box('delete_message.php script is obsolete since 1.5.1.',$color);
+error_box('delete_message.php script is obsolete since 1.5.1.');
$oTemplate->display('footer.tpl');
?>
\ No newline at end of file
if (file_exists("../help/$squirrelmail_language")) {
$user_language = $squirrelmail_language;
} else if (file_exists('../help/en_US')) {
- error_box(_("Help is not available in the selected language. It will be displayed in English instead."), $color);
+ error_box(_("Help is not available in the selected language. It will be displayed in English instead."));
echo '<br />';
$user_language = 'en_US';
} else {
- error_box( _("Help is not available. Please contact your system administrator for assistance."), $color );
- exit;
+ error_box( _("Help is not available. Please contact your system administrator for assistance."));
+ // display footer (closes html tags) and stop script execution
+ $oTemplate->display('footer.tpl');
+ exit();
}
} elseif (file_exists("../help/en_US/" . $helpdir[$chapter-1])) {
// If the selected language can't be found, try English.
$doc = file("../help/en_US/" . $helpdir[$chapter-1]);
- error_box(_("This chapter in not available in the selected language. It will be displayed in English instead."), $color);
+ error_box(_("This chapter in not available in the selected language. It will be displayed in English instead."));
echo '<br />';
} else {
// If English can't be found, the chapter went MIA.
echo '<br /><div style="text-align: center;"><a href="#pagetop">' . _("Top") . '</a></div>';
} else {
// If the help file went MIA, display an error message.
- error_box(sprintf(_("For some reason, chapter %s is not available."), $chapter), $color);
+ error_box(sprintf(_("For some reason, chapter %s is not available."), $chapter));
}
}
$string .= _("Also, the use of TLS may allow SquirrelMail to login.").'<br />';
}
$string .= _("Please contact your system administrator and report this error.");
- error_box($string,$color);
+ error_box($string);
+ // display footer (closes html tags) and stop script execution
+ $oTemplate->display('footer.tpl');
exit;
}
}
}
$logo_str = '<img src="'.$org_logo.'" ' .
- 'alt="'. sprintf(_("%s Logo"), $org_name).'" ' .
- $width_and_height .
+ 'alt="'. sprintf(_("%s Logo"), $org_name).'" ' .
+ $width_and_height .
'class="sqm_loginImage" ' .
- ' /><br />'."\n";
+ ' /><br />'."\n";
}
$sm_attribute_str = '';
$passed_ent_id = 0;
if ( ! sqgetGlobalVar('mailbox',$mailbox,SQ_GET) ||
! sqgetGlobalVar('passed_id',$passed_id,SQ_GET)) {
- error_box(_("Invalid URL"),$color);
+ error_box(_("Invalid URL"));
} else {
$passed_id= (int) $passed_id;
$view_unsafe_images = (bool) $_GET['view_unsafe_images'];
extract($t);
$this->display('error_message.tpl');
?>
+<!-- end of generated html -->
</body>
</html>
\ No newline at end of file