在admin/plugin.inc.php
找 if($action == 'pluginsconfig' && $export) { 上面加
- require_once DISCUZ_ROOT.'include/sctc.inc.php';
复制代码
找 <tr><td class="altbg1"><div align="center"><textarea name="plugindata" cols="80" rows="8"></textarea><br> 改成
- <tr><td class="altbg1"><div align="center">
- <input class="radio" type="radio" name="code" value="utf_tc"> <?=$lang['plugins_import_from_tc']?>
- <input class="radio" type="radio" name="code" value="utf_sc"> <?=$lang['plugins_import_from_sc']?>
- <input class="radio" type="radio" name="code" value="big5"> <?=$lang['plugins_import_from_big5']?>
- <input class="radio" type="radio" name="code" value="gbk" checked> <?=$lang['plugins_import_from_gbk']?><br>
- <textarea name="plugindata" cols="80" rows="8"></textarea><br>
复制代码
找 $db->query("INSERT INTO {$tablepre}plugins ($sql1) VALUES ($sql2)");
上面加- switch($code) {
- case "big5":
- require_once DISCUZ_ROOT.'include/chinese.class.php';
- $chs = new Chinese('BIG5', 'UTF8');
- $sql2=$chs->Convert($sql2);
- $sql2=tc2sc($sql2);
- $chs = new Chinese('UTF8', 'GBK');
- $sql2=$chs->Convert($sql2);
- break;
- case "utf_tc":
- $sql2=tc2sc($sql2);
- require_once DISCUZ_ROOT.'include/chinese.class.php';
- $chs = new Chinese('UTF8', 'GBK');
- $sql2=$chs->Convert($sql2);
- break;
- case "utf_sc":
- require_once DISCUZ_ROOT.'include/chinese.class.php';
- $chs = new Chinese('UTF8', 'GBK');
- $sql2=$chs->Convert($sql2);
- break;
- case "gbk":
- break;
- }
复制代码
找 $db->query("INSERT INTO {$tablepre}plugin$pluginconfig ($sql1) VALUES ($sql2)");
上面加- switch($code) {
- case "big5":
- require_once DISCUZ_ROOT.'include/chinese.class.php';
- $chs = new Chinese('BIG5', 'UTF8');
- $sql2=$chs->Convert($sql2);
- $sql2=tc2sc($sql2);
- $chs = new Chinese('UTF8', 'GBK');
- $sql2=$chs->Convert($sql2);
- break;
- case "utf_tc":
- $sql2=tc2sc($sql2);
- require_once DISCUZ_ROOT.'include/chinese.class.php';
- $chs = new Chinese('UTF8', 'GBK');
- $sql2=$chs->Convert($sql2);
- break;
- case "utf_sc":
- require_once DISCUZ_ROOT.'include/chinese.class.php';
- $chs = new Chinese('UTF8', 'GBK');
- $sql2=$chs->Convert($sql2);
- break;
- case "gbk":
- break;
- }
复制代码
在最底?>上面加
- function tc2sc($str){
- $outstr="";
- for($i=0; $i < strlen($str); $i++) {
- $ch=ord(substr($str,$i,1));
- if($ch > 127) {
- $char=substr($str,$i,3);
- $loc=strpos(strTC,$char);
- if ($loc !== false) $char=substr(strSC,$loc,3);
- $outstr.=$char;
- $i+=2;
- } else {
- $outstr.=substr($str,$i,1);
- }
- }
- return $outstr;
- }
复制代码
==================================================================
在admin/styles.inc.php找
找 if($action == 'styles' && $export) { 上面加
- require_once DISCUZ_ROOT.'include/sctc.inc.php';
复制代码
找 <tr><td class="altbg1"><div align="center"><textarea name="styledata" cols="80" rows="8"></textarea><br> 改成
- <tr><td class="altbg1"><div align="center">
- <input class="radio" type="radio" name="code" value="utf_tc"> <?=$lang['plugins_import_from_tc']?>
- <input class="radio" type="radio" name="code" value="utf_sc"> <?=$lang['plugins_import_from_sc']?>
- <input class="radio" type="radio" name="code" value="big5"> <?=$lang['plugins_import_from_big5']?>
- <input class="radio" type="radio" name="code" value="gbk" checked> <?=$lang['plugins_import_from_gbk']?><br>
- <textarea name="styledata" cols="80" rows="8"></textarea><br>
复制代码
找 $db->query("INSERT INTO {$tablepre}templates (name, directory, copyright)
上面加- switch($code) {
- case "big5":
- require_once DISCUZ_ROOT.'include/chinese.class.php';
- $chs = new Chinese('BIG5', 'UTF8');
- $stylearray[tplname]=$chs->Convert($stylearray[tplname]);
- $stylearray[copyright]=$chs->Convert($stylearray[copyright]);
- $stylearray[name]=$chs->Convert($stylearray[name]);
- $stylearray[tplname]=tc2sc($stylearray[tplname]);
- $stylearray[copyright]=tc2sc($stylearray[copyright]);
- $stylearray[name]=tc2sc($stylearray[name]);
- $chs = new Chinese('UTF8', 'GBK');
- $stylearray[tplname]=$chs->Convert($stylearray[tplname]);
- $stylearray[copyright]=$chs->Convert($stylearray[copyright]);
- $stylearray[name]=$chs->Convert($stylearray[name]);
- break;
- case "utf_tc":
- $stylearray[tplname]=tc2sc($stylearray[tplname]);
- $stylearray[copyright]=tc2sc($stylearray[copyright]);
- $stylearray[name]=tc2sc($stylearray[name]);
- require_once DISCUZ_ROOT.'include/chinese.class.php';
- $chs = new Chinese('UTF8', 'GBK');
- $stylearray[tplname]=$chs->Convert($stylearray[tplname]);
- $stylearray[copyright]=$chs->Convert($stylearray[copyright]);
- $stylearray[name]=$chs->Convert($stylearray[name]);
- break;
- case "utf_sc":
- require_once DISCUZ_ROOT.'include/chinese.class.php';
- $chs = new Chinese('UTF8', 'GBK');
- $stylearray[tplname]=$chs->Convert($stylearray[tplname]);
- $stylearray[copyright]=$chs->Convert($stylearray[copyright]);
- $stylearray[name]=$chs->Convert($stylearray[name]);
- break;
- case "gbk":
- break;
- }
复制代码
在最底?>上面加
- function tc2sc($str){
- $outstr="";
- for($i=0; $i < strlen($str); $i++) {
- $ch=ord(substr($str,$i,1));
- if($ch > 127) {
- $char=substr($str,$i,3);
- $loc=strpos(strTC,$char);
- if ($loc !== false) $char=substr(strSC,$loc,3);
- $outstr.=$char;
- $i+=2;
- } else {
- $outstr.=substr($str,$i,1);
- }
- }
- return $outstr;
- }
复制代码
[ 本帖最后由 Eiffel 于 2006-9-25 00:16 编辑 ] |