better-staridc-MNBT
1<?php include('amftp_header.php');?>
2<script>
3var amftp_am_ftp_pwd = <?php echo json_encode($amftp_am_ftp_pwd);?>;
4</script>
5<style>
6input {
7 margin: 0px;
8}
9</style>
10<div id="content">
11<?php
12$pwd_arr = explode('/', trim($amftp_am_ftp_pwd));
13$back_amftp_am_ftp_pwd = array_slice($pwd_arr, 0, -2);
14$back_amftp_am_ftp_pwd = implode('/', $back_amftp_am_ftp_pwd);
15
16$pwd_str = array();
17foreach($pwd_arr AS $key => $val)
18{
19 if(empty($val)) continue;
20 foreach($pwd_arr AS $k=> $v)
21 {
22 if(empty($v)) continue;
23 $pwd_str[$key]['url'] .= "/{$v}";
24 $pwd_str[$key]['name'] = $v;
25 if($v == $val)
26 break;
27 }
28}
29?>
30 <div style="border:1px solid #DBDEE1;overflow: hidden;">
31 <div class="title" style="">
32 <input type="button" value="返回目录" onclick="window.location='./index.php?pwd=<?php echo $amftp_am_ftp_pwd;?>'" class="input_button"/>
33
34 <form action="./index.php" method="GET" style="display:inline;position:relative" id="go_pwd_form">
35 <span id="pwd_str" style="padding-right: 20px;top:-2px">/<?php foreach ($pwd_str AS $key => $val) { ?><a href="javascript:;" onclick="window.location='./index.php?pwd=<?php echo $val['url'];?>'"><?php echo $val['name'];?></a>/<?php }?><?php echo $_GET['file'];?> <img src="View/images/ico/<?php echo functions::Gicon($_GET['file'], '-');?>" style="margin-bottom:-3px;"/></span>
36 <input type="text" value="<?php echo $amftp_am_ftp_pwd;?>" name="pwd" id="pwd" class="input_text" style="width:65%"/>
37 <input type="submit" value="跳转" class="input_button"/>
38 </form>
39 <input type="button" value="刷新" onclick="window.location='<?php echo $_SERVER['REQUEST_URI'];?>'" class="input_button"/>
40 <br />
41 </div>
42
43 <?php if ($file_type == 'txt') { ?>
44
45 <script src="View/js/ace/ace.js"></script>
46 <script src="View/js/ace/ext-language_tools.js"></script>
47 <style type="text/css">
48 #content .title {
49 }
50 </style>
51
52 <form action="" id="file_content_form" method="POST" style="margin:0px">
53 <pre id="file_content" name="file_content"><?php echo $file_content;?></pre>
54 <div class="title" style="padding: 9px 17px;">
55 <?php $character_arr = array('UTF-8' => 'utf8', 'CP936' => 'gbk', 'EUC-CN' => 'gb2312', 'BIG-5' => 'big5');?>
56 编码: <input type="radio" onclick="character_set(this)" name="character" value="UTF-8" <?php echo ($character == 'UTF-8') ? 'checked=""' : '';?> id="utf8_general_ci"> <label for="utf8_general_ci" class="tip" title="国际通用编码">utf8</label>
57 <input type="radio" onclick="character_set(this)" name="character" value="CP936" <?php echo ($character == 'CP936') ? 'checked=""' : '';?> id="gbk_chinese_ci"> <label for="gbk_chinese_ci" class="tip" title="中日韩汉字编码(包括繁体)" >gbk</label>
58 <input type="radio" onclick="character_set(this)" name="character" value="EUC-CN" <?php echo ($character == 'EUC-CN') ? 'checked=""' : '';?> id="gb2312_chinese_ci"> <label for="gb2312_chinese_ci" class="tip" title="简体中文编码" >gb2312</label>
59 <input type="radio" onclick="character_set(this)" name="character" value="BIG-5" <?php echo ($character == 'BIG-5') ? 'checked=""' : '';?> id="big5_chinese_ci"> <label for="big5_chinese_ci" class="tip" title="繁体中文编码" >big5</label>  
60 <?php if(!in_array($character, array('UTF-8', 'CP936', 'EUC-CN', 'BIG-5'))) {?>
61 <input type="radio" name="character" value="<?php echo $character;?>" checked="" id="character_other"> <label for="character_other" ><?php echo !empty($character) ? $character : '未识别';?></label>  
62 <?php } ?>
63 工具:<input type="button" value="查找" onclick="edit_tool('find')" class="input_button tip" title="Ctrl+F">
64 <input type="button" value="替换" onclick="edit_tool('replace')" class="input_button tip" title="<?php echo stripos($_SERVER['HTTP_USER_AGENT'], 'macintosh') ? 'Ctrl+Option+F':'Ctrl+H';?>">
65 <input type="button" value="转到行" onclick="edit_tool('gotoline')" class="input_button tip" title="Ctrl+L">
66
67 <font color="red" id="character_t" style="display:none">您当前更换的编码字符集小于文件默认 <?php echo $character_arr[$character];?> 编码,可能导致文件内容丢失。</font>
68 <br /><br />
69 <input type="submit" value="保存" name="save" class="input_button" style="padding:5px 10px"/> (Ctrl+S) <span id="span_notice"></span>
70 </div>
71 <input type="hidden" name="character_v" id="character_v" value="<?php echo $character;?>" />
72 <input type="hidden" name="file_ctype" id="file_ctype" value="<?php echo $file_ctype;?>" />
73 <input type="hidden" name="pwd_v" id="pwd_v" value="<?php echo $amftp_am_ftp_pwd;?>" />
74 <input type="hidden" name="file_v" id="file_v" value="<?php echo $_GET['file'];?>" />
75 <input type="hidden" name="charset_v" id="charset_v" value="<?php echo $_GET['charset'];?>" />
76 </form>
77
78 <script>
79 file_content_form = G('file_content_form');
80 if (file_content_form)
81 {
82 file_content_form.onsubmit = function()
83 {
84 var notice_id = 'span_notice';
85 $('#'+notice_id).html(' <img src="./View/images/load.gif">');
86 var data = 'file_content=' + encodeURIComponent(editor.getSession().getValue()) + '&character=' + encodeURIComponent($("input[name='character']:checked").val());
87 Ajax.post('./index.php?c=index&a=file_edit&pwd=' + G('pwd_v').value + '&file=' + G('file_v').value + '&charset=' + G('charset_v').value + '&tag=' + Math.random(), data, function (msg){
88 if (msg == 'success')
89 $('#'+notice_id).html('<span id="success"> 保存成功 </span>');
90 else
91 $('#'+notice_id).html('<span id="success"> 保存失败 </span>');
92 setTimeout(function(){
93 $('#'+notice_id).html('');
94 }, 1500);
95 }, false, true)
96 return false;
97 }
98 }
99 ace.require("ace/ext/language_tools");
100 editor = ace.edit("file_content");
101 editor.session.setMode("ace/mode/" + G('file_ctype').value);
102 editor.setTheme("ace/theme/chrome");
103 editor.setOptions({
104 enableSnippets: true,
105 enableLiveAutocompletion: true
106 });
107 editor.commands.addCommand({
108 name: "SaveFile",
109 bindKey: { win: "Ctrl-S", mac: "Command-S" },
110 exec: function(editor) { G('file_content_form').onsubmit(); },
111 scrollIntoView: "cursor",
112 multiSelectAction: "forEachLine"
113 });
114 editor.focus();
115 editor.gotoLine(1, 0);
116 $().ready(function(){
117 var file_content_height = $(window).height()-$('#header').height()-$('#footer').height()-195;
118 $('#file_content').height(file_content_height > 500 ? file_content_height : 500);
119 if(editor)
120 editor.resize();
121 })
122 </script>
123 <?php } elseif ($file_type == 'img') { ?>
124 <img src="<?php echo $_SERVER['REQUEST_URI'];?>&img=y" style="margin: 15px;max-width: 96%;"/>
125 <div class="title" style="">
126 <input type="button" value="新窗口打开" onclick="window.open('<?php echo $_SERVER['REQUEST_URI'];?>&img=y')" class="input_button" />
127 </div>
128 <?php } else {?>
129 <p>文件不支持直接阅读,请返回列表下载文件查看。</p>
130 <div class="title" style="">
131 <input type="button" value="返回" onclick="window.location='./index.php?pwd=<?php echo $amftp_am_ftp_pwd;?>'" class="input_button" />
132 </div>
133 <?php } ?>
134 </div>
135</div>
136
137
138
139<?php include('amftp_footer.php');?>