本文整理汇总了PHP中PMA_fatalError函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_fatalError函数的具体用法?PHP PMA_fatalError怎么用?PHP PMA_fatalError使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_fatalError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFatalErrorMessageWithArgs
/**
* Test for PMA_fatalError
*
* @return void
*/
public function testFatalErrorMessageWithArgs()
{
$message = "Fatal error #%d in file %s.";
$params = array(1, 'error_file.php');
$this->expectOutputRegex("/Fatal error #1 in file error_file.php./", "Not EQ");
PMA_fatalError($message, $params);
$message = "Fatal error in file %s.";
$params = 'error_file.php';
$this->expectOutputRegex("/Fatal error in file error_file.php./");
PMA_fatalError($message, $params);
}
示例2: PMA_auth
/**
* Displays authentication form
*
* @global string the font face to use in case of failure
* @global string the default font size to use in case of failure
* @global string the big font size to use in case of failure
*
* @return boolean always true (no return indeed)
*
* @access public
*/
function PMA_auth()
{
unset($_SESSION['LAST_SIGNON_URL']);
if (empty($GLOBALS['cfg']['Server']['SignonURL'])) {
PMA_fatalError('You must set SignonURL!');
} elseif (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) {
/* Perform logout to custom URL */
PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']);
} else {
PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['SignonURL']);
}
exit;
}
示例3: PMA_generateToken
/**
* Generates PMA_token session variable.
*
* @return void
*/
function PMA_generateToken()
{
if (class_exists('phpseclib\\Crypt\\Random')) {
$_SESSION[' PMA_token '] = bin2hex(phpseclib\Crypt\Random::string(16));
} else {
$_SESSION[' PMA_token '] = bin2hex(openssl_random_pseudo_bytes(16));
}
/**
* Check if token is properly generated (the genration can fail, for example
* due to missing /dev/random for openssl).
*/
if (empty($_SESSION[' PMA_token '])) {
PMA_fatalError('Failed to generate random CSRF token!');
}
}
示例4: PMA_processExportSchema
/**
* get all the export options and verify
* call and include the appropriate Schema Class depending on $export_type
*
* @param string $export_type format of the export
*
* @return void
*/
function PMA_processExportSchema($export_type)
{
/**
* default is PDF, otherwise validate it's only letters a-z
*/
if (!isset($export_type) || !preg_match('/^[a-zA-Z]+$/', $export_type)) {
$export_type = 'pdf';
}
// sanitize this parameter which will be used below in a file inclusion
$export_type = PMA_securePath($export_type);
// get the specific plugin
$export_plugin = PMA_getPlugin("schema", $export_type, 'libraries/plugins/schema/');
// Check schema export type
if (!isset($export_plugin)) {
PMA_fatalError(__('Bad type!'));
}
$GLOBALS['dbi']->selectDb($GLOBALS['db']);
$export_plugin->exportSchema($GLOBALS['db']);
}
示例5: PMA_sessionFailed
function PMA_sessionFailed($errors)
{
$messages = array();
foreach ($errors as $error) {
/*
* Remove path from open() in error message to avoid path disclossure
*
* This can happen with PHP 5 when nonexisting session ID is provided,
* since PHP 7, session existence is checked first.
*
* This error can also happen in case of session backed error (eg.
* read only filesystem) on any PHP version.
*
* The message string is currently hardcoded in PHP, so hopefully it
* will not change in future.
*/
$messages[] = preg_replace('/open\\(.*, O_RDWR\\)/', 'open(SESSION_FILE, O_RDWR)', htmlspecialchars($error->getMessage()));
}
/*
* Session initialization is done before selecting language, so we
* can not use translations here.
*/
PMA_fatalError('Error during session start; please check your PHP and/or ' . 'webserver log file and configure your PHP ' . 'installation properly. Also ensure that cookies are enabled ' . 'in your browser.' . '<br /><br />' . implode('<br /><br />', $messages));
}
示例6: PMA_fatalError
$message->addParam('[/doc]');
// so we can obtain the message
$_SESSION['Import_message']['message'] = $message->getDisplay();
$_SESSION['Import_message']['go_back_url'] = $goto;
$message->display();
exit;
// the footer is displayed automatically
}
/**
* Sets globals from $_POST patterns, for import plugins
* We only need to load the selected plugin
*/
if (!in_array($format, array('csv', 'ldi', 'mediawiki', 'ods', 'shp', 'sql', 'xml'))) {
// this should not happen for a normal user
// but only during an attack
PMA_fatalError('Incorrect format parameter');
}
$post_patterns = array('/^force_file_/', '/^' . $format . '_/');
foreach (array_keys($_POST) as $post_key) {
foreach ($post_patterns as $one_post_pattern) {
if (preg_match($one_post_pattern, $post_key)) {
$GLOBALS[$post_key] = $_POST[$post_key];
}
}
}
// Check needed parameters
PMA_Util::checkParameters(array('import_type', 'format'));
// We don't want anything special in format
$format = PMA_securePath($format);
// Import functions
require_once 'libraries/import.lib.php';
示例7: fatalErrorHandler
/**
* Error handler to catch fatal errors when loading configuration
* file
*
*
* PMA_Config_fatalErrorHandler
* @return void
*/
public static function fatalErrorHandler()
{
if (!isset($GLOBALS['pma_config_loading']) || !$GLOBALS['pma_config_loading']) {
return;
}
$error = error_get_last();
if ($error === null) {
return;
}
PMA_fatalError(sprintf('Failed to load phpMyAdmin configuration (%s:%s): %s', Error::relPath($error['file']), $error['line'], $error['message']));
}
示例8: PMA_fatalError
if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
PMA_fatalError(__("GLOBALS overwrite attempt"));
}
/**
* protect against possible exploits - there is no need to have so much variables
*/
if (count($_REQUEST) > 1000) {
PMA_fatalError(__('possible exploit'));
}
/**
* Check for numeric keys
* (if register_globals is on, numeric key can be found in $GLOBALS)
*/
foreach ($GLOBALS as $key => $dummy) {
if (is_numeric($key)) {
PMA_fatalError(__('numeric key detected'));
}
}
unset($dummy);
// here, the function does not exist with this configuration:
// $cfg['ServerDefault'] = 0;
$GLOBALS['is_superuser'] = isset($GLOBALS['dbi']) && $GLOBALS['dbi']->isSuperuser();
if (!empty($__redirect) && in_array($__redirect, $goto_whitelist)) {
/**
* include subform target page
*/
include $__redirect;
exit;
}
// If Zero configuration mode enabled, check PMA tables in current db.
if (!defined('PMA_MINIMUM_COMMON') && !empty($GLOBALS['server']) && isset($GLOBALS['cfg']['ZeroConf']) && $GLOBALS['cfg']['ZeroConf'] == true) {
示例9: _setlocale
}
}
// Set locale
_setlocale(LC_MESSAGES, $GLOBALS['lang']);
_bindtextdomain('phpmyadmin', $GLOBALS['lang_path']);
_bind_textdomain_codeset('phpmyadmin', 'UTF-8');
_textdomain('phpmyadmin');
/**
* Messages for phpMyAdmin.
*
* These messages are here for easy transition to Gettext.
* You should not add any messages here, use instead gettext directly
* in your template/PHP file.
*/
if (!function_exists('__')) {
PMA_fatalError('Bad invocation!');
}
/* Text direction for language */
if (in_array($GLOBALS['lang'], array('ar', 'fa', 'he', 'ur'))) {
$GLOBALS['text_dir'] = 'rtl';
} else {
$GLOBALS['text_dir'] = 'ltr';
}
/* TCPDF */
$GLOBALS['l'] = array();
/* TCPDF settings */
$GLOBALS['l']['a_meta_charset'] = 'UTF-8';
$GLOBALS['l']['a_meta_dir'] = $GLOBALS['text_dir'];
$GLOBALS['l']['a_meta_language'] = $GLOBALS['lang'];
/* TCPDF translations */
$GLOBALS['l']['w_page'] = __('Page number:');
示例10: checkPermissions
/**
* verifies the permissions on config file (if asked by configuration)
* (must be called after config.inc.php has been merged)
*
* @return void
*/
function checkPermissions()
{
// Check for permissions (on platforms that support it):
if ($this->get('CheckConfigurationPermissions')) {
$perms = @fileperms($this->getSource());
if (!($perms === false) && $perms & 2) {
// This check is normally done after loading configuration
$this->checkWebServerOs();
if ($this->get('PMA_IS_WINDOWS') == 0) {
$this->source_mtime = 0;
/* Gettext is possibly still not loaded */
if (function_exists('__')) {
$msg = __('Wrong permissions on configuration file, should not be world writable!');
} else {
$msg = 'Wrong permissions on configuration file, should not be world writable!';
}
PMA_fatalError($msg);
}
}
}
}
示例11: filter_input
* @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
*/
/**
* Core libraries.
*/
require './lib/common.inc.php';
$page = filter_input(INPUT_GET, 'page');
$page = preg_replace('/[^a-z]/', '', $page);
if ($page === '') {
$page = 'index';
}
if (!file_exists("./setup/frames/$page.inc.php")) {
// it will happen only when enterung URL by hand, we don't care for these cases
PMA_fatalError(__('Wrong GET file attribute value'));
}
// Handle done action info
$action_done = filter_input(INPUT_GET, 'action_done');
$action_done = preg_replace('/[^a-z_]/', '', $action_done);
// send no-cache headers
require './libraries/header_http.inc.php';
?>
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>phpMyAdmin setup</title>
<link href="../favicon.ico" rel="icon" type="image/x-icon" />
示例12: checkConfigSource
/**
* check config source
*
* @return boolean whether source is valid or not
*/
function checkConfigSource()
{
if (!$this->getSource()) {
// no configuration file set at all
return false;
}
if (!file_exists($this->getSource())) {
$this->source_mtime = 0;
return false;
}
if (!is_readable($this->getSource())) {
// manually check if file is readable
// might be bug #3059806 Supporting running from CIFS/Samba shares
$contents = false;
$handle = @fopen($this->getSource(), 'r');
if ($handle !== false) {
$contents = @fread($handle, 1);
// reading 1 byte is enough to test
@fclose($handle);
}
if ($contents === false) {
$this->source_mtime = 0;
PMA_fatalError(sprintf(function_exists('__') ? __('Existing configuration file (%s) is not readable.') : 'Existing configuration file (%s) is not readable.', $this->getSource()));
return false;
}
}
return true;
}
示例13: checkPermissions
/**
* verifies the permissions on config file (if asked by configuration)
* (must be called after config.inc.php has been merged)
*
* @return void
*/
function checkPermissions()
{
// Check for permissions (on platforms that support it):
if ($this->get('CheckConfigurationPermissions')) {
$perms = @fileperms($this->getSource());
if (!($perms === false) && $perms & 2) {
// This check is normally done after loading configuration
$this->checkWebServerOs();
if ($this->get('PMA_IS_WINDOWS') == 0) {
$this->source_mtime = 0;
PMA_fatalError(__('Wrong permissions on configuration file, ' . 'should not be world writable!'));
}
}
}
}
示例14: array
/**
* @global array MySQL charsets map
*/
$GLOBALS['mysql_charset_map'] = array('big5' => 'big5', 'cp-866' => 'cp866', 'euc-jp' => 'ujis', 'euc-kr' => 'euckr', 'gb2312' => 'gb2312', 'gbk' => 'gbk', 'iso-8859-1' => 'latin1', 'iso-8859-2' => 'latin2', 'iso-8859-7' => 'greek', 'iso-8859-8' => 'hebrew', 'iso-8859-8-i' => 'hebrew', 'iso-8859-9' => 'latin5', 'iso-8859-13' => 'latin7', 'iso-8859-15' => 'latin1', 'koi8-r' => 'koi8r', 'shift_jis' => 'sjis', 'tis-620' => 'tis620', 'utf-8' => 'utf8', 'windows-1250' => 'cp1250', 'windows-1251' => 'cp1251', 'windows-1252' => 'latin1', 'windows-1256' => 'cp1256', 'windows-1257' => 'cp1257');
/*
* Do the work!
*/
if (!PMA_langCheck()) {
// fallback language
$fall_back_lang = 'en';
$line = __LINE__;
if (!PMA_langSet($fall_back_lang)) {
trigger_error('phpMyAdmin-ERROR: invalid lang code: ' . __FILE__ . '#' . $line . ', check hard coded fall back language.', E_USER_WARNING);
// stop execution
// and tell the user that his chosen language is invalid
PMA_fatalError('Could not load any language, please check your language settings and folder.');
}
}
// Set locale
_setlocale(LC_MESSAGES, $GLOBALS['lang']);
_bindtextdomain('phpmyadmin', $GLOBALS['lang_path']);
_bind_textdomain_codeset('phpmyadmin', 'UTF-8');
_textdomain('phpmyadmin');
/**
* Messages for phpMyAdmin.
*
* These messages are here for easy transition to Gettext.
* You should not add any messages here, use instead gettext directly
* in your template/PHP file.
*/
if (!function_exists('__')) {
示例15: session_start
// on the session data directory, so I add some "@"
// See bug #1538132. This would block normal behavior on a cluster
//ini_set('session.save_handler', 'files');
$session_name = 'phpMyAdmin';
@session_name($session_name);
if (! isset($_COOKIE[$session_name])) {
// on first start of session we check for errors
// f.e. session dir cannot be accessed - session file not created
$orig_error_count = $GLOBALS['error_handler']->countErrors();
$r = session_start();
if ($r !== true || $orig_error_count != $GLOBALS['error_handler']->countErrors()) {
setcookie($session_name, '', 1);
PMA_fatalError('strSessionStartupErrorGeneral');
}
unset($orig_error_count);
} else {
@session_start();
}
/**
* Token which is used for authenticating access queries.
* (we use "space PMA_token space" to prevent overwriting)
*/
if (!isset($_SESSION[' PMA_token '])) {
$_SESSION[' PMA_token '] = md5(uniqid(rand(), true));
}
/**