diff --git a/class/core/plugins_api.py b/class/core/plugins_api.py index e6962fe5c..28b62dbf0 100755 --- a/class/core/plugins_api.py +++ b/class/core/plugins_api.py @@ -161,7 +161,7 @@ class plugins_api: return '' def checkInstalled(self): - checks = ['nginx', 'apache', 'php', 'mysql'] + checks = ['nginx', 'php'] for name in checks: filename = public.getRootDir() + "/server/" + name if os.path.exists(filename): diff --git a/plugins/mysql/js/mysql.js b/plugins/mysql/js/mysql.js index d16ff9a8b..ac02f576a 100755 --- a/plugins/mysql/js/mysql.js +++ b/plugins/mysql/js/mysql.js @@ -177,8 +177,7 @@ function myPerfOpt() { //获取MySQL配置 myPost('db_status','',function(data){ var rdata = $.parseJSON(data.data); - console.log(rdata); - + // console.log(rdata); var key_buffer_size = toSizeM(rdata.mem.key_buffer_size); var query_cache_size = toSizeM(rdata.mem.query_cache_size); var tmp_table_size = toSizeM(rdata.mem.tmp_table_size); @@ -538,10 +537,15 @@ function delDb(id, name){ function openPhpmyadmin(name,username,password){ + var url = $("#toPHPMyAdmin").attr('action'); + console.log(url); + + + if($("#toPHPMyAdmin").attr('action').indexOf('phpmyadmin') == -1){ - layer.msg(lan.database.phpmyadmin_err,{icon:2,shade: [0.3, '#000']}) + layer.msg('请先安装phpMyAdmin',{icon:2,shade: [0.3, '#000']}) setTimeout(function(){ window.location.href = '/soft'; },3000); - return; + return; } var murl = $("#toPHPMyAdmin").attr('action'); @@ -549,7 +553,7 @@ function openPhpmyadmin(name,username,password){ $("#pma_password").val(password); $("#db").val(name); - layer.msg(lan.database.phpmyadmin,{icon:16,shade: [0.3, '#000'],time:1000}); + layer.msg('正在打开phpMyAdmin',{icon:16,shade: [0.3, '#000'],time:1000}); setTimeout(function(){ $("#toPHPMyAdmin").submit(); diff --git a/plugins/phpmyadmin/index.html b/plugins/phpmyadmin/index.html index 5d48667d9..a4180e9fa 100755 --- a/plugins/phpmyadmin/index.html +++ b/plugins/phpmyadmin/index.html @@ -3,6 +3,7 @@
diff --git a/plugins/phpmyadmin/index.py b/plugins/phpmyadmin/index.py index c8c0508c0..b4a12661f 100755 --- a/plugins/phpmyadmin/index.py +++ b/plugins/phpmyadmin/index.py @@ -47,7 +47,21 @@ def getArgs(): def getConf(): return public.getServerDir() + '/openresty/nginx/conf/vhost/phpmyadmin.conf' -#{$PHP_VERSION} + +def getPort(): + file = getConf() + content = public.readFile(file) + rep = 'listen\s*(.*);' + tmp = re.search(rep, content) + return tmp.groups()[0].strip() + + +def getHomePage(): + port = getPort() + ip = '127.0.0.1' + if not public.isAppleSystem(): + ip = public.getLocalIp() + return 'http://' + ip + ':' + port + '/phpmyadmin/index.php' def getPhpVer(expect=55): @@ -129,5 +143,7 @@ if __name__ == "__main__": print reload() elif func == 'conf': print getConf() + elif func == 'get_home_page': + print getHomePage() else: print 'error' diff --git a/plugins/phpmyadmin/js/phpmyadmin.js b/plugins/phpmyadmin/js/phpmyadmin.js index 80e04e12e..d3b4178d4 100755 --- a/plugins/phpmyadmin/js/phpmyadmin.js +++ b/plugins/phpmyadmin/js/phpmyadmin.js @@ -1,3 +1,44 @@ +function str2Obj(str){ + var data = {}; + kv = str.split('&'); + for(i in kv){ + v = kv[i].split('='); + data[v[0]] = v[1]; + } + return data; +} + +function pmaPost(method,args,callback){ + + var _args = null; + if (typeof(args) == 'string'){ + _args = JSON.stringify(str2Obj(args)); + } else { + _args = JSON.stringify(args); + } + + var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); + $.post('/plugins/run', {name:'phpmyadmin', func:method, args:_args}, function(data) { + layer.close(loadT); + if (!data.status){ + layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']}); + return; + } + + if(typeof(callback) == 'function'){ + callback(data); + } + },'json'); +} + +function homePage(){ + pmaPost('get_home_page', '', function(data){ + console.log(data); + var con = ''; + $(".soft-man-con").html(con); + }); +} + //phpmyadmin安全设置 function safeConf(name, port, auth) { var con = '