--- amfphp.module.orig 2008-03-21 16:48:35.000000000 +0100 +++ amfphp.module 2008-03-21 17:09:09.000000000 +0100 @@ -1,6 +1,57 @@ 'admin/settings/amfphp', + 'title' => t('amfphp'), + 'callback' => 'drupal_get_form', + 'callback arguments' => array('amfphp_settings'), + 'access' => user_access('administer site configuration'), + 'type' => MENU_NORMAL_ITEM, + 'description' => t('amfphp module settings.'), + ); + } + return $items; +} + +/** + * Admin settings callback. + */ +function amfphp_settings() { + /*$method_options = array( + 0 => 'none', + 1 => 'utf8_decode', + 2 => 'mbstring' + )*/ + $form['charset_method'] = array( + '#type' => 'select', + '#title' => t('Charset method'), + '#options' => array('utf8_decode','iconv','mbstring','recode','none'), + '#default_value' => variable_get('charset_method','iconv'), + ); + $form['charset_php'] = array( + '#type' => 'select', + '#title' => t('Charset php'), + '#options' => array('ISO-8859-1','UTF-8','big5','CP950','Shift_JIS','CP932','CP949'), + '#default_value' => variable_get('charset_php','UTF-8'), + ); + $form['charset_sql'] = array( + '#type' => 'select', + '#title' => t('Charset sql'), + '#options' => array('ISO-8859-1','UTF-8','big5','CP950','Shift_JIS','CP932','CP949'), + '#default_value' => variable_get('charset_sql','ISO-8859-1'), + ); + $form['array_filter'] = array('#type' => 'hidden'); + + return system_settings_form($form); +} + /* * Implementation of hook_requirements() */ @@ -46,7 +97,7 @@ $gateway = new AmfphpGateway(); $gateway->setClassPath($servicesPath); $gateway->setClassMappingsPath($voPath); - $gateway->setCharsetHandler("utf8_decode", "ISO-8859-1", "ISO-8859-1"); + $gateway->setCharsetHandler(variable_get('charset_method','utf8_decode'), variable_get('charset_php','ISO-8859-1'), variable_get('charset_sql','ISO-8859-1')); $gateway->setErrorHandling(E_ALL ^ E_NOTICE); if(PRODUCTION_SERVER)