pull/109/head
midoks 6 years ago
parent 97123f915b
commit 5d5abbe3b8
  1. 29
      plugins/php/index.py
  2. 55
      plugins/php/js/php.js
  3. 2
      route/static/app/public.js
  4. 2
      route/templates/default/layout.html

@ -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__":

@ -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,8 +325,7 @@ function disableFunc(version) {
"<tbody id='blacktable'>" + dbody + "</tbody>" +
"</table></div>";
con += '\
<ul class="help-info-text">\
con += '<ul class="help-info-text">\
<li>在此处可以禁用指定函数的调用,以增强环境安全性!</li>\
<li>强烈建议禁用如exec,system等危险函数!</li>\
</ul>';
@ -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 = '<a style="color:green;" href="javascript:messageBox();">安装</a>'
} 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();
});
}

@ -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, {

@ -21,7 +21,7 @@
<div id="container" class="container-fluid">
<div class="sidebar-scroll">
<div class="sidebar-auto">
<div id="task" class="task cw" onclick="messagebox()"></div>
<div id="task" class="task cw" onclick="messageBox();"></div>
<h3 class="mypcip"><span class="f14 cw">{{data['ip']}}</span></h3>
<ul class="menu">
<li id="memuA"> <a class="menu_home" href="/">首页</a></li>

Loading…
Cancel
Save