Unified error handling by using PMA_fatalError.

This commit is contained in:
Michal Čihař
2010-05-05 11:39:24 +02:00
parent 40388d4fe0
commit 5bcca1a6b5

View File

@@ -10,6 +10,13 @@ if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Failure on loading recode/iconv extensions.
*/
function PMA_failRecoding() {
PMA_fatalError(__('Couldn\'t load the iconv or recode extension needed for charset conversion. Either configure PHP to enable these extensions or disable charset conversion in phpMyAdmin.'));
}
/**
* Loads the recode or iconv extensions if any of it is not loaded yet
*/
@@ -18,14 +25,12 @@ if (isset($cfg['AllowAnywhereRecoding'])
if ($cfg['RecodingEngine'] == 'recode') {
if (!@extension_loaded('recode')) {
echo __('Couldn\'t load the iconv or recode extension needed for charset conversion. Either configure PHP to enable these extensions or disable charset conversion in phpMyAdmin.');
exit;
PMA_failRecoding();
}
$PMA_recoding_engine = 'recode';
} elseif ($cfg['RecodingEngine'] == 'iconv') {
if (!@extension_loaded('iconv')) {
echo __('Couldn\'t load the iconv or recode extension needed for charset conversion. Either configure PHP to enable these extensions or disable charset conversion in phpMyAdmin.');
exit;
PMA_failRecoding();
}
$PMA_recoding_engine = 'iconv';
} else {
@@ -34,8 +39,7 @@ if (isset($cfg['AllowAnywhereRecoding'])
} elseif (@extension_loaded('recode')) {
$PMA_recoding_engine = 'recode';
} else {
echo __('Couldn\'t load the iconv or recode extension needed for charset conversion. Either configure PHP to enable these extensions or disable charset conversion in phpMyAdmin.');
exit;
PMA_failRecoding();
}
}
} // end load recode/iconv extension