diff --git a/export.php b/export.php index f69402d305..37efc02c62 100644 --- a/export.php +++ b/export.php @@ -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 diff --git a/file_echo.php b/file_echo.php index 47e8dbe312..c776270791 100644 --- a/file_echo.php +++ b/file_echo.php @@ -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')); } /* diff --git a/libraries/Config.class.php b/libraries/Config.class.php index a1f8efeff2..dba6f082d8 100644 --- a/libraries/Config.class.php +++ b/libraries/Config.class.php @@ -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); } } } diff --git a/libraries/auth/cookie.auth.lib.php b/libraries/auth/cookie.auth.lib.php index 9a09a1900e..41a8c2d582 100644 --- a/libraries/auth/cookie.auth.lib.php +++ b/libraries/auth/cookie.auth.lib.php @@ -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)); diff --git a/libraries/common.inc.php b/libraries/common.inc.php index f99e04a544..0c0392559e 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -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); diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 7f8accc526..142f7d8673 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -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) ) . ''; $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', diff --git a/libraries/config/messages.inc.php b/libraries/config/messages.inc.php index db0c2b557e..61d1698bea 100644 --- a/libraries/config/messages.inc.php +++ b/libraries/config/messages.inc.php @@ -11,7 +11,7 @@ */ if (!function_exists('__')) { - die('Bad invocation!'); + PMA_fatalError('Bad invocation!'); } $strConfigAjaxEnable_desc = __('Improves efficiency of screen refresh'); diff --git a/libraries/core.lib.php b/libraries/core.lib.php index 15bdd6f3d5..4af2e11e03 100644 --- a/libraries/core.lib.php +++ b/libraries/core.lib.php @@ -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)) { diff --git a/libraries/header_http.inc.php b/libraries/header_http.inc.php index 9873c5dbdf..38756be6f7 100644 --- a/libraries/header_http.inc.php +++ b/libraries/header_http.inc.php @@ -12,7 +12,7 @@ if (! defined('PHPMYADMIN')) { * */ if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) { - die(__("GLOBALS overwrite attempt")); + PMA_fatalError(__("GLOBALS overwrite attempt")); } /** diff --git a/libraries/header_meta_style.inc.php b/libraries/header_meta_style.inc.php index c2e59c8316..eb010a9bea 100644 --- a/libraries/header_meta_style.inc.php +++ b/libraries/header_meta_style.inc.php @@ -12,7 +12,7 @@ if (! defined('PHPMYADMIN')) { * */ if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) { - die(__("GLOBALS overwrite attempt")); + PMA_fatalError(__("GLOBALS overwrite attempt")); } /** diff --git a/libraries/select_lang.lib.php b/libraries/select_lang.lib.php index a2f1d34829..0eb94a796d 100644 --- a/libraries/select_lang.lib.php +++ b/libraries/select_lang.lib.php @@ -488,7 +488,7 @@ _textdomain('phpmyadmin'); */ if (! function_exists('__')) { - die('Bad invocation!'); + PMA_fatalError('Bad invocation!'); } /* l10n: Text direction, use either ltr or rtl */ diff --git a/setup/frames/form.inc.php b/setup/frames/form.inc.php index a62b80a297..cf188eb2b0 100644 --- a/setup/frames/form.inc.php +++ b/setup/frames/form.inc.php @@ -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])) { diff --git a/setup/index.php b/setup/index.php index 1b202ba842..d828c1ddfd 100644 --- a/setup/index.php +++ b/setup/index.php @@ -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 diff --git a/setup/lib/common.inc.php b/setup/lib/common.inc.php index c547521ac6..38389bee0f 100644 --- a/setup/lib/common.inc.php +++ b/setup/lib/common.inc.php @@ -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(); -?> \ No newline at end of file +?> diff --git a/setup/validate.php b/setup/validate.php index edf562f24d..2cb8c93ca8 100644 --- a/setup/validate.php +++ b/setup/validate.php @@ -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);