diff --git a/BTPanel/static/js/soft.js b/BTPanel/static/js/soft.js index 65e006bc..988544fd 100644 --- a/BTPanel/static/js/soft.js +++ b/BTPanel/static/js/soft.js @@ -111,43 +111,43 @@ var soft = { return '' + ps + ''; } }, - // { - // field: 'price', title: lan.soft.price, width: 92, templet: function (item) { - // var price = lan.soft.free; - // if (item.price > 0) { - // price = '¥' + item.price + ''; - // } - // return price; - // } - // }, - // { - // field: 'endtime', width: 120, title: lan.soft.expire_time, templet: function (item) { - // var endtime = '--'; - // if (item.pid > 0) { - // if (item.endtime > 0) { - // if (item.type != 10) { - // endtime = bt.format_data(item.endtime, 'yyyy/MM/dd') + ' ('+lan.soft.renew+')'; - // } else { - // endtime = bt.format_data(item.endtime, 'yyyy/MM/dd') + ' ('+lan.soft.renew+')'; - // } - // } - // else if (item.endtime === 0) { - // endtime = lan.soft.permanent; - // } - // else if (item.endtime === -1) { - // endtime = lan.soft.not_open; - // } - // else if (item.endtime === -2) { - // if (item.type != 10) { - // endtime = lan.soft.already_expire + ' ('+lan.soft.renew+')'; - // }else { - // endtime = lan.soft.already_expire + ' ('+lan.soft.renew+')'; - // } - // } - // } - // return endtime; - // } - // }, + { + field: 'price', title: lan.soft.price, width: 92, templet: function (item) { + var price = lan.soft.free; + if (item.price > 0) { + price = '¥' + item.price + ''; + } + return price; + } + }, + { + field: 'endtime', width: 120, title: lan.soft.expire_time, templet: function (item) { + var endtime = '--'; + if (item.pid > 0) { + if (item.endtime > 0) { + if (item.type != 10) { + endtime = bt.format_data(item.endtime, 'yyyy/MM/dd') + ' ('+lan.soft.renew+')'; + } else { + endtime = bt.format_data(item.endtime, 'yyyy/MM/dd') + ' ('+lan.soft.renew+')'; + } + } + else if (item.endtime === 0) { + endtime = lan.soft.permanent; + } + else if (item.endtime === -1) { + endtime = lan.soft.not_open; + } + else if (item.endtime === -2) { + if (item.type != 10) { + endtime = lan.soft.already_expire + ' ('+lan.soft.renew+')'; + }else { + endtime = lan.soft.already_expire + ' ('+lan.soft.renew+')'; + } + } + } + return endtime; + } + }, { field: 'path', width: 40, @@ -1271,23 +1271,23 @@ var soft = { case 'phpmyadmin_safe': var sdata = $('.bt-soft-menu').data('data'); var con = '
\ - '+ lan.soft.pma_port + '\ - \ - \ -
\ -
\ - '+ lan.soft.pma_pass + '\ - \ - \ - \ -
\ -
\ -

'+ lan.soft.pma_user + '

\ -

'+ lan.soft.pma_pass1 + '

\ -

'+ lan.soft.pma_pass2 + '

\ -

\ -
\ - '; + '+ lan.soft.pma_port + '\ + \ + \ + \ +
\ + '+ lan.soft.pma_pass + '\ + \ + \ + \ +
\ +
\ +

'+ lan.soft.pma_user + '

\ +

'+ lan.soft.pma_pass1 + '

\ +

'+ lan.soft.pma_pass2 + '

\ +

