Merge remote-tracking branch 'origin/master'

This commit is contained in:
Michal Čihař 2012-05-09 11:58:35 +02:00
commit 37b9ca54dc
15 changed files with 27 additions and 44 deletions

View File

@ -36,7 +36,7 @@ $type = $what;
// Check export type
if (! isset($export_list[$type])) {
die(__('Bad type!'));
PMA_fatalError(__('Bad type!'));
}
/**
@ -113,7 +113,7 @@ if ($export_type == 'server') {
} elseif ($export_type == 'table' && strlen($db) && strlen($table)) {
$err_url = 'tbl_export.php?' . PMA_generate_common_url($db, $table);
} else {
die(__('Bad parameters!'));
PMA_fatalError(__('Bad parameters!'));
}
// Get the functions specific to the export type

View File

@ -18,7 +18,7 @@ if (isset($_REQUEST['filename']) && isset($_REQUEST['image'])) {
/* Check whether MIME type is allowed */
if (! isset($allowed[$_REQUEST['type']])) {
die(__('Invalid export type'));
PMA_fatalError(__('Invalid export type'));
}
/*

View File

@ -880,19 +880,6 @@ class PMA_Config
$this->source = trim($source);
}
/**
* checks if the config folder still exists and terminates app if true
*
* @return void
*/
function checkConfigFolder()
{
// Refuse to work while there still might be some world writable dir:
if (is_dir('./config')) {
die(__('Remove "./config" directory before using phpMyAdmin!'));
}
}
/**
* check config source
*
@ -953,7 +940,13 @@ class PMA_Config
$this->checkWebServerOs();
if ($this->get('PMA_IS_WINDOWS') == 0) {
$this->source_mtime = 0;
die(__('Wrong permissions on configuration file, should not be world writable!'));
/* 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);
}
}
}

View File

@ -43,7 +43,7 @@ if (function_exists('mcrypt_encrypt')) {
srand((double) microtime() * 1000000);
$td = mcrypt_module_open(MCRYPT_BLOWFISH, '', MCRYPT_MODE_CBC, '');
if ($td === false) {
die(__('Failed to use Blowfish from mcrypt!'));
PMA_fatalError(__('Failed to use Blowfish from mcrypt!'));
}
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
$GLOBALS['PMA_Config']->setCookie('pma_mcrypt_iv', base64_encode($iv));

View File

@ -153,7 +153,7 @@ if (!defined('PMA_MINIMUM_COMMON')) {
* protect against possible exploits - there is no need to have so much variables
*/
if (count($_REQUEST) > 1000) {
die(__('possible exploit'));
PMA_fatalError(__('possible exploit'));
}
/**
@ -162,7 +162,7 @@ if (count($_REQUEST) > 1000) {
*/
foreach ($GLOBALS as $key => $dummy) {
if (is_numeric($key)) {
die(__('numeric key detected'));
PMA_fatalError(__('numeric key detected'));
}
}
unset($dummy);

View File

