From df84e3f86cea64e9d85104920c6cc861b76f8336 Mon Sep 17 00:00:00 2001 From: midoks Date: Sat, 12 Jan 2019 21:29:07 +0800 Subject: [PATCH] update --- class/core/common.py | 4 + plugins/php/index.py | 43 ++- plugins/php/js/php.js | 83 ++++- plugins/php/versions/phplib.conf | 487 ++++++++++++++++++++++++++++ plugins/webssh/info.json | 2 +- route/static/app/public.js | 70 ++-- route/templates/default/layout.html | 5 +- 7 files changed, 621 insertions(+), 73 deletions(-) create mode 100755 plugins/php/versions/phplib.conf diff --git a/class/core/common.py b/class/core/common.py index 957a3e37b..5fb774fa0 100755 --- a/class/core/common.py +++ b/class/core/common.py @@ -51,3 +51,7 @@ def initInitD(): if not os.path.exists(initd_bin): shutil.copyfile(script_bin, initd_bin) public.execShell('chmod +x ' + initd_bin) + + +def initUserInfo(): + return '' diff --git a/plugins/php/index.py b/plugins/php/index.py index 40d0cc700..5d4e60d6f 100755 --- a/plugins/php/index.py +++ b/plugins/php/index.py @@ -496,25 +496,34 @@ def getPhpinfo(version): def getLibConf(version): fname = public.getServerDir() + '/php/' + version + '/etc/php.ini' - if not os.path.exists(filename): + if not os.path.exists(fname): return public.returnJson(False, '指定PHP版本不存在!') - data = {} - rep = "disable_functions\s*=\s{0,1}(.*)\n" - tmp = re.search(rep, phpini).groups() - data['disable_functions'] = tmp[0] - - rep = "upload_max_filesize\s*=\s*([0-9]+)(M|m|K|k)" - tmp = re.search(rep, phpini).groups() - data['max'] = tmp[0] - - rep = ur"\n;*\s*cgi\.fix_pathinfo\s*=\s*([0-9]+)\s*\n" - tmp = re.search(rep, phpini).groups() - if tmp[0] == '0': - data['pathinfo'] = False - else: - data['pathinfo'] = True - return public.getJson(data) + phpini = public.readFile(fname) + + libpath = getPluginDir() + '/versions/phplib.conf' + phplib = json.loads(public.readFile(libpath)) + + libs = [] + tasks = public.M('tasks').where( + "status!=?", ('1',)).field('status,name').select() + for lib in phplib: + lib['task'] = '1' + for task in tasks: + tmp = public.getStrBetween('[', ']', task['name']) + if not tmp: + continue + tmp1 = tmp.split('-') + if tmp1[0].lower() == lib['name'].lower(): + lib['task'] = task['status'] + lib['phpversions'] = [] + lib['phpversions'].append(tmp1[1]) + if phpini.find(lib['check']) == -1: + lib['status'] = False + else: + lib['status'] = True + libs.append(lib) + return public.returnJson(True, 'OK!', libs) if __name__ == "__main__": diff --git a/plugins/php/js/php.js b/plugins/php/js/php.js index 6b1434cec..48fee0f7a 100755 --- a/plugins/php/js/php.js +++ b/plugins/php/js/php.js @@ -1,4 +1,4 @@ -function phpPost(method,version, args,callback){ +function phpPost(method, version, args,callback){ var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); var req_data = {}; @@ -382,27 +382,76 @@ function getPHPInfo(version) { function phpLibConfig(version){ -} + phpPost('get_lib_conf', version, '', function(data){ + console.log(data); + var rdata = $.parseJSON(data.data); + console.log(rdata.data); + var libs = rdata.data; -//设置PATHINFO -function setPathInfo(version, type) { - var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] }); - $.post('/config?action=setPathInfo', 'version=' + version + '&type=' + type, function(rdata) { - var pathinfo = (type == 'on') ? true : false; - var pathinfoOpt = '' + lan.public.off + '' - if (!pathinfo) { - pathinfoOpt = '' + lan.public.on + '' + var body = "" + var opt = "" + for (var i = 0; i < libs.length; i++) { + if (libs[i].versions.indexOf(version) == -1) continue; + if (libs[i]['task'] == '-1' && libs[i].phpversions.indexOf(version) != -1) { + opt = '' + lan.soft.the_install + '' + } else if (libs[i]['task'] == '0' && libs[i].phpversions.indexOf(version) != -1) { + opt = '' + lan.soft.sleep_install + '' + } else if (libs[i].status) { + opt = '' + lan.soft.uninstall + '' + } else { + opt = '' + lan.soft.install + '' + } + + body += '' + + '' + libs[i].name + '' + + '' + libs[i].type + '' + + '' + libs[i].msg + '' + + '' + + '' + opt + '' + + ''; } - var pathinfo1 = 'PATH_INFO' + lan.soft.php_menu_ext + '' + lan.soft.mvc_ps + '' + pathinfoOpt + ''; - $("#pathInfo").html(pathinfo1); - $(".bt-w-menu .bgw").attr('onclick', "SetPHPConfig('" + version + "'," + pathinfo + ",1)"); - $(".bt-w-menu .bgw a").attr('href', "javascript:SetPHPConfig('" + version + "'," + pathinfo + ",1);"); - layer.msg(rdata.msg, { icon: 1 }); + + + var con = '
' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + body + '' + + '
' + lan.soft.php_ext_name + '' + lan.soft.php_ext_type + '' + lan.soft.php_ext_ps + '' + lan.soft.php_ext_status + '' + lan.public.action + '
' + + '
' + + ''; + $('.soft-man-con').html(con); }); + } +//设置PATHINFO +// function setPathInfo(version, type) { +// var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] }); +// $.post('/config?action=setPathInfo', 'version=' + version + '&type=' + type, function(rdata) { +// var pathinfo = (type == 'on') ? true : false; +// var pathinfoOpt = '' + lan.public.off + '' +// if (!pathinfo) { +// pathinfoOpt = '' + lan.public.on + '' +// } +// var pathinfo1 = 'PATH_INFO' + lan.soft.php_menu_ext + '' + lan.soft.mvc_ps + '' + pathinfoOpt + ''; +// $("#pathInfo").html(pathinfo1); +// $(".bt-w-menu .bgw").attr('onclick', "SetPHPConfig('" + version + "'," + pathinfo + ",1)"); +// $(".bt-w-menu .bgw a").attr('href', "javascript:SetPHPConfig('" + version + "'," + pathinfo + ",1);"); +// layer.msg(rdata.msg, { icon: 1 }); +// }); +// } + + //PHP扩展配置 function setPHPConfig(version, pathinfo, go) { $.get('/ajax?action=GetPHPConfig&version=' + version, function(rdata) { @@ -411,9 +460,9 @@ function setPHPConfig(version, pathinfo, go) { for (var i = 0; i < rdata.libs.length; i++) { if (rdata.libs[i].versions.indexOf(version) == -1) continue; if (rdata.libs[i]['task'] == '-1' && rdata.libs[i].phpversions.indexOf(version) != -1) { - opt = '' + lan.soft.the_install + '' + opt = '' + lan.soft.the_install + '' } else if (rdata.libs[i]['task'] == '0' && rdata.libs[i].phpversions.indexOf(version) != -1) { - opt = '' + lan.soft.sleep_install + '' + opt = '' + lan.soft.sleep_install + '' } else if (rdata.libs[i].status) { opt = '' + lan.soft.uninstall + '' } else { diff --git a/plugins/php/versions/phplib.conf b/plugins/php/versions/phplib.conf new file mode 100755 index 000000000..1b9d9213a --- /dev/null +++ b/plugins/php/versions/phplib.conf @@ -0,0 +1,487 @@ +[ + { + "name": "ZendGuardLoader", + "versions": [ + "53", + "54", + "55", + "56" + ], + "type": "脚本解密", + "msg": "用于解密ZendGuard加密脚本!", + "shell": "zend_guard_loader.sh", + "check": "ZendGuardLoader.so" + }, + { + "name": "ZendOptimizer", + "versions": [ + "52" + ], + "type": "脚本解密", + "msg": "用于解密ZendOptimizer加密脚本!", + "shell": "zend_optimizer.sh", + "check": "ZendOptimizer.so" + }, + { + "name": "ionCube", + "versions": [ + "52", + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "脚本解密", + "msg": "用于解密ionCube Encoder加密脚本!", + "shell": "ioncube.sh", + "check": "ioncube_loader_lin" + }, + { + "name": "fileinfo", + "versions": [ + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "通用扩展", + "msg": "用于获取文件MIME,编码等信息!", + "shell": "fileinfo.sh", + "check": "fileinfo.so" + }, + { + "name": "opcache", + "versions": [ + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "缓存器", + "msg": "用于加速PHP脚本!", + "shell": "opcache.sh", + "check": "opcache.so" + }, + { + "name": "xcache", + "versions": [ + "52", + "53", + "54", + "55", + "56" + ], + "type": "缓存器", + "msg": "支持脚本缓存和变量缓存!", + "shell": "xcache.sh", + "check": "xcache.so" + }, + { + "name": "memcache", + "versions": [ + "52", + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "缓存器", + "msg": "强大的内容缓存器,不支持集群", + "shell": "memcache.sh", + "check": "memcache.so" + }, + { + "name": "memcached", + "versions": [ + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "缓存器", + "msg": "强大的内容缓存器,支持集群", + "shell": "memcached.sh", + "check": "memcached.so" + }, + { + "name": "redis", + "versions": [ + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "缓存器", + "msg": "更强大的内容缓存器,支持集群", + "shell": "redis.sh", + "check": "redis.so" + }, + { + "name": "apc", + "versions": [ + "53", + "54" + ], + "type": "缓存器", + "msg": "脚本缓存器", + "shell": "apc.sh", + "check": "apc.so" + }, + { + "name": "imagemagick", + "versions": [ + "54", + "55", + "56", + "70", + "71" + ], + "type": "通用扩展", + "msg": "比GD更强大的图形库", + "shell": "imagemagick.sh", + "check": "imagick.so" + }, + { + "name": "xdebug", + "versions": [ + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "调试器", + "msg": "不多说,不了解的不要安装", + "shell": "xdebug.sh", + "check": "xdebug.so" + }, + { + "name": "imap", + "versions": [ + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "邮件服务", + "msg": "邮件服务器必备", + "shell": "imap.sh", + "check": "imap.so" + }, + { + "name": "exif", + "versions": [ + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "通用扩展", + "msg": "用于读取图片EXIF信息", + "shell": "exif.sh", + "check": "exif.so" + }, + { + "name": "intl", + "versions": [ + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "通用扩展", + "msg": "提供国际化支持", + "shell": "intl.sh", + "check": "intl.so" + }, + { + "name": "xsl", + "versions": [ + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "通用扩展", + "msg": "xsl解析扩展", + "shell": "xsl.sh", + "check": "xsl.so" + }, + { + "name": "Swoole", + "versions": [ + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "通用扩展", + "msg": "异步、并行、高性能网络通信引擎", + "shell": "swoole.sh", + "check": "swoole.so" + }, + { + "name": "eAccelerator", + "versions": [ + "52", + "53", + "54" + ], + "type": "缓存器", + "msg": "内容缓存器", + "shell": "eaccelerator.sh", + "check": "eaccelerator.so" + }, + { + "name": "yaf", + "versions": [ + "54", + "55", + "56", + "70", + "71" + ], + "type": "框架", + "msg": "Yaf是一个C语言编写的PHP框架", + "shell": "yaf.sh", + "check": "yaf.so" + }, + { + "name": "mongo", + "versions": [ + "53", + "54", + "55", + "56" + ], + "type": "通用扩展", + "msg": "Mongodb数据库连接驱动", + "shell": "mongo.sh", + "check": "mongo.so" + }, + { + "name": "yac", + "versions": [ + "70", + "71" + ], + "type": "缓存器", + "msg": "高性能无锁共享内存Cache", + "shell": "yac.sh", + "check": "yac.so" + }, + { + "name": "sg11", + "versions": [ + "52", + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "脚本加密", + "msg": "php代码混淆加密", + "shell": "sg11.sh", + "check": "ixed.lin" + }, + { + "name": "readline", + "versions": [ + "52", + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "通用扩展", + "msg": "php官方扩展", + "shell": "readline.sh", + "check": "readline.so" + }, + { + "name": "snmp", + "versions": [ + "52", + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "通用扩展", + "msg": "php官方扩展", + "shell": "snmp.sh", + "check": "snmp.so" + }, + { + "name": "recode", + "versions": [ + "52", + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "通用扩展", + "msg": "php官方扩展", + "shell": "recode.sh", + "check": "recode.so" + }, + { + "name": "enchant", + "versions": [ + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "通用扩展", + "msg": "php官方扩展", + "shell": "enchant.sh", + "check": "enchant.so" + }, + { + "name": "pspell", + "versions": [ + "52", + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "通用扩展", + "msg": "php官方扩展", + "shell": "pspell.sh", + "check": "pspell.so" + }, + { + "name": "bz2", + "versions": [ + "52", + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "通用扩展", + "msg": "php官方扩展", + "shell": "bz2.sh", + "check": "bz2.so" + }, + { + "name": "sysvshm", + "versions": [ + "52", + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "通用扩展", + "msg": "php官方扩展", + "shell": "sysvshm.sh", + "check": "sysvshm.so" + }, + { + "name": "calendar", + "versions": [ + "52", + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "通用扩展", + "msg": "php官方扩展", + "shell": "calendar.sh", + "check": "calendar.so" + }, + { + "name": "gmp", + "versions": [ + "52", + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "通用扩展", + "msg": "php官方扩展", + "shell": "gmp.sh", + "check": "gmp.so" + }, + { + "name": "wddx", + "versions": [ + "52", + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "通用扩展", + "msg": "php官方扩展", + "shell": "wddx.sh", + "check": "wddx.so" + }, + { + "name": "sysvmsg", + "versions": [ + "52", + "53", + "54", + "55", + "56", + "70", + "71" + ], + "type": "通用扩展", + "msg": "php官方扩展", + "shell": "sysvmsg.sh", + "check": "sysvmsg.so" + } +] \ No newline at end of file diff --git a/plugins/webssh/info.json b/plugins/webssh/info.json index d5695b85c..18fc7b778 100755 --- a/plugins/webssh/info.json +++ b/plugins/webssh/info.json @@ -1,6 +1,6 @@ { "id":3, - "title":"宝塔SSH终端", + "title":"SSH终端", "tip":"lib", "name":"webssh", "type":"扩展", diff --git a/route/static/app/public.js b/route/static/app/public.js index da6c13adf..ef675708e 100755 --- a/route/static/app/public.js +++ b/route/static/app/public.js @@ -35,11 +35,11 @@ function randomStrPwd(b) { function getRandomString(len) { len = len || 32; - var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'; // 默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1 - var maxPos = $chars.length; + var chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'; // 默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1 + var maxPos = chars.length; var pwd = ''; for (i = 0; i < len; i++) { - pwd += $chars.charAt(Math.floor(Math.random() * maxPos)); + pwd += chars.charAt(Math.floor(Math.random() * maxPos)); } return pwd; } @@ -683,7 +683,7 @@ var downLoad = null; var speed = null; function task() { - messagebox(); + messageBox(); } function ActionTask() { @@ -858,14 +858,13 @@ function listOrder(skey,type,obj){ } //添加面板快捷登录 -function bindBTPanel(a,type,ip,btid,url,user,pw){ - var titleName = lan.bt.panel_add; +function bindPanel(a,type,ip,btid,url,user,pw){ + var titleName = '关联面板'; if(type == "b"){ - btn = ""; - } - else{ - titleName = lan.bt.panel_edit+ip; - btn = ""; + btn = ""; + } else { + titleName = '修改关联' + ip; + btn = ""; } if(url == undefined) url="http://"; if(user == undefined) user=""; @@ -909,20 +908,21 @@ function bindBTPanel(a,type,ip,btid,url,user,pw){ shift: 5, shadeClose: false, content: "
\ -
"+lan.bt.panel_address+"\ -
\ -
\ -
"+lan.bt.panel_user+"\ -
\ -
\ -
"+lan.bt.panel_pass+"\ -
\ -
\ -
"+lan.bt.panel_ps+"\ -
\ -
\ -
  • "+lan.bt.panel_ps_1+"
  • "+lan.bt.panel_ps_2+"
  • "+lan.bt.panel_ps_3+"
\ -
"+btn+"
" +
"+lan.bt.panel_address+"\ +
\ +
\ +
"+lan.bt.panel_user+"\ +
\ +
\ +
"+lan.bt.panel_pass+"\ +
\ +
\ +
"+lan.bt.panel_ps+"\ +
\ +
\ +
\ +
"+btn+"
\ + " }); $("#btaddress").on("input",function(){ var str =$(this).val(); @@ -937,7 +937,7 @@ function bindBTPanel(a,type,ip,btid,url,user,pw){ }); } //删除快捷登录 -function bindBTPaneldel(id){ +function bindPaneldel(id){ $.post("/config?action=DelPanelInfo","id="+id,function(rdata){ layer.closeAll(); layer.msg(rdata.msg,{icon:rdata.status?1:2}); @@ -967,7 +967,7 @@ function getSpeed(sele){ }); } //消息盒子 -function messagebox() { +function messageBox() { layer.open({ type: 1, title: lan.bt.task_title, @@ -1029,19 +1029,17 @@ function remind(a){ $(".msg_count").text(g.data.length); $(".taskcon").html(con); $("#taskPage").html(g.page); + $("#Rs-checkAll").click(function(){ if($(this).prop("checked")){ $("#remind").find("input").prop("checked",true) - } - else{ + } else { $("#remind").find("input").prop("checked",false) } }); - },'json'); } - function getReloads() { var a = 0; var mm = $(".bt-w-menu .bgw").html() @@ -1051,7 +1049,7 @@ function getReloads() { speed = null; return } - if(speed) return; + if(speed) {return;} speed = setInterval(function() { var mm = $(".bt-w-menu .bgw").html() if(mm == undefined || mm.indexOf(lan.bt.task_list) == -1) { @@ -1061,10 +1059,10 @@ function getReloads() { return } a++; - $.post("/task/get_task_speed", "", function(h) { + $.post('/task/get_task_speed', '', function(h) { if(h.task == undefined) { $(".cmdlist").html(lan.bt.task_not_list); - return + return; } var b = ""; var d = ""; @@ -1181,7 +1179,7 @@ function scroll_handle(e){ $(function(){ setInterval(function(){ check_login(); - },60000); + },6000); }); function asyncLoadImage(obj, url){ @@ -1189,7 +1187,6 @@ function asyncLoadImage(obj, url){ if (typeof(url) == 'undefined'){ return; } - loadImage(obj, url, showImage); function loadImage(obj,url,callback){ var img = new Image(); @@ -1207,6 +1204,7 @@ function asyncLoadImage(obj, url){ function showImage(obj){ obj.src = this.src; } + loadImage(obj, url, showImage); } function loadImage(){ diff --git a/route/templates/default/layout.html b/route/templates/default/layout.html index aa6ed2100..ff8f1df69 100755 --- a/route/templates/default/layout.html +++ b/route/templates/default/layout.html @@ -35,7 +35,7 @@
  • 退出
  • -
    +
    +
    +
    @@ -45,7 +45,7 @@ - + {% block content %}{% endblock %} +