mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-01-06 07:39:43 +01:00
Improved WordPress installation process.
This commit is contained in:
@@ -134,4 +134,5 @@ h1, h2, h3, h4, h5, h6,
|
||||
|
||||
/* Admin responsive */
|
||||
|
||||
@media only screen and (min-width:20em){#header-logo,#theme-options{display:none}#page-sidebar{transform:translateX(0);-ms-transform:translateX(0);-o-transform:translateX(0);-webkit-transform:translateX(0);visibility:hidden}#page-content{margin-left:0}}@media only screen and (min-width:56.25em){#header-logo,#page-sidebar.collapse,#theme-options{display:block}#mobile-navigation{display:none}#page-sidebar{transform:translateX(0);-ms-transform:translateX(0);-o-transform:translateX(0);-webkit-transform:translateX(0);visibility:visible}#page-content{margin-left:260px}}@media only screen and (max-width:760px){#cloud-btn,#header-nav-right #fullscreen-btn{display:none}}@media only screen and (max-width:630px){#page-header .user-account-btn>a.user-profile span{display:none}#page-header .user-account-btn .dropdown-menu:after,#page-header .user-account-btn .dropdown-menu:before{left:56px}}@media only screen and (max-width:545px){#header-nav-right #chatbox-btn{display:none}}@media only screen and (max-width:520px){#dashnav-btn,#page-header .user-account-btn>a.user-profile span{display:none}.popover{width:100%;border-radius:0}.box-md{width:auto}}@media only screen and (max-width:460px){.box-sm,.timeline-box .popover{width:auto}#page-content{padding:10px}#page-title{padding:10px 0 15px;text-align:center}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{margin-bottom:20px}.content-box{margin-top:0!important}.row.mrg20B{margin-bottom:0!important}#page-title p,#progress-btn,.dashboard-box .list-grade,.header-buttons-separator,.todo-box .bs-label,.todo-box .btn,.tooltip .tooltip-arrow{display:none}}@media only screen and (max-width:410px){#header-nav-right #logout-btn,#notifications-btn{display:none}#header-nav-left{float:right}#header-nav-right{margin-right:0;margin-left:15px;float:left}.dropdown-menu{position:fixed;left:0!important;width:100%;border-radius:0}#page-header .user-account-btn .dropdown-menu{top:65px}#page-header .user-account-btn .dropdown-menu:after,#page-header .user-account-btn .dropdown-menu:before{left:auto;right:24px}}
|
||||
@media only screen and (min-width:20em){#header-logo,#theme-options{display:none}#page-sidebar{transform:translateX(0);-ms-transform:translateX(0);-o-transform:translateX(0);-webkit-transform:translateX(0);visibility:hidden}#page-content{margin-left:0}}@media only screen and (min-width:56.25em){#header-logo,#page-sidebar.collapse,#theme-options{display:block}#mobile-navigation{display:none}#page-sidebar{transform:translateX(0);-ms-transform:translateX(0);-o-transform:translateX(0);-webkit-transform:translateX(0);visibility:visible}#page-content{margin-left:260px}}@media only screen and (max-width:760px){#cloud-btn,#header-nav-right #fullscreen-btn{display:none}}@media only screen and (max-width:630px){#page-header .user-account-btn>a.user-profile span{display:none}#page-header .user-account-btn .dropdown-menu:after,#page-header .user-account-btn .dropdown-menu:before{left:56px}}@media only screen and (max-width:545px){#header-nav-right #chatbox-btn{display:none}}@media only screen and (max-width:520px){#dashnav-btn,#page-header .user-account-btn>a.user-profile span{display:none}.popover{width:100%;border-radius:0}.box-md{width:auto}}@media only screen and (max-width:460px){.box-sm,.timeline-box .popover{width:auto}#page-content{padding:10px}#page-title{padding:10px 0 15px;text-align:center}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{margin-bottom:20px}.content-box{margin-top:0!important}.row.mrg20B{margin-bottom:0!important}#page-title p,#progress-btn,.dashboard-box .list-grade,.header-buttons-separator,.todo-box .bs-label,.todo-box .btn,.tooltip .tooltip-arrow{display:none}}@media only screen and (max-width:410px){#header-nav-right #logout-btn,#notifications-btn{display:none}#header-nav-left{float:right}#header-nav-right{margin-right:0;margin-left:15px;float:left}.dropdown-menu{position:fixed;left:0!important;width:100%;border-radius:0}#page-header .user-account-btn .dropdown-menu{top:65px}#page-header .user-account-btn .dropdown-menu:after,#page-header .user-account-btn .dropdown-menu:before{left:auto;right:24px}}
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@
|
||||
</div><!-- #header-nav-right -->
|
||||
|
||||
</div>
|
||||
<div id="page-sidebar">
|
||||
<div id="page-sidebar">
|
||||
<div class="scroll-sidebar">
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
|
||||
<form action="/" class="form-horizontal bordered-row">
|
||||
<form class="form-horizontal bordered-row">
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
@@ -32,7 +32,7 @@ def listDomains(request):
|
||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||
|
||||
if admin.type == 1:
|
||||
websites = Websites.objects.all()
|
||||
websites = DomainLimits.objects.all()
|
||||
else:
|
||||
return HttpResponse("Only administrator can view this page.")
|
||||
|
||||
@@ -44,7 +44,7 @@ def listDomains(request):
|
||||
installCheck = 0
|
||||
|
||||
for items in output:
|
||||
if items.find('check_policy_service inet:localhost:1089') > -1:
|
||||
if items.find('check_policy_service unix:/var/log/policyServerSocket') > -1:
|
||||
installCheck = 1
|
||||
break
|
||||
|
||||
@@ -81,10 +81,9 @@ def listDomains(request):
|
||||
def getFurtherDomains(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
|
||||
try:
|
||||
|
||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if request.method == 'POST':
|
||||
try:
|
||||
@@ -124,7 +123,7 @@ def getFurtherDomains(request):
|
||||
else:
|
||||
json_data = json_data +',' + json.dumps(dic)
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
pass
|
||||
|
||||
json_data = json_data + ']'
|
||||
final_dic = {'listWebSiteStatus': 1, 'error_message': "None", "data": json_data}
|
||||
@@ -953,7 +952,7 @@ def fetchPolicyServerStatus(request):
|
||||
installCheck = 0
|
||||
|
||||
for items in output:
|
||||
if items.find('check_policy_service inet:localhost:1089') > -1:
|
||||
if items.find('check_policy_service unix:/var/log/policyServerSocket') > -1:
|
||||
installCheck = 1
|
||||
break
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ def addRule(request):
|
||||
def deleteRule(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(val=val)
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
|
||||
13
install/FileManager/.idea/workspace.xml
generated
13
install/FileManager/.idea/workspace.xml
generated
@@ -14,8 +14,8 @@
|
||||
<file leaf-file-name="fileManager.php" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/php/fileManager.php">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="306">
|
||||
<caret line="74" column="30" lean-forward="true" selection-start-line="74" selection-start-column="30" selection-end-line="74" selection-end-column="30" />
|
||||
<state relative-caret-position="414">
|
||||
<caret line="80" column="26" lean-forward="true" selection-start-line="80" selection-start-column="26" selection-end-line="80" selection-end-column="26" />
|
||||
<folding>
|
||||
<element signature="n#listDir#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#getPermissions#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
@@ -176,16 +176,15 @@
|
||||
<workItem from="1526512471223" duration="71000" />
|
||||
<workItem from="1530908210451" duration="3368000" />
|
||||
<workItem from="1531046295316" duration="1117000" />
|
||||
<workItem from="1531052646849" duration="26000" />
|
||||
<workItem from="1531052646849" duration="625000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="41000000" />
|
||||
<option name="totallyTimeSpent" value="41599000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="1419" y="-4" width="1303" height="780" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.12759416" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
@@ -575,8 +574,8 @@
|
||||
<entry file="file://$USER_HOME$/.cache/.fr-Tsiwv1/CyberCP/install/FileManager/php/fileManager.php" />
|
||||
<entry file="file://$PROJECT_DIR$/php/fileManager.php">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="306">
|
||||
<caret line="74" column="30" lean-forward="true" selection-start-line="74" selection-start-column="30" selection-end-line="74" selection-end-column="30" />
|
||||
<state relative-caret-position="414">
|
||||
<caret line="80" column="26" lean-forward="true" selection-start-line="80" selection-start-column="26" selection-end-line="80" selection-end-column="26" />
|
||||
<folding>
|
||||
<element signature="n#listDir#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#getPermissions#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
|
||||
281
plogical/applicationInstaller.py
Normal file
281
plogical/applicationInstaller.py
Normal file
@@ -0,0 +1,281 @@
|
||||
#!/usr/local/CyberCP/bin/python2
|
||||
import os,sys
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
import django
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||
django.setup()
|
||||
import threading as multi
|
||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||
import subprocess
|
||||
import shlex
|
||||
from vhost import vhost
|
||||
from loginSystem.models import Administrator
|
||||
from websiteFunctions.models import ChildDomains, Websites
|
||||
import randomPassword
|
||||
from mysqlUtilities import mysqlUtilities
|
||||
from databases.models import Databases
|
||||
from installUtilities import installUtilities
|
||||
import shutil
|
||||
|
||||
|
||||
class ApplicationInstaller(multi.Thread):
|
||||
|
||||
def __init__(self, installApp, extraArgs):
|
||||
multi.Thread.__init__(self)
|
||||
self.installApp = installApp
|
||||
self.extraArgs = extraArgs
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
if self.installApp == 'wordpress':
|
||||
self.installWordPress()
|
||||
|
||||
except BaseException, msg:
|
||||
logging.writeToFile( str(msg) + ' [ApplicationInstaller.run]')
|
||||
|
||||
|
||||
def installWPCLI(self):
|
||||
try:
|
||||
command = 'sudo wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar'
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
command = 'sudo chmod +x wp-cli.phar'
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
command = 'sudo mv wp-cli.phar /usr/bin/wp'
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
except BaseException, msg:
|
||||
logging.writeToFile( str(msg) + ' [ApplicationInstaller.installWPCLI]')
|
||||
|
||||
|
||||
|
||||
def installWordPress(self):
|
||||
try:
|
||||
|
||||
admin = self.extraArgs['admin']
|
||||
domainName = self.extraArgs['domainName']
|
||||
home = self.extraArgs['home']
|
||||
tempStatusPath = self.extraArgs['tempStatusPath']
|
||||
blogTitle = self.extraArgs['blogTitle']
|
||||
adminUser = self.extraArgs['adminUser']
|
||||
adminPassword = self.extraArgs['adminPassword']
|
||||
adminEmail = self.extraArgs['adminEmail']
|
||||
|
||||
|
||||
### Check WP CLI
|
||||
|
||||
try:
|
||||
command = 'sudo wp --info'
|
||||
res = subprocess.call(shlex.split(command))
|
||||
|
||||
if res == 1:
|
||||
self.installWPCLI()
|
||||
except subprocess.CalledProcessError:
|
||||
self.installWPCLI()
|
||||
|
||||
## Open Status File
|
||||
|
||||
statusFile = open(tempStatusPath, 'w')
|
||||
statusFile.writelines('Setting up paths,0')
|
||||
statusFile.close()
|
||||
|
||||
try:
|
||||
website = ChildDomains.objects.get(domain=domainName)
|
||||
externalApp = website.master.externalApp
|
||||
|
||||
if admin.type != 1:
|
||||
if website.master.admin != admin:
|
||||
statusFile = open(tempStatusPath, 'w')
|
||||
statusFile.writelines("You do not own this website." + " [404]")
|
||||
statusFile.close()
|
||||
return 0
|
||||
|
||||
except:
|
||||
website = Websites.objects.get(domain=domainName)
|
||||
externalApp = website.externalApp
|
||||
|
||||
if admin.type != 1:
|
||||
if website.admin != admin:
|
||||
statusFile = open(tempStatusPath, 'w')
|
||||
statusFile.writelines("You do not own this website." + " [404]")
|
||||
statusFile.close()
|
||||
return 0
|
||||
|
||||
finalPath = ""
|
||||
|
||||
|
||||
if home == '0':
|
||||
path = self.extraArgs['path']
|
||||
finalPath = "/home/" + domainName + "/public_html/" + path + "/"
|
||||
else:
|
||||
finalPath = "/home/" + domainName + "/public_html/"
|
||||
|
||||
|
||||
## Security Check
|
||||
|
||||
if finalPath.find("..") > -1:
|
||||
statusFile = open(tempStatusPath, 'w')
|
||||
statusFile.writelines("Specified path must be inside virtual host home." + " [404]")
|
||||
statusFile.close()
|
||||
return 0
|
||||
|
||||
FNULL = open(os.devnull, 'w')
|
||||
|
||||
if not os.path.exists(finalPath):
|
||||
command = 'sudo mkdir -p ' + finalPath
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
## checking for directories/files
|
||||
|
||||
dirFiles = os.listdir(finalPath)
|
||||
|
||||
if len(dirFiles) == 1:
|
||||
if dirFiles[0] == ".well-known":
|
||||
pass
|
||||
else:
|
||||
statusFile = open(tempStatusPath, 'w')
|
||||
statusFile.writelines("Target directory should be empty before installation, otherwise data loss could occur." + " [404]")
|
||||
statusFile.close()
|
||||
return 0
|
||||
elif len(dirFiles) == 0:
|
||||
pass
|
||||
else:
|
||||
statusFile = open(tempStatusPath, 'w')
|
||||
statusFile.writelines(
|
||||
"Target directory should be empty before installation, otherwise data loss could occur." + " [404]")
|
||||
statusFile.close()
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
|
||||
## DB Creation
|
||||
|
||||
statusFile = open(tempStatusPath, 'w')
|
||||
statusFile.writelines('Setting up Database,20')
|
||||
statusFile.close()
|
||||
|
||||
dbName = randomPassword.generate_pass()
|
||||
dbUser = dbName
|
||||
dbPassword = randomPassword.generate_pass()
|
||||
|
||||
## DB Creation
|
||||
|
||||
if website.package.dataBases > website.databases_set.all().count():
|
||||
pass
|
||||
else:
|
||||
raise BaseException("Maximum database limit reached for this website.")
|
||||
|
||||
if Databases.objects.filter(dbName=dbName).exists() or Databases.objects.filter(
|
||||
dbUser=dbUser).exists():
|
||||
raise BaseException("This database or user is already taken.")
|
||||
|
||||
result = mysqlUtilities.createDatabase(dbName, dbUser, dbPassword)
|
||||
|
||||
if result == 1:
|
||||
pass
|
||||
else:
|
||||
raise BaseException("Not able to create database.")
|
||||
|
||||
db = Databases(website=website, dbName=dbName, dbUser=dbUser)
|
||||
db.save()
|
||||
|
||||
|
||||
####
|
||||
|
||||
statusFile = open(tempStatusPath, 'w')
|
||||
statusFile.writelines('Downloading WordPress Core,30')
|
||||
statusFile.close()
|
||||
|
||||
command = "sudo wp core download --allow-root --path=" + finalPath
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
##
|
||||
|
||||
statusFile = open(tempStatusPath, 'w')
|
||||
statusFile.writelines('Configuring the installation,40')
|
||||
statusFile.close()
|
||||
|
||||
command = "sudo wp core config --dbname=" + dbName + " --dbuser=" + dbUser + " --dbpass=" + dbPassword + " --dbhost=localhost --dbprefix=wp_ --allow-root --path=" + finalPath
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
if home == '0':
|
||||
path = self.extraArgs['path']
|
||||
finalURL = domainName + '/' + path
|
||||
else:
|
||||
finalURL = domainName
|
||||
|
||||
command = 'sudo wp core install --url="http://' + finalURL + '" --title="' + blogTitle + '" --admin_user="' + adminUser + '" --admin_password="' + adminPassword + '" --admin_email="' + adminEmail + '" --allow-root --path=' + finalPath
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
##
|
||||
|
||||
statusFile = open(tempStatusPath, 'w')
|
||||
statusFile.writelines('Installing LSCache Plugin,80')
|
||||
statusFile.close()
|
||||
|
||||
command = "sudo wp plugin install litespeed-cache --allow-root --path=" + finalPath
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
statusFile = open(tempStatusPath, 'w')
|
||||
statusFile.writelines('Activating LSCache Plugin,90')
|
||||
statusFile.close()
|
||||
|
||||
command = "sudo wp plugin activate litespeed-cache --allow-root --path=" + finalPath
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
|
||||
|
||||
##
|
||||
|
||||
|
||||
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + "/home/" + domainName + "/public_html/"
|
||||
cmd = shlex.split(command)
|
||||
res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||
|
||||
vhost.addRewriteRules(domainName)
|
||||
installUtilities.reStartLiteSpeed()
|
||||
|
||||
|
||||
statusFile = open(tempStatusPath, 'w')
|
||||
statusFile.writelines("Successfully Installed. [200]")
|
||||
statusFile.close()
|
||||
return 0
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
# remove the downloaded files
|
||||
try:
|
||||
|
||||
command = "sudo rm -rf " + finalPath
|
||||
cmd = shlex.split(command)
|
||||
res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||
|
||||
except BaseException, msg:
|
||||
logging.writeToFile(str(msg) + " [installWordPress]")
|
||||
|
||||
homeDir = "/home/" + domainName + "/public_html"
|
||||
|
||||
if not os.path.exists(homeDir):
|
||||
FNULL = open(os.devnull, 'w')
|
||||
|
||||
command = 'sudo mkdir ' + homeDir
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
|
||||
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + homeDir
|
||||
cmd = shlex.split(command)
|
||||
res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||
|
||||
try:
|
||||
mysqlUtilities.deleteDatabase(dbName, dbUser)
|
||||
db = Databases.objects.get(dbName=dbName)
|
||||
db.delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
statusFile = open(tempStatusPath, 'w')
|
||||
statusFile.writelines(str(msg) + " [404]")
|
||||
statusFile.close()
|
||||
return 0
|
||||
0
plogical/letsEncrypt.py
Normal file
0
plogical/letsEncrypt.py
Normal file
@@ -534,7 +534,7 @@ milter_default_action = accept
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
writeToFile = open(postfixPath, 'a')
|
||||
writeToFile.writelines('smtpd_data_restrictions = check_policy_service inet:localhost:1089\n')
|
||||
writeToFile.writelines('smtpd_data_restrictions = check_policy_service unix:/var/log/policyServerSocket\n')
|
||||
writeToFile.close()
|
||||
|
||||
command = 'systemctl restart postfix'
|
||||
@@ -545,7 +545,7 @@ milter_default_action = accept
|
||||
writeToFile = open(postfixPath, 'w')
|
||||
|
||||
for items in data:
|
||||
if items.find('check_policy_service inet:localhost:1089') > -1:
|
||||
if items.find('check_policy_service unix:/var/log/policyServerSocket') > -1:
|
||||
continue
|
||||
else:
|
||||
writeToFile.writelines(items)
|
||||
|
||||
@@ -39,10 +39,12 @@ class virtualHostUtilities:
|
||||
try:
|
||||
|
||||
if Websites.objects.filter(domain=virtualHostName).count() > 0:
|
||||
raise BaseException("This website already exists.")
|
||||
print "0, This website already exists."
|
||||
return 0, "This website already exists."
|
||||
|
||||
if ChildDomains.objects.filter(domain=virtualHostName).count() > 0:
|
||||
raise BaseException("This website already exists as child domain.")
|
||||
print "0, This website already exists as child domain."
|
||||
return 0, "This website already exists as child domain."
|
||||
|
||||
####### Limitations Check End
|
||||
|
||||
@@ -55,10 +57,12 @@ class virtualHostUtilities:
|
||||
## zone creation
|
||||
|
||||
if vhost.checkIfVirtualHostExists(virtualHostName) == 1:
|
||||
raise BaseException("Virtual Host Directory already exists!")
|
||||
print "0, Virtual Host Directory already exists!"
|
||||
return 0, "Virtual Host Directory already exists!"
|
||||
|
||||
if vhost.checkIfAliasExists(virtualHostName) == 1:
|
||||
raise BaseException("This domain exists as Alias.")
|
||||
print "0, This domain exists as Alias."
|
||||
return 0, "This domain exists as Alias."
|
||||
|
||||
if dkimCheck == 1:
|
||||
if mailUtilities.checkIfDKIMInstalled() == 0:
|
||||
@@ -924,10 +928,12 @@ class virtualHostUtilities:
|
||||
DNS.dnsTemplate(virtualHostName, admin)
|
||||
|
||||
if Websites.objects.filter(domain=virtualHostName).count() > 0:
|
||||
raise BaseException("This Domain already exists as a website.")
|
||||
print "0, This Domain already exists as a website."
|
||||
return 0, "This Domain already exists as a website."
|
||||
|
||||
if ChildDomains.objects.filter(domain=virtualHostName).count() > 0:
|
||||
raise BaseException("This domain already exists as child domain.")
|
||||
print "0, This domain already exists as child domain."
|
||||
return 0, "This domain already exists as child domain."
|
||||
|
||||
####### Limitations check
|
||||
|
||||
@@ -939,16 +945,20 @@ class virtualHostUtilities:
|
||||
elif domainsInPackage > master.childdomains_set.all().count():
|
||||
pass
|
||||
else:
|
||||
raise BaseException("Exceeded maximum number of domains for this package")
|
||||
print "0, Exceeded maximum number of domains for this package"
|
||||
return 0, "Exceeded maximum number of domains for this package"
|
||||
|
||||
|
||||
####### Limitations Check End
|
||||
|
||||
|
||||
if vhost.checkIfVirtualHostExists(virtualHostName) == 1:
|
||||
raise BaseException("Virtual Host Directory already exists!")
|
||||
print "0, Virtual Host Directory already exists!"
|
||||
return 0, "Virtual Host Directory already exists!"
|
||||
|
||||
if vhost.checkIfAliasExists(virtualHostName) == 1:
|
||||
raise BaseException("This domain exists as Alias.")
|
||||
print "0, This domain exists as Alias."
|
||||
return 0, "This domain exists as Alias."
|
||||
|
||||
if dkimCheck == 1:
|
||||
if mailUtilities.checkIfDKIMInstalled() == 0:
|
||||
|
||||
@@ -57,7 +57,6 @@ class HandleRequest(multi.Thread):
|
||||
|
||||
except BaseException, msg:
|
||||
logging.writeToFile( str(msg) + ' [HandleRequest.run]')
|
||||
|
||||
finally:
|
||||
limitThreads.release()
|
||||
|
||||
@@ -67,7 +66,7 @@ class HandleRequest(multi.Thread):
|
||||
|
||||
for items in completeData:
|
||||
tempData = items.split('=')
|
||||
if tempData[0] == 'sasl_username':
|
||||
if tempData[0] == 'sender':
|
||||
emailAddress = tempData[1]
|
||||
domainName = emailAddress.split('@')[1]
|
||||
elif tempData[0] == 'recipient':
|
||||
@@ -120,5 +119,5 @@ class HandleRequest(multi.Thread):
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
logging.writeToFile(str(msg) + " [HandleRequest.manageRequest]")
|
||||
self.connection.sendall('action=defer_if_permit Service temporarily unavailable\n\n')
|
||||
logging.writeToFile(str(msg) + " [HandleRequest.manageRequest")
|
||||
|
||||
@@ -31,7 +31,7 @@ class cacheManager:
|
||||
dbEmail.save()
|
||||
|
||||
except BaseException, msg:
|
||||
logging.writeToFile(str(msg))
|
||||
logging.writeToFile(str(msg) + ' [cacheManager.flushCache]')
|
||||
|
||||
@staticmethod
|
||||
def disableEnableLogs(self, emailAddress, operationValue):
|
||||
@@ -45,7 +45,7 @@ class cacheManager:
|
||||
emailOBJ.logStatus = operationValue
|
||||
|
||||
except BaseException, msg:
|
||||
logging.writeToFile(str(msg))
|
||||
logging.writeToFile(str(msg) + ' [cacheManager.disableEnableLogs]')
|
||||
|
||||
@staticmethod
|
||||
def purgeLog(command):
|
||||
@@ -60,7 +60,7 @@ class cacheManager:
|
||||
emailOBJ.logStatus = operationVal
|
||||
|
||||
except BaseException, msg:
|
||||
logging.writeToFile(str(msg))
|
||||
logging.writeToFile(str(msg) + ' [cacheManager.purgeLog]')
|
||||
|
||||
@staticmethod
|
||||
def purgeLimit(command):
|
||||
@@ -75,7 +75,7 @@ class cacheManager:
|
||||
emailOBJ.limitStatus = operationVal
|
||||
|
||||
except BaseException, msg:
|
||||
logging.writeToFile(str(msg))
|
||||
logging.writeToFile(str(msg) + ' [cacheManager.purgeLimit]')
|
||||
|
||||
@staticmethod
|
||||
def purgeLimitDomain(command):
|
||||
@@ -88,7 +88,7 @@ class cacheManager:
|
||||
domainOBJ.limitStatus = operationVal
|
||||
|
||||
except BaseException, msg:
|
||||
logging.writeToFile(str(msg))
|
||||
logging.writeToFile(str(msg) + ' [cacheManager.purgeLimitDomain]')
|
||||
|
||||
@staticmethod
|
||||
def updateDomainLimit(command):
|
||||
@@ -101,7 +101,7 @@ class cacheManager:
|
||||
domainOBJ.monthlyLimits = newLimit
|
||||
|
||||
except BaseException, msg:
|
||||
logging.writeToFile(str(msg))
|
||||
logging.writeToFile(str(msg) + ' [cacheManager.updateDomainLimit]')
|
||||
|
||||
@staticmethod
|
||||
def purgeLimitEmail(command):
|
||||
@@ -118,7 +118,7 @@ class cacheManager:
|
||||
emailOBJ.hourlyLimits = hourlyLimit
|
||||
|
||||
except BaseException, msg:
|
||||
logging.writeToFile(str(msg))
|
||||
logging.writeToFile(str(msg) + ' [cacheManager.purgeLimitEmail]')
|
||||
|
||||
@staticmethod
|
||||
def hourlyCleanUP():
|
||||
@@ -141,7 +141,7 @@ class cacheManager:
|
||||
dbEmail.save()
|
||||
|
||||
except BaseException, msg:
|
||||
logging.writeToFile(str(msg))
|
||||
logging.writeToFile(str(msg) + ' [cacheManager.hourlyCleanUP]')
|
||||
|
||||
@staticmethod
|
||||
def monthlyCleanUP():
|
||||
@@ -166,7 +166,7 @@ class cacheManager:
|
||||
dbDomain.save()
|
||||
|
||||
except BaseException, msg:
|
||||
logging.writeToFile(str(msg))
|
||||
logging.writeToFile(str(msg) + ' [cacheManager.monthlyCleanUP]')
|
||||
|
||||
|
||||
@staticmethod
|
||||
@@ -197,5 +197,5 @@ class cacheManager:
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
logging.writeToFile(str(msg))
|
||||
logging.writeToFile(str(msg) + ' [cacheManager.handlePurgeRequest]')
|
||||
|
||||
|
||||
@@ -13,13 +13,12 @@ class cacheClient:
|
||||
def handleCachePurgeRequest(command):
|
||||
try:
|
||||
mailUtilities.checkHome()
|
||||
|
||||
writeToFile = open(cacheClient.cleaningPath, 'w')
|
||||
writeToFile.write(command)
|
||||
writeToFile.close()
|
||||
|
||||
except BaseException, msg:
|
||||
logging.writeToFile(str(msg))
|
||||
logging.writeToFile(str(msg) + ' [cacheClient.handleCachePurgeRequest]')
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -5,7 +5,7 @@ Description = CyberPanel Email Policy Control Daemon
|
||||
Type=forking
|
||||
ExecStart = /usr/local/CyberCP/postfixSenderPolicy/policyCTRL.py start
|
||||
ExecStop = /usr/local/CyberCP/postfixSenderPolicy/policyCTRL.py stop
|
||||
Restart= /usr/local/CyberCP/postfixSenderPolicy/policyCTRL.py restart
|
||||
Restart = /usr/local/CyberCP/postfixSenderPolicy/policyCTRL.py restart
|
||||
Restart=on-abnormal
|
||||
|
||||
[Install]
|
||||
|
||||
@@ -31,7 +31,6 @@ class policyCTRL:
|
||||
|
||||
path = policyCTRL.applicationPath
|
||||
if os.path.exists(path):
|
||||
|
||||
pid = open(path, "r").readlines()[0]
|
||||
try:
|
||||
os.kill(int(pid), signal.SIGTERM)
|
||||
|
||||
@@ -5,45 +5,64 @@ import django
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||
django.setup()
|
||||
import socket
|
||||
|
||||
import os
|
||||
import accept_traffic as handle
|
||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||
from signal import *
|
||||
from cacheManager import cacheManager
|
||||
import pwd
|
||||
import grp
|
||||
|
||||
|
||||
class SetupConn:
|
||||
cleaningPath = '/home/cyberpanel/purgeCache'
|
||||
server_address = ('localhost', 1089)
|
||||
cleaning_server = ('localhost', 1090)
|
||||
applicationPath = '/usr/local/CyberCP/postfixSenderPolicy/pid'
|
||||
cleaningServerPID = '/usr/local/CyberCP/postfixSenderPolicy/cpid'
|
||||
serverAddress = '/var/log/policyServerSocket'
|
||||
|
||||
|
||||
def __init__(self, serv_addr):
|
||||
self.server_addr = serv_addr
|
||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
|
||||
def setup_conn(self):
|
||||
logging.writeToFile('Starting CyberPanel Email Policy Server!')
|
||||
self.sock.bind(self.server_addr)
|
||||
logging.writeToFile('CyberPanel Email Policy Server Successfully started!')
|
||||
try:
|
||||
logging.writeToFile('Starting CyberPanel Email Policy Server!')
|
||||
|
||||
try:
|
||||
os.unlink(self.server_addr)
|
||||
except OSError:
|
||||
if os.path.exists(self.server_addr):
|
||||
raise
|
||||
|
||||
self.sock.bind(self.server_addr)
|
||||
|
||||
uid = pwd.getpwnam("postfix").pw_uid
|
||||
gid = grp.getgrnam("postfix").gr_gid
|
||||
os.chown(self.server_addr, uid, gid)
|
||||
|
||||
os.chmod(self.server_addr, 0755)
|
||||
|
||||
logging.writeToFile('CyberPanel Email Policy Server Successfully started!')
|
||||
except BaseException, msg:
|
||||
logging.writeToFile(str(msg) + ' [SetupConn.setup_conn]')
|
||||
|
||||
def start_listening(self):
|
||||
self.sock.listen(5)
|
||||
while True:
|
||||
# Wait for a connection
|
||||
if os.path.exists(SetupConn.cleaningPath):
|
||||
readFromFile = open(SetupConn.cleaningPath, 'r')
|
||||
command = readFromFile.read()
|
||||
cacheManager.handlePurgeRequest(command)
|
||||
readFromFile.close()
|
||||
os.remove(SetupConn.cleaningPath)
|
||||
try:
|
||||
self.sock.listen(5)
|
||||
while True:
|
||||
# Wait for a connection
|
||||
if os.path.exists(SetupConn.cleaningPath):
|
||||
readFromFile = open(SetupConn.cleaningPath, 'r')
|
||||
command = readFromFile.read()
|
||||
cacheManager.handlePurgeRequest(command)
|
||||
readFromFile.close()
|
||||
os.remove(SetupConn.cleaningPath)
|
||||
|
||||
connection, client_address = self.sock.accept()
|
||||
background = handle.HandleRequest(connection)
|
||||
background.start()
|
||||
connection, client_address = self.sock.accept()
|
||||
background = handle.HandleRequest(connection)
|
||||
background.start()
|
||||
except BaseException, msg:
|
||||
logging.writeToFile(str(msg) + ' [SetupConn.start_listening]')
|
||||
|
||||
|
||||
def __del__(self):
|
||||
@@ -61,7 +80,7 @@ def Main():
|
||||
writeToFile.write(str(os.getpid()))
|
||||
writeToFile.close()
|
||||
|
||||
listenConn = SetupConn(SetupConn.server_address)
|
||||
listenConn = SetupConn(SetupConn.serverAddress)
|
||||
listenConn.setup_conn()
|
||||
listenConn.start_listening()
|
||||
|
||||
|
||||
@@ -134,4 +134,5 @@ h1, h2, h3, h4, h5, h6,
|
||||
|
||||
/* Admin responsive */
|
||||
|
||||
@media only screen and (min-width:20em){#header-logo,#theme-options{display:none}#page-sidebar{transform:translateX(0);-ms-transform:translateX(0);-o-transform:translateX(0);-webkit-transform:translateX(0);visibility:hidden}#page-content{margin-left:0}}@media only screen and (min-width:56.25em){#header-logo,#page-sidebar.collapse,#theme-options{display:block}#mobile-navigation{display:none}#page-sidebar{transform:translateX(0);-ms-transform:translateX(0);-o-transform:translateX(0);-webkit-transform:translateX(0);visibility:visible}#page-content{margin-left:260px}}@media only screen and (max-width:760px){#cloud-btn,#header-nav-right #fullscreen-btn{display:none}}@media only screen and (max-width:630px){#page-header .user-account-btn>a.user-profile span{display:none}#page-header .user-account-btn .dropdown-menu:after,#page-header .user-account-btn .dropdown-menu:before{left:56px}}@media only screen and (max-width:545px){#header-nav-right #chatbox-btn{display:none}}@media only screen and (max-width:520px){#dashnav-btn,#page-header .user-account-btn>a.user-profile span{display:none}.popover{width:100%;border-radius:0}.box-md{width:auto}}@media only screen and (max-width:460px){.box-sm,.timeline-box .popover{width:auto}#page-content{padding:10px}#page-title{padding:10px 0 15px;text-align:center}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{margin-bottom:20px}.content-box{margin-top:0!important}.row.mrg20B{margin-bottom:0!important}#page-title p,#progress-btn,.dashboard-box .list-grade,.header-buttons-separator,.todo-box .bs-label,.todo-box .btn,.tooltip .tooltip-arrow{display:none}}@media only screen and (max-width:410px){#header-nav-right #logout-btn,#notifications-btn{display:none}#header-nav-left{float:right}#header-nav-right{margin-right:0;margin-left:15px;float:left}.dropdown-menu{position:fixed;left:0!important;width:100%;border-radius:0}#page-header .user-account-btn .dropdown-menu{top:65px}#page-header .user-account-btn .dropdown-menu:after,#page-header .user-account-btn .dropdown-menu:before{left:auto;right:24px}}
|
||||
@media only screen and (min-width:20em){#header-logo,#theme-options{display:none}#page-sidebar{transform:translateX(0);-ms-transform:translateX(0);-o-transform:translateX(0);-webkit-transform:translateX(0);visibility:hidden}#page-content{margin-left:0}}@media only screen and (min-width:56.25em){#header-logo,#page-sidebar.collapse,#theme-options{display:block}#mobile-navigation{display:none}#page-sidebar{transform:translateX(0);-ms-transform:translateX(0);-o-transform:translateX(0);-webkit-transform:translateX(0);visibility:visible}#page-content{margin-left:260px}}@media only screen and (max-width:760px){#cloud-btn,#header-nav-right #fullscreen-btn{display:none}}@media only screen and (max-width:630px){#page-header .user-account-btn>a.user-profile span{display:none}#page-header .user-account-btn .dropdown-menu:after,#page-header .user-account-btn .dropdown-menu:before{left:56px}}@media only screen and (max-width:545px){#header-nav-right #chatbox-btn{display:none}}@media only screen and (max-width:520px){#dashnav-btn,#page-header .user-account-btn>a.user-profile span{display:none}.popover{width:100%;border-radius:0}.box-md{width:auto}}@media only screen and (max-width:460px){.box-sm,.timeline-box .popover{width:auto}#page-content{padding:10px}#page-title{padding:10px 0 15px;text-align:center}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{margin-bottom:20px}.content-box{margin-top:0!important}.row.mrg20B{margin-bottom:0!important}#page-title p,#progress-btn,.dashboard-box .list-grade,.header-buttons-separator,.todo-box .bs-label,.todo-box .btn,.tooltip .tooltip-arrow{display:none}}@media only screen and (max-width:410px){#header-nav-right #logout-btn,#notifications-btn{display:none}#header-nav-left{float:right}#header-nav-right{margin-right:0;margin-left:15px;float:left}.dropdown-menu{position:fixed;left:0!important;width:100%;border-radius:0}#page-header .user-account-btn .dropdown-menu{top:65px}#page-header .user-account-btn .dropdown-menu:after,#page-header .user-account-btn .dropdown-menu:before{left:auto;right:24px}}
|
||||
|
||||
|
||||
@@ -9,4 +9,6 @@
|
||||
.website-content-box{
|
||||
border-radius: 25px;
|
||||
border-color:#3498db
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -456,6 +456,7 @@ app.controller('websitePages', function($scope,$http) {
|
||||
};
|
||||
|
||||
$scope.fileManagerURL = "/filemanager/"+$("#domainNamePage").text();
|
||||
$scope.wordPressInstallURL = $("#domainNamePage").text() + "/wordpressInstall";
|
||||
$scope.domainAliasURL = "/websites/"+$("#domainNamePage").text()+"/domainAlias";
|
||||
$scope.previewUrl = "/preview/"+$("#domainNamePage").text()+"/";
|
||||
|
||||
@@ -3835,7 +3836,294 @@ app.controller('launchChild', function($scope,$http) {
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
/* Application Installer */
|
||||
|
||||
|
||||
app.controller('installWordPressCTRL', function($scope, $http, $timeout) {
|
||||
|
||||
$scope.installationDetailsForm = false;
|
||||
$scope.installationProgress = true;
|
||||
$scope.installationFailed = true;
|
||||
$scope.installationSuccessfull = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.wpInstallLoading = true;
|
||||
$scope.goBackDisable = true;
|
||||
|
||||
var statusFile;
|
||||
var domain = $("#domainNamePage").text();
|
||||
var path;
|
||||
|
||||
|
||||
|
||||
$scope.goBack = function () {
|
||||
$scope.installationDetailsForm = false;
|
||||
$scope.installationProgress = true;
|
||||
$scope.installationFailed = true;
|
||||
$scope.installationSuccessfull = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.wpInstallLoading = true;
|
||||
$scope.goBackDisable = true;
|
||||
$("#installProgress").css("width", "0%");
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
$scope.installWordPress = function(){
|
||||
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.installationProgress = false;
|
||||
$scope.installationFailed = true;
|
||||
$scope.installationSuccessfull = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.wpInstallLoading = false;
|
||||
$scope.goBackDisable = true;
|
||||
$scope.currentStatus = "Starting installation..";
|
||||
|
||||
path = $scope.installPath;
|
||||
|
||||
|
||||
url = "/websites/installWordpress";
|
||||
|
||||
var home = "1";
|
||||
|
||||
if (typeof path !== 'undefined'){
|
||||
home = "0";
|
||||
}
|
||||
|
||||
|
||||
var data = {
|
||||
domain: domain,
|
||||
home:home,
|
||||
path:path,
|
||||
blogTitle: $scope.blogTitle,
|
||||
adminUser: $scope.adminUser,
|
||||
adminPassword: $scope.adminPassword,
|
||||
adminEmail: $scope.adminEmail
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers : {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if (response.data.installStatus === 1)
|
||||
{
|
||||
statusFile = response.data.tempStatusPath;
|
||||
getInstallStatus();
|
||||
}
|
||||
else{
|
||||
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.installationProgress = false;
|
||||
$scope.installationFailed = false;
|
||||
$scope.installationSuccessfull = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.wpInstallLoading = true;
|
||||
$scope.goBackDisable = false;
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function getInstallStatus(){
|
||||
|
||||
url = "/websites/installWordpressStatus";
|
||||
|
||||
var data = {
|
||||
statusFile: statusFile,
|
||||
domainName: domain
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers : {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
|
||||
if(response.data.abort === 1){
|
||||
|
||||
if(response.data.installStatus === 1){
|
||||
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.installationProgress = false;
|
||||
$scope.installationFailed = true;
|
||||
$scope.installationSuccessfull = false;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.wpInstallLoading = true;
|
||||
$scope.goBackDisable = false;
|
||||
|
||||
if (typeof path !== 'undefined'){
|
||||
$scope.installationURL = "http://"+domain+"/"+path;
|
||||
}
|
||||
else{
|
||||
$scope.installationURL = domain;
|
||||
}
|
||||
|
||||
|
||||
$("#installProgress").css("width", "100%");
|
||||
$scope.installPercentage = "100";
|
||||
$scope.currentStatus = response.data.currentStatus;
|
||||
$timeout.cancel();
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.installationProgress = false;
|
||||
$scope.installationFailed = false;
|
||||
$scope.installationSuccessfull = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.wpInstallLoading = true;
|
||||
$scope.goBackDisable = false;
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
$("#installProgress").css("width", "0%");
|
||||
$scope.installPercentage = "0";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
$("#installProgress").css("width", response.data.installationProgress + "%");
|
||||
$scope.installPercentage = response.data.installationProgress;
|
||||
$scope.currentStatus = response.data.currentStatus;
|
||||
|
||||
$timeout(getInstallStatus,1000);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.canNotFetch = true;
|
||||
$scope.couldNotConnect = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$scope.installJoomla = function(){
|
||||
|
||||
|
||||
$scope.installationDetailsFormJoomla = false;
|
||||
$scope.applicationInstallerLoading = false;
|
||||
$scope.installationFailed = true;
|
||||
$scope.installationSuccessfull = true;
|
||||
$scope.couldNotConnect = true;
|
||||
|
||||
var domain = $("#domainNamePage").text();
|
||||
var path = $scope.installPath;
|
||||
var sitename = $scope.sitename
|
||||
var username = $scope.username
|
||||
var password = $scope.password
|
||||
var prefix = $scope.prefix
|
||||
|
||||
|
||||
url = "/websites/installJoomla";
|
||||
|
||||
var home = "1";
|
||||
|
||||
if (typeof path != 'undefined'){
|
||||
home = "0";
|
||||
}
|
||||
|
||||
|
||||
var data = {
|
||||
domain: domain,
|
||||
home:home,
|
||||
path:path,
|
||||
sitename:sitename,
|
||||
username:username,
|
||||
password:password,
|
||||
prefix:prefix,
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers : {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if (response.data.installStatus == 1)
|
||||
{
|
||||
if (typeof path != 'undefined'){
|
||||
$scope.installationURL = "http://"+domain+"/"+path;
|
||||
}
|
||||
else{
|
||||
$scope.installationURL = domain;
|
||||
}
|
||||
|
||||
$scope.installationDetailsFormJoomla = false;
|
||||
$scope.applicationInstallerLoading = true;
|
||||
$scope.installationFailed = true;
|
||||
$scope.installationSuccessfull = false;
|
||||
$scope.couldNotConnect = true;
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
$scope.installationDetailsFormJoomla = false;
|
||||
$scope.applicationInstallerLoading = true;
|
||||
$scope.installationFailed = false;
|
||||
$scope.installationSuccessfull = true;
|
||||
$scope.couldNotConnect = true;
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.installationDetailsFormJoomla = false;
|
||||
$scope.applicationInstallerLoading = true;
|
||||
$scope.installationFailed = true;
|
||||
$scope.installationSuccessfull = true;
|
||||
$scope.couldNotConnect = false;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
@@ -9,4 +9,6 @@
|
||||
.website-content-box{
|
||||
border-radius: 25px;
|
||||
border-color:#3498db
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -456,6 +456,7 @@ app.controller('websitePages', function($scope,$http) {
|
||||
};
|
||||
|
||||
$scope.fileManagerURL = "/filemanager/"+$("#domainNamePage").text();
|
||||
$scope.wordPressInstallURL = $("#domainNamePage").text() + "/wordpressInstall";
|
||||
$scope.domainAliasURL = "/websites/"+$("#domainNamePage").text()+"/domainAlias";
|
||||
$scope.previewUrl = "/preview/"+$("#domainNamePage").text()+"/";
|
||||
|
||||
@@ -3835,7 +3836,294 @@ app.controller('launchChild', function($scope,$http) {
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
/* Application Installer */
|
||||
|
||||
|
||||
app.controller('installWordPressCTRL', function($scope, $http, $timeout) {
|
||||
|
||||
$scope.installationDetailsForm = false;
|
||||
$scope.installationProgress = true;
|
||||
$scope.installationFailed = true;
|
||||
$scope.installationSuccessfull = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.wpInstallLoading = true;
|
||||
$scope.goBackDisable = true;
|
||||
|
||||
var statusFile;
|
||||
var domain = $("#domainNamePage").text();
|
||||
var path;
|
||||
|
||||
|
||||
|
||||
$scope.goBack = function () {
|
||||
$scope.installationDetailsForm = false;
|
||||
$scope.installationProgress = true;
|
||||
$scope.installationFailed = true;
|
||||
$scope.installationSuccessfull = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.wpInstallLoading = true;
|
||||
$scope.goBackDisable = true;
|
||||
$("#installProgress").css("width", "0%");
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
$scope.installWordPress = function(){
|
||||
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.installationProgress = false;
|
||||
$scope.installationFailed = true;
|
||||
$scope.installationSuccessfull = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.wpInstallLoading = false;
|
||||
$scope.goBackDisable = true;
|
||||
$scope.currentStatus = "Starting installation..";
|
||||
|
||||
path = $scope.installPath;
|
||||
|
||||
|
||||
url = "/websites/installWordpress";
|
||||
|
||||
var home = "1";
|
||||
|
||||
if (typeof path !== 'undefined'){
|
||||
home = "0";
|
||||
}
|
||||
|
||||
|
||||
var data = {
|
||||
domain: domain,
|
||||
home:home,
|
||||
path:path,
|
||||
blogTitle: $scope.blogTitle,
|
||||
adminUser: $scope.adminUser,
|
||||
adminPassword: $scope.adminPassword,
|
||||
adminEmail: $scope.adminEmail
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers : {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if (response.data.installStatus === 1)
|
||||
{
|
||||
statusFile = response.data.tempStatusPath;
|
||||
getInstallStatus();
|
||||
}
|
||||
else{
|
||||
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.installationProgress = false;
|
||||
$scope.installationFailed = false;
|
||||
$scope.installationSuccessfull = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.wpInstallLoading = true;
|
||||
$scope.goBackDisable = false;
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function getInstallStatus(){
|
||||
|
||||
url = "/websites/installWordpressStatus";
|
||||
|
||||
var data = {
|
||||
statusFile: statusFile,
|
||||
domainName: domain
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers : {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
|
||||
if(response.data.abort === 1){
|
||||
|
||||
if(response.data.installStatus === 1){
|
||||
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.installationProgress = false;
|
||||
$scope.installationFailed = true;
|
||||
$scope.installationSuccessfull = false;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.wpInstallLoading = true;
|
||||
$scope.goBackDisable = false;
|
||||
|
||||
if (typeof path !== 'undefined'){
|
||||
$scope.installationURL = "http://"+domain+"/"+path;
|
||||
}
|
||||
else{
|
||||
$scope.installationURL = domain;
|
||||
}
|
||||
|
||||
|
||||
$("#installProgress").css("width", "100%");
|
||||
$scope.installPercentage = "100";
|
||||
$scope.currentStatus = response.data.currentStatus;
|
||||
$timeout.cancel();
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.installationProgress = false;
|
||||
$scope.installationFailed = false;
|
||||
$scope.installationSuccessfull = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.wpInstallLoading = true;
|
||||
$scope.goBackDisable = false;
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
$("#installProgress").css("width", "0%");
|
||||
$scope.installPercentage = "0";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
$("#installProgress").css("width", response.data.installationProgress + "%");
|
||||
$scope.installPercentage = response.data.installationProgress;
|
||||
$scope.currentStatus = response.data.currentStatus;
|
||||
|
||||
$timeout(getInstallStatus,1000);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.canNotFetch = true;
|
||||
$scope.couldNotConnect = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$scope.installJoomla = function(){
|
||||
|
||||
|
||||
$scope.installationDetailsFormJoomla = false;
|
||||
$scope.applicationInstallerLoading = false;
|
||||
$scope.installationFailed = true;
|
||||
$scope.installationSuccessfull = true;
|
||||
$scope.couldNotConnect = true;
|
||||
|
||||
var domain = $("#domainNamePage").text();
|
||||
var path = $scope.installPath;
|
||||
var sitename = $scope.sitename
|
||||
var username = $scope.username
|
||||
var password = $scope.password
|
||||
var prefix = $scope.prefix
|
||||
|
||||
|
||||
url = "/websites/installJoomla";
|
||||
|
||||
var home = "1";
|
||||
|
||||
if (typeof path != 'undefined'){
|
||||
home = "0";
|
||||
}
|
||||
|
||||
|
||||
var data = {
|
||||
domain: domain,
|
||||
home:home,
|
||||
path:path,
|
||||
sitename:sitename,
|
||||
username:username,
|
||||
password:password,
|
||||
prefix:prefix,
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers : {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if (response.data.installStatus == 1)
|
||||
{
|
||||
if (typeof path != 'undefined'){
|
||||
$scope.installationURL = "http://"+domain+"/"+path;
|
||||
}
|
||||
else{
|
||||
$scope.installationURL = domain;
|
||||
}
|
||||
|
||||
$scope.installationDetailsFormJoomla = false;
|
||||
$scope.applicationInstallerLoading = true;
|
||||
$scope.installationFailed = true;
|
||||
$scope.installationSuccessfull = false;
|
||||
$scope.couldNotConnect = true;
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
$scope.installationDetailsFormJoomla = false;
|
||||
$scope.applicationInstallerLoading = true;
|
||||
$scope.installationFailed = false;
|
||||
$scope.installationSuccessfull = true;
|
||||
$scope.couldNotConnect = true;
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.installationDetailsFormJoomla = false;
|
||||
$scope.applicationInstallerLoading = true;
|
||||
$scope.installationFailed = true;
|
||||
$scope.installationSuccessfull = true;
|
||||
$scope.couldNotConnect = false;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
@@ -0,0 +1,62 @@
|
||||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Application Installer - CyberPanel" %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div id="page-title">
|
||||
<h2 id="domainNamePage">{% trans "Application Installer" %}</h2>
|
||||
<p>{% trans "One-click application install." %}</p>
|
||||
</div>
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
<div style="border-radius: 25px;border-color:#3498db" class="content-box">
|
||||
<h3 class="content-box-header bg-blue">
|
||||
{% trans "Application Installer" %} <img ng-hide="applicationInstallerLoading" src="/static/images/loading.gif">
|
||||
</h3>
|
||||
|
||||
<div class="content-box-wrapper">
|
||||
<div class="row">
|
||||
|
||||
<a ng-click="installationDetails()" href="" title="{% trans 'Install wordpress with LSCache' %}">
|
||||
<div class="col-md-4" style="margin-bottom: 2%;">
|
||||
|
||||
<a ng-click="installationDetails()" href="" title="{% trans 'Install wordpress with LSCache' %}">
|
||||
<img src="{% static 'images/icons/wordpress.png' %}">
|
||||
</a>
|
||||
<a ng-click="installationDetails()" href="" title="{% trans 'Install wordpress with LSCache' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "Wordpress with LSCache" %}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a ng-click="installationDetailsJoomla()" href="" title="{% trans 'Install Joomla with(?) LSCache' %}">
|
||||
<div class="col-md-4" style="margin-bottom: 2%;">
|
||||
|
||||
<a ng-click="installationDetailsJoomla()" href="" title="{% trans 'Install Joomla with LSCache' %}">
|
||||
<img src="{% static 'images/icons/joomla-logo.png' %}">
|
||||
</a>
|
||||
<a ng-click="installationDetailsJoomla()" href="" title="{% trans 'Install Joomla with LSCache' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "Joomla" %}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@@ -51,7 +51,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Domain Name" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input ng-pattern="/*/i" name="dom" type="text" class="form-control" ng-model="domainNameCreate" placeholder="{% trans "Do not enter WWW, it will be auto created!" %}" required>
|
||||
<input name="dom" type="text" class="form-control" ng-model="domainNameCreate" placeholder="{% trans "Do not enter WWW, it will be auto created!" %}" required>
|
||||
</div>
|
||||
<div ng-show="websiteCreationForm.dom.$error.pattern" class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}</div>
|
||||
</div>
|
||||
@@ -115,7 +115,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button ng-disabled="websiteCreationForm.dom.$error.required || websiteCreationForm.dom.$error.pattern || websiteCreationForm.email.$invalid" type="button" ng-click="createWebsite()" class="btn btn-primary btn-lg btn-block">{% trans "Create Website" %}</button>
|
||||
<button ng-disabled="websiteCreationForm.dom.$error.required || websiteCreationForm.email.$invalid" type="button" ng-click="createWebsite()" class="btn btn-primary btn-lg btn-block">{% trans "Create Website" %}</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Install WordPress - CyberPanel" %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
|
||||
<div class="container">
|
||||
<div id="page-title">
|
||||
<h2>{% trans "Install WordPress" %}</h2>
|
||||
<p>{% trans "Install WordPress with LSCache." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-controller="installWordPressCTRL" class="panel">
|
||||
<div class="panel-body">
|
||||
<h3 class="title-hero">
|
||||
<span id="domainNamePage">{{ domainName }}</span> - {% trans "Installation Details" %} <img ng-hide="wpInstallLoading" src="{% static 'images/loading.gif' %}">
|
||||
</h3>
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
|
||||
<form name="websiteCreationForm" action="/" id="createPackages" class="form-horizontal bordered-row">
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Blog Title" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" ng-model="blogTitle" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Login User" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" ng-model="adminUser" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Login Password" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="password" class="form-control" ng-model="adminPassword" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Email" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" ng-model="adminEmail" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Path" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input placeholder="Leave emtpy to install in website home directory. (Without preceding slash)" type="text" class="form-control" ng-model="installPath">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-click="installWordPress()" class="btn btn-primary btn-lg btn-block">{% trans "Install Now" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div ng-hide="installationProgress" class="form-group">
|
||||
<label class="col-sm-2 control-label"></label>
|
||||
<div class="col-sm-7">
|
||||
|
||||
<div class="alert alert-success text-center">
|
||||
<h2>{$ currentStatus $}</h2>
|
||||
</div>
|
||||
|
||||
<div class="progress">
|
||||
<div id="installProgress" class="progress-bar" role="progressbar" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="width:0%">
|
||||
<span class="sr-only">70% Complete</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div ng-hide="installationFailed" class="alert alert-danger">
|
||||
<p>{% trans "Installation failed. Error message:" %} {$ errorMessage $}</p>
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationSuccessfull" class="alert alert-success">
|
||||
<p>{% trans "Installation successful. Visit:" %} {$ installationURL $}</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div ng-hide="couldNotConnect" class="alert alert-danger">
|
||||
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationProgress" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-disabled="goBackDisable" ng-click="goBack()" class="btn btn-primary btn-lg btn-block">{% trans "Go Back" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@@ -940,10 +940,10 @@
|
||||
|
||||
<div class="col-md-4" style="margin-bottom: 2%;">
|
||||
|
||||
<a ng-click="installationDetails()" href="" title="{% trans 'Install wordpress with LSCache' %}">
|
||||
<a href="{$ wordPressInstallURL $}" target="_blank" title="{% trans 'Install wordpress with LSCache' %}">
|
||||
<img src="{% static 'images/icons/wordpress.png' %}">
|
||||
</a>
|
||||
<a ng-click="installationDetails()" href="" title="{% trans 'Install wordpress with LSCache' %}">
|
||||
<a href="{$ wordPressInstallURL $}" target="_blank" title="{% trans 'Install wordpress with LSCache' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "Wordpress with LSCache" %}</span>
|
||||
</a>
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ urlpatterns = [
|
||||
url(r'^fetchErrorLogs', views.fetchErrorLogs, name='fetchErrorLogs'),
|
||||
|
||||
|
||||
url(r'^installWordpress', views.installWordpress, name='installWordpress'),
|
||||
url(r'^installWordpress$', views.installWordpress, name='installWordpress'),
|
||||
url(r'^installJoomla', views.installJoomla, name='installJoomla'),
|
||||
|
||||
url(r'^getDataFromConfigFile', views.getDataFromConfigFile, name='getDataFromConfigFile'),
|
||||
@@ -76,4 +76,10 @@ urlpatterns = [
|
||||
url(r'^changeOpenBasedir$',views.changeOpenBasedir,name="changeOpenBasedir"),
|
||||
|
||||
|
||||
## Application Installer
|
||||
|
||||
url(r'^applicationInstaller$',views.applicationInstaller,name="applicationInstaller"),
|
||||
url(r'^(?P<domain>([\da-z\.-]+\.[a-z\.]{2,12}|[\d\.]+)([\/:?=&#]{1}[\da-z\.-]+)*[\/\?]?)/wordpressInstall$', views.wordpressInstall, name='wordpressInstall'),
|
||||
url(r'^installWordpressStatus$',views.installWordpressStatus,name="installWordpressStatus"),
|
||||
|
||||
]
|
||||
@@ -25,6 +25,7 @@ from random import randint
|
||||
import hashlib
|
||||
from xml.etree import ElementTree
|
||||
from plogical.mailUtilities import mailUtilities
|
||||
from plogical.applicationInstaller import ApplicationInstaller
|
||||
# Create your views here.
|
||||
|
||||
|
||||
@@ -1061,127 +1062,6 @@ def fetchErrorLogs(request):
|
||||
final_json = json.dumps({'logstatus': 0, 'error_message': str(msg)})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
def installWordpress(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
|
||||
if request.method == 'POST':
|
||||
try:
|
||||
data = json.loads(request.body)
|
||||
domainName = data['domain']
|
||||
home = data['home']
|
||||
|
||||
finalPath = ""
|
||||
|
||||
if home == '0':
|
||||
path = data['path']
|
||||
finalPath = "/home/" + domainName + "/public_html/" + path + "/"
|
||||
else:
|
||||
finalPath = "/home/" + domainName + "/public_html/"
|
||||
|
||||
## Security Check
|
||||
|
||||
if finalPath.find("..") > -1:
|
||||
data_ret = {'installStatus': 0,
|
||||
'error_message': "Specified path must be inside virtual host home!"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
try:
|
||||
website = ChildDomains.objects.get(domain=domainName)
|
||||
externalApp = website.master.externalApp
|
||||
|
||||
if admin.type != 1:
|
||||
if website.master.admin != admin:
|
||||
data_ret = {'installStatus': 0,
|
||||
'error_message': "You do not own this website!"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except:
|
||||
website = Websites.objects.get(domain=domainName)
|
||||
externalApp = website.externalApp
|
||||
|
||||
if admin.type != 1:
|
||||
if website.admin != admin:
|
||||
data_ret = {'installStatus': 0,
|
||||
'error_message': "You do not own this website!"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
## DB Creation
|
||||
|
||||
dbName = randomPassword.generate_pass()
|
||||
dbUser = dbName
|
||||
dbPassword = randomPassword.generate_pass()
|
||||
|
||||
## DB Creation
|
||||
|
||||
if website.package.dataBases > website.databases_set.all().count():
|
||||
pass
|
||||
else:
|
||||
data_ret = {'installStatus': 0, 'error_message': "0,Maximum database limit reached for this website."}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
if Databases.objects.filter(dbName=dbName).exists() or Databases.objects.filter(
|
||||
dbUser=dbUser).exists():
|
||||
|
||||
data_ret = {'installStatus': 0,
|
||||
'error_message': "0,This database or user is already taken."}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
result = mysqlUtilities.createDatabase(dbName, dbUser, dbPassword)
|
||||
|
||||
if result == 1:
|
||||
pass
|
||||
else:
|
||||
data_ret = {'installStatus': 0,
|
||||
'error_message': "0,Not able to create database."}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
db = Databases(website=website, dbName=dbName, dbUser=dbUser)
|
||||
db.save()
|
||||
|
||||
## Installation
|
||||
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
||||
|
||||
execPath = execPath + " installWordPress --virtualHostName " + domainName + " --virtualHostUser " + externalApp + " --path " + finalPath + " --dbName " + dbName + " --dbUser " + dbUser + " --dbPassword " + dbPassword
|
||||
|
||||
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
|
||||
if output.find("1,None") > -1:
|
||||
data_ret = {"installStatus": 1}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
else:
|
||||
mysqlUtilities.deleteDatabase(dbName, dbUser)
|
||||
db = Databases.objects.get(dbName=dbName)
|
||||
db.delete()
|
||||
data_ret = {'installStatus': 0, 'error_message': output}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
## Installation ends
|
||||
|
||||
except BaseException, msg:
|
||||
data_ret = {'installStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
except KeyError, msg:
|
||||
status = {"installStatus":0,"error":str(msg)}
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[installWordpress]")
|
||||
return HttpResponse("Not Logged in as admin")
|
||||
|
||||
def installJoomla(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
@@ -2450,4 +2330,138 @@ def changeOpenBasedir(request):
|
||||
except KeyError,msg:
|
||||
data_ret = {'changeOpenBasedir': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def applicationInstaller(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
try:
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type != 1:
|
||||
website = Websites.objects.get(domain=domain)
|
||||
if website.admin != admin:
|
||||
raise BaseException('You do not own this website.')
|
||||
|
||||
|
||||
return render(request, 'websiteFunctions/applicationInstaller.html')
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return HttpResponse(str(msg))
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def wordpressInstall(request, domain):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
try:
|
||||
if admin.type != 1:
|
||||
website = Websites.objects.get(domain=domain)
|
||||
if website.admin != admin:
|
||||
raise BaseException('You do not own this website.')
|
||||
|
||||
|
||||
return render(request, 'websiteFunctions/installWordPress.html', {'domainName' : domain})
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return HttpResponse(str(msg))
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def installWordpress(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if request.method == 'POST':
|
||||
try:
|
||||
data = json.loads(request.body)
|
||||
|
||||
mailUtilities.checkHome()
|
||||
|
||||
extraArgs = {}
|
||||
extraArgs['admin'] = admin
|
||||
extraArgs['domainName'] = data['domain']
|
||||
extraArgs['home'] = data['home']
|
||||
extraArgs['blogTitle'] = data['blogTitle']
|
||||
extraArgs['adminUser'] = data['adminUser']
|
||||
extraArgs['adminPassword'] = data['adminPassword']
|
||||
extraArgs['adminEmail'] = data['adminEmail']
|
||||
extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999))
|
||||
|
||||
if data['home'] == '0':
|
||||
extraArgs['path'] = data['path']
|
||||
|
||||
|
||||
background = ApplicationInstaller('wordpress', extraArgs)
|
||||
background.start()
|
||||
|
||||
data_ret = {'installStatus': 1, 'error_message': 'None', 'tempStatusPath': extraArgs['tempStatusPath']}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
data_ret = {'installStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
except KeyError, msg:
|
||||
status = {"installStatus":0,"error":str(msg)}
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[installWordpress]")
|
||||
return HttpResponse("Not Logged in as admin")
|
||||
|
||||
|
||||
def installWordpressStatus(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if request.method == 'POST':
|
||||
try:
|
||||
data = json.loads(request.body)
|
||||
|
||||
|
||||
domainName = data['domainName']
|
||||
statusFile = data['statusFile']
|
||||
|
||||
if admin.type != 1:
|
||||
website = Websites.objects.get(domain=domainName)
|
||||
if website.admin != admin:
|
||||
raise BaseException('You do not own this website.')
|
||||
|
||||
statusData = open(statusFile, 'r').readlines()
|
||||
|
||||
lastLine = statusData[-1]
|
||||
|
||||
if lastLine.find('[200]') > -1:
|
||||
data_ret = { 'abort':1, 'installStatus': 1, 'installationProgress': "100", 'currentStatus': 'Successfully Installed.' }
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
elif lastLine.find('[404]') > -1:
|
||||
data_ret = {'abort': 1, 'installStatus': 0, 'installationProgress': "0", 'error_message': lastLine}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
else:
|
||||
progress = lastLine.split(',')
|
||||
currentStatus = progress[0]
|
||||
installationProgress = progress[1]
|
||||
data_ret = {'abort': 0, 'installStatus': 0, 'installationProgress': installationProgress, 'currentStatus': currentStatus}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
data_ret = {'abort': 1, 'installStatus': 0, 'installationProgress': "0", 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
except KeyError, msg:
|
||||
data_ret = {'abort': 1, 'installStatus': 0, 'installationProgress': "0", 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
Reference in New Issue
Block a user