10) {
header( "Location: ../index.php" );
exit();
}
require_once( '../includes/version.php' );
$_VERSION = new version();
$version = $_VERSION->PRODUCT .' '. $_VERSION->RELEASE .'.'. $_VERSION->DEV_LEVEL .' '
. $_VERSION->DEV_STATUS
.' [ '.$_VERSION->CODENAME .' ] '. $_VERSION->RELDATE .' '
. $_VERSION->RELTIME .' '. $_VERSION->RELTZ;
/** Include common.php */
include_once( 'common.php' );
list($tmp_lang,$directions) = getLanguages();
$lang = trim( mosGetParam( $_POST, 'lang', '' ) );
$charset="utf-8";
$text_direction="ltr";
if($lang=='') {
$lang="en";
}else
{
$str_charset = explode(" ",$tmp_lang[$lang]);
$charset = $str_charset[1];
$text_direction = $directions[$lang];
}
$filename = "langconfig.php";
if(is_writable($filename)) {
$handle = fopen($filename,'w+');
$content = "debug = '0';\n";
$content .= "\$gettext->has_gettext = '0';\n";
$content .= "\$gettext->setlocale(\$lang);\n";
$content .= "\$gettext->bindtextdomain(\$lang, 'language/');\n";
$content .= "\$gettext->textdomain(\$lang);\n";
$content .= "?>";
fwrite($handle,$content);
fclose($handle);
}
include_once( 'langconfig.php' );
function getLanguages() {
$langfiles = glob("language/*.xml");
$langs = array();
foreach($langfiles as $xml) {
if(is_readable($xml)) {
$source = file_get_contents($xml);
$encoding = "UTF-8";
if (preg_match('//m', $source, $m)) {
$encoding = strtoupper($m[1]);
}
$parser = xml_parser_create("UTF-8");
xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8");
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
if (!xml_parse_into_struct($parser,$source,$values)) {
die(sprintf("XML error: %s at ".$xml." in line %d",
xml_error_string(xml_get_error_code($parser)),
xml_get_current_line_number($parser)));
}
xml_parser_free($parser);
$flag = true;
$title = "English";
foreach($values as $key=>$val) {
$tag = strtolower($val['tag']);
if($flag) {
if($tag=="locale") {
$title = $val['attributes']['title'];
$text_direction = $val['attributes']['text_direction'];
$flag = false;
}
}
}
$name = str_replace("language/","",$xml);
$name = str_replace(".xml","",$name);
$langs[$name] = $title." ".strtolower($encoding);
$directions[$name]=$text_direction;
}
}
return Array($langs,$directions);
}
function get_php_setting($val) {
$r = (ini_get($val) == '1' ? 1 : 0);
return $r ? T_('ON') : T_('OFF');
}
function writableCell( $folder ) {
echo '
';
echo '' . $folder . '/ ';
echo '';
echo is_writable( "../$folder" ) ? ''.T_('Writeable').' ' : ''.T_('Unwriteable').' ' . ' ';
echo ' ';
}
echo "";
?>