/* *宝塔面板去除各种计算题与延时等待 */ if("undefined" != typeof bt && bt.hasOwnProperty("show_confirm")){ bt.show_confirm = function(title, msg, callback, error) { layer.open({ type: 1, title: title, area: "365px", closeBtn: 2, shadeClose: true, btn: [lan['public'].ok, lan['public'].cancel], content: "
\

" + msg + "

" + (error || '') + "\
", yes: function (index, layero) { layer.close(index); if (callback) callback(); } }); } } 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: "
\

" + msg + "

\
", yes: function (layers, index) { layer.close(layers) if (callback) callback() } }); } } if("undefined" != typeof bt && bt.hasOwnProperty("compute_confirm")){ bt.compute_confirm = function (config, callback) { layer.open({ type: 1, title: config.title, area: '430px', closeBtn: 2, shadeClose: true, btn: [lan['public'].ok, lan['public'].cancel], content: '
\
\ \
' + config.msg + '
\
\
', yes: function (layers, index) { layer.close(layers) if (callback) callback() } }); } } if("undefined" != typeof bt && bt.hasOwnProperty("input_confirm")){ bt.input_confirm = function (config, callback) { layer.open({ type: 1, title: config.title, area: '430px', closeBtn: 2, shadeClose: true, btn: [lan['public'].ok, lan['public'].cancel], content: '
\
\ \
' + config.msg + '
\
\
', 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 is_db_type = false, del_data = [] if (typeof wid === 'object') { del_data = wid is_db_type = wid.some(function (item) { return item.db_type > 0 }) var ids = []; for (var i = 0; i < wid.length; i++) { ids.push(wid[i].id); } wid = ids } var type = $('.database-pos .tabs-item.active').data('type'), title = '', tips = ''; title = typeof dbname === "function" ? '批量删除数据库' : '删除数据库 - [ ' + dbname + ' ]'; tips = is_db_type || !recycle_bin_db_open || type !== 'mysql' ? '当前列表存在彻底删除后无法恢复的数据库,请仔细查看列表,以防误删,是否继续操作?' : '当前列表数据库将迁移至数据库回收站,如需彻底删除请前往数据库回收站,是否继续操作?' var arrs = wid instanceof Array ? wid : [wid] var ids = JSON.stringify(arrs), countDown = 9; if (arrs.length == 1) countDown = 4 var loadT = bt.load('正在检测数据库数据信息,请稍候...'), param = { url: 'database/' + bt.data.db_tab_name + '/check_del_data', data: { data: JSON.stringify({ ids: ids }) } } if (bt.data.db_tab_name == 'mysql') param = { url: 'database?action=check_del_data', data: { ids: ids } } bt_tools.send(param, function (res) { loadT.close() layer.open({ type: 1, title: title, area: '740px', skin: 'verify_site_layer_info', closeBtn: 2, shadeClose: true, content: '
' + "
\ \
"+ tips + "
\
"+ '
' + '
' + '
' + (is_db_type ? '注意:远程数据库暂不支持数据库回收站,选中的数据库将彻底删除
' : '') + (!recycle_bin_db_open ? '风险操作:当前数据库回收站未开启,删除数据库将永久消失
' : '') + '请仔细阅读以上要删除信息,防止数据库被误删
' + '
', btn: ['下一步', lan.public.cancel], success: function (layers) { setTimeout(function () { $(layers).css('top', ($(window).height() - $(layers).height()) / 2); }, 50) var rdata = res.data, newTime = parseInt(new Date().getTime() / 1000), t_icon = ' '; for (var j = 0; j < rdata.length; j++) { for (var i = 0; i < del_data.length; i++) { if (rdata[j].id == del_data[i].id) { var is_time_rule = (newTime - rdata[j].st_time) > (86400 * 30) && (rdata[j].total > 1024 * 10), is_database_rule = res.db_size <= rdata[j].total, database_time = bt.format_data(rdata[j].st_time, 'yyyy-MM-dd'), database_size = bt.format_size(rdata[j].total); var f_size = database_size var t_size = '注意:此数据库较大,可能为重要数据,请谨慎操作.\n数据库:' + database_size; if (rdata[j].total < 2048) t_size = '注意事项:当前数据库不为空,可能为重要数据,请谨慎操作.\n数据库:' + database_size; if (rdata[j].total === 0) t_size = ''; rdata[j]['t_size'] = t_size rdata[j]['f_size'] = f_size rdata[j]['database_time'] = database_time rdata[j]['is_time_rule'] = is_time_rule rdata[j]['is_database_rule'] = is_database_rule rdata[j]['db_type'] = del_data[i].db_type rdata[j]['conn_config'] = del_data[i].conn_config } } } var filterData = rdata.filter(function (el) { return ids.indexOf(el.id) != -1 }) bt_tools.table({ el: '#check_layer_content', data: filterData, height: '300px', column: [ { fid: 'name', title: '数据库名称' }, { title: '数据库大小', template: function (row) { return '' + row.f_size + (row.is_database_rule ? t_icon : '') + '' } }, { title: '数据库位置', template: function (row) { var type_column = '-' switch (row.db_type) { case 0: type_column = '本地数据库' break; case 1: case 2: type_column = '远程数据库' break; } return '' + type_column + '' } }, { title: '创建时间', template: function (row) { return '' + row.database_time + '' } }, { title: '删除结果', align: 'right', template: function (row, index, ev, _that) { var _html = '' switch (row.db_type) { case 0: _html = type !== 'mysql' ? '彻底删除' : (!recycle_bin_db_open ? '彻底删除' : '移至回收站') break; case 1: case 2: _html = '彻底删除' break; } return '' + _html + '' } } ], success: function () { $('#check_layer_content').find('.glyphicon-info-sign').click(function (e) { var msg = $(this).parent().prop('title') msg = msg.replace('数据库:','
数据库:') layer.tips(msg, $(this).parent(), { tips: [1, 'red'], time: 3000 }) $(document).click(function (ev) { layer.closeAll('tips'); $(this).unbind('click'); ev.stopPropagation(); ev.preventDefault(); }); e.stopPropagation(); e.preventDefault(); }); if ($('.remote_database').length) { $('.remote_database').each(function (index, el) { var id = $(el).parent().parent().parent().index() $('#check_layer_content tbody tr').eq(id).css('background-color', '#ff00000a') }) } } }) }, yes: function (indes, layers) { title = typeof dbname === "function" ? '二次验证信息,批量删除数据库' : '二次验证信息,删除数据库 - [ ' + dbname + ' ]'; if (type !== 'mysql') { tips = '当前数据库暂不支持数据库回收站,删除后将无法恢复,此操作不可逆,是否继续操作?'; } else { tips = is_db_type ? '远程数据库不支持数据库回收站,删除后将无法恢复,此操作不可逆,是否继续操作?' : recycle_bin_db_open ? '删除后如需彻底删除请前往数据库回收站,是否继续操作?' : '删除后可能会影响业务使用,此操作不可逆,是否继续操作?' } layer.open({ type: 1, title: title, icon: 0, skin: 'delete_site_layer', area: "530px", closeBtn: 2, shadeClose: true, content: "
" + "
\ \
"+ tips + "
\
"+ "
注意:数据无价,请谨慎操作!!!" + (type === 'mysql' && !recycle_bin_db_open ? '
风险操作:当前数据库回收站未开启,删除数据库将永久消失!' : '') + "
"+ "
", btn: ['确认删除', '取消删除'], yes: function (indexs) { var data = { id: wid, name: dbname }; if (typeof dbname === "function") { delete data.id; delete data.name; } layer.close(indexs) layer.close(indes) if (typeof dbname === "function") { dbname(data) } else { data.id = data.id[0] bt.database.del_database(data, function (rdata) { layer.closeAll() if (callback) callback(rdata); bt.msg(rdata); }) } } }) } }) }) } } if("undefined" != typeof site && site.hasOwnProperty("del_site")){ site.del_site = function (wid, wname, callback) { title = typeof wname === "function" ? '批量删除站点' : '删除站点 [ ' + wname + ' ]'; layer.open({ type: 1, title: title, icon: 0, skin: 'delete_site_layer', area: "440px", closeBtn: 2, shadeClose: true, content: "
" + '' + "
是否要删除关联的FTP、数据库、站点目录!
" + "
" + "" + "" + "" + "
" + "
", 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 === 'database' && !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) var ids = JSON.stringify(wid instanceof Array ? wid : [wid]), countDown = typeof wname === 'string' ? 4 : 9; title = typeof wname === "function" ? '二次验证信息,批量删除站点' : '二次验证信息,删除站点 [ ' + wname + ' ]'; var loadT = bt.load('正在检测站点数据信息,请稍候...') bt.send('check_del_data', 'site/check_del_data', { ids: ids }, function (res) { loadT.close() layer.open({ type: 1, title: title, closeBtn: 2, skin: 'verify_site_layer_info', area: '740px', content: '
' + '' + '
堡塔温馨提示您,请冷静几秒钟,确认以下要删除的数据。
' + '
' + '
' + '
' + '
' + '
' + '
' + '
风险事项:当前未开启数据库回收站功能,删除数据库后,数据库将永久消失!
' + '
风险事项:当前未开启文件回收站功能,删除站点目录后,站点目录将永久消失!
' + '
注意:请仔细阅读以上要删除信息,防止网站数据被误删
' + '
', // recycle_bin_db_open && // recycle_bin_open && btn: ['确认删除', '取消删除'], success: function (layers) { var html = '', rdata = res.data; for (var i = 0; i < rdata.length; i++) { var item = rdata[i], newTime = parseInt(new Date().getTime() / 1000), t_icon = ''; site_html = (function (item) { if (!is_path) return '' var is_time_rule = (newTime - item.st_time) > (86400 * 30) && (item.total > 1024 * 10), is_path_rule = res.file_size <= item.total, dir_time = bt.format_data(item.st_time, 'yyyy-MM-dd'), dir_size = bt.format_size(item.total); var f_html = ' ' + (item.limit ? '大于50MB' : dir_size) + ' ' + (is_path_rule ? t_icon : ''); var f_title = (is_path_rule ? '注意:此目录较大,可能为重要数据,请谨慎操作.\n' : '') + '目录:' + item.path + '(' + (item.limit ? '大于' : '') + dir_size + ')'; return '
' + '站点名:' + item.name + '' + '目录:' + item.path + ' (' + f_html + ')' + '创建时间:' + dir_time + '' + '
' }(item)), database_html = (function (item) { if (!is_database || !item.database) return ''; var is_time_rule = (newTime - item.st_time) > (86400 * 30) && (item.total > 1024 * 10), is_database_rule = res.db_size <= item.database.total, database_time = bt.format_data(item.database.st_time, 'yyyy-MM-dd'), database_size = bt.format_size(item.database.total); var f_size = ' ' + database_size + ' ' + (is_database_rule ? t_icon : ''); var t_size = '注意:此数据库较大,可能为重要数据,请谨慎操作.\n数据库:' + database_size; return '
' + '数据库:' + item.database.name + '' + '大小:' + f_size + '' + '创建时间:' + database_time + '' + '
' }(item)) if ((site_html + database_html) !== '') html += '
' + site_html + database_html + '
'; } if (html === '') html = '
无数据
' $('.check_layer_content').html(html) }, yes: function (indes, layers) { if (typeof wname === "function") { 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('可用端口范围:1-65535', { icon: 2 }); // 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: "

" + h + "

" + f + "
" }); $(".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); } })