Polish Translation

This commit is contained in:
usmannasir
2018-08-28 01:19:34 +05:00
parent 41b0483cb3
commit b6fee47f3e
36 changed files with 30974 additions and 21251 deletions

View File

@@ -178,4 +178,5 @@ LANGUAGES = (
('tr', _('Turkish')), ('tr', _('Turkish')),
('es', _('Spanish')), ('es', _('Spanish')),
('fr', _('French')), ('fr', _('French')),
('pl', _('Polish')),
) )

View File

@@ -58,6 +58,7 @@ def changeUserPassAPI(request):
websiteOwner = data['websiteOwner'] websiteOwner = data['websiteOwner']
ownerPassword = data['ownerPassword'] ownerPassword = data['ownerPassword']
adminUser = data['adminUser'] adminUser = data['adminUser']
adminPass = data['adminPass'] adminPass = data['adminPass']
@@ -130,7 +131,7 @@ def deleteWebsite(request):
try: try:
if request.method == 'POST': if request.method == 'POST':
data = json.loads(request.body) data = json.loads(request.body)
websiteName = data['domainName'] data['websiteName'] = data['domainName']
adminUser = data['adminUser'] adminUser = data['adminUser']
adminPass = data['adminPass'] adminPass = data['adminPass']
@@ -144,7 +145,7 @@ def deleteWebsite(request):
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
website = Websites.objects.get(domain=websiteName) website = Websites.objects.get(domain=data['websiteName'])
websiteOwner = website.admin websiteOwner = website.admin
if admin.websites_set.all().count() == 0: if admin.websites_set.all().count() == 0:
@@ -152,19 +153,8 @@ def deleteWebsite(request):
## Deleting master domain ## Deleting master domain
numberOfWebsites = str(Websites.objects.count() + ChildDomains.objects.count()) wm = WebsiteManager()
return wm.submitWebsiteDeletion(admin.pk, data)
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)
except BaseException, msg: except BaseException, msg:
data_ret = {'websiteDeleteStatus': 0, 'error_message': str(msg)} data_ret = {'websiteDeleteStatus': 0, 'error_message': str(msg)}
@@ -175,8 +165,6 @@ def submitWebsiteStatus(request):
try: try:
if request.method == 'POST': if request.method == 'POST':
data = json.loads(request.body) data = json.loads(request.body)
websiteName = data['websiteName']
state = data['state']
adminUser = data['adminUser'] adminUser = data['adminUser']
adminPass = data['adminPass'] adminPass = data['adminPass']
@@ -190,22 +178,8 @@ def submitWebsiteStatus(request):
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
website = Websites.objects.get(domain=websiteName) wm = WebsiteManager()
return wm.submitWebsiteStatus(admin.pk, json.loads(request.body))
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)
except BaseException, msg: except BaseException, msg:
data_ret = {'websiteStatus': 0, 'error_message': str(msg)} data_ret = {'websiteStatus': 0, 'error_message': str(msg)}
@@ -214,8 +188,6 @@ def submitWebsiteStatus(request):
def loginAPI(request): def loginAPI(request):
try: try:
if request.method == "POST":
username = request.POST['username'] username = request.POST['username']
password = request.POST['password'] password = request.POST['password']
@@ -227,13 +199,11 @@ def loginAPI(request):
else: else:
return HttpResponse("Invalid Credentials.") return HttpResponse("Invalid Credentials.")
except BaseException, msg: except BaseException, msg:
data = {'userID': 0, 'loginStatus': 0, 'error_message': str(msg)} data = {'userID': 0, 'loginStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data) json_data = json.dumps(data)
return HttpResponse(json_data) return HttpResponse(json_data)
def fetchSSHkey(request): def fetchSSHkey(request):
try: try:
if request.method == "POST": if request.method == "POST":
@@ -356,7 +326,6 @@ def fetchAccountsFromRemoteServer(request):
json_data = json.dumps(data) json_data = json.dumps(data)
return HttpResponse(json_data) return HttpResponse(json_data)
def FetchRemoteTransferStatus(request): def FetchRemoteTransferStatus(request):
try: try:
if request.method == "POST": if request.method == "POST":

View File

@@ -20,9 +20,10 @@
</h3> </h3>
<div class="example-box-wrapper"> <div class="example-box-wrapper">
{% if viewStatus == 0 %}
<div class="row"> <div class="row">
{% if createBackup or admin %}
<div class="col-md-6"> <div class="col-md-6">
<a href="{% url 'backupSite' %}" title="{% trans 'Back up Site' %}" class="tile-box tile-box-shortcut btn-primary"> <a href="{% url 'backupSite' %}" title="{% trans 'Back up Site' %}" class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header"> <div class="tile-header">
@@ -34,21 +35,9 @@
</a> </a>
</div> </div>
</div> {% endif %}
{% else %} {% if restoreBackup or admin %}
<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>
<div class="col-md-6"> <div class="col-md-6">
@@ -62,11 +51,56 @@
</a> </a>
</div> </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> </div>
{% endif %} {% 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>
</div> </div>
</div> </div>
</div> </div>

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

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

View File

@@ -135,6 +135,7 @@
<option>Russian</option> <option>Russian</option>
<option>Turkish</option> <option>Turkish</option>
<option>Spanish</option> <option>Spanish</option>
<option>Polish</option>
</select> </select>
</div> </div>
</div> </div>

View File

@@ -90,6 +90,11 @@ def verifyLogin(request):
request.session[LANGUAGE_SESSION_KEY] = user_Language request.session[LANGUAGE_SESSION_KEY] = user_Language
request.COOKIES['django_language'] = user_Language request.COOKIES['django_language'] = user_Language
settings.LANGUAGE_CODE = 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: except:
request.session[LANGUAGE_SESSION_KEY] = "en" request.session[LANGUAGE_SESSION_KEY] = "en"
request.COOKIES['django_language'] = "en" request.COOKIES['django_language'] = "en"

View File

@@ -10,6 +10,9 @@ from packages.models import Package
from websiteFunctions.models import Websites, ChildDomains from websiteFunctions.models import Websites, ChildDomains
from dns.models import Domains from dns.models import Domains
import json import json
from subprocess import call, CalledProcessError
from shlex import split
from CyberCPLogFileWriter import CyberCPLogFileWriter as logging
class ACLManager: class ACLManager:
@@ -408,6 +411,21 @@ class ACLManager:
else: else:
return 0 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

File diff suppressed because it is too large Load Diff

View File

@@ -11,13 +11,9 @@ from shutil import make_archive,rmtree
import mysqlUtilities import mysqlUtilities
import tarfile import tarfile
from multiprocessing import Process from multiprocessing import Process
import json
import requests
import signal import signal
from installUtilities import installUtilities from installUtilities import installUtilities
import argparse import argparse
from shutil import move,copy
from xml.etree import ElementTree
from virtualHostUtilities import virtualHostUtilities from virtualHostUtilities import virtualHostUtilities
from sslUtilities import sslUtilities from sslUtilities import sslUtilities
from websiteFunctions.models import Websites, ChildDomains, Backups from websiteFunctions.models import Websites, ChildDomains, Backups
@@ -29,9 +25,9 @@ from xml.etree import ElementTree
from xml.dom import minidom from xml.dom import minidom
from backup.models import DBUsers from backup.models import DBUsers
from mailServer.models import Domains as eDomains from mailServer.models import Domains as eDomains
from random import randint
import time import time
from plogical.mailUtilities import mailUtilities from plogical.mailUtilities import mailUtilities
from shutil import copy
## I am not the monster that you think I am.. ## I am not the monster that you think I am..
@@ -39,6 +35,7 @@ class backupUtilities:
completeKeyPath = "/home/cyberpanel/.ssh" completeKeyPath = "/home/cyberpanel/.ssh"
destinationsPath = "/home/cyberpanel/destinations" destinationsPath = "/home/cyberpanel/destinations"
licenseKey = '/usr/local/lsws/conf/license.key'
@staticmethod @staticmethod
def prepareBackupMeta(backupDomain, backupName, tempStoragePath, backupPath): def prepareBackupMeta(backupDomain, backupName, tempStoragePath, backupPath):
@@ -229,6 +226,12 @@ class backupUtilities:
domainName = backupMetaData.find('masterDomain').text 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 ## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018 -- tempStoragePath
## shutil.make_archive ## shutil.make_archive
@@ -273,6 +276,10 @@ class backupUtilities:
actualChildDomain = childDomain.find('domain').text 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 sslStoragePath = '/etc/letsencrypt/live/' + actualChildDomain
if os.path.exists(sslStoragePath): if os.path.exists(sslStoragePath):
@@ -498,6 +505,12 @@ class backupUtilities:
## Let us try to restore SSL for Child Domains. ## Let us try to restore SSL for Child Domains.
try: 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' sslStoragePath = completPath + "/sslData-" + domain + '.tar.gz'
if os.path.exists(sslStoragePath): if os.path.exists(sslStoragePath):
@@ -586,17 +599,21 @@ class backupUtilities:
tar = tarfile.open(pathToCompressedEmails) tar = tarfile.open(pathToCompressedEmails)
tar.extractall(emailHome) tar.extractall(emailHome)
tar.close() tar.close()
except:
pass
## emails extracted
## Change permissions ## Change permissions
command = "chmod -r vmail:vmail " + emailHome command = "chmod -r vmail:vmail " + emailHome
subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))
## except:
pass
## emails extracted
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") logging.CyberCPLogFileWriter.statusWriter(status, "Done")
@@ -607,9 +624,7 @@ class backupUtilities:
subprocess.call(cmd) subprocess.call(cmd)
except BaseException, msg: except BaseException, msg:
status = open(os.path.join(completPath,'status'), "w") logging.CyberCPLogFileWriter.statusWriter(status, str(msg) + " [5009]")
status.write(str(msg) + " [5009]")
status.close()
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startRestore]") logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startRestore]")
@staticmethod @staticmethod