@ -776,9 +776,6 @@ function PMA_getTableList($db, $tables = null, $limit_offset = 0,
$table_groups = array();
// load PMA configuration
$PMA_Config = $GLOBALS['PMA_Config'];
foreach ($tables as $table_name => $table) {
// check for correct row count
if (null === $table['Rows']) {
@ -1034,7 +1031,6 @@ function PMA_showMessage(
PMA_DBI_try_query('REPAIR TABLE ' . PMA_backquote($GLOBALS['table']));
}
}
unset($tbl_status);
// In an Ajax request, $GLOBALS['cell_align_left'] may not be defined. Hence,
// check for it's presence before using it
@ -1223,8 +1219,6 @@ function PMA_showMessage(
$edit_link = '';
}
$url_qpart = PMA_generate_common_url($url_params);
// Also we would like to get the SQL formed in some nice
// php-code
if (! empty($cfg['SQLQuery']['ShowAsPHP']) && ! $query_too_big) {
@ -3232,7 +3226,7 @@ function PMA_expandUserString($string, $escape = null, $updates = array())
if (! is_null($escape)) {
$column_names[] = $escape($column['Field']);
} else {
$column_names[] = $field['Field'];
$column_names[] = $column['Field'];
}
}
@ -3340,7 +3334,7 @@ function PMA_selectUploadFile($import_list, $uploaddir)
)
. '</label>';
$extensions = '';
foreach ($import_list as $key => $val) {
foreach ($import_list as $val) {
if (! empty($extensions)) {
$extensions .= '|';
}
@ -3349,7 +3343,7 @@ function PMA_selectUploadFile($import_list, $uploaddir)
$matcher = '@\.(' . $extensions . ')(\.('
. PMA_supportedDecompressions() . '))?$@';
$active = (isset($timeout_passed) && $timeout_passed && isset($local_import_file))
$active = (isset($GLOBALS['timeout_passed']) && $GLOBALS['timeout_passed'] && isset($local_import_file))
? $local_import_file
: '';
$files = PMA_getFileSelectOptions(
@ -3414,8 +3408,6 @@ function PMA_buildActionTitles()
*/
function PMA_getSupportedDatatypes($html = false, $selected = '')
{
global $cfg;
if ($html) {
// NOTE: the SELECT tag in not included in this snippet.
$retval = '';
@ -3831,7 +3823,7 @@ function PMA_currentUserHasPrivilege($priv, $db = null, $tbl = null)
// need to escape wildcards in db and table names, see bug #3518484
$tbl = str_replace(array('%', '_'), array('\%', '\_'), $tbl);
$query .= " AND TABLE_NAME='%s'";
if ($retval = PMA_DBI_fetch_value(
if (PMA_DBI_fetch_value(
sprintf(
$query,
'TABLE_PRIVILEGES',

View File

@ -11,7 +11,7 @@
*/
if (!function_exists('__')) {
die('Bad invocation!');
PMA_fatalError('Bad invocation!');
}
$strConfigAjaxEnable_desc = __('Improves efficiency of screen refresh');

View File

@ -222,8 +222,6 @@ function PMA_fatalError($error_message, $message_args = null, $delete_session =
// Displays the error message
$lang = $GLOBALS['available_languages'][$GLOBALS['lang']][1];
$dir = $GLOBALS['text_dir'];
$type = $error_header;
$error = $error_message;
// on fatal errors it cannot hurt to always delete the current session
if ($delete_session
@ -429,7 +427,7 @@ function PMA_arrayWalkRecursive(&$array, $function, $apply_to_keys_also = false)
{
static $recursive_counter = 0;
if (++$recursive_counter > 1000) {
die(__('possible deep recursion attack'));
PMA_fatalError(__('possible deep recursion attack'));
}
foreach ($array as $key => $value) {
if (is_array($value)) {

View File

@ -12,7 +12,7 @@ if (! defined('PHPMYADMIN')) {
*
*/
if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
die(__("GLOBALS overwrite attempt"));
PMA_fatalError(__("GLOBALS overwrite attempt"));
}
/**

View File

@ -12,7 +12,7 @@ if (! defined('PHPMYADMIN')) {
*
*/
if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
die(__("GLOBALS overwrite attempt"));
PMA_fatalError(__("GLOBALS overwrite attempt"));
}
/**

View File

@ -488,7 +488,7 @@ _textdomain('phpmyadmin');
*/
if (! function_exists('__')) {
die('Bad invocation!');
PMA_fatalError('Bad invocation!');
}
/* l10n: Text direction, use either ltr or rtl */

View File

@ -22,7 +22,7 @@ require './libraries/config/setup.forms.php';
$formset_id = filter_input(INPUT_GET, 'formset');
$mode = filter_input(INPUT_GET, 'mode');
if (! isset($forms[$formset_id])) {
die(__('Incorrect formset, check $formsets array in setup/frames/form.inc.php'));
PMA_fatalError(__('Incorrect formset, check $formsets array in setup/frames/form.inc.php'));
}
if (isset($GLOBALS['strConfigFormset_' . $formset_id])) {

View File

@ -19,7 +19,7 @@ if ($page === '') {
}
if (!file_exists("./setup/frames/$page.inc.php")) {
// it will happen only when enterung URL by hand, we don't care for these cases
die(__('Wrong GET file attribute value'));
PMA_fatalError(__('Wrong GET file attribute value'));
}
// Handle done action info

View File

@ -15,7 +15,7 @@ define('PMA_SETUP', true);
chdir('..');
if (!file_exists('./libraries/common.inc.php')) {
die('Bad invocation!');
PMA_fatalError('Bad invocation!');
}
require_once './libraries/common.inc.php';
@ -52,4 +52,4 @@ ConfigFile::getInstance()->setPersistKeys(
// allows for redirection even after sending some data
ob_start();
?>
?>

View File

@ -19,7 +19,7 @@ header('Content-type: application/json');
$vids = explode(',', filter_input(INPUT_POST, 'id'));
$values = json_decode(filter_input(INPUT_POST, 'values'));
if (!($values instanceof stdClass)) {
die(__('Wrong data'));
PMA_fatalError(__('Wrong data'));
}
$values = (array)$values;
$result = PMA_config_validate($vids, $values, true);