One Hat Cyber Team
  • Dir : ~/www/server/panel/BTPanel/static/js/
  • Edit File: site.js
    '); $("input[name='test']") .parent() .parent() .html( '
    private cache
    ' ); var private = $("input[name='maxage'],textarea[name='exclude_file'],button[name='private_save']").parent().parent(); $('input.bt-input-text').parent().append('sec'); $("button[name='static_save']") .parent() .append(bt.render_help(['The default static file cache time is 604800 seconds', 'If you want to shut down, please change it to 0 seconds'])); $('.ols').append(bt.render_help(['Private cache only supports page caching for PHP and cache time is 120 seconds by default', 'Exclude files only support files with PHP as the suffix'])); private.hide(); bt.send('get_ols_private_cache_status', 'config/get_ols_private_cache_status', { id: web.id }, function (kdata) { checked = kdata; if (kdata) { bt.send('get_ols_private_cache', 'config/get_ols_private_cache', { id: web.id }, function (fdata) { $("input[name='maxage']").val(fdata.maxage); var ss = fdata.exclude_file.join(' '); $("textarea[name='exclude_file']").html(ss); $('#ols').attr('checked', true); private.show(); }); } }); $('#ols').on('click', function () { var loadT = bt.load(); bt.send('switch_ols_private_cache', 'config/switch_ols_private_cache', { id: web.id }, function (res) { loadT.close(); private.toggle(); checked = private.is(':hidden') ? false : true; bt.msg(res); if (checked) { bt.send('get_ols_private_cache', 'config/get_ols_private_cache', { id: web.id }, function (fdata) { private.show(); $("input[name='maxage']").val(fdata.maxage); $("textarea[name='exclude_file']").html(fdata.exclude_file.join(' ')); }); } }); }); bt.render_clicks(clicks); $("button[name='private_save']").parent().css('margin-bottom', '-13px'); $('.ss-text').css('margin-left', '66px'); $('.ols .btn-success').css('margin-left', '125px'); }); }, limit_network: function (web) { bt.site.get_limitnet(web.id, function (rdata) { var limits = [ { title: lan.site.bbs_or_blog, value: 1, items: { perserver: 300, perip: 25, limit_rate: 512 } }, { title: lan.site.photo_station, value: 2, items: { perserver: 200, perip: 10, limit_rate: 1024 } }, { title: lan.site.download_station, value: 3, items: { perserver: 50, perip: 3, limit_rate: 2048 } }, { title: lan.site.mall, value: 4, items: { perserver: 500, perip: 10, limit_rate: 2048 } }, { title: lan.site.portal_site, value: 5, items: { perserver: 400, perip: 15, limit_rate: 1024 } }, { title: lan.site.enterprise, value: 6, items: { perserver: 60, perip: 10, limit_rate: 512 } }, { title: lan.site.video, value: 7, items: { perserver: 150, perip: 4, limit_rate: 1024 } }, ]; var datas = [ { items: [ { name: 'status', type: 'checkbox', value: rdata.perserver != 0 ? true : false, text: lan.site.limit_net_8, callback: function (ldata) { if (ldata.status) { bt.site.set_limitnet(web.id, ldata.perserver, ldata.perip, ldata.limit_rate, function (ret) { layer.msg(ret.msg, { icon: ret.status ? 1 : 2 }); if (ret.status) site.reload(3); }); } else { bt.site.close_limitnet(web.id, function (ret) { layer.msg(ret.msg, { icon: ret.status ? 1 : 2 }); if (ret.status) site.reload(3); }); } }, }, ], }, { title: lan.site.limit_net_9 + ' ', width: '160px', name: 'limit', type: 'select', items: limits, callback: function (obj) { var data = limits.filter(function (p) { return p.value === parseInt(obj.val()); })[0]; for (var key in data.items) $('input[name="' + key + '"]').val(data.items[key]); }, }, { title: lan.site.limit_net_10 + ' ', type: 'number', width: '200px', value: rdata.perserver, name: 'perserver', }, { title: lan.site.limit_net_12 + ' ', type: 'number', width: '200px', value: rdata.perip, name: 'perip', }, { title: lan.site.limit_net_14 + ' ', type: 'number', width: '200px', value: rdata.limit_rate, name: 'limit_rate', }, { name: 'btn_limit_get', text: lan.site.save, type: 'button', callback: function (ldata) { bt.site.set_limitnet(web.id, ldata.perserver, ldata.perip, ldata.limit_rate, function (ret) { layer.msg(ret.msg, { icon: ret.status ? 1 : 2 }); if (ret.status) site.reload(3); }); }, }, ]; var _html = $("
    "); var clicks = []; for (var i = 0; i < datas.length; i++) { var _form_data = bt.render_form_line(datas[i]); _html.append(_form_data.html); clicks = clicks.concat(_form_data.clicks); } _html.find('input[type="checkbox"]').parent().addClass('label-input-group ptb10'); _html.append(bt.render_help([lan.site.limit_net_11, lan.site.limit_net_13, lan.site.limit_net_15])); $('#webedit-con').append(_html); $('.newnanme .tname').css('width', '138px'); bt.render_clicks(clicks); if (rdata.perserver == 0) $("select[name='limit']").trigger('change'); $('#status,.btn_limit_get').css('margin-left', '138px'); }); }, get_rewrite_list: function (web) { var filename = '/www/server/panel/vhost/rewrite/' + web.name + '.conf'; bt.site.get_rewrite_list(web.name, function (rdata) { var arrs = [], webserver = bt.get_cookie('serverType'); if (webserver == 'apache' || webserver == 'openlitespeed') filename = rdata.sitePath + '/.htaccess'; if (webserver == 'openlitespeed') webserver = 'apache'; for (var i = 0; i < rdata.rewrite.length; i++) arrs.push({ title: rdata.rewrite[i], value: rdata.rewrite[i], }); var datas = [ { name: 'rewrite', type: 'select', width: '130px', items: arrs, callback: function (obj) { if (bt.os == 'Linux') { var spath = filename; if (obj.val() != lan.site.rewritename) spath = '/www/server/panel/rewrite/' + (webserver == 'openlitespeed' ? 'apache' : webserver) + '/' + obj.val() + '.conf'; bt.files.get_file_body(spath, function (ret) { if (ret.status == false) { layer.msg(ret.msg, { icon: 2 }); return false; } aceEditor.ACE.setValue(ret.data); aceEditor.ACE.moveCursorTo(0, 0); aceEditor.path = spath; }); } }, }, { items: [{ name: 'config', type: 'div', value: rdata.data, widht: '340px', height: '200px' }] }, { items: [ { name: 'btn_save', text: lan.site.save, type: 'button', callback: function (ldata) { // bt.files.set_file_body(filename, editor.getValue(), 'utf-8', function(ret) { // if (ret.status) site.reload(4) // bt.msg(ret); // }) aceEditor.path = filename; bt.saveEditor(aceEditor); }, }, { name: 'btn_save_to', text: lan.site.save_as_template, type: 'button', callback: function (ldata) { var temps = { title: lan.site.save_rewrite_temp, area: '330px', list: [ { title: lan.site.template_name, placeholder: lan.site.template_name, width: '160px', name: 'tempname', }, ], btns: [ { title: lan.site.turn_off, name: 'close' }, { title: lan.site.submit, name: 'submit', css: 'btn-success', callback: function (rdata, load, callback) { var name = rdata.tempname; if (name === '') return layer.msg('The template name cannot be empty!', { icon: 2 }); var isSameName = false; for (var i = 0; i < arrs.length; i++) { if (arrs[i].value == name) { isSameName = true; break; } } var save_to = function () { bt.site.set_rewrite_tel(name, aceEditor.ACE.getValue(), function (rRet) { if (rRet.status) { load.close(); site.reload(4); } bt.msg(rRet); }); }; if (isSameName) { return layer.msg('The template name already exists, please re-enter the template name!', { icon: 2 }); } else { save_to(); } }, }, ], }; bt.render_form(temps); }, }, ], }, ]; var _html = $("
    "); var clicks = []; for (var i = 0; i < datas.length; i++) { var _form_data = bt.render_form_line(datas[i]); _html.append(_form_data.html); var _other = bt.os == 'Linux' && i == 0 ? '' + lan.site.rewrite_change_tools + ':' + lan.site.ap_change_ng + '' : ''; _html.find('.info-r').append(_other); clicks = clicks.concat(_form_data.clicks); } _html.append(bt.render_help([lan.site.rewrite_tips_1, lan.site.rewrite_tips_2, lan.site.edit_rewrite])); $('#webedit-con').append(_html); bt.render_clicks(clicks); // $('textarea.config').attr('id', 'config_rewrite'); // var editor = CodeMirror.fromTextArea(document.getElementById("config_rewrite"), { // extraKeys: { "Ctrl-Space": "autocomplete" }, // lineNumbers: true, // matchBrackets: true, // }); // $(".CodeMirror-scroll").css({ "height": "340px", "margin": 0, "padding": 0 }); // $(".soft-man-con .CodeMirror").css({ "height": "342px" }); // setTimeout(function() { // editor.refresh(); // }, 250); $('div.config').attr('id', 'config_rewrite').css({ height: '360px', width: '540px' }); var aceEditor = bt.aceEditor({ el: 'config_rewrite', content: rdata.data }); $('select.rewrite').trigger('change'); }); }, set_default_index: function (web) { bt.site.get_index(web.id, function (rdata) { rdata = rdata.replace(new RegExp(/(,)/g), '\n'); var data = { items: [ { name: 'Dindex', height: '230px', width: '50%', type: 'textarea', value: rdata }, { name: 'btn_submit', text: lan.site.add, type: 'button', callback: function (ddata) { var Dindex = ddata.Dindex.replace(new RegExp(/(\n)/g), ','); bt.site.set_index(web.id, Dindex, function (ret) { if (!ret.status) { bt.msg(ret); return; } site.reload(5); }); }, }, ], }; var _form_data = bt.render_form_line(data); var _html = $(_form_data.html); _html.append(bt.render_help([lan.site.default_doc_help])); $('#webedit-con').append(_html); $('.btn_submit').addClass('pull-right').css('margin', '90px 100px 0 0'); bt.render_clicks(_form_data.clicks); }); }, set_config: function (web) { var con = '

    Tips:Ctrl+F Search keywords,Ctrl+S Save,Ctrl+H Search and replace

    \ \ '; $('#webedit-con').html(con); var webserve = bt.get_cookie('serverType'), config = bt.aceEditor({ el: 'siteConfigBody', path: '/www/server/panel/vhost/' + (webserve == 'openlitespeed' ? webserve + '/detail' : webserve) + '/' + web.name + '.conf', }); $('#OnlineEditFileBtn').click(function (e) { bt.saveEditor(config); }); }, set_php_version: function (web) { bt.site.get_site_phpversion(web.name, function (sdata) { if (sdata.status === false) { bt.msg(sdata); return; } bt.site.get_all_phpversion(function (vdata) { var versions = []; for (var j = vdata.length - 1; j >= 0; j--) { var o = vdata[j]; o.value = o.version; o.title = o.name; versions.push(o); } // var data = { // items: [ // { // title: 'PHP版本', // name: 'versions', // value: sdata.phpversion, // type: 'select', // items: versions , // ps:'' // }, // { // text: '切换', // name: 'btn_change_phpversion', // type: 'button', // callback: function(pdata) { // var other = $('.other-version').val(); // if(pdata.versions == 'other' && other == ''){ // layer.msg('自定义PHP版本时,PHP连接配置不能为空'); // $('.other-version').focus(); // return; // } // bt.site.set_phpversion(web.name, pdata.versions, other, function(ret) { // if (ret.status) { // var versions = $('[name="versions"]').val(); // versions = versions.slice(0, versions.length - 1) + '.' + versions.slice(-1); // if (versions == '0.0') versions = '静态'; // site_table.$refresh_table_list(true); // site.reload() // setTimeout(function() { // bt.msg(ret); // }, 1000); // }else{ // bt.msg(ret); // } // }) // } // } // ] // } // var _form_data = bt.render_form_line(data); // var _html = $(_form_data.html); // _html.append(bt.render_help([lan.site.switch_php_help1, lan.site.switch_php_help2, lan.site.switch_php_help3])); // $('#webedit-con').append(_html); // bt.render_clicks(_form_data.clicks); // $('#webedit-con').append('
    ' + lan.site.session_off + '
    ' + bt.render_help([lan.site.independent_storage])); // function get_session_status() { // var loading = bt.load('Getting session status...'); // bt.send('get_php_session_path', 'config/get_php_session_path', { id: web.id }, function(tdata) { // loading.close(); // $('#session_switch').prop("checked", tdata); // }) // }; // get_session_status() // $('#session_switch').click(function() { // var val = $(this).prop('checked'); // bt.send('set_php_session_path', 'config/set_php_session_path', { id: web.id, act: val ? 1 : 0 }, function(rdata) { // get_session_status(); // bt.msg(rdata) // }); // }) var data = { items: [ { title: 'PHP version', name: 'versions', value: sdata.phpversion, type: 'select', items: versions, ps: '', }, { text: 'Switch', name: 'btn_change_phpversion', type: 'button', callback: function (pdata) { var other = $('.other-version').val(); if (pdata.versions == 'other' && other == '') { layer.msg('When customizing the PHP version, the PHP connection configuration cannot be empty'); $('.other-version').focus(); return; } bt.site.set_phpversion(web.name, pdata.versions, other, function (ret) { if (ret.status) { var versions = $('[name="versions"]').val(); versions = versions.slice(0, versions.length - 1) + '.' + versions.slice(-1); if (versions == '0.0') versions = 'Static'; site_table.$refresh_table_list(true); site.reload(); setTimeout(function () { bt.msg(ret); }, 1000); } else { bt.msg(ret); } }); }, }, ], }; var _form_data = bt.render_form_line(data); var _html = $(_form_data.html); _html.append( bt.render_help([ 'Select the version according to your program requirements', 'Try not to use PHP5.2 unless you have to, as this can reduce your server security', 'PHP7 does not support the MySQL extension. The default installation is mysqli and mysql-pdo', '[Customize] You can customize the PHP connection information by selecting the available PHP connection configuration', '[Customize] Currently only support NGINX', 'Support TCP or UNIX configuration. Example: 192.168.1.25:9001 or unix:/tmp/php8.sock', ]) ); $('#webedit-con').append(_html); bt.render_clicks(_form_data.clicks); if (sdata.phpversion != 'other') { var tips = bt.render_help([ 'When enabled, session files will be stored in a separate folder, not in a common storage location with other sites', 'Do not enable this option if you are saving sessions to caches such as memcache/redis in your PHP configuration', ]); $('#webedit-con').append( '\
    \ ' + lan.site.session_off + '\ \ \ \ \
    \
    ' + tips ); } if (sdata.phpversion != 'other') { $('.other-version').hide(); } setTimeout(function () { $('select[name="versions"]').change(function () { var phpversion = $(this).val(); // console.log(phpversion); if (phpversion == 'other') { $('.other-version').show(); } else { $('.other-version').hide(); } }); }, 500); function get_session_status() { var loading = bt.load('Please wait while getting session status'); bt.send('get_php_session_path', 'config/get_php_session_path', { id: web.id }, function (tdata) { loading.close(); $('#session_switch').prop('checked', tdata); }); } get_session_status(); $('#session_switch').click(function () { var val = $(this).prop('checked'); bt.send( 'set_php_session_path', 'config/set_php_session_path', { id: web.id, act: val ? 1 : 0, }, function (rdata) { bt.msg(rdata); } ); setTimeout(function () { get_session_status(); }, 500); }); }); }); }, set_wp_config: function (web) { var loadup = bt.load('Getting Wordpress information, please wait...'); bt.send('is_update', 'site/is_update', { s_id: web.id }, function (rdata) { loadup.close(); var loadin = bt.load('Getting wordpress account information, please wait...'); bt.send('get_wp_username', 'site/get_wp_username', { s_id: web.id }, function (wlist) { loadin.close(); var robj = $('#webedit-con'); if (wlist.status === false) { wlist.time = 0; wlist.closeBtn = 2; bt.msg(wlist); var data = { items: [ { title: 'Database name', name: 'database', value: '', type: 'input', width: '250px', placeholder: 'Please enter the database name', }, { text: 'Set', name: 'btn_change_database', type: 'button', callback: function (pdata) { if (pdata.database == '') { return layer.msg('The database name cannot be empty', { icon: 2 }); } var param = { site_id: web.id, db_name: pdata.database, }; var load = bt.load('Setting Database name, please wait...'); bt.send('reset_wp_db', 'site/reset_wp_db', param, function (res) { load.close(); bt.msg(res); if (res.status) { setTimeout(function () { robj.html(''); site.edit.set_wp_config(web); }, 1500); } }); }, }, ], }; var _form_data = bt.render_form_line(data); var _html = $(_form_data.html); _html.append(bt.render_help(['Please enter the database name for this wordpress website'])); robj.append(_html); bt.render_clicks(_form_data.clicks); return; } var _html = $('
    '), user_array = [], clicks = []; $.each(wlist.msg, function (index, item) { user_array.push({ title: item, value: item }); }); var datas = [ { title: 'WP Version', items: [ { name: 'wp_version', type: 'html', html: rdata['msg']['update'] ? 'The current version is: ' + rdata['msg']['local_v'] + '' : 'The latest version', }, ], }, { title: 'Cache', items: [ { type: 'checkbox', name: 'cache_switch', text: ' Open cache', value: web.cache_status, callback: function (sdata) { var loads = bt.load((sdata.cache_switch ? 'Turning on' : 'Turining off') + ' [ ' + web.name + ' ] cache, please wait...'); bt.send('set_fastcgi_cache', 'site/set_fastcgi_cache', { version: web.php_version, sitename: web.name, act: sdata.cache_switch ? 'enable' : 'disable' }, function (res) { loads.close(); bt.msg(res); if (res.status) { site.php_table_view(); web.cache_status = sdata.cache_switch; } }); }, }, { name: 'remove_cache', text: 'Purge all cache', type: 'button', callback: function (sdata) { var loadC = bt.load('Clearing all caches, please wait...'); bt.send('purge_all_cache', 'site/purge_all_cache', { s_id: web.id }, function (res) { loadC.close(); bt.msg(res); }); }, }, ], }, { title: 'Reset password', items: [ { name: 'user', type: 'select', items: user_array, width: '200px', }, { title: '', name: 'new_pass', placeholder: 'Please enter a new password', width: '200px', }, { name: 'submit_pw', text: 'Save password', type: 'button', callback: function (sdata) { var loads = bt.load('Resetting password, please wait...'); bt.send('reset_wp_password', 'site/reset_wp_password', { s_id: web.id, user: sdata.user, new_pass: sdata.new_pass }, function (res) { loads.close(); bt.msg(res); }); }, }, ], }, ]; for (var i = 0; i < datas.length; i++) { var _form_data = bt.render_form_line(datas[i]); _html.append(_form_data.html); clicks = clicks.concat(_form_data.clicks); } _html.find('input[type="checkbox"]').parent().addClass('label-input-group'); _html.find('button[name="submit_pw"]').css('margin', '15px 0'); robj.append(_html); bt.render_clicks(clicks); //wp版本更新 $('.update_wp_version').click(function () { var load_wp = bt.load('Updating Wordpress version, please wait...'); bt.send('update_wp', 'site/update_wp', { s_id: web.id, version: rdata['msg']['online_v'] }, function (res) { load_wp.close(); bt.msg(res); if (res.status) $('.bt-w-menu.site-menu p.bgw').click(); }); }); }); }); }, templet_301: function (sitename, id, types, obj) { if (types) { obj = { redirectname: new Date().valueOf(), tourl: 'http://', redirectdomain: [], redirectpath: '', redirecttype: '', type: 1, domainorpath: 'domain', holdpath: 1, }; } var helps = [lan.site.redirect_tips1, lan.site.redirect_tips2, lan.site.redirect_tips3, lan.site.redirect_tips4, lan.site.redirect_tips5, lan.site.redirect_tips6]; bt.site.get_domains(id, function (rdata) { var domain_html = ''; for (var i = 0; i < rdata.length; i++) { domain_html += ''; } var form_redirect = bt.open({ type: 1, skin: 'demo-class', area: '650px', title: types ? lan.site.create_redirect : lan.site.modify_redirect + '[' + obj.redirectname + ']', closeBtn: 2, shift: 5, shadeClose: false, content: "" + "
    " + "" + lan.site.open_redirect + '' + "
    " + "" + "
    " + "" + lan.site.reserve_url + '' + "" + '
    ' + '
    ' + '
    ' + "' + "
    " + "" + lan.site.redirect_type + '' + "
    " + "' + "" + lan.site.redirect_mode + '' + "
    ' + '
    ' + "
    " + "" + lan.site.redirect_domain + '' + "
    " + "' + '
    ' + "" + lan.site.target_url + '' + "
    " + "" + '
    ' + '
    ' + "
    " + "" + lan.site.redirect_path + '' + "
    " + "" + "" + lan.site.target_url + '' + "" + '
    ' + '
    ' + "' + "
    ' + '
    ', }); setTimeout(function () { $('.selectpicker').selectpicker({ noneSelectedText: lan.site.choose_domain, selectAllText: lan.site.choose_all, deselectAllText: lan.site.cancel_all, }); $('.selectpicker').selectpicker('val', obj.redirectdomain); $('#form_redirect').parent().css('overflow', 'inherit'); $('[name="domainorpath"]').change(function () { if ($(this).val() == 'path') { $('.redirectpath').show(); $('.redirectdomain').hide(); $('.selectpicker').selectpicker('val', []); } else { $('.redirectpath').hide(); $('.redirectdomain').show(); $('[name="redirectpath"]').val(''); } }); $('.btn-colse-prosy').click(function () { form_redirect.close(); }); $('.btn-submit-redirect').click(function () { var type = $('[name="type"]').prop('checked') ? 1 : 0; var holdpath = $('[name="holdpath"]').prop('checked') ? 1 : 0; var redirectname = $('[name="redirectname"]').val(); var redirecttype = $('[name="redirecttype"]').val(); var domainorpath = $('[name="domainorpath"]').val(); var redirectpath = $('[name="redirectpath"]').val(); var redirectdomain = JSON.stringify($('.selectpicker').val() || []); var tourl = $(domainorpath == 'path' ? '[name="tourl1"]' : '[name="tourl"]').val(); if (!types) { bt.site.modify_redirect( { type: type, sitename: sitename, holdpath: holdpath, redirectname: redirectname, redirecttype: redirecttype, domainorpath: domainorpath, redirectpath: redirectpath, redirectdomain: redirectdomain, tourl: tourl, }, function (rdata) { if (rdata.status) { form_redirect.close(); site.reload(11); } bt.msg(rdata); } ); } else { bt.site.create_redirect( { type: type, sitename: sitename, holdpath: holdpath, redirectname: redirectname, redirecttype: redirecttype, domainorpath: domainorpath, redirectpath: redirectpath, redirectdomain: redirectdomain, tourl: tourl, }, function (rdata) { if (rdata.status) { form_redirect.close(); site.reload(11); } bt.msg(rdata); } ); } }); }, 100); }); }, template_Dir: function (id, type, obj) { if (type) { obj = { name: '', sitedir: '', username: '', password: '' }; } else { obj = { name: obj.name, sitedir: obj.site_dir, username: '', password: '' }; } var form_directory = bt.open({ type: 1, skin: 'demo-class', area: '475px', title: type ? 'Add limit access' : 'Edit limit access', closeBtn: 2, shift: 5, shadeClose: false, content: "
    " + "
    " + "" + lan.bt.task_name + '' + "
    " + '
    ' + "
    " + "Path" + "
    " + '
    ' + "
    " + "" + lan.bt.panel_user + '' + "
    " + '
    ' + "
    " + "" + lan.bt.panel_pass + '' + "
    " + '
    ' + "' + "
    ', }); $('.btn-colse-guard').click(function () { form_directory.close(); }); $('.btn-submit-guard').click(function () { var guardData = {}; guardData['id'] = id; guardData['name'] = $('input[name="dir_name"]').val(); guardData['site_dir'] = $('input[name="dir_sitedir"]').val(); guardData['username'] = $('input[name="dir_username"]').val(); guardData['password'] = $('input[name="dir_password"]').val(); if (type) { bt.site.create_dir_guard(guardData, function (rdata) { if (rdata.status) { form_directory.close(); site.reload(); } bt.msg(rdata); }); } else { bt.site.edit_dir_account(guardData, function (rdata) { if (rdata.status) { form_directory.close(); site.reload(); } bt.msg(rdata); }); } }); setTimeout(function () { if (!type) { $('input[name="dir_name"]').attr('disabled', 'disabled'); $('input[name="dir_sitedir"]').attr('disabled', 'disabled'); } }, 500); }, template_php: function (website, obj) { var _type = 'add', _name = '', _bggrey = ''; if (obj == undefined) { obj = { name: '', suffix: 'php|jsp', dir: '' }; } else { obj = { name: obj.name, suffix: obj.suffix, dir: obj.dir }; _type = 'edit'; _name = ' readonly'; _bggrey = 'background: #eee;'; } var form_directory = bt.open({ type: 1, area: '440px', title: 'Deny access', closeBtn: 2, btn: ['Save', 'Cancel'], content: "
    " + "
    " + "Name" + "
    " + '
    ' + "
    " + "Suffix" + "
    " + '
    ' + "
    " + "Path" + "
    " + '
    ' + "', yes: function () { var dent_data = $('.php_deny').serializeObject(); dent_data.act = _type; dent_data.website = website; var loading = bt.load(); bt.site.edit_php_deny(dent_data, function (rdata) { loading.close(); if (rdata.status) { form_directory.close(); site.reload(); $('#set_dirguard .tab-nav span:eq(1)').click(); } bt.msg(rdata); }); }, }); }, del_php_deny: function (website, deny_name, callback) { layer.confirm( 'Are you sure to delete [ ' + deny_name + ' ] this deny?', { icon: 0, closeBtn: 2, title: 'Delete deny', }, function (index) { bt.site.del_php_deny({ website: website, deny_name: deny_name }, function (rdata) { layer.close(index); if (callback) callback(rdata); }); } ); }, set_301_old: function (web) { bt.site.get_domains(web.id, function (rdata) { var domains = [{ title: lan.site.site, value: 'all' }]; for (var i = 0; i < rdata.length; i++) domains.push({ title: rdata[i].name, value: rdata[i].name }); bt.site.get_site_301(web.name, function (pdata) { var _val = pdata.src == '' ? 'all' : pdata.src; var datas = [ { title: lan.site.access_domain, width: '360px', name: 'domains', value: _val, disabled: pdata.status, type: 'select', items: domains, }, { title: lan.site.target_url, width: '360px', name: 'toUrl', value: pdata.url }, { title: ' ', text: lan.site.enable_301, value: pdata.status, name: 'status', class: 'label-input-group', type: 'checkbox', callback: function (sdata) { bt.site.set_site_301(web.name, sdata.domains, sdata.toUrl, sdata.status ? '1' : '0', function (ret) { if (ret.status) site.reload(10); bt.msg(ret); }); }, }, ]; var robj = $('#webedit-con'); for (var i = 0; i < datas.length; i++) { var _form_data = bt.render_form_line(datas[i]); robj.append(_form_data.html); bt.render_clicks(_form_data.clicks); } robj.append(bt.render_help([lan.site.to301_help_1, lan.site.to301_help_2])); }); }); }, set_301: function (web) { $('#webedit-con').html('
    '); bt_tools.table({ el: '#redirect_list', url: '/site?action=GetRedirectList', param: { sitename: web.name }, dataFilter: function (res) { return { data: res }; }, column: [ { type: 'checkbox', width: 20 }, { fid: 'sitename', title: lan.site.redirect_type, type: 'text', template: function (row) { if (row.domainorpath == 'path') { conter = row.redirectpath; } else { conter = row.redirectdomain ? row.redirectdomain.join('、') : lan.site.empty; } return '' + conter + ''; }, }, { fid: 'redirecttype', title: lan.site.redirect_mode, type: 'text' }, { fid: 'holdpath', title: lan.site.reserve_url, config: { icon: false, list: [ [1, lan.site.turn_on, 'bt_success'], [0, lan.site.turn_off, 'bt_danger'], ], }, type: 'status', event: function (row, index, ev, key, that) { row.holdpath = row.holdpath == 0 ? 1 : 0; row.redirectdomain = JSON.stringify(row['redirectdomain']); bt.site.modify_redirect(row, function (res) { row.redirectdomain = JSON.parse(row['redirectdomain']); that.$modify_row_data({ holdpath: row.holdpath }); bt.msg(res); }); }, }, { fid: 'type', title: lan.site.status, config: { icon: true, list: [ [1, lan.site.running_text, 'bt_success', 'glyphicon-play'], [0, lan.site.already_stop, 'bt_danger', 'glyphicon-pause'], ], }, type: 'status', event: function (row, index, ev, key, that) { row.type = row.type == 0 ? 1 : 0; row.redirectdomain = JSON.stringify(row['redirectdomain']); bt.site.modify_redirect(row, function (res) { row.redirectdomain = JSON.parse(row['redirectdomain']); that.$modify_row_data({ status: row.type }); bt.msg(res); }); }, }, { title: lan.site.operate, width: 129, type: 'group', align: 'right', group: [ { title: 'Conf', event: function (row, index, ev, key, that) { bt.site.get_redirect_config( { sitename: web.name, redirectname: row.redirectname, webserver: bt.get_cookie('serverType'), }, function (rdata) { if (typeof rdata == 'object' && rdata.constructor == Array) { if (!rdata[0].status) bt.msg(rdata); } else { if (!rdata.status) bt.msg(rdata); } var datas = [ { items: [ { name: 'redirect_configs', type: 'textarea', value: rdata[0].data, widht: '340px', height: '200px', }, ], }, { name: 'btn_config_submit', text: 'Save', type: 'button', callback: function (ddata) { bt.site.save_redirect_config( { path: rdata[1], data: editor.getValue(), encoding: rdata[0].encoding, }, function (ret) { if (ret.status) { site.reload(11); redirect_config.close(); } bt.msg(ret); } ); }, }, ]; redirect_config = bt.open({ type: 1, area: ['550px', '550px'], title: 'Edit profile [' + row.redirectname + ']', closeBtn: 2, shift: 0, content: "
    ", }); var robj = $('#redirect_config_con'); for (var i = 0; i < datas.length; i++) { var _form_data = bt.render_form_line(datas[i]); robj.append(_form_data.html); bt.render_clicks(_form_data.clicks); } robj.append(bt.render_help(['This is the configuration file of the load balancing. Not modify if you do not understand the configuration rules.'])); $('textarea.redirect_configs').attr('id', 'configBody'); var editor = CodeMirror.fromTextArea(document.getElementById('configBody'), { extraKeys: { 'Ctrl-Space': 'autocomplete' }, lineNumbers: true, matchBrackets: true, }); $('.CodeMirror-scroll').css({ height: '350px', margin: 0, padding: 0 }); setTimeout(function () { editor.refresh(); }, 250); } ); }, }, { title: lan.site.edit, event: function (row, index, ev, key, that) { site.edit.templet_301(web.name, web.id, false, row); }, }, { title: lan.site.del, event: function (row, index, ev, key, that) { bt.site.remove_redirect(web.name, row.redirectname, function (rdata) { if (rdata.status) that.$delete_table_row(index); }); }, }, ], }, ], tootls: [ { //按钮组 type: 'group', positon: ['left', 'top'], list: [ { title: 'Add redirection', active: true, event: function (ev) { site.edit.templet_301(web.name, web.id, true); }, }, ], }, { //批量操作 type: 'batch', positon: ['left', 'bottom'], config: { title: ' delete', url: '/site?action=del_redirect_multiple', param: { site_id: web.id }, paramId: 'redirectname', paramName: 'redirectnames', theadName: 'Name', confirmVerify: false, // 是否提示验证方式 }, }, ], }); }, templet_proxy: function (sitename, type, obj) { if (type) { obj = { type: 1, cache: 0, proxyname: '', proxydir: '/', proxysite: 'http://', cachetime: 1, todomain: '$host', subfilter: [{ sub1: '', sub2: '' }], }; } var sub_conter = ''; for (var i = 0; i < obj.subfilter.length; i++) { if (i == 0 || obj.subfilter[i]['sub1'] != '') { sub_conter += "
    " + "" + "" + "Del" + '
    '; } if (i == 2) $('.add-replace-prosy').attr('disabled', 'disabled'); } var helps = [lan.site.proxy_tips1, lan.site.proxy_tips2, lan.site.proxy_tips3, lan.site.proxy_tips4]; var form_proxy = bt.open({ type: 1, skin: 'demo-class', area: '650px', title: type ? lan.site.create_proxy : lan.site.modify_proxy + '[' + obj.proxyname + ']', closeBtn: 2, shift: 5, shadeClose: false, content: "
    " + "
    " + "" + lan.site.open_proxy + '' + "
    " + "" + "
    " + "" + lan.site.proxy_cache + '' + "" + '
    ' + "
    " + "" + lan.site.proxy_adv + '' + "" + '
    ' + '
    ' + '
    ' + "
    " + "" + lan.site.proxy_name + '' + "
    " + '
    ' + "
    " + "" + lan.site.cache_time + '' + "
    " + lan.site.minute + '
    ' + '
    ' + "
    " + "" + lan.site.proxy_dir + '' + "
    " + '
    ' + '
    ' + "
    " + "" + lan.site.target_url + '' + "
    " + "" + '
    ' + '
    ' + "
    " + "" + lan.site.proxy_domain + '' + "
    " + "" + '
    ' + '
    ' + "
    " + "" + lan.site.con_rep + '' + "
    " + sub_conter + '
    ' + '
    ' + "
    " + "
    " + "' + '
    ' + '
    ' + "
    ' + '
    ', yes: function () { var isVerify = true; $('.certificate_confirm') .find('input') .each(function () { var name = $(this).attr('name'), value = $(this).val(), value = check_ssl_user_info($(this), name, value, config); if (typeof value === 'boolean') { form = false; return false; } form[name] = value; }); req(false); }, success: function () { if (countryList.length > 0) { var _option = ''; var couOp = ''; $.each(countryList, function (index, item) { _option += ''; couOp += ''; }); var node_pid = $('[name=phonePre]'); var countrySelect = $('[name=country]'); node_pid.html(_option); node_pid.val(form.phonePre); countrySelect.html(couOp); countrySelect.val(form.country); } // $.ajax({ // type: "GET", // url: "/static/js/countryCode.json", // data: "data", // dataType: "JSON", // success: function (data) { // console.log(data); // } // }) $('.certificate_confirm [name="organation"]').change(function () { $('.perfect_ssl_info [name="organation"]').val($(this).val()); form.organation = $(this).val(); }); $('.certificate_confirm [name="address"]').change(function () { $('.perfect_ssl_info [name="address"]').val($(this).val()); form.address = $(this).val(); }); $('.checkInfo').on('click', function (e) { window.open('https://www.qcc.com/web/search?key=' + $('.certificate_confirm [name="organation"]').val()); }); }, }); return false; } _this_layer.check_dns_interface(function () { var loadT = bt.load('Please wait while submitting certificate information...'); var auth_to = $("[name='dns_select']") ? $("[name='dns_select']").val() : ''; bt.send( 'apply_order_ca', 'ssl/apply_order_ca', { pdata: JSON.stringify({ pid: config.pid, oid: config.oid, domains: form.domains, dcvMethod: $("[name='dcvMethod']:checked").val(), auth_to: auth_to, uc_id: config.uc_id, Administrator: { job: 'General affairs', postCode: '523000', country: form.country, firstName: form.firstName, lastName: form.name, state: form.state, city: form.city, address: form.address, organation: form.organation, email: form.email, tel_prefix: form.phonePre, mobile: form.mobile, lastName: form.name, }, }), }, function (res) { loadT.close(); if (typeof res.msg == 'object') { for (var key in res.msg.errors) { if (Object.hasOwnProperty.call(res.msg.errors, key)) { var element = res.msg.errors[key]; bt.msg({ status: false, msg: element, }); } } } else { if (res.caa_list) { site.show_domain_error_dialog(res.caa_list, res.msg); } else { bt.msg({ status: res.success, msg: res.res }); } } if (res.success) { layer.close(index); verify_order_veiw(config.uc_id); $('#ssl_tabs span.on').click(); } } ); }); } }); $('.check_method_item label').click(function (e) { e.stopPropagation(); }); $('.check_method_item').click(function () { // 选中 $(this).find('label').trigger('click'); // 判断是否显示异常 var show = $(this).data('show-tips'); if (!show) return; $(this).data('show-tips', false); // 判断是否存在异常数据 var data = $(this).data('error-data'); if (!data) return; $(this).find('.error-link').trigger('click'); }); $('.check_method_item').on('click', '.error-link', function (e) { e.stopPropagation(); var data = $(this).parents('.check_method_item').data('error-data'); if ($.isPlainObject(data)) { site.show_domain_error_dialog(data); } if (Array.isArray(data)) { var html = ''; $.each(data, function (i, item) { html += '

    ' + item + '

    '; }); layer.msg(html, { icon: 2, shade: 0.3, closeBtn: 2, time: 0, success: function ($layer) { $layer.css({ 'max-width': '560px' }); var width = $(window).width(); var lWidth = $layer.width(); $layer.css({ left: (width - lWidth) / 2 + 'px', }); }, }); } }); var Timer = null; $('.CNAME_CSR_HASH,.HTTP_CSR_HASH,.HTTPS_CSR_HASH').hover( function () { var $this = $(this); var data = $(this).data('error-data'); if (data) return; var arry = [ 'If the website has not been filed, optional [DNS verification]', 'If the 301, 302, forced HTTPS, and reverse proxy functions are not enabled, select HTTP', 'If the website enables "mandatory HTTPS", please select "HTTPS verification".', ]; var tips = arry[$this.index()]; clearTimeout(Timer); Timer = setTimeout(function () { $this.data({ tips: layer.tips(tips, $this.find('label'), { tips: 1, time: 0 }), }); }, 200); }, function () { clearTimeout(Timer); layer.close($(this).data('tips')); } ); }); }, }); }); } $('.ssl_business_application').click(function () { pay_ssl_business(); }); //订单证书操作 $('.ssl_order_list') .unbind('click') .on('click', '.options_ssl', function () { var type = $(this).data('type'), tr = $(this).parents('tr'); itemData = order_list[tr.data('index')]; switch (type) { case 'deploy_ssl': // 部署证书 bt.confirm( { title: 'Deployment certificate', msg: 'Whether to deploy the certificate and whether to continue?
    Certificate type:' + itemData.title + '
    Certificate supported domain name:' + itemData.domains.join('、') + '
    Deployment site name:' + web.name + '', }, function (index) { var loads = bt.load('Please wait while certificates are deployed...'); bt.send('set_cert', 'ssl/set_cert', { uc_id: itemData.uc_id, siteName: web.name }, function (rdata) { layer.close(index); $('#webedit-con').empty(); site.set_ssl(web); site.ssl.reload(); bt.msg(rdata); }); } ); break; case 'verify_order': // 验证订单 verify_order_veiw(itemData.uc_id); break; case 'clear_order': // 取消订单 bt.confirm( { title: 'Cancel order', msg: 'Whether to cancel the order, the order domain name [' + itemData.domains.join('、') + '], whether to continue?', }, function (index) { var loads = bt.load('Cancelling order, please wait...'); bt.send('cancel_cert_order', 'ssl/cancel_cert_order', { oid: itemData.oid }, function (rdata) { layer.close(index); if (rdata.status) { $('#ssl_tabs span:eq(2)').click(); setTimeout(function () { bt.msg(rdata); }, 2000); } bt.msg(rdata); }); } ); break; case 'perfect_user_info': //完善用户信息 confirm_certificate_info(itemData); break; case 'renewal_ssl': renewal_ssl_view(itemData); break; } }); } else { robj.append('
    ' + lan.site.set_ssl.no_bind + '
    '); var datas = [ { title: lan.public.user, name: 'bt_username', value: rdata.email, width: '260px', placeholder: lan.public_backup.mobile_phone_or_email }, { title: lan.public.pass, type: 'password', name: 'bt_password', value: rdata.email, width: '260px' }, { title: ' ', items: [ { text: lan.public_backup.login, name: 'btn_ssl_login', type: 'button', callback: function (sdata) { bt.pub.login_btname(sdata.bt_username, sdata.bt_password, function (ret) { if (ret.status) site.reload(7); }); }, }, { text: lan.site.set_ssl.register_ac, name: 'bt_register', type: 'button', callback: function (sdata) { window.open('https://www.aapanel.com/user_admin/register'); }, }, ], }, ]; for (var i = 0; i < datas.length; i++) { var _form_data = bt.render_form_line(datas[i]); robj.append(_form_data.html); bt.render_clicks(_form_data.clicks); } robj.append( bt.render_help([ lan.site.set_ssl.bind_tip1 + '' + lan.site.set_ssl.click_view + '', lan.site.set_ssl.bind_tip2, ]) ); } }); }, }, { title: "Let's Encrypt", callback: function (robj) { robj = $('#webedit-con .tab-con'); // console.log(robj,'obj'); acme.get_account_info(function (let_user) {}); acme.id = web.id; if (rdata.status && rdata.type == 1) { var cert_info = ''; if (rdata.cert_data['notBefore']) { cert_info = '
    \ ' + lan.site.deploy_success_cret + '' + lan.site.try_renew_cret + '\ \ ' + lan.site.cert_brand + '' + rdata.cert_data.issuer + '\ ' + lan.site.auth_domain + ' ' + (rdata.cert_data.dns ? rdata.cert_data.dns.join(', ') : '') + '\ ' + lan.site.expire_time + ' ' + rdata.cert_data.notAfter + '
    '; } robj.append('
    ' + cert_info + '
    ' + lan.site.ssl_key + '' + lan.site.ssl_crt + '
    '); var datas = [ { items: [ { name: 'key', width: '48%', height: '220px', type: 'textarea', value: rdata.key }, { name: 'csr', width: '48%', height: '220px', type: 'textarea', value: rdata.csr }, ], }, { items: [ { text: lan.site.ssl_close, name: 'btn_ssl_close', hide: !rdata.status, type: 'button', callback: function (sdata) { site.ssl.set_ssl_status('CloseSSLConf', web.name); }, }, { text: lan.site.ssl_renew, name: 'btn_ssl_renew', hide: !rdata.status, type: 'button', callback: function (sdata) { site.ssl.renew_ssl(web.name, rdata.auth_type, rdata.index); }, }, ], }, ]; for (var i = 0; i < datas.length; i++) { var _form_data = bt.render_form_line(datas[i]); robj.append(_form_data.html); bt.render_clicks(_form_data.clicks); } robj .find('textarea') .css({ 'background-color': '#f6f6f6', resize: 'none', }) .attr('readonly', true); robj.find('[name=csr]').css('margin-right', '0'); var helps = [lan.site.ssl_tips1, lan.site.ssl_tips2, lan.site.ssl_tips3, lan.site.ssl_tips4, lan.site.ssl_tips5]; robj.append(bt.render_help([lan.site.ssl_help_2, lan.site.ssl_help_3])); return; } bt.site.get_site_domains(web.id, function (ddata) { var helps = [ [lan.site.bt_ssl_help_5, lan.site.bt_ssl_help_8, lan.site.bt_ssl_help_9, lan.site.ssl_tips5], [lan.site.dns_check_tips1, lan.site.dns_check_tips2, lan.site.dns_check_tips3, lan.site.dns_check_tips4], ]; var datas = [ { title: lan.site.checking_mode, items: [ { name: 'check_file', text: lan.site.file_check, type: 'radio', callback: function (obj) { $('.checks_line').remove(); $(obj).siblings().removeAttr('checked'); $('.help-info-text').html($(bt.render_help(helps[0]))); //var _form_data = bt.render_form_line({ title: ' ', class: 'checks_line label-input-group', items: [{ name: 'force', type: 'checkbox', value: true, text: '提前校验域名(提前发现问题,减少失败率)' }] }); //$(obj).parents('.line').append(_form_data.html); $('#ymlist li input[type="checkbox"]').each(function () { if ($(this).val().indexOf('*') >= 0) { $(this).parents('li').hide(); } }); }, }, { name: 'check_dns', text: lan.site.check_dns, type: 'radio', callback: function (obj) { $('.checks_line').remove(); $(obj).siblings().removeAttr('checked'); $('.help-info-text').html($(bt.render_help(helps[1]))); $('#ymlist li').show(); var arrs_list = [], arr_obj = {}; bt.site.get_dns_api(function (api) { site.dnsapi = {}; for (var x = 0; x < api.length; x++) { site.dnsapi[api[x].name] = {}; site.dnsapi[api[x].name].s_key = 'None'; site.dnsapi[api[x].name].s_token = 'None'; if (api[x].data) { site.dnsapi[api[x].name].s_key = api[x].data[0].value; site.dnsapi[api[x].name].s_token = api[x].data[1].value; } arrs_list.push({ title: api[x].title, value: api[x].name }); arr_obj[api[x].name] = api[x]; } var data = [ { title: lan.site.choose_dns, class: 'checks_line', items: [ { name: 'dns_select', width: 'auto', type: 'select', items: arrs_list, callback: function (obj) { var _val = obj.val(); $('.set_dns_config').remove(); var _val_obj = arr_obj[_val]; var _form = { title: '', area: '530px', list: [], btns: [{ title: lan.site.turn_off, name: 'close' }], }; var helps = []; if (_val_obj.data !== false) { _form.title = lan.site.set + '【' + _val_obj.title + '】' + lan.site.interface; if (_val_obj.help == 'How to get API Token') { _val_obj.help = '' + _val_obj.help + ''; } helps.push(_val_obj.help); var is_hide = true; for (var i = 0; i < _val_obj.data.length; i++) { _form.list.push({ title: _val_obj.data[i].name, name: _val_obj.data[i].key, value: _val_obj.data[i].value, }); if (!_val_obj.data[i].value) is_hide = false; } if (_val_obj.title == 'CloudFlare') { _form.list.push({ html: '
    API-Limit
    ', }); } _form.btns.push({ title: lan.site.save, css: 'btn-success', name: 'btn_submit_save', callback: function (ldata, load) { bt.site.set_dns_api({ pdata: JSON.stringify(ldata) }, function (ret) { if (ret.status) { load.close(); robj.find('input[type="radio"]:eq(0)').trigger('click'); robj.find('input[type="radio"]:eq(1)').trigger('click'); } bt.msg(ret); }); }, }); if (is_hide) { obj.after(''); $('.set_dns_config').click(function () { var _bs = bt.render_form(_form); $('div[data-id="form' + _bs + '"]').append(bt.render_help(helps)); }); } else { var _bs = bt.render_form(_form); $('div[data-id="form' + _bs + '"]').append(bt.render_help(helps)); } } }, }, ], }, { title: ' ', class: 'checks_line label-input-group', items: [ { css: 'label-input-group ptb10', text: 'Automatically combine pan-domain names', name: 'app_root', type: 'checkbox', }, ], }, ]; for (var i = 0; i < data.length; i++) { var _form_data = bt.render_form_line(data[i]); $(obj).parents('.line').append(_form_data.html); bt.render_clicks(_form_data.clicks); } }); }, }, ], }, ]; for (var i = 0; i < datas.length; i++) { var _form_data = bt.render_form_line(datas[i]); robj.append(_form_data.html); bt.render_clicks(_form_data.clicks); } var _ul = $( '' ); for (var i = 0; i < ddata.domains.length; i++) { if (ddata.domains[i].binding === true) continue; _ul.append('
  • ' + ddata.domains[i].name + '
  • '); } var _line = $("
    "); _line.append('' + lan.site.domain + ''); _line.append(_ul); robj.append(_line); robj.find('input[type="radio"]').parent().addClass('label-input-group ptb10'); $('#ymlist li input').click(function (e) { e.stopPropagation(); var a = true; $('#ymlist li input').each(function () { var o = $(this).prop('checked'); if (!o) { a = false; return false; } }); $('#ymlist div input').prop('checked', a); }); $('#ymlist li').click(function () { var o = $(this).find('input'), a = true; if (o.prop('checked')) { o.prop('checked', false); } else { o.prop('checked', true); } $('#ymlist li input').each(function () { var o = $(this).prop('checked'); if (!o) { a = false; return false; } }); $('#ymlist div input').prop('checked', a); }); $('#ymlist div').click(function () { var o = $('#ymlist div input'), p = $('#ymlist input'); if (o.prop('checked')) { p.prop('checked', true); } else { p.prop('checked', false); } }); var _btn_data = bt.render_form_line({ title: ' ', text: lan.site.btapply, name: 'letsApply', type: 'button', callback: function (ldata) { ldata['domains'] = []; $('#ymlist li:visible input[type="checkbox"]:checked').each(function () { ldata['domains'].push($(this).val()); }); // console.log(ldata) var auth_type = 'http'; var auth_to = web.id; var auto_wildcard = '0'; if (ldata.check_dns) { auth_type = 'dns'; auth_to = 'dns'; auto_wildcard = ldata.app_root ? '1' : '0'; if (ldata.dns_select !== auth_to) { if (!site.dnsapi[ldata.dns_select].s_key) { layer.msg('No key information is set for the specified dns interface'); return; } auth_to = ldata.dns_select + '|' + site.dnsapi[ldata.dns_select].s_key + '|' + site.dnsapi[ldata.dns_select].s_token; } } if (ldata['domains'].length <= 0) { return layer.msg('Need at least a domain name!', { icon: 2 }); } site.show_certificate_confirm(web.name, function () { acme.apply_cert(ldata['domains'], auth_type, auth_to, auto_wildcard, function (res) { site.ssl.ssl_result(res, auth_type, web.name); }); }); }, }); robj.append(_btn_data.html); bt.render_clicks(_btn_data.clicks); robj.append(bt.render_help(helps[0])); robj.find('input[type="radio"]:eq(0)').trigger('click'); }); }, }, // { // title: lan.site.other_ssl, // callback: function (robj) { // robj = $('#webedit-con .tab-con') // var cert_info = ''; // if (rdata.cert_data['notBefore']) { // cert_info = '
    \ // ' + (rdata.status ? lan.site.deploy_success_tips : lan.site.not_deploy_and_save) + '\ // ' + lan.site.cert_brand + '' + rdata.cert_data.issuer + '\ // ' + lan.site.auth_domain + ' ' + (rdata.cert_data.dns ? rdata.cert_data.dns.join(', ') : '') + '\ // ' + lan.site.expire_time + ' ' + rdata.cert_data.notAfter + '
    ' // } // robj.append('
    ' + cert_info + '
    ' + lan.site.ssl_key + '' + lan.site.ssl_crt + '
    '); // var datas = [{ // items: [ // {name: 'key', width: '48%', height: '220px', type: 'textarea', value: rdata.key}, // {name: 'csr', width: '48%', height: '220px', type: 'textarea', value: rdata.csr} // ] // }, // { // items: [{ // text: lan.site.save, // name: 'btn_ssl_save', // type: 'button', // callback: function (sdata) { // bt.site.set_ssl(web.name, sdata, function (ret) { // if (ret.status) site.reload(7); // bt.msg(ret); // }) // } // }, // { // text: lan.site.ssl_close, // name: 'btn_ssl_close', // hide: !rdata.status, // type: 'button', // callback: function (sdata) { // site.ssl.set_ssl_status('CloseSSLConf', web.name); // } // } // ] // } // ] // for (var i = 0; i < datas.length; i++) { // var _form_data = bt.render_form_line(datas[i]); // robj.append(_form_data.html); // bt.render_clicks(_form_data.clicks); // } // var helps = [ // lan.site.bt_ssl_help_10, // lan.public_backup.cret_err, // lan.public_backup.pem_format, // lan.site.ssl_tips5, // ] // robj.append(bt.render_help(helps)); // robj.find(".help-info-text").css('margin-top', '0'); // robj.find('textarea').css('resize', 'none'); // robj.find('[name=csr]').css('margin-right', '0'); // } // }, // { // title: lan.site.turn_off, // callback: function (robj) { // robj = $('#webedit-con .tab-con'); // if (rdata.type == -1) { // robj.html("
    " + lan.site.ssl_help_1 + "
    "); // } else { // var txt = ''; // switch (rdata.type) { // case 1: // txt = "Let's Encrypt"; // break; // case 0: // txt = lan.site.other_ssl; // break; // case 2: // txt = lan.site.bt_ssl; // break; // } // robj.html('\ //
    ' + lan.get('ssl_enable', [txt]) + '
    \ //
    \ // \ //
    \ // '); // } // var loadT = bt.load(lan.site.the_msg); // $.post('/site?action=get_auto_restart_rph', { // sitename: web.name // }, function (res) { // loadT.close(); // if (res) { // var checked_str = res.status ? 'checked="true"' : ''; // robj.append('\ //
    \ //
    Auto restart proxy, redirect, http to https when apply or renew SSL
    \ //
    \ // \ // \ //
    \ // '); // } // }); // } // }, { title: lan.site.ssl_dir, callback: function (robj) { robj = $('#webedit-con .tab-con'); robj.html("
    "); bt.site.get_cer_list(function (rdata) { bt.render({ table: '#cer_list_table', columns: [ { field: 'subject', title: lan.site.domain, templet: function (item) { return item.dns.join('
    '); }, }, { field: 'notAfter', width: '100px', title: lan.site.endtime }, { field: 'issuer', width: '150px', title: lan.site.brand }, { field: 'opt', width: '100px', align: 'right', title: lan.site.operate, templet: function (item) { var opt = '' + lan.site.deploy + ' | '; opt += '' + lan.site.del + ''; return opt; }, }, ], data: rdata, }); }); }, }, ]; bt.render_tab('ssl_tabs', tabs); // $('#ssl_tabs').append('
    ' + lan.site.force_https + '
    '); // $("#toHttps").attr('checked', rdata.httpTohttps); // $('#toHttps').click(function (sdata) { // var isHttps = $("#toHttps").attr('checked'); // if (isHttps) { // layer.confirm('After closing HTTPS, you need to clear your browser cache to see the effect. Continue?', { // icon: 3, // title: "Turn off forced HTTPS\"" // }, function () { // bt.site.close_http_to_https(web.name, function (rdata) { // if (rdata.status) { // setTimeout(function () { // site.reload(7); // }, 3000); // } // }) // }); // } else { // bt.site.set_http_to_https(web.name, function (rdata) { // if (!rdata.status) { // setTimeout(function () { // site.reload(7); // }, 3000); // } // }) // } // }) // switch (rdata.type) { // case 1: // $('#ssl_tabs span:eq(0)').trigger('click'); // break; // case 0: // $('#ssl_tabs span:eq(0)').trigger('click'); // break; // default: // $('#ssl_tabs span:eq(0)').trigger('click'); // break; // } $('#ssl_tabs span:eq(' + (rdata.status ? (rdata.csr ? 0 : 1) : 1) + ')').trigger('click'); $('.cutTabView').on('click', function () { $('#ssl_tabs span:eq(1)').trigger('click'); setTimeout(function () { $('.ssl_business_application').trigger('click'); }, 400); }); }); }, show_certificate_confirm: function (sitename, callback) { var _this = this; var auto_restart_rph = function (index, loading) { if (loading) loadT = bt.load(lan.site.the_msg); $.post( '/site?action=auto_restart_rph', { sitename: sitename, }, function (res) { loadT.close(); if (res.status) { if (index) layer.close(index); if (callback) callback(res); } } ); }; var loadT = bt.load(lan.site.the_msg); $.post( '/site?action=get_auto_restart_rph', { sitename: sitename, }, function (res) { if (res && res.status) { auto_restart_rph(); } else { loadT.close(); layer.open({ type: 1, area: '530px', title: 'Apply SSL', closeBtn: 2, shift: 5, shadeClose: false, content: '\
    \
    \ \

    Apply or renew SSL

    \ \
    \
    \ \ \
    \
    \ ', success: function (layers, index) { $('.submit_cert').click(function () { auto_restart_rph(index, true); }); $('.close_cert').click(function () { layer.close(index); }); }, }); } } ); }, }; $('#cutMode .tabs-item[data-type="' + (bt.get_cookie('site_model') || 'php') + '"]').trigger('click'); // site.get_types(); // $.prototype.serializeObject = function() { // var a, o, h, i, e; // a = this.serializeArray(); // o = {}; // h = o.hasOwnProperty; // for (i = 0; i < a.length; i++) { // e = a[i]; // if (!h.call(o, e.name)) { // o[e.name] = e.value; // } // } // return o; // };