mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-01-26 09:19:05 +01:00
bug fix: csf install and mysql manager
This commit is contained in:
130
plogical/csf.py
130
plogical/csf.py
@@ -54,71 +54,71 @@ class CSF(multi.Thread):
|
||||
|
||||
### manually update csf views.py because it does not load CyberPanel properly in default configurations
|
||||
|
||||
content = '''
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
import django
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||
django.setup()
|
||||
import json
|
||||
from plogical.acl import ACLManager
|
||||
from plogical.httpProc import httpProc
|
||||
import plogical.CyberCPLogFileWriter as logging
|
||||
import subprocess
|
||||
from django.shortcuts import HttpResponse, render
|
||||
from plogical.processUtilities import ProcessUtilities
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
import tempfile
|
||||
from django.http import HttpResponse
|
||||
from django.views.decorators.clickjacking import xframe_options_exempt
|
||||
|
||||
def configservercsf(request):
|
||||
proc = httpProc(request, 'configservercsf/index.html',
|
||||
None, 'admin')
|
||||
return proc.render()
|
||||
|
||||
@csrf_exempt
|
||||
@xframe_options_exempt
|
||||
def configservercsfiframe(request):
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
if request.method == 'GET':
|
||||
qs = request.GET.urlencode()
|
||||
elif request.method == 'POST':
|
||||
qs = request.POST.urlencode()
|
||||
|
||||
try:
|
||||
tmp = tempfile.NamedTemporaryFile(mode = "w", delete=False)
|
||||
tmp.write(qs)
|
||||
tmp.close()
|
||||
command = "/usr/local/csf/bin/cyberpanel.pl '" + tmp.name + "'"
|
||||
|
||||
try:
|
||||
output = ProcessUtilities.outputExecutioner(command)
|
||||
except:
|
||||
output = "Output Error from csf UI script"
|
||||
|
||||
os.unlink(tmp.name)
|
||||
except:
|
||||
output = "Unable to create csf UI temp file"
|
||||
|
||||
return HttpResponse(output)
|
||||
'''
|
||||
|
||||
WriteToFile = open('cyberpanel/configservercsf/views.py', 'w')
|
||||
WriteToFile.write(content)
|
||||
WriteToFile.close()
|
||||
# content = '''
|
||||
# # -*- coding: utf-8 -*-
|
||||
# from __future__ import unicode_literals
|
||||
#
|
||||
# import os
|
||||
# import os.path
|
||||
# import sys
|
||||
# import django
|
||||
# sys.path.append('/usr/local/CyberCP')
|
||||
# os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||
# django.setup()
|
||||
# import json
|
||||
# from plogical.acl import ACLManager
|
||||
# from plogical.httpProc import httpProc
|
||||
# import plogical.CyberCPLogFileWriter as logging
|
||||
# import subprocess
|
||||
# from django.shortcuts import HttpResponse, render
|
||||
# from plogical.processUtilities import ProcessUtilities
|
||||
# from django.views.decorators.csrf import csrf_exempt
|
||||
# import tempfile
|
||||
# from django.http import HttpResponse
|
||||
# from django.views.decorators.clickjacking import xframe_options_exempt
|
||||
#
|
||||
# def configservercsf(request):
|
||||
# proc = httpProc(request, 'configservercsf/index.html',
|
||||
# None, 'admin')
|
||||
# return proc.render()
|
||||
#
|
||||
# @csrf_exempt
|
||||
# @xframe_options_exempt
|
||||
# def configservercsfiframe(request):
|
||||
# userID = request.session['userID']
|
||||
# currentACL = ACLManager.loadedACL(userID)
|
||||
#
|
||||
# if currentACL['admin'] == 1:
|
||||
# pass
|
||||
# else:
|
||||
# return ACLManager.loadError()
|
||||
#
|
||||
# if request.method == 'GET':
|
||||
# qs = request.GET.urlencode()
|
||||
# elif request.method == 'POST':
|
||||
# qs = request.POST.urlencode()
|
||||
#
|
||||
# try:
|
||||
# tmp = tempfile.NamedTemporaryFile(mode = "w", delete=False)
|
||||
# tmp.write(qs)
|
||||
# tmp.close()
|
||||
# command = "/usr/local/csf/bin/cyberpanel.pl '" + tmp.name + "'"
|
||||
#
|
||||
# try:
|
||||
# output = ProcessUtilities.outputExecutioner(command)
|
||||
# except:
|
||||
# output = "Output Error from csf UI script"
|
||||
#
|
||||
# os.unlink(tmp.name)
|
||||
# except:
|
||||
# output = "Unable to create csf UI temp file"
|
||||
#
|
||||
# return HttpResponse(output)
|
||||
# '''
|
||||
#
|
||||
# WriteToFile = open('cyberpanel/configservercsf/views.py', 'w')
|
||||
# WriteToFile.write(content)
|
||||
# WriteToFile.close()
|
||||
|
||||
command = "chmod +x install.sh"
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
Reference in New Issue
Block a user