From 382daa375a26b1af1be96cf6fbeff271ef69959a Mon Sep 17 00:00:00 2001 From: jose Date: Fri, 22 Nov 2019 16:55:21 +0800 Subject: [PATCH] update 6.5.1 --- BT-Panel | 41 + BTPanel/__init__.py | 123 +- BTPanel/static/css/site.css | 518 +++-- BTPanel/static/js/config.js | 72 +- BTPanel/static/js/files.js | 2592 ++++++++++++------------- BTPanel/static/js/public.js | 260 ++- BTPanel/static/js/public_backup.js | 12 +- BTPanel/static/js/site.js | 8 + BTPanel/static/js/soft.js | 484 ++++- BTPanel/templates/default/config.html | 17 +- BTPanel/templates/default/error.html | 2 +- BTPanel/templates/default/error2.html | 2 +- BTPanel/templates/default/files.html | 15 +- BTPanel/templates/default/index.html | 2 +- BTPanel/templates/default/layout.html | 4 +- BTPanel/templates/default/site.html | 2 +- BTPanel/templates/default/soft.html | 9 +- class/acme_v2.py | 329 ++++ class/ajax.py | 6 +- class/common.py | 2 +- class/config.py | 31 +- class/crontab.py | 4 +- class/database.py | 60 +- class/downloadFile.py | 2 +- class/files.py | 180 +- class/firewalld.py | 4 +- class/flask_sockets.py | 113 ++ class/ftp.py | 2 +- class/jobs.py | 25 +- class/panelDnsapi.py | 6 +- class/panelLets.py | 2 +- class/panelPlugin.py | 100 +- class/panelRedirect.py | 8 +- class/panelSSL.py | 12 +- class/panelSite.py | 180 +- class/panelTask.py | 86 +- class/password.py | 217 +++ class/public.py | 74 +- class/san_baseline.py | 1314 +++++++++++++ class/sewer/aa.py | 3 + class/ssh_terminal.py | 104 +- class/system.py | 19 +- class/userlogin.py | 24 +- init.sh | 898 +++------ requirements.txt | 3 +- rewrite/apache/EmpireCMS.conf | 10 + rewrite/apache/dedecms.conf | 13 + rewrite/apache/default.conf | 1 + rewrite/apache/discuzx.conf | 16 + rewrite/apache/discuzx2.conf | 20 + rewrite/apache/discuzx3.conf | 20 + rewrite/apache/ecshop.conf | 28 + rewrite/apache/list.txt | 1 + rewrite/apache/mvc.conf | 7 + rewrite/apache/phpcms.conf | 5 + rewrite/apache/phpwind.conf | 7 + rewrite/apache/thinkphp.conf | 7 + rewrite/apache/wordpress.conf | 8 + rewrite/apache/zblog.conf | 7 + rewrite/nginx/0.Current.conf | 0 rewrite/nginx/EmpireCMS.conf | 8 + rewrite/nginx/dabr.conf | 5 + rewrite/nginx/dbshop.conf | 7 + rewrite/nginx/dedecms.conf | 10 + rewrite/nginx/default.conf | 1 + rewrite/nginx/discuz.conf | 7 + rewrite/nginx/discuzx.conf | 12 + rewrite/nginx/discuzx2.conf | 14 + rewrite/nginx/discuzx3.conf | 15 + rewrite/nginx/drupal.conf | 3 + rewrite/nginx/ecshop.conf | 32 + rewrite/nginx/emlog.conf | 7 + rewrite/nginx/laravel5.conf | 3 + rewrite/nginx/maccms.conf | 5 + rewrite/nginx/mvc.conf | 6 + rewrite/nginx/niushop.conf | 6 + rewrite/nginx/phpcms.conf | 9 + rewrite/nginx/phpwind.conf | 4 + rewrite/nginx/sablog.conf | 16 + rewrite/nginx/seacms.conf | 11 + rewrite/nginx/shopex.conf | 5 + rewrite/nginx/thinkphp.conf | 5 + rewrite/nginx/typecho.conf | 3 + rewrite/nginx/typecho2.conf | 5 + rewrite/nginx/wordpress.conf | 6 + rewrite/nginx/wp2.conf | 6 + rewrite/nginx/zblog.conf | 9 + runserver.py | 4 +- script/backup.py | 4 +- task.py | 38 +- tools.py | 7 +- 91 files changed, 5733 insertions(+), 2661 deletions(-) create mode 100644 BT-Panel create mode 100644 class/acme_v2.py create mode 100644 class/flask_sockets.py create mode 100644 class/password.py create mode 100644 class/san_baseline.py create mode 100644 class/sewer/aa.py create mode 100644 rewrite/apache/EmpireCMS.conf create mode 100644 rewrite/apache/dedecms.conf create mode 100644 rewrite/apache/default.conf create mode 100644 rewrite/apache/discuzx.conf create mode 100644 rewrite/apache/discuzx2.conf create mode 100644 rewrite/apache/discuzx3.conf create mode 100644 rewrite/apache/ecshop.conf create mode 100644 rewrite/apache/list.txt create mode 100644 rewrite/apache/mvc.conf create mode 100644 rewrite/apache/phpcms.conf create mode 100644 rewrite/apache/phpwind.conf create mode 100644 rewrite/apache/thinkphp.conf create mode 100644 rewrite/apache/wordpress.conf create mode 100644 rewrite/apache/zblog.conf create mode 100644 rewrite/nginx/0.Current.conf create mode 100644 rewrite/nginx/EmpireCMS.conf create mode 100644 rewrite/nginx/dabr.conf create mode 100644 rewrite/nginx/dbshop.conf create mode 100644 rewrite/nginx/dedecms.conf create mode 100644 rewrite/nginx/default.conf create mode 100644 rewrite/nginx/discuz.conf create mode 100644 rewrite/nginx/discuzx.conf create mode 100644 rewrite/nginx/discuzx2.conf create mode 100644 rewrite/nginx/discuzx3.conf create mode 100644 rewrite/nginx/drupal.conf create mode 100644 rewrite/nginx/ecshop.conf create mode 100644 rewrite/nginx/emlog.conf create mode 100644 rewrite/nginx/laravel5.conf create mode 100644 rewrite/nginx/maccms.conf create mode 100644 rewrite/nginx/mvc.conf create mode 100644 rewrite/nginx/niushop.conf create mode 100644 rewrite/nginx/phpcms.conf create mode 100644 rewrite/nginx/phpwind.conf create mode 100644 rewrite/nginx/sablog.conf create mode 100644 rewrite/nginx/seacms.conf create mode 100644 rewrite/nginx/shopex.conf create mode 100644 rewrite/nginx/thinkphp.conf create mode 100644 rewrite/nginx/typecho.conf create mode 100644 rewrite/nginx/typecho2.conf create mode 100644 rewrite/nginx/wordpress.conf create mode 100644 rewrite/nginx/wp2.conf create mode 100644 rewrite/nginx/zblog.conf diff --git a/BT-Panel b/BT-Panel new file mode 100644 index 00000000..7ea74f2d --- /dev/null +++ b/BT-Panel @@ -0,0 +1,41 @@ +#!/usr/bin/python +#coding: utf-8 +# +------------------------------------------------------------------- +# | 宝塔Linux面板 +# +------------------------------------------------------------------- +# | Copyright (c) 2015-2099 宝塔软件(http://bt.cn) All rights reserved. +# +------------------------------------------------------------------- +# | Author: 黄文良 <287962566@qq.com> +# +------------------------------------------------------------------- +from gevent import monkey +monkey.patch_all() +import os,ssl +os.chdir('/www/server/panel') +from BTPanel import app,sys + +if __name__ == '__main__': + f = open('data/port.pl') + PORT = int(f.read()) + HOST = '0.0.0.0' + if os.path.exists('data/ipv6.pl'): + HOST = "0:0:0:0:0:0:0:0" + f.close() + + #app.threaded=True + #app.jinja_env.auto_reload = True + + from gevent.pywsgi import WSGIServer + from geventwebsocket.handler import WebSocketHandler + + keyfile = 'ssl/privateKey.pem' + certfile = 'ssl/certificate.pem' + if os.path.exists('data/debug.pl'): + ssl_context = None + if os.path.exists('data/ssl.pl'): ssl_context=(certfile,keyfile) + app.run(host=HOST,port=PORT,threaded=True,debug=True,ssl_context=ssl_context) + else: + if os.path.exists('data/ssl.pl'): + http_server = WSGIServer((HOST, PORT), app,handler_class=WebSocketHandler,keyfile=keyfile,certfile=certfile,log=None,error_log = None) + else: + http_server = WSGIServer((HOST, PORT), app,handler_class=WebSocketHandler) + http_server.serve_forever() \ No newline at end of file diff --git a/BTPanel/__init__.py b/BTPanel/__init__.py index 6616b8a8..2a4167dc 100644 --- a/BTPanel/__init__.py +++ b/BTPanel/__init__.py @@ -10,6 +10,7 @@ import sys,json,os,time,logging,re if sys.version_info[0] != 2: from imp import reload sys.path.insert(0,'/www/server/panel/class/') +sys.setrecursionlimit(1000000) import public from flask import Flask app = Flask(__name__,template_folder="templates/" + public.GetConfigValue('template')) @@ -18,8 +19,10 @@ from flask import Flask,current_app,session,render_template,send_file,request,re from flask_session import Session from werkzeug.contrib.cache import SimpleCache from werkzeug.wrappers import Response -from flask_socketio import SocketIO,emit,send from threading import Lock +from flask_sockets import Sockets +sockets = Sockets(app) + dns_client = None app.config['DEBUG'] = os.path.exists('data/debug.pl') @@ -35,11 +38,12 @@ if os.path.exists(basic_auth_conf): except: pass cache = SimpleCache() -socketio = SocketIO() -socketio.init_app(app) -import common,db,jobs,uuid,ssh_terminal -jobs.control_init() +import common,db,jobs,uuid,threading +job = threading.Thread(target=jobs.control_init) +job.setDaemon(True) +job.start() + app.secret_key = uuid.UUID(int=uuid.getnode()).hex[-12:] local_ip = None my_terms = {} @@ -92,23 +96,26 @@ if admin_path in admin_path_checks: admin_path = '/bt' def service_status(): return 'True' - - -@socketio.on('connect') -def socket_connect(msg=None): - if not check_login(): - emit('server_response',{'data':public.getMsg('111')}) - return False - -@socketio.on('webssh') -def webssh(msg): +@sockets.route('/webssh') +def webssh(ws): if not check_login(): session.clear() emit('server_response',"Panel session is lost, please re-login panel!") return None if not 'ssh_obj' in session: + import ssh_terminal session['ssh_obj'] = ssh_terminal.ssh_terminal() - session['ssh_obj'].send(msg) + if not 'ssh_info' in session: + s_file = '/www/server/panel/config/t_info.json' + if os.path.exists(s_file): + try: + session['ssh_info'] = json.loads(public.en_hexb(public.readFile(s_file))) + except: + session['ssh_info'] = {"host":"127.0.0.1","port":22} + else: + session['ssh_info'] = {"host":"127.0.0.1","port":22} + + session['ssh_obj'].run(ws,session['ssh_info']) @app.route('/term_open',methods=method_all) @@ -126,10 +133,11 @@ def term_open(): session[key] = session['ssh_info'] s_file = '/www/server/panel/config/t_info.json' if 'is_save' in session['ssh_info']: - public.writeFile(s_file,public.de_hexb(json.dumps(session['ssh_info']))) + public.writeFile(s_file,public.de_hexb(json.dumps(session['ssh_info'])),'wb+') public.set_mode(s_file,600) else: if os.path.exists(s_file): os.remove(s_file) + if 'ssh_obj' in session: session['ssh_obj']._ssh_info = session['ssh_info'] return public.returnJson(True,'Successful setup!'); @app.route('/reload_mod',methods=method_all) @@ -146,7 +154,9 @@ def reload_mod(): @app.before_request def request_check(): - if not request.path in ['/safe','/hook','/public']: + if request.path in ['/service_status']: return + + if not request.path in ['/safe','/hook','/public','/mail_sys']: ip_check = public.check_ip_panel() if ip_check: return ip_check @@ -162,7 +172,7 @@ def request_check(): return public.returnJson(False,'This feature is not available in offline mode!'),json_header if app.config['BASIC_AUTH_OPEN']: - if request.path in ['/public','/download']: return; + if request.path in ['/public','/download','/mail_sys','/hook']: return; auth = request.authorization if not comm.get_sk(): return; if not auth: return send_authenticated() @@ -570,7 +580,7 @@ def code(): try: import vilidate,time except: - os.system("pip install Pillow==5.4.1 -I") + public.ExecShell("pip install Pillow==5.4.1 -I") return "Pillow not install!" code_time = cache.get('codeOut') if code_time: return u'Error: Don\'t request validation codes frequently'; @@ -618,7 +628,7 @@ def plugin(pdata = None): if comReturn: return comReturn import panelPlugin pluginObject = panelPlugin.panelPlugin() - defs = ('update_zip','input_zip','export_zip','add_index','remove_index','sort_index','install_plugin','uninstall_plugin','get_soft_find','get_index_list','get_soft_list','get_cloud_list','check_deps','flush_cache','GetCloudWarning','install','unInstall','getPluginList','getPluginInfo','getPluginStatus','setPluginStatus','a','getCloudPlugin','getConfigHtml','savePluginSort') + defs = ('set_score','get_score','update_zip','input_zip','export_zip','add_index','remove_index','sort_index','install_plugin','uninstall_plugin','get_soft_find','get_index_list','get_soft_list','get_cloud_list','check_deps','flush_cache','GetCloudWarning','install','unInstall','getPluginList','getPluginInfo','getPluginStatus','setPluginStatus','a','getCloudPlugin','getConfigHtml','savePluginSort') return publicObject(pluginObject,defs,None,pdata); @@ -650,6 +660,7 @@ def panel_public(): data = public.getJson(eval('pluwx.'+get.fun+'(get)')) return data,json_header + if get.name != 'app': return abort(404) import panelPlugin plu = panelPlugin.panelPlugin() get.s = '_check'; @@ -676,6 +687,19 @@ def send_favicon(): @app.route('//',methods=method_all) @app.route('///',methods=method_all) def panel_other(name=None,fun = None,stype=None): + is_accept = False + if not fun: fun = 'index.html' + if not stype: + tmp = fun.split('.') + fun = tmp[0] + if len(tmp) == 1: tmp.append('') + stype = tmp[1] + + if not name in ['mail_sys'] or not fun in ['send_mail_http']: + comReturn = comm.local() + if comReturn: return comReturn + else: + is_accept = True if not name: name = 'coll' if not public.path_safe_check("%s/%s/%s" % (name,fun,stype)): return abort(404) if name.find('./') != -1 or not re.match("^[\w-]+$",name): return abort(404) @@ -683,7 +707,6 @@ def panel_other(name=None,fun = None,stype=None): p_path = '/www/server/panel/plugin/' + name if not os.path.exists(p_path): return abort(404) - #是否响插件应静态文件 if fun == 'static': if stype.find('./') != -1 or not os.path.exists(p_path + '/static'): return abort(404) @@ -697,12 +720,6 @@ def panel_other(name=None,fun = None,stype=None): #准备参数 args = get_input(); args.client_ip = public.GetClientIp(); - if not fun: fun = 'index.html' - if not stype: - tmp = fun.split('.') - fun = tmp[0] - if len(tmp) == 1: tmp.append('') - stype = tmp[1] args.fun = fun #初始化插件对象 @@ -721,32 +738,12 @@ def panel_other(name=None,fun = None,stype=None): plu = eval('plugin_main.' + name + '_main()') if not hasattr(plu,fun): return public.returnJson(False,'SPECIFY_METHOD'),json_header - #检查访问权限 - comReturn = comm.local() - if comReturn: - if not is_php: - if not hasattr(plu,'_check'): - session.clear() - return public.returnJson(False,'SPECIFY_PLUG_ERR'),json_header - checks = plu._check(args) - r_type = type(checks) - if r_type == Response: return checks - if r_type != bool or not checks: return public.getJson(checks),json_header - - #初始化面板数据 - comm.setSession() - comm.init() - comm.checkWebType() - comm.GetOS() - - import panelPlugin - plugins = panelPlugin.panelPlugin() - args.name = name - if not plugins.check_accept(args): - return public.returnMsg(False,public.to_string([24744, 26410, 36141, 20080, 91, 37, 115, 93, 25110, 25480, 26435, 24050, 21040, 26399, 33]) % (plugins.get_title_byname(args),)) #执行插件方法 if not is_php: + if is_accept: + checks = plu._check(args) + if type(checks) != bool or not checks: return public.getJson(checks),json_header data = eval('plu.'+fun+'(args)') else: import panelPHP @@ -964,15 +961,7 @@ def publicObject(toObject,defs,action=None,get = None): if hasattr(toObject,'site_path_check'): if not toObject.site_path_check(get): return public.ReturnJson(False,'Excessive operation!'),json_header - for key in defs: - if key == get.action: - fun = 'toObject.'+key+'(get)' - if hasattr(get,'html') or hasattr(get,'s_module'): - return eval(fun) - else: - return public.GetJson(eval(fun)),json_header - - return public.ReturnJson(False,'ARGS_ERR'),json_header + return run_exec().run(toObject,defs,get) def check_login(http_token=None): @@ -1077,3 +1066,17 @@ def get_input_data(data): for key in data.keys(): pdata[key] = str(data[key]) return pdata + + +class run_exec: + + def run(self,toObject,defs,get): + for key in defs: + if key == get.action: + fun = 'toObject.'+key+'(get)' + if hasattr(get,'html') or hasattr(get,'s_module'): + return eval(fun) + else: + return public.GetJson(eval(fun)),json_header + + return public.ReturnJson(False,'ARGS_ERR'),json_header \ No newline at end of file diff --git a/BTPanel/static/css/site.css b/BTPanel/static/css/site.css index d81bd5d6..2853f14f 100644 --- a/BTPanel/static/css/site.css +++ b/BTPanel/static/css/site.css @@ -163,7 +163,7 @@ html { float:right; } .bge6 { - background-color: #F1F2F7; + background-color: #f2f2f2; } /* .bge6 { background-color: #e6e9ee @@ -368,7 +368,6 @@ html { color:red; background-color: #fef3e2; line-height: 20px; - height: 60px; margin-bottom: 15px; padding-left: 10px; box-shadow: 0 1px 2px 0 rgba(0,0,0,.2); @@ -574,7 +573,7 @@ html { } .main-content { - margin-left: 200px + margin-left: 180px } .sidebar-scroll { @@ -5292,15 +5291,16 @@ select[disabled]{ width: 100%; display: inline-block; position: relative; + background: #777; } -.ace_catalogue { +.ace_catalogue{ display: none; float: left; width: 250px; position: absolute; z-index: 99; - height: 45px; - background: #333; + height: 100%; + background: #292929; } .ace_catalogue_sidebar { display: none; @@ -5323,6 +5323,16 @@ select[disabled]{ line-height: 45px; padding-left: 20px; color: #fff; + background: #383838; +} +.ace_catalogue_list{ + height: auto; + position: absolute; + top: 40px; + left: 0; + right: 0; + bottom: 0; + background: #222; } .ace_conter_menu { height: 40px; @@ -5351,9 +5361,6 @@ select[disabled]{ background: #565656; /* transition: all 500ms; */ } -.chrome .ace_header{ - background: #dedede; -} .ace_header span { float: left; height: 35px; @@ -5365,25 +5372,16 @@ select[disabled]{ border-right: 1px solid #4c4c4c; cursor: pointer; } -.chrome .ace_header span{ - border-right: 1px solid #cccccc; - color: #444; -} -.ace_header span .glyphicon { +.ace_header span i{ margin-right: 5px; - vertical-align: text-top; + vertical-align: text-top; } -.chrome .ace_header span:hover{ - background: #d4d4d4; +.ace_header span .fa { + margin-right: 5px; } .ace_header span:hover { background: #2f2f2f; } -.chrome .ace_header .pull-down{ - color: #555; - background: #dedede; -} - .ace_header .pull-down{ display: inline-block; position: absolute; @@ -5397,12 +5395,10 @@ select[disabled]{ background: #292929; cursor: pointer; } -.chrome .ace_editor_main{ - background: #dedede; -} .ace_editor_main { position: relative; background: #444; + /* margin-left: 250px; */ } .ace_editor_main_storey { @@ -5412,18 +5408,8 @@ select[disabled]{ height: 5px; background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(255, 255, 255, 0)); } -.chrome .ace_conter_menu{ - background:rgb(243, 243, 243); -} -.chrome .ace_conter_menu .item{ - border-right: 1px solid #ececec; - color: #555; - transition: all 500ms; -} - .ace_conter_menu .item { display: inline-block; - overflow: hidden; float: left; font-size: 15px; max-width: 350px; @@ -5435,19 +5421,12 @@ select[disabled]{ cursor: pointer; border-right: 1px solid #191919; } -.chrome .ace_conter_menu .item:hover{ - background: #fff; -} .ace_conter_menu .item:hover { background: #313131; } .ace_conter_menu .item:hover .icon-tool { display: block; } -.chrome .ace_conter_menu .item.active{ - background-color: #fff; - color: #555 -} .ace_conter_menu .item.active { color: #fff; background: #404040; @@ -5457,22 +5436,19 @@ select[disabled]{ display: block; } .ace_conter_menu .item span { - max-width:250px; display: inline-block; - overflow: hidden; - white-space: normal; - text-overflow: ellipsis; line-height: 40px; height: 40px; - margin: 0 15px 0 0; + margin: 0 5px; + vertical-align: top; +} +.ace_conter_menu .item span i{ + font-style: normal; } .ace_conter_menu .item .icon_file { + color: #ff9800; font-weight: 500; - margin-left: 10px; -} -.ace_conter_menu .item .icon_file i{ - width: 14px; - font-style: normal; + min-width: 8px; } .ace_conter_menu .item .icon-tool.fa-circle { display: block; @@ -5483,7 +5459,6 @@ select[disabled]{ right: 15px; top: 13px; transition: all 1000ms; - font-size: 14px; } .ace_editor_add { float: left; @@ -5539,12 +5514,6 @@ select[disabled]{ border-color: #d43f3a; } /* 关闭视图-结束 */ - -.chrome .ace_conter_toolbar{ - background: #e6e6e6; - border-top: 1px solid #e4e4e4; -} - .ace_conter_toolbar { height: 35px; line-height: 35px; @@ -5557,11 +5526,6 @@ select[disabled]{ font-size: 0; overflow: hidden; } -.chrome .ace_conter_toolbar .pull-left span , -.chrome .ace_conter_toolbar .pull-right span{ - color: #555; - border-right: 1px solid #d4d0d0 -} .ace_conter_toolbar .pull-left, .ace_conter_toolbar .pull-right{ @@ -5578,26 +5542,16 @@ select[disabled]{ font-size: 13px; } .ace_conter_toolbar .pull-left span{ - border-right:0 !important; + border-right:0; cursor: default; } .ace_conter_toolbar .pull-left span i, .ace_conter_toolbar .pull-right span i { font-style: normal; } - -.chrome .ace_conter_toolbar .pull-right span:hover { - background:#cacaca; - -} - .ace_conter_toolbar .pull-right span:hover { background: #717171; } -.chrome .ace_toolbar_menu{ - background: #f3f3f3; - box-shadow: 0px 0px 8px 0px #9c9c9c; -} .ace_toolbar_menu { position: absolute; z-index: 9999; @@ -5609,7 +5563,6 @@ select[disabled]{ padding: 15px 0; box-shadow: 0px 0px 2px 0px #000; } - .ace_toolbar_menu .menu-conter { margin: 0 15px 15px; position: relative; @@ -5623,14 +5576,6 @@ select[disabled]{ color: #fff; cursor: pointer; } -.chrome .ace_toolbar_menu input{ - background: #f3f3f3; - border: 1px solid #7d7d7d; - color: #333; -} -.chrome .ace_toolbar_menu input:focus{ - border: 1px solid #7d7d7d; -} .ace_toolbar_menu input { width: 100%; height: 35px; @@ -5648,9 +5593,6 @@ select[disabled]{ overflow: auto; max-height: 300px; } -.chrome .ace_toolbar_menu .menu-item li{ - color: #555; -} .ace_toolbar_menu .menu-item li { padding: 0 20px; height: 35px; @@ -5660,19 +5602,10 @@ select[disabled]{ transition: all 500ms; position: relative; } -.chrome .ace_toolbar_menu .menu-item li.active, -.chrome .ace_toolbar_menu .menu-item li.active:hover { - background: #aaa; - color: #fff; -} .ace_toolbar_menu .menu-item li.active, .ace_toolbar_menu .menu-item li.active:hover { background: #666; } -.chrome .ace_toolbar_menu .menu-item li:hover { - background: #aaa; - color: #fff; -} .ace_toolbar_menu .menu-item li:hover { background: #505050; } @@ -5684,17 +5617,12 @@ select[disabled]{ position: absolute; right: 25px; } -.chrome .ace_toolbar_menu .menu-title{ - border-bottom: 1px solid #e4e4e4; - color: #777; -} .ace_toolbar_menu .menu-title { padding: 0 0 5px 20px; border-bottom: 1px solid #666666; color: #9e9e9e; } - .make_transist { -webkit-transition: all .2s ease-in-out; -moz-transition: all .2s ease-in-out; @@ -5816,33 +5744,30 @@ select[disabled]{ text-decoration: none; background-color: #f5f5f5 } -/*.dropdown-menu-li > li > div > a:focus, .dropdown-menu-li > li > div > a:hover { -color: #262626; -text-decoration: none; -background-color: #f5f5f5 -}*/ .file-types { position: relative; + line-height: 30px; + height: 30px; } .file-types .ico-folder { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAMpJREFUeNpi/P//P8NAAiaGAQYD7gAWdIFPpxIoMS8ZiOcQqfY5SD0LFT1jAsRTuaU0GZjZuAgq/vPto+S3V3fmUssBokC8llNEjp2ZFWjk/1+Eg56TE0RJsgCD3BPImAvikGs7IzMLAxuvKAMrNz9ZaWAul5iKJAsXPwUBAMzK//9AaDIcIAkODiKCbbQcGHXAqANGHTDqgFEHjDpg1AGjDqCVA57/+f6Z7hZD7XwBahOmfHv1ANQqlqCzG54CcRrjaOd0oB0AEGAAscwsxMSUtNsAAAAASUVORK5CYII=") + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAMpJREFUeNpi/P//P8NAAiaGAQYD7gAWdIFPpxIoMS8ZiOcQqfY5SD0LFT1jAsRTuaU0GZjZuAgq/vPto+S3V3fmUssBokC8llNEjp2ZFWjk/1+Eg56TE0RJsgCD3BPImAvikGs7IzMLAxuvKAMrNz9ZaWAul5iKJAsXPwUBAMzK//9AaDIcIAkODiKCbbQcGHXAqANGHTDqgFEHjDpg1AGjDqCVA57/+f6Z7hZD7XwBahOmfHv1ANQqlqCzG54CcRrjaOd0oB0AEGAAscwsxMSUtNsAAAAASUVORK5CYII="); } .file-types .ico-file { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAOVJREFUeNpi/P//P8NAAhZkzrVr1zyB1FwglqSiHSZAfBZZQEtLC7sDQJZLSUlJcnNzU8Xm27dvg6jVQByqqqp6FpsaJjS+JCcnJ8O/f/+ogkFATk5uJ8gRQMcYE+MAqgN2dvYMeXn5g0DmGmyOYKJHQmNjY0tQUFA4gc0RLLS0mI+PD5YOQCACSp8BYka6OEBUVJRBXFwcW8KkTwiAACwx4gJMDAMMRh0w6oBRB4w6YNQBow4YdcCoA0YdMOgc8Pzbt280swxq9gt8reKU58+fgzqnEjRyw1MgTkMWYBzo7jlAgAEAzk5sMbucHicAAAAASUVORK5CYII=") + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAOVJREFUeNpi/P//P8NAAhZkzrVr1zyB1FwglqSiHSZAfBZZQEtLC7sDQJZLSUlJcnNzU8Xm27dvg6jVQByqqqp6FpsaJjS+JCcnJ8O/f/+ogkFATk5uJ8gRQMcYE+MAqgN2dvYMeXn5g0DmGmyOYKJHQmNjY0tQUFA4gc0RLLS0mI+PD5YOQCACSp8BYka6OEBUVJRBXFwcW8KkTwiAACwx4gJMDAMMRh0w6oBRB4w6YNQBow4YdcCoA0YdMOgc8Pzbt280swxq9gt8reKU58+fgzqnEjRyw1MgTkMWYBzo7jlAgAEAzk5sMbucHicAAAAASUVORK5CYII="); } .file-types .ico { background-position: center center; background-repeat: no-repeat; + background-size: 15px; display: inline-block; height: 15px; margin-right: 10px; margin-left: 5px; - width: 20px; - margin-top: 3px; - vertical-align: sub; + width: 16px; + vertical-align: text-top; } .file-type-li { @@ -5859,4 +5784,373 @@ background-color: #f5f5f5 top: 7px; font-size: 11px; transform: scale(.7); -} \ No newline at end of file +} + + +/* 评价样式 */ +.score_info_view{ + display: none; + padding: 25px; +} +.comment_title{ + padding: 0 10px; + width: 100%; + height: 100px; + box-sizing: border-box; + border-bottom: 1px solid #efefef; +} +.comment_num{ + display: inline-block; + font-size: 60px; + line-height: 100px; + color: #666666; +} +.comment_num_tips{ + list-style-type: none; + width: 145px; + height: 100px; + display: inline-block; + vertical-align: top; + padding-left: 10px; + padding: 20px 0 20px 15px; + box-sizing: border-box; + margin: 0; + line-height: 19px; +} +.comment_num_tips li{ + color: #888; + display: inline-block; + font-size: 13.5px; +} +.comment_left{ + margin-right: 10px; + display: inline-block; +} +.comment_star_group{ + height: 12px; + line-height:12px; +} +.comment_right{ + width: 230px; + height: 100px; + display: inline-block; + box-sizing: border-box; + float:right; + padding: 20px 0; +} +.comment_right .comment_progress{ + width: 150px; + height: 6px; + position: relative; + display: inline-block; + margin-left: 8px; + top: -1.5px; + vertical-align: baseline; +} +.comment_right .comment_progress_bgw{ + width: 0; + height: 6px; + background: #CCCCCC; + border-radius: 2px; + position: absolute; + left: 0; + top: 0; + z-index: 999; +} +.comment_right .comment_progress_speed{ + width: 150px; + height: 6px; + background: #EFEFEF; + border-radius: 2px; +} +.comment_right .comment_star{ + display: inline-block; + height: 12px; + line-height: 12px; + vertical-align: text-top; +} +.comment_star .star_active{ + color: #F6BA2A; +} +.comment_star .star_none{ + color: #fff; +} +.comment_star{ + display: inline-block; + font-size: 0px; +} +.comment_star span{ + font-size: 12px; + margin-right: 1px; +} +.comment_tab{ + padding:15px 10px 20px 10px; + display: flex; + display: none; +} +.comment_tab span{ + display: inline-block; + width: 125px; + margin: 0 10px; + border-radius: 3px; + height: 35px; + line-height: 35px; + text-align: center; + color: #555; + background-color:#F7F7F7; + border: 1px solid #efefef; + flex: 1; + cursor: pointer; + +} +.comment_tab span:first-child{ + margin-left: 0px; +} +.comment_tab span:last-child{ + margin-right: 0px; +} +.comment_tab span.active{ + background-color:#20a53a; + border-color: #20a53a; + color: #fff; +} +.comment_tab span i{ + font-style: normal; + font-weight: 600; +} +.comment_box{ + margin-left: 1%; + margin-right: 0; + padding: 20px; + border-radius: 2px; + background: #F8F8F8; + margin-bottom: 10px; + width: 48%; + float: left; + transition: all 500ms; +} +.comment_box:hover{ + box-shadow: 0 0 4px 2px #00000022; + cursor: pointer; +} +.comment_box:nth-child(2n){ + margin-left: 2%; + margin-right: 1%; + padding: 20px; + border-radius: 2px; + background: #F8F8F8; + margin-bottom: 10px; + width: 48%; +} + +.comment_box_title{ + padding-bottom: 10px; +} +.comment_box_title .nice_star{ + margin-right: 10px; +} +.comment_box_title .nice_star span{ + font-size: 15px; + vertical-align: text-bottom; + color: #aaa; +} +.comment_box_title .nice_star span.star_active { + color: #F6BA2A; +} +.comment_box_title .nice_time{ + font-weight: 500; + color: #777; + font-size: 13px; + float: right; +} +.comment_box_title .nice_name{ + font-weight: 500; + color: #777; + font-size: 13px; + display: inline-block; + width: 90px; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + vertical-align: middle; +} +.comment_box_content{ + color: #777; + font-size: 13px; + height: 36px; +} +.edit_view.active{ + cursor: no-drop; + background: #ddd; + border: 1px solid #ccc; +} +.edit_view.active:hover{ + background: #ccc; +} +.edit_view .glyphicon{ + font-size: 16px; + position: relative; + top: 2px; +} +.edit_view{ + width: 200px; + height: 35px; + line-height: 35px; + border-radius: 20px; + text-align: center; + background: #21a53a; + border: 1px solid #21a53a; + color: #fff; + font-size: 15px; + position: relative; + left: 50%; + cursor: pointer; + transition: 500ms all; + margin: 15px 0 8px -100px; +} +.edit_view:hover{ + background: #0f9228; +} +.comment_content{ + overflow-y: auto; + height: 365px; + border-radius: 2px; + padding: 10px 0; + display: none; +} +.comment_box.get_next_page{ + display: block; + width: auto; + padding: 12px; + text-align: center; + font-size: 14px; + color: #888; + line-height: 14px; + box-sizing: border-box; + cursor: pointer; + transition: all 500ms; + margin:1%; + float: none; + clear: both; +} +.comment_box.get_next_page span{ + vertical-align: text-top; +} +.comment_box.get_next_page:hover{ + background-color: #ececec; + color: #666; + box-shadow: none; +} +.comment_content.box-shadow{ + box-shadow: -5px 0 3px 0px #00000022 inset; +} +.add_score_view{ + padding: 30px 30px 0 30px; +} +.score_icon_group{ + text-align: center; + height: 30px; + line-height: 30px; + font-size: 32px; + margin-bottom: 2px; + color: #cecece; +} +.score_icon_group_tips{ + text-align: center; + color: #666; + font-size: 13px; + margin-top: 10px; +} +.score_icon_group span{ + margin:0 2px; + cursor: pointer; + color: #bbb; + transition: all 500ms; +} +.score_icon_group span.active{ + color: #F6BA2A; +} +.score_input{ + width: auto; + display: block; + width: 100%; + height: 130px; + padding: 7px 5px 5px 8px; + margin-top: 10px; + line-height: 20px; + font-size: 13px; + display: none; +} +.score_input_tips{ + margin-top: 5px; + color: #888; + display: none; +} +.score_input_tips i{ + font-style: normal; + color: #666; +} +.score_details{ + padding: 50px 25px; +} +.score_details .nice_star span{ + font-size: 17px; +} +.score_details .nice_name{ + font-size: 14px; +} +.score_details .nice_time{ + font-size: 14px; +} +.score_details .comment_box_content{ + height: auto; + font-size: 14px; + line-height: 18px; +} +.score_details .comment_box_title{ + padding-bottom: 15px; +} +/* 结束 */ +/* 文件侧边栏 */ +.cd-accordion-menu{ + overflow-y: hidden; +} +.cd-accordion-menu .has-children{ + height: 30px; + line-height: 30px; +} +.cd-accordion-menu .has-children ul{ + display: none; +} +.cd-accordion-menu .has-children label:hover{ + background-color: #313131; +} +.cd-accordion-menu .has-children label{ + margin-bottom: 0; + padding: 0 10px; + width: 100%; + cursor: pointer; + color: #cccccc; +} +.cd-accordion-menu .has-children input{ + display: none; +} +.cd-accordion-menu .has-children .glyphicon{ + + margin-right: 10px; +} +.cd-accordion-menu .has-children .folder_icon{ + font-style: normal; + font-size: 15px; + margin-right: 2px; + vertical-align: bottom; +} +.cd-accordion-menu .has-children .folder_icon:before{ + color: #cccccc; + content: '\f016'; + font-family:octicons; + width: 16px; + height: 16px; + display: inline-block; +} +/* 结束 */ \ No newline at end of file diff --git a/BTPanel/static/js/config.js b/BTPanel/static/js/config.js index 073b7906..9c4ff571 100644 --- a/BTPanel/static/js/config.js +++ b/BTPanel/static/js/config.js @@ -1,3 +1,73 @@ +function modify_port_val(port){ + layer.open({ + type: 1, + area: '400px', + title: 'Change Panel Port', + closeBtn:2, + shadeClose: false, + btn:['Confirm','Cancel'], + content: '
\ +
    \ +
  • 1. Have a security group server, please release the new port in the security group in advance.
  • \ +
  • 2. If the panel is inaccessible after modifying the port, change the original port to the SSH command line by using the bt command.
  • \ +
