diff --git a/plugins/php/index.py b/plugins/php/index.py
index ec5c1f22d..ae0e7074e 100755
--- a/plugins/php/index.py
+++ b/plugins/php/index.py
@@ -54,6 +54,13 @@ def getArgs():
return tmp
+def checkArgs(data, ck=[]):
+ for i in range(len(ck)):
+ if not ck[i] in data:
+ return (False, public.returnJson(False, '参数:(' + ck[i] + ')没有!'))
+ return (True, public.returnJson(True, 'ok'))
+
+
def getConf(version):
path = getServerDir() + '/' + version + '/etc/php.ini'
return path
@@ -300,8 +307,10 @@ def getLimitConf(version):
def setMaxTime(version):
args = getArgs()
- if not 'time' in args:
- return 'missing time args!'
+ data = checkArgs(args, ['time'])
+ if not data[0]:
+ return data[1]
+
time = args['time']
if int(time) < 30 or int(time) > 86400:
return public.returnJson(False, '请填写30-86400间的值!')
@@ -527,7 +536,21 @@ def getLibConf(version):
def installLib(version):
- return version, 'ok'
+ args = getArgs()
+ data = checkArgs(args, ['type', 'name'])
+ if not data[0]:
+ return data[1]
+
+ name = args['name']
+ stype = args['type']
+ execstr = "cd " + getPluginDir() + '/versions/' + version + " && /bin/bash " + \
+ name + '.sh' + " " + stype + " " + version
+
+ rettime = time.strftime('%Y-%m-%d %H:%M:%S')
+ public.M('tasks').add('id,name,type,status,addtime,execstr', (None,
+ '安装[' + name + '-' + version + ']', 'execshell', '0', rettime, execstr))
+ # print execstr
+ return public.returnJson(True, '已将下载任务添加到队列!')
if __name__ == "__main__":
diff --git a/plugins/php/js/php.js b/plugins/php/js/php.js
index 7c444f95b..52d736cad 100755
--- a/plugins/php/js/php.js
+++ b/plugins/php/js/php.js
@@ -1,3 +1,14 @@
+
+function str2Obj(str){
+ var data = {};
+ kv = str.split('&');
+ for(i in kv){
+ v = kv[i].split('=');
+ data[v[0]] = v[1];
+ }
+ return data;
+}
+
function phpPost(method, version, args,callback){
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
@@ -6,7 +17,9 @@ function phpPost(method, version, args,callback){
req_data['func'] = method;
req_data['version'] = version;
- if (typeof(args) != 'undefined' && args!=''){
+ if (typeof(args) == 'string'){
+ req_data['args'] = JSON.stringify(str2Obj(args));
+ } else {
req_data['args'] = JSON.stringify(args);
}
@@ -312,11 +325,10 @@ function disableFunc(version) {
"
" + dbody + "" +
"";
- con += '\
- \
- - 在此处可以禁用指定函数的调用,以增强环境安全性!
\
- - 强烈建议禁用如exec,system等危险函数!
\
-
';
+ con += '\
+ - 在此处可以禁用指定函数的调用,以增强环境安全性!
\
+ - 强烈建议禁用如exec,system等危险函数!
\
+
';
$(".soft-man-con").html(con);
});
@@ -383,14 +395,16 @@ function getPHPInfo(version) {
function phpLibConfig(version){
phpPost('get_lib_conf', version, '', function(data){
-
var rdata = $.parseJSON(data.data);
var libs = rdata.data;
- var body = "";
- var opt = "";
+ var body = '';
+ var opt = '';
for (var i = 0; i < libs.length; i++) {
- if (libs[i].versions.indexOf(version) == -1) continue;
+ if (libs[i].versions.indexOf(version) == -1){
+ continue;
+ }
+
if (libs[i]['task'] == '-1' && libs[i].phpversions.indexOf(version) != -1) {
opt = '安装'
} else if (libs[i]['task'] == '0' && libs[i].phpversions.indexOf(version) != -1) {
@@ -522,19 +536,24 @@ function installPHPLib(version, name, title, pathinfo) {
layer.confirm('您真的要安装{1}吗?'.replace('{1}', name), { icon: 3, closeBtn: 2 }, function() {
name = name.toLowerCase();
var data = "name=" + name + "&version=" + version + "&type=1";
- var loadT = layer.msg('正在添加到安装器...', { icon: 16, time: 0, shade: [0.3, '#000'] });
- $.post('/files?action=InstallSoft', data, function(rdata) {
- setTimeout(function() {
- layer.close(loadT);
- SetPHPConfig(version, pathinfo, true);
- setTimeout(function() {
- layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
- }, 1000);
- }, 1000);
+ // var loadT = layer.msg('正在添加到安装器...', { icon: 16, time: 0, shade: [0.3, '#000'] });
+ // $.post('/files?action=InstallSoft', data, function(rdata) {
+ // setTimeout(function() {
+ // layer.close(loadT);
+ // SetPHPConfig(version, pathinfo, true);
+ // setTimeout(function() {
+ // layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
+ // }, 1000);
+ // }, 1000);
+ // });
+
+ phpPost('install_lib', version, data, function(data){
+ var rdata = $.parseJSON(data.data);
+ console.log(rdata);
});
- fly("bi-btn");
- InstallTips();
+ // fly("bi-btn");
+ // installTips();
getTaskCount();
});
}
diff --git a/route/static/app/public.js b/route/static/app/public.js
index ef675708e..63d5232cb 100755
--- a/route/static/app/public.js
+++ b/route/static/app/public.js
@@ -769,7 +769,7 @@ function jump() {
window.location.href = "/soft"
}
-function InstallTips() {
+function installTips() {
$(".fangshi label").mouseover(function() {
var a = $(this).attr("data-title");
layer.tips(a, this, {
diff --git a/route/templates/default/layout.html b/route/templates/default/layout.html
index ff8f1df69..17f0caeab 100755
--- a/route/templates/default/layout.html
+++ b/route/templates/default/layout.html
@@ -21,7 +21,7 @@