mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-15 09:46:11 +01:00
Plugin Manager
This commit is contained in:
@@ -12,14 +12,23 @@ class secMiddleware:
|
||||
try:
|
||||
data = json.loads(request.body)
|
||||
for key, value in data.iteritems():
|
||||
if type(value) == int or type(value) == bool or key == 'configData':
|
||||
if type(value) == str or type(value) == unicode:
|
||||
pass
|
||||
else:
|
||||
continue
|
||||
if key == 'configData' or key == 'rewriteRules' or key == 'modSecRules':
|
||||
continue
|
||||
if value.find(';') > -1 or value.find('&&') > -1 or value.find('|') > -1 or value.find('...') > -1:
|
||||
logging.writeToFile(request.body)
|
||||
return HttpResponse('Error')
|
||||
final_dic = {'error_message': "Data supplied is not accepted.",
|
||||
"errorMessage": "Data supplied is not accepted."}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
if key.find(';') > -1 or key.find('&&') > -1 or key.find('|') > -1 or key.find('...') > -1:
|
||||
logging.writeToFile(request.body)
|
||||
return HttpResponse('Error')
|
||||
final_dic = {'error_message': "Data supplied is not accepted.", "errorMessage": "Data supplied is not accepted."}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
except BaseException, msg:
|
||||
logging.writeToFile(str(msg))
|
||||
response = self.get_response(request)
|
||||
|
||||
@@ -687,7 +687,7 @@ class preFlightsChecks:
|
||||
|
||||
count = 0
|
||||
while (1):
|
||||
command = "wget http://cyberpanel.net/CyberPanel.1.7.1.tar.gz"
|
||||
command = "wget http://cyberpanel.net/CyberPanel.1.7.2.tar.gz"
|
||||
#command = "wget http://cyberpanel.net/CyberPanelTemp.tar.gz"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
|
||||
@@ -707,7 +707,7 @@ class preFlightsChecks:
|
||||
|
||||
count = 0
|
||||
while(1):
|
||||
command = "tar zxf CyberPanel.1.7.1.tar.gz"
|
||||
command = "tar zxf CyberPanel.1.7.2.tar.gz"
|
||||
#command = "tar zxf CyberPanelTemp.tar.gz"
|
||||
|
||||
res = subprocess.call(shlex.split(command))
|
||||
|
||||
@@ -140,7 +140,7 @@ class BackupManager:
|
||||
## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018
|
||||
tempStoragePath = os.path.join(backupPath, backupName)
|
||||
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||
execPath = "sudo nice -n python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||
execPath = execPath + " submitBackupCreation --tempStoragePath " + tempStoragePath + " --backupName " \
|
||||
+ backupName + " --backupPath " + backupPath + ' --backupDomain ' + backupDomain
|
||||
|
||||
@@ -290,7 +290,7 @@ class BackupManager:
|
||||
else:
|
||||
dir = "CyberPanelRestore"
|
||||
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||
execPath = "sudo nice -n python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||
execPath = execPath + " submitRestore --backupFile " + backupFile + " --dir " + dir
|
||||
subprocess.Popen(shlex.split(execPath))
|
||||
time.sleep(4)
|
||||
|
||||
18
plogical/pluginManagerGlobal.py
Normal file
18
plogical/pluginManagerGlobal.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from django.http import HttpResponse
|
||||
from CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||
|
||||
|
||||
class pluginManagerGlobal:
|
||||
@staticmethod
|
||||
def globalPlug(request, eventInQuest):
|
||||
hookReturn = eventInQuest.send(sender=None, request=request)
|
||||
for items in hookReturn:
|
||||
if type(items[1] == HttpResponse):
|
||||
return items[1]
|
||||
else:
|
||||
if items[1] == 200:
|
||||
return items[1]
|
||||
else:
|
||||
logging.writeToFile('Something wrong with : ' + str(items[0]) + ' on ' + str(eventInQuest))
|
||||
return 200
|
||||
return 200
|
||||
@@ -294,10 +294,9 @@ def issueSSLForDomain(domain, adminEmail, sslpath, aliasDomain = None):
|
||||
else:
|
||||
return [0, "210 Failed to install SSL for domain. [issueSSLForDomain]"]
|
||||
else:
|
||||
pathToStoreSSL = sslUtilities.Server_root + "/conf/vhosts/" + "SSL-" + domain
|
||||
|
||||
if not os.path.exists(pathToStoreSSL):
|
||||
os.mkdir(pathToStoreSSL)
|
||||
pathToStoreSSL = "/etc/letsencrypt/live/" + domain
|
||||
command = 'mkdir -p ' + pathToStoreSSL
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
pathToStoreSSLPrivKey = "/etc/letsencrypt/live/" + domain + "/privkey.pem"
|
||||
pathToStoreSSLFullChain = "/etc/letsencrypt/live/" + domain + "/fullchain.pem"
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
import sys
|
||||
import subprocess
|
||||
import shutil
|
||||
import argparse
|
||||
import os
|
||||
import shlex
|
||||
import time
|
||||
import string
|
||||
import random
|
||||
|
||||
def setupVirtualEnv():
|
||||
##
|
||||
|
||||
|
||||
command = "yum install -y libattr-devel xz-devel gpgme-devel mariadb-devel curl-devel"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
|
||||
##
|
||||
|
||||
|
||||
command = "pip install virtualenv"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
|
||||
####
|
||||
|
||||
command = "virtualenv /usr/local/CyberCP"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
|
||||
##
|
||||
env_path = '/usr/local/CyberCP'
|
||||
if not os.path.exists(env_path):
|
||||
subprocess.call(['virtualenv', env_path])
|
||||
activate_this = os.path.join(env_path, 'bin', 'activate_this.py')
|
||||
execfile(activate_this, dict(__file__=activate_this))
|
||||
|
||||
command = "pip install -r /usr/local/CyberCP/requirments.txt"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
|
||||
##
|
||||
|
||||
command = "systemctl restart gunicorn.socket"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
|
||||
|
||||
setupVirtualEnv()
|
||||
@@ -736,8 +736,8 @@ class virtualHostUtilities:
|
||||
|
||||
pathToStoreSSL = '/etc/letsencrypt/live/' + virtualHost
|
||||
|
||||
if not os.path.exists(pathToStoreSSL):
|
||||
os.mkdir(pathToStoreSSL)
|
||||
command = 'mkdir -p ' + pathToStoreSSL
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
pathToStoreSSLPrivKey = pathToStoreSSL + "/privkey.pem"
|
||||
pathToStoreSSLFullChain = pathToStoreSSL + "/fullchain.pem"
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
default_app_config = 'userManagment.apps.UsermanagmentConfig'
|
||||
@@ -6,3 +6,6 @@ from django.apps import AppConfig
|
||||
|
||||
class UsermanagmentConfig(AppConfig):
|
||||
name = 'userManagment'
|
||||
|
||||
def ready(self):
|
||||
import signals
|
||||
|
||||
7
userManagment/signals.py
Normal file
7
userManagment/signals.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from django.dispatch import receiver
|
||||
from websiteFunctions.signals import postWebsiteDeletion
|
||||
|
||||
@receiver(postWebsiteDeletion)
|
||||
def rcvr(sender, **kwargs):
|
||||
request = kwargs['request']
|
||||
return 200
|
||||
124
websiteFunctions/pluginManager.py
Normal file
124
websiteFunctions/pluginManager.py
Normal file
@@ -0,0 +1,124 @@
|
||||
from signals import *
|
||||
from plogical.pluginManagerGlobal import pluginManagerGlobal
|
||||
|
||||
class pluginManager:
|
||||
|
||||
@staticmethod
|
||||
def preWebsiteCreation(request):
|
||||
return pluginManagerGlobal.globalPlug(request, preWebsiteCreation)
|
||||
|
||||
@staticmethod
|
||||
def postWebsiteCreation(request):
|
||||
return pluginManagerGlobal.globalPlug(request, postWebsiteCreation)
|
||||
|
||||
@staticmethod
|
||||
def preDomainCreation(request):
|
||||
return pluginManagerGlobal.globalPlug(request, preDomainCreation)
|
||||
|
||||
@staticmethod
|
||||
def postDomainCreation(request):
|
||||
return pluginManagerGlobal.globalPlug(request, postDomainCreation)
|
||||
|
||||
@staticmethod
|
||||
def preWebsiteDeletion(request):
|
||||
return pluginManagerGlobal.globalPlug(request, preWebsiteDeletion)
|
||||
|
||||
@staticmethod
|
||||
def postWebsiteDeletion(request):
|
||||
return pluginManagerGlobal.globalPlug(request, postWebsiteDeletion)
|
||||
|
||||
@staticmethod
|
||||
def preDomainDeletion(request):
|
||||
return pluginManagerGlobal.globalPlug(request, preDomainDeletion)
|
||||
|
||||
@staticmethod
|
||||
def postDomainDeletion(request):
|
||||
return pluginManagerGlobal.globalPlug(request, postDomainDeletion)
|
||||
|
||||
@staticmethod
|
||||
def preWebsiteSuspension(request):
|
||||
return pluginManagerGlobal.globalPlug(request, preWebsiteSuspension)
|
||||
|
||||
@staticmethod
|
||||
def postWebsiteSuspension(request):
|
||||
return pluginManagerGlobal.globalPlug(request, postWebsiteSuspension)
|
||||
|
||||
@staticmethod
|
||||
def preWebsiteModification(request):
|
||||
return pluginManagerGlobal.globalPlug(request, preWebsiteModification)
|
||||
|
||||
@staticmethod
|
||||
def postWebsiteModification(request):
|
||||
return pluginManagerGlobal.globalPlug(request, postWebsiteModification)
|
||||
|
||||
@staticmethod
|
||||
def preSaveConfigsToFile(request):
|
||||
return pluginManagerGlobal.globalPlug(request, preSaveConfigsToFile)
|
||||
|
||||
@staticmethod
|
||||
def postSaveConfigsToFile(request):
|
||||
return pluginManagerGlobal.globalPlug(request, postSaveConfigsToFile)
|
||||
|
||||
@staticmethod
|
||||
def preSaveRewriteRules(request):
|
||||
return pluginManagerGlobal.globalPlug(request, preSaveRewriteRules)
|
||||
|
||||
@staticmethod
|
||||
def postSaveRewriteRules(request):
|
||||
return pluginManagerGlobal.globalPlug(request, postSaveRewriteRules)
|
||||
|
||||
@staticmethod
|
||||
def preSaveSSL(request):
|
||||
return pluginManagerGlobal.globalPlug(request, preSaveSSL)
|
||||
|
||||
@staticmethod
|
||||
def postSaveSSL(request):
|
||||
return pluginManagerGlobal.globalPlug(request, postSaveSSL)
|
||||
|
||||
@staticmethod
|
||||
def preChangePHP(request):
|
||||
return pluginManagerGlobal.globalPlug(request, preChangePHP)
|
||||
|
||||
@staticmethod
|
||||
def postChangePHP(request):
|
||||
return pluginManagerGlobal.globalPlug(request, postChangePHP)
|
||||
|
||||
@staticmethod
|
||||
def preChangeOpenBasedir(request):
|
||||
return pluginManagerGlobal.globalPlug(request, preChangeOpenBasedir)
|
||||
|
||||
@staticmethod
|
||||
def postChangeOpenBasedir(request):
|
||||
return pluginManagerGlobal.globalPlug(request, postChangeOpenBasedir)
|
||||
|
||||
@staticmethod
|
||||
def preAddNewCron(request):
|
||||
return pluginManagerGlobal.globalPlug(request, preAddNewCron)
|
||||
|
||||
@staticmethod
|
||||
def postAddNewCron(request):
|
||||
return pluginManagerGlobal.globalPlug(request, postAddNewCron)
|
||||
|
||||
@staticmethod
|
||||
def preRemCronbyLine(request):
|
||||
return pluginManagerGlobal.globalPlug(request, preRemCronbyLine)
|
||||
|
||||
@staticmethod
|
||||
def postRemCronbyLine(request):
|
||||
return pluginManagerGlobal.globalPlug(request, postRemCronbyLine)
|
||||
|
||||
@staticmethod
|
||||
def preSubmitAliasCreation(request):
|
||||
return pluginManagerGlobal.globalPlug(request, preSubmitAliasCreation)
|
||||
|
||||
@staticmethod
|
||||
def postSubmitAliasCreation(request):
|
||||
return pluginManagerGlobal.globalPlug(request, postSubmitAliasCreation)
|
||||
|
||||
@staticmethod
|
||||
def preDelateAlias(request):
|
||||
return pluginManagerGlobal.globalPlug(request, preDelateAlias)
|
||||
|
||||
@staticmethod
|
||||
def postDelateAlias(request):
|
||||
return pluginManagerGlobal.globalPlug(request, postDelateAlias)
|
||||
93
websiteFunctions/signals.py
Normal file
93
websiteFunctions/signals.py
Normal file
@@ -0,0 +1,93 @@
|
||||
# The world is a prison for the believer.
|
||||
|
||||
from django.dispatch import Signal
|
||||
|
||||
## This event is fired before CyberPanel core start creation of website
|
||||
preWebsiteCreation = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired after CyberPanel core finished creation of website.
|
||||
postWebsiteCreation = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired before CyberPanel core start creation of child-domain
|
||||
preDomainCreation = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired after CyberPanel core finished creation of child-domain.
|
||||
postDomainCreation = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired before CyberPanel core start deletion of website
|
||||
preWebsiteDeletion = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired after CyberPanel core finished deletion of website
|
||||
postWebsiteDeletion = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired before CyberPanel core start deletion of child-domain
|
||||
preDomainDeletion = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired after CyberPanel core finished deletion of child-domain
|
||||
postDomainDeletion = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired before CyberPanel core start suspension of website
|
||||
preWebsiteSuspension = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired after CyberPanel core finished suspension of website
|
||||
postWebsiteSuspension = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired before CyberPanel core start suspension of website
|
||||
preWebsiteModification = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired after CyberPanel core finished suspension of website
|
||||
postWebsiteModification = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired before CyberPanel core start saving changes to vhost conf
|
||||
preSaveConfigsToFile = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired after CyberPanel core finished saving changes to vhost conf
|
||||
postSaveConfigsToFile = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired before CyberPanel core start saving changes to vhost rewrite file
|
||||
preSaveRewriteRules = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired after CyberPanel core finished saving changes to vhost rewrite file
|
||||
postSaveRewriteRules = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired before CyberPanel core start saving custom SSL
|
||||
preSaveSSL = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired after CyberPanel core finished saving saving custom SSL
|
||||
postSaveSSL = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired before CyberPanel core start changing php version of domain or website
|
||||
preChangePHP = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired after CyberPanel core finished change php version of domain or website
|
||||
postChangePHP = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired before CyberPanel core start changing open_basdir status for domain or website
|
||||
preChangeOpenBasedir = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired after CyberPanel core finished changing open_basdir status for domain or website
|
||||
postChangeOpenBasedir = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired before CyberPanel core start adding new cron
|
||||
preAddNewCron = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired after CyberPanel core is finished adding new cron
|
||||
postAddNewCron = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired before CyberPanel core start removing cron
|
||||
preRemCronbyLine = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired after CyberPanel core is finished removing cron
|
||||
postRemCronbyLine = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired before CyberPanel core start creating domain alias
|
||||
preSubmitAliasCreation = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired after CyberPanel core is finished creating domain alias
|
||||
postSubmitAliasCreation = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired before CyberPanel core start deleting domain alais
|
||||
preDelateAlias = Signal(providing_args=["request"])
|
||||
|
||||
## This event is fired after CyberPanel core is finished deleting domain alias
|
||||
postDelateAlias = Signal(providing_args=["request"])
|
||||
@@ -8,6 +8,7 @@ from loginSystem.views import loadLoginPage
|
||||
import plogical.CyberCPLogFileWriter as logging
|
||||
import json
|
||||
from plogical.website import WebsiteManager
|
||||
from websiteFunctions.pluginManager import pluginManager
|
||||
|
||||
def loadWebsitesHome(request):
|
||||
try:
|
||||
@@ -63,16 +64,40 @@ def listWebsites(request):
|
||||
def submitWebsiteCreation(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
result = pluginManager.preWebsiteCreation(request)
|
||||
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
wm = WebsiteManager()
|
||||
return wm.submitWebsiteCreation(userID, json.loads(request.body))
|
||||
coreResult = wm.submitWebsiteCreation(userID, json.loads(request.body))
|
||||
|
||||
result = pluginManager.postWebsiteCreation(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
return coreResult
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def submitDomainCreation(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
result = pluginManager.preDomainCreation(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
wm = WebsiteManager()
|
||||
return wm.submitDomainCreation(userID, json.loads(request.body))
|
||||
coreResult = wm.submitDomainCreation(userID, json.loads(request.body))
|
||||
|
||||
result = pluginManager.postDomainCreation(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
return coreResult
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
@@ -94,11 +119,20 @@ def getFurtherAccounts(request):
|
||||
|
||||
def submitWebsiteDeletion(request):
|
||||
try:
|
||||
|
||||
userID = request.session['userID']
|
||||
wm = WebsiteManager()
|
||||
return wm.submitWebsiteDeletion(userID, json.loads(request.body))
|
||||
|
||||
result = pluginManager.preWebsiteDeletion(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
wm = WebsiteManager()
|
||||
coreResult = wm.submitWebsiteDeletion(userID, json.loads(request.body))
|
||||
|
||||
result = pluginManager.postWebsiteDeletion(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
return coreResult
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
@@ -106,8 +140,19 @@ def submitDomainDeletion(request):
|
||||
try:
|
||||
|
||||
userID = request.session['userID']
|
||||
|
||||
result = pluginManager.preDomainDeletion(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
wm = WebsiteManager()
|
||||
return wm.submitDomainDeletion(userID, json.loads(request.body))
|
||||
coreResult = wm.submitDomainDeletion(userID, json.loads(request.body))
|
||||
|
||||
result = pluginManager.postDomainDeletion(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
return coreResult
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
@@ -116,8 +161,19 @@ def submitWebsiteStatus(request):
|
||||
try:
|
||||
|
||||
userID = request.session['userID']
|
||||
|
||||
result = pluginManager.preWebsiteSuspension(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
wm = WebsiteManager()
|
||||
return wm.submitWebsiteStatus(userID, json.loads(request.body))
|
||||
coreResult = wm.submitWebsiteStatus(userID, json.loads(request.body))
|
||||
|
||||
result = pluginManager.postWebsiteSuspension(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
return coreResult
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
@@ -136,8 +192,19 @@ def saveWebsiteChanges(request):
|
||||
try:
|
||||
|
||||
userID = request.session['userID']
|
||||
|
||||
result = pluginManager.preWebsiteModification(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
wm = WebsiteManager()
|
||||
return wm.saveWebsiteChanges(userID, json.loads(request.body))
|
||||
coreResult = wm.saveWebsiteChanges(userID, json.loads(request.body))
|
||||
|
||||
result = pluginManager.postWebsiteModification(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
return coreResult
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
@@ -186,9 +253,22 @@ def getDataFromConfigFile(request):
|
||||
|
||||
def saveConfigsToFile(request):
|
||||
try:
|
||||
|
||||
userID = request.session['userID']
|
||||
|
||||
result = pluginManager.preSaveConfigsToFile(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
wm = WebsiteManager()
|
||||
return wm.saveConfigsToFile(userID, json.loads(request.body))
|
||||
coreResult = wm.saveConfigsToFile(userID, json.loads(request.body))
|
||||
|
||||
result = pluginManager.postSaveConfigsToFile(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
return coreResult
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
@@ -202,25 +282,64 @@ def getRewriteRules(request):
|
||||
|
||||
def saveRewriteRules(request):
|
||||
try:
|
||||
|
||||
userID = request.session['userID']
|
||||
|
||||
result = pluginManager.preSaveRewriteRules(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
wm = WebsiteManager()
|
||||
return wm.saveRewriteRules(userID, json.loads(request.body))
|
||||
coreResult = wm.saveRewriteRules(userID, json.loads(request.body))
|
||||
|
||||
result = pluginManager.postSaveRewriteRules(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
return coreResult
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def saveSSL(request):
|
||||
try:
|
||||
|
||||
userID = request.session['userID']
|
||||
|
||||
result = pluginManager.preSaveSSL(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
wm = WebsiteManager()
|
||||
return wm.saveSSL(userID, json.loads(request.body))
|
||||
coreResult = wm.saveSSL(userID, json.loads(request.body))
|
||||
|
||||
result = pluginManager.postSaveSSL(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
return coreResult
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def changePHP(request):
|
||||
try:
|
||||
|
||||
userID = request.session['userID']
|
||||
|
||||
result = pluginManager.preChangePHP(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
wm = WebsiteManager()
|
||||
return wm.changePHP(userID, json.loads(request.body))
|
||||
coreResult = wm.changePHP(userID, json.loads(request.body))
|
||||
|
||||
result = pluginManager.postChangePHP(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
return coreResult
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
@@ -259,16 +378,38 @@ def saveCronChanges(request):
|
||||
def remCronbyLine(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
result = pluginManager.preRemCronbyLine(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
wm = WebsiteManager()
|
||||
return wm.remCronbyLine(userID, json.loads(request.body))
|
||||
coreResult = wm.remCronbyLine(userID, json.loads(request.body))
|
||||
|
||||
result = pluginManager.postRemCronbyLine(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
return coreResult
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def addNewCron(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
result = pluginManager.preAddNewCron(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
wm = WebsiteManager()
|
||||
return wm.addNewCron(userID, json.loads(request.body))
|
||||
coreResult = wm.addNewCron(userID, json.loads(request.body))
|
||||
|
||||
result = pluginManager.postAddNewCron(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
return coreResult
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
@@ -283,8 +424,19 @@ def domainAlias(request, domain):
|
||||
def submitAliasCreation(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
result = pluginManager.preSubmitAliasCreation(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
wm = WebsiteManager()
|
||||
return wm.submitAliasCreation(userID, json.loads(request.body))
|
||||
coreResult = wm.submitAliasCreation(userID, json.loads(request.body))
|
||||
|
||||
result = pluginManager.postSubmitAliasCreation(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
return coreResult
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
@@ -299,27 +451,40 @@ def issueAliasSSL(request):
|
||||
def delateAlias(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
result = pluginManager.preDelateAlias(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
wm = WebsiteManager()
|
||||
return wm.delateAlias(userID, json.loads(request.body))
|
||||
coreResult = wm.delateAlias(userID, json.loads(request.body))
|
||||
|
||||
result = pluginManager.postDelateAlias(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
return coreResult
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def changeOpenBasedir(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
wm = WebsiteManager()
|
||||
return wm.changeOpenBasedir(userID, json.loads(request.body))
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def applicationInstaller(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
return render(request, 'websiteFunctions/applicationInstaller.html')
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
result = pluginManager.preChangeOpenBasedir(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
wm = WebsiteManager()
|
||||
coreResult = wm.changeOpenBasedir(userID, json.loads(request.body))
|
||||
|
||||
result = pluginManager.postChangeOpenBasedir(request)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
return coreResult
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user