mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-09 14:56:10 +01:00
code refactor
This commit is contained in:
@@ -520,7 +520,6 @@ class FirewallManager:
|
|||||||
if installStatus.find("[200]") > -1:
|
if installStatus.find("[200]") > -1:
|
||||||
|
|
||||||
execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py"
|
execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py"
|
||||||
|
|
||||||
execPath = execPath + " installModSecConfigs"
|
execPath = execPath + " installModSecConfigs"
|
||||||
|
|
||||||
output = ProcessUtilities.outputExecutioner(execPath)
|
output = ProcessUtilities.outputExecutioner(execPath)
|
||||||
@@ -1292,7 +1291,6 @@ class FirewallManager:
|
|||||||
def installStatusCSF(self):
|
def installStatusCSF(self):
|
||||||
try:
|
try:
|
||||||
userID = self.request.session['userID']
|
userID = self.request.session['userID']
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
|
||||||
|
|
||||||
installStatus = ProcessUtilities.outputExecutioner("sudo cat " + CSF.installLogPath)
|
installStatus = ProcessUtilities.outputExecutioner("sudo cat " + CSF.installLogPath)
|
||||||
|
|
||||||
|
|||||||
@@ -443,7 +443,6 @@ def enableDisableRuleFile(request):
|
|||||||
|
|
||||||
def csf(request):
|
def csf(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
|
||||||
|
|
||||||
result = pluginManager.preCSF(request)
|
result = pluginManager.preCSF(request)
|
||||||
if result != 200:
|
if result != 200:
|
||||||
@@ -462,7 +461,6 @@ def csf(request):
|
|||||||
|
|
||||||
def installCSF(request):
|
def installCSF(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
|
||||||
fm = FirewallManager(request)
|
fm = FirewallManager(request)
|
||||||
return fm.installCSF()
|
return fm.installCSF()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@@ -470,7 +468,6 @@ def installCSF(request):
|
|||||||
|
|
||||||
def installStatusCSF(request):
|
def installStatusCSF(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
|
||||||
fm = FirewallManager(request)
|
fm = FirewallManager(request)
|
||||||
return fm.installStatusCSF()
|
return fm.installStatusCSF()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@@ -478,7 +475,6 @@ def installStatusCSF(request):
|
|||||||
|
|
||||||
def removeCSF(request):
|
def removeCSF(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
|
||||||
fm = FirewallManager(request)
|
fm = FirewallManager(request)
|
||||||
return fm.removeCSF()
|
return fm.removeCSF()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@@ -486,7 +482,6 @@ def removeCSF(request):
|
|||||||
|
|
||||||
def fetchCSFSettings(request):
|
def fetchCSFSettings(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
|
||||||
fm = FirewallManager(request)
|
fm = FirewallManager(request)
|
||||||
return fm.fetchCSFSettings()
|
return fm.fetchCSFSettings()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@@ -494,7 +489,6 @@ def fetchCSFSettings(request):
|
|||||||
|
|
||||||
def changeStatus(request):
|
def changeStatus(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
|
||||||
|
|
||||||
result = pluginManager.preChangeStatus(request)
|
result = pluginManager.preChangeStatus(request)
|
||||||
if result != 200:
|
if result != 200:
|
||||||
@@ -513,7 +507,6 @@ def changeStatus(request):
|
|||||||
|
|
||||||
def modifyPorts(request):
|
def modifyPorts(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
|
||||||
|
|
||||||
result = pluginManager.preModifyPorts(request)
|
result = pluginManager.preModifyPorts(request)
|
||||||
if result != 200:
|
if result != 200:
|
||||||
@@ -532,7 +525,6 @@ def modifyPorts(request):
|
|||||||
|
|
||||||
def modifyIPs(request):
|
def modifyIPs(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
|
||||||
|
|
||||||
result = pluginManager.preModifyIPs(request)
|
result = pluginManager.preModifyIPs(request)
|
||||||
if result != 200:
|
if result != 200:
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ from plogical.httpProc import httpProc
|
|||||||
def loadPHPHome(request):
|
def loadPHPHome(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
|
||||||
|
|
||||||
proc = httpProc(request, 'managePHP/index.html',
|
proc = httpProc(request, 'managePHP/index.html',
|
||||||
None, 'admin')
|
None, 'admin')
|
||||||
@@ -39,8 +38,6 @@ def loadPHPHome(request):
|
|||||||
|
|
||||||
def installExtensions(request):
|
def installExtensions(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
|
||||||
|
|
||||||
if PHP.objects.count() == 0:
|
if PHP.objects.count() == 0:
|
||||||
for i in range(3, 7):
|
for i in range(3, 7):
|
||||||
@@ -1597,7 +1594,6 @@ def getRequestStatusApache(request):
|
|||||||
|
|
||||||
def editPHPConfigs(request):
|
def editPHPConfigs(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
|
||||||
proc = httpProc(request, 'managePHP/editPHPConfig.html',
|
proc = httpProc(request, 'managePHP/editPHPConfig.html',
|
||||||
{'phps': PHPManager.findPHPVersions()}, 'admin')
|
{'phps': PHPManager.findPHPVersions()}, 'admin')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
@@ -1694,7 +1690,6 @@ def getCurrentPHPConfig(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def savePHPConfigBasic(request):
|
def savePHPConfigBasic(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
|
|||||||
@@ -103,7 +103,6 @@ def fetchStatus(request):
|
|||||||
data_ret = {'status': 1, 'error_message': 'None', 'installCheck': 0}
|
data_ret = {'status': 1, 'error_message': 'None', 'installCheck': 0}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
data_ret = {'status': 0, 'error_message': str(msg)}
|
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ def serverStatusHome(request):
|
|||||||
def litespeedStatus(request):
|
def litespeedStatus(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
|
||||||
|
|
||||||
processList = ProcessUtilities.getLitespeedProcessNumber()
|
processList = ProcessUtilities.getLitespeedProcessNumber()
|
||||||
|
|
||||||
@@ -607,7 +606,6 @@ def topProcessesStatus(request):
|
|||||||
data['buffCache'] = '%sMB' % ('0')
|
data['buffCache'] = '%sMB' % ('0')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Swap
|
## Swap
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user