\ +
\ + '; $(".soft-man-con").html(con); if (sdata.ext.port) { $(".user_pw").show(); diff --git a/class/ajax.py b/class/ajax.py index 4e28b340..4ef8486e 100644 --- a/class/ajax.py +++ b/class/ajax.py @@ -714,16 +714,74 @@ ServerName 127.0.0.2 public.M('logs').where('id>?',(0,)).delete(); public.WriteLog('TYPE_CONFIG','LOG_CLOSE'); return public.returnMsg(True,'LOG_CLOSE'); - + + def __get_webserver_conffile(self): + if public.get_webserver() == 'nginx': + filename = public.GetConfigValue('setup_path') + '/nginx/conf/nginx.conf' + else: + filename = public.GetConfigValue('setup_path') + '/apache/conf/extra/httpd-vhosts.conf' + return filename + + # 获取phpmyadmin ssl状态 + def get_phpmyadmin_ssl(self,get): + import re + filename = self.__get_webserver_conffile() + conf = public.readFile(filename) + rep = "listen 443 ssl;" + if re.search(rep,conf): + return True + return False + + + # 设置phpmyadmin ssl + def set_phpmyadmin_ssl(self,get): + import re + filename = self.__get_webserver_conffile() + conf = public.readFile(filename) + if get.v == "on": + ssl_conf = """ + #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则 + #error_page 404/404.html; + #AUTH_START + auth_basic "Authorization"; + auth_basic_user_file /www/server/pass/phpmyadmin.pass; + #AUTH_END + ssl_certificate /www/server/panel/ssl/certificate.pem; + ssl_certificate_key /www/server/panel/ssl/privateKey.pem; + ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; + ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; + ssl_prefer_server_ciphers on; + ssl_session_cache shared:SSL:10m; + ssl_session_timeout 10m; + error_page 497 https://$host$request_uri; + #SSL-END""" + listen_conf = """ + listen 888 ssl; + listen 443 ssl;""" + listen_rep = "listen.*" + + conf = re.sub(listen_rep, listen_conf, conf) + + ssl_rep = "\s*#error_page.+;" + conf = re.sub(ssl_rep, ssl_conf, conf) + public.writeFile(filename,conf) + else: + listen_rep = "\n\s*listen.*;\n\s*.*" + listen_conf = "\n\t\tlisten 888 ssl;" + conf = re.sub(listen_rep, listen_conf, conf) + + ssl_rep = "\n\s*#SSL-START(\n|.)+#SSL-END" + sslconf = """ + #error_page 404/404.html;""" + conf = re.sub(ssl_rep, sslconf, conf) + public.writeFile(filename,conf) + return public.returnMsg(True,'SET_PORT_SUCCESS') + #设置PHPMyAdmin def setPHPMyAdmin(self,get): import re; #try: - if public.get_webserver() == 'nginx': - filename = public.GetConfigValue('setup_path') + '/nginx/conf/nginx.conf'; - else: - filename = public.GetConfigValue('setup_path') + '/apache/conf/extra/httpd-vhosts.conf'; - + filename = self.__get_webserver_conffile() conf = public.readFile(filename); if hasattr(get,'port'): mainPort = public.readFile('data/port.pl').strip(); diff --git a/tools.py b/tools.py index 700064c0..33a653cc 100644 --- a/tools.py +++ b/tools.py @@ -400,25 +400,27 @@ def update_to6(): print("====================================================") #命令行菜单 -def bt_cli(): +def bt_cli(u_input = 0): raw_tip = "===============================================" - print("==============="+public.GetMsg("PANEL_SHELL")+"==================") - print("(1) %s (8) %s" % (public.GetMsg("RESTART_PANEL"),public.GetMsg("CHANGE_PANEL_PORT"))) - print("(2) %s (9) %s"% (public.GetMsg("STOP_PANEL"),public.GetMsg("CLEAR_PANEL_CACHE"))) - print("(3) %s (10) %s"% (public.GetMsg("START_PANEL"),public.GetMsg("CLEAR_PANEL_LIMIT"))) - print("(4) %s (11) %s"% (public.GetMsg("RELOAD_PANEL"),public.GetMsg("CANCEL_ENTRY"))) - print("(5) %s (12) %s"% (public.GetMsg("CHANGE_PANEL_PASS"),public.GetMsg("CANCEL_DOMAIN_BIND"))) - print("(6) %s (13) %s"% (public.GetMsg("CHANGE_PANEL_USER"),public.GetMsg("CANCEL_IP_LIMIT"))) - print("(7) %s (14) %s"% (public.GetMsg("CHANGE_MYSQL_PASS_FORCE"),public.GetMsg("GET_PANEL_DEFAULT_MSG"))) - print("(22) %s (15) %s"% ("Display panel error log",public.GetMsg("CLEAR_SYS_RUBBISH"))) - print("(23) %s (16) %s"% ("Turn off BasicAuth authentication","Repair panel (check for errors and update panel files to the latest version)")) - print("(0) Cancel") - print(raw_tip) - try: - u_input = input(public.GetMsg("INPUT_CMD_NUM")) - if sys.version_info[0] == 3: u_input = int(u_input) - except: u_input = 0 - nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16] + if not u_input: + print("==============="+public.GetMsg("PANEL_SHELL")+"==================") + print("(1) %s (8) %s" % (public.GetMsg("RESTART_PANEL"),public.GetMsg("CHANGE_PANEL_PORT"))) + print("(2) %s (9) %s"% (public.GetMsg("STOP_PANEL"),public.GetMsg("CLEAR_PANEL_CACHE"))) + print("(3) %s (10) %s"% (public.GetMsg("START_PANEL"),public.GetMsg("CLEAR_PANEL_LIMIT"))) + print("(4) %s (11) %s"% (public.GetMsg("RELOAD_PANEL"),public.GetMsg("CANCEL_ENTRY"))) + print("(5) %s (12) %s"% (public.GetMsg("CHANGE_PANEL_PASS"),public.GetMsg("CANCEL_DOMAIN_BIND"))) + print("(6) %s (13) %s"% (public.GetMsg("CHANGE_PANEL_USER"),public.GetMsg("CANCEL_IP_LIMIT"))) + print("(7) %s (14) %s"% (public.GetMsg("CHANGE_MYSQL_PASS_FORCE"),public.GetMsg("GET_PANEL_DEFAULT_MSG"))) + print("(22) %s (15) %s"% ("Display panel error log",public.GetMsg("CLEAR_SYS_RUBBISH"))) + print("(23) %s (16) %s"% ("Turn off BasicAuth authentication","Repair panel (check for errors and update panel files to the latest version)")) + print("(0) Cancel") + print(raw_tip) + try: + u_input = input(public.GetMsg("INPUT_CMD_NUM")) + if sys.version_info[0] == 3: u_input = int(u_input) + except: u_input = 0 + + nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,22,23] if not u_input in nums: print(raw_tip) print(public.GetMsg("CANCELLED")) @@ -527,7 +529,7 @@ def bt_cli(): elif u_input == 15: ClearSystem() elif u_input == 16: - os.system("curl http://download.bt.cn/install/update6.sh|bash") + os.system("curl http://download.bt.cn/install/update6_en.sh|bash") elif u_input == 22: os.system('tail -100 /www/server/panel/logs/error.log') elif u_input == 23: