Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
weblate committed May 9, 2012
2 parents 0b07776 + 54dc10a commit 37b9ca5
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 44 deletions.
4 changes: 2 additions & 2 deletions export.php
Expand Up @@ -36,7 +36,7 @@

// Check export type
if (! isset($export_list[$type])) {
die(__('Bad type!'));
PMA_fatalError(__('Bad type!'));
}

/**
Expand Down Expand Up @@ -113,7 +113,7 @@
} 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
Expand Down
2 changes: 1 addition & 1 deletion file_echo.php
Expand Up @@ -18,7 +18,7 @@

/* Check whether MIME type is allowed */
if (! isset($allowed[$_REQUEST['type']])) {
die(__('Invalid export type'));
PMA_fatalError(__('Invalid export type'));
}

/*
Expand Down
21 changes: 7 additions & 14 deletions libraries/Config.class.php
Expand Up @@ -880,19 +880,6 @@ function setSource($source)
$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
*
Expand Down Expand Up @@ -953,7 +940,13 @@ function checkPermissions()
$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);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/auth/cookie.auth.lib.php
Expand Up @@ -43,7 +43,7 @@
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));
Expand Down
4 changes: 2 additions & 2 deletions libraries/common.inc.php
Expand Up @@ -153,7 +153,7 @@
* protect against possible exploits - there is no need to have so much variables
*/
if (count($_REQUEST) > 1000) {
die(__('possible exploit'));
PMA_fatalError(__('possible exploit'));
}

/**
Expand All @@ -162,7 +162,7 @@
*/
foreach ($GLOBALS as $key => $dummy) {
if (is_numeric($key)) {
die(__('numeric key detected'));
PMA_fatalError(__('numeric key detected'));
}
}
unset($dummy);
Expand Down
16 changes: 4 additions & 12 deletions libraries/common.lib.php
Expand Up @@ -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']) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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'];
}
}

Expand Down Expand Up @@ -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 .= '|';
}
Expand All @@ -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(
Expand Down Expand Up @@ -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 = '';
Expand Down Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion libraries/config/messages.inc.php
Expand Up @@ -11,7 +11,7 @@
*/

if (!function_exists('__')) {
die('Bad invocation!');
PMA_fatalError('Bad invocation!');
}

$strConfigAjaxEnable_desc = __('Improves efficiency of screen refresh');
Expand Down
4 changes: 1 addition & 3 deletions libraries/core.lib.php
Expand Up @@ -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
Expand Down Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion libraries/header_http.inc.php
Expand Up @@ -12,7 +12,7 @@
*
*/
if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
die(__("GLOBALS overwrite attempt"));
PMA_fatalError(__("GLOBALS overwrite attempt"));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion libraries/header_meta_style.inc.php
Expand Up @@ -12,7 +12,7 @@
*
*/
if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
die(__("GLOBALS overwrite attempt"));
PMA_fatalError(__("GLOBALS overwrite attempt"));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion libraries/select_lang.lib.php
Expand Up @@ -488,7 +488,7 @@ function PMA_langList()
*/

if (! function_exists('__')) {
die('Bad invocation!');
PMA_fatalError('Bad invocation!');
}

/* l10n: Text direction, use either ltr or rtl */
Expand Down
2 changes: 1 addition & 1 deletion setup/frames/form.inc.php
Expand Up @@ -22,7 +22,7 @@
$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])) {
Expand Down
2 changes: 1 addition & 1 deletion setup/index.php
Expand Up @@ -19,7 +19,7 @@
}
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
Expand Down
4 changes: 2 additions & 2 deletions setup/lib/common.inc.php
Expand Up @@ -15,7 +15,7 @@
chdir('..');

if (!file_exists('./libraries/common.inc.php')) {
die('Bad invocation!');
PMA_fatalError('Bad invocation!');
}

require_once './libraries/common.inc.php';
Expand Down Expand Up @@ -52,4 +52,4 @@
// allows for redirection even after sending some data
ob_start();

?>
?>
2 changes: 1 addition & 1 deletion setup/validate.php
Expand Up @@ -19,7 +19,7 @@
$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);
Expand Down

0 comments on commit 37b9ca5

Please sign in to comment.