Skip to content

Commit

Permalink
bug fix: csf install and mysql manager
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Oct 3, 2024
1 parent f540cc2 commit 6b437ec
Showing 1 changed file with 65 additions and 65 deletions.
130 changes: 65 additions & 65 deletions plogical/csf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,71 +54,71 @@ def installCSF():

### 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)
Expand Down

0 comments on commit 6b437ec

Please sign in to comment.