diff --git a/baseTemplate/views.py b/baseTemplate/views.py index 04cd9ca5a..ebca03522 100755 --- a/baseTemplate/views.py +++ b/baseTemplate/views.py @@ -262,6 +262,11 @@ def getthemedata(request): currentACL = ACLManager.loadedACL(val) data = json.loads(request.body) + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadErrorJson('reboot', 0) + #logging.CyberCPLogFileWriter.writeToFile(str(data) + " [themedata]") url = "https://raw.githubusercontent.com/usmannasir/CyberPanel-Themes/main/%s/design.css" % data['Themename'] diff --git a/plogical/backupUtilities.py b/plogical/backupUtilities.py index 287657797..23127abcf 100755 --- a/plogical/backupUtilities.py +++ b/plogical/backupUtilities.py @@ -368,11 +368,14 @@ class backupUtilities: ## Stop making archive of document_root and copy instead - # copy_tree('/home/%s/public_html' % domainName, '%s/%s' % (tempStoragePath, 'public_html')) + from shutil import copytree + + + #copytree('/home/%s/public_html' % domainName, '%s/%s' % (tempStoragePath, 'public_html')) command = f'cp -R /home/{domainName}/public_html {tempStoragePath}/public_html' if ProcessUtilities.normalExecutioner(command) == 0: - raise BaseException(f'Failed to run {command}.') + raise BaseException(f'Failed to run cp command during backup generation.') # make_archive(os.path.join(tempStoragePath,"public_html"), 'gztar', os.path.join("/home",domainName,"public_html")) diff --git a/plogical/cPanelImporter.py b/plogical/cPanelImporter.py index 3283ff268..d88cc7477 100644 --- a/plogical/cPanelImporter.py +++ b/plogical/cPanelImporter.py @@ -279,7 +279,19 @@ class cPanelImporter: message = 'Restoring document root files for %s.' % (DomainName) logging.statusWriter(self.logFile, message, 1) - self.homeDir = self.MainSite[4].replace('/home/%s/' % (self.MainSite[0]), '') + message = 'self.MainSite[4] %s.' % (self.MainSite[4]) + logging.statusWriter(self.logFile, message, 1) + + message = 'self.MainSite[0] %s.' % (self.MainSite[0]) + logging.statusWriter(self.logFile, message, 1) + + if self.MainSite[4].find('home/') > -1: + self.homeDir = self.MainSite[4].replace('/home/%s/' % (self.MainSite[0]), '') + else: + self.homeDir = self.MainSite[4].replace('/home2/%s/' % (self.MainSite[0]), '') + + message = 'self.homeDir %s.' % (self.homeDir) + logging.statusWriter(self.logFile, message, 1) nowPath = '/home/%s/public_html' % (DomainName) if os.path.exists(nowPath): @@ -387,7 +399,23 @@ class cPanelImporter: message = 'Restoring document root files for %s.' % (items) logging.statusWriter(self.logFile, message, 1) - ChildDocRoot = self.OtherDomains[counter][4].replace('/home/%s/' % (self.MainSite[0]), '') + + message = 'self.OtherDomains[counter][4] %s.' % (self.OtherDomains[counter][4]) + logging.statusWriter(self.logFile, message, 1) + + message = 'self.MainSite[0] %s.' % (self.MainSite[0]) + logging.statusWriter(self.logFile, message, 1) + + if self.OtherDomains[counter][4].find('home/') > -1: + ChildDocRoot = self.OtherDomains[counter][4].replace('/home/%s/' % (self.MainSite[0]), '') + else: + ChildDocRoot = self.OtherDomains[counter][4].replace('/home2/%s/' % (self.MainSite[0]), '') + + + #ChildDocRoot = self.OtherDomains[counter][4].replace('/home/%s/' % (self.MainSite[0]), '') + + message = 'ChildDocRoot %s.' % (ChildDocRoot) + logging.statusWriter(self.logFile, message, 1) if os.path.exists(path): shutil.rmtree(path) @@ -863,7 +891,7 @@ class cPanelImporter: if self.createCronJobs(): pass else: - return 0 + pass self.RestoreEmails() self.FixPermissions() diff --git a/plogical/vhost.py b/plogical/vhost.py index 24127a088..8bfa8bd9a 100755 --- a/plogical/vhost.py +++ b/plogical/vhost.py @@ -910,9 +910,10 @@ class vhost: else: groupName = 'nogroup' - command = 'sudo -u %s chown %s:%s %s' % (virtualHostUser, virtualHostUser, groupName, path) + command = 'sudo -g %s -u %s chown %s:%s %s' % (groupName, virtualHostUser, virtualHostUser, groupName, path) ProcessUtilities.normalExecutioner(command) + command = "sudo -u %s chmod 750 %s" % (virtualHostUser, path) cmd = shlex.split(command) subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT) diff --git a/static/baseTemplate/custom-js/system-status.js b/static/baseTemplate/custom-js/system-status.js index b24357fb4..affffe87d 100644 --- a/static/baseTemplate/custom-js/system-status.js +++ b/static/baseTemplate/custom-js/system-status.js @@ -98,21 +98,21 @@ app.filter('getwebsitename', function () { }; }); -function getWebsiteName(domain){ +function getWebsiteName(domain) { if (domain !== undefined) { - domain = domain.replace(/-/g, ''); + domain = domain.replace(/-/g, ''); - var domainName = domain.split("."); + var domainName = domain.split("."); - var finalDomainName = domainName[0]; + var finalDomainName = domainName[0]; - if (finalDomainName.length > 5) { - finalDomainName = finalDomainName.substring(0, 4); - } - - return finalDomainName; + if (finalDomainName.length > 5) { + finalDomainName = finalDomainName.substring(0, 4); } + + return finalDomainName; + } } app.controller('systemStatusInfo', function ($scope, $http, $timeout) { @@ -655,3 +655,50 @@ app.controller('versionManagment', function ($scope, $http, $timeout) { }); + +app.controller('designtheme', function ($scope, $http, $timeout) { + + $scope.themeloading = true; + + + $scope.getthemedata = function () { + $scope.themeloading = false; + + url = "/base/getthemedata"; + + var data = { + package: "helo world", + Themename: $('#stheme').val(), + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(Listgetthemedata, cantgetthemedata); + + + function Listgetthemedata(response) { + $scope.themeloading = true; + + if (response.data.status === 1) { + document.getElementById('appendthemedata').innerHTML = ""; + $("#appendthemedata").val(response.data.csscontent) + } else { + alert(response.data.error_message) + } + } + + function cantgetthemedata(response) { + $scope.themeloading = true; + console.log(response); + } + + //$timeout(getStuff, 2000); + + }; +}); + +