/*
*宝塔面板去除各种计算题与延时等待
*/
if("undefined" != typeof bt && bt.hasOwnProperty("show_confirm")){
bt.show_confirm = function(title, msg, fun, error) {
if (error == undefined) {
error = ""
}
var mess = layer.open({
type: 1,
title: title,
area: "350px",
closeBtn: 2,
shadeClose: true,
content: "
"
});
$(".bt-cancel").click(function () {
layer.close(mess);
});
$("#toSubmit").click(function () {
layer.close(mess);
fun();
})
}
}
if("undefined" != typeof bt && bt.hasOwnProperty("prompt_confirm")){
bt.prompt_confirm = function (title, msg, callback) {
layer.open({
type: 1,
title: title,
area: "350px",
closeBtn: 2,
btn: ['确认', '取消'],
content: "",
yes: function (layers, index) {
layer.close(layers)
if (callback) callback()
}
});
}
}
if("undefined" != typeof database && database.hasOwnProperty("del_database")){
database.del_database = function (wid, dbname,obj, callback) {
var tips = '是否确认【删除数据库】,删除后可能会影响业务使用!';
if(obj && obj.db_type > 0) tips = '远程数据库不支持数据库回收站,删除后将无法恢复,请谨慎操作';
var title = typeof dbname === "function" ?'批量删除数据库':'删除数据库 [ '+ dbname +' ]';
layer.open({
type:1,
title:title,
icon:0,
skin:'delete_site_layer',
area: "530px",
closeBtn: 2,
shadeClose: true,
content:"",
btn:[lan.public.ok,lan.public.cancel],
yes:function(indexs){
var data = {id: wid,name: dbname};
if(typeof dbname === "function"){
delete data.id;
delete data.name;
}
layer.close(indexs)
if(typeof dbname === "function"){
dbname(data)
}else{
bt.database.del_database(data, function (rdata) {
layer.closeAll()
if (rdata.status) database_table.$refresh_table_list(true);
if (callback) callback(rdata);
bt.msg(rdata);
})
}
}
})
}
}
if("undefined" != typeof site && site.hasOwnProperty("del_site")){
site.del_site = function(wid, wname, callback) {
var title = typeof wname === "function" ?'批量删除站点':'删除站点 [ '+ wname +' ]';
layer.open({
type:1,
title:title,
icon:0,
skin:'delete_site_layer',
area: "440px",
closeBtn: 2,
shadeClose: true,
content:"",
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) {
layer.tips('风险操作:当前数据库回收站未开启,删除数据库将永久消失!', this, { tips: [1, 'red'], time: 0 })
} else if (name === 'path' && !recycle_bin_open) {
layer.tips('风险操作:当前文件回收站未开启,删除站点目录将永久消失!', this, { tips: [1, 'red'], time: 0 })
}
}, function () {
layer.closeAll('tips');
})
},
yes:function(indexs){
var data = {id: wid,webname: wname};
$('#site_delete_form input[type=checkbox]').each(function (index, item) {
if($(item).is(':checked')) data[$(item).attr('name')] = 1
})
var is_database = data.hasOwnProperty('database'),is_path = data.hasOwnProperty('path'),is_ftp = data.hasOwnProperty('ftp');
if((!is_database && !is_path) && (!is_ftp || is_ftp)){
if(typeof wname === "function"){
wname(data)
return false;
}
bt.site.del_site(data, function (rdata) {
layer.close(indexs);
if (callback) callback(rdata);
bt.msg(rdata);
})
return false
}
if(typeof wname === "function"){
delete data.id;
delete data.webname;
}
layer.close(indexs)
if(typeof wname === "function"){
console.log(data)
wname(data)
}else{
bt.site.del_site(data, function (rdata) {
layer.closeAll()
if (rdata.status) site.get_list();
if (callback) callback(rdata);
bt.msg(rdata);
})
}
}
})
}
}
if("undefined" != typeof bt && bt.hasOwnProperty("firewall") && bt.firewall.hasOwnProperty("add_accept_port")){
bt.firewall.add_accept_port = function(type, port, ps, callback) {
var action = "AddDropAddress";
if (type == 'port') {
ports = port.split(':');
if (port.indexOf('-') != -1) ports = port.split('-');
for (var i = 0; i < ports.length; i++) {
if (!bt.check_port(ports[i])) {
layer.msg(lan.firewall.port_err, { icon: 5 });
return;
}
}
action = "AddAcceptPort";
}
loading = bt.load();
bt.send(action, 'firewall/' + action, { port: port, type: type, ps: ps }, function(rdata) {
loading.close();
if (callback) callback(rdata);
})
}
}
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: ""
});
$(".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);
}
})