本文整理汇总了PHP中format_error函数的典型用法代码示例。如果您正苦于以下问题:PHP format_error函数的具体用法?PHP format_error怎么用?PHP format_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了format_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fatal_handler
function fatal_handler()
{
$errfile = "unknown file";
$errstr = "shutdown";
$errno = E_CORE_ERROR;
$errline = 0;
$error = error_get_last();
if ($error !== NULL) {
$errno = $error["type"];
$errfile = $error["file"];
$errline = $error["line"];
$errstr = $error["message"];
$html = format_error($errno, $errstr, $errfile, $errline);
// Отправляем письмо, если есть соответствующий плагин
if ($errno == 1) {
$errors_to_email = load_plugin('errors_to_email');
if (!empty($errors_to_email)) {
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html\r\n";
mail($errors_to_email, 'CPATracker error', $html, $headers);
}
}
if (_ENABLE_DEBUG && isset($_GET['debug']) && $_GET['debug'] == 1) {
echo $html;
} else {
if ($errno == 1) {
echo '<div class="alert alert-error">Произошла ошибка. Обратитесь, пожалуйста, в техническую поддержку.</div>';
}
}
}
}
示例2: fatal_handler
function fatal_handler()
{
$errfile = "unknown file";
$errstr = "shutdown";
$errno = E_CORE_ERROR;
$errline = 0;
$error = error_get_last();
if ($error !== NULL) {
$errno = $error["type"];
$errfile = $error["file"];
$errline = $error["line"];
$errstr = $error["message"];
mail(EMAIL_ADMIN_EMAIL, "Fatal Error: " . NOTIFY_FROM_NAME, format_error($errno, $errstr, $errfile, $errline), "MIME-Version: 1.0\r\nContent-type: text/html; charset=utf-8\r\n");
}
}
示例3: fatal_handler
function fatal_handler()
{
$errfile = "unknown file";
$errstr = "shutdown";
$errno = E_CORE_ERROR;
$errline = 0;
$error = error_get_last();
if ($error !== NULL) {
$errno = $error["type"];
$errfile = $error["file"];
$errline = $error["line"];
$errstr = $error["message"];
echo format_error($errno, $errstr, $errfile, $errline);
}
}
示例4: fatal_handler
function fatal_handler()
{
$errfile = "unknown file";
$errstr = "shutdown";
$errno = E_CORE_ERROR;
$errline = 0;
$error = error_get_last();
if ($error !== NULL) {
$errno = $error["type"];
$errfile = $error["file"];
$errline = $error["line"];
$errstr = $error["message"];
#error_mail(format_error( $errno, $errstr, $errfile, $errline));
$formattedError = format_error($errno, $errstr, $errfile, $errline);
$myfile = fopen("debug.html", "a+") or die("Unable to open file!");
fwrite($myfile, print_r($formattedError, true));
fclose($myfile);
}
}
示例5: faq_edit
/**
* faq_edit
*
* @param string $id unique identifier for te FAQ
*
* @access public
* @return string
*/
function faq_edit($id)
{
$data = array();
$faq = Faq::fetch($id);
if (!$faq) {
throw new NotFoundException();
}
if (is_post()) {
$faq->fromArray($_POST);
if ($faq->isValid()) {
$faq->save();
return redirect('/faq/list');
} else {
$data['errors'] = array();
$data['errors']['faq'] = format_error($faq);
}
}
$data['faq'] = $faq;
return render('faq_form.tpl', $data);
}
示例6: changepassword
function changepassword()
{
$old_pw = $_POST["old_password"];
$new_pw = $_POST["new_password"];
$con_pw = $_POST["confirm_password"];
if ($old_pw == "") {
print "ERROR: " . format_error("Old password cannot be blank.");
return;
}
if ($new_pw == "") {
print "ERROR: " . format_error("New password cannot be blank.");
return;
}
if ($new_pw != $con_pw) {
print "ERROR: " . format_error("Entered passwords do not match.");
return;
}
$authenticator = PluginHost::getInstance()->get_plugin($_SESSION["auth_module"]);
if (method_exists($authenticator, "change_password")) {
print format_notice($authenticator->change_password($_SESSION["uid"], $old_pw, $new_pw));
} else {
print "ERROR: " . format_error("Function not supported by authentication module.");
}
}
示例7: print_error
function print_error($msg)
{
return print format_error($msg);
}
示例8: format_error
#
# Famesy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Famesy; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
require_once "../../functions.php";
include_once "../../header.php";
// Get member
$m = $_REQUEST['m'];
if (strlen($m) == 0) {
include "../../header.php";
echo format_error("Missing member ID");
include "../../footer.php";
}
$member = get_member($m);
if (!$member) {
die("Member not found");
}
// Create invoice
$invoice = create_invoice($member);
if (!$invoice) {
die("Invoice not found");
}
?>
<html>
<head>
<title>Facturer</title>
示例9: initial_sanity_check
//.........这里部分代码省略.........
}
if (SINGLE_USER_MODE) {
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if ($link) {
$result = db_query($link, "SELECT id FROM ttrss_users WHERE id = 1");
if (db_num_rows($result) != 1) {
array_push($errors, "SINGLE_USER_MODE is enabled in config.php but default admin account is not found.");
}
}
}
if (SELF_URL_PATH == "http://yourserver/tt-rss/") {
if ($_SERVER['HTTP_REFERER']) {
array_push($errors, "Please set SELF_URL_PATH to the correct value for your server (possible value: <b>" . $_SERVER['HTTP_REFERER'] . "</b>)");
} else {
array_push($errors, "Please set SELF_URL_PATH to the correct value for your server.");
}
}
if (!is_writable(ICONS_DIR)) {
array_push($errors, "ICONS_DIR defined in config.php is not writable (chmod -R 777 " . ICONS_DIR . ").\n");
}
if (!is_writable(LOCK_DIRECTORY)) {
array_push($errors, "LOCK_DIRECTORY defined in config.php is not writable (chmod -R 777 " . LOCK_DIRECTORY . ").\n");
}
if (ini_get("open_basedir")) {
array_push($errors, "PHP configuration option open_basedir is not supported. Please disable this in PHP settings file (php.ini).");
}
if (!function_exists("curl_init") && !ini_get("allow_url_fopen")) {
array_push($errors, "PHP configuration option allow_url_fopen is disabled, and CURL functions are not present. Either enable allow_url_fopen or install PHP extension for CURL.");
}
if (!function_exists("json_encode")) {
array_push($errors, "PHP support for JSON is required, but was not found.");
}
if (DB_TYPE == "mysql" && !function_exists("mysql_connect")) {
array_push($errors, "PHP support for MySQL is required for configured DB_TYPE in config.php.");
}
if (DB_TYPE == "pgsql" && !function_exists("pg_connect")) {
array_push($errors, "PHP support for PostgreSQL is required for configured DB_TYPE in config.php");
}
if (!function_exists("mb_strlen")) {
array_push($errors, "PHP support for mbstring functions is required but was not found.");
}
if (!function_exists("hash")) {
array_push($errors, "PHP support for hash() function is required but was not found.");
}
if (!function_exists("ctype_lower")) {
array_push($errors, "PHP support for ctype functions are required by HTMLPurifier.");
}
if (ini_get("safe_mode")) {
array_push($errors, "PHP safe mode setting is not supported.");
}
if ((PUBSUBHUBBUB_HUB || PUBSUBHUBBUB_ENABLED) && !function_exists("curl_init")) {
array_push($errors, "PHP support for CURL is required for PubSubHubbub.");
}
if (!class_exists("DOMDocument")) {
array_push($errors, "PHP support for DOMDocument is required, but was not found.");
}
}
if (count($errors) > 0 && $_SERVER['REQUEST_URI']) {
?>
<html>
<head>
<title>Startup failed</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="utility.css">
</head>
<body>
<div class="floatingLogo"><img src="images/logo_wide.png"></div>
<h1>Startup failed</h1>
<p>Tiny Tiny RSS was unable to start properly. This usually means a misconfiguration or an incomplete upgrade. Please fix
errors indicated by the following messages:</p>
<?php
foreach ($errors as $error) {
echo format_error($error);
}
?>
<p>You might want to check tt-rss <a href="http://tt-rss.org/wiki">wiki</a> or the
<a href="http://tt-rss.org/forum">forums</a> for more information. Please search the forums before creating new topic
for your question.</p>
</body>
</html>
<?php
die;
} else {
if (count($errors) > 0) {
echo "Tiny Tiny RSS was unable to start properly. This usually means a misconfiguration or an incomplete upgrade.\n";
echo "Please fix errors indicated by the following messages:\n\n";
foreach ($errors as $error) {
echo " * {$error}\n";
}
echo "\nYou might want to check tt-rss wiki or the forums for more information.\n";
echo "Please search the forums before creating new topic for your question.\n";
exit(-1);
}
}
}
示例10: woniu_fatal_handler
/**
* 致命错误处理函数。
* 该函数会接受所有类型的错误,应该只处理致命错误
* @param type $errno
* @param type $errstr
* @param type $errfile
* @param type $errline
* @return type
*/
function woniu_fatal_handler()
{
$system = WoniuLoader::$system;
$errfile = "unknown file";
$errstr = "shutdown";
$errno = E_CORE_ERROR;
$errline = 0;
$error = error_get_last();
$fatal_err = array(E_ERROR, E_USER_ERROR, E_COMPILE_ERROR, E_CORE_ERROR, E_PARSE, E_RECOVERABLE_ERROR);
if ($error !== NULL && isset($error["type"]) && in_array($error["type"], $fatal_err)) {
$errno = $error["type"];
$errfile = $error["file"];
$errline = $error["line"];
$errstr = $error["message"];
if ($system['log_error']) {
$handle = $system['log_error_handle']['error'];
if (!empty($handle)) {
if (is_array($handle)) {
$class = key($handle);
$method = $handle[$class];
$rclass_obj = new ReflectionClass($class);
$rclass_obj = $rclass_obj->newInstanceArgs();
if (method_exists($rclass_obj, $method)) {
$rclass_obj->{$method}($errno, $errstr, $errfile, $errline, get_strace());
}
} else {
if (function_exists($handle)) {
$handle($errno, $errstr, $errfile, $errline, get_strace());
}
}
}
}
if ($system['debug']) {
//@ob_clean();
trigger500('<pre>' . format_error($errno, $errstr, $errfile, $errline) . '</pre>');
}
exit;
}
}
示例11: get_errors
/**
* get_errors
*
* @param mixed $record a Doctrine model
*
* @access public
* @return void
*/
function get_errors($record)
{
$record->isValid();
return format_error($record->getErrorStack()->toArray());
}
示例12: paragon_jw_search
function paragon_jw_search($search_string, $field_list)
{
$field_list = "ID," . $field_list;
$pk = "ID";
global $db;
$primary_field_string = "name";
$secondary_field_string = "description";
$stem_length = 3;
$first_word_stem_length = 4;
$second_time_stem_length = 2;
$score1 = 1;
$score2 = 0.99;
$score3 = 0.98;
$score4 = 0.97;
// set up initial variables
$primary_fields = explode(",", $primary_field_string);
$secondary_fields = explode(",", $secondary_field_string);
$final_results_array = array();
$final_category_results_array = array();
$words = explode(" ", $search_string);
if (!$search_string) {
format_error("No search text was entered.", 1);
}
// The first search is for product categories. This will provide links to the categories themselves.
// Subsequent searches are through the products table.
$sql_fields = array();
$sql = "SELECT id,category_name,html_page_name,\"{$score1}\" AS score FROM product_categories WHERE active=1 AND ";
foreach ($words as $word) {
array_push($sql_fields, "category_name LIKE \"{$word}%\"");
}
$sql .= implode(" OR ", $sql_fields);
$res = $db->query($sql);
while ($h = $db->fetch_array($res)) {
$h['name'] = "Category: " . $h['category_name'];
if (!array_key_exists($h[$pk], $final_category_results)) {
$final_category_results[$h[$pk]] = $h;
}
}
// Product search - exact matches without trailing chars in primary field get a score of $score1
$sql_fields = array();
$sql = "SELECT {$field_list},\"{$score1}\" AS score FROM products WHERE (child_product IS NULL OR child_product = 0 or child_product=\"\") AND ";
foreach ($primary_fields as $pfield) {
array_push($sql_fields, "{$pfield} LIKE \"{$search_string}%\"");
}
$sql .= implode(",", $sql_fields);
$res = $db->query($sql);
while ($h = $db->fetch_array($res)) {
if (!array_key_exists($h[$pk], $final_results)) {
$final_results[$h[$pk]] = $h;
}
}
// Product search - exact phrase match in the primary field, anywhere in the field. Primary field may contain extra text for a score of $score2.
$sql_fields = array();
$sql = "SELECT {$field_list},\"{$score2}\" AS score FROM products WHERE (child_product IS NULL OR child_product = 0 or child_product=\"\") AND ";
foreach ($primary_fields as $pfield) {
array_push($sql_fields, "{$pfield} LIKE \"%{$search_string}%\"");
}
$sql .= implode(",", $sql_fields);
$res = $db->query($sql);
while ($h = $db->fetch_array($res)) {
if (!array_key_exists($h[$pk], $final_results)) {
$final_results[$h[$pk]] = $h;
}
}
// Product search - exact phrase match in the secondary field - anywhere in field
$sql_fields = array();
$sql = "SELECT {$field_list},\"{$score3}\" AS score FROM products WHERE (child_product IS NULL OR child_product = 0 or child_product=\"\") AND ";
foreach ($secondary_fields as $sfield) {
array_push($sql_fields, "{$sfield} LIKE \"%{$search_string}%\"");
}
$sql .= implode(",", $sql_fields);
$res = $db->query($sql);
while ($h = $db->fetch_array($res)) {
//print $h[$pk] . " - " . $h['name'] . " - " . $h['score'] ."\n";
if (!array_key_exists($h[$pk], $final_results)) {
$final_results[$h[$pk]] = $h;
}
}
// Product search - each word separately in primary field
$sql_fields = array();
$sql = "SELECT {$field_list},\"{$score4}\" AS score FROM products WHERE (child_product IS NULL OR child_product = 0 or child_product=\"\") AND ";
foreach ($primary_fields as $pfield) {
array_push($sql_fields, "{$pfield} LIKE \"%{$search_string}%\"");
}
$sql .= implode(",", $sql_fields);
$res = $db->query($sql);
while ($h = $db->fetch_array($res)) {
//print $h[$pk] . " - " . $h['name'] . " - " . $h['score'] ."\n";
if (!array_key_exists($h[$pk], $final_results)) {
$final_results[$h[$pk]] = $h;
}
}
if (!$final_results) {
$response = "An exact match could not be found. The closest matches to {$search_string} are";
} else {
$response = "Search Results";
$response = "";
}
// FIRST JARO WINKLER SERCH
$final_results = $this->jaro_winkler($search_string, $first_word_stem_length, $stem_length, "AND", 0, $final_results, $field_list, $pk);
//.........这里部分代码省略.........
开发者ID:matt-platts,项目名称:jaro-winkler-search-functions,代码行数:101,代码来源:paragon_jaro_winkler_child_products.php
示例13: page_edit
/**
* page_edit
*
* @param string $slug the unique url slug for the page
*
* @access public
* @return string
*/
function page_edit($slug)
{
$data = array();
$page = Pages::fetchBySlug($slug);
if (!$page) {
throw new NotFoundException();
}
if (is_post()) {
$page->fromArray($_POST);
if ($page->isValid()) {
$page->save();
return redirect('/page/list');
} else {
$data['errors'] = array();
$data['errors']['page'] = format_error($page);
}
}
$data['page'] = $page;
return render('page_form.tpl', $data);
}
示例14: add_to_error_base
protected function add_to_error_base($msg)
{
$this->global_page_error[] = format_error($msg);
}
示例15: custom_search
function custom_search($dbf_search_for, $field_list)
{
$field_list = "ID," . $field_list;
$pk = "ID";
global $db;
$primary_field_string = "artist";
$secondary_field_string = "title";
$stem_length = 3;
$first_word_stem_length = 4;
$second_time_stem_length = 2;
$score1 = 1;
$score2 = 0.99;
$score3 = 0.98;
$score4 = 0.97;
// process initial vaariables
$primary_fields = explode(",", $primary_field_string);
$secondary_fields = explode(",", $secondary_field_string);
$final_results_array = array();
$final_category_results_array = array();
$words = explode(" ", $dbf_search_for);
if (!$dbf_search_for) {
format_error("no search for so exit", 1);
}
// category search results - displayed separately by the framework
$sql_fields = array();
$sql = "SELECT id,artist,\"{$score1}\" AS score FROM artists WHERE active=1 AND ";
foreach ($words as $word) {
array_push($sql_fields, "artist LIKE \"{$word}%\"");
}
$sql .= implode(" OR ", $sql_fields);
$res = $db->query($sql);
while ($h = $db->fetch_array($res)) {
//print $h[$pk] . " - " . $h['name'] . " - " . $h['score'] ."\n";
$h['title'] = "Category: " . $h['artist'];
if (!array_key_exists($h[$pk], $final_category_results)) {
$final_category_results[$h[$pk]] = $h;
}
}
// exact matches in primary field
$sql_fields = array();
$sql = "SELECT {$field_list},\"{$score1}\" AS score FROM products WHERE available IN (1,5) AND ";
foreach ($primary_fields as $pfield) {
array_push($sql_fields, "{$pfield} LIKE \"{$dbf_search_for}%\"");
}
$sql .= implode(",", $sql_fields);
$res = $db->query($sql);
while ($h = $db->fetch_array($res)) {
//print $h[$pk] . " - " . $h['name'] . " - " . $h['score'] ."\n";
if (!array_key_exists($h[$pk], $final_results)) {
$final_results[$h[$pk]] = $h;
}
}
//print "Exact phrase match - primary field - anywhere in field\n\n";
$sql_fields = array();
$sql = "SELECT {$field_list},\"{$score2}\" AS score FROM products WHERE available IN (1,5) AND ";
foreach ($primary_fields as $pfield) {
array_push($sql_fields, "{$pfield} LIKE \"%{$dbf_search_for}%\"");
}
$sql .= implode(",", $sql_fields);
$res = $db->query($sql);
while ($h = $db->fetch_array($res)) {
//print $h[$pk] . " - " . $h['name'] . " - " . $h['score'] ."\n";
if (!array_key_exists($h[$pk], $final_results)) {
$final_results[$h[$pk]] = $h;
}
}
//print "Exact phrase match - secondary field - anywhere in field\n\n";
$sql_fields = array();
$sql = "SELECT {$field_list},\"{$score3}\" AS score FROM products WHERE available IN (1,5) AND ";
foreach ($secondary_fields as $sfield) {
array_push($sql_fields, "{$sfield} LIKE \"%{$dbf_search_for}%\"");
}
$sql .= implode(",", $sql_fields);
$res = $db->query($sql);
while ($h = $db->fetch_array($res)) {
//print $h[$pk] . " - " . $h['name'] . " - " . $h['score'] ."\n";
if (!array_key_exists($h[$pk], $final_results)) {
$final_results[$h[$pk]] = $h;
}
}
//print "Each word separately substr 4 \n\n";
$sql_fields = array();
$sql = "SELECT {$field_list},\"{$score4}\" AS score FROM products WHERE available IN (1,5) AND ";
foreach ($primary_fields as $pfield) {
array_push($sql_fields, "{$pfield} LIKE \"%{$dbf_search_for}%\"");
}
$sql .= implode(",", $sql_fields);
$res = $db->query($sql);
while ($h = $db->fetch_array($res)) {
//print $h[$pk] . " - " . $h['name'] . " - " . $h['score'] ."\n";
if (!array_key_exists($h[$pk], $final_results)) {
$final_results[$h[$pk]] = $h;
}
}
if (!$final_results) {
$response = "An exact match could not be found. The closest matches to {$dbf_search_for} are";
} else {
$response = "Search Results";
$response = "";
}
//.........这里部分代码省略.........