From 5bcca1a6b51aa09a53e023013cbdb561cae37915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 5 May 2010 11:39:24 +0200 Subject: [PATCH] Unified error handling by using PMA_fatalError. --- libraries/charset_conversion.lib.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/libraries/charset_conversion.lib.php b/libraries/charset_conversion.lib.php index 4348453b1..dbcb4fdc7 100644 --- a/libraries/charset_conversion.lib.php +++ b/libraries/charset_conversion.lib.php @@ -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