mirror of
https://github.com/flucont/btcloud.git
synced 2025-01-22 20:58:14 -05:00
wiki
This commit is contained in:
parent
4608d4899b
commit
57cbf9315c
@ -1,132 +1,239 @@
|
|||||||
#coding: utf-8
|
#coding: utf-8
|
||||||
|
# +-------------------------------------------------------------------
|
||||||
|
# | 宝塔Linux面板
|
||||||
|
# +-------------------------------------------------------------------
|
||||||
|
# | Copyright (c) 2015-2099 宝塔软件(http://bt.cn) All rights reserved.
|
||||||
|
# +-------------------------------------------------------------------
|
||||||
|
# | Author: hwliang <hwl@bt.cn>
|
||||||
|
# +-------------------------------------------------------------------
|
||||||
|
|
||||||
|
#+--------------------------------------------------------------------
|
||||||
|
#| 插件和模块加载器
|
||||||
|
#+--------------------------------------------------------------------
|
||||||
|
|
||||||
import public,os,sys,json
|
import public,os,sys,json
|
||||||
|
|
||||||
#获取插件列表(0/1)
|
def plugin_run(plugin_name,def_name,args):
|
||||||
def get_plugin_list(force = 0):
|
'''
|
||||||
api_root_url = 'https://api.bt.cn'
|
@name 执行插件方法
|
||||||
api_url = api_root_url+ '/panel/get_plugin_list'
|
@param plugin_name<string> 插件名称
|
||||||
cache_file = 'data/plugin_list.json'
|
@param def_name<string> 方法名称
|
||||||
|
@param args<dict_obj> 参数对像
|
||||||
if force==0 and os.path.exists(cache_file):
|
@return mixed
|
||||||
jsonData = public.readFile(cache_file)
|
'''
|
||||||
softList = json.loads(jsonData)
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
jsonData = public.HttpGet(api_url)
|
|
||||||
except Exception as ex:
|
|
||||||
raise public.error_conn_cloud(str(ex))
|
|
||||||
softList = json.loads(jsonData)
|
|
||||||
if type(softList)!=dict or 'list' not in softList:
|
|
||||||
if type(softList)==str:
|
|
||||||
raise Exception(softList)
|
|
||||||
else:
|
|
||||||
raise Exception('云端插件列表获取失败')
|
|
||||||
public.writeFile(cache_file, jsonData)
|
|
||||||
return softList
|
|
||||||
|
|
||||||
#获取授权状态() 返回:0.免费版 1.专业版 2.企业版 -1.获取失败
|
|
||||||
def get_auth_state():
|
|
||||||
try:
|
|
||||||
softList = get_plugin_list()
|
|
||||||
if softList['ltd'] > -1:
|
|
||||||
return 2
|
|
||||||
elif softList['pro'] > -1:
|
|
||||||
return 1
|
|
||||||
else:
|
|
||||||
return 0
|
|
||||||
except:
|
|
||||||
return -1
|
|
||||||
|
|
||||||
#执行插件方法(插件名,方法名,参数)
|
|
||||||
def plugin_run(plugin_name, def_name, args):
|
|
||||||
if not plugin_name or not def_name: return public.returnMsg(False,'插件名称和插件方法名称不能为空!')
|
if not plugin_name or not def_name: return public.returnMsg(False,'插件名称和插件方法名称不能为空!')
|
||||||
if not path_check(plugin_name) or not path_check(def_name): return public.returnMsg(False,'插件名或方法名不能包含特殊符号!')
|
|
||||||
p_path = public.get_plugin_path(plugin_name)
|
|
||||||
if not os.path.exists(p_path + '/index.php') and not os.path.exists(p_path + '/%s_main.py' % plugin_name): return public.returnMsg(False,'插件不存在!')
|
|
||||||
|
|
||||||
is_php = os.path.exists(p_path + '/index.php')
|
# 获取插件目录
|
||||||
if not is_php:
|
plugin_path = public.get_plugin_path(plugin_name)
|
||||||
public.package_path_append(p_path)
|
is_php = os.path.exists(os.path.join(plugin_path,'index.php'))
|
||||||
plugin_main = __import__(plugin_name + '_main')
|
|
||||||
try:
|
|
||||||
if sys.version_info[0] == 2:
|
|
||||||
reload(plugin_main)
|
|
||||||
else:
|
|
||||||
from imp import reload
|
|
||||||
reload(plugin_main)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
plu = eval('plugin_main.' + plugin_name + '_main()')
|
|
||||||
if not hasattr(plu, def_name):
|
|
||||||
return public.returnMsg(False,'在[%s]插件中找不到[%s]方法' % (plugin_name,def_name))
|
|
||||||
|
|
||||||
if 'plugin_get_object' in args and args.plugin_get_object == 1:
|
# 检查插件目录是否合法
|
||||||
if not is_php:
|
if is_php:
|
||||||
return getattr(plu, def_name)
|
plugin_file = os.path.join(plugin_path,'index.php')
|
||||||
else:
|
|
||||||
return None
|
|
||||||
else:
|
else:
|
||||||
|
plugin_file = os.path.join(plugin_path, plugin_name + '_main.py')
|
||||||
|
if not public.path_safe_check(plugin_file): return public.returnMsg(False,'插件路径不合法')
|
||||||
|
|
||||||
|
# 检查插件入口文件是否存在
|
||||||
|
if not os.path.exists(plugin_file): return public.returnMsg(False,'指定插件入口文件不存在')
|
||||||
|
|
||||||
|
# 添加插件目录到系统路径
|
||||||
|
public.sys_path_append(plugin_path)
|
||||||
|
|
||||||
|
try:
|
||||||
if not is_php:
|
if not is_php:
|
||||||
data = eval('plu.' + def_name + '(args)')
|
# 引用插件入口文件
|
||||||
|
_name = "{}_main".format(plugin_name)
|
||||||
|
plugin_main = __import__(_name)
|
||||||
|
|
||||||
|
# 检查类名是否符合规范
|
||||||
|
if not hasattr(plugin_main,_name):
|
||||||
|
return public.returnMsg(False,'指定插件入口文件不符合规范')
|
||||||
|
|
||||||
|
try:
|
||||||
|
if sys.version_info[0] == 2:
|
||||||
|
reload(plugin_main)
|
||||||
|
else:
|
||||||
|
from imp import reload
|
||||||
|
reload(plugin_main)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# 实例化插件类
|
||||||
|
plugin_obj = getattr(plugin_main,_name)()
|
||||||
|
|
||||||
|
# 检查方法是否存在
|
||||||
|
if not hasattr(plugin_obj,def_name):
|
||||||
|
return public.returnMsg(False,'在[%s]插件中找不到[%s]方法' % (plugin_name,def_name))
|
||||||
|
|
||||||
|
if 'plugin_get_object' in args and args.plugin_get_object == 1:
|
||||||
|
return getattr(plugin_obj, def_name)
|
||||||
|
|
||||||
|
# 执行方法
|
||||||
|
return getattr(plugin_obj,def_name)(args)
|
||||||
else:
|
else:
|
||||||
|
if 'plugin_get_object' in args and args.plugin_get_object == 1:
|
||||||
|
return None
|
||||||
import panelPHP
|
import panelPHP
|
||||||
args.s = def_name
|
args.s = def_name
|
||||||
args.name = plugin_name
|
args.name = plugin_name
|
||||||
data = panelPHP.panelPHP(plugin_name).exec_php_script(args)
|
return panelPHP.panelPHP(plugin_name).exec_php_script(args)
|
||||||
return data
|
|
||||||
|
|
||||||
#执行模块方法(模块名,方法名,参数)
|
except SyntaxError as ex:
|
||||||
def module_run(mod_name, def_name, args):
|
return public.returnMsg(False,'指定插件不兼容当前操作系统')
|
||||||
if not mod_name or not def_name: return public.returnMsg(False,'模块名称和模块方法名称不能为空!')
|
except Exception as ex:
|
||||||
if not path_check(mod_name) or not path_check(def_name): return public.returnMsg(False,'模块名或方法名不能包含特殊符号!')
|
public.print_error()
|
||||||
|
return public.returnMsg(False,'指定插件不存在')
|
||||||
|
|
||||||
|
|
||||||
if 'model_index' in args:
|
|
||||||
if args.model_index:
|
|
||||||
mod_file = "{}/{}Model/{}Model.py".format(public.get_class_path(),args.model_index,mod_name)
|
|
||||||
else:
|
|
||||||
mod_file = "{}/projectModel/{}Model.py".format(public.get_class_path(),mod_name)
|
|
||||||
else:
|
|
||||||
module_list = get_module_list()
|
|
||||||
for module_dir in module_list:
|
|
||||||
mod_file = "{}/{}/{}Model.py".format(public.get_class_path(),module_dir,mod_name)
|
|
||||||
if os.path.exists(mod_file): break
|
|
||||||
|
|
||||||
if not os.path.exists(mod_file):
|
|
||||||
return public.returnMsg(False,'模块[%s]不存在' % mod_name)
|
|
||||||
|
|
||||||
def_object = public.get_script_object(mod_file)
|
|
||||||
if not def_object: return public.returnMsg(False,'模块[%s]不存在!' % mod_name)
|
|
||||||
try:
|
|
||||||
run_object = getattr(def_object.main(),def_name,None)
|
|
||||||
except:
|
|
||||||
return public.returnMsg(False,'模块入口实例化失败' % mod_name)
|
|
||||||
if not run_object: return public.returnMsg(False,'在[%s]模块中找不到[%s]方法' % (mod_name,def_name))
|
|
||||||
if 'module_get_object' in args and args.module_get_object == 1:
|
|
||||||
return run_object
|
|
||||||
result = run_object(args)
|
|
||||||
return result
|
|
||||||
|
|
||||||
#获取模块文件夹列表
|
|
||||||
def get_module_list():
|
def get_module_list():
|
||||||
list = []
|
'''
|
||||||
|
@name 获取模块列表
|
||||||
|
@return list
|
||||||
|
'''
|
||||||
|
module_list = []
|
||||||
class_path = public.get_class_path()
|
class_path = public.get_class_path()
|
||||||
f_list = os.listdir(class_path)
|
for name in os.listdir(class_path):
|
||||||
for fname in f_list:
|
path = os.path.join(class_path,name)
|
||||||
f_path = class_path+'/'+fname
|
# 过滤无效文件
|
||||||
if os.path.isdir(f_path) and len(fname) > 6 and fname.find('.') == -1 and fname.find('Model') != -1:
|
if not name or name.endswith('.py') or name[0] == '.' or not name.endswith('Model') or os.path.isfile(path):continue
|
||||||
list.append(fname)
|
module_list.append(name)
|
||||||
return list
|
return module_list
|
||||||
|
|
||||||
#检查路径是否合法
|
def module_run(module_name,def_name,args):
|
||||||
def path_check(path):
|
'''
|
||||||
list = ["./","..",",",";",":","?","'","\"","<",">","|","\\","\n","\r","\t","\b","\a","\f","\v","*","%","&","$","#","@","!","~","`","^","(",")","+","=","{","}","[","]"]
|
@name 执行模块方法
|
||||||
for i in path:
|
@param module_name<string> 模块名称
|
||||||
if i in list:
|
@param def_name<string> 方法名称
|
||||||
return False
|
@param args<dict_obj> 参数对像
|
||||||
return True
|
@return mixed
|
||||||
|
'''
|
||||||
|
if not module_name or not def_name: return public.returnMsg(False,'模块名称和模块方法名称不能为空!')
|
||||||
|
model_index = args.get('model_index',None)
|
||||||
|
class_path = public.get_class_path()
|
||||||
|
panel_path = public.get_panel_path()
|
||||||
|
|
||||||
|
module_file = None
|
||||||
|
if model_index:
|
||||||
|
# 新模块目录
|
||||||
|
if model_index in ['mod']:
|
||||||
|
_name = "{}Mod".format(module_name)
|
||||||
|
module_file = os.path.join(panel_path,'mod','project',module_name + 'Mod.py')
|
||||||
|
elif model_index:
|
||||||
|
# 旧模块目录
|
||||||
|
_name = "{}Model".format(module_name)
|
||||||
|
module_file = os.path.join(class_path,model_index+"Model",module_name + 'Model.py')
|
||||||
|
else:
|
||||||
|
_name = "{}Model".format(module_name)
|
||||||
|
module_file = os.path.join(class_path,"projectModel",module_name + 'Model.py')
|
||||||
|
else:
|
||||||
|
# 如果没指定模块名称,则遍历所有模块目录
|
||||||
|
module_list = get_module_list()
|
||||||
|
for name in module_list:
|
||||||
|
module_file = os.path.join(class_path,name,module_name + 'Model.py')
|
||||||
|
if os.path.exists(module_file):
|
||||||
|
_name = "{}Model".format(module_name)
|
||||||
|
break
|
||||||
|
|
||||||
|
# 判断模块入口文件是否存在
|
||||||
|
if not os.path.exists(module_file):
|
||||||
|
return public.returnMsg(False,'模块[%s]不存在' % module_name)
|
||||||
|
|
||||||
|
# 判断模块路径是否合法
|
||||||
|
if not public.path_safe_check(module_file):
|
||||||
|
return public.returnMsg(False,'模块路径不合法')
|
||||||
|
|
||||||
|
public.sys_path_append(os.path.dirname(module_file))
|
||||||
|
try:
|
||||||
|
# 引用模块入口文件
|
||||||
|
module_main = __import__(_name)
|
||||||
|
|
||||||
|
# 检查模块是否符合规范
|
||||||
|
if not hasattr(module_main,'main'):
|
||||||
|
return public.returnMsg(False,'指定模块入口文件不符合规范')
|
||||||
|
|
||||||
|
# 实例化模块类
|
||||||
|
module_obj = getattr(module_main,'main')()
|
||||||
|
|
||||||
|
# 检查方法是否存在
|
||||||
|
if not hasattr(module_obj,def_name):
|
||||||
|
return public.returnMsg(False,'在[%s]模块中找不到[%s]方法' % (module_name,def_name))
|
||||||
|
|
||||||
|
if 'module_get_object' in args and args.module_get_object == 1:
|
||||||
|
return getattr(module_obj,def_name)
|
||||||
|
|
||||||
|
# 执行方法
|
||||||
|
return getattr(module_obj,def_name)(args)
|
||||||
|
except SyntaxError as ex:
|
||||||
|
return public.returnMsg(False,'指定模块不兼容当前操作系统')
|
||||||
|
except Exception as ex:
|
||||||
|
public.print_error()
|
||||||
|
return public.returnMsg(False,'指定模块不存在')
|
||||||
|
|
||||||
|
|
||||||
|
def get_plugin_list(upgrade_force = False):
|
||||||
|
'''
|
||||||
|
@name 获取插件列表
|
||||||
|
@param upgrade_force<bool> 是否强制重新获取列表
|
||||||
|
@return dict
|
||||||
|
'''
|
||||||
|
|
||||||
|
api_root_url = 'https://api.bt.cn'
|
||||||
|
api_url = api_root_url+ '/panel/get_plugin_list'
|
||||||
|
panel_path = public.get_panel_path()
|
||||||
|
data_path = os.path.join(panel_path,'data')
|
||||||
|
|
||||||
|
if not os.path.exists(data_path):
|
||||||
|
os.makedirs(data_path,384)
|
||||||
|
|
||||||
|
plugin_list = {}
|
||||||
|
plugin_list_file = os.path.join(data_path,'plugin_list.json')
|
||||||
|
if os.path.exists(plugin_list_file) and not upgrade_force:
|
||||||
|
plugin_list_body = public.readFile(plugin_list_file)
|
||||||
|
try:
|
||||||
|
plugin_list = json.loads(plugin_list_body)
|
||||||
|
except:
|
||||||
|
plugin_list = {}
|
||||||
|
|
||||||
|
if not os.path.exists(plugin_list_file) or upgrade_force or not plugin_list:
|
||||||
|
try:
|
||||||
|
res = public.HttpGet(api_url)
|
||||||
|
except Exception as ex:
|
||||||
|
raise public.error_conn_cloud(str(ex))
|
||||||
|
if not res: raise Exception(False,'云端插件列表获取失败')
|
||||||
|
|
||||||
|
plugin_list = json.loads(res)
|
||||||
|
if type(plugin_list)!=dict or 'list' not in plugin_list:
|
||||||
|
if type(plugin_list)==str:
|
||||||
|
raise Exception(plugin_list)
|
||||||
|
else:
|
||||||
|
raise Exception('云端插件列表获取失败')
|
||||||
|
public.writeFile(plugin_list_file,json.dumps(plugin_list))
|
||||||
|
|
||||||
|
return plugin_list
|
||||||
|
|
||||||
|
|
||||||
|
def start_total():
|
||||||
|
'''
|
||||||
|
@name 启动统计服务
|
||||||
|
@return dict
|
||||||
|
'''
|
||||||
|
pass
|
||||||
|
|
||||||
|
def get_soft_list(args):
|
||||||
|
'''
|
||||||
|
@name 获取软件列表
|
||||||
|
@param args<dict_obj> 参数对像
|
||||||
|
@return dict
|
||||||
|
'''
|
||||||
|
pass
|
||||||
|
|
||||||
#数据加密
|
|
||||||
def db_encrypt(data):
|
def db_encrypt(data):
|
||||||
|
'''
|
||||||
|
@name 数据库加密
|
||||||
|
@param args<dict_obj> 参数对像
|
||||||
|
@return dict
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
key = __get_db_sgin()
|
key = __get_db_sgin()
|
||||||
iv = __get_db_iv()
|
iv = __get_db_iv()
|
||||||
@ -143,8 +250,12 @@ def db_encrypt(data):
|
|||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|
||||||
#数据解密
|
|
||||||
def db_decrypt(data):
|
def db_decrypt(data):
|
||||||
|
'''
|
||||||
|
@name 数据库解密
|
||||||
|
@param args<dict_obj> 参数对像
|
||||||
|
@return dict
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
key = __get_db_sgin()
|
key = __get_db_sgin()
|
||||||
iv = __get_db_iv()
|
iv = __get_db_iv()
|
||||||
@ -215,3 +326,49 @@ def __aes_encrypt(data, key, iv):
|
|||||||
encryptedbytes = aes.encrypt(data)
|
encryptedbytes = aes.encrypt(data)
|
||||||
en_text = base64.b64encode(encryptedbytes)
|
en_text = base64.b64encode(encryptedbytes)
|
||||||
return en_text.decode('utf-8')
|
return en_text.decode('utf-8')
|
||||||
|
|
||||||
|
def plugin_end():
|
||||||
|
'''
|
||||||
|
@name 插件到期处理
|
||||||
|
@return dict
|
||||||
|
'''
|
||||||
|
pass
|
||||||
|
|
||||||
|
def daemon_task():
|
||||||
|
'''
|
||||||
|
@name 后台任务守护
|
||||||
|
@return dict
|
||||||
|
'''
|
||||||
|
pass
|
||||||
|
|
||||||
|
def daemon_panel():
|
||||||
|
'''
|
||||||
|
@name 面板守护
|
||||||
|
@return dict
|
||||||
|
'''
|
||||||
|
pass
|
||||||
|
|
||||||
|
def flush_auth_key():
|
||||||
|
'''
|
||||||
|
@name 刷新授权密钥
|
||||||
|
@return dict
|
||||||
|
'''
|
||||||
|
pass
|
||||||
|
|
||||||
|
def get_auth_state():
|
||||||
|
'''
|
||||||
|
@name 获取授权状态
|
||||||
|
@return 返回:0.免费版 1.专业版 2.企业版 -1.获取失败
|
||||||
|
'''
|
||||||
|
try:
|
||||||
|
softList = get_plugin_list()
|
||||||
|
if softList['ltd'] > -1:
|
||||||
|
return 2
|
||||||
|
elif softList['pro'] > -1:
|
||||||
|
return 1
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
except:
|
||||||
|
return -1
|
||||||
|
|
||||||
|
|
@ -1,369 +1,394 @@
|
|||||||
/*
|
/*
|
||||||
*宝塔面板去除各种计算题与延时等待
|
*宝塔面板去除各种计算题与延时等待
|
||||||
*/
|
*/
|
||||||
if("undefined" != typeof bt && bt.hasOwnProperty("show_confirm")){
|
if("undefined" != typeof bt && bt.hasOwnProperty("show_confirm")){
|
||||||
bt.show_confirm = function(title, msg, fun, error) {
|
bt.show_confirm = function(title, msg, fun, error) {
|
||||||
if (error == undefined) {
|
if (error == undefined) {
|
||||||
error = ""
|
error = ""
|
||||||
}
|
}
|
||||||
var mess = layer.open({
|
var mess = layer.open({
|
||||||
type: 1,
|
type: 1,
|
||||||
title: title,
|
title: title,
|
||||||
area: "350px",
|
area: "350px",
|
||||||
closeBtn: 2,
|
closeBtn: 2,
|
||||||
shadeClose: true,
|
shadeClose: true,
|
||||||
content: "<div class='bt-form webDelete pd20 pb70'><p>" + msg + "</p>" + error + "<div class='bt-form-submit-btn'><button type='button' class='btn btn-danger btn-sm bt-cancel'>" + lan.public.cancel + "</button> <button type='button' id='toSubmit' class='btn btn-success btn-sm' >" + lan.public.ok + "</button></div></div>"
|
content: "<div class='bt-form webDelete pd20 pb70'><p>" + msg + "</p>" + error + "<div class='bt-form-submit-btn'><button type='button' class='btn btn-danger btn-sm bt-cancel'>" + lan.public.cancel + "</button> <button type='button' id='toSubmit' class='btn btn-success btn-sm' >" + lan.public.ok + "</button></div></div>"
|
||||||
});
|
});
|
||||||
$(".bt-cancel").click(function () {
|
$(".bt-cancel").click(function () {
|
||||||
layer.close(mess);
|
layer.close(mess);
|
||||||
});
|
});
|
||||||
$("#toSubmit").click(function () {
|
$("#toSubmit").click(function () {
|
||||||
layer.close(mess);
|
layer.close(mess);
|
||||||
fun();
|
fun();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if("undefined" != typeof bt && bt.hasOwnProperty("prompt_confirm")){
|
if("undefined" != typeof bt && bt.hasOwnProperty("prompt_confirm")){
|
||||||
bt.prompt_confirm = function (title, msg, callback) {
|
bt.prompt_confirm = function (title, msg, callback) {
|
||||||
layer.open({
|
layer.open({
|
||||||
type: 1,
|
type: 1,
|
||||||
title: title,
|
title: title,
|
||||||
area: "350px",
|
area: "350px",
|
||||||
closeBtn: 2,
|
closeBtn: 2,
|
||||||
btn: ['确认', '取消'],
|
btn: ['确认', '取消'],
|
||||||
content: "<div class='bt-form promptDelete pd20'>\
|
content: "<div class='bt-form promptDelete pd20'>\
|
||||||
<p>" + msg + "</p>\
|
<p>" + msg + "</p>\
|
||||||
</div>",
|
</div>",
|
||||||
yes: function (layers, index) {
|
yes: function (layers, index) {
|
||||||
layer.close(layers)
|
layer.close(layers)
|
||||||
if (callback) callback()
|
if (callback) callback()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if("undefined" != typeof bt && bt.hasOwnProperty("compute_confirm")){
|
if("undefined" != typeof bt && bt.hasOwnProperty("compute_confirm")){
|
||||||
bt.compute_confirm = function (config, callback) {
|
bt.compute_confirm = function (config, callback) {
|
||||||
layer.open({
|
layer.open({
|
||||||
type: 1,
|
type: 1,
|
||||||
title: config.title,
|
title: config.title,
|
||||||
area: '430px',
|
area: '430px',
|
||||||
closeBtn: 2,
|
closeBtn: 2,
|
||||||
shadeClose: true,
|
shadeClose: true,
|
||||||
btn: [lan['public'].ok, lan['public'].cancel],
|
btn: [lan['public'].ok, lan['public'].cancel],
|
||||||
content:
|
content:
|
||||||
'<div class="bt-form hint_confirm pd30">\
|
'<div class="bt-form hint_confirm pd30">\
|
||||||
<div class="hint_title">\
|
<div class="hint_title">\
|
||||||
<i class="hint-confirm-icon"></i>\
|
<i class="hint-confirm-icon"></i>\
|
||||||
<div class="hint_con">' +
|
<div class="hint_con">' +
|
||||||
config.msg +
|
config.msg +
|
||||||
'</div>\
|
'</div>\
|
||||||
</div>\
|
</div>\
|
||||||
</div>',
|
</div>',
|
||||||
yes: function (layers, index) {
|
yes: function (layers, index) {
|
||||||
layer.close(layers)
|
layer.close(layers)
|
||||||
if (callback) callback()
|
if (callback) callback()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if("undefined" != typeof database && database.hasOwnProperty("del_database")){
|
if("undefined" != typeof bt && bt.hasOwnProperty("input_confirm")){
|
||||||
database.del_database = function (wid, dbname,obj, callback) {
|
bt.input_confirm = function (config, callback) {
|
||||||
var title = '',
|
layer.open({
|
||||||
tips = '是否确认【删除数据库】,删除后可能会影响业务使用!';
|
type: 1,
|
||||||
if(obj && obj.db_type > 0) tips = '远程数据库不支持数据库回收站,删除后将无法恢复,请谨慎操作';
|
title: config.title,
|
||||||
title = typeof dbname === "function" ?'批量删除数据库':'删除数据库 [ '+ dbname +' ]';
|
area: '430px',
|
||||||
layer.open({
|
closeBtn: 2,
|
||||||
type:1,
|
shadeClose: true,
|
||||||
title:title,
|
btn: [lan['public'].ok, lan['public'].cancel],
|
||||||
icon:0,
|
content:
|
||||||
skin:'delete_site_layer',
|
'<div class="bt-form hint_confirm pd30">\
|
||||||
area: "530px",
|
<div class="hint_title">\
|
||||||
closeBtn: 2,
|
<i class="hint-confirm-icon"></i>\
|
||||||
shadeClose: true,
|
<div class="hint_con">' +
|
||||||
content:"<div class=\'bt-form webDelete pd30\' id=\'site_delete_form\'>" +
|
config.msg +
|
||||||
"<i class=\'layui-layer-ico layui-layer-ico0\'></i>" +
|
'</div>\
|
||||||
"<div class=\'f13 check_title\' style=\'margin-bottom: 20px;\'>"+tips+"</div>" +
|
</div>\
|
||||||
"<div style=\'color:red;margin:18px 0 18px 18px;font-size:14px;font-weight: bold;\'>注意:数据无价,请谨慎操作!!!"+(!recycle_bin_db_open?'<br>风险操作:当前数据库回收站未开启,删除数据库将永久消失!':'')+"</div>" +
|
</div>',
|
||||||
"</div>",
|
yes: function (layers, index) {
|
||||||
btn:[lan.public.ok,lan.public.cancel],
|
layer.close(layers);
|
||||||
yes:function(indexs){
|
if (callback) callback();
|
||||||
var data = {id: wid,name: dbname};
|
},
|
||||||
if(typeof dbname === "function"){
|
});
|
||||||
delete data.id;
|
}
|
||||||
delete data.name;
|
}
|
||||||
}
|
if("undefined" != typeof database && database.hasOwnProperty("del_database")){
|
||||||
layer.close(indexs)
|
database.del_database = function (wid, dbname,obj, callback) {
|
||||||
var arrs = wid instanceof Array ? wid : [wid]
|
var title = '',
|
||||||
var ids = JSON.stringify(arrs), countDown = 9;
|
tips = '是否确认【删除数据库】,删除后可能会影响业务使用!';
|
||||||
if (arrs.length == 1) countDown = 4
|
if(obj && obj.db_type > 0) tips = '远程数据库不支持数据库回收站,删除后将无法恢复,请谨慎操作';
|
||||||
title = typeof dbname === "function" ?'二次验证信息,批量删除数据库':'二次验证信息,删除数据库 [ ' + dbname + ' ]';
|
title = typeof dbname === "function" ?'批量删除数据库':'删除数据库 [ '+ dbname +' ]';
|
||||||
var loadT = bt.load('正在检测数据库数据信息,请稍后...')
|
layer.open({
|
||||||
|
type:1,
|
||||||
bt_tools.send({url:'database/'+bt.data.db_tab_name+'/check_del_data',data:{data:JSON.stringify({ids: ids})}},function(res){
|
title:title,
|
||||||
loadT.close()
|
icon:0,
|
||||||
layer.open({
|
skin:'delete_site_layer',
|
||||||
type:1,
|
area: "530px",
|
||||||
title:title,
|
closeBtn: 2,
|
||||||
closeBtn: 2,
|
shadeClose: true,
|
||||||
skin: 'verify_site_layer_info',
|
content:"<div class=\'bt-form webDelete pd30\' id=\'site_delete_form\'>" +
|
||||||
area: '740px',
|
"<i class=\'layui-layer-ico layui-layer-ico0\'></i>" +
|
||||||
content: '<div class="check_delete_site_main pd30">' +
|
"<div class=\'f13 check_title\' style=\'margin-bottom: 20px;\'>"+tips+"</div>" +
|
||||||
'<i class="layui-layer-ico layui-layer-ico0"></i>' +
|
"<div style=\'color:red;margin:18px 0 18px 18px;font-size:14px;font-weight: bold;\'>注意:数据无价,请谨慎操作!!!"+(!recycle_bin_db_open?'<br>风险操作:当前数据库回收站未开启,删除数据库将永久消失!':'')+"</div>" +
|
||||||
'<div class="check_layer_title">堡塔温馨提示您,请冷静几秒钟,确认是否要删除以下数据。</div>' +
|
"</div>",
|
||||||
'<div class="check_layer_content">' +
|
btn:[lan.public.ok,lan.public.cancel],
|
||||||
'<div class="check_layer_item">' +
|
yes:function(indexs){
|
||||||
'<div class="check_layer_site"></div>' +
|
var data = {id: wid,name: dbname};
|
||||||
'<div class="check_layer_database"></div>' +
|
if(typeof dbname === "function"){
|
||||||
'</div>' +
|
delete data.id;
|
||||||
'</div>' +
|
delete data.name;
|
||||||
'<div class="check_layer_error ' + (recycle_bin_db_open ? 'hide' : '') + '"><span class="glyphicon glyphicon-info-sign"></span>风险事项:当前未开启数据库回收站功能,删除数据库后,数据库将永久消失!</div>' +
|
}
|
||||||
'<div class="check_layer_message"><span style="color:red">注意:请仔细阅读以上要删除信息,防止数据库被误删</span></div>' +
|
layer.close(indexs)
|
||||||
'</div>',
|
var arrs = wid instanceof Array ? wid : [wid]
|
||||||
btn: ['确认删除', '取消删除'],
|
var ids = JSON.stringify(arrs), countDown = 9;
|
||||||
success: function (layers) {
|
if (arrs.length == 1) countDown = 4
|
||||||
var html = '', rdata = res.data;
|
title = typeof dbname === "function" ?'二次验证信息,批量删除数据库':'二次验证信息,删除数据库 [ ' + dbname + ' ]';
|
||||||
var filterData = rdata.filter(function(el){
|
var loadT = bt.load('正在检测数据库数据信息,请稍后...')
|
||||||
return ids.indexOf(el.id) != -1
|
|
||||||
})
|
bt_tools.send({url:'database/'+bt.data.db_tab_name+'/check_del_data',data:{data:JSON.stringify({ids: ids})}},function(res){
|
||||||
for (var i = 0; i < filterData.length; i++) {
|
loadT.close()
|
||||||
var item = filterData[i], newTime = parseInt(new Date().getTime() / 1000),
|
layer.open({
|
||||||
t_icon = '<span class="glyphicon glyphicon-info-sign" style="color: red;width:15px;height: 15px;;vertical-align: middle;"></span>';
|
type:1,
|
||||||
|
title:title,
|
||||||
database_html = (function(item){
|
closeBtn: 2,
|
||||||
var is_time_rule = (newTime - item.st_time) > (86400 * 30) && (item.total > 1024 * 10),
|
skin: 'verify_site_layer_info',
|
||||||
is_database_rule = res.db_size <= item.total,
|
area: '740px',
|
||||||
database_time = bt.format_data(item.st_time, 'yyyy-MM-dd'),
|
content: '<div class="check_delete_site_main pd30">' +
|
||||||
database_size = bt.format_size(item.total);
|
'<i class="layui-layer-ico layui-layer-ico0"></i>' +
|
||||||
|
'<div class="check_layer_title">堡塔温馨提示您,请冷静几秒钟,确认是否要删除以下数据。</div>' +
|
||||||
var f_size = '<i ' + (is_database_rule ? 'class="warning"' : '') + ' style = "vertical-align: middle;" > ' + database_size + '</i> ' + (is_database_rule ? t_icon : '');
|
'<div class="check_layer_content">' +
|
||||||
var t_size = '注意:此数据库较大,可能为重要数据,请谨慎操作.\n数据库:' + database_size;
|
'<div class="check_layer_item">' +
|
||||||
|
'<div class="check_layer_site"></div>' +
|
||||||
return '<div class="check_layer_database">' +
|
'<div class="check_layer_database"></div>' +
|
||||||
'<span title="数据库:' + item.name + '">数据库:' + item.name + '</span>' +
|
'</div>' +
|
||||||
'<span title="' + t_size+'">大小:' + f_size +'</span>' +
|
'</div>' +
|
||||||
'<span title="' + (is_time_rule && item.total != 0 ? '重要:此数据库创建时间较早,可能为重要数据,请谨慎操作.' : '') + '时间:' + database_time+'">创建时间:<i ' + (is_time_rule && item.total != 0 ? 'class="warning"' : '') + '>' + database_time + '</i></span>' +
|
'<div class="check_layer_error ' + (recycle_bin_db_open ? 'hide' : '') + '"><span class="glyphicon glyphicon-info-sign"></span>风险事项:当前未开启数据库回收站功能,删除数据库后,数据库将永久消失!</div>' +
|
||||||
'</div>'
|
'<div class="check_layer_message"><span style="color:red">注意:请仔细阅读以上要删除信息,防止数据库被误删</span></div>' +
|
||||||
}(item))
|
'</div>',
|
||||||
if(database_html !== '') html += '<div class="check_layer_item">' + database_html +'</div>';
|
btn: ['确认删除', '取消删除'],
|
||||||
}
|
success: function (layers) {
|
||||||
if(html === '') html = '<div style="text-align: center;width: 100%;height: 100%;line-height: 300px;font-size: 15px;">无数据</div>'
|
var html = '', rdata = res.data;
|
||||||
$('.check_layer_content').html(html)
|
var filterData = rdata.filter(function(el){
|
||||||
},
|
return ids.indexOf(el.id) != -1
|
||||||
yes:function(indes,layers){
|
})
|
||||||
if(typeof dbname === "function"){
|
for (var i = 0; i < filterData.length; i++) {
|
||||||
dbname(data)
|
var item = filterData[i], newTime = parseInt(new Date().getTime() / 1000),
|
||||||
}else{
|
t_icon = '<span class="glyphicon glyphicon-info-sign" style="color: red;width:15px;height: 15px;;vertical-align: middle;"></span>';
|
||||||
bt.database.del_database(data, function (rdata) {
|
|
||||||
layer.closeAll()
|
database_html = (function(item){
|
||||||
if (rdata.status) database_table.$refresh_table_list(true);
|
var is_time_rule = (newTime - item.st_time) > (86400 * 30) && (item.total > 1024 * 10),
|
||||||
if (callback) callback(rdata);
|
is_database_rule = res.db_size <= item.total,
|
||||||
bt.msg(rdata);
|
database_time = bt.format_data(item.st_time, 'yyyy-MM-dd'),
|
||||||
})
|
database_size = bt.format_size(item.total);
|
||||||
}
|
|
||||||
}
|
var f_size = '<i ' + (is_database_rule ? 'class="warning"' : '') + ' style = "vertical-align: middle;" > ' + database_size + '</i> ' + (is_database_rule ? t_icon : '');
|
||||||
})
|
var t_size = '注意:此数据库较大,可能为重要数据,请谨慎操作.\n数据库:' + database_size;
|
||||||
})
|
|
||||||
}
|
return '<div class="check_layer_database">' +
|
||||||
})
|
'<span title="数据库:' + item.name + '">数据库:' + item.name + '</span>' +
|
||||||
}
|
'<span title="' + t_size+'">大小:' + f_size +'</span>' +
|
||||||
}
|
'<span title="' + (is_time_rule && item.total != 0 ? '重要:此数据库创建时间较早,可能为重要数据,请谨慎操作.' : '') + '时间:' + database_time+'">创建时间:<i ' + (is_time_rule && item.total != 0 ? 'class="warning"' : '') + '>' + database_time + '</i></span>' +
|
||||||
if("undefined" != typeof site && site.hasOwnProperty("del_site")){
|
'</div>'
|
||||||
site.del_site = function(wid, wname, callback) {
|
}(item))
|
||||||
var title = typeof wname === "function" ? '批量删除站点' : '删除站点 [ ' + wname + ' ]';
|
if(database_html !== '') html += '<div class="check_layer_item">' + database_html +'</div>';
|
||||||
recycle_bin_open = bt.get_cookie("is_recycle") || bt.get_cookie("is_recycle") == null ? true : false
|
}
|
||||||
layer.open({
|
if(html === '') html = '<div style="text-align: center;width: 100%;height: 100%;line-height: 300px;font-size: 15px;">无数据</div>'
|
||||||
type: 1,
|
$('.check_layer_content').html(html)
|
||||||
title: title,
|
},
|
||||||
icon: 0,
|
yes:function(indes,layers){
|
||||||
skin: 'delete_site_layer',
|
if(typeof dbname === "function"){
|
||||||
area: "440px",
|
dbname(data)
|
||||||
closeBtn: 2,
|
}else{
|
||||||
shadeClose: true,
|
bt.database.del_database(data, function (rdata) {
|
||||||
content: "<div class=\'bt-form webDelete pd30\' id=\'site_delete_form\'>" +
|
layer.closeAll()
|
||||||
'<i class="layui-layer-ico layui-layer-ico0"></i>' +
|
if (rdata.status) database_table.$refresh_table_list(true);
|
||||||
"<div class=\'f13 check_title\'>是否要删除关联的FTP、数据库、站点目录!</div>" +
|
if (callback) callback(rdata);
|
||||||
"<div class=\"check_type_group\">" +
|
bt.msg(rdata);
|
||||||
"<label><input type=\"checkbox\" name=\"ftp\"><span>FTP</span></label>" +
|
})
|
||||||
"<label><input type=\"checkbox\" name=\"database\"><span>数据库</span>" + (!recycle_bin_db_open ? '<span class="glyphicon glyphicon-info-sign" style="color: red"></span>' : '') + "</label>" +
|
}
|
||||||
"<label><input type=\"checkbox\" name=\"path\"><span>站点目录</span>" + (!recycle_bin_open ? '<span class="glyphicon glyphicon-info-sign" style="color: red"></span>' : '') + "</label>" +
|
}
|
||||||
"</div>" +
|
})
|
||||||
"</div>",
|
})
|
||||||
btn: [lan.public.ok, lan.public.cancel],
|
}
|
||||||
success: function (layers, indexs) {
|
})
|
||||||
$(layers).find('.check_type_group label').hover(function () {
|
}
|
||||||
var name = $(this).find('input').attr('name');
|
}
|
||||||
if (name === 'data' && !recycle_bin_db_open) {
|
if("undefined" != typeof site && site.hasOwnProperty("del_site")){
|
||||||
layer.tips('风险操作:当前数据库回收站未开启,删除数据库将永久消失!', this, { tips: [1, 'red'], time: 0 })
|
site.del_site = function(wid, wname, callback) {
|
||||||
} else if (name === 'path' && !recycle_bin_open) {
|
var title = typeof wname === "function" ? '批量删除站点' : '删除站点 [ ' + wname + ' ]';
|
||||||
layer.tips('风险操作:当前文件回收站未开启,删除站点目录将永久消失!', this, { tips: [1, 'red'], time: 0 })
|
recycle_bin_open = bt.get_cookie("is_recycle") || bt.get_cookie("is_recycle") == null ? true : false
|
||||||
}
|
layer.open({
|
||||||
}, function () {
|
type: 1,
|
||||||
layer.closeAll('tips');
|
title: title,
|
||||||
})
|
icon: 0,
|
||||||
},
|
skin: 'delete_site_layer',
|
||||||
yes: function (indexs) {
|
area: "440px",
|
||||||
var data = { id: wid, webname: wname };
|
closeBtn: 2,
|
||||||
$('#site_delete_form input[type=checkbox]').each(function (index, item) {
|
shadeClose: true,
|
||||||
if ($(item).is(':checked')) data[$(item).attr('name')] = 1
|
content: "<div class=\'bt-form webDelete pd30\' id=\'site_delete_form\'>" +
|
||||||
})
|
'<i class="layui-layer-ico layui-layer-ico0"></i>' +
|
||||||
var is_database = data.hasOwnProperty('database'), is_path = data.hasOwnProperty('path'), is_ftp = data.hasOwnProperty('ftp');
|
"<div class=\'f13 check_title\'>是否要删除关联的FTP、数据库、站点目录!</div>" +
|
||||||
if ((!is_database && !is_path) && (!is_ftp || is_ftp)) {
|
"<div class=\"check_type_group\">" +
|
||||||
if (typeof wname === "function") {
|
"<label><input type=\"checkbox\" name=\"ftp\"><span>FTP</span></label>" +
|
||||||
wname(data)
|
"<label><input type=\"checkbox\" name=\"database\"><span>数据库</span>" + (!recycle_bin_db_open ? '<span class="glyphicon glyphicon-info-sign" style="color: red"></span>' : '') + "</label>" +
|
||||||
return false;
|
"<label><input type=\"checkbox\" name=\"path\"><span>站点目录</span>" + (!recycle_bin_open ? '<span class="glyphicon glyphicon-info-sign" style="color: red"></span>' : '') + "</label>" +
|
||||||
}
|
"</div>" +
|
||||||
bt.site.del_site(data, function (rdata) {
|
"</div>",
|
||||||
layer.close(indexs);
|
btn: [lan.public.ok, lan.public.cancel],
|
||||||
if (callback) callback(rdata);
|
success: function (layers, indexs) {
|
||||||
bt.msg(rdata);
|
$(layers).find('.check_type_group label').hover(function () {
|
||||||
})
|
var name = $(this).find('input').attr('name');
|
||||||
return false
|
if (name === 'data' && !recycle_bin_db_open) {
|
||||||
}
|
layer.tips('风险操作:当前数据库回收站未开启,删除数据库将永久消失!', this, { tips: [1, 'red'], time: 0 })
|
||||||
if (typeof wname === "function") {
|
} else if (name === 'path' && !recycle_bin_open) {
|
||||||
delete data.id;
|
layer.tips('风险操作:当前文件回收站未开启,删除站点目录将永久消失!', this, { tips: [1, 'red'], time: 0 })
|
||||||
delete data.webname;
|
}
|
||||||
}
|
}, function () {
|
||||||
layer.close(indexs)
|
layer.closeAll('tips');
|
||||||
var arrs = wid instanceof Array ? wid : [wid]
|
})
|
||||||
var ids = JSON.stringify(arrs), countDown = 9;
|
},
|
||||||
if (arrs.length == 1) countDown = 4
|
yes: function (indexs) {
|
||||||
title = typeof wname === "function" ? '二次验证信息,批量删除站点' : '二次验证信息,删除站点 [ ' + wname + ' ]';
|
var data = { id: wid, webname: wname };
|
||||||
var loadT = bt.load('正在检测站点数据信息,请稍后...')
|
$('#site_delete_form input[type=checkbox]').each(function (index, item) {
|
||||||
bt.send('check_del_data', 'site/check_del_data', { ids: ids }, function (res) {
|
if ($(item).is(':checked')) data[$(item).attr('name')] = 1
|
||||||
loadT.close()
|
})
|
||||||
layer.open({
|
var is_database = data.hasOwnProperty('database'), is_path = data.hasOwnProperty('path'), is_ftp = data.hasOwnProperty('ftp');
|
||||||
type: 1,
|
if ((!is_database && !is_path) && (!is_ftp || is_ftp)) {
|
||||||
title: title,
|
if (typeof wname === "function") {
|
||||||
closeBtn: 2,
|
wname(data)
|
||||||
skin: 'verify_site_layer_info',
|
return false;
|
||||||
area: '740px',
|
}
|
||||||
content: '<div class="check_delete_site_main pd30">' +
|
bt.site.del_site(data, function (rdata) {
|
||||||
'<i class="layui-layer-ico layui-layer-ico0"></i>' +
|
layer.close(indexs);
|
||||||
'<div class="check_layer_title">堡塔温馨提示您,请冷静几秒钟,确认以下要删除的数据。</div>' +
|
if (callback) callback(rdata);
|
||||||
'<div class="check_layer_content">' +
|
bt.msg(rdata);
|
||||||
'<div class="check_layer_item">' +
|
})
|
||||||
'<div class="check_layer_site"></div>' +
|
return false
|
||||||
'<div class="check_layer_database"></div>' +
|
}
|
||||||
'</div>' +
|
if (typeof wname === "function") {
|
||||||
'</div>' +
|
delete data.id;
|
||||||
'<div class="check_layer_error ' + (data.database && recycle_bin_db_open ? 'hide' : '') + '"><span class="glyphicon glyphicon-info-sign"></span>风险事项:当前未开启数据库回收站功能,删除数据库后,数据库将永久消失!</div>' +
|
delete data.webname;
|
||||||
'<div class="check_layer_error ' + (data.path && recycle_bin_open ? 'hide' : '') + '"><span class="glyphicon glyphicon-info-sign"></span>风险事项:当前未开启文件回收站功能,删除站点目录后,站点目录将永久消失!</div>' +
|
}
|
||||||
'<div class="check_layer_message"><span style="color:red">注意:请仔细阅读以上要删除信息,防止网站数据被误删</span></div>' +
|
layer.close(indexs)
|
||||||
'</div>',
|
var arrs = wid instanceof Array ? wid : [wid]
|
||||||
// recycle_bin_db_open &&
|
var ids = JSON.stringify(arrs), countDown = 9;
|
||||||
// recycle_bin_open &&
|
if (arrs.length == 1) countDown = 4
|
||||||
btn: ['确认删除', '取消删除'],
|
title = typeof wname === "function" ? '二次验证信息,批量删除站点' : '二次验证信息,删除站点 [ ' + wname + ' ]';
|
||||||
success: function (layers) {
|
var loadT = bt.load('正在检测站点数据信息,请稍后...')
|
||||||
var html = '', rdata = res.data;
|
bt.send('check_del_data', 'site/check_del_data', { ids: ids }, function (res) {
|
||||||
for (var i = 0; i < rdata.length; i++) {
|
loadT.close()
|
||||||
var item = rdata[i], newTime = parseInt(new Date().getTime() / 1000),
|
layer.open({
|
||||||
t_icon = '<span class="glyphicon glyphicon-info-sign" style="color: red;width:15px;height: 15px;;vertical-align: middle;"></span>';
|
type: 1,
|
||||||
|
title: title,
|
||||||
site_html = (function (item) {
|
closeBtn: 2,
|
||||||
if (!is_path) return ''
|
skin: 'verify_site_layer_info',
|
||||||
var is_time_rule = (newTime - item.st_time) > (86400 * 30) && (item.total > 1024 * 10),
|
area: '740px',
|
||||||
is_path_rule = res.file_size <= item.total,
|
content: '<div class="check_delete_site_main pd30">' +
|
||||||
dir_time = bt.format_data(item.st_time, 'yyyy-MM-dd'),
|
'<i class="layui-layer-ico layui-layer-ico0"></i>' +
|
||||||
dir_size = bt.format_size(item.total);
|
'<div class="check_layer_title">堡塔温馨提示您,请冷静几秒钟,确认以下要删除的数据。</div>' +
|
||||||
|
'<div class="check_layer_content">' +
|
||||||
var f_html = '<i ' + (is_path_rule ? 'class="warning"' : '') + ' style = "vertical-align: middle;" > ' + dir_size + '</i> ' + (is_path_rule ? t_icon : '');
|
'<div class="check_layer_item">' +
|
||||||
var f_title = (is_path_rule ? '注意:此目录较大,可能为重要数据,请谨慎操作.\n' : '') + '目录:' + item.path + '(' + (item.limit ? '大于' : '') + dir_size + ')';
|
'<div class="check_layer_site"></div>' +
|
||||||
|
'<div class="check_layer_database"></div>' +
|
||||||
return '<div class="check_layer_site">' +
|
'</div>' +
|
||||||
'<span title="站点:' + item.name + '">站点名:' + item.name + '</span>' +
|
'</div>' +
|
||||||
'<span title="' + f_title + '" >目录:<span style="vertical-align: middle;max-width: 160px;width: auto;">' + item.path + '</span> (' + f_html + ')</span>' +
|
'<div class="check_layer_error ' + (data.database && recycle_bin_db_open ? 'hide' : '') + '"><span class="glyphicon glyphicon-info-sign"></span>风险事项:当前未开启数据库回收站功能,删除数据库后,数据库将永久消失!</div>' +
|
||||||
'<span title="' + (is_time_rule ? '注意:此站点创建时间较早,可能为重要数据,请谨慎操作.\n' : '') + '时间:' + dir_time + '">创建时间:<i ' + (is_time_rule ? 'class="warning"' : '') + '>' + dir_time + '</i></span>' +
|
'<div class="check_layer_error ' + (data.path && recycle_bin_open ? 'hide' : '') + '"><span class="glyphicon glyphicon-info-sign"></span>风险事项:当前未开启文件回收站功能,删除站点目录后,站点目录将永久消失!</div>' +
|
||||||
'</div>'
|
'<div class="check_layer_message"><span style="color:red">注意:请仔细阅读以上要删除信息,防止网站数据被误删</span></div>' +
|
||||||
}(item)),
|
'</div>',
|
||||||
database_html = (function (item) {
|
// recycle_bin_db_open &&
|
||||||
if (!is_database || !item.database) return '';
|
// recycle_bin_open &&
|
||||||
var is_time_rule = (newTime - item.st_time) > (86400 * 30) && (item.total > 1024 * 10),
|
btn: ['确认删除', '取消删除'],
|
||||||
is_database_rule = res.db_size <= item.database.total,
|
success: function (layers) {
|
||||||
database_time = bt.format_data(item.database.st_time, 'yyyy-MM-dd'),
|
var html = '', rdata = res.data;
|
||||||
database_size = bt.format_size(item.database.total);
|
for (var i = 0; i < rdata.length; i++) {
|
||||||
|
var item = rdata[i], newTime = parseInt(new Date().getTime() / 1000),
|
||||||
var f_size = '<i ' + (is_database_rule ? 'class="warning"' : '') + ' style = "vertical-align: middle;" > ' + database_size + '</i> ' + (is_database_rule ? t_icon : '');
|
t_icon = '<span class="glyphicon glyphicon-info-sign" style="color: red;width:15px;height: 15px;;vertical-align: middle;"></span>';
|
||||||
var t_size = '注意:此数据库较大,可能为重要数据,请谨慎操作.\n数据库:' + database_size;
|
|
||||||
|
site_html = (function (item) {
|
||||||
return '<div class="check_layer_database">' +
|
if (!is_path) return ''
|
||||||
'<span title="数据库:' + item.database.name + '">数据库:' + item.database.name + '</span>' +
|
var is_time_rule = (newTime - item.st_time) > (86400 * 30) && (item.total > 1024 * 10),
|
||||||
'<span title="' + t_size + '">大小:' + f_size + '</span>' +
|
is_path_rule = res.file_size <= item.total,
|
||||||
'<span title="' + (is_time_rule && item.database.total != 0 ? '重要:此数据库创建时间较早,可能为重要数据,请谨慎操作.' : '') + '时间:' + database_time + '">创建时间:<i ' + (is_time_rule && item.database.total != 0 ? 'class="warning"' : '') + '>' + database_time + '</i></span>' +
|
dir_time = bt.format_data(item.st_time, 'yyyy-MM-dd'),
|
||||||
'</div>'
|
dir_size = bt.format_size(item.total);
|
||||||
}(item))
|
|
||||||
if ((site_html + database_html) !== '') html += '<div class="check_layer_item">' + site_html + database_html + '</div>';
|
var f_html = '<i ' + (is_path_rule ? 'class="warning"' : '') + ' style = "vertical-align: middle;" > ' + dir_size + '</i> ' + (is_path_rule ? t_icon : '');
|
||||||
}
|
var f_title = (is_path_rule ? '注意:此目录较大,可能为重要数据,请谨慎操作.\n' : '') + '目录:' + item.path + '(' + (item.limit ? '大于' : '') + dir_size + ')';
|
||||||
if (html === '') html = '<div style="text-align: center;width: 100%;height: 100%;line-height: 300px;font-size: 15px;">无数据</div>'
|
|
||||||
$('.check_layer_content').html(html)
|
return '<div class="check_layer_site">' +
|
||||||
},
|
'<span title="站点:' + item.name + '">站点名:' + item.name + '</span>' +
|
||||||
yes: function (indes, layers) {
|
'<span title="' + f_title + '" >目录:<span style="vertical-align: middle;max-width: 160px;width: auto;">' + item.path + '</span> (' + f_html + ')</span>' +
|
||||||
if (typeof wname === "function") {
|
'<span title="' + (is_time_rule ? '注意:此站点创建时间较早,可能为重要数据,请谨慎操作.\n' : '') + '时间:' + dir_time + '">创建时间:<i ' + (is_time_rule ? 'class="warning"' : '') + '>' + dir_time + '</i></span>' +
|
||||||
wname(data)
|
'</div>'
|
||||||
} else {
|
}(item)),
|
||||||
bt.site.del_site(data, function (rdata) {
|
database_html = (function (item) {
|
||||||
layer.closeAll()
|
if (!is_database || !item.database) return '';
|
||||||
if (rdata.status) site.get_list();
|
var is_time_rule = (newTime - item.st_time) > (86400 * 30) && (item.total > 1024 * 10),
|
||||||
if (callback) callback(rdata);
|
is_database_rule = res.db_size <= item.database.total,
|
||||||
bt.msg(rdata);
|
database_time = bt.format_data(item.database.st_time, 'yyyy-MM-dd'),
|
||||||
})
|
database_size = bt.format_size(item.database.total);
|
||||||
}
|
|
||||||
}
|
var f_size = '<i ' + (is_database_rule ? 'class="warning"' : '') + ' style = "vertical-align: middle;" > ' + database_size + '</i> ' + (is_database_rule ? t_icon : '');
|
||||||
})
|
var t_size = '注意:此数据库较大,可能为重要数据,请谨慎操作.\n数据库:' + database_size;
|
||||||
})
|
|
||||||
}
|
return '<div class="check_layer_database">' +
|
||||||
})
|
'<span title="数据库:' + item.database.name + '">数据库:' + item.database.name + '</span>' +
|
||||||
if(bt.get_cookie("is_recycle") || bt.get_cookie("is_recycle")==null){
|
'<span title="' + t_size + '">大小:' + f_size + '</span>' +
|
||||||
$('[name="path"]').attr('checked',true)
|
'<span title="' + (is_time_rule && item.database.total != 0 ? '重要:此数据库创建时间较早,可能为重要数据,请谨慎操作.' : '') + '时间:' + database_time + '">创建时间:<i ' + (is_time_rule && item.database.total != 0 ? 'class="warning"' : '') + '>' + database_time + '</i></span>' +
|
||||||
}else{
|
'</div>'
|
||||||
$('[name="path"]').removeProp('checked');
|
}(item))
|
||||||
}
|
if ((site_html + database_html) !== '') html += '<div class="check_layer_item">' + site_html + database_html + '</div>';
|
||||||
}
|
}
|
||||||
}
|
if (html === '') html = '<div style="text-align: center;width: 100%;height: 100%;line-height: 300px;font-size: 15px;">无数据</div>'
|
||||||
if("undefined" != typeof bt && bt.hasOwnProperty("firewall") && bt.firewall.hasOwnProperty("add_accept_port")){
|
$('.check_layer_content').html(html)
|
||||||
bt.firewall.add_accept_port = function(type, port, ps, callback) {
|
},
|
||||||
var action = "AddDropAddress";
|
yes: function (indes, layers) {
|
||||||
if (type == 'port') {
|
if (typeof wname === "function") {
|
||||||
ports = port.split(':');
|
wname(data)
|
||||||
if (port.indexOf('-') != -1) ports = port.split('-');
|
} else {
|
||||||
for (var i = 0; i < ports.length; i++) {
|
bt.site.del_site(data, function (rdata) {
|
||||||
if (!bt.check_port(ports[i])) {
|
layer.closeAll()
|
||||||
layer.msg(lan.firewall.port_err, { icon: 5 });
|
if (rdata.status) site.get_list();
|
||||||
return;
|
if (callback) callback(rdata);
|
||||||
}
|
bt.msg(rdata);
|
||||||
}
|
})
|
||||||
action = "AddAcceptPort";
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
loading = bt.load();
|
})
|
||||||
bt.send(action, 'firewall/' + action, { port: port, type: type, ps: ps }, function(rdata) {
|
}
|
||||||
loading.close();
|
})
|
||||||
if (callback) callback(rdata);
|
if(bt.get_cookie("is_recycle") || bt.get_cookie("is_recycle")==null){
|
||||||
})
|
$('[name="path"]').attr('checked',true)
|
||||||
}
|
}else{
|
||||||
}
|
$('[name="path"]').removeProp('checked');
|
||||||
function SafeMessage(j, h, g, f) {
|
}
|
||||||
if(f == undefined) {
|
}
|
||||||
f = ""
|
}
|
||||||
}
|
if("undefined" != typeof bt && bt.hasOwnProperty("firewall") && bt.firewall.hasOwnProperty("add_accept_port")){
|
||||||
var mess = layer.open({
|
bt.firewall.add_accept_port = function(type, port, ps, callback) {
|
||||||
type: 1,
|
var action = "AddDropAddress";
|
||||||
title: j,
|
if (type == 'port') {
|
||||||
area: "350px",
|
ports = port.split(':');
|
||||||
closeBtn: 2,
|
if (port.indexOf('-') != -1) ports = port.split('-');
|
||||||
shadeClose: true,
|
for (var i = 0; i < ports.length; i++) {
|
||||||
content: "<div class='bt-form webDelete pd20 pb70'><p>" + h + "</p>" + f + "<div class='bt-form-submit-btn'><button type='button' class='btn btn-danger btn-sm bt-cancel'>"+lan.public.cancel+"</button> <button type='button' id='toSubmit' class='btn btn-success btn-sm' >"+lan.public.ok+"</button></div></div>"
|
if (!bt.check_port(ports[i])) {
|
||||||
});
|
layer.msg(lan.firewall.port_err, { icon: 5 });
|
||||||
$(".bt-cancel").click(function(){
|
return;
|
||||||
layer.close(mess);
|
}
|
||||||
});
|
}
|
||||||
$("#toSubmit").click(function() {
|
action = "AddAcceptPort";
|
||||||
layer.close(mess);
|
}
|
||||||
g();
|
|
||||||
})
|
loading = bt.load();
|
||||||
}
|
bt.send(action, 'firewall/' + action, { port: port, type: type, ps: ps }, function(rdata) {
|
||||||
$(document).ready(function () {
|
loading.close();
|
||||||
if($('#updata_pro_info').length>0){
|
if (callback) callback(rdata);
|
||||||
$('#updata_pro_info').html('');
|
})
|
||||||
bt.set_cookie('productPurchase', 1);
|
}
|
||||||
}
|
}
|
||||||
|
function SafeMessage(j, h, g, f) {
|
||||||
|
if(f == undefined) {
|
||||||
|
f = ""
|
||||||
|
}
|
||||||
|
var mess = layer.open({
|
||||||
|
type: 1,
|
||||||
|
title: j,
|
||||||
|
area: "350px",
|
||||||
|
closeBtn: 2,
|
||||||
|
shadeClose: true,
|
||||||
|
content: "<div class='bt-form webDelete pd20 pb70'><p>" + h + "</p>" + f + "<div class='bt-form-submit-btn'><button type='button' class='btn btn-danger btn-sm bt-cancel'>"+lan.public.cancel+"</button> <button type='button' id='toSubmit' class='btn btn-success btn-sm' >"+lan.public.ok+"</button></div></div>"
|
||||||
|
});
|
||||||
|
$(".bt-cancel").click(function(){
|
||||||
|
layer.close(mess);
|
||||||
|
});
|
||||||
|
$("#toSubmit").click(function() {
|
||||||
|
layer.close(mess);
|
||||||
|
g();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
$(document).ready(function () {
|
||||||
|
if($('#updata_pro_info').length>0){
|
||||||
|
$('#updata_pro_info').html('');
|
||||||
|
bt.set_cookie('productPurchase', 1);
|
||||||
|
}
|
||||||
})
|
})
|
@ -16,6 +16,8 @@ Windows版宝塔由于加密文件太多,无法全部解密,因此无法做
|
|||||||
|
|
||||||
- 全局搜索替换 https://www.bt.cn/api/ => http://www.example.com/api/(需排除ipsModel.py)
|
- 全局搜索替换 https://www.bt.cn/api/ => http://www.example.com/api/(需排除ipsModel.py)
|
||||||
|
|
||||||
|
- 全局搜索替换 http://www.bt.cn/api/ => http://www.example.com/api/
|
||||||
|
|
||||||
- 全局搜索替换 https://download.bt.cn/win/panel/data/setup.py => http://www.example.com/win/panel/data/setup.py
|
- 全局搜索替换 https://download.bt.cn/win/panel/data/setup.py => http://www.example.com/win/panel/data/setup.py
|
||||||
|
|
||||||
- class/panel_update.py 文件 public.get_url() => 'http://www.example.com'
|
- class/panel_update.py 文件 public.get_url() => 'http://www.example.com'
|
||||||
|
Loading…
Reference in New Issue
Block a user