View File

@@ -62,7 +62,6 @@ class Upgrade:
## ##
count = 0 count = 0
while (1): while (1):
command = "pip install virtualenv" command = "pip install virtualenv"
@@ -123,12 +122,17 @@ class Upgrade:
Upgrade.stdOut("Project dependant modules installed successfully!!") Upgrade.stdOut("Project dependant modules installed successfully!!")
break break
try:
command = "systemctl stop gunicorn.socket" command = "systemctl stop gunicorn.socket"
res = subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))
except:
pass
try:
command = "virtualenv --system-site-packages /usr/local/CyberCP" command = "virtualenv --system-site-packages /usr/local/CyberCP"
res = subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))
except:
pass
Upgrade.stdOut('Virtual enviroment for CyberPanel successfully installed.') Upgrade.stdOut('Virtual enviroment for CyberPanel successfully installed.')
@@ -161,7 +165,6 @@ class Upgrade:
Upgrade.stdOut(str(msg) + " [upgradeOpenLiteSpeed]") Upgrade.stdOut(str(msg) + " [upgradeOpenLiteSpeed]")
os._exit(0) os._exit(0)
@staticmethod @staticmethod
def updateGunicornConf(): def updateGunicornConf():
try: try:
@@ -191,12 +194,17 @@ WantedBy=multi-user.target"""
writeToFile.write(cont) writeToFile.write(cont)
writeToFile.close() writeToFile.close()
try:
command = 'systemctl daemon-reload' command = 'systemctl daemon-reload'
subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))
except:
pass
try:
command = 'systemctl restart gunicorn.socket' command = 'systemctl restart gunicorn.socket'
subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))
except:
pass
except BaseException, msg: except BaseException, msg:
Upgrade.stdOut(str(msg) + " [updateGunicornConf]") Upgrade.stdOut(str(msg) + " [updateGunicornConf]")
@@ -238,22 +246,34 @@ WantedBy=multi-user.target"""
Upgrade.stdOut("File manager successfully upgraded!") Upgrade.stdOut("File manager successfully upgraded!")
break break
try:
command = "chmod -R 777 /usr/local/lsws/Example/html/FileManager" command = "chmod -R 777 /usr/local/lsws/Example/html/FileManager"
subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))
except:
pass
@staticmethod @staticmethod
def setupCLI(): def setupCLI():
try: try:
try:
command = "ln -s /usr/local/CyberCP/cli/cyberPanel.py /usr/bin/cyberpanel" command = "ln -s /usr/local/CyberCP/cli/cyberPanel.py /usr/bin/cyberpanel"
res = subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))
except:
pass
try:
command = "chmod +x /usr/local/CyberCP/cli/cyberPanel.py" command = "chmod +x /usr/local/CyberCP/cli/cyberPanel.py"
res = subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))
except:
pass
except OSError, msg: except OSError, msg:
try:
command = "chmod +x /usr/local/CyberCP/cli/cyberPanel.py" command = "chmod +x /usr/local/CyberCP/cli/cyberPanel.py"
res = subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))
except:
pass
Upgrade.stdOut(str(msg) + " [setupCLI]") Upgrade.stdOut(str(msg) + " [setupCLI]")
return 0 return 0
@@ -307,14 +327,23 @@ WantedBy=multi-user.target"""
cwd = os.getcwd() cwd = os.getcwd()
os.chdir('/usr/local/CyberCP') os.chdir('/usr/local/CyberCP')
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" 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) subprocess.check_output(command, shell=True)
except:
pass
try:
command = "echo 'ALTER TABLE loginSystem_administrator ADD acl_id integer;' | python manage.py dbshell" command = "echo 'ALTER TABLE loginSystem_administrator ADD acl_id integer;' | python manage.py dbshell"
subprocess.call(command, shell=True) subprocess.call(command, shell=True)
except:
pass
try:
command = "echo 'ALTER TABLE loginSystem_administrator ADD FOREIGN KEY (acl_id) REFERENCES loginSystem_acl(id);' | python manage.py dbshell" 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) subprocess.check_output(command, shell=True)
except:
pass
dbName = settings.DATABASES['default']['NAME'] dbName = settings.DATABASES['default']['NAME']
dbUser = settings.DATABASES['default']['USER'] dbUser = settings.DATABASES['default']['USER']
@@ -325,36 +354,77 @@ WantedBy=multi-user.target"""
if len(port) == 0: if len(port) == 0:
port = '3306' port = '3306'
try:
passwordCMD = "use " + dbName+";insert into loginSystem_acl (id, name, adminStatus) values (1,'admin',1);" 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 + '"' command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
cmd = shlex.split(command) cmd = shlex.split(command)
subprocess.call(cmd) 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);" 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 + '"' command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
cmd = shlex.split(command) cmd = shlex.split(command)
subprocess.call(cmd) subprocess.call(cmd)
except:
pass
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);" 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 + '"' command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
cmd = shlex.split(command) cmd = shlex.split(command)
subprocess.call(cmd) subprocess.call(cmd)
except:
pass
try:
passwordCMD = "use " + dbName + ";UPDATE loginSystem_administrator SET acl_id = 3;" passwordCMD = "use " + dbName + ";UPDATE loginSystem_administrator SET acl_id = 3;"
command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"' command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
cmd = shlex.split(command) cmd = shlex.split(command)
subprocess.call(cmd) subprocess.call(cmd)
except:
pass
try:
passwordCMD = "use " + dbName + ";UPDATE loginSystem_administrator SET acl_id = 1 where userName = 'admin';" 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 + '"' command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
cmd = shlex.split(command) cmd = shlex.split(command)
subprocess.call(cmd) subprocess.call(cmd)
except:
pass
try:
passwordCMD = "use " + dbName + ";alter table loginSystem_administrator drop initUserAccountsLimit;" passwordCMD = "use " + dbName + ";alter table loginSystem_administrator drop initUserAccountsLimit;"
command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"' command = 'sudo mysql --host=' + host + ' --port=' + port + ' -u ' + dbUser + ' -p' + password + ' -e "' + passwordCMD + '"'
cmd = shlex.split(command) cmd = shlex.split(command)
subprocess.call(cmd) subprocess.call(cmd)
except:
pass
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) os.chdir(cwd)
@@ -366,15 +436,21 @@ WantedBy=multi-user.target"""
def mailServerMigrations(): def mailServerMigrations():
try: try:
os.chdir('/usr/local/CyberCP') os.chdir('/usr/local/CyberCP')
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" 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) subprocess.check_output(command, shell=True)
except:
pass
try:
command = "python manage.py makemigrations emailPremium" command = "python manage.py makemigrations emailPremium"
res = subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))
except:
pass
try:
command = "python manage.py migrate emailPremium" command = "python manage.py migrate emailPremium"
res = subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))
except:
pass
except: except:
pass pass
@@ -488,6 +564,7 @@ WantedBy=multi-user.target"""
if count == 3: if count == 3:
Upgrade.stdOut( Upgrade.stdOut(
"Failed to install tldextract! [installTLDExtract]") "Failed to install tldextract! [installTLDExtract]")
break
else: else:
Upgrade.stdOut("tldextract successfully installed! [pip]") Upgrade.stdOut("tldextract successfully installed! [pip]")
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) Version = version.objects.get(pk=1)
try:
command = "systemctl stop gunicorn.socket" command = "systemctl stop gunicorn.socket"
res = subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))
except:
pass
try:
command = "systemctl stop lscpd" command = "systemctl stop lscpd"
res = subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))
except:
pass
## ##
@@ -546,7 +628,6 @@ WantedBy=multi-user.target"""
## ##
if Version.currentVersion == '1.7' and Version.build == 0:
Upgrade.applyLoginSystemMigrations() Upgrade.applyLoginSystemMigrations()
Upgrade.enableServices() Upgrade.enableServices()
@@ -560,8 +641,11 @@ WantedBy=multi-user.target"""
Upgrade.upgradeVersion() Upgrade.upgradeVersion()
try:
command = "systemctl start lscpd" command = "systemctl start lscpd"
res = subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))
except:
pass
Upgrade.stdOut("Upgrade Completed.") Upgrade.stdOut("Upgrade Completed.")

View File

@@ -643,8 +643,10 @@ RewriteFile .htaccess
inMB = int(float(currentUsed) / (1024.0 * 1024.0)) 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) percentage = float(percentage) * float(inMB)
except: except:
print "0,0" print "0,0"

View File

@@ -1395,17 +1395,15 @@ class WebsiteManager:
try: try:
currentACL = ACLManager.loadedACL(userID) currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
self.domain = data['domainName'] self.domain = data['domainName']
openBasedirValue = data['openBasedirValue'] openBasedirValue = data['openBasedirValue']
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1: if currentACL['admin'] == 1:
pass pass
else: else:
return ACLManager.loadErrorJson('changeOpenBasedir', 0) return ACLManager.loadErrorJson('changeOpenBasedir', 0)
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
execPath = execPath + " changeOpenBasedir --virtualHostName '" + self.domain + "' --openBasedirValue " + openBasedirValue execPath = execPath + " changeOpenBasedir --virtualHostName '" + self.domain + "' --openBasedirValue " + openBasedirValue
@@ -1914,8 +1912,6 @@ class WebsiteManager:
data['phpSelection'] = "PHP 7.0" data['phpSelection'] = "PHP 7.0"
data['package'] = data['packageName'] data['package'] = data['packageName']
admin = Administrator.objects.get(userName=adminUser) admin = Administrator.objects.get(userName=adminUser)
if hashPassword.check_password(admin.password, adminPass): if hashPassword.check_password(admin.password, adminPass):
@@ -1932,14 +1928,12 @@ class WebsiteManager:
except BaseException: except BaseException:
pass pass
else: else:
data_ret = {"existsStatus": 0, 'createWebSiteStatus': 0, data_ret = {"existsStatus": 0, 'createWebSiteStatus': 0,
'error_message': "Could not authorize access to API"} 'error_message': "Could not authorize access to API"}
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
return self.submitWebsiteCreation(admin.pk, data) return self.submitWebsiteCreation(admin.pk, data)
except BaseException, msg: except BaseException, msg: