mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-10-26 07:46:35 +01:00
Polish Translation
This commit is contained in:
@@ -178,4 +178,5 @@ LANGUAGES = (
|
||||
('tr', _('Turkish')),
|
||||
('es', _('Spanish')),
|
||||
('fr', _('French')),
|
||||
('pl', _('Polish')),
|
||||
)
|
||||
|
||||
61
api/views.py
61
api/views.py
@@ -58,6 +58,7 @@ def changeUserPassAPI(request):
|
||||
|
||||
websiteOwner = data['websiteOwner']
|
||||
ownerPassword = data['ownerPassword']
|
||||
|
||||
adminUser = data['adminUser']
|
||||
adminPass = data['adminPass']
|
||||
|
||||
@@ -130,7 +131,7 @@ def deleteWebsite(request):
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
websiteName = data['domainName']
|
||||
data['websiteName'] = data['domainName']
|
||||
adminUser = data['adminUser']
|
||||
adminPass = data['adminPass']
|
||||
|
||||
@@ -144,7 +145,7 @@ def deleteWebsite(request):
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
website = Websites.objects.get(domain=websiteName)
|
||||
website = Websites.objects.get(domain=data['websiteName'])
|
||||
websiteOwner = website.admin
|
||||
|
||||
if admin.websites_set.all().count() == 0:
|
||||
@@ -152,19 +153,8 @@ def deleteWebsite(request):
|
||||
|
||||
## Deleting master domain
|
||||
|
||||
numberOfWebsites = str(Websites.objects.count() + ChildDomains.objects.count())
|
||||
|
||||
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
||||
|
||||
execPath = execPath + " deleteVirtualHostConfigurations --virtualHostName " + websiteName + \
|
||||
" --numberOfSites " + numberOfWebsites
|
||||
|
||||
subprocess.check_output(shlex.split(execPath))
|
||||
|
||||
data_ret = {'websiteDeleteStatus': 1, 'error_message': "None"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
wm = WebsiteManager()
|
||||
return wm.submitWebsiteDeletion(admin.pk, data)
|
||||
|
||||
except BaseException, msg:
|
||||
data_ret = {'websiteDeleteStatus': 0, 'error_message': str(msg)}
|
||||
@@ -175,8 +165,6 @@ def submitWebsiteStatus(request):
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
websiteName = data['websiteName']
|
||||
state = data['state']
|
||||
adminUser = data['adminUser']
|
||||
adminPass = data['adminPass']
|
||||
|
||||
@@ -190,22 +178,8 @@ def submitWebsiteStatus(request):
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
website = Websites.objects.get(domain=websiteName)
|
||||
|
||||
if state == "Suspend":
|
||||
virtualHostUtilities.suspendVirtualHost(websiteName)
|
||||
installUtilities.reStartLiteSpeed()
|
||||
website.state = 0
|
||||
else:
|
||||
virtualHostUtilities.UnsuspendVirtualHost(websiteName)
|
||||
installUtilities.reStartLiteSpeed()
|
||||
website.state = 1
|
||||
|
||||
website.save()
|
||||
|
||||
data_ret = {'websiteStatus': 1, 'error_message': "None"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
wm = WebsiteManager()
|
||||
return wm.submitWebsiteStatus(admin.pk, json.loads(request.body))
|
||||
|
||||
except BaseException, msg:
|
||||
data_ret = {'websiteStatus': 0, 'error_message': str(msg)}
|
||||
@@ -214,26 +188,22 @@ def submitWebsiteStatus(request):
|
||||
|
||||
def loginAPI(request):
|
||||
try:
|
||||
if request.method == "POST":
|
||||
username = request.POST['username']
|
||||
password = request.POST['password']
|
||||
|
||||
username = request.POST['username']
|
||||
password = request.POST['password']
|
||||
|
||||
admin = Administrator.objects.get(userName=username)
|
||||
|
||||
if hashPassword.check_password(admin.password, password):
|
||||
request.session['userID'] = admin.pk
|
||||
return redirect(renderBase)
|
||||
else:
|
||||
return HttpResponse("Invalid Credentials.")
|
||||
admin = Administrator.objects.get(userName=username)
|
||||
|
||||
if hashPassword.check_password(admin.password, password):
|
||||
request.session['userID'] = admin.pk
|
||||
return redirect(renderBase)
|
||||
else:
|
||||
return HttpResponse("Invalid Credentials.")
|
||||
|
||||
except BaseException, msg:
|
||||
data = {'userID': 0, 'loginStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def fetchSSHkey(request):
|
||||
try:
|
||||
if request.method == "POST":
|
||||
@@ -356,7 +326,6 @@ def fetchAccountsFromRemoteServer(request):
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def FetchRemoteTransferStatus(request):
|
||||
try:
|
||||
if request.method == "POST":
|
||||
|
||||
@@ -20,53 +20,87 @@
|
||||
</h3>
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
{% if viewStatus == 0 %}
|
||||
<div class="row">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<a href="{% url 'backupSite' %}" title="{% trans 'Back up Site' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<div class="tile-header">
|
||||
{% trans "Back up" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{% if createBackup or admin %}
|
||||
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<a href="{% url 'backupSite' %}" title="{% trans 'Back up Site' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<div class="tile-header">
|
||||
{% trans "Back up" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
{% endif %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<a href="{% url 'backupSite' %}" title="{% trans 'Back up Site' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<div class="tile-header">
|
||||
{% trans "Back up" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{% if restoreBackup or admin %}
|
||||
|
||||
|
||||
<div class="col-md-6">
|
||||
<a href="{% url 'restoreSite' %}" title="{% trans 'Restore Back up' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<div class="tile-header">
|
||||
{% trans "Restore" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<a href="{% url 'restoreSite' %}" title="{% trans 'Restore Back up' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<div class="tile-header">
|
||||
{% trans "Restore" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if addDeleteDestinations or admin %}
|
||||
|
||||
<div class="col-md-6">
|
||||
<a href="{% url 'backupDestinations' %}" title="{% trans 'Add/Delete Destinations' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<div class="tile-header">
|
||||
{% trans "Add/Delete Destinations" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if scheDuleBackups or admin %}
|
||||
|
||||
<div class="col-md-6">
|
||||
<a href="{% url 'scheduleBackup' %}" title="{% trans 'Schedule Back up' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<div class="tile-header">
|
||||
{% trans "Schedule Back up" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if remoteBackups or admin %}
|
||||
|
||||
<div class="col-md-6">
|
||||
<a href="{% url 'remoteBackups' %}" title="{% trans 'Remote Back ups' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<div class="tile-header">
|
||||
{% trans "Remote Back ups" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
1473
backup/views.py
1473
backup/views.py
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
BIN
locale/id/LC_MESSAGES/django.mo
Normal file
BIN
locale/id/LC_MESSAGES/django.mo
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
BIN
locale/pl/LC_MESSAGES/django.mo
Normal file
BIN
locale/pl/LC_MESSAGES/django.mo
Normal file
Binary file not shown.
5059
locale/pl/LC_MESSAGES/django.po
Normal file
5059
locale/pl/LC_MESSAGES/django.po
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -135,6 +135,7 @@
|
||||
<option>Russian</option>
|
||||
<option>Turkish</option>
|
||||
<option>Spanish</option>
|
||||
<option>Polish</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -90,6 +90,11 @@ def verifyLogin(request):
|
||||
request.session[LANGUAGE_SESSION_KEY] = user_Language
|
||||
request.COOKIES['django_language'] = user_Language
|
||||
settings.LANGUAGE_CODE = user_Language
|
||||
elif data['languageSelection'] == "Polish":
|
||||
user_Language = "pl"
|
||||
request.session[LANGUAGE_SESSION_KEY] = user_Language
|
||||
request.COOKIES['django_language'] = user_Language
|
||||
settings.LANGUAGE_CODE = user_Language
|
||||
except:
|
||||
request.session[LANGUAGE_SESSION_KEY] = "en"
|
||||
request.COOKIES['django_language'] = "en"
|
||||
|
||||
@@ -10,6 +10,9 @@ from packages.models import Package
|
||||
from websiteFunctions.models import Websites, ChildDomains
|
||||
from dns.models import Domains
|
||||
import json
|
||||
from subprocess import call, CalledProcessError
|
||||
from shlex import split
|
||||
from CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||
|
||||
class ACLManager:
|
||||
|
||||
@@ -408,6 +411,21 @@ class ACLManager:
|
||||
else:
|
||||
return 0
|
||||
|
||||
@staticmethod
|
||||
def executeCall(command):
|
||||
try:
|
||||
result = call(split(command))
|
||||
if result == 1:
|
||||
return 0, 'Something bad happened'
|
||||
else:
|
||||
return 1, 'None'
|
||||
except CalledProcessError, msg:
|
||||
logging.writeToFile(str(msg) + ' [ACLManager.executeCall]')
|
||||
return 0, str(msg)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1314
plogical/backupManager.py
Normal file
1314
plogical/backupManager.py
Normal file
File diff suppressed because it is too large
Load Diff
@@ -11,13 +11,9 @@ from shutil import make_archive,rmtree
|
||||
import mysqlUtilities
|
||||
import tarfile
|
||||
from multiprocessing import Process
|
||||
import json
|
||||
import requests
|
||||
import signal
|
||||
from installUtilities import installUtilities
|
||||
import argparse
|
||||
from shutil import move,copy
|
||||
from xml.etree import ElementTree
|
||||
from virtualHostUtilities import virtualHostUtilities
|
||||
from sslUtilities import sslUtilities
|
||||
from websiteFunctions.models import Websites, ChildDomains, Backups
|
||||
@@ -29,9 +25,9 @@ from xml.etree import ElementTree
|
||||
from xml.dom import minidom
|
||||
from backup.models import DBUsers
|
||||
from mailServer.models import Domains as eDomains
|
||||
from random import randint
|
||||
import time
|
||||
from plogical.mailUtilities import mailUtilities
|
||||
from shutil import copy
|
||||
|
||||
## I am not the monster that you think I am..
|
||||
|
||||
@@ -39,6 +35,7 @@ class backupUtilities:
|
||||
|
||||
completeKeyPath = "/home/cyberpanel/.ssh"
|
||||
destinationsPath = "/home/cyberpanel/destinations"
|
||||
licenseKey = '/usr/local/lsws/conf/license.key'
|
||||
|
||||
@staticmethod
|
||||
def prepareBackupMeta(backupDomain, backupName, tempStoragePath, backupPath):
|
||||
@@ -229,6 +226,12 @@ class backupUtilities:
|
||||
|
||||
domainName = backupMetaData.find('masterDomain').text
|
||||
|
||||
## Saving original vhost conf file
|
||||
|
||||
completPathToConf = virtualHostUtilities.Server_root + '/conf/vhosts/' + domainName + '/vhost.conf'
|
||||
if os.path.exists(backupUtilities.licenseKey):
|
||||
copy(completPathToConf, tempStoragePath + '/vhost.conf')
|
||||
|
||||
## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018 -- tempStoragePath
|
||||
## shutil.make_archive
|
||||
|
||||
@@ -273,6 +276,10 @@ class backupUtilities:
|
||||
|
||||
actualChildDomain = childDomain.find('domain').text
|
||||
|
||||
if os.path.exists(backupUtilities.licenseKey):
|
||||
completPathToConf = virtualHostUtilities.Server_root + '/conf/vhosts/' + actualChildDomain + '/vhost.conf'
|
||||
copy(completPathToConf, tempStoragePath + '/' + actualChildDomain + '.vhost.conf')
|
||||
|
||||
sslStoragePath = '/etc/letsencrypt/live/' + actualChildDomain
|
||||
|
||||
if os.path.exists(sslStoragePath):
|
||||
@@ -498,6 +505,12 @@ class backupUtilities:
|
||||
## Let us try to restore SSL for Child Domains.
|
||||
|
||||
try:
|
||||
|
||||
if os.path.exists(backupUtilities.licenseKey):
|
||||
if os.path.exists(completPath + '/' + domain + '.vhost.conf'):
|
||||
completPathToConf = virtualHostUtilities.Server_root + '/conf/vhosts/' + domain + '/vhost.conf'
|
||||
copy(completPath + '/' + domain + '.vhost.conf', completPathToConf)
|
||||
|
||||
sslStoragePath = completPath + "/sslData-" + domain + '.tar.gz'
|
||||
|
||||
if os.path.exists(sslStoragePath):
|
||||
@@ -586,17 +599,21 @@ class backupUtilities:
|
||||
tar = tarfile.open(pathToCompressedEmails)
|
||||
tar.extractall(emailHome)
|
||||
tar.close()
|
||||
|
||||
## Change permissions
|
||||
|
||||
command = "chmod -r vmail:vmail " + emailHome
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
except:
|
||||
pass
|
||||
|
||||
## emails extracted
|
||||
|
||||
## Change permissions
|
||||
|
||||
command = "chmod -r vmail:vmail " + emailHome
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
##
|
||||
if os.path.exists(backupUtilities.licenseKey):
|
||||
completPathToConf = virtualHostUtilities.Server_root + '/conf/vhosts/' + masterDomain + '/vhost.conf'
|
||||
if os.path.exists(completPath + '/vhost.conf'):
|
||||
copy(completPath + '/vhost.conf', completPathToConf)
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(status, "Done")
|
||||
|
||||
@@ -607,9 +624,7 @@ class backupUtilities:
|
||||
subprocess.call(cmd)
|
||||
|
||||
except BaseException, msg:
|
||||
status = open(os.path.join(completPath,'status'), "w")
|
||||
status.write(str(msg) + " [5009]")
|
||||
status.close()
|
||||
logging.CyberCPLogFileWriter.statusWriter(status, str(msg) + " [5009]")
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startRestore]")
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -62,7 +62,6 @@ class Upgrade:
|
||||
|
||||
##
|
||||
|
||||
|
||||
count = 0
|
||||
while (1):
|
||||
command = "pip install virtualenv"
|
||||
@@ -123,12 +122,17 @@ class Upgrade:
|
||||
Upgrade.stdOut("Project dependant modules installed successfully!!")
|
||||
break
|
||||
|
||||
command = "systemctl stop gunicorn.socket"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
try:
|
||||
command = "systemctl stop gunicorn.socket"
|
||||
subprocess.call(shlex.split(command))
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
command = "virtualenv --system-site-packages /usr/local/CyberCP"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
try:
|
||||
command = "virtualenv --system-site-packages /usr/local/CyberCP"
|
||||
subprocess.call(shlex.split(command))
|
||||
except:
|
||||
pass
|
||||
|
||||
Upgrade.stdOut('Virtual enviroment for CyberPanel successfully installed.')
|
||||
|
||||
@@ -161,7 +165,6 @@ class Upgrade:
|
||||
Upgrade.stdOut(str(msg) + " [upgradeOpenLiteSpeed]")
|
||||
os._exit(0)
|
||||
|
||||
|
||||
@staticmethod
|
||||
def updateGunicornConf():
|
||||
try:
|
||||
@@ -191,12 +194,17 @@ WantedBy=multi-user.target"""
|
||||
writeToFile.write(cont)
|
||||
writeToFile.close()
|
||||
|
||||
try:
|
||||
command = 'systemctl daemon-reload'
|
||||
subprocess.call(shlex.split(command))
|
||||
except:
|
||||
pass
|
||||
|
||||
command = 'systemctl daemon-reload'
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
command = 'systemctl restart gunicorn.socket'
|
||||
subprocess.call(shlex.split(command))
|
||||
try:
|
||||
command = 'systemctl restart gunicorn.socket'
|
||||
subprocess.call(shlex.split(command))
|
||||
except:
|
||||
pass
|
||||
|
||||
except BaseException, msg:
|
||||
Upgrade.stdOut(str(msg) + " [updateGunicornConf]")
|
||||
@@ -238,22 +246,34 @@ WantedBy=multi-user.target"""
|
||||
Upgrade.stdOut("File manager successfully upgraded!")
|
||||
break
|
||||
|
||||
command = "chmod -R 777 /usr/local/lsws/Example/html/FileManager"
|
||||
subprocess.call(shlex.split(command))
|
||||
try:
|
||||
command = "chmod -R 777 /usr/local/lsws/Example/html/FileManager"
|
||||
subprocess.call(shlex.split(command))
|
||||
except:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def setupCLI():
|
||||
try:
|
||||
try:
|
||||
command = "ln -s /usr/local/CyberCP/cli/cyberPanel.py /usr/bin/cyberpanel"
|
||||
subprocess.call(shlex.split(command))
|
||||
except:
|
||||
pass
|
||||
|
||||
command = "ln -s /usr/local/CyberCP/cli/cyberPanel.py /usr/bin/cyberpanel"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
|
||||
command = "chmod +x /usr/local/CyberCP/cli/cyberPanel.py"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
try:
|
||||
command = "chmod +x /usr/local/CyberCP/cli/cyberPanel.py"
|
||||
subprocess.call(shlex.split(command))
|
||||
except:
|
||||
pass
|
||||
|
||||
except OSError, msg:
|
||||
command = "chmod +x /usr/local/CyberCP/cli/cyberPanel.py"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
try:
|
||||
command = "chmod +x /usr/local/CyberCP/cli/cyberPanel.py"
|
||||
subprocess.call(shlex.split(command))
|
||||
except:
|
||||
pass
|
||||
|
||||
Upgrade.stdOut(str(msg) + " [setupCLI]")
|
||||
return 0
|
||||
|
||||
@@ -307,14 +327,23 @@ WantedBy=multi-user.target"""
|
||||
cwd = os.getcwd()
|
||||
os.chdir('/usr/local/CyberCP')
|
||||
|
||||
command = "echo 'CREATE TABLE `loginSystem_acl` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `name` varchar(50) NOT NULL UNIQUE, `adminStatus` integer NOT NULL DEFAULT 0, `versionManagement` integer NOT NULL DEFAULT 0, `createNewUser` integer NOT NULL DEFAULT 0, `deleteUser` integer NOT NULL DEFAULT 0, `resellerCenter` integer NOT NULL DEFAULT 0, `changeUserACL` integer NOT NULL DEFAULT 0, `createWebsite` integer NOT NULL DEFAULT 0, `modifyWebsite` integer NOT NULL DEFAULT 0, `suspendWebsite` integer NOT NULL DEFAULT 0, `deleteWebsite` integer NOT NULL DEFAULT 0, `createPackage` integer NOT NULL DEFAULT 0, `deletePackage` integer NOT NULL DEFAULT 0, `modifyPackage` integer NOT NULL DEFAULT 0, `createDatabase` integer NOT NULL DEFAULT 0, `deleteDatabase` integer NOT NULL DEFAULT 0, `listDatabases` integer NOT NULL DEFAULT 0, `createNameServer` integer NOT NULL DEFAULT 0, `createDNSZone` integer NOT NULL DEFAULT 0, `deleteZone` integer NOT NULL DEFAULT 0, `addDeleteRecords` integer NOT NULL DEFAULT 0, `createEmail` integer NOT NULL DEFAULT 0, `deleteEmail` integer NOT NULL DEFAULT 0, `emailForwarding` integer NOT NULL DEFAULT 0, `changeEmailPassword` integer NOT NULL DEFAULT 0, `dkimManager` integer NOT NULL DEFAULT 0, `createFTPAccount` integer NOT NULL DEFAULT 0, `deleteFTPAccount` integer NOT NULL DEFAULT 0, `listFTPAccounts` integer NOT NULL DEFAULT 0, `createBackup` integer NOT NULL DEFAULT 0, `restoreBackup` integer NOT NULL DEFAULT 0, `addDeleteDestinations` integer NOT NULL DEFAULT 0, `scheDuleBackups` integer NOT NULL DEFAULT 0, `remoteBackups` integer NOT NULL DEFAULT 0, `manageSSL` integer NOT NULL DEFAULT 0, `hostnameSSL` integer NOT NULL DEFAULT 0, `mailServerSSL` integer NOT NULL DEFAULT 0);' | python manage.py dbshell"
|
||||
subprocess.check_output(command, shell=True)
|
||||
try:
|
||||
command = "echo 'CREATE TABLE `loginSystem_acl` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `name` varchar(50) NOT NULL UNIQUE, `adminStatus` integer NOT NULL DEFAULT 0, `versionManagement` integer NOT NULL DEFAULT 0, `createNewUser` integer NOT NULL DEFAULT 0, `deleteUser` integer NOT NULL DEFAULT 0, `resellerCenter` integer NOT NULL DEFAULT 0, `changeUserACL` integer NOT NULL DEFAULT 0, `createWebsite` integer NOT NULL DEFAULT 0, `modifyWebsite` integer NOT NULL DEFAULT 0, `suspendWebsite` integer NOT NULL DEFAULT 0, `deleteWebsite` integer NOT NULL DEFAULT 0, `createPackage` integer NOT NULL DEFAULT 0, `deletePackage` integer NOT NULL DEFAULT 0, `modifyPackage` integer NOT NULL DEFAULT 0, `createDatabase` integer NOT NULL DEFAULT 0, `deleteDatabase` integer NOT NULL DEFAULT 0, `listDatabases` integer NOT NULL DEFAULT 0, `createNameServer` integer NOT NULL DEFAULT 0, `createDNSZone` integer NOT NULL DEFAULT 0, `deleteZone` integer NOT NULL DEFAULT 0, `addDeleteRecords` integer NOT NULL DEFAULT 0, `createEmail` integer NOT NULL DEFAULT 0, `deleteEmail` integer NOT NULL DEFAULT 0, `emailForwarding` integer NOT NULL DEFAULT 0, `changeEmailPassword` integer NOT NULL DEFAULT 0, `dkimManager` integer NOT NULL DEFAULT 0, `createFTPAccount` integer NOT NULL DEFAULT 0, `deleteFTPAccount` integer NOT NULL DEFAULT 0, `listFTPAccounts` integer NOT NULL DEFAULT 0, `createBackup` integer NOT NULL DEFAULT 0, `restoreBackup` integer NOT NULL DEFAULT 0, `addDeleteDestinations` integer NOT NULL DEFAULT 0, `scheDuleBackups` integer NOT NULL DEFAULT 0, `remoteBackups` integer NOT NULL DEFAULT 0, `manageSSL` integer NOT NULL DEFAULT 0, `hostnameSSL` integer NOT NULL DEFAULT 0, `mailServerSSL` integer NOT NULL DEFAULT 0);' | python manage.py dbshell"
|
||||
subprocess.check_output(command, shell=True)
|
||||
except:
|
||||
pass
|
||||
|
||||
command = "echo 'ALTER TABLE loginSystem_administrator ADD acl_id integer;' | python manage.py dbshell"
|
||||
subprocess.call(command, shell=True)
|
||||
try:
|
||||
command = "echo 'ALTER TABLE loginSystem_administrator ADD acl_id integer;' | python manage.py dbshell"
|
||||
subprocess.call(command, shell=True)
|
||||
except:
|
||||
pass
|
||||
|
||||
command = "echo 'ALTER TABLE loginSystem_administrator ADD FOREIGN KEY (acl_id) REFERENCES loginSystem_acl(id);' | python manage.py dbshell"
|
||||
subprocess.check_output(command, shell=True)
|
||||
try:
|
||||
command = "echo 'ALTER TABLE loginSystem_administrator ADD FOREIGN KEY (acl_id) REFERENCES loginSystem_acl(id);' | python manage.py dbshell"
|
||||
subprocess.check_output(command, shell=True)
|
||||
except:
|
||||
pass
|
||||
|
||||
dbName = settings.DATABASES['default']['NAME']
|
||||
dbUser = settings.DATABASES['default']['USER']
|
||||
@@ -325,36 +354,77 @@ WantedBy=multi-user.target"""
|
||||
if len(port) == 0:
|
||||
port = '3306'
|
||||
|
||||
passwordCMD = "use " + dbName+";insert into loginSystem_acl (id, name, adminStatus) values (1,'admin',1);"
|
||||
command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd)
|
||||
try:
|
||||
passwordCMD = "use " + dbName+";insert into loginSystem_acl (id, name, adminStatus) values (1,'admin',1);"
|
||||
command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd)
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
passwordCMD = "use " + dbName + ";insert into loginSystem_acl (id, name, adminStatus, createNewUser, deleteUser, createWebsite, resellerCenter, modifyWebsite, suspendWebsite, deleteWebsite, createPackage, deletePackage, modifyPackage, createNameServer, restoreBackup) values (2,'reseller',0,1,1,1,1,1,1,1,1,1,1,1,1);"
|
||||
command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd)
|
||||
except:
|
||||
pass
|
||||
|
||||
passwordCMD = "use " + dbName + ";insert into loginSystem_acl (id, name, adminStatus, createNewUser, deleteUser, createWebsite, resellerCenter, modifyWebsite, suspendWebsite, deleteWebsite, createPackage, deletePackage, modifyPackage, createNameServer, restoreBackup) values (2,'reseller',0,1,1,1,1,1,1,1,1,1,1,1,1);"
|
||||
command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd)
|
||||
try:
|
||||
passwordCMD = "use " + dbName + ";insert into loginSystem_acl (id, name, createDatabase, deleteDatabase, listDatabases, createDNSZone, deleteZone, addDeleteRecords, createEmail, deleteEmail, emailForwarding, changeEmailPassword, dkimManager, createFTPAccount, deleteFTPAccount, listFTPAccounts, createBackup, manageSSL) values (3,'user', 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);"
|
||||
command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd)
|
||||
except:
|
||||
pass
|
||||
|
||||
passwordCMD = "use " + dbName + ";insert into loginSystem_acl (id, name, createDatabase, deleteDatabase, listDatabases, createDNSZone, deleteZone, addDeleteRecords, createEmail, deleteEmail, emailForwarding, changeEmailPassword, dkimManager, createFTPAccount, deleteFTPAccount, listFTPAccounts, createBackup, manageSSL) values (3,'user', 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);"
|
||||
command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd)
|
||||
try:
|
||||
passwordCMD = "use " + dbName + ";UPDATE loginSystem_administrator SET acl_id = 3;"
|
||||
command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd)
|
||||
except:
|
||||
pass
|
||||
|
||||
passwordCMD = "use " + dbName + ";UPDATE loginSystem_administrator SET acl_id = 3;"
|
||||
command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd)
|
||||
try:
|
||||
passwordCMD = "use " + dbName + ";UPDATE loginSystem_administrator SET acl_id = 1 where userName = 'admin';"
|
||||
command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd)
|
||||
except:
|
||||
pass
|
||||
|
||||
passwordCMD = "use " + dbName + ";UPDATE loginSystem_administrator SET acl_id = 1 where userName = 'admin';"
|
||||
command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd)
|
||||
try:
|
||||
passwordCMD = "use " + dbName + ";alter table loginSystem_administrator drop initUserAccountsLimit;"
|
||||
command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd)
|
||||
except:
|
||||
pass
|
||||
|
||||
passwordCMD = "use " + dbName + ";alter table loginSystem_administrator drop initUserAccountsLimit;"
|
||||
command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd)
|
||||
try:
|
||||
passwordCMD = "use " + dbName + ";CREATE TABLE `websiteFunctions_aliasdomains` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `aliasDomain` varchar(75) NOT NULL);"
|
||||
command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd)
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
passwordCMD = "use " + dbName + ";ALTER TABLE `websiteFunctions_aliasdomains` ADD COLUMN `master_id` integer NOT NULL;"
|
||||
command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd)
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
passwordCMD = "use " + dbName + ";ALTER TABLE `websiteFunctions_aliasdomains` ADD CONSTRAINT `websiteFunctions_ali_master_id_726c433d_fk_websiteFu` FOREIGN KEY (`master_id`) REFERENCES `websiteFunctions_websites` (`id`);"
|
||||
command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd)
|
||||
except:
|
||||
pass
|
||||
|
||||
os.chdir(cwd)
|
||||
|
||||
@@ -366,15 +436,21 @@ WantedBy=multi-user.target"""
|
||||
def mailServerMigrations():
|
||||
try:
|
||||
os.chdir('/usr/local/CyberCP')
|
||||
|
||||
command = "echo 'ALTER TABLE e_forwardings DROP PRIMARY KEY;ALTER TABLE e_forwardings ADD id INT AUTO_INCREMENT PRIMARY KEY;' | python manage.py dbshell"
|
||||
res = subprocess.check_output(command, shell=True)
|
||||
|
||||
command = "python manage.py makemigrations emailPremium"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
|
||||
command = "python manage.py migrate emailPremium"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
try:
|
||||
command = "echo 'ALTER TABLE e_forwardings DROP PRIMARY KEY;ALTER TABLE e_forwardings ADD id INT AUTO_INCREMENT PRIMARY KEY;' | python manage.py dbshell"
|
||||
subprocess.check_output(command, shell=True)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
command = "python manage.py makemigrations emailPremium"
|
||||
subprocess.call(shlex.split(command))
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
command = "python manage.py migrate emailPremium"
|
||||
subprocess.call(shlex.split(command))
|
||||
except:
|
||||
pass
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -488,6 +564,7 @@ WantedBy=multi-user.target"""
|
||||
if count == 3:
|
||||
Upgrade.stdOut(
|
||||
"Failed to install tldextract! [installTLDExtract]")
|
||||
break
|
||||
else:
|
||||
Upgrade.stdOut("tldextract successfully installed! [pip]")
|
||||
Upgrade.stdOut("tldextract successfully installed! [pip]")
|
||||
@@ -506,11 +583,16 @@ WantedBy=multi-user.target"""
|
||||
|
||||
Version = version.objects.get(pk=1)
|
||||
|
||||
command = "systemctl stop gunicorn.socket"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
|
||||
command = "systemctl stop lscpd"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
try:
|
||||
command = "systemctl stop gunicorn.socket"
|
||||
subprocess.call(shlex.split(command))
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
command = "systemctl stop lscpd"
|
||||
subprocess.call(shlex.split(command))
|
||||
except:
|
||||
pass
|
||||
|
||||
##
|
||||
|
||||
@@ -546,9 +628,8 @@ WantedBy=multi-user.target"""
|
||||
##
|
||||
|
||||
|
||||
if Version.currentVersion == '1.7' and Version.build == 0:
|
||||
Upgrade.applyLoginSystemMigrations()
|
||||
Upgrade.enableServices()
|
||||
Upgrade.applyLoginSystemMigrations()
|
||||
Upgrade.enableServices()
|
||||
|
||||
## Upgrade OpenLiteSpeed
|
||||
|
||||
@@ -560,8 +641,11 @@ WantedBy=multi-user.target"""
|
||||
|
||||
Upgrade.upgradeVersion()
|
||||
|
||||
command = "systemctl start lscpd"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
try:
|
||||
command = "systemctl start lscpd"
|
||||
subprocess.call(shlex.split(command))
|
||||
except:
|
||||
pass
|
||||
|
||||
Upgrade.stdOut("Upgrade Completed.")
|
||||
|
||||
|
||||
@@ -643,8 +643,10 @@ RewriteFile .htaccess
|
||||
|
||||
inMB = int(float(currentUsed) / (1024.0 * 1024.0))
|
||||
|
||||
percentage = float(100) / float(totalAllowed)
|
||||
if totalAllowed == 0:
|
||||
totalAllowed = 999999
|
||||
|
||||
percentage = float(100) / float(totalAllowed)
|
||||
percentage = float(percentage) * float(inMB)
|
||||
except:
|
||||
print "0,0"
|
||||
|
||||
@@ -1395,17 +1395,15 @@ class WebsiteManager:
|
||||
try:
|
||||
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
self.domain = data['domainName']
|
||||
openBasedirValue = data['openBasedirValue']
|
||||
|
||||
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('changeOpenBasedir', 0)
|
||||
|
||||
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
||||
|
||||
execPath = execPath + " changeOpenBasedir --virtualHostName '" + self.domain + "' --openBasedirValue " + openBasedirValue
|
||||
@@ -1914,8 +1912,6 @@ class WebsiteManager:
|
||||
data['phpSelection'] = "PHP 7.0"
|
||||
data['package'] = data['packageName']
|
||||
|
||||
|
||||
|
||||
admin = Administrator.objects.get(userName=adminUser)
|
||||
|
||||
if hashPassword.check_password(admin.password, adminPass):
|
||||
@@ -1932,14 +1928,12 @@ class WebsiteManager:
|
||||
except BaseException:
|
||||
pass
|
||||
|
||||
|
||||
else:
|
||||
data_ret = {"existsStatus": 0, 'createWebSiteStatus': 0,
|
||||
'error_message': "Could not authorize access to API"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
return self.submitWebsiteCreation(admin.pk, data)
|
||||
|
||||
except BaseException, msg:
|
||||
|
||||
Reference in New Issue
Block a user