pull/109/head
midoks 6 years ago
parent 619df1cf7a
commit e62c536046
  1. 31
      class/core/site_api.py
  2. 6
      route/static/app/site.js

@ -154,6 +154,18 @@ class site_api:
data['path'] = path data['path'] = path
return public.returnJson(True, 'OK', data) return public.returnJson(True, 'OK', data)
def setDirUserIniApi(self):
path = request.form.get('path', '').encode('utf-8')
filename = path + '/.user.ini'
self.delUserInI(path)
if os.path.exists(filename):
public.execShell("which chattr && chattr -i " + filename)
os.remove(filename)
return public.returnJson(True, '已清除防跨站设置!')
public.writeFile(filename, 'open_basedir=' + path + '/:/tmp/:/proc/')
public.execShell("which chattr && chattr +i " + filename)
return public.returnJson(True, '已打开防跨站设置!')
def getCertListApi(self): def getCertListApi(self):
try: try:
vpath = self.sslDir vpath = self.sslDir
@ -1189,6 +1201,25 @@ location /{
except: except:
return None return None
# 清除多余user.ini
def delUserInI(self, path, up=0):
for p1 in os.listdir(path):
try:
npath = path + '/' + p1
if os.path.isdir(npath):
if up < 100:
self.delUserInI(npath, up + 1)
else:
continue
useriniPath = npath + '/.user.ini'
if not os.path.exists(useriniPath):
continue
public.execShell('which chattr && chattr -i ' + useriniPath)
public.execShell('rm -f ' + useriniPath)
except:
continue
return True
# 转换时间 # 转换时间
def strfToTime(self, sdate): def strfToTime(self, sdate):
import time import time

@ -330,13 +330,13 @@ function webPathEdit(id){
+'<p><button class="btn btn-success btn-sm" onclick="SetPathSafe('+id+')">保存</button></p>' +'<p><button class="btn btn-success btn-sm" onclick="SetPathSafe('+id+')">保存</button></p>'
+'</div>' +'</div>'
+'</div>'; +'</div>';
$("#webedit-con").html(webPathHtml);
$("#webedit-con").html(webPathHtml);
$("#userini").change(function(){ $("#userini").change(function(){
$.post('/site?action=SetDirUserINI','path='+rdata,function(userini){ $.post('/site/set_dir_user_ini','path='+webpath,function(userini){
layer.msg(userini.msg+'<p style="color:red;">注意:设置防跨站需要重启PHP才能生效!</p>',{icon:userini.status?1:2}); layer.msg(userini.msg+'<p style="color:red;">注意:设置防跨站需要重启PHP才能生效!</p>',{icon:userini.status?1:2});
});
},'json'); },'json');
});
$("#logs").change(function(){ $("#logs").change(function(){
$.post('/site?action=logsOpen','id='+id,function(userini){ $.post('/site?action=logsOpen','id='+id,function(userini){

Loading…
Cancel
Save