本文整理汇总了PHP中error_box函数的典型用法代码示例。如果您正苦于以下问题:PHP error_box函数的具体用法?PHP error_box怎么用?PHP error_box使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了error_box函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sq_get_attach_tempfile
/**
* Get a new file to write an attachment to.
* This function makes sure it doesn't overwrite other attachments,
* preventing collisions and race conditions.
*
* @return filename of the tempfile only (not full path)
* @since 1.5.2
*/
function sq_get_attach_tempfile()
{
global $username, $attachment_dir;
$hashed_attachment_dir = getHashedDir($username, $attachment_dir);
// using PHP >= 4.3.2 we can be truly atomic here
$filemods = check_php_version(4, 3, 2) ? 'x' : 'w';
// give up after 1000 tries
$TMP_MAX = 1000;
for ($try = 0; $try < $TMP_MAX; ++$try) {
$localfilename = GenerateRandomString(32, '', 7);
$full_localfilename = "{$hashed_attachment_dir}/{$localfilename}";
// filename collision. try again
if (file_exists($full_localfilename)) {
continue;
}
// try to open for (binary) writing
$fp = @fopen($full_localfilename, $filemods);
if ($fp !== FALSE) {
// success! make sure it's not readable, close and return filename
chmod($full_localfilename, 0600);
fclose($fp);
return $localfilename;
}
}
// we tried 1000 times but didn't succeed.
error_box(_("Could not open temporary file to store attachment. Contact your system administrator to resolve this issue."));
return FALSE;
}
示例2: cpw_template_init
/**
* Use this function to do any backend-specific initialization,
* e.g. checking requirements, before the password change form
* is displayed to the user.
*/
function cpw_template_init()
{
global $oTemplate;
// plugin is not configured. Handle error gracefully.
error_box(_("No valid backend defined."));
// close html and stop script execution
$oTemplate->display('footer.tpl');
exit;
}
示例3: folders_checkname
/**
* Helper function for the functions below; checks if the user entered
* folder name is valid according to the IMAP standard. If not, it
* bails out with an error and cleanly terminates the IMAP connection.
*/
function folders_checkname($imapConnection, $folder_name, $delimiter)
{
if (substr_count($folder_name, '"') || substr_count($folder_name, "\\") || substr_count($folder_name, $delimiter) || $folder_name == '') {
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>.');
sqimap_logout($imapConnection);
$oTemplate->display('footer.tpl');
exit;
}
}
示例4: cpw_merak_init
/**
* Check if php install has all required extensions.
*/
function cpw_merak_init()
{
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!"));
// close html and stop script execution
$oTemplate->display('footer.tpl');
exit;
}
}
示例5: translate_read_form_function
/**
* Shows translation box in message display window
* @access private
*/
function translate_read_form_function()
{
global $color, $translate_server;
global $message, $translate_dir;
global $translate_show_read;
global $imapConnection, $wrap_at, $passed_id, $mailbox;
global $translate_gpltrans_url;
global $translate_babelfish_enabled, $translate_go_enabled, $translate_dictionary_enabled, $translate_google_enabled, $translate_gpltrans_enabled, $translate_intertran_enabled, $translate_promt_enabled, $translate_otenet_enabled;
global $translate_custom_enabled;
if (!$translate_show_read) {
return;
}
$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."));
return;
}
$translate_dir = 'to';
$trans_ar = $message->findDisplayEntity(array(), array('text/plain'));
$body = '';
$final_body = '';
if (!empty($trans_ar[0])) {
for ($i = 0; $i < count($trans_ar); $i++) {
/* reduced version of formatBody and translateText functions */
// get message entity information
$body_message = getEntity($message, $trans_ar[$i]);
// get message body
$body = mime_fetch_body($imapConnection, $passed_id, $trans_ar[$i]);
// convert encoded messages
$body = decodeBody($body, $body_message->header->encoding);
/*
* if message part is html formated - convert spaces, html line feeds,
* less than and greater than html entities and remove tags
*/
if ($body_message->header->type1 == 'html') {
$entity_conv = array(' ' => ' ', '<p>' => "\n", '<P>' => "\n", '<br>' => "\n", '<BR>' => "\n", '<br />' => "\n", '<BR />' => "\n", '>' => '>', '<' => '<');
$body = strtr($body, $entity_conv);
$body = strip_tags($body);
}
// remove whitespace
$body = trim($body);
// save processed text and parse other entity
$final_body .= charset_decode($body_message->header->getParameter('charset'), $body);
}
// add form if message is not empty
if (!empty($final_body)) {
$function = 'translate_form_' . $translate_server;
$function($final_body);
}
}
}
示例6: sqimap_asearch_error_box
function sqimap_asearch_error_box($response, $query, $message, $link = '')
{
global $color;
// Error message titles according to imap server returned code
$imap_error_titles = array('OK' => '', 'NO' => _("ERROR : Could not complete request."), 'BAD' => _("ERROR : Bad or malformed request."), 'BYE' => _("ERROR : Imap server closed the connection."), '' => _("ERROR : Connection dropped by imap-server."));
if (!array_key_exists($response, $imap_error_titles)) {
$title = _("ERROR : Unknown imap response.");
} else {
$title = $imap_error_titles[$response];
}
if ($link == '') {
$message_title = _("Reason Given: ");
} else {
$message_title = _("Possible reason : ");
}
if (function_exists('sqimap_error_box')) {
sqimap_error_box($title, $query, $message_title, $message, $link);
} else {
//Straight copy of 1.5 imap_general.php:sqimap_error_box(). Can be removed at a later time
global $color;
require_once SM_PATH . 'functions/display_messages.php';
$string = "<font color=\"{$color['2']}\"><b>\n" . $title . "</b><br />\n";
if ($query != '') {
$string .= _("Query:") . ' ' . htmlspecialchars($query) . '<br />';
}
if ($message_title != '') {
$string .= $message_title;
}
if ($message != '') {
$string .= htmlspecialchars($message);
}
if ($link != '') {
$string .= $link;
}
$string .= "</font><br />\n";
error_box($string, $color);
}
}
示例7: define
* @copyright (c) 1999-2004 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: printer_friendly_main.php,v 1.20 2004/10/02 17:21:32 jervfors Exp $
* @package squirrelmail
*/
/**
* Path for SquirrelMail required files.
* @ignore
*/
define('SM_PATH', '../');
/* SquirrelMail required files. */
require_once SM_PATH . 'include/validate.php';
/* get those globals into gear */
global $color;
if (!sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET)) {
$passed_ent_id = 0;
}
if (!sqgetGlobalVar('mailbox', $mailbox, SQ_GET) || !sqgetGlobalVar('passed_id', $passed_id, SQ_GET)) {
error_box(_("Invalid URL"), $color);
} else {
$passed_id = (int) $passed_id;
/* end globals */
displayHtmlHeader(_("Printer Friendly"), '', false, true);
echo '<frameset rows="60, *">' . "\n";
echo '<frame src="printer_friendly_top.php" name="top_frame" ' . 'scrolling="no" noresize="noresize" frameborder="0" />' . "\n";
echo '<frame src="printer_friendly_bottom.php?passed_ent_id=' . urlencode($passed_ent_id) . '&mailbox=' . urlencode($mailbox) . '&passed_id=' . $passed_id . '" name="bottom_frame" frameborder="0" />' . "\n";
echo "</frameset>\n";
}
?>
</html>
示例8: plain_error_message
function plain_error_message($message, $color)
{
error_box($message, $color);
}
示例9: getHashedDir
/**
* Helper function for getHashedFile, given a username returns the hashed
* dir for that username.
*
* @param string username the username of the current user
* @param string dir the SquirrelMail datadir
* @param string hash_dirs default ''
* @return the path to the hash dir for username
* @since 1.2.0
*/
function getHashedDir($username, $dir, $hash_dirs = '')
{
global $dir_hash_level;
/* Remove trailing slash from $dir if found */
if (substr($dir, -1) == '/') {
$dir = substr($dir, 0, strlen($dir) - 1);
}
/* If necessary, populate the hash dir variable. */
if ($hash_dirs == '') {
$hash_dirs = computeHashDirs($username);
}
/* Make sure the full hash directory exists. */
$real_hash_dir = $dir;
for ($h = 0; $h < $dir_hash_level; ++$h) {
$real_hash_dir .= '/' . $hash_dirs[$h];
if (!@is_dir($real_hash_dir)) {
//FIXME: When safe_mode is turned on, the error suppression below makes debugging safe_mode UID/GID restrictions tricky... for now, I will add a check in configtest
if (!@mkdir($real_hash_dir, 0770)) {
error_box(sprintf(_("Error creating directory %s."), $real_hash_dir) . "\n" . _("Could not create hashed directory structure!") . "\n" . _("Please contact your system administrator and report this error."));
exit;
}
}
}
/* And return that directory. */
return $real_hash_dir;
}
示例10: addressbook_init
//.........这里部分代码省略.........
$abook = new AddressBook();
/* Create empty error message */
$abook_init_error = '';
/*
Always add a local backend. We use *either* file-based *or* a
database addressbook. If $addrbook_dsn is set, the database
backend is used. If not, addressbooks are stores in files.
*/
if (isset($addrbook_dsn) && !empty($addrbook_dsn)) {
/* Database */
if (!isset($addrbook_table) || empty($addrbook_table)) {
$addrbook_table = 'address';
}
$r = $abook->add_backend('database', array('dsn' => $addrbook_dsn, 'owner' => $username, 'table' => $addrbook_table));
if (!$r && $showerr) {
$abook_init_error .= _("Error initializing address book database.") . ' ' . $abook->error;
}
} else {
/* File */
$filename = getHashedFile($username, $data_dir, "{$username}.abook");
$r = $abook->add_backend('local_file', array('filename' => $filename, 'line_length' => $abook_file_line_length, 'create' => true));
if (!$r && $showerr) {
$abook_init_error .= sprintf(_("Error opening file %s"), $filename);
}
}
/* This would be for the global addressbook */
if (isset($abook_global_file) && isset($abook_global_file_writeable) && trim($abook_global_file) != '') {
// Detect place of address book
if (!preg_match("/[\\/\\\\]/", $abook_global_file)) {
/* no path chars, address book stored in data directory
* make sure that there is a slash between data directory
* and address book file name
*/
$abook_global_filename = $data_dir . (substr($data_dir, -1) != '/' ? '/' : '') . $abook_global_file;
} elseif (preg_match("/^\\/|\\w:/", $abook_global_file)) {
// full path is set in options (starts with slash or x:)
$abook_global_filename = $abook_global_file;
} else {
$abook_global_filename = SM_PATH . $abook_global_file;
}
$r = $abook->add_backend('local_file', array('filename' => $abook_global_filename, 'name' => _("Global address book"), 'detect_writeable' => false, 'line_length' => $abook_file_line_length, 'writeable' => $abook_global_file_writeable, 'listing' => $abook_global_file_listing));
if (!$r && $showerr) {
if ($abook_init_error != '') {
$abook_init_error .= "\n";
}
$abook_init_error .= _("Error initializing global address book.") . "\n" . $abook->error;
}
}
/* Load global addressbook from SQL if configured */
if (isset($addrbook_global_dsn) && !empty($addrbook_global_dsn)) {
/* Database configured */
if (!isset($addrbook_global_table) || empty($addrbook_global_table)) {
$addrbook_global_table = 'global_abook';
}
$r = $abook->add_backend('database', array('dsn' => $addrbook_global_dsn, 'owner' => 'global', 'name' => _("Global address book"), 'writeable' => $addrbook_global_writeable, 'listing' => $addrbook_global_listing, 'table' => $addrbook_global_table));
if (!$r && $showerr) {
if ($abook_init_error != '') {
$abook_init_error .= "\n";
}
$abook_init_error .= _("Error initializing global address book.") . "\n" . $abook->error;
}
}
/*
* hook allows to include different address book backends.
* plugins should extract $abook and $r from arguments
* and use same add_backend commands as above functions.
* @since 1.5.1 and 1.4.5
*/
$hookReturn = do_hook('abook_init', $abook, $r);
$abook = $hookReturn[1];
$r = $hookReturn[2];
if (!$onlylocal) {
/* Load configured LDAP servers (if PHP has LDAP support) */
if (isset($ldap_server) && is_array($ldap_server) && function_exists('ldap_connect')) {
reset($ldap_server);
while (list($undef, $param) = each($ldap_server)) {
if (is_array($param)) {
$r = $abook->add_backend('ldap_server', $param);
if (!$r && $showerr) {
if ($abook_init_error != '') {
$abook_init_error .= "\n";
}
$abook_init_error .= sprintf(_("Error initializing LDAP server %s:") . "\n", $param['host']);
$abook_init_error .= $abook->error;
}
}
}
}
}
// end of remote abook backends init
/**
* display address book init errors.
*/
if ($abook_init_error != '' && $showerr) {
$abook_init_error = htmlspecialchars($abook_init_error);
error_box($abook_init_error, $color);
}
/* Return the initialized object */
return $abook;
}
示例11: sqgetGlobalVar
sqgetGlobalVar('send_to', $send_to, SQ_GET);
sqgetGlobalVar('subject', $subject, SQ_GET);
sqgetGlobalVar('body', $body, SQ_GET);
sqgetGlobalVar('action', $action, SQ_GET);
switch ($action) {
case 'help':
$out_string = _("This will send a message to %s requesting help for this list. You will receive an emailed response at the address below.");
break;
case 'subscribe':
$out_string = _("This will send a message to %s requesting that you will be subscribed to this list. You will be subscribed with the address below.");
break;
case 'unsubscribe':
$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);
exit;
}
echo html_tag('p', '', 'left') . html_tag('table', '', 'center', $color[0], 'border="0" width="75%"') . "\n" . html_tag('tr', html_tag('th', _("Mailinglist") . ' ' . _($action), '', $color[9])) . html_tag('tr') . html_tag('td', '', 'left');
printf($out_string, htmlspecialchars($send_to));
echo '<form method="post" action="../../src/compose.php">';
$idents = get_identities();
echo html_tag('p', '', 'center') . _("From:") . ' ';
if (count($idents) > 1) {
echo '<select name="identity">';
foreach ($idents as $nr => $data) {
echo '<option value="' . $nr . '">' . htmlspecialchars($data['full_name'] . ' <' . $data['email_address'] . ">\n");
}
echo '</select>' . "\n";
} else {
echo htmlspecialchars('"' . $idents[0]['full_name'] . '" <' . $idents[0]['email_address'] . '>');
示例12: _
* Update/modify address *
***********************************************/
if (!empty($editaddr)) {
/* Stage one: Copy data into form */
if (isset($sel) && sizeof($sel) > 0) {
if (sizeof($sel) > 1) {
$formerror = _("You can only edit one address at the time");
$showaddrlist = true;
$defselected = $sel;
} else {
$abortform = true;
list($ebackend, $enick) = explode('_', current($sel), 2);
$olddata = $abook->lookup($enick, $ebackend);
// Test if $olddata really contains anything and return an error message if it doesn't
if (!$olddata) {
error_box(nl2br(sm_encode_html_special_chars($abook->error)));
} else {
/* Display the "new address" form */
echo abook_create_form($form_url, 'editaddr', _("Update address"), _("Update address"), $current_backend, $olddata);
echo addHidden('oldnick', $olddata['nickname']) . addHidden('backend', $olddata['backend']) . addHidden('doedit', '1') . '</form>';
}
}
} elseif ($doedit == 1) {
/* Stage two: Write new data */
$newdata = $editaddr;
$r = $abook->modify($oldnick, $newdata, $backend);
/* Handle error messages */
if (!$r) {
/* Display error */
plain_error_message(nl2br(sm_encode_html_special_chars($abook->error)));
/* Display the "new address" form again */
示例13: set_up_language
$nbsp = $oTemplate->fetch('non_breaking_space.tpl');
$br = $oTemplate->fetch('line_break.tpl');
/**
* Set up the language.
*
* This code block corresponds to the *default* block of the switch
* statement above, but the language cannot be set up until after the
* template is instantiated, so we set $set_up_langage_after_template_setup
* above and do the linguistic stuff now.
*/
if ($set_up_langage_after_template_setup) {
$err = set_up_language(getPref($data_dir, $username, 'language'));
// Japanese translation used without mbstring support
if ($err == 2) {
$sError = "<p>Your administrator needs to have PHP installed with the multibyte string extension enabled (using configure option --enable-mbstring).</p>\n" . "<p>This system has assumed that you accidently switched to Japanese and has reverted your language preference to English.</p>\n" . "<p>Please refresh this page in order to continue using your webmail.</p>\n";
error_box($sError);
}
}
/**
* Initialize our custom error handler object
*/
$oErrorHandler = new ErrorHandler($oTemplate, 'error_message.tpl');
/**
* Activate custom error handling
*/
if (version_compare(PHP_VERSION, "4.3.0", ">=")) {
$oldErrorHandler = set_error_handler(array($oErrorHandler, 'SquirrelMailErrorhandler'));
} else {
$oldErrorHandler = set_error_handler('SquirrelMailErrorhandler');
}
// ============================================================================
示例14: sqimap_mailbox_select
/**
* Selects a mailbox
*/
function sqimap_mailbox_select($imap_stream, $mailbox)
{
global $auto_expunge;
if (empty($mailbox)) {
return;
}
/**
* Default UW IMAP server configuration allows to access other files
* on server. $imap_server_type is not checked because interface can
* be used with 'other' or any other server type setting. $mailbox
* variable can be modified in any script that uses variable from GET
* or POST. This code blocks all standard SquirrelMail IMAP API requests
* that use mailbox with full path (/etc/passwd) or with ../ characters
* in path (../../etc/passwd)
*/
if (strstr($mailbox, '../') || substr($mailbox, 0, 1) == '/') {
global $color;
include_once SM_PATH . 'functions/display_messages.php';
error_box(sprintf(_("Invalid mailbox name: %s"), htmlspecialchars($mailbox)), $color);
sqimap_logout($imap_stream);
die('</body></html>');
}
// cleanup $mailbox in order to prevent IMAP injection attacks
$mailbox = str_replace(array("\r", "\n"), array("", ""), $mailbox);
$read = sqimap_run_command($imap_stream, "SELECT \"{$mailbox}\"", true, $response, $message);
$result = array();
for ($i = 0, $cnt = count($read); $i < $cnt; $i++) {
if (preg_match('/^\\*\\s+OK\\s\\[(\\w+)\\s(\\w+)\\]/', $read[$i], $regs)) {
$result[strtoupper($regs[1])] = $regs[2];
} else {
if (preg_match('/^\\*\\s([0-9]+)\\s(\\w+)/', $read[$i], $regs)) {
$result[strtoupper($regs[2])] = $regs[1];
} else {
if (preg_match("/PERMANENTFLAGS(.*)/i", $read[$i], $regs)) {
$regs[1] = trim(preg_replace(array("/\\(/", "/\\)/", "/\\]/"), '', $regs[1]));
$result['PERMANENTFLAGS'] = $regs[1];
} else {
if (preg_match("/FLAGS(.*)/i", $read[$i], $regs)) {
$regs[1] = trim(preg_replace(array("/\\(/", "/\\)/"), '', $regs[1]));
$result['FLAGS'] = $regs[1];
}
}
}
}
}
if (preg_match('/^\\[(.+)\\]/', $message, $regs)) {
$result['RIGHTS'] = $regs[1];
}
if ($auto_expunge) {
$tmp = sqimap_run_command($imap_stream, 'EXPUNGE', false, $a, $b);
}
return $result;
}
示例15: sqspell_ckMOD
* @subpackage squirrelspell
*/
/**
* Include the SquirrelMail initialization file.
*/
require '../../include/init.php';
/**
* Set a couple of constants and defaults. Don't change these,
* the configurable stuff is in sqspell_config.php
* @todo do we really need $SQSPELL_DIR var?
*/
$SQSPELL_DIR = 'plugins/squirrelspell/';
$SQSPELL_CRYPTO = FALSE;
include_once SM_PATH . $SQSPELL_DIR . 'sqspell_functions.php';
/**
* $MOD is the name of the module to invoke.
* If $MOD is unspecified, assign "options_main" to it. Else check for
* security breach attempts.
*/
if (!sqgetGlobalVar('MOD', $MOD, SQ_FORM)) {
$MOD = 'options_main';
}
sqspell_ckMOD($MOD);
/* Load the stuff already. */
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."));
// display footer (closes html tags)
$oTemplate->display('footer.tpl');
}