\ +
\ + Port\ +
\ + \ +
\ +
\ +
\ + \ + ,How to release the port?\ +
\ +
', + yes:function(index,layero){ + var check_port = $('#check_port').prop('checked'),_tips = ''; + if(!check_port){ + _tips = layer.tips('Please tick the one I already know', '#check_port', {tips:[1,'#ff0000'],time:5000}); + return false; + } + layer.close(_tips); + $('#banport').val($('[name="portss"]').val()); + var _data = $("#set-Config").serializeObject(); + _data['port'] = $('[name="portss"]').val(); + var loadT = layer.msg(lan.config.config_save,{icon:16,time:0,shade: [0.3, '#000']}); + $.post('/config?action=setPanel',_data,function(rdata){ + layer.close(loadT); + layer.msg(rdata.msg,{icon:rdata.status?1:2}); + if(rdata.status){ + layer.close(index); + setTimeout(function(){ + window.location.href = ((window.location.protocol.indexOf('https') != -1)?'https://':'http://') + rdata.host + window.location.pathname; + },4000); + } + }); + }, + success:function(){ + $('#check_port').click(function(){ + layer.closeAll('tips'); + }); + } + }); +} +$.fn.serializeObject = function(){ + var o = {}; + var a = this.serializeArray(); + $.each(a, function() { + if (o[this.name]) { + if (!o[this.name].push) { + o[this.name] = [o[this.name]]; + } + o[this.name].push(this.value || ''); + } else { + o[this.name] = this.value || ''; + } + }); + return o; +}; + + //关闭面板 function ClosePanel(){ layer.confirm(lan.config.close_panel_msg,{title:lan.config.close_panel_title,closeBtn:2,icon:13,cancel:function(){ @@ -845,7 +915,7 @@ function modify_basic_auth() { } else { m_html = '
' + '

Warning! Do not understand this feature, do not open!

' - + '
    ' + + '
      ' + '
    • You must use and understand this feature to decide if you want to open it!
    • ' + '
    • After opening, access the panel in any way, you will be asked to enter the BasicAuth username and password first.
    • ' + '
    • After being turned on, it can effectively prevent the panel from being scanned and found, but it cannot replace the account password of the panel itself.
    • ' diff --git a/BTPanel/static/js/files.js b/BTPanel/static/js/files.js index b3d89509..13eed165 100644 --- a/BTPanel/static/js/files.js +++ b/BTPanel/static/js/files.js @@ -1,298 +1,298 @@ -function IsDiskWidth(){ - var comlistWidth = $("#comlist").width(); - var bodyWidth = $(".file-box").width(); - if(comlistWidth + 530 > bodyWidth){ - $("#comlist").css({"width":bodyWidth-530+"px","height":"34px","overflow":"auto"}); - } - else{ - $("#comlist").removeAttr("style"); - } +function IsDiskWidth() { + var comlistWidth = $("#comlist").width(); + var bodyWidth = $(".file-box").width(); + if (comlistWidth + 530 > bodyWidth) { + $("#comlist").css({ "width": bodyWidth - 530 + "px", "height": "34px", "overflow": "auto" }); + } + else { + $("#comlist").removeAttr("style"); + } } -function Recycle_bin(type){ - $.post('/files?action=Get_Recycle_bin','',function(rdata){ - var body = '' - switch(type){ - case 1: - for(var i=0;i 20) shortwebname = shortwebname.substring(0, 20) + "..."; - if(shortpath.length > 20) shortpath = shortpath.substring(0, 20) + "..."; - body += '\ - '+shortwebname+'\ - '+shortpath+'\ - '+ToSize(rdata.dirs[i].size)+'\ - '+getLocalTime(rdata.dirs[i].time)+'\ +function Recycle_bin(type) { + $.post('/files?action=Get_Recycle_bin', '', function (rdata) { + var body = '' + switch (type) { + case 1: + for (var i = 0; i < rdata.dirs.length; i++) { + var shortwebname = rdata.dirs[i].name.replace(/'/, "\\'"); + var shortpath = rdata.dirs[i].dname; + if (shortwebname.length > 20) shortwebname = shortwebname.substring(0, 20) + "..."; + if (shortpath.length > 20) shortpath = shortpath.substring(0, 20) + "..."; + body += '\ + ' + shortwebname + '\ + ' + shortpath + '\ + '+ ToSize(rdata.dirs[i].size) + '\ + '+ getLocalTime(rdata.dirs[i].time) + '\ \ - '+lan.files.recycle_bin_re+'\ - | '+lan.files.recycle_bin_del+'\ + ' + lan.files.recycle_bin_re + '\ + | ' + lan.files.recycle_bin_del + '\ \ '; - } - for(var i=0;i 20) shortwebname = shortwebname.substring(0, 20) + "..."; - if(shortpath.length > 20) shortpath = shortpath.substring(0, 20) + "..."; - body += '\ - '+shortwebname.replace('BTDB_','')+'\ - mysql://'+shortpath.replace('BTDB_','')+'\ + } + for (var i = 0; i < rdata.files.length; i++) { + if (rdata.files[i].name.indexOf('BTDB_') != -1) { + var shortwebname = rdata.files[i].name.replace(/'/, "\\'"); + var shortpath = rdata.files[i].dname; + if (shortwebname.length > 20) shortwebname = shortwebname.substring(0, 20) + "..."; + if (shortpath.length > 20) shortpath = shortpath.substring(0, 20) + "..."; + body += '\ + ' + shortwebname.replace('BTDB_', '') + '\ + mysql://' + shortpath.replace('BTDB_', '') + '\ -\ - '+getLocalTime(rdata.files[i].time)+'\ + '+ getLocalTime(rdata.files[i].time) + '\ \ - '+lan.files.recycle_bin_re+'\ - | '+lan.files.recycle_bin_del+'\ + ' + lan.files.recycle_bin_re + '\ + | ' + lan.files.recycle_bin_del + '\ \ ' - - continue; - } - var shortwebname = rdata.files[i].name.replace(/'/,"\\'"); - var shortpath = rdata.files[i].dname; - if(shortwebname.length > 20) shortwebname = shortwebname.substring(0, 20) + "..."; - if(shortpath.length > 20) shortpath = shortpath.substring(0, 20) + "..."; - body += '\ - '+shortwebname+'\ - '+shortpath+'\ - '+ToSize(rdata.files[i].size)+'\ - '+getLocalTime(rdata.files[i].time)+'\ + + continue; + } + var shortwebname = rdata.files[i].name.replace(/'/, "\\'"); + var shortpath = rdata.files[i].dname; + if (shortwebname.length > 20) shortwebname = shortwebname.substring(0, 20) + "..."; + if (shortpath.length > 20) shortpath = shortpath.substring(0, 20) + "..."; + body += '\ + ' + shortwebname + '\ + ' + shortpath + '\ + '+ ToSize(rdata.files[i].size) + '\ + '+ getLocalTime(rdata.files[i].time) + '\ \ - '+lan.files.recycle_bin_re+'\ - | '+lan.files.recycle_bin_del+'\ + ' + lan.files.recycle_bin_re + '\ + | ' + lan.files.recycle_bin_del + '\ \ ' - } - $("#RecycleBody").html(body); - return; - break; - case 2: - for(var i=0;i 20) shortwebname = shortwebname.substring(0, 20) + "..."; - if(shortpath.length > 20) shortpath = shortpath.substring(0, 20) + "..."; - body += '\ - '+shortwebname+'\ - '+shortpath+'\ - '+ToSize(rdata.dirs[i].size)+'\ - '+getLocalTime(rdata.dirs[i].time)+'\ + } + $("#RecycleBody").html(body); + return; + break; + case 2: + for (var i = 0; i < rdata.dirs.length; i++) { + var shortwebname = rdata.dirs[i].name.replace(/'/, "\\'"); + var shortpath = rdata.dirs[i].dname; + if (shortwebname.length > 20) shortwebname = shortwebname.substring(0, 20) + "..."; + if (shortpath.length > 20) shortpath = shortpath.substring(0, 20) + "..."; + body += '\ + ' + shortwebname + '\ + ' + shortpath + '\ + '+ ToSize(rdata.dirs[i].size) + '\ + '+ getLocalTime(rdata.dirs[i].time) + '\ \ - '+lan.files.recycle_bin_re+'\ - | '+lan.files.recycle_bin_del+'\ + ' + lan.files.recycle_bin_re + '\ + | ' + lan.files.recycle_bin_del + '\ \ ' - } - $("#RecycleBody").html(body); - return; - break; - case 3: - for(var i=0;i 20) shortwebname = shortwebname.substring(0, 20) + "..."; - if(shortpath.length > 20) shortpath = shortpath.substring(0, 20) + "..."; - body += '\ - '+shortwebname+'\ - '+shortpath+'\ - '+ToSize(rdata.files[i].size)+'\ - '+getLocalTime(rdata.files[i].time)+'\ + } + $("#RecycleBody").html(body); + return; + break; + case 3: + for (var i = 0; i < rdata.files.length; i++) { + if (rdata.files[i].name.indexOf('BTDB_') != -1) continue; + var shortwebname = rdata.files[i].name.replace(/'/, "\\'"); + var shortpath = rdata.files[i].dname; + if (shortwebname.length > 20) shortwebname = shortwebname.substring(0, 20) + "..."; + if (shortpath.length > 20) shortpath = shortpath.substring(0, 20) + "..."; + body += '\ + ' + shortwebname + '\ + ' + shortpath + '\ + '+ ToSize(rdata.files[i].size) + '\ + '+ getLocalTime(rdata.files[i].time) + '\ \ - '+lan.files.recycle_bin_re+'\ - | '+lan.files.recycle_bin_del+'\ + ' + lan.files.recycle_bin_re + '\ + | ' + lan.files.recycle_bin_del + '\ \ ' - } - $("#RecycleBody").html(body); - return; - break; - case 4: - for(var i=0;i 20) shortwebname = shortwebname.substring(0, 20) + "..."; - if(shortpath.length > 20) shortpath = shortpath.substring(0, 20) + "..."; - body += '\ - '+shortwebname+'\ - '+shortpath+'\ - '+ToSize(rdata.files[i].size)+'\ - '+getLocalTime(rdata.files[i].time)+'\ + } + $("#RecycleBody").html(body); + return; + break; + case 4: + for (var i = 0; i < rdata.files.length; i++) { + if (ReisImage(getFileName(rdata.files[i].name))) { + var shortwebname = rdata.files[i].name.replace(/'/, "\\'"); + var shortpath = rdata.files[i].dname; + if (shortwebname.length > 20) shortwebname = shortwebname.substring(0, 20) + "..."; + if (shortpath.length > 20) shortpath = shortpath.substring(0, 20) + "..."; + body += '\ + ' + shortwebname + '\ + ' + shortpath + '\ + '+ ToSize(rdata.files[i].size) + '\ + '+ getLocalTime(rdata.files[i].time) + '\ \ - '+lan.files.recycle_bin_re+'\ - | '+lan.files.recycle_bin_del+'\ + ' + lan.files.recycle_bin_re + '\ + | ' + lan.files.recycle_bin_del + '\ \ ' - } - } - $("#RecycleBody").html(body); - return; - break; - case 5: - for(var i=0;i 20) shortwebname = shortwebname.substring(0, 20) + "..."; - if(shortpath.length > 20) shortpath = shortpath.substring(0, 20) + "..."; - body += '\ - '+shortwebname+'\ - '+shortpath+'\ - '+ToSize(rdata.files[i].size)+'\ - '+getLocalTime(rdata.files[i].time)+'\ + } + } + $("#RecycleBody").html(body); + return; + break; + case 5: + for (var i = 0; i < rdata.files.length; i++) { + if (rdata.files[i].name.indexOf('BTDB_') != -1) continue; + if (!(ReisImage(getFileName(rdata.files[i].name)))) { + var shortwebname = rdata.files[i].name.replace(/'/, "\\'"); + var shortpath = rdata.files[i].dname; + if (shortwebname.length > 20) shortwebname = shortwebname.substring(0, 20) + "..."; + if (shortpath.length > 20) shortpath = shortpath.substring(0, 20) + "..."; + body += '\ + ' + shortwebname + '\ + ' + shortpath + '\ + '+ ToSize(rdata.files[i].size) + '\ + '+ getLocalTime(rdata.files[i].time) + '\ \ - '+lan.files.recycle_bin_re+'\ - | '+lan.files.recycle_bin_del+'\ + ' + lan.files.recycle_bin_re + '\ + | ' + lan.files.recycle_bin_del + '\ \ ' - } - } - $("#RecycleBody").html(body); - return; - case 6: - for(var i=0;i 20) shortwebname = shortwebname.substring(0, 20) + "..."; - if(shortpath.length > 20) shortpath = shortpath.substring(0, 20) + "..."; - body += '\ - '+shortwebname.replace('BTDB_','')+'\ - mysql://'+shortpath.replace('BTDB_','')+'\ + } + } + $("#RecycleBody").html(body); + return; + case 6: + for (var i = 0; i < rdata.files.length; i++) { + if (rdata.files[i].name.indexOf('BTDB_') != -1) { + var shortwebname = rdata.files[i].name.replace(/'/, "\\'"); + var shortpath = rdata.files[i].dname; + if (shortwebname.length > 20) shortwebname = shortwebname.substring(0, 20) + "..."; + if (shortpath.length > 20) shortpath = shortpath.substring(0, 20) + "..."; + body += '\ + ' + shortwebname.replace('BTDB_', '') + '\ + mysql://' + shortpath.replace('BTDB_', '') + '\ -\ - '+getLocalTime(rdata.files[i].time)+'\ + '+ getLocalTime(rdata.files[i].time) + '\ \ - '+lan.files.recycle_bin_re+'\ - | '+lan.files.recycle_bin_del+'\ + ' + lan.files.recycle_bin_re + '\ + | ' + lan.files.recycle_bin_del + '\ \ ' - } - } - $("#RecycleBody").html(body); - return; - break; - } - - - var tablehtml = '
      \ + } + } + $("#RecycleBody").html(body); + return; + break; + } + + + var tablehtml = '
      \
      \ - '+lan.files.recycle_bin_on+'\ + '+ lan.files.recycle_bin_on + '\
      \ - \ + \ \
      \ - '+lan.files.recycle_bin_on_db+'\ + '+ lan.files.recycle_bin_on_db + '\
      \ - \ + \ \
      \
      \ - '+lan.files.recycle_bin_ps+'\ - \ + '+ lan.files.recycle_bin_ps + '\ + \
      \
      \
      \ -

      '+lan.files.recycle_bin_type1+'

      \ -

      '+lan.files.recycle_bin_type2+'

      \ -

      '+lan.files.recycle_bin_type3+'

      \ -

      '+lan.files.recycle_bin_type4+'

      \ -

      '+lan.files.recycle_bin_type5+'

      \ -

      '+lan.files.recycle_bin_type6+'

      \ +

      '+ lan.files.recycle_bin_type1 + '

      \ +

      '+ lan.files.recycle_bin_type2 + '

      \ +

      '+ lan.files.recycle_bin_type3 + '

      \ +

      '+ lan.files.recycle_bin_type4 + '

      \ +

      '+ lan.files.recycle_bin_type5 + '

      \ +

      '+ lan.files.recycle_bin_type6 + '

      \
      \
      \
      \ \ \ \ - \ - \ - \ - \ - \ + \ + \ + \ + \ + \ \ \ - '+body+'\ + '+ body + '\
      '+lan.files.recycle_bin_th1+''+lan.files.recycle_bin_th2+''+lan.files.recycle_bin_th3+''+lan.files.recycle_bin_th4+''+lan.files.recycle_bin_th5+''+ lan.files.recycle_bin_th1 + ''+ lan.files.recycle_bin_th2 + ''+ lan.files.recycle_bin_th3 + ''+ lan.files.recycle_bin_th4 + ''+ lan.files.recycle_bin_th5 + '
      '; - if(type == "open"){ - layer.open({ - type: 1, - shift: 5, - closeBtn: 2, - area: ['80%','606px'], - title: lan.files.recycle_bin_title, - content: tablehtml - }); - - if(window.location.href.indexOf("database") != -1){ - Recycle_bin(6); - $(".re-con-menu p:last-child").addClass("on").siblings().removeClass("on"); - }else{ - Recycle_bin(1); - } - } - $(".re-con-menu p").click(function(){ - $(this).addClass("on").siblings().removeClass("on"); - }) - }); + if (type == "open") { + layer.open({ + type: 1, + shift: 5, + closeBtn: 2, + area: ['80%', '606px'], + title: lan.files.recycle_bin_title, + content: tablehtml + }); + + if (window.location.href.indexOf("database") != -1) { + Recycle_bin(6); + $(".re-con-menu p:last-child").addClass("on").siblings().removeClass("on"); + } else { + Recycle_bin(1); + } + } + $(".re-con-menu p").click(function () { + $(this).addClass("on").siblings().removeClass("on"); + }) + }); } -function getFileName(name){ - var text = name.split("."); - var n = text.length-1; - text = text[n]; - return text; +function getFileName(name) { + var text = name.split("."); + var n = text.length - 1; + text = text[n]; + return text; } -function ReisImage(fileName){ - var exts = ['jpg','jpeg','png','bmp','gif','tiff','ico']; - for(var i=0; i"+lan.files.recycle_bin_close_the+"
      ",{icon:16,time:0,shade: [0.3, '#000']}); - setTimeout(function(){ - getSpeed('.myspeed'); - },1000); - $.post('/files?action=Close_Recycle_bin','',function(rdata){ - layer.close(loadT); - layer.msg(rdata.msg,{icon:rdata.status?1:5}); - $("#RecycleBody").html(''); - }); - }); +function CloseRecycleBin() { + layer.confirm(lan.files.recycle_bin_close_msg, { title: lan.files.recycle_bin_close, closeBtn: 2, icon: 3 }, function () { + var loadT = layer.msg("
      " + lan.files.recycle_bin_close_the + "
      ", { icon: 16, time: 0, shade: [0.3, '#000'] }); + setTimeout(function () { + getSpeed('.myspeed'); + }, 1000); + $.post('/files?action=Close_Recycle_bin', '', function (rdata) { + layer.close(loadT); + layer.msg(rdata.msg, { icon: rdata.status ? 1 : 5 }); + $("#RecycleBody").html(''); + }); + }); } -function Set_Recycle_bin(db){ - var loadT = layer.msg(lan.public.the,{icon:16,time:0,shade: [0.3, '#000']}); - var data = {} - if(db == 1){ - data = {db:db}; - } - $.post('/files?action=Recycle_bin',data,function(rdata){ - layer.close(loadT); - layer.msg(rdata.msg,{icon:rdata.status?1:5}); - }); +function Set_Recycle_bin(db) { + var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] }); + var data = {} + if (db == 1) { + data = { db: db }; + } + $.post('/files?action=Recycle_bin', data, function (rdata) { + layer.close(loadT); + layer.msg(rdata.msg, { icon: rdata.status ? 1 : 5 }); + }); } function get_path_size(path) { @@ -314,19 +314,19 @@ function path_check(path) { return path; } -function GetFiles(Path,sort) { +function GetFiles(Path, sort) { var searchtype = Path; var p = '1'; - if(!isNaN(Path)){ - p = Path; - Path = getCookie('Path'); + if (!isNaN(Path)) { + p = Path; + Path = getCookie('Path'); } Path = path_check(Path); var data = {}; - var search = ''; - var searchV = $("#SearchValue").val(); + var search = ''; + var searchV = $("#SearchValue").val(); if (searchV.length > 0 && searchtype == "1") { data['search'] = searchV; if ($("#search_all")[0].checked) { @@ -355,106 +355,113 @@ function GetFiles(Path,sort) { } - var showRow = getCookie('showRow'); - if(!showRow) showRow = '200'; - var Body = ''; + var showRow = getCookie('showRow'); + if (!showRow) showRow = '200'; + var Body = ''; data['path'] = Path; if (searchV) { var loadT = layer.msg(lan.files.search_now, { icon: 16, time: 0, shade: [0.3, '#000']}); } - var totalSize = 0; - $.post('/files?action=GetDir&tojs=GetFiles&p=' + p + '&showRow=' + showRow + search, data, function(rdata) { + var totalSize = 0; + $.post('/files?action=GetDir&tojs=GetFiles&p=' + p + '&showRow=' + showRow + search, data, function (rdata) { if (searchV) layer.close(loadT); if (rdata.status === false) { layer.msg(rdata.msg, { icon: 2 }); return; } - var rows = ['10','50','100','200','500','1000','2000']; - var rowOption = ''; - for(var i=0;i'+rows[i]+''; - } - - $("#filePage").html(rdata.PAGE); + var rows = ['10', '50', '100', '200', '500', '1000', '2000']; + var rowOption = ''; + for (var i = 0; i < rows.length; i++) { + var rowSelected = ''; + if (showRow == rows[i]) rowSelected = 'selected'; + rowOption += ''; + } + + $("#filePage").html(rdata.PAGE); $("#filePage div").append(""+lan.files.per_page+""+lan.files.piece+""); - $("#filePage .Pcount").css("left","16px"); - if(rdata.DIR == null) rdata.DIR = []; - for (var i = 0; i < rdata.DIR.length; i++) { - var fmp = rdata.DIR[i].split(";"); - var cnametext =fmp[0] + fmp[5]; - fmp[0] = fmp[0].replace(/'/,"\\'"); - if(cnametext.length>20){ - cnametext = cnametext.substring(0,20)+'...' - } - if(isChineseChar(cnametext)){ - if(cnametext.length>10){ - cnametext = cnametext.substring(0,10)+'...' - } - } - var timetext ='--'; - if(getCookie("rank") == "a"){ - $("#set_list").addClass("active"); - $("#set_icon").removeClass("active"); - Body += "\ - \ - " + cnametext + "\ + $("#filePage .Pcount").css("left", "16px"); + if (rdata.DIR == null) rdata.DIR = []; + for (var i = 0; i < rdata.DIR.length; i++) { + var fmp = rdata.DIR[i].split(";"); + var cnametext = fmp[0] + fmp[5]; + fmp[0] = fmp[0].replace(/'/, "\\'"); + if (cnametext.length > 20) { + cnametext = cnametext.substring(0, 20) + '...' + } + if (isChineseChar(cnametext)) { + if (cnametext.length > 10) { + cnametext = cnametext.substring(0, 10) + '...' + } + } + var fileMsg = ''; + if (fmp[0].indexOf('Recycle_bin') != -1) { + fileMsg = 'PS: Recycle Bin directory, Do not operate'; + } + if (fileMsg != '') { + fileMsg = '' + fileMsg + ''; + } + var timetext = '--'; + if (getCookie("rank") == "a") { + $("#set_list").addClass("active"); + $("#set_icon").removeClass("active"); + Body += "\ + \ + " + cnametext + fileMsg + "\ "+lan.files.calc_click+"\ - "+getLocalTime(fmp[2])+"\ - "+fmp[3]+"\ - "+fmp[4]+"\ + "+ getLocalTime(fmp[2]) + "\ + "+ fmp[3] + "\ + "+ fmp[4] + "\ \ - "+lan.files.file_menu_copy+" | \ - "+lan.files.file_menu_mv+" | \ - "+lan.files.file_menu_rename+" | \ - "+lan.files.file_menu_auth+" | \ - "+lan.files.file_menu_zip+" | \ - "+lan.files.file_menu_del+"\ + " + lan.files.file_menu_copy + " | \ + " + lan.files.file_menu_mv + " | \ + " + lan.files.file_menu_rename + " | \ + " + lan.files.file_menu_auth + " | \ + " + lan.files.file_menu_zip + " | \ + " + lan.files.file_menu_del + "\ "; - } - else{ - $("#set_icon").addClass("active"); - $("#set_list").removeClass("active"); - Body += "
' BarTools += shtml; @@ -589,182 +582,182 @@ function GetFiles(Path,sort) { var cutName = getCookie('cutFileName'); var isPaste = (copyName == 'null') ? cutName : copyName; if (isPaste != 'null' && isPaste != undefined) { - BarTools += ' '; + BarTools += ' '; } - $("#Batch").html(''); - var BatchTools = ''; - var isBatch = getCookie('BatchSelected'); - if (isBatch == 1 || isBatch == '1'){ - BatchTools += ' '; - } - $("#Batch").html(BatchTools); - $("#setBox").prop("checked", false); + $("#Batch").html(''); + var BatchTools = ''; + var isBatch = getCookie('BatchSelected'); + if (isBatch == 1 || isBatch == '1') { + BatchTools += ' '; + } + $("#Batch").html(BatchTools); + $("#setBox").prop("checked", false); - $("#BarTools").html(BarTools); + $("#BarTools").html(BarTools); - $("input[name=id]").click(function(){ - if($(this).prop("checked")) { - $(this).prop("checked", true); - $(this).parents("tr").addClass("ui-selected"); - } - else{ - $(this).prop("checked", false); - $(this).parents("tr").removeClass("ui-selected"); - } - showSeclect() + $("input[name=id]").click(function () { + if ($(this).prop("checked")) { + $(this).prop("checked", true); + $(this).parents("tr").addClass("ui-selected"); + } + else { + $(this).prop("checked", false); + $(this).parents("tr").removeClass("ui-selected"); + } + showSeclect() }); - // 鼠标移入移出事件 - $('.file-types').hover(function () { - // 鼠标移入时添加hover类 - $('.dropdown-menu-li').hide(); - $(this).find('.dropdown-menu-li').show(); + // // 鼠标移入移出事件 + // $('.file-types').hover(function () { + // // 鼠标移入时添加hover类 + // $('.dropdown-menu-li').hide(); + // $(this).find('.dropdown-menu-li').show(); - }, function () { - $('.dropdown-menu-li').hide(); - // 鼠标移出时移出hover类 + // }, function () { + // $('.dropdown-menu-li').hide(); + // // 鼠标移出时移出hover类 + // }); + + $("#setBox").click(function () { + if ($(this).prop("checked")) { + $("input[name=id]").prop("checked", true); + $("#filesBody > tr").addClass("ui-selected"); + + } else { + $("input[name=id]").prop("checked", false); + $("#filesBody > tr").removeClass("ui-selected"); + } + showSeclect(); }); - $("#setBox").click(function() { - if ($(this).prop("checked")) { - $("input[name=id]").prop("checked", true); - $("#filesBody > tr").addClass("ui-selected"); - - } else { - $("input[name=id]").prop("checked", false); - $("#filesBody > tr").removeClass("ui-selected"); - } - showSeclect(); + $("#filesBody .btlink").click(function (e) { + e.stopPropagation(); }); - - $("#filesBody .btlink").click(function(e){ - e.stopPropagation(); - }); - $("input[name=id]").dblclick(function(e){ - e.stopPropagation(); - }); - $("#filesBody").bind("contextmenu",function(e){ - return false; - }); - bindselect(); - $("#filesBody").mousedown(function(e){ - var count = totalFile(); - if(e.which == 3) { - if(count>1){ - RClickAll(e); - } - else{ - return - } - } - }); - $(".folderBox,.folderBoxTr").mousedown(function(e){ - var count = totalFile(); - if(e.which == 3) { - if(count <= 1){ - var a = $(this); - a.contextify(RClick(a.attr("filetype"),a.attr("data-path"),a.find("input").val(),rdata)); - } - else{ - RClickAll(e); - } - } - }); - $(".showRow").change(function(){ - setCookie('showRow',$(this).val()); - GetFiles(p); - }); - PathPlaceBtn(rdata.PATH); - auto_table_width(); - }); -} -function auto_table_width(){ - var oldTable = $(window).height() - $('#tipTools')[0].getBoundingClientRect().height - $('#filePage')[0].getBoundingClientRect().height - $('.footer')[0].getBoundingClientRect().height - 111; - var oldTable_heigth = $('.oldTable table').height(); - $('.oldTable thead th').each(function(index,el){ - var table_th = $('.oldTable thead th').length; - $('.newTable thead th').eq(index).attr('width',el.offsetWidth); - if(index == (table_th - 1)) $('.newTable thead th').eq(table_th).attr('width','10').css('padding','0'); + $("input[name=id]").dblclick(function (e) { + e.stopPropagation(); + }); + $("#filesBody").bind("contextmenu", function (e) { + return false; + }); + bindselect(); + $("#filesBody").mousedown(function (e) { + var count = totalFile(); + if (e.which == 3) { + if (count > 1) { + RClickAll(e); + } + else { + return + } + } + }); + $(".folderBox,.folderBoxTr").mousedown(function (e) { + var count = totalFile(); + if (e.which == 3) { + if (count <= 1) { + var a = $(this); + a.contextify(RClick(a.attr("filetype"), a.attr("data-path"), a.find("input").val(), rdata)); + } + else { + RClickAll(e); + } + } + }); + $(".showRow").change(function () { + setCookie('showRow', $(this).val()); + GetFiles(p); + }); + PathPlaceBtn(rdata.PATH); + auto_table_width(); }); - if(oldTable_heigth > oldTable){ - $('.oldTableShadow,.newTableShadow').show(); - $('.oldTable').css('marginTop','0') - }else{ - $('.oldTableShadow,.newTableShadow').hide(); - $('.oldTable').css('marginTop','0') - } - $('.oldTable').height(oldTable); +} +function auto_table_width() { + var oldTable = $(window).height() - $('#tipTools')[0].getBoundingClientRect().height - $('#filePage')[0].getBoundingClientRect().height - $('.footer')[0].getBoundingClientRect().height - 111; + var oldTable_heigth = $('.oldTable table').height(); + $('.oldTable thead th').each(function (index, el) { + var table_th = $('.oldTable thead th').length; + $('.newTable thead th').eq(index).attr('width', el.offsetWidth); + if (index == (table_th - 1)) $('.newTable thead th').eq(table_th).attr('width', '10').css('padding', '0'); + }); + if (oldTable_heigth > oldTable) { + $('.oldTableShadow,.newTableShadow').show(); + $('.oldTable').css('marginTop', '0') + } else { + $('.oldTableShadow,.newTableShadow').hide(); + $('.oldTable').css('marginTop', '0') + } + $('.oldTable').height(oldTable); $('.oldTable table').css({ 'marginTop': '-36px' }) } -function totalFile(){ - var el = $("input[name='id']"); - var len = el.length; - var count = 0; - for(var i=0;i 1){ - BatchTools = '\ - \ - \ - \ - ' - $("#Batch").html(BatchTools); - }else{ - $("#Batch").html(BatchTools); - } +function showSeclect() { + var count = totalFile(); + var BatchTools = ''; + if (count > 1) { + BatchTools = '\ + \ + \ + \ + ' + $("#Batch").html(BatchTools); + } else { + $("#Batch").html(BatchTools); + } } -$("#tipTools").width($(".file-box")[0].clientWidth); +$("#tipTools").width($(".file-box")[0].clientWidth-30); $("#PathPlaceBtn").width($(".file-box").width() - 700); $("#DirPathPlace input").width($(".file-box").width() - 700); if ($(window).width() < 1160) { $("#PathPlaceBtn").width(290); } window.onresize = function () { - $("#tipTools").width($(".file-box")[0].clientWidth); + $("#tipTools").width($(".file-box")[0].clientWidth-30); $("#PathPlaceBtn").width($(".file-box").width() - 700); $("#DirPathPlace input").width($(".file-box").width() - 700); if ($(window).width() < 1160) { @@ -774,31 +767,31 @@ window.onresize = function () { IsDiskWidth() auto_table_width(); } -function Batch(type,access){ - var path = $("#DirPathPlace input").val(); - var el = document.getElementsByTagName('input'); - var len = el.length; - var data='path='+path+'&type='+type; +function Batch(type, access) { + var path = $("#DirPathPlace input").val(); + var el = document.getElementsByTagName('input'); + var len = el.length; + var data = 'path=' + path + '&type=' + type; var name = 'data'; var datas = [] - var oldType = getCookie('BatchPaste'); + var oldType = getCookie('BatchPaste'); - for(var i=0;i"+lan.public.the+"",{icon:16,time:0,shade: [0.3, '#000']}); - setTimeout(function(){getSpeed('.myspeed');},1000); - $.post('/files?action=SetBatchData',data,function(rdata){ - layer.close(myloadT); - GetFiles(path); - layer.msg(rdata.msg,{icon:1}); - }); + myloadT = layer.msg("
" + lan.public.the + "
", { icon: 16, time: 0, shade: [0.3, '#000'] }); + setTimeout(function () { getSpeed('.myspeed'); }, 1000); + $.post('/files?action=SetBatchData', data, function (rdata) { + layer.close(myloadT); + GetFiles(path); + layer.msg(rdata.msg, { icon: 1 }); + }); } -function BatchPaste(){ - var path = $("#DirPathPlace input").val(); - var type = getCookie('BatchPaste'); - var data = 'type='+type+'&path='+path; +function BatchPaste() { + var path = $("#DirPathPlace input").val(); + var type = getCookie('BatchPaste'); + var data = 'type=' + type + '&path=' + path; - $.post('/files?action=CheckExistsFiles',{dfile:path},function(result){ - if(result.length > 0){ - var tbody = ''; - for(var i=0;i'+ToSize(result[i].size)+''+getLocalTime(result[i].mtime)+''; - } - var mbody = '
\ + $.post('/files?action=CheckExistsFiles', { dfile: path }, function (result) { + if (result.length > 0) { + var tbody = ''; + for (var i = 0; i < result.length; i++) { + tbody += ''; + } + var mbody = '
'+lan.files.file_name+''+lan.files.file_size+''+lan.files.last_edit_time+'
' + result[i].filename + '' + ToSize(result[i].size) + '' + getLocalTime(result[i].mtime) + '
\ '+tbody+'\
'+lan.files.file_name+''+lan.files.file_size+''+lan.files.last_edit_time+'
'; SafeMessage(lan.files.will_cover_this_file,mbody,function(){ - BatchPasteTo(data,path); - }); - $(".layui-layer-page").css("width","500px"); - }else{ - BatchPasteTo(data,path); - } - }); + BatchPasteTo(data, path); + }); + $(".layui-layer-page").css("width", "500px"); + } else { + BatchPasteTo(data, path); + } + }); } -function BatchPasteTo(data,path){ - myloadT = layer.msg("
"+lan.public.the+"
",{icon:16,time:0,shade: [0.3, '#000']}); - setTimeout(function(){getSpeed('.myspeed');},1000); - $.post('files?action=BatchPaste',data,function(rdata){ - layer.close(myloadT); - setCookie('BatchSelected', null); - GetFiles(path); - layer.msg(rdata.msg,{icon:1}); - }); +function BatchPasteTo(data, path) { + myloadT = layer.msg("
" + lan.public.the + "
", { icon: 16, time: 0, shade: [0.3, '#000'] }); + setTimeout(function () { getSpeed('.myspeed'); }, 1000); + $.post('files?action=BatchPaste', data, function (rdata) { + layer.close(myloadT); + setCookie('BatchSelected', null); + GetFiles(path); + layer.msg(rdata.msg, { icon: 1 }); + }); } -function GetExtName(fileName){ - var extArr = fileName.split("."); - var exts = ['folder','folder-unempty','sql','c','cpp','cs','flv','css','js','htm','html','java','log','mht','php','url','xml','ai','bmp','cdr','gif','ico','jpeg','jpg','JPG','png','psd','webp','ape','avi','flv','mkv','mov','mp3','mp4','mpeg','mpg','rm','rmvb','swf','wav','webm','wma','wmv','rtf','docx','fdf','potm','pptx','txt','xlsb','xlsx','7z','cab','iso','bz2','rar','zip','gz','bt','file','apk','bookfolder','folder','folder-empty','folder-unempty','fromchromefolder','documentfolder','fromphonefolder','mix','musicfolder','picturefolder','videofolder','sefolder','access','mdb','accdb','sql','c','cpp','cs','js','fla','flv','htm','html','java','log','mht','php','url','xml','ai','bmp','cdr','gif','ico','jpeg','jpg','JPG','png','psd','webp','ape','avi','flv','mkv','mov','mp3','mp4','mpeg','mpg','rm','rmvb','swf','wav','webm','wma','wmv','doc','docm','dotx','dotm','dot','rtf','docx','pdf','fdf','ppt','pptm','pot','potm','pptx','txt','xls','csv','xlsm','xlsb','xlsx','7z','gz','cab','iso','rar','zip','bt','file','apk','css']; - var extLastName = extArr[extArr.length - 1]; - for(var i=0; i tr").hover(function(){ - $(this).addClass("hover"); - },function(){ - $(this).removeClass("hover"); - }).click(function(){ - $(this).addClass("on").siblings().removeClass("on"); - }) +function ShowEditMenu() { + $("#filesBody > tr").hover(function () { + $(this).addClass("hover"); + }, function () { + $(this).removeClass("hover"); + }).click(function () { + $(this).addClass("on").siblings().removeClass("on"); + }) } function GetFileName(fileNameFull) { - var pName = fileNameFull.split('/'); - return pName[pName.length - 1]; + var pName = fileNameFull.split('/'); + return pName[pName.length - 1]; } function GetDisk() { - var LBody = ''; - $.get('/system?action=GetDiskInfo', function(rdata) { - for (var i = 0; i < rdata.length; i++) { - LBody += " " + (rdata[i].path=='/'?lan.files.path_root:rdata[i].path) + "(" + rdata[i].size[2] + ")"; - } - var trash = ' '+lan.files.recycle_bin_title+''; - $("#comlist").html(LBody+trash); - IsDiskWidth(); - }); + var LBody = ''; + $.get('/system?action=GetDiskInfo', function (rdata) { + for (var i = 0; i < rdata.length; i++) { + LBody += " " + (rdata[i].path == '/' ? lan.files.path_root : rdata[i].path) + "(" + rdata[i].size[2] + ")"; + } + var trash = ' ' + lan.files.recycle_bin_title + ''; + $("#comlist").html(LBody + trash); + IsDiskWidth(); + }); } function BackDir() { - var str = $("#DirPathPlace input").val().replace('//','/'); - if(str.substr(str.length-1,1) == '/'){ - str = str.substr(0,str.length-1); - } - var Path = str.split("/"); - var back = '/'; - if (Path.length > 2) { - var count = Path.length - 1; - for (var i = 0; i < count; i++) { - back += Path[i] + '/'; - } - if(back.substr(back.length-1,1) == '/'){ - back = back.substr(0,back.length-1); - } - GetFiles(back); - } else { - back += Path[0]; - GetFiles(back); - } - setTimeout('PathPlaceBtn(getCookie("Path"));',200); + var str = $("#DirPathPlace input").val().replace('//', '/'); + if (str.substr(str.length - 1, 1) == '/') { + str = str.substr(0, str.length - 1); + } + var Path = str.split("/"); + var back = '/'; + if (Path.length > 2) { + var count = Path.length - 1; + for (var i = 0; i < count; i++) { + back += Path[i] + '/'; + } + if (back.substr(back.length - 1, 1) == '/') { + back = back.substr(0, back.length - 1); + } + GetFiles(back); + } else { + back += Path[0]; + GetFiles(back); + } + setTimeout('PathPlaceBtn(getCookie("Path"));', 200); } function CreateFile(type, path) { - if (type == 1) { - var fileName = $("#newFileName").val(); - layer.msg(lan.public.the, { icon: 16, time: 10000 }); - $.post('/files?action=CreateFile', 'path=' + encodeURIComponent(path + '/' + fileName), function(rdata) { - layer.close(getCookie('layers')); - layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2}); - if(rdata.status){ - GetFiles($("#DirPathPlace input").val()); - openEditorView(0,path + '/' + fileName); - } - }); - return; - } - var layers = layer.open({ - type: 1, - shift: 5, - closeBtn: 2, - area: '320px', - title: lan.files.new_empty_file, - content: '
\ + if (type == 1) { + var fileName = $("#newFileName").val(); + layer.msg(lan.public.the, { icon: 16, time: 10000 }); + $.post('/files?action=CreateFile', 'path=' + encodeURIComponent(path + '/' + fileName), function (rdata) { + layer.close(getCookie('layers')); + layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); + if (rdata.status) { + GetFiles($("#DirPathPlace input").val()); + openEditorView(0, path + '/' + fileName); + } + }); + return; + } + var layers = layer.open({ + type: 1, + shift: 5, + closeBtn: 2, + area: '320px', + title: lan.files.new_empty_file, + content: '
\
\ - \ + \
\
\ - \ - \ + \ + \
\
', - success:function(layers,index){ - $('.layer_close').click(function(){ - layer.close(index); - }); - } - }); - setCookie('layers',layers); - $("#newFileName").focus().keyup(function(e){ - if(e.keyCode == 13) $("#CreateFileBtn").click(); - }); + success: function (layers, index) { + $('.layer_close').click(function () { + layer.close(index); + }); + } + }); + setCookie('layers', layers); + $("#newFileName").focus().keyup(function (e) { + if (e.keyCode == 13) $("#CreateFileBtn").click(); + }); } function CreateDir(type, path) { - if (type == 1) { - var dirName = $("#newDirName").val(); - layer.msg(lan.public.the, { - icon: 16, - time: 10000 - }); - $.post('/files?action=CreateDir', 'path=' + encodeURIComponent(path + '/' + dirName), function(rdata) { - layer.close(getCookie('layers')); - layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); - GetFiles($("#DirPathPlace input").val()); - }); - return; - } - var layers = layer.open({ - type: 1, - shift: 5, - closeBtn: 2, - area: '320px', - title: lan.files.new_dir, - content: '
\ + if (type == 1) { + var dirName = $("#newDirName").val(); + layer.msg(lan.public.the, { + icon: 16, + time: 10000 + }); + $.post('/files?action=CreateDir', 'path=' + encodeURIComponent(path + '/' + dirName), function (rdata) { + layer.close(getCookie('layers')); + layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); + GetFiles($("#DirPathPlace input").val()); + }); + return; + } + var layers = layer.open({ + type: 1, + shift: 5, + closeBtn: 2, + area: '320px', + title: lan.files.new_dir, + content: '
\
\ - \ + \
\
\ - \ - \ + \ + \
\
', - success:function(layers,index){ - $('.layer_close').click(function(){ - layer.close(index); - }); - } - }); - setCookie('layers',layers); - $("#newDirName").focus().keyup(function(e){ - if(e.keyCode == 13) $("#CreateDirBtn").click(); - }); + success: function (layers, index) { + $('.layer_close').click(function () { + layer.close(index); + }); + } + }); + setCookie('layers', layers); + $("#newDirName").focus().keyup(function (e) { + if (e.keyCode == 13) $("#CreateDirBtn").click(); + }); } // 删除文件 -function DeleteFile(fileName){ - layer.confirm(lan.get('recycle_bin_confirm',[fileName]),{title:lan.files.del_file,closeBtn:2,icon:3},function(index){ - layer.msg(lan.public.the,{icon:16,time:0,shade: [0.3, '#000']}); - $.post('/files?action=DeleteFile', 'path=' + encodeURIComponent(fileName), function(rdata) { - layer.close(index); - layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); - GetFiles($("#DirPathPlace input").val()); - }); - }); +function DeleteFile(fileName) { + layer.confirm(lan.get('recycle_bin_confirm', [fileName]), { title: lan.files.del_file, closeBtn: 2, icon: 3 }, function (index) { + layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] }); + $.post('/files?action=DeleteFile', 'path=' + encodeURIComponent(fileName), function (rdata) { + layer.close(index); + layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); + GetFiles($("#DirPathPlace input").val()); + }); + }); } -function DeleteDir(dirName){ - layer.confirm(lan.get('recycle_bin_confirm_dir',[dirName]),{title:lan.files.del_dir,closeBtn:2,icon:3},function(index){ - layer.msg(lan.public.the,{icon:16,time:0,shade: [0.3, '#000']}); - $.post('/files?action=DeleteDir', 'path=' + encodeURIComponent(dirName), function(rdata) { - layer.close(index); - layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); - GetFiles($("#DirPathPlace input").val()); - }); - }); +function DeleteDir(dirName) { + layer.confirm(lan.get('recycle_bin_confirm_dir', [dirName]), { title: lan.files.del_dir, closeBtn: 2, icon: 3 }, function (index) { + layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] }); + $.post('/files?action=DeleteDir', 'path=' + encodeURIComponent(dirName), function (rdata) { + layer.close(index); + layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); + GetFiles($("#DirPathPlace input").val()); + }); + }); } -function AllDeleteFileSub(data,path){ - layer.confirm(lan.files.del_all_msg,{title:lan.files.del_all_file,closeBtn:2,icon:3},function(index){ - layer.msg("
"+lan.public.the+"
",{icon:16,time:0,shade: [0.3, '#000']}); - setTimeout(function(){getSpeed('.myspeed');},1000); - $.post('files?action=SetBatchData',data,function(rdata){ - layer.close(index); - GetFiles(path); - layer.msg(rdata.msg,{icon:1}); - }); - }); +function AllDeleteFileSub(data, path) { + layer.confirm(lan.files.del_all_msg, { title: lan.files.del_all_file, closeBtn: 2, icon: 3 }, function (index) { + layer.msg("
" + lan.public.the + "
", { icon: 16, time: 0, shade: [0.3, '#000'] }); + setTimeout(function () { getSpeed('.myspeed'); }, 1000); + $.post('files?action=SetBatchData', data, function (rdata) { + layer.close(index); + GetFiles(path); + layer.msg(rdata.msg, { icon: 1 }); + }); + }); } -function ReloadFiles(){ - setInterval(function(){ - var path = $("#DirPathPlace input").val(); - GetFiles(path); - },3000); +function ReloadFiles() { + setInterval(function () { + var path = $("#DirPathPlace input").val(); + GetFiles(path); + }, 3000); } -function DownloadFile(action){ - if(action == 1){ - var fUrl = $("#mUrl").val(); - fUrl = encodeURIComponent(fUrl); - fpath = $("#dpath").val(); +function DownloadFile(action) { + if (action == 1) { + var fUrl = $("#mUrl").val(); + fUrl = encodeURIComponent(fUrl); + fpath = $("#dpath").val(); fname = encodeURIComponent($("#dfilename").val()); if (!fname) { durl = $("#mUrl").val() @@ -1057,377 +1050,377 @@ function DownloadFile(action){ return; } } - layer.close(getCookie('layers')) - layer.msg(lan.files.down_task,{time:0,icon:16,shade: [0.3, '#000']}); - $.post('/files?action=DownloadFile','path='+fpath+'&url='+fUrl+'&filename='+fname,function(rdata){ - layer.msg(rdata.msg,{icon:rdata.status?1:2}); - GetFiles(fpath); + layer.close(getCookie('layers')) + layer.msg(lan.files.down_task, { time: 0, icon: 16, shade: [0.3, '#000'] }); + $.post('/files?action=DownloadFile', 'path=' + fpath + '&url=' + fUrl + '&filename=' + fname, function (rdata) { + layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); + GetFiles(fpath); GetTaskCount(); task_stat(); - }); - return; - } - var path = $("#DirPathPlace input").val(); - var layers = layer.open({ - type: 1, - shift: 5, - closeBtn: 2, - area: '500px', - title: lan.files.down_title, - content: '
\ + }); + return; + } + var path = $("#DirPathPlace input").val(); + var layers = layer.open({ + type: 1, + shift: 5, + closeBtn: 2, + area: '500px', + title: lan.files.down_title, + content: '\
\ - '+lan.files.down_url+':\ + '+ lan.files.down_url + ':\
\
\ - '+lan.files.down_to+':\ + '+ lan.files.down_to + ':\
\
\ - '+lan.files.file_name+':\ + '+ lan.files.file_name + ':\
\
\ - \ - \ + \ + \
\
', - success:function(layers,index){ - $('.layer_close').click(function(){ - layer.close(index) - }); - } - }); - setCookie('layers',layers); + success: function (layers, index) { + $('.layer_close').click(function () { + layer.close(index) + }); + } + }); + setCookie('layers', layers); //fly("dlok"); $("#mUrl").change(function () { - durl = $(this).val() - tmp = durl.split('/') - $("#dfilename").val(tmp[tmp.length-1]) + durl = $(this).val() + tmp = durl.split('/') + $("#dfilename").val(tmp[tmp.length - 1]) }); } -function ExecShell(action){ - if(action == 1){ - var path = $("#DirPathPlace input").val(); - var exec = encodeURIComponent($("#mExec").val()); - $.post('/files?action=ExecShell','path='+path+'&shell='+exec,function(rdata){ - if(rdata.status){ - $("#mExec").val(''); - GetShellEcho(); - } - else{ - layer.msg(rdata.msg,{icon:rdata.status?1:2}); - } +function ExecShell(action) { + if (action == 1) { + var path = $("#DirPathPlace input").val(); + var exec = encodeURIComponent($("#mExec").val()); + $.post('/files?action=ExecShell', 'path=' + path + '&shell=' + exec, function (rdata) { + if (rdata.status) { + $("#mExec").val(''); + GetShellEcho(); + } + else { + layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); + } - }); - return; - } - layer.open({ - type: 1, - shift: 5, - closeBtn: 2, - area: ['70%','600px'], - title: lan.files.shell_title, - content: '
\ + }); + return; + } + layer.open({ + type: 1, + shift: 5, + closeBtn: 2, + area: ['70%', '600px'], + title: lan.files.shell_title, + content: '
\
\
\ - '+lan.files.shell_go+'\ + ' + lan.files.shell_go + '\
\
' - }); - setTimeout(function(){ - outTimeGet(); - },1000); + }); + setTimeout(function () { + outTimeGet(); + }, 1000); } var outTime = null; -function outTimeGet(){ - outTime = setInterval(function(){ - if(!$("#mExec").attr('name')){ - clearInterval(outTime); - return; - } - GetShellEcho(); - },1000); +function outTimeGet() { + outTime = setInterval(function () { + if (!$("#mExec").attr('name')) { + clearInterval(outTime); + return; + } + GetShellEcho(); + }, 1000); } -function GetShellEcho(){ - $.post('/files?action=GetExecShellMsg','',function(rdata){ - $("#Result").html(rdata); - $(".shellcode").scrollTop($(".shellcode")[0].scrollHeight); - }); +function GetShellEcho() { + $.post('/files?action=GetExecShellMsg', '', function (rdata) { + $("#Result").html(rdata); + $(".shellcode").scrollTop($(".shellcode")[0].scrollHeight); + }); } function ReName(type, fileName) { - if (type == 1) { - var path = $("#DirPathPlace input").val(); - var newFileName = encodeURIComponent(path + '/' + $("#newFileName").val()); - var oldFileName = encodeURIComponent(path + '/' + fileName); - layer.msg(lan.public.the, {icon: 16,time: 10000}); - $.post('/files?action=MvFile', 'sfile=' + oldFileName + '&dfile=' + newFileName + '&rename=true', function(rdata) { - layer.close(getCookie('layers')); - layer.msg(rdata.msg, {icon: rdata.status ? 1 : 2}); - GetFiles(path); - }); - return; - } - var layers = layer.open({ - type: 1, - shift: 5, - closeBtn: 2, - area: '320px', - title: lan.files.file_menu_rename, - content: '
\ + if (type == 1) { + var path = $("#DirPathPlace input").val(); + var newFileName = encodeURIComponent(path + '/' + $("#newFileName").val()); + var oldFileName = encodeURIComponent(path + '/' + fileName); + layer.msg(lan.public.the, { icon: 16, time: 10000 }); + $.post('/files?action=MvFile', 'sfile=' + oldFileName + '&dfile=' + newFileName + '&rename=true', function (rdata) { + layer.close(getCookie('layers')); + layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); + GetFiles(path); + }); + return; + } + var layers = layer.open({ + type: 1, + shift: 5, + closeBtn: 2, + area: '320px', + title: lan.files.file_menu_rename, + content: '
\
\ - \ + \
\
\ - \ - \ + \ + \
\
', - success:function (layers,index){ - $('.layers_close').click(function(){ - layer.close(index); - }); - } - }); - setCookie('layers',layers); - $("#newFileName").focus().keyup(function(e){ - if(e.keyCode == 13) $("#ReNameBtn").click(); - }); + success: function (layers, index) { + $('.layers_close').click(function () { + layer.close(index); + }); + } + }); + setCookie('layers', layers); + $("#newFileName").focus().keyup(function (e) { + if (e.keyCode == 13) $("#ReNameBtn").click(); + }); } function CutFile(fileName) { - var path = $("#DirPathPlace input").val(); - setCookie('cutFileName', fileName); - setCookie('copyFileName', null); - layer.msg(lan.files.mv_ok, {icon: 1,time: 1000}); - GetFiles(path); + var path = $("#DirPathPlace input").val(); + setCookie('cutFileName', fileName); + setCookie('copyFileName', null); + layer.msg(lan.files.mv_ok, { icon: 1, time: 1000 }); + GetFiles(path); } function CopyFile(fileName) { - var path = $("#DirPathPlace input").val(); - setCookie('copyFileName', fileName); - setCookie('cutFileName', null); - layer.msg(lan.files.copy_ok, {icon: 1,time: 1000}); - GetFiles(path); + var path = $("#DirPathPlace input").val(); + setCookie('copyFileName', fileName); + setCookie('cutFileName', null); + layer.msg(lan.files.copy_ok, { icon: 1, time: 1000 }); + GetFiles(path); } function PasteFile(fileName) { - var path = $("#DirPathPlace input").val(); - var copyName = getCookie('copyFileName'); - var cutName = getCookie('cutFileName'); - var filename = copyName; - if(cutName != 'null' && cutName != undefined) filename=cutName; - filename = filename.split('/').pop(); - $.post('/files?action=CheckExistsFiles',{dfile:path,filename:filename},function(result){ - if(result.length > 0){ - var tbody = ''; - for(var i=0;i'+ToSize(result[i].size)+''+getLocalTime(result[i].mtime)+''; - } + var path = $("#DirPathPlace input").val(); + var copyName = getCookie('copyFileName'); + var cutName = getCookie('cutFileName'); + var filename = copyName; + if (cutName != 'null' && cutName != undefined) filename = cutName; + filename = filename.split('/').pop(); + $.post('/files?action=CheckExistsFiles', { dfile: path, filename: filename }, function (result) { + if (result.length > 0) { + var tbody = ''; + for (var i = 0; i < result.length; i++) { + tbody += '' + result[i].filename + '' + ToSize(result[i].size) + '' + getLocalTime(result[i].mtime) + ''; + } var mbody = '
\ '+tbody+'\
'+lan.files.file_name+''+lan.files.file_size+''+lan.files.last_edit_time+'
'; SafeMessage(lan.files.will_cover_this_file,mbody,function(){ - PasteTo(path,copyName,cutName,fileName); - }); - }else{ - PasteTo(path,copyName,cutName,fileName); - } - }); + PasteTo(path, copyName, cutName, fileName); + }); + } else { + PasteTo(path, copyName, cutName, fileName); + } + }); } -function PasteTo(path,copyName,cutName,fileName){ - if (copyName != 'null' && copyName != undefined) { - layer.msg(lan.files.copy_the, { - icon: 16, - time: 0,shade: [0.3, '#000'] - }); - $.post('/files?action=CopyFile', 'sfile=' + encodeURIComponent(copyName) + '&dfile=' + encodeURIComponent(path +'/'+ fileName), function(rdata) { - layer.closeAll(); - layer.msg(rdata.msg, { - icon: rdata.status ? 1 : 2 - }); - GetFiles(path); - }); - setCookie('copyFileName', null); - setCookie('cutFileName', null); - return; - } +function PasteTo(path, copyName, cutName, fileName) { + if (copyName != 'null' && copyName != undefined) { + layer.msg(lan.files.copy_the, { + icon: 16, + time: 0, shade: [0.3, '#000'] + }); + $.post('/files?action=CopyFile', 'sfile=' + encodeURIComponent(copyName) + '&dfile=' + encodeURIComponent(path + '/' + fileName), function (rdata) { + layer.closeAll(); + layer.msg(rdata.msg, { + icon: rdata.status ? 1 : 2 + }); + GetFiles(path); + }); + setCookie('copyFileName', null); + setCookie('cutFileName', null); + return; + } - if (cutName != 'null' && cutName != undefined) { - layer.msg(lan.files.mv_the, { - icon: 16, - time: 0,shade: [0.3, '#000'] - }); - $.post('/files?action=MvFile', 'sfile=' + encodeURIComponent(cutName) + '&dfile=' + encodeURIComponent(path + '/'+fileName), function(rdata) { - layer.closeAll(); - layer.msg(rdata.msg, { - icon: rdata.status ? 1 : 2 - }); - GetFiles(path); - }); - setCookie('copyFileName', null); - setCookie('cutFileName', null); - } + if (cutName != 'null' && cutName != undefined) { + layer.msg(lan.files.mv_the, { + icon: 16, + time: 0, shade: [0.3, '#000'] + }); + $.post('/files?action=MvFile', 'sfile=' + encodeURIComponent(cutName) + '&dfile=' + encodeURIComponent(path + '/' + fileName), function (rdata) { + layer.closeAll(); + layer.msg(rdata.msg, { + icon: rdata.status ? 1 : 2 + }); + GetFiles(path); + }); + setCookie('copyFileName', null); + setCookie('cutFileName', null); + } } // 压缩文件 -function Zip(dirName,submits) { - var path = $("#DirPathPlace input").val(); - if(submits != undefined){ - if(dirName.indexOf(',') == -1){ - tmp = $("#sfile").val().split('/'); - sfile = encodeURIComponent(tmp[tmp.length-1]); - }else{ - sfile = encodeURIComponent(dirName); - } +function Zip(dirName, submits) { + var path = $("#DirPathPlace input").val(); + if (submits != undefined) { + if (dirName.indexOf(',') == -1) { + tmp = $("#sfile").val().split('/'); + sfile = encodeURIComponent(tmp[tmp.length - 1]); + } else { + sfile = encodeURIComponent(dirName); + } dfile = encodeURIComponent($("#dfile").val()); var z_type = $("select[name='z_type']").val(); if (!z_type) z_type = 'tar.gz'; - layer.close(getCookie('layers')); - var layers = layer.msg(lan.files.zip_the, {icon: 16,time: 0,shade: [0.3, '#000']}); - $.post('/files?action=Zip', 'sfile=' + sfile + '&dfile=' + dfile + '&z_type='+z_type+'&path='+encodeURIComponent(path), function(rdata) { - layer.close(layers); - if(rdata == null || rdata == undefined){ - layer.msg(lan.files.zip_ok,{icon:1}); - GetFiles(path) - ReloadFiles(); - return; - } - layer.msg(rdata.msg, {icon: rdata.status ? 1 : 2}); + layer.close(getCookie('layers')); + var layers = layer.msg(lan.files.zip_the, { icon: 16, time: 0, shade: [0.3, '#000'] }); + $.post('/files?action=Zip', 'sfile=' + sfile + '&dfile=' + dfile + '&z_type=' + z_type + '&path=' + encodeURIComponent(path), function (rdata) { + layer.close(layers); + if (rdata == null || rdata == undefined) { + layer.msg(lan.files.zip_ok, { icon: 1 }); + GetFiles(path) + ReloadFiles(); + return; + } + layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); if (rdata.status) { task_stat() GetFiles(path); } - }); - return - } + }); + return + } - param = dirName; - if(dirName.indexOf(',') != -1){ - tmp = path.split('/') - dirName = path + '/' + tmp[tmp.length-1] - } + param = dirName; + if (dirName.indexOf(',') != -1) { + tmp = path.split('/') + dirName = path + '/' + tmp[tmp.length - 1] + } - var layers = layer.open({ - type: 1, - shift: 5, - closeBtn: 2, - area: '650px', - title: lan.files.zip_title, - content: '
' - +'
' - + '' - + '

'+lan.files.comp_type+'

' - +''+lan.files.zip_to+'' - + '
' - +'
' - +'' - +'' - +'
' - +'
', - success:function(layers,index){ - $('.layer_close').click(function(){ - layer.close(index); - }); - } - }); - setCookie('layers',layers); - setTimeout(function (){ - $("select[name='z_type']").change(function(){ + var layers = layer.open({ + type: 1, + shift: 5, + closeBtn: 2, + area: '650px', + title: lan.files.zip_title, + content: '
' + + '
' + + '' + + '

'+lan.files.comp_type+'

' + + '' + lan.files.zip_to + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
', + success: function (layers, index) { + $('.layer_close').click(function () { + layer.close(index); + }); + } + }); + setCookie('layers', layers); + setTimeout(function () { + $("select[name='z_type']").change(function () { var z_type = $(this).val(); dirName = dirName.replace("tar.gz", z_type) $("#dfile").val(dirName + '.' + z_type); - }); - },100); + }); + }, 100); } -function UnZip(fileName,type) { - var path = $("#DirPathPlace input").val(); - if(type.length ==3){ - var sfile = encodeURIComponent($("#sfile").val()); - var dfile = encodeURIComponent($("#dfile").val()); - var password = encodeURIComponent($("#unpass").val()); - coding = $("select[name='coding']").val(); - layer.close(getCookie('layers')); - layer.msg(lan.files.unzip_the, {icon: 16,time: 0,shade: [0.3, '#000']}); - $.post('/files?action=UnZip', 'sfile=' + sfile + '&dfile=' + dfile +'&type=' + type + '&coding=' + coding + '&password=' + password, function(rdata) { +function UnZip(fileName, type) { + var path = $("#DirPathPlace input").val(); + if (type.length == 3) { + var sfile = encodeURIComponent($("#sfile").val()); + var dfile = encodeURIComponent($("#dfile").val()); + var password = encodeURIComponent($("#unpass").val()); + coding = $("select[name='coding']").val(); + layer.close(getCookie('layers')); + layer.msg(lan.files.unzip_the, { icon: 16, time: 0, shade: [0.3, '#000'] }); + $.post('/files?action=UnZip', 'sfile=' + sfile + '&dfile=' + dfile + '&type=' + type + '&coding=' + coding + '&password=' + password, function (rdata) { layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); task_stat(); - GetFiles(path); - }); - return - } + GetFiles(path); + }); + return + } - type = (type == 1) ? 'tar':'zip' - var umpass = ''; - if(type == 'zip'){ - umpass = '
'+lan.files.zip_pass_title+'
' - } - var layers = layer.open({ - type: 1, - shift: 5, - closeBtn: 2, - area: '490px', - title: lan.files.unzip_title, - content: '
' - +'
' - +''+lan.files.unzip_name+'
' - +'
'+lan.files.unzip_to+'
' + umpass - +'
'+lan.files.unzip_coding+'' - +'
' - +'
' - +'' - +'' - +'
' - +'
', - success:function(layers,index){ - $('.layer_close').click(function(){ - layer.close(index); - }); - } - }); - setCookie('layers',layers); + type = (type == 1) ? 'tar' : 'zip' + var umpass = ''; + if (type == 'zip') { + umpass = '
' + lan.files.zip_pass_title + '
' + } + var layers = layer.open({ + type: 1, + shift: 5, + closeBtn: 2, + area: '490px', + title: lan.files.unzip_title, + content: '
' + + '
' + + '' + lan.files.unzip_name + '
' + + '
' + lan.files.unzip_to + '
' + umpass + + '
' + lan.files.unzip_coding + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
', + success: function (layers, index) { + $('.layer_close').click(function () { + layer.close(index); + }); + } + }); + setCookie('layers', layers); } -function isZip(fileName){ - var ext = fileName.split('.'); - var extName = ext[ext.length-1].toLowerCase(); +function isZip(fileName) { + var ext = fileName.split('.'); + var extName = ext[ext.length - 1].toLowerCase(); if (extName == 'zip' || extName == 'war' || extName == 'rar') return 0; - if( extName == 'gz' || extName == 'tgz' || extName == 'bz2') return 1; - return -1; + if (extName == 'gz' || extName == 'tgz' || extName == 'bz2') return 1; + return -1; } -function isText(fileName){ - var exts = ['rar','war','zip','tar.gz','gz','iso','xsl','doc','xdoc','jpeg','jpg','png','gif','bmp','tiff','exe','so','7z','bz','bz2']; - return isExts(fileName,exts)?false:true; +function isText(fileName) { + var exts = ['rar', 'war', 'zip', 'tar.gz', 'gz', 'iso', 'xsl', 'doc', 'xdoc', 'jpeg', 'jpg', 'png', 'gif', 'bmp', 'tiff', 'exe', 'so', '7z', 'bz', 'bz2']; + return isExts(fileName, exts) ? false : true; } -function isImage(fileName){ - var exts = ['jpg','jpeg','png','bmp','gif','tiff','ico']; - return isExts(fileName,exts); +function isImage(fileName) { + var exts = ['jpg', 'jpeg', 'png', 'bmp', 'gif', 'tiff', 'ico']; + return isExts(fileName, exts); } function isVideo(fileName) { var exts = ['mp4', 'mpeg', 'mpg', 'mov', 'avi', 'webm', 'mkv']; return isExts(fileName, exts); } -function isExts(fileName,exts){ - var ext = fileName.split('.'); - if(ext.length < 2) return false; - var extName = ext[ext.length-1].toLowerCase(); - for(var i=0;i
' - }); - $(".layui-layer").css("top", "30%"); +function GetImage(fileName) { + var imgUrl = '/download?filename=' + fileName; + layer.open({ + type: 1, + closeBtn: 2, + title: false, + area: '500px', + shadeClose: true, + content: '
' + }); + $(".layui-layer").css("top", "30%"); } function GetPlay(fileName) { @@ -1444,8 +1437,8 @@ function GetPlay(fileName) { }); $(".layui-layer").css("top", "30%"); } -function GetFileBytes(fileName, fileSize){ - window.open('/download?filename='+encodeURIComponent(fileName)); +function GetFileBytes(fileName, fileSize) { + window.open('/download?filename=' + encodeURIComponent(fileName)); } function UploadFiles() { @@ -1482,136 +1475,136 @@ function UploadFiles() { } // 设置权限 -function SetChmod(action,fileName){ - if(action == 1){ - var chmod = $("#access").val(); +function SetChmod(action, fileName) { + if (action == 1) { + var chmod = $("#access").val(); var chown = $("#chown").val(); var all = $("#accept_all").prop("checked") ? 'True' : 'False'; - var data = 'filename='+ encodeURIComponent(fileName)+'&user='+chown+'&access='+chmod+'&all=' + all; - var loadT = layer.msg(lan.public.config,{icon:16,time:0,shade: [0.3, '#000']}); - $.post('files?action=SetFileAccess',data,function(rdata){ - layer.close(loadT); - if(rdata.status) layer.close(getCookie('layers')); - layer.msg(rdata.msg,{icon:rdata.status?1:2}); - var path = $("#DirPathPlace input").val(); - GetFiles(path) - }); - return; - } + var data = 'filename=' + encodeURIComponent(fileName) + '&user=' + chown + '&access=' + chmod + '&all=' + all; + var loadT = layer.msg(lan.public.config, { icon: 16, time: 0, shade: [0.3, '#000'] }); + $.post('files?action=SetFileAccess', data, function (rdata) { + layer.close(loadT); + if (rdata.status) layer.close(getCookie('layers')); + layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); + var path = $("#DirPathPlace input").val(); + GetFiles(path) + }); + return; + } - var toExec = fileName == lan.files.all?'Batch(3,1)':'SetChmod(1,\''+fileName+'\')'; + var toExec = fileName == lan.files.all ? 'Batch(3,1)' : 'SetChmod(1,\'' + fileName + '\')'; - $.post('/files?action=GetFileAccess','filename='+encodeURIComponent(fileName),function(rdata){ - var layers = layer.open({ - type:1, - closeBtn: 2, - title: lan.files.set_auth + '['+fileName+']', - area: '430px', - shadeClose:false, - content:'
\ + $.post('/files?action=GetFileAccess', 'filename=' + encodeURIComponent(fileName), function (rdata) { + var layers = layer.open({ + type: 1, + closeBtn: 2, + title: lan.files.set_auth + '[' + fileName + ']', + area: '430px', + shadeClose: false, + content: '
\
\ - '+lan.files.file_own+'\ -

'+lan.files.file_read+'

\ -

'+lan.files.file_write+'

\ -

'+lan.files.file_exec+'

\ + '+ lan.files.file_own + '\ +

'+ lan.files.file_read + '

\ +

'+ lan.files.file_write + '

\ +

'+ lan.files.file_exec + '

\
\
\ - '+lan.files.file_group+'\ -

'+lan.files.file_read+'

\ -

'+lan.files.file_write+'

\ -

'+lan.files.file_exec+'

\ + '+ lan.files.file_group + '\ +

'+ lan.files.file_read + '

\ +

'+ lan.files.file_write + '

\ +

'+ lan.files.file_exec + '

\
\
\ - '+lan.files.file_public+'\ -

'+lan.files.file_read+'

\ -

'+lan.files.file_write+'

\ -

'+lan.files.file_exec+'

\ + '+ lan.files.file_public + '\ +

'+ lan.files.file_read + '

\ +

'+ lan.files.file_write + '

\ +

'+ lan.files.file_exec + '

\
\ -
'+lan.files.file_menu_auth+',\ - '+lan.files.file_own+'\ +
' + lan.files.file_menu_auth + ',\ + '+ lan.files.file_own + '\ \ \
\
\ - \ - \ + \ + \
\
', - success:function(layers,index){ - $('.layer_close').click(function(){ - layer.close(index); - }) - } - }); - setCookie('layers',layers); + success: function (layers, index) { + $('.layer_close').click(function () { + layer.close(index); + }) + } + }); + setCookie('layers', layers); - onAccess(); - $("#access").keyup(function(){ - onAccess(); - }); + onAccess(); + $("#access").keyup(function () { + onAccess(); + }); - $("input[type=checkbox]").change(function(){ - var idName = ['owner','group','public']; - var onacc = ''; - for(var n=0;n idName.length) continue; - if(onacc > 7) $("#access").val(access.substr(0,access.length-1)); - switch(onacc){ - case '1': - $("#"+idName[i]+"_x").prop('checked',true); - break; - case '2': - $("#"+idName[i]+"_w").prop('checked',true); - break; - case '3': - $("#"+idName[i]+"_x").prop('checked',true); - $("#"+idName[i]+"_w").prop('checked',true); - break; - case '4': - $("#"+idName[i]+"_r").prop('checked',true); - break; - case '5': - $("#"+idName[i]+"_r").prop('checked',true); - $("#"+idName[i]+"_x").prop('checked',true); - break; - case '6': - $("#"+idName[i]+"_r").prop('checked',true); - $("#"+idName[i]+"_w").prop('checked',true); - break; - case '7': - $("#"+idName[i]+"_r").prop('checked',true); - $("#"+idName[i]+"_w").prop('checked',true); - $("#"+idName[i]+"_x").prop('checked',true); - break; - } - } +function onAccess() { + var access = $("#access").val(); + var idName = ['owner', 'group', 'public']; + for (var n = 0; n < idName.length; n++) { + $("#" + idName[n] + "_x").prop('checked', false); + $("#" + idName[n] + "_w").prop('checked', false); + $("#" + idName[n] + "_r").prop('checked', false); + } + for (var i = 0; i < access.length; i++) { + var onacc = access.substr(i, 1); + if (i > idName.length) continue; + if (onacc > 7) $("#access").val(access.substr(0, access.length - 1)); + switch (onacc) { + case '1': + $("#" + idName[i] + "_x").prop('checked', true); + break; + case '2': + $("#" + idName[i] + "_w").prop('checked', true); + break; + case '3': + $("#" + idName[i] + "_x").prop('checked', true); + $("#" + idName[i] + "_w").prop('checked', true); + break; + case '4': + $("#" + idName[i] + "_r").prop('checked', true); + break; + case '5': + $("#" + idName[i] + "_r").prop('checked', true); + $("#" + idName[i] + "_x").prop('checked', true); + break; + case '6': + $("#" + idName[i] + "_r").prop('checked', true); + $("#" + idName[i] + "_w").prop('checked', true); + break; + case '7': + $("#" + idName[i] + "_r").prop('checked', true); + $("#" + idName[i] + "_w").prop('checked', true); + $("#" + idName[i] + "_x").prop('checked', true); + break; + } + } } function RClick(type, path, name, file_store) { var displayZip = isZip(type); @@ -1623,165 +1616,131 @@ function RClick(type, path, name, file_store) { { text: lan.files.file_menu_auth, onclick: function () { SetChmod(0, path) } }, { text: lan.files.file_menu_zip, onclick: function () { Zip(path) } } - ] + ] }; - if(type == "dir"){ - options.items.push({text: lan.files.file_menu_del, onclick: function() {DeleteDir(path)}}); + if (type == "dir") { + options.items.push({ text: lan.files.file_menu_del, onclick: function () { DeleteDir(path) } }); } //else if (isVideo(type)) { // options.items.push({ text: '播放', onclick: function () { GetPlay(path) } }, { text: lan.files.file_menu_down, onclick: function () { GetFileBytes(path) } }, { text: lan.files.file_menu_del, onclick: function () { DeleteFile(path) } }); //} - else if(isText(type)){ - options.items.push({text: lan.files.file_menu_edit, onclick: function() {openEditorView(0,path)}},{text: lan.files.file_menu_down, onclick: function() {GetFileBytes(path)}},{text: lan.files.file_menu_del, onclick: function() {DeleteFile(path)}}); - } - else if(displayZip != -1){ - options.items.push({text: lan.files.file_menu_unzip, onclick: function() {UnZip(path,displayZip)}},{text: lan.files.file_menu_down, onclick: function() {GetFileBytes(path)}},{text: lan.files.file_menu_del, onclick: function() {DeleteFile(path)}}); - } - else if(isImage(type)){ - options.items.push({text: lan.files.file_menu_img, onclick: function() {GetImage(path)}},{text: lan.files.file_menu_down, onclick: function() {GetFileBytes(path)}},{text: lan.files.file_menu_del, onclick: function() {DeleteFile(path)}}); + else if (isText(type)) { + options.items.push({ text: lan.files.file_menu_edit, onclick: function () { openEditorView(0, path) } }, { text: lan.files.file_menu_down, onclick: function () { GetFileBytes(path) } }, { text: lan.files.file_menu_del, onclick: function () { DeleteFile(path) } }); } - else{ - options.items.push({text: lan.files.file_menu_down, onclick: function() {GetFileBytes(path)}},{text: lan.files.file_menu_del, onclick: function() {DeleteFile(path)}}); + else if (displayZip != -1) { + options.items.push({ text: lan.files.file_menu_unzip, onclick: function () { UnZip(path, displayZip) } }, { text: lan.files.file_menu_down, onclick: function () { GetFileBytes(path) } }, { text: lan.files.file_menu_del, onclick: function () { DeleteFile(path) } }); + } + else if (isImage(type)) { + options.items.push({ text: lan.files.file_menu_img, onclick: function () { GetImage(path) } }, { text: lan.files.file_menu_down, onclick: function () { GetFileBytes(path) } }, { text: lan.files.file_menu_del, onclick: function () { DeleteFile(path) } }); + } + else { + options.items.push({ text: lan.files.file_menu_down, onclick: function () { GetFileBytes(path) } }, { text: lan.files.file_menu_del, onclick: function () { DeleteFile(path) } }); } options.items.push({ text: "Favorites", onclick: function () { - - var datas = [] - for (var i = 0; i < file_store.STORE.length; i++) { - datas.push({ title: file_store.STORE[i].name, value: file_store.STORE[i].name }) - } - var file_data = { - title: 'Add to favorites', - area: '500px', - list: [ - { name: 'path', disabled: true, width: '300px', value: path }, - { name: 'file_type', type: 'select', width: '300px', items: datas } - ], - btns: [ - bt.form.btn.close(), - { - title: 'Add', name: 'submit', css: 'btn-success', callback: function (rdata, load) { - var loading = bt.load(); - bt.send('add_files_store', 'files/add_files_store', rdata, function (rRet) { - loading.close(); - bt.msg(rRet); - if (rRet.status) { - load.close(); - GetFiles(file_store.PATH) - } - }) - } - } - ] - } - var bs = bt.render_form(file_data); - $(".bt-form" + bs).find(".info-r").css("margin-left", "15px") + var loading = bt.load(); + bt.send('add_files_store', 'files/add_files_store',{path:path}, function (rRet) { + loading.close(); + bt.msg(rRet); + if (rRet.status) { + console.log(file_store.PATH); + GetFiles(file_store.PATH) + } + }); } }) - return options; + return options; } -function RClickAll(e){ - var menu = $("#rmenu"); - var windowWidth = $(window).width(), - windowHeight = $(window).height(), - menuWidth = menu.outerWidth(), - menuHeight = menu.outerHeight(), - x = (menuWidth + e.clientX < windowWidth) ? e.clientX : windowWidth - menuWidth, - y = (menuHeight + e.clientY < windowHeight) ? e.clientY : windowHeight - menuHeight; +function RClickAll(e) { + var menu = $("#rmenu"); + var windowWidth = $(window).width(), + windowHeight = $(window).height(), + menuWidth = menu.outerWidth(), + menuHeight = menu.outerHeight(), + x = (menuWidth + e.clientX < windowWidth) ? e.clientX : windowWidth - menuWidth, + y = (menuHeight + e.clientY < windowHeight) ? e.clientY : windowHeight - menuHeight; - menu.css('top', y) - .css('left', x) - .css('position', 'fixed') - .css("z-index","1") - .show(); + menu.css('top', y) + .css('left', x) + .css('position', 'fixed') + .css("z-index", "1") + .show(); } -function GetPathSize(){ - var path = encodeURIComponent($("#DirPathPlace input").val()); +function GetPathSize() { + var path = encodeURIComponent($("#DirPathPlace input").val()); layer.msg(lan.files.calc_now,{icon:16,time:0,shade: [0.3, '#000']}) - $.post("/files?action=GetDirSize","path="+path,function(rdata){ - layer.closeAll(); - $("#pathSize").text(rdata) - }) + $.post("/files?action=GetDirSize", "path=" + path, function (rdata) { + layer.closeAll(); + $("#pathSize").text(rdata) + }) } -$("body").not(".def-log").click(function(){ - $("#rmenu").hide() +$("body").not(".def-log").click(function () { + $("#rmenu").hide() }); -$("#DirPathPlace input").keyup(function(e){ - if(e.keyCode == 13) { - GetFiles($(this).val()); - } +$("#DirPathPlace input").keyup(function (e) { + if (e.keyCode == 13) { + GetFiles($(this).val()); + } }); -function PathPlaceBtn(path){ - var html = ''; +function PathPlaceBtn(path) { + var html = ''; var title = ''; path = path.replace('//', '/'); - var Dpath = path; - if(path == '/'){ - html ='
  • '+lan.files.path_root+'
  • '; - } - else{ - Dpath = path.split("/"); - for(var i = 0; i'+Dpath[i]+''; - } - } - html = '
      '+html+'
    '; - $("#PathPlaceBtn").html(html); - $("#PathPlaceBtn ul li a").click(function(e){ - var Gopath = $(this).attr("title"); - if(Gopath.length>1){ - if(Gopath.substr(Gopath.length-1,Gopath.length) =='/'){ - Gopath = Gopath.substr(0,Gopath.length-1); - } - } - GetFiles(Gopath); - e.stopPropagation(); - }); - PathLeft(); + var Dpath = path; + if (path == '/') { + html = '
  • ' + lan.files.path_root + '
  • '; + } + else { + Dpath = path.split("/"); + for (var i = 0; i < Dpath.length; i++) { + title += Dpath[i] + '/'; + Dpath[0] = lan.files.path_root; + html += '
  • ' + Dpath[i] + '
  • '; + } + } + html = '
      ' + html + '
    '; + $("#PathPlaceBtn").html(html); + $("#PathPlaceBtn ul li a").click(function (e) { + var Gopath = $(this).attr("title"); + if (Gopath.length > 1) { + if (Gopath.substr(Gopath.length - 1, Gopath.length) == '/') { + Gopath = Gopath.substr(0, Gopath.length - 1); + } + } + GetFiles(Gopath); + e.stopPropagation(); + }); + PathLeft(); } -function PathLeft(){ - var UlWidth = $("#PathPlaceBtn ul").width(); - var SpanPathWidth = $("#PathPlaceBtn").width() - 50; - var Ml = UlWidth - SpanPathWidth; - if(UlWidth > SpanPathWidth ){ - $("#PathPlaceBtn ul").css("left",-Ml) - } - else{ - $("#PathPlaceBtn ul").css("left",0) - } +function PathLeft() { + var UlWidth = $("#PathPlaceBtn ul").width(); + var SpanPathWidth = $("#PathPlaceBtn").width() - 50; + var Ml = UlWidth - SpanPathWidth; + if (UlWidth > SpanPathWidth) { + $("#PathPlaceBtn ul").css("left", -Ml) + } + else { + $("#PathPlaceBtn ul").css("left", 0) + } } var store_type_index = 0 //删除分类或者文件 -function del_files_store(path, obj, parent_name) { +function del_files_store(path, obj) { var _item = $(obj).parents('tr').data('item') var action = '', msg = ''; var data = {} - if (parent_name != undefined) { - action = 'del_files_store'; - data['file_type'] = parent_name - data['path'] = _item.path; - msg = "Are you sure to delete the path [" + _item.path + "]?" - } - else { - action = 'del_files_store_types'; - data['file_type'] = _item.name; - msg = "Are you sure to delete the category [" + _item.name + "]?" - } - bt.confirm({ msg: msg, title: '提示' }, function () { + action = 'del_files_store'; + data['path'] = _item.path; + msg = "Are you sure to delete the path [ " + _item.path + " ]?" + bt.confirm({ msg: msg, title: 'Tips' }, function () { var loading = bt.load(); bt.send(action, 'files/' + action, data, function (rRet) { loading.close(); - if (parent_name) { - store_type_index.close(); - } - if (rRet.status) { set_file_store(path) GetFiles(getCookie('Path')) @@ -1805,7 +1764,7 @@ function set_file_store(path) { closeBtn: 2, shift: 5, shadeClose: false, - content: "
    ", + content: "
    ", success: function () { $('#btn_data_store_add').click(function () { bt.send('add_files_store_types', 'files/add_files_store_types', { file_type: $(".type_name").val() }, function (rRet) { @@ -1813,7 +1772,6 @@ function set_file_store(path) { if (rRet.status) { set_file_store(path) - GetFiles(path) } bt.msg(rRet); @@ -1826,74 +1784,40 @@ function set_file_store(path) { else { reload_sort_data(path) } - function reload_sort_data(path) { var _tab = bt.render({ table: '#stroe_tab_list', columns: [ - { field: 'name', title: 'Category Name' }, + { field: 'path', title: 'Path' }, { - field: 'opt', align: 'right', title: 'Operating', templet: function (item) { - var opt = ' View' - if (item.name != 'Default category') { - opt += ' | Del'; - } - return opt; + field: 'opt', align: 'right', title: 'Operation', templet: function (item) { + return 'Del'; } }, ], data: rRet }); - - $(".show_file_store_detail").click(function () { - var _item = $(this).parents('tr').data('item') - store_type_index = bt.open({ - type: 1, - skin: 'demo-class', - area: '710px', - title: "Manage [" + _item['name'] + ']', - closeBtn: 2, - shift: 5, - shadeClose: false, - content: "
    ", - success: function () { - var _tab = bt.render({ - table: '#stroe_tab_list_detail', - columns: [ - { field: 'path', title: 'Path name' }, - { - field: 'opt', align: 'right', title: 'Operating', templet: function (item) { - var opt = ' Del' - return opt; - } - }, - ], - data: _item.data - }); - } - }); - }) } }) } -$("#PathPlaceBtn").on("click", function(e){ - if($("#DirPathPlace").is(":hidden")){ - $("#DirPathPlace").css("display","inline"); - $("#DirPathPlace input").focus(); - $(this).hide(); - }else{ - $("#DirPathPlace").hide(); - $(this).css("display","inline"); - } - $(document).one("click", function(){ - $("#DirPathPlace").hide(); - $("#PathPlaceBtn").css("display","inline"); - }); - e.stopPropagation(); -}); -$("#DirPathPlace").on("click", function(e){ - e.stopPropagation(); +$("#PathPlaceBtn").on("click", function (e) { + if ($("#DirPathPlace").is(":hidden")) { + $("#DirPathPlace").css("display", "inline"); + $("#DirPathPlace input").focus(); + $(this).hide(); + } else { + $("#DirPathPlace").hide(); + $(this).css("display", "inline"); + } + $(document).one("click", function () { + $("#DirPathPlace").hide(); + $("#PathPlaceBtn").css("display", "inline"); + }); + e.stopPropagation(); +}); +$("#DirPathPlace").on("click", function (e) { + e.stopPropagation(); }); diff --git a/BTPanel/static/js/public.js b/BTPanel/static/js/public.js index 12bd73c0..a927b27f 100644 --- a/BTPanel/static/js/public.js +++ b/BTPanel/static/js/public.js @@ -154,7 +154,7 @@ var aceEditor = { path:_path, data:editor_item.ace.getValue(), encoding:editor_item.ace.getValue() - },function(){ + },function(res){ layer.msg(res.msg, {icon: 1}); editor_item.fileType = 0; $('.item_tab_' + editor_item.id + ' .icon-tool').attr('data-file-state', '0').removeClass('glyphicon-exclamation-sign').addClass('glyphicon-remove'); @@ -414,7 +414,7 @@ var aceEditor = { $('.menu-themes ul').html(_html); $('.menu-themes ul li').click(function(){ var _theme = $(this).attr('data-value'); - $(this).addClass('active').append(_icon).siblings().removeClass('active').find('.icon').remove(); + $(this).addClass('active').append(_icon).siblings().removeClass('active').find('.icon').remove(); var _fontSize = JSON.parse(getCookie('aceEditor')).fontSize.match(/([0-9]*)px/)[1], _data = JSON.stringify({"fontSize": _fontSize +"px","theme":_theme}); for(var item in _this.editor){ @@ -650,7 +650,7 @@ var aceEditor = { data: editor.getValue(), encoding: ACE.encoding }, function (res) { - layer.msg(res.msg, {icon: 1}); + layer.msg(res.msg, {icon: res.status?1:2}); ACE.fileType = 0; $('.item_tab_' + ACE.id + ' .icon-tool').attr('data-file-state', '0').removeClass('glyphicon-exclamation-sign').addClass('glyphicon-remove'); }); @@ -957,22 +957,25 @@ function openEditorView(type,path){ }); } -var my_headers = {}; -var request_token_ele = document.getElementById("request_token_head"); -if (request_token_ele) { - var request_token = request_token_ele.getAttribute('token'); - if (request_token) { - my_headers['x-http-token'] = request_token +function ajaxSetup() { + var my_headers = {}; + var request_token_ele = document.getElementById("request_token_head"); + if (request_token_ele) { + var request_token = request_token_ele.getAttribute('token'); + if (request_token) { + my_headers['x-http-token'] = request_token + } + } + request_token_cookie = getCookie('request_token'); + if (request_token_cookie) { + my_headers['x-cookie-token'] = request_token_cookie + } + + if (my_headers) { + $.ajaxSetup({ headers: my_headers }); } } -request_token_cookie = getCookie('request_token'); -if (request_token_cookie) { - my_headers['x-cookie-token'] = request_token_cookie -} - -if (my_headers) { - $.ajaxSetup({ headers: my_headers }); -} +ajaxSetup(); function RandomStrPwd(b) { b = b || 32; @@ -2441,8 +2444,9 @@ function remind(a){ function GetReloads() { var a = 0; - var mm = $(".bt-w-menu .bgw").html() - if(mm == undefined || mm.indexOf(lan.bt.task_list) == -1) { + var mm = $("#taskList").html() + console.log(lan.bt.task_list) + if (mm == undefined || mm.indexOf(lan.bt.task_list) == -1 ) { clearInterval(speed); a = 0; speed = null; @@ -2450,15 +2454,22 @@ function GetReloads() { } if(speed) return; speed = setInterval(function() { - var mm = $(".bt-w-menu .bgw").html() - if(mm == undefined || mm.indexOf(lan.bt.task_list) == -1) { + var mm = $("#taskList").html() + if (mm == undefined || mm.indexOf(lan.bt.task_list) == -1) { clearInterval(speed); speed = null; a = 0; return } a++; - $.post("/files?action=GetTaskSpeed", "", function(h) { + $.post("/files?action=GetTaskSpeed", "", function (h) { + if (h.status === false) { + clearInterval(speed); + speed = null; + a = 0; + return + } + if(h.task == undefined) { $(".cmdlist").html(lan.bt.task_not_list); return @@ -2580,64 +2591,169 @@ var pdata_socket = { x_http_token: document.getElementById("request_token_head").getAttribute('token') } -function web_shell() { - var termCols = 100; - var termRows = 34; - if (!socket) connect_io() - term = new Terminal({ cols: termCols, rows: termRows, screenKeys: true, useStyle: true }); - term.setOption('cursorBlink', true); - term_box = layer.open({ - type: 1, - title: 'aaPanel terminal', - area: ['920px', '630px'], - closeBtn: 2, - shadeClose: false, - content: '[Set]
    ', - cancel: function () { - term.destroy(); - }, - success: function () { - term.open(document.getElementById('term')); +var Term = { + bws: null, //websocket对象 + route: '/webssh', //被访问的方法 + term: null, + term_box: null, + ssh_info: null, + + //连接websocket + connect: function () { + if (!Term.bws || Term.bws.readyState == 3 || Term.bws.readyState == 2) { + //连接 + ws_url = (window.location.protocol === 'http:' ? 'ws://' : 'wss://') + window.location.host + Term.route; + + Term.bws = new WebSocket(ws_url); + + + //绑定事件 + Term.bws.addEventListener('message', Term.on_message); + Term.bws.addEventListener('close', Term.on_close); + Term.bws.addEventListener('error', Term.on_error); + + if (Term.ssh_info) Term.send(JSON.stringify(Term.ssh_info)) } - }); + }, - term.on('data', function (data) { - socket.emit('webssh', data); - }); - - $(".shell_btn_close").click(function(){ - layer.close(term_box); - term.destroy(); - }) - - setTimeout(function () { - socket.emit('webssh', "\u0015"); - socket.emit('webssh', "new_bt_terminal"); - //socket.emit('webssh', "new_bt_terminal"); - term.focus(); - }, 100) -} - - -function connect_io() { - socket = io.connect(); - socket.on('ssh_data', function (data) { - if (data === "\rServer connection failed!\r" || data === "\rWrong user name or password!\r") { - show_ssh_login(0); + //服务器消息事件 + on_message: function (ws_event) { + result = ws_event.data; + if (result === "\rServer connection failed!\r" || result === "\rWrong user name or password!\r") { + show_ssh_login(result); + Term.close(); return; } + Term.term.write(result); - term.write(data); - - if (data == '\r\n登出\r\n' || data == '登出\r\n' || data == '\r\nlogout\r\n' || data == 'logout\r\n') { + if (result == '\r\n登出\r\n' || result == '登出\r\n' || result == '\r\nlogout\r\n' || result == 'logout\r\n') { setTimeout(function () { - layer.close(term_box); + layer.close(Term.term_box); }, 500); + Term.close(); + Term.bws = null; } - }); + }, + //websocket关闭事件 + on_close: function (ws_event) { + Term.bws = null; + }, + + //websocket错误事件 + on_error: function (ws_event) { + console.log(ws_event) + }, + + //关闭连接 + close: function () { + Term.bws.close(); + }, + + resize: function () { + var m_width = 100; + var m_height = 34; + Term.term.resize(m_width, m_height); + Term.term.scrollToBottom(); + Term.term.focus(); + Term.send('new_terminal'); + }, + + //发送数据 + //@param event 唯一事件名称 + //@param data 发送的数据 + //@param collback 服务器返回结果时回调的函数,运行完后将被回收 + send: function (data, num) { + //如果没有连接,则尝试连接服务器 + if (!Term.bws || Term.bws.readyState == 3 || Term.bws.readyState == 2) { + Term.connect(); + } + + //判断当前连接状态,如果!=1,则100ms后尝试重新发送 + if (Term.bws.readyState === 1) { + Term.bws.send(data); + } else { + if (!num) num = 0; + if (num < 5) { + num++; + setTimeout(function () { Term.send(data, num++); }, 100) + } + } + }, + run: function (ssh_info) { + var termCols = 100; + var termRows = 34; + Term.term = new Terminal({ cols: termCols, rows: termRows, screenKeys: true, useStyle: true }); + Term.term.setOption('cursorBlink', true); + + Term.term_box = layer.open({ + type: 1, + title: 'Terminal', + area: ['920px', '630px'], + closeBtn: 2, + shadeClose: false, + content: '[Set]
    ', + cancel: function () { + Term.term.destroy(); + + }, + success: function () { + Term.term.open(document.getElementById('term')); + Term.resize(); + } + }); + + Term.term.on('data', function (data) { + try { + Term.bws.send(data) + } catch (e) { + Term.term.write('\r\nThe connection is lost and you are trying to reconnect!\r\n') + Term.connect() + } + }); + if (ssh_info) Term.ssh_info = ssh_info + Term.connect(); + }, + reset_login: function () { + var ssh_info = { + data: JSON.stringify({ + host: $("input[name='host']").val(), + port: $("input[name='port']").val(), + username: $("input[name='username']").val(), + password: $("input[name='password']").val() + }) + } + $.post('/term_open', ssh_info, function (rdata) { + if (rdata.status === false) { + layer.msg(rdata.msg); + return; + } + layer.closeAll(); + Term.connect(); + Term.term.scrollToBottom(); + Term.term.focus(); + }); + } } +function web_shell() { + Term.run(); +} + +socket = { + emit: function (data,data2) { + if (data === 'webssh') { + data = data2 + } + if (typeof(data) === 'object') { + return; + } + Term.send(data); + } +} + + + function show_ssh_login(is_config) { if ($("input[name='ssh_user']").attr('autocomplete')) return; var s_body = '
    \ @@ -2681,7 +2797,7 @@ function show_ssh_login(is_config) { \
    \

    Only support login to this server

    \ -
    '; +
    '; ssh_login = layer.open({ type: 1, title: is_config?'Please fill in the SSH connection configuration':'Please enter the SSH login account and password', @@ -2766,9 +2882,9 @@ function send_ssh_info() { var loadT = layer.msg('Trying to log in to SSH...', { icon: 16, time: 0, shade: 0.3 }); $.post("/term_open", { data: JSON.stringify(pdata) }, function () { layer.close(loadT) - socket.emit('webssh', pdata); + Term.send('reset_connect'); layer.close(ssh_login) - term.focus(); + Term.term.focus(); }) diff --git a/BTPanel/static/js/public_backup.js b/BTPanel/static/js/public_backup.js index aa6f6ceb..d2616881 100644 --- a/BTPanel/static/js/public_backup.js +++ b/BTPanel/static/js/public_backup.js @@ -1315,7 +1315,7 @@ bt.index = { var m = ""; for(var b = 0; b < l[h].versions.length; b++) { var d = ""; - if((l[h].name == "PHP" && (l[h].versions[b].version == "5.4" || l[h].versions[b].version == "54")) || (l[h].name == "MySQL" && l[h].versions[b].version == "5.5") || (l[h].name == "phpMyAdmin" && l[h].versions[b].version == "4.4")) { + if((l[h].name == "PHP" && (l[h].versions[b].version == "5.6" || l[h].versions[b].version == "5.6")) || (l[h].name == "MySQL" && l[h].versions[b].version == "5.6") || (l[h].name == "phpMyAdmin" && l[h].versions[b].version == "4.4")) { d = "selected"; m = "" } @@ -1433,7 +1433,11 @@ bt.index = { case "5.7": max = 1500; msg = "2GB"; - break; + break; + case "8.0": + max = 5000; + msg = "6GB"; + break; case "5.6": max = 800; msg = "1GB"; @@ -3207,9 +3211,9 @@ bt.soft = { }, php : { get_config:function(version,callback){ //获取禁用函数,扩展列表 - var loading = bt.load(); + //var loading = bt.load(); bt.send('GetPHPConfig','ajax/GetPHPConfig',{version:version},function(rdata){ - loading.close(); + //loading.close(); if(callback) callback(rdata); }) }, diff --git a/BTPanel/static/js/site.js b/BTPanel/static/js/site.js index 68f19910..9828b41b 100644 --- a/BTPanel/static/js/site.js +++ b/BTPanel/static/js/site.js @@ -2550,6 +2550,14 @@ var site = { bt.msg(ret); }) } + }, + { + text: 'Allow empty HTTP_REFERER requests', name: 'none', value: rdata.none, type: 'checkbox', callback: function (sdata) { + bt.site.set_site_security(web.id, web.name, sdata.sec_fix, sdata.sec_domains, '1', function (ret) { + if (ret.status) site.reload(13) + bt.msg(ret); + }) + } } ] } diff --git a/BTPanel/static/js/soft.js b/BTPanel/static/js/soft.js index 4587e0b5..7d5d3906 100644 --- a/BTPanel/static/js/soft.js +++ b/BTPanel/static/js/soft.js @@ -18,7 +18,7 @@ var soft = { } soft.is_install = false; bt.soft.get_soft_list(page, type, search, function (rdata) { - if (rdata.pro >= 0) { + if (rdata.pro < 0) { $("#updata_pro_info").html(''); } else if (rdata.pro === -2) { $("#updata_pro_info").html('
    ' + lan.soft.pro_expire + ''); @@ -27,19 +27,20 @@ var soft = { } if (type == 10) { - $("#updata_pro_info").html('
    ' + lan.soft.bt_developer + '' + lan.soft.free_to_enter + '' + lan.soft.get_third_party_apps + '
    ') + $("#updata_pro_info").html('
    ' + lan.soft.bt_developer + '' + lan.soft.get_third_party_apps + '
    ') } else if (type == 11) { $("#updata_pro_info").html('
    '+lan.soft.comingsoon+'
    ') } var tBody = ''; - rdata.type.unshift({ icon: 'icon', id: 0, ps: lan.soft.all, sort: 1, title: lan.soft.all }) + rdata.type.unshift({ icon: 'icon', id: 0, ps: lan.soft.all, sort: 1, title: lan.soft.all },{ icon: 'icon', id: -1, ps: 'Installed', sort: 1, title: 'Installed' }) for (var i = 0; i < rdata.type.length; i++) { var c = ''; if (istype == rdata.type[i].id) { c = 'class="on"'; } // 注释软件管理的付费插件,第三方插件,一键部署 - if (rdata.type[i].id != "11" && rdata.type[i].id != "10" && rdata.type[i].id != "8") { + // if (rdata.type[i].id != "11" && rdata.type[i].id != "10" && rdata.type[i].id != "8") { + if (rdata.type[i].id != "11" && rdata.type[i].id != "8") { tBody += '' + rdata.type[i].title + ''; } } @@ -121,6 +122,11 @@ var soft = { return price; } }, + (type ==10?{ + field: 'sort', width: 60, title: 'Score', templet: function (item) { + return item.sort !== undefined?('' + (item.sort <= 0 || item.sort >5?'无评分':item.sort.toFixed(1)) +''):'--'; + } + }:''), { field: 'endtime', width: 120, title: lan.soft.expire_time, templet: function (item) { var endtime = '--'; @@ -161,7 +167,7 @@ var soft = { return path; } }, - { + (type !=10?{ field: 'status', width: 40, title: lan.soft.status1, templet: function (item) { var status = ''; if (item.setup) { @@ -174,7 +180,7 @@ var soft = { } return status; } - }, + }:''), { field: 'index', width: 100, title: lan.soft.display_at_homepage, templet: function (item) { var to_index = ''; @@ -189,8 +195,8 @@ var soft = { }, { field: 'opt', width: 180, title: lan.soft.operate, align: 'right', templet: function (item) { + console.log(item) var option = ''; - var pay_opt = ''; if (item.endtime < 0 && item.pid > 0) { var re_msg = ''; @@ -236,7 +242,6 @@ var soft = { var min_version = item.versions[i] var ret = bt.check_version(item.version, min_version.m_version + '.' + min_version.version); if (ret > 0) { - if (!min_version.update_msg) min_version.update_msg = ''; if (ret == 2) option += '' + lan.soft.update + ' | '; break; } @@ -245,7 +250,6 @@ var soft = { else { var min_version = item.versions[0]; var cloud_version = min_version.m_version + '.' + min_version.version; - if (!min_version.update_msg) min_version.update_msg = ''; if (item.version != cloud_version) option += '' + lan.soft.update + ' | '; } if (item.admin) { @@ -318,8 +322,7 @@ var soft = { $.post('/deployment?action=GetList', pdata, function (rdata) { layer.close(loadT) var tBody = ''; - rdata.type.unshift({ icon: 'icon', id: 0, ps: 'All', sort: 1, title: 'All' }) - + rdata.type.unshift({ icon: 'icon', id: 0, ps: 'All', sort: 1, title: 'All' },{ icon: 'icon', id: -1, ps: 'Installed', sort: 1, title: 'Installed' }); for (var i = 0; i < rdata.type.length; i++) { var c = ''; if ('11' == rdata.type[i].id) { @@ -373,6 +376,7 @@ var soft = { Introduction\ Support for PHP version\ Provider\ + Score\ Operate\ \ '; @@ -391,6 +395,8 @@ var soft = { + '' + rdata.list[i].ps + '' + '' + rdata.list[i].php + '' + '' + (rdata.list[i].author == 'aaPanel' ? rdata.list[i].title : rdata.list[i].author) + '' + + '' + (rdata.list[i].sort !== undefined?('' + (rdata.list[i].sort <= 0 || rdata.list[i].sort > 5?'No rating':rdata.list[i].sort.toFixed(1))+''):'--') + + '' + 'One-Click' + remove_opt+'' + '' } @@ -1410,7 +1416,11 @@ var soft = { case 'set_php_config': bt.soft.php.get_config(version, function (rdata) { - $(".soft-man-con").empty().append('
    '); + var divObj = document.getElementById('phpextdiv'); + var scrollTopNum = 0; + if (divObj) scrollTopNum = divObj.scrollTop; + + $(".soft-man-con").empty().append('
    '); var list = []; for (var i = 0; i < rdata.libs.length; i++) { @@ -1448,9 +1458,7 @@ var soft = { $(".soft-man-con").append(bt.render_help(helps)); var divObj = document.getElementById('phpextdiv'); - var scrollTopNum = 0; - if (divObj) scrollTopNum = divObj.scrollTop; - document.getElementById('phpextdiv').scrollTop = scrollTopNum; + if (divObj) divObj.scrollTop = scrollTopNum; $('a').click(function () { var _obj = $(this); if (_obj.hasClass('lib-uninstall')) { @@ -1468,6 +1476,12 @@ var soft = { }); } }) + + if ($(".bt-soft-menu .bgw").text() === "Installation extension") { + setTimeout(function () { + soft.get_tab_contents('set_php_config', obj); + }, 3000) + } }) break; case 'get_phpinfo': @@ -1637,7 +1651,6 @@ var soft = { field: 'opt', title: lan.public.action, width: 50, templet: function (item) { var new_disable_functions = disable_functions.slice() new_disable_functions.splice($.inArray(item.name, new_disable_functions), 1) - // console.log(new_disable_functions) return '' + lan.soft.del + ''; } } @@ -1709,7 +1722,6 @@ var soft = { { title: 'max_spare_servers', name: 'max_spare_servers', value: rdata.max_spare_servers, type: 'number', width: '100px', ps: '*' + lan.soft.php_fpm_ps5 }, { title: ' ', text: lan.public.save, name: 'btn_children_submit', css: 'btn-success', type: 'button', callback: function (ldata) { - // console.log(ldata) bt.pub.get_menm(function (memInfo) { var limit_children = parseInt(memInfo['memTotal'] / 8); if (limit_children < parseInt(ldata.max_children)) { @@ -1825,7 +1837,6 @@ var soft = { ''); if(res.save_handler == 'files'){ bt.soft.php.get_session_count(function(res){ - // console.log(res); $('.clear_conter').html('
    ' + lan.soft.total_seesion_files + '' + res.total + '
    ' + lan.soft.can_clear_seesion + '' + res.oldfile + '
    ') $('.clear_session_file').click(function(){ bt.soft.php.clear_session_count({ @@ -2221,7 +2232,8 @@ function onekeyCodeSite(codename, versions,title,enable_functions) { layer.msg('Missing supported PHP version, please install!', { icon: 5 }); return; } - + var default_path = bt.get_cookie('sites_path'); + if (!default_path) default_path = '/www/wwwroot'; var con = '\ @@ -2234,7 +2246,7 @@ function onekeyCodeSite(codename, versions,title,enable_functions) {
    \ \
    Root Directory\ -
    \ +
    \
    \
    Database\
    \ @@ -2289,7 +2301,8 @@ function onekeyCodeSite(codename, versions,title,enable_functions) { }); //FTP账号数据绑定域名 $('#mainDomain').on('input', function () { - var defaultPath = '/www/wwwroot'; + var default_path = bt.get_cookie('sites_path'); + if (!default_path) default_path = '/www/wwwroot'; var array; var res, ress; var str = $(this).val(); @@ -2333,4 +2346,433 @@ function _getRandomString(len) { pwd += $chars.charAt(Math.floor(Math.random() * maxPos)); } return pwd; +} +var score = { + total:1, + type:'', + data:[], + // 获取评论信息 + get_score_info:function (obj,callback) { + var loadT = layer.msg('
    Getting comment information
    ', { icon: 16, time: 0, shade: [0.3, "#000"] }); + bt.send('get_score','plugin/get_score',{ + pid:obj.pid, + p:obj.p, + limit_num:obj.limit_num + },function(res){ + layer.close(loadT); + if(res.status === false){ + layer.msg(res.msg,{icon:2}); + return false; + } + if(callback) callback(res); + }); + }, + render_score_info:function(obj,callback){ + var config = {pid:obj.pid},_this = this; + obj.p == undefined?config.p = 1:config.p = parseInt(obj.p) + obj.limit_num == undefined?config.limit_num = '':config.limit_num = obj.limit_num + score.get_score_info(config,function(res){ + var _split_score = res.split.reverse(),_average_score = (_split_score[4]*1+_split_score[3]*2+_split_score[2]*3+_split_score[1]*4 +_split_score[0]*5)/res.total,_data = res.data,_html =''; + _this.total = res.total; + $('.comment_user_count').text(obj.count); + $('.comment_num').text((res.total!==0?_average_score:0).toFixed(1)); + $('.comment_partake').text(res.total); + $('.comment_rate').text(res.total!==0?((((_split_score[0]+_split_score[1])/res.total).toFixed(2)*100)+'%'):'0%'); + for(var i=0;i<5;i++){ + $('.comment_star_group:eq('+ i +')').find('.comment_progress .comment_progress_bgw').css('width',((_split_score[i] / res.total).toFixed(2)*100)+'%') + } + $('.comment_tab span:eq(1)').find('i').text(_split_score[0]+_split_score[1]); + $('.comment_tab span:eq(2)').find('i').text(_split_score[2]+_split_score[3]); + $('.comment_tab span:eq(3)').find('i').text(_split_score[4]); + + for (var j = 0; j < _data.length; j++){ + _html += '
    \ +
    \ + \ + \ + \ + \ + \ + \ + \ + '+ _data[j].nickname +'\ + '+ timeago(_data[j].addtime * 1000) +'\ +
    \ +
    '+ (getLength(_data[j].ps)>65?reBytesStr(_data[j].ps,65)+'... Details':_data[j].ps) +'
    \ +
    ' + // console.log(getLength(_data[j].ps)>70?reBytesStr(_data[j].ps,70)+' 详情':_data[j].ps); + } + _this.data = _this.data.concat(_data); + if(res.total > 10 && _data.length === 10){ + _html += '
    Click for more comments
    ' + } + $('.comment_content').find('.get_next_page').remove(); + $('.comment_content').append(_html); + if($('.comment_content .comment_box').length > 6){ + $('.comment_content').addClass('box-shadow'); + }else{ + $('.comment_content').removeClass('box-shadow'); + } + if(callback) callback(res); + }); + }, + // 设置评论信息 + set_score_info:function (obj,callback){ + var loadT = layer.msg('
    Submitting comment
    ', { icon: 16, time: 0, shade: [0.3, "#000"] }); + bt.send('set_score','plugin/set_score',{ + pid:obj.pid, + num:obj.num, + ps:obj.ps + },function(res){ + layer.close(loadT); + if(res.status === false){ + layer.msg(res.msg,{icon:2}); + return false; + } + if(callback) callback(res); + }); + }, + open_score_view:function(_pid,_name,_count){ + layer.open({ + type: 1, + title:'[ '+ _name + '] Score', + area:['550px','350px'], + closeBtn: 2, + shadeClose: false, + content:'
    \ +
    \ +
    --
    \ +
      \ +
    • user count --
    • \ +
    •  -- people participated in the score
    • \ +
    • -- Favorable rate
    • \ +
    \ +
    \ +
    \ +
    \ +
    \ + \ + \ + \ + \ + \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ + \ + \ + \ + \ + \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ + \ + \ + \ + \ + \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ + \ + \ + \ + \ + \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ + \ + \ + \ + \ + \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ + All evaluation\ + Praise -- \ + Average -- \ + Bad review -- \ +
    \ +
    \ +
    \ +
    \ +
    \ + \ + \ + \ + \ + \ +
    \ +
    Recommended: 5 points
    \ + \ + Can also enter 60 words\ +
    \ +
    \ + Participate in the score\ +
    \ +
    ' + ,success:function(index,layero){ + score.data = []; + score.render_score_info({pid:_pid,count:_count},function(){ + $('.score_info_view').show(); + }); + score.score_icon_time = null; + $('.score_icon_group span').hover(function(){ + var _active = $(this).hasClass('active'); + // if($(this).prevAll().length == 0 && $(this).nextAll('.active').length == 0 && _active){ + // $(this).removeClass('active').nextAll().removeClass('active') + // $('.score_icon_group_tips').html('选择以上图标选择评分等级1-5'); + // $('.score_icon_group').attr('data-icon',0) + // }else{ + // $(this).addClass('active').nextAll().removeClass('active'); + // $(this).prevAll().addClass('active'); + // $('.score_icon_group').attr('data-icon',$(this).prevAll().length +1) + // var _title = $(this).attr('title'); + // $('.score_icon_group_tips').text(_title); + // } + }); + $('.score_icon_group span').click(function(){ + var _active = $(this).hasClass('active'); + if($(this).prevAll().length == 0 && $(this).nextAll('.active').length == 0 && _active){ + $('.edit_view').addClass('active'); + $(this).removeClass('active').nextAll().removeClass('active') + $('.score_icon_group_tips').html('Click on the selection icon to rate 1-5 stars'); + $('.score_icon_group').attr('data-icon',0) + }else{ + $('.edit_view').removeClass('active'); + $(this).addClass('active').nextAll().removeClass('active'); + $(this).prevAll().addClass('active'); + $('.score_icon_group').attr('data-icon',$(this).prevAll().length +1) + var _title = $(this).attr('title'); + $('.score_icon_group_tips').text(_title); + } + }); + $('.comment_tab span').click(function(e){ + var _num = $(this).attr('data-num'); + $('.comment_content').removeClass('box-shadow'); + $(this).addClass('active').siblings().removeClass('active'); + $('.comment_content').html(''); + score.data = [] + score.type = _num; + score.render_score_info({pid:_pid,limit_num:_num,count:_count}); + + }); + $('.comment_content').on('click','.get_next_page',function () { + var _next_page = ($('.comment_content .comment_box').length / 10)+1; + score.render_score_info({pid:_pid,limit_num:score.type,p:_next_page,count:_count}); + }); + $('.comment_content').on('click','.comment_box',function(){ + if(!$(this).hasClass('get_next_page')){ + var _index = $(this).attr('data-index'); + layer.open({ + type: 1, + title:false, + area:['350px','200px'], + closeBtn: 2, + shadeClose: false, + content: '
    '+ $(this).html() +'
    ', + success:function(index,layers) { + $('.score_details .comment_box_content').html(score.data[_index]['ps']); + } + }); + } + }); + $('.edit_view').click(function(){ + if($('.edit_view').hasClass('active')){ + // layer.msg('请选择评分等级',{icon:2}); + $('.score_icon_group_tips').css('color','red'); + setTimeout(function(){ + $('.score_icon_group_tips').removeAttr('style') + },1000); + return false + } + var _num = parseInt($('.score_icon_group').attr('data-icon')),_ps = $('.score_input').val(); + if(_num == 0){ + layer.msg('Rating level cannot be empty',{icon:2}); + return false; + } + if(120 - getLength(_ps)<0){ + layer.msg('Evaluation information cannot exceed 60 words',{icon:2}); + return false; + } + score.set_score_info({pid:_pid,num:_num,ps:_ps == ''?'User did not make any evaluation': _ps},function(res){ + layer.msg(res.msg,{icon:1}); + score.render_score_info({pid:_pid,limit_num:score.type,count:_count}); + soft.flush_cache(); + layer.close(index); + }); + return false + layer.open({ + type: 1, + title:'Add review', + area:['400px','350px'], + closeBtn: 2, + shadeClose: false, + btn:['Confirm','Cancel'], + content:'
    \ +
    \ + \ + \ + \ + \ + \ +
    \ +
    (Click on the icon above to select rating 1-5)
    \ + \ + Can also enter 60 words\ +
    ', + success:function(){ + $('.score_icon_group span').click(function(){ + var _active = $(this).hasClass('active'); + if($(this).prevAll().length == 0 && $(this).nextAll('.active').length == 0 && _active){ + $(this).removeClass('active').nextAll().removeClass('active') + $('.score_icon_group_tips').html('(Click on the icon above to select rating 1-5)'); + $('.score_icon_group').attr('data-icon',0) + }else{ + $(this).addClass('active').nextAll().removeClass('active'); + $(this).prevAll().addClass('active'); + $('.score_icon_group').attr('data-icon',$(this).prevAll().length +1) + var _title = $(this).attr('title'); + $('.score_icon_group_tips').text(_title); + } + }); + $('.score_input').on('keydown keyup focus click',function(){ + var _val = $('.score_input').val(),_size = 120 - getLength(_val); + if(_size > 0){ + $('.score_input_tips i').css('color',_size > 20?'#666':'red').text(parseInt(_size/2)); + $('.score_input').attr('style',''); + }else{ + $('.score_input_tips i').text(0) + $('.score_input').css({'outline-color':'red','border':'1px solid red'}); + } + }); + }, + yes:function(index,layero){ + var _num = parseInt($('.score_icon_group').attr('data-icon')),_ps = $('.score_input').val(); + if(_num == 0){ + layer.msg('Rating level cannot be empty',{icon:2}); + return false; + } + if(120 - getLength(_ps)<0){ + layer.msg('Evaluation information cannot exceed 60 words',{icon:2}); + return false; + } + score.set_score_info({pid:_pid,num:_num,ps:_ps == ''?'User did not make any evaluation': _ps},function(res){ + layer.msg(res.msg,{icon:1}); + score.render_score_info({pid:_pid,limit_num:score.type,count:_count}); + soft.flush_cache(); + layer.close(index); + }); + } + }); + }); + } + }) + } +} + +function timeago(dateTimeStamp){ //dateTimeStamp是一个时间毫秒,注意时间戳是秒的形式,在这个毫秒的基础上除以1000,就是十位数的时间戳。13位数的都是时间毫秒。 + if(dateTimeStamp.toString().length < 10) dateTimeStamp = dateTimeStamp * 1000 + var minute = 1000 * 60, + hour = minute * 60, + day = hour * 24, + week = day * 7, + halfamonth = day * 15, + month = day * 30, + now = new Date().getTime(), //获取当前时间毫秒 + diffValue = now - dateTimeStamp;//时间差 + if(diffValue <= 0){return 'Just a moment ago';} + var minC = diffValue/minute, //计算时间差的分,时,天,周,月 + hourC = diffValue/hour, + dayC = diffValue/day, + weekC = diffValue/week, + monthC = diffValue/month, + result ='Just a moment ago'; + if(monthC >= 1 && monthC <= 3){ + result = " " + parseInt(monthC) + "month ago" + }else if(weekC >= 1 && weekC <= 3){ + result = " " + parseInt(weekC) + "week ago" + }else if(dayC >= 1 && dayC <= 6){ + result = " " + parseInt(dayC) + "day ago" + }else if(hourC >= 1 && hourC <= 23){ + result = " " + parseInt(hourC) + "hour ago" + }else if(minC >= 1 && minC <= 59){ + result =" " + parseInt(minC) + "minute ago" + }else if(diffValue >= 0 && diffValue <= minute){ + result = "Just a moment ago" + }else { + var datetime = new Date(); + datetime.setTime(dateTimeStamp); + var Nyear = datetime.getFullYear(), + Nmonth = datetime.getMonth() + 1 < 10 ? "0" + (datetime.getMonth() + 1) : datetime.getMonth() + 1, + Ndate = datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime.getDate(), + Nhour = datetime.getHours() < 10 ? "0" + datetime.getHours() : datetime.getHours(), + Nminute = datetime.getMinutes() < 10 ? "0" + datetime.getMinutes() : datetime.getMinutes(), + Nsecond = datetime.getSeconds() < 10 ? "0" + datetime.getSeconds() : datetime.getSeconds(), + result = Nmonth + "-" + Ndate + } + if (!result) result = 'Just a moment ago' + return ((result == undefined || result == 'undefined')?'Just a moment ago':result); +} +// 规则转码 +function escapeHTML(val) { + val = "" + val; + return val.replace(//g, ">").replace(/"/g, '"').replace(/'/g, "‘").replace(/\(/g, "(").replace(/\</g, "<").replace(/\>/g, ">").replace(/`/g, "`").replace(/=/g, "="); +} +function getLength(val) { + var str = new String(val); + var bytesCount = 0; + for (var i = 0 ,n = str.length; i < n; i++) { + var c = str.charCodeAt(i); + if ((c >= 0x0001 && c <= 0x007e) || (0xff60<=c && c<=0xff9f)) { + bytesCount += 1; + } else { + bytesCount += 2; + } + } + return bytesCount; +} +function reBytesStr(str, len) { + if ((!str && typeof(str) != 'undefined')) {return '';} + var num = 0; + var str1 = str; + var str = ''; + for (var i = 0,lens = str1.length; i < lens; i++) { + num += ((str1.charCodeAt(i) > 255) ? 2 : 1); + if (num > len) { + break; + } else { + str = str1.substring(0, i + 1); + } + } + return str; } \ No newline at end of file diff --git a/BTPanel/templates/default/config.html b/BTPanel/templates/default/config.html index 46442406..9bd48ca2 100644 --- a/BTPanel/templates/default/config.html +++ b/BTPanel/templates/default/config.html @@ -77,15 +77,18 @@ {{data['lan']['CY1']}}
    - {{data['lan']['CT2']}} - +
    + {{data['lan']['CT2']}} + + {{data['lan']['CY10']}} +
    {{data['lan']['CY2']}}, {{data['lan']['S_PORT_TIPS']}}
    -
    - {{data['lan']['concurrent_thread']}} - - {{data['lan']['thread_ps']}} -
    + + + + +
    {{data['lan']['TIMEOUT']}} diff --git a/BTPanel/templates/default/error.html b/BTPanel/templates/default/error.html index 6a213b36..4242784b 100644 --- a/BTPanel/templates/default/error.html +++ b/BTPanel/templates/default/error.html @@ -8,6 +8,6 @@

    {1}

    {2}


    -
    {3} 6.x {4}
    +
    {3} {4}
    \ No newline at end of file diff --git a/BTPanel/templates/default/error2.html b/BTPanel/templates/default/error2.html index 9f80547c..16933b20 100644 --- a/BTPanel/templates/default/error2.html +++ b/BTPanel/templates/default/error2.html @@ -10,6 +10,6 @@

    {3}

    {4}


    -
    {5} 6.x {6}
    +
    {5} {6}
    \ No newline at end of file diff --git a/BTPanel/templates/default/files.html b/BTPanel/templates/default/files.html index bb406e53..254ad2b7 100644 --- a/BTPanel/templates/default/files.html +++ b/BTPanel/templates/default/files.html @@ -68,6 +68,7 @@ Replace Font Theme + Set Help
    @@ -77,13 +78,14 @@
    Favorites
      +
    • Back to previous
    • - +
      • - +
    @@ -182,15 +183,15 @@ - + - +