<?php define('in_flow', true); @(include_once '../inc/global.inc.php'); include 'lib/charset.php'; init_adodb(); init_smarty(); global $smarty, $cfg, $db; if (!isset($_POST['postflag'])) { $pic = rand(1, 17); $smarty->assign("picid", $pic); $smarty->display("login.html"); } else { $_POST['username'] = Charset::convert($_POST['username'], "utf8", "gbk"); if (login($_POST['username'], MD5($_POST['password'])) == true) { echo "success"; exit; } else { echo "fail"; exit; } }
function transliterate($str, $enc) { // see this for hebraic-chinisee // http://www.derickrethans.nl/translit.php global $CONF_use_utf; if ($enc == 'gb2312') { // echo "#### $str $enc ##"; if (!$CONF_use_utf) { require_once dirname(__FILE__) . "/lib/ConvertCharset/convert_gb2312.php"; return gb2312_to_latin($str); } else { if (substr(phpversion(), 0, 1) >= 5) { require_once dirname(__FILE__) . "/lib/ConvertCharset/chinese/charset.class.php"; $gb2312_str = Charset::convert($str, 'utf-8', 'gb2312'); $str2 = Charset::PinYin($gb2312_str, 'gb2312'); // echo "^gb2312_str : $gb2312_str ^ "; // echo "^str2: $str2 ^ "; return $str2; } else { return $str; } } } require_once dirname(__FILE__) . "/lib/ConvertCharset/ConvertCharset.class.php"; require_once dirname(__FILE__) . "/lib/utf8_to_ascii/utf8_to_ascii.php"; // if $CONF_use_utf it means the $str is already in utf // so translitarate it directly if ($CONF_use_utf) { return utf8_to_ascii($str); } $NewEncoding = new ConvertCharset(); $str_utf8 = $NewEncoding->Convert($str, $enc, "utf-8", $Entities); return utf8_to_ascii($str_utf8); }
$NewFileOutput = $NewEncoding->Convert($NewFileOutput, $encFrom, $encTo, $Entities); } writeFile(LANG_ABS_PATH . "/utf8/lang-{$lang}.php", $NewFileOutput); } // ---------------------------------- // Now do the countries files // ---------------------------------- $FileName = LANG_ABS_PATH . "/source/countries-{$lang}.php"; $File = file($FileName); $FileText = implode("", $File); writeFile(LANG_ABS_PATH . "/iso/countries-{$lang}.php", $FileText); if (!$convert_to_utf_mannually) { $FileText = str_replace("charset={$encFrom}", "charset=utf-8", $FileText); if ($lang == 'chinese') { require_once dirname(__FILE__) . "/lib/ConvertCharset/chinese/charset.class.php"; $FileText = Charset::convert($FileText, 'gb2312', 'utf-8'); } else { $FileText = str_replace("charset={$encFrom}", "charset=utf-8", $FileText); $FileText = $NewEncoding->Convert($FileText, $encFrom, $encTo, $Entities); } writeFile(LANG_ABS_PATH . "/utf8/countries-{$lang}.php", $FileText); } echo "<strong>Converted {$lang}</strong><hr><BR>"; //break; } } // end if admin_op echo "<ul>"; echo "<li><a href='" . getLeonardoLink(array('op' => 'admin_languages', 'admin_op' => 'update')) . "'>Process ALL language files and create/update files in 'utf8'/'iso' dirs</a></li>"; foreach ($availableLanguages as $lang) { echo "<li><a href='" . getLeonardoLink(array('op' => 'admin_languages', 'admin_op' => 'update', 'update_lang' => $lang)) . "'>Process only " . strtoupper($lang) . " language files</a></li>";
<?php define('in_flow', true); @(include_once '../inc/global.inc.php'); include 'lib/charset.php'; init_adodb(); init_smarty(); global $smarty, $cfg, $db; $tbl_article = $cfg['tbl_article']; if (!isset($_POST['postflag'])) { $sql = "select id,heading,score,editor from {$tbl_article} where id = " . intval($_GET['article_id']); $arr = $db->GetRow($sql); $arr['heading'] = Charset::convert($arr['heading'], "gbk", "utf8"); $arr['editor'] = Charset::convert($arr['editor'], "gbk", "utf8"); $smarty->assign("article", $arr); $smarty->display("givescore.html"); } else { $privileges_check = "givescore"; $sql = "select catalog from {$tbl_article} where id = " . intval($_POST['article_id']); $catalog_id = $db->GetOne($sql); if (!checkpower($catalog_id, GetUid(), 3)) { echo intval($_POST['fscore']); exit; } else { $sql = "update {$tbl_article} set score = " . intval($_POST['score']) . " where id = " . intval($_POST['article_id']) . " limit 1"; if ($db->Execute($sql)) { echo intval($_POST['score']); } else { echo intval($_POST['fscore']); } }