diff -r dc6026376919 -r 5bd429428101 plugins/admin/LangManager.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/admin/LangManager.php Thu Jan 24 22:06:09 2008 -0500 @@ -0,0 +1,131 @@ +auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) + { + $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); + echo '
' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '
'; + return; + } + if ( isset($_POST['action']) ) + { + $action =& $_POST['action']; + if ( strpos($action, ';') ) + { + $parms = substr($action, strpos($action, ';') + 1); + $action = substr($action, 0, strpos($action, ';')); + preg_match_all('/([a-z0-9_]+)=(.+?)(;|$)/', $parms, $matches); + $parms = array(); + foreach ( $matches[0] as $i => $_ ) + { + $parms[$matches[1][$i]] = $matches[2][$i]; + } + } + switch ( $action ) + { + case 'edit_language': + break; + case 'install_language': + $lang_list = list_available_languages(); + // Verify that we have this language's metadata + if ( isset($lang_list[@$parms['iso639']]) ) + { + // From here it's all downhill :-) + $lang_code =& $parms['iso639']; + $lang_data =& $lang_list[$lang_code]; + + $result = install_language($lang_code, $lang_data['name_eng'], $lang_data['name']); + if ( $result ) + { + // Language installed. Import the language files. + $lang_local = new Language($lang_code); + foreach ( array('core', 'admin', 'tools', 'user') as $file ) + { + $lang_local->import(ENANO_ROOT . "/language/{$lang_data['dir']}/$file.json"); + } + unset($lang_local); + + echo '