diff --git a/baseTemplate/templates/baseTemplate/FileManagerV2.html b/baseTemplate/templates/baseTemplate/FileManagerV2.html new file mode 100644 index 000000000..a33f4a364 --- /dev/null +++ b/baseTemplate/templates/baseTemplate/FileManagerV2.html @@ -0,0 +1,167 @@ +{% extends "baseTemplate/newBase.html" %} +{% load i18n %} +{% block titleNew %}{% trans "Home - CyberPanel" %}{% endblock %} +{% block newContent %} + + + {% trans "File Manager - CyberPanel" %} + + + + + {% load static %} + + + + + + + + + + + + + + + + + + + + + +
+
+
+

Current Path

+
+
+ +
+
+ +
+
+
+
+ +
+ +
+
+ + + + + + + + + + + +
+ File Name + + Size (KB) + + Last Modified + + Permissions +
+
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/filemanager/urls.py b/filemanager/urls.py index bd58d4934..b0de804e6 100755 --- a/filemanager/urls.py +++ b/filemanager/urls.py @@ -9,6 +9,7 @@ urlpatterns = [ url(r'^RootDownloadFile$',views.RootDownloadFile, name='RootDownloadFile'), url(r'^editFile$', views.editFile, name='editFile'), url('^Filemanager', views.FileManagerRoot, name='Filemanager'), + url('^V2/FilemanagerV2', views.FileManagerRootV2, name='FilemanagerV2'), url(r'^(?P(.*))$', views.loadFileManagerHome, name='loadFileManagerHome'), ] diff --git a/filemanager/views.py b/filemanager/views.py index 49b2cfe01..6a14bb718 100755 --- a/filemanager/views.py +++ b/filemanager/views.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from django.shortcuts import render,redirect +from django.shortcuts import render, redirect from loginSystem.models import Administrator from loginSystem.views import loadLoginPage import plogical.CyberCPLogFileWriter as logging @@ -8,9 +8,11 @@ import json from websiteFunctions.models import Websites from plogical.acl import ACLManager from .filemanager import FileManager as FM + + # Create your views here. -def loadFileManagerHome(request,domain): +def loadFileManagerHome(request, domain): try: userID = request.session['userID'] if Websites.objects.filter(domain=domain).exists(): @@ -27,6 +29,7 @@ def loadFileManagerHome(request,domain): except KeyError: return redirect(loadLoginPage) + def changePermissions(request): try: userID = request.session['userID'] @@ -58,6 +61,7 @@ def changePermissions(request): except KeyError: return redirect(loadLoginPage) + def controller(request): try: data = json.loads(request.body) @@ -128,6 +132,7 @@ def controller(request): fm = FM(request, None) return fm.ajaxPre(0, str(msg)) + def upload(request): try: @@ -152,6 +157,7 @@ def upload(request): except KeyError: return redirect(loadLoginPage) + def editFile(request): try: userID = request.session['userID'] @@ -184,13 +190,15 @@ def editFile(request): if ACLManager.checkOwnership(domainName, admin, currentACL) == 1: return render(request, 'filemanager/editFile.html', {'domainName': domainName, 'fileName': fileName, 'mode': mode, 'modeFiles': modeFiles, 'theme': theme, - 'themeFile': themeFile, 'additionalOptions': additionalOptions}) + 'themeFile': themeFile, + 'additionalOptions': additionalOptions}) else: return ACLManager.loadError() except KeyError: return redirect(loadLoginPage) + def FileManagerRoot(request): ### Load Custom CSS try: @@ -216,17 +224,17 @@ def FileManagerRoot(request): url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission" data = { "name": "Filemanager", - "IP": ipAddressLocal + "IP": ipAddressLocal } import requests response = requests.post(url, data=json.dumps(data)) Status = response.json()['status'] - if(Status == 1): + if (Status == 1): template = 'baseTemplate/FileManager.html' else: - return redirect("https://cyberpanel.net/cyberpanel-addons") + return redirect("https://cyberpanel.net/cyberpanel-addons") else: template = 'baseTemplate/FileManager.html' except BaseException as msg: @@ -241,6 +249,58 @@ def FileManagerRoot(request): proc = httpProc(request, template) return proc.render() + +def FileManagerRootV2(request): + ### Load Custom CSS + try: + from baseTemplate.models import CyberPanelCosmetic + cosmetic = CyberPanelCosmetic.objects.get(pk=1) + except: + from baseTemplate.models import CyberPanelCosmetic + cosmetic = CyberPanelCosmetic() + cosmetic.save() + + userID = request.session['userID'] + currentACL = ACLManager.loadedACL(userID) + ipFile = "/etc/cyberpanel/machineIP" + f = open(ipFile) + ipData = f.read() + ipAddressLocal = ipData.split('\n', 1)[0] + + try: + + from plogical.processUtilities import ProcessUtilities + if ProcessUtilities.decideServer() == ProcessUtilities.OLS: + + url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission" + data = { + "name": "Filemanager", + "IP": ipAddressLocal + } + + import requests + response = requests.post(url, data=json.dumps(data)) + Status = response.json()['status'] + + if (Status == 1): + template = 'baseTemplate/FileManagerV2.html' + else: + return redirect("https://cyberpanel.net/cyberpanel-addons") + else: + template = 'baseTemplate/FileManagerV2.html' + except BaseException as msg: + template = 'baseTemplate/FileManagerV2.html' + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadErrorJson('FilemanagerAdmin', 0) + + from plogical.httpProc import httpProc + proc = httpProc(request, template) + return proc.render() + + def downloadFile(request): try: userID = request.session['userID'] @@ -274,6 +334,7 @@ def downloadFile(request): except KeyError: return redirect(loadLoginPage) + def RootDownloadFile(request): try: userID = request.session['userID'] @@ -295,6 +356,6 @@ def RootDownloadFile(request): response['X-LiteSpeed-Location'] = '%s' % (fileToDownload) return response - #return HttpResponse(response['X-LiteSpeed-Location']) + # return HttpResponse(response['X-LiteSpeed-Location']) except KeyError: return redirect(loadLoginPage) diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctionsV2.js b/websiteFunctions/static/websiteFunctions/websiteFunctionsV2.js index 26061a71c..59c025d84 100644 --- a/websiteFunctions/static/websiteFunctions/websiteFunctionsV2.js +++ b/websiteFunctions/static/websiteFunctions/websiteFunctionsV2.js @@ -464,7 +464,7 @@ newapp.controller('websitePagesV2', function ($scope, $http, $timeout, $window) }; $scope.fileManagerURL = "/filemanager/" + $("#domainNamePage").text(); - $scope.wordPressInstallURL = $("#domainNamePage").text() + "/wordpressInstall"; + $scope.wordPressInstallURLV2 = $("#domainNamePageV2").text() + "/wordpressInstallV2"; $scope.joomlaInstallURL = $("#domainNamePage").text() + "/joomlaInstall"; $scope.setupGit = $("#domainNamePage").text() + "/setupGit"; $scope.installPrestaURL = $("#domainNamePage").text() + "/installPrestaShop"; @@ -3407,8 +3407,1584 @@ function create_staging_checkbox_function() { // alert(domain_check); } -newapp.controller('WPsiteHomeV2', function ($scope, $http, $timeout, $compile, $window) { +newapp.controller('installMauticCTRLV2', 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; + + $scope.databasePrefix = 'ps_'; + + 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%"); + }; + + 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.installMautic = 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/mauticInstall"; + + var home = "1"; + + if (typeof path !== 'undefined') { + home = "0"; + } + + + var data = { + domain: domain, + home: home, + path: path, + username: $scope.adminUserName, + email: $scope.email, + passwordByPass: $scope.password + }; + + 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) { + } + + }; + + +}); +newapp.controller('installPrestaShopCTRLV2', 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; + + $scope.databasePrefix = 'ps_'; + + 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%"); + }; + + 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.installPrestShop = 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/prestaShopInstall"; + + var home = "1"; + + if (typeof path !== 'undefined') { + home = "0"; + } + + + var data = { + domain: domain, + home: home, + path: path, + shopName: $scope.shopName, + firstName: $scope.firstName, + lastName: $scope.lastName, + databasePrefix: $scope.databasePrefix, + email: $scope.email, + passwordByPass: $scope.password + }; + + 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) { + } + + }; + + +}); + +newapp.controller('manageGITV2', function ($scope, $http, $timeout, $window) { + + $scope.cyberpanelLoading = true; + $scope.loadingSticks = true; + $scope.gitTracking = true; + $scope.gitEnable = true; + $scope.statusBox = true; + $scope.gitCommitsTable = true; + + var statusFile; + + $scope.fetchFolderDetails = function () { + + $scope.cyberpanelLoading = false; + $scope.gitCommitsTable = true; + + url = "/websites/fetchFolderDetails"; + + + var data = { + domain: $("#domain").text(), + folder: $scope.folder + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + function ListInitialDatas(response) { + $scope.cyberpanelLoading = true; + + if (response.data.status === 1) { + if (response.data.repo === 1) { + $scope.gitTracking = true; + $scope.gitEnable = false; + $scope.branches = response.data.finalBranches; + $scope.deploymentKey = response.data.deploymentKey; + $scope.remote = response.data.remote; + $scope.remoteResult = response.data.remoteResult; + $scope.totalCommits = response.data.totalCommits; + $scope.home = response.data.home; + $scope.webHookURL = response.data.webHookURL; + $scope.autoCommitCurrent = response.data.autoCommitCurrent; + $scope.autoPushCurrent = response.data.autoPushCurrent; + $scope.emailLogsCurrent = response.data.emailLogsCurrent; + document.getElementById("currentCommands").value = response.data.commands; + $scope.webhookCommandCurrent = response.data.webhookCommandCurrent; + } else { + $scope.gitTracking = false; + $scope.gitEnable = true; + $scope.home = response.data.home; + $scope.deploymentKey = response.data.deploymentKey; + } + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + } + + + } + + function cantLoadInitialDatas(response) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + + + } + + }; + + $scope.initRepo = function () { + + $scope.cyberpanelLoading = false; + + url = "/websites/initRepo"; + + + var data = { + domain: $("#domain").text(), + folder: $scope.folder + + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + function ListInitialDatas(response) { + $scope.cyberpanelLoading = true; + + if (response.data.status === 1) { + new PNotify({ + title: 'Success', + text: 'Repo initiated.', + type: 'success' + }); + $scope.fetchFolderDetails(); + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + } + + + } + + function cantLoadInitialDatas(response) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + + + } + + }; + + $scope.setupRemote = function () { + + $scope.cyberpanelLoading = false; + + url = "/websites/setupRemote"; + + + var data = { + domain: $("#domain").text(), + folder: $scope.folder, + gitHost: $scope.gitHost, + gitUsername: $scope.gitUsername, + gitReponame: $scope.gitReponame, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + function ListInitialDatas(response) { + $scope.cyberpanelLoading = true; + + if (response.data.status === 1) { + new PNotify({ + title: 'Success', + text: 'Remote successfully set.', + type: 'success' + }); + $scope.fetchFolderDetails(); + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + } + + + } + + function cantLoadInitialDatas(response) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + + + } + + }; + + var changeBranch = 0; + + $scope.changeBranch = function () { + + if (changeBranch === 1) { + changeBranch = 0; + return 0; + } + + $scope.loadingSticks = false; + $("#showStatus").modal(); + + url = "/websites/changeGitBranch"; + + + var data = { + domain: $("#domain").text(), + folder: $scope.folder, + branchName: $scope.branchName + + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + function ListInitialDatas(response) { + $scope.loadingSticks = true; + + if (response.data.status === 1) { + new PNotify({ + title: 'Success', + text: 'Changes applied.', + type: 'success' + }); + $scope.commandStatus = response.data.commandStatus; + $timeout(function () { + $window.location.reload(); + }, 3000); + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + $scope.commandStatus = response.data.commandStatus; + } + + + } + + function cantLoadInitialDatas(response) { + $scope.loadingSticks = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + + + } + }; + + $scope.createNewBranch = function () { + $scope.cyberpanelLoading = false; + $scope.commandStatus = ""; + $scope.statusBox = false; + changeBranch = 1; + + url = "/websites/createNewBranch"; + + + var data = { + domain: $("#domain").text(), + folder: $scope.folder, + newBranchName: $scope.newBranchName + + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + function ListInitialDatas(response) { + $scope.cyberpanelLoading = true; + + if (response.data.status === 1) { + new PNotify({ + title: 'Success', + text: 'Changes applied.', + type: 'success' + }); + $scope.commandStatus = response.data.commandStatus; + $scope.fetchFolderDetails(); + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + $scope.commandStatus = response.data.commandStatus; + } + + + } + + function cantLoadInitialDatas(response) { + $scope.cyberpanelLoading = false; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + + + } + }; + + $scope.commitChanges = function () { + $scope.cyberpanelLoading = false; + $scope.commandStatus = ""; + $scope.statusBox = false; + + url = "/websites/commitChanges"; + + + var data = { + domain: $("#domain").text(), + folder: $scope.folder, + commitMessage: $scope.commitMessage + + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + function ListInitialDatas(response) { + $scope.cyberpanelLoading = true; + + if (response.data.status === 1) { + new PNotify({ + title: 'Success', + text: 'Changes applied.', + type: 'success' + }); + $scope.commandStatus = response.data.commandStatus; + $scope.fetchFolderDetails(); + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + $scope.commandStatus = response.data.commandStatus; + } + + + } + + function cantLoadInitialDatas(response) { + $scope.cyberpanelLoading = false; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + + + } + }; + + $scope.gitPull = function () { + + $scope.loadingSticks = false; + $("#showStatus").modal(); + + url = "/websites/gitPull"; + + + var data = { + domain: $("#domain").text(), + folder: $scope.folder, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + function ListInitialDatas(response) { + $scope.loadingSticks = true; + + if (response.data.status === 1) { + new PNotify({ + title: 'Success', + text: 'Changes applied.', + type: 'success' + }); + $scope.commandStatus = response.data.commandStatus; + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + $scope.commandStatus = response.data.commandStatus; + } + + + } + + function cantLoadInitialDatas(response) { + $scope.loadingSticks = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + + + } + }; + + $scope.gitPush = function () { + + $scope.loadingSticks = false; + $("#showStatus").modal(); + + url = "/websites/gitPush"; + + + var data = { + domain: $("#domain").text(), + folder: $scope.folder, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + function ListInitialDatas(response) { + $scope.loadingSticks = true; + + if (response.data.status === 1) { + new PNotify({ + title: 'Success', + text: 'Changes applied.', + type: 'success' + }); + $scope.commandStatus = response.data.commandStatus; + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + $scope.commandStatus = response.data.commandStatus; + } + + + } + + function cantLoadInitialDatas(response) { + $scope.loadingSticks = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + + + } + }; + + $scope.attachRepoGIT = function () { + $scope.cyberpanelLoading = false; + $scope.commandStatus = ""; + $scope.statusBox = false; + + url = "/websites/attachRepoGIT"; + + + var data = { + domain: $("#domain").text(), + folder: $scope.folder, + gitHost: $scope.gitHost, + gitUsername: $scope.gitUsername, + gitReponame: $scope.gitReponame, + overrideData: $scope.overrideData + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + function ListInitialDatas(response) { + $scope.cyberpanelLoading = true; + + if (response.data.status === 1) { + new PNotify({ + title: 'Success', + text: 'Changes applied.', + type: 'success' + }); + $scope.commandStatus = response.data.commandStatus; + $scope.fetchFolderDetails(); + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + $scope.commandStatus = response.data.commandStatus; + } + + + } + + function cantLoadInitialDatas(response) { + $scope.cyberpanelLoading = false; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + + + } + }; + + $scope.removeTracking = function () { + + $scope.cyberpanelLoading = false; + + url = "/websites/removeTracking"; + + + var data = { + domain: $("#domain").text(), + folder: $scope.folder + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + function ListInitialDatas(response) { + $scope.cyberpanelLoading = true; + if (response.data.status === 1) { + new PNotify({ + title: 'Success', + text: 'Changes applied.', + type: 'success' + }); + $scope.fetchFolderDetails(); + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + } + + + } + + function cantLoadInitialDatas(response) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + + + } + }; + + $scope.fetchGitignore = function () { + + $scope.cyberpanelLoading = false; + + url = "/websites/fetchGitignore"; + + + var data = { + domain: $("#domain").text(), + folder: $scope.folder + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + function ListInitialDatas(response) { + $scope.cyberpanelLoading = true; + if (response.data.status === 1) { + new PNotify({ + title: 'Success', + text: 'Successfully fetched.', + type: 'success' + }); + $scope.gitIgnoreContent = response.data.gitIgnoreContent; + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + } + + + } + + function cantLoadInitialDatas(response) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + + + } + }; + + $scope.saveGitIgnore = function () { + + $scope.cyberpanelLoading = false; + + url = "/websites/saveGitIgnore"; + + + var data = { + domain: $("#domain").text(), + folder: $scope.folder, + gitIgnoreContent: $scope.gitIgnoreContent + + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + function ListInitialDatas(response) { + $scope.cyberpanelLoading = true; + if (response.data.status === 1) { + new PNotify({ + title: 'Success', + text: 'Successfully saved.', + type: 'success' + }); + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + } + + + } + + function cantLoadInitialDatas(response) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + + + } + }; + + $scope.fetchCommits = function () { + + $scope.cyberpanelLoading = false; + + url = "/websites/fetchCommits"; + + + var data = { + domain: $("#domain").text(), + folder: $scope.folder + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + function ListInitialDatas(response) { + $scope.cyberpanelLoading = true; + $scope.gitCommitsTable = false; + if (response.data.status === 1) { + new PNotify({ + title: 'Success', + text: 'Successfully fetched.', + type: 'success' + }); + $scope.commits = JSON.parse(response.data.commits); + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + } + + + } + + function cantLoadInitialDatas(response) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + + + } + }; + + var currentComit; + var fetchFileCheck = 0; + var initial = 1; + + $scope.fetchFiles = function (commit) { + + currentComit = commit; + $scope.cyberpanelLoading = false; + + if (initial === 1) { + initial = 0; + } else { + fetchFileCheck = 1; + } + + url = "/websites/fetchFiles"; + + + var data = { + domain: $("#domain").text(), + folder: $scope.folder, + commit: commit + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + function ListInitialDatas(response) { + $scope.cyberpanelLoading = true; + $scope.gitCommitsTable = false; + if (response.data.status === 1) { + new PNotify({ + title: 'Success', + text: 'Successfully fetched.', + type: 'success' + }); + $scope.files = response.data.files; + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + } + + + } + + function cantLoadInitialDatas(response) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + + + } + }; + + $scope.fileStatus = true; + + $scope.fetchChangesInFile = function () { + $scope.fileStatus = true; + + if (fetchFileCheck === 1) { + fetchFileCheck = 0; + return 0; + } + + $scope.cyberpanelLoading = false; + $scope.currentSelectedFile = $scope.changeFile; + + url = "/websites/fetchChangesInFile"; + + var data = { + domain: $("#domain").text(), + folder: $scope.folder, + file: $scope.changeFile, + commit: currentComit + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + function ListInitialDatas(response) { + $scope.cyberpanelLoading = true; + if (response.data.status === 1) { + new PNotify({ + title: 'Success', + text: 'Successfully fetched.', + type: 'success' + }); + $scope.fileStatus = false; + document.getElementById("fileChangedContent").innerHTML = response.data.fileChangedContent; + } else { + $scope.fileStatus = true; + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + } + } + + function cantLoadInitialDatas(response) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + + + } + }; + + $scope.saveGitConfigurations = function () { + + $scope.cyberpanelLoading = false; + + url = "/websites/saveGitConfigurations"; + + var data = { + domain: $("#domain").text(), + folder: $scope.folder, + autoCommit: $scope.autoCommit, + autoPush: $scope.autoPush, + emailLogs: $scope.emailLogs, + commands: document.getElementById("currentCommands").value, + webhookCommand: $scope.webhookCommand + }; + + if ($scope.autoCommit === undefined) { + $scope.autoCommitCurrent = 'Never'; + } else { + $scope.autoCommitCurrent = $scope.autoCommit; + } + + if ($scope.autoPush === undefined) { + $scope.autoPushCurrent = 'Never'; + } else { + $scope.autoPushCurrent = $scope.autoPush; + } + + if ($scope.emailLogs === undefined) { + $scope.emailLogsCurrent = false; + } else { + $scope.emailLogsCurrent = $scope.emailLogs; + } + + if ($scope.webhookCommand === undefined) { + $scope.webhookCommandCurrent = false; + } else { + $scope.webhookCommandCurrent = $scope.webhookCommand; + } + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + function ListInitialDatas(response) { + $scope.cyberpanelLoading = true; + if (response.data.status === 1) { + new PNotify({ + title: 'Success', + text: 'Successfully saved.', + type: 'success' + }); + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + } + } + + function cantLoadInitialDatas(response) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + + + } + }; + + $scope.currentPage = 1; + $scope.recordsToShow = 10; + + $scope.fetchGitLogs = function () { + $scope.cyberpanelLoading = false; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + var data = { + domain: $("#domain").text(), + folder: $scope.folder, + page: $scope.currentPage, + recordsToShow: $scope.recordsToShow + }; + + + dataurl = "/websites/fetchGitLogs"; + + $http.post(dataurl, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + function ListInitialDatas(response) { + $scope.cyberpanelLoading = true; + if (response.data.status === 1) { + new PNotify({ + title: 'Success', + text: 'Successfully fetched.', + type: 'success' + }); + $scope.logs = JSON.parse(response.data.logs); + $scope.pagination = response.data.pagination; + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + } + } + + function cantLoadInitialDatas(response) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + + + } + + + }; + +}); + +newapp.controller('installWordPressCTRLV2', 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, + passwordByPass: $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; + + + } + + + } + + +}); + +newapp.controller('WPsiteHomeV2', function ($scope, $http, $timeout, $compile, $window) { var CheckBoxpasssword = 0; @@ -4970,3 +6546,4 @@ function showTab(tabId, tabColour) { + diff --git a/websiteFunctions/templates/websiteFunctions/installMauticV2.html b/websiteFunctions/templates/websiteFunctions/installMauticV2.html new file mode 100644 index 000000000..45bf7e62e --- /dev/null +++ b/websiteFunctions/templates/websiteFunctions/installMauticV2.html @@ -0,0 +1,84 @@ +{% extends "baseTemplate/newBase.html" %} +{% load i18n %} +{% block titleNew %}{% trans "Home - CyberPanel" %}{% endblock %} +{% block newContent %} + + {% load static %} + +
+
+

Install Mautic

+

One-click Mautic Install!

+
+
+
+

+ {{ domainName }} - {% trans "Installation Details" %} +

+
+ {% trans "Before installing Mautic, we will change the PHP version of the website to PHP 8.0, which is supported by Mautic." %} +
+
+
+
+

Administrator Username

+
+
+ +
+
+
+
+

Email

+
+
+ +
+
+
+
+

Password

+
+
+ +
+
+
+
+
+ +
+
+
+
+

{$ currentStatus $}

+
+
+
+
+
+
+

{% trans "Installation failed. Error message:" %} {$ errorMessage $}

+
+
+

{% trans "Installation successful. Visit:" %} {$ installationURL $}

+
+
+

{% trans "Could not connect to server. Please refresh this page." %}

+
+
+
+
+
+ +
+
+
+{% endblock %} diff --git a/websiteFunctions/templates/websiteFunctions/installPrestaShopV2.html b/websiteFunctions/templates/websiteFunctions/installPrestaShopV2.html new file mode 100644 index 000000000..eae681e5e --- /dev/null +++ b/websiteFunctions/templates/websiteFunctions/installPrestaShopV2.html @@ -0,0 +1,108 @@ +{% extends "baseTemplate/newBase.html" %} +{% load i18n %} +{% block titleNew %}{% trans "Home - CyberPanel" %}{% endblock %} +{% block newContent %} + + {% load static %} + +
+
+

Install PrestaShop

+

One-click PrestaShop Install!

+
+
a +
+

+ {{ domainName }} - {% trans "Installation Details" %} +

+
+
+
+
+
+

Shop Name

+
+
+ +
+
+
+
+

First Name

+
+
+ +
+
+
+
+

Last Name

+
+
+ +
+
+
+
+

Email

+
+
+ +
+
+
+
+

Password

+
+
+ +
+
+
+
+

Database Prefix

+
+
+ +
+
+
+
+
+ +
+
+
+
+

{$ currentStatus $}

+
+
+
+
+
+
+

{% trans "Installation failed. Error message:" %} {$ errorMessage $}

+
+
+

{% trans "Installation successful. Visit:" %} {$ installationURL $}

+
+
+

{% trans "Could not connect to server. Please refresh this page." %}

+
+
+
+
+
+ +
+
+
+{% endblock %} diff --git a/websiteFunctions/templates/websiteFunctions/installWordPressV2.html b/websiteFunctions/templates/websiteFunctions/installWordPressV2.html new file mode 100644 index 000000000..c007c3c06 --- /dev/null +++ b/websiteFunctions/templates/websiteFunctions/installWordPressV2.html @@ -0,0 +1,103 @@ +{% extends "baseTemplate/newBase.html" %} +{% load i18n %} +{% block titleNew %}{% trans "Home - CyberPanel" %}{% endblock %} +{% block newContent %} + + {% load static %} + +
+
+

Install WordPress

+

Install WordPress with LSCache.

+
+
a +
+

+ {{ domainName }} - {% trans "Installation Details" %} - Stress Test +

+
+
+
+
+
+

Blog Title

+
+
+ +
+
+
+
+

Login User

+
+
+ +
+
+
+
+

Login Password

+
+
+ +
+
+
+
+

Email

+
+
+ +
+
+
+
+

Path

+
+
+ +
+
+
+
+
+ +
+
+
+
+

{$ currentStatus $}

+
+
+
+
+
+
+

{% trans "Installation failed. Error message:" %} {$ errorMessage $}

+
+
+

{% trans "Installation successful. Visit:" %} {$ installationURL $} or perform stress test.

+
+
+

{% trans "Could not connect to server. Please refresh this page." %}

+
+
+
+
+
+ +
+
+
+{% endblock %} diff --git a/websiteFunctions/templates/websiteFunctions/manageGIT.html b/websiteFunctions/templates/websiteFunctions/manageGIT.html index 5b0afc6c9..11b565403 100755 --- a/websiteFunctions/templates/websiteFunctions/manageGIT.html +++ b/websiteFunctions/templates/websiteFunctions/manageGIT.html @@ -37,8 +37,7 @@ -

{% trans "This folder does not have Git tracking, click below to initiate a repository and start tracking files." %}

+

{% trans "This folder does not have Git tracking, click below to initiate a repository and start tracking files." %}

+ + + + + + +{% endblock %} diff --git a/websiteFunctions/templates/websiteFunctions/websiteV2.html b/websiteFunctions/templates/websiteFunctions/websiteV2.html index 8b59fdfb7..e05a6a67e 100644 --- a/websiteFunctions/templates/websiteFunctions/websiteV2.html +++ b/websiteFunctions/templates/websiteFunctions/websiteV2.html @@ -8,7 +8,7 @@
-

{{ domain }}

+

{{ domain }}

All functions related to a particular site.

@@ -167,14 +167,13 @@ class="bg-orange-500 text-white font-bold px-2 py-1">{% trans "Next" %} -
- - + +
@@ -800,7 +799,7 @@
    -
  • +
    File Manager

    -
  • +
  • diff --git a/websiteFunctions/urls.py b/websiteFunctions/urls.py index 55a6a8547..3a1d1a1aa 100755 --- a/websiteFunctions/urls.py +++ b/websiteFunctions/urls.py @@ -16,6 +16,7 @@ urlpatterns = [ url(r'^createWebsiteV2$', views.createWebsiteV2, name='createWebsiteV2'), url(r'^listWebsitesV2$', views.listWebsitesV2, name='listWebsitesV2'), url(r'^V2/(?P(.*))$', views.domainV2, name='domainv2'), + url(r'^V2/(?P(.*))/wordpressInstallV2$', views.wordpressInstallV2, name='wordpressInstallV2'), url(r'^CreateNewDomain$', views.CreateNewDomain, name='CreateNewDomain'), url(r'^CreateNewDomainV2$', views.CreateNewDomainV2, name='CreateNewDomainV2'), @@ -139,6 +140,7 @@ urlpatterns = [ url(r'^(?P(.*))/wordpressInstall$', views.wordpressInstall, name='wordpressInstall'), url(r'^installWordpressStatus$', views.installWordpressStatus, name="installWordpressStatus"), url(r'^installWordpress$', views.installWordpress, name='installWordpress'), + url(r'^V2/installWordpressV2$', views.installWordpressV2, name='installWordpressV2'), ## Joomla Install @@ -149,6 +151,7 @@ urlpatterns = [ url(r'^prestaShopInstall$', views.prestaShopInstall, name='prestaShopInstall'), url(r'^(?P(.*))/installPrestaShop$', views.installPrestaShop, name='installPrestaShop'), + url(r'^V2/(?P(.*))/installPrestaShopV2$', views.installPrestaShopV2, name='installPrestaShopV2'), ## magento @@ -158,6 +161,7 @@ urlpatterns = [ ## mautic url(r'^(?P(.*))/installMautic$', views.installMautic, name='installMautic'), + url(r'^V2/(?P(.*))/installMauticV2$', views.installMauticV2, name='installMauticV2'), url(r'^mauticInstall$', views.mauticInstall, name='mauticInstall'), ## Git @@ -182,6 +186,7 @@ urlpatterns = [ ### Manage GIT url(r'^(?P(.*))/manageGIT$', views.manageGIT, name='manageGIT'), + url(r'^V2/(?P(.*))/manageGITV2$', views.manageGITV2, name='manageGITV2'), url(r'^(?P(.*))/webhook$', views.webhook, name='webhook'), url(r'^fetchFolderDetails$', views.fetchFolderDetails, name='fetchFolderDetails'), url(r'^initRepo$', views.initRepo, name='initRepo'), diff --git a/websiteFunctions/views.py b/websiteFunctions/views.py index 51f78ebdb..307a6cefd 100755 --- a/websiteFunctions/views.py +++ b/websiteFunctions/views.py @@ -49,6 +49,7 @@ def WPCreate(request): except KeyError: return redirect(loadLoginPage) + def WPCreateV2(request): try: userID = request.session['userID'] @@ -57,6 +58,7 @@ def WPCreateV2(request): except KeyError: return redirect(loadLoginPage) + def ListWPSites(request): try: userID = request.session['userID'] @@ -65,6 +67,8 @@ def ListWPSites(request): return wm.ListWPSites(request, userID, DeleteID) except KeyError: return redirect(loadLoginPage) + + def ListWPSitesV2(request): try: userID = request.session['userID'] @@ -74,6 +78,7 @@ def ListWPSitesV2(request): except KeyError: return redirect(loadLoginPage) + def WPHome(request): try: userID = request.session['userID'] @@ -85,6 +90,7 @@ def WPHome(request): except KeyError: return redirect(loadLoginPage) + def WPHomeV2(request): try: userID = request.session['userID'] @@ -162,6 +168,7 @@ def RestoreBackups(request): except KeyError: return redirect(loadLoginPage) + def RestoreBackupsV2(request): try: userID = request.session['userID'] @@ -201,6 +208,7 @@ def ConfigurePlugins(request): except KeyError: return redirect(loadLoginPage) + def ConfigurePluginsV2(request): try: userID = request.session['userID'] @@ -228,6 +236,7 @@ def Addnewplugin(request): except KeyError: return redirect(loadLoginPage) + def AddnewpluginV2(request): try: userID = request.session['userID'] @@ -237,7 +246,6 @@ def AddnewpluginV2(request): return redirect(loadLoginPage) - def SearchOnkeyupPlugin(request): try: userID = request.session['userID'] @@ -292,6 +300,7 @@ def EidtPlugin(request): except KeyError: return redirect(loadLoginPage) + def EidtPluginV2(request): try: userID = request.session['userID'] @@ -904,6 +913,7 @@ def modifyWebsite(request): except KeyError: return redirect(loadLoginPage) + def modifyWebsiteV2(request): try: userID = request.session['userID'] @@ -924,6 +934,7 @@ def deleteWebsite(request): except KeyError: return redirect(loadLoginPage) + def deleteWebsiteV2(request): try: userID = request.session['userID'] @@ -931,6 +942,8 @@ def deleteWebsiteV2(request): return wm.deleteWebsiteV2(request, userID) except KeyError: return redirect(loadLoginPage) + + def CreateNewDomain(request): try: userID = request.session['userID'] @@ -939,6 +952,7 @@ def CreateNewDomain(request): except KeyError: return redirect(loadLoginPage) + def CreateNewDomainV2(request): try: userID = request.session['userID'] @@ -947,6 +961,7 @@ def CreateNewDomainV2(request): except KeyError: return redirect(loadLoginPage) + def siteState(request): try: userID = request.session['userID'] @@ -955,6 +970,7 @@ def siteState(request): except KeyError: return redirect(loadLoginPage) + def siteStateV2(request): try: userID = request.session['userID'] @@ -990,6 +1006,7 @@ def listChildDomains(request): except KeyError: return redirect(loadLoginPage) + def listChildDomainsV2(request): try: userID = request.session['userID'] @@ -1227,6 +1244,7 @@ def domain(request, domain): except KeyError: return redirect(loadLoginPage) + def domainV2(request, domain): try: @@ -1550,6 +1568,15 @@ def wordpressInstall(request, domain): return redirect(loadLoginPage) +def wordpressInstallV2(request, domain): + try: + userID = request.session['userID'] + wm = WebsiteManager(domain) + return wm.wordpressInstallV2(request, userID) + except KeyError: + return redirect(loadLoginPage) + + def installWordpress(request): try: userID = request.session['userID'] @@ -1559,6 +1586,15 @@ def installWordpress(request): return redirect(loadLoginPage) +def installWordpressV2(request): + try: + userID = request.session['userID'] + wm = WebsiteManager() + return wm.installWordpressV2(userID, json.loads(request.body)) + except KeyError: + return redirect(loadLoginPage) + + def installWordpressStatus(request): try: userID = request.session['userID'] @@ -1640,6 +1676,15 @@ def installPrestaShop(request, domain): return redirect(loadLoginPage) +def installPrestaShopV2(request, domain): + try: + userID = request.session['userID'] + wm = WebsiteManager(domain) + return wm.installPrestaShopV2(request, userID) + except KeyError: + return redirect(loadLoginPage) + + def installMagento(request, domain): try: userID = request.session['userID'] @@ -1667,6 +1712,15 @@ def installMautic(request, domain): return redirect(loadLoginPage) +def installMauticV2(request, domain): + try: + userID = request.session['userID'] + wm = WebsiteManager(domain) + return wm.installMauticV2(request, userID) + except KeyError: + return redirect(loadLoginPage) + + def mauticInstall(request): try: userID = request.session['userID'] @@ -1757,6 +1811,22 @@ def manageGIT(request, domain): return redirect(loadLoginPage) +def manageGITV2(request, domain): + try: + + if not request.GET._mutable: + request.GET._mutable = True + + request.GET['domain'] = domain + + userID = request.session['userID'] + wm = WebsiteManager(domain) + return wm.manageGITV2(request, userID) + + except KeyError: + return redirect(loadLoginPage) + + def fetchFolderDetails(request): try: userID = request.session['userID'] diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index d5a51f0af..47f766850 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -82,7 +82,6 @@ class WebsiteManager: Data, 'createWebsite') return proc.render() - def createWebsiteV2(self, request=None, userID=None, data=None): url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission" @@ -290,7 +289,6 @@ class WebsiteManager: response = requests.post(url, data=json.dumps(data)) Status = response.json()['status'] - rnpss = randomPassword.generate_pass(10) Data['Randam_String'] = rnpss.lower() @@ -343,7 +341,6 @@ class WebsiteManager: response = requests.post(url, data=json.dumps(data)) Status = response.json()['status'] - rnpss = randomPassword.generate_pass(10) Data['Randam_String'] = rnpss.lower() @@ -698,11 +695,11 @@ class WebsiteManager: password = randomPassword.generate_pass(10) command = f'sudo -u %s {FinalPHPPath} /usr/bin/wp user create autologin %s --role=administrator --user_pass="%s" --path=%s --skip-plugins --skip-themes' % ( - WPobj.owner.externalApp, 'autologin@cloudpages.cloud', password, WPobj.path) + WPobj.owner.externalApp, 'autologin@cloudpages.cloud', password, WPobj.path) ProcessUtilities.executioner(command) command = f'sudo -u %s {FinalPHPPath} /usr/bin/wp user update autologin --user_pass="%s" --path=%s --skip-plugins --skip-themes' % ( - WPobj.owner.externalApp, password, WPobj.path) + WPobj.owner.externalApp, password, WPobj.path) ProcessUtilities.executioner(command) data = {} @@ -1011,7 +1008,8 @@ class WebsiteManager: rnpss = randomPassword.generate_pass(10) proc = httpProc(request, 'websiteFunctions/createDomain.html', - {'websiteList': websitesName, 'phps': PHPManager.findPHPVersions(), 'Randam_String': rnpss, 'test_domain_data':test_domain_status}) + {'websiteList': websitesName, 'phps': PHPManager.findPHPVersions(), 'Randam_String': rnpss, + 'test_domain_data': test_domain_status}) return proc.render() def CreateNewDomainV2(self, request=None, userID=None, data=None): @@ -1035,7 +1033,8 @@ class WebsiteManager: rnpss = randomPassword.generate_pass(10) proc = httpProc(request, 'websiteFunctions/createDomainV2.html', - {'websiteList': websitesName, 'phps': PHPManager.findPHPVersions(), 'Randam_String': rnpss, 'test_domain_data':test_domain_status}) + {'websiteList': websitesName, 'phps': PHPManager.findPHPVersions(), 'Randam_String': rnpss, + 'test_domain_data': test_domain_status}) return proc.render() def siteState(self, request=None, userID=None, data=None): @@ -1151,12 +1150,12 @@ class WebsiteManager: FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php) command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp core version --skip-plugins --skip-themes --path=%s 2>/dev/null' % ( - Vhuser, FinalPHPPath, path) + Vhuser, FinalPHPPath, path) version = ProcessUtilities.outputExecutioner(command, None, True) version = html.escape(version) command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin status litespeed-cache --skip-plugins --skip-themes --path=%s' % ( - Vhuser, FinalPHPPath, path) + Vhuser, FinalPHPPath, path) lscachee = ProcessUtilities.outputExecutioner(command) if lscachee.find('Status: Active') > -1: @@ -1165,7 +1164,7 @@ class WebsiteManager: lscache = 0 command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config list --skip-plugins --skip-themes --path=%s' % ( - Vhuser, FinalPHPPath, path) + Vhuser, FinalPHPPath, path) stdout = ProcessUtilities.outputExecutioner(command) debugging = 0 for items in stdout.split('\n'): @@ -1174,12 +1173,12 @@ class WebsiteManager: break command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp option get blog_public --skip-plugins --skip-themes --path=%s' % ( - Vhuser, FinalPHPPath, path) + Vhuser, FinalPHPPath, path) stdoutput = ProcessUtilities.outputExecutioner(command) searchindex = int(stdoutput.splitlines()[-1]) command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp maintenance-mode status --skip-plugins --skip-themes --path=%s' % ( - Vhuser, FinalPHPPath, path) + Vhuser, FinalPHPPath, path) maintenanceMod = ProcessUtilities.outputExecutioner(command) result = maintenanceMod.splitlines()[-1] @@ -1250,7 +1249,7 @@ class WebsiteManager: FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php) command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin list --skip-plugins --skip-themes --format=json --path=%s' % ( - Vhuser, FinalPHPPath, path) + Vhuser, FinalPHPPath, path) stdoutput = ProcessUtilities.outputExecutioner(command) json_data = stdoutput.splitlines()[-1] @@ -1288,7 +1287,7 @@ class WebsiteManager: FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php) command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme list --skip-plugins --skip-themes --format=json --path=%s' % ( - Vhuser, FinalPHPPath, path) + Vhuser, FinalPHPPath, path) stdoutput = ProcessUtilities.outputExecutioner(command) json_data = stdoutput.splitlines()[-1] @@ -1631,7 +1630,7 @@ class WebsiteManager: Rconfig = json.loads(RemoteBackupConfigobj.config) try: - #This code is only supposed to run if backups are s3, not for SFTP + # This code is only supposed to run if backups are s3, not for SFTP provider = Rconfig['Provider'] if provider == "Backblaze": EndURl = Rconfig['EndUrl'] @@ -1761,7 +1760,6 @@ class WebsiteManager: currentACL = ACLManager.loadedACL(userID) admin = Administrator.objects.get(pk=userID) - allweb = Websites.objects.all() childdomain = ChildDomains.objects.all() @@ -1774,7 +1772,6 @@ class WebsiteManager: if os.path.exists(ProcessUtilities.debugPath): logging.CyberCPLogFileWriter.writeToFile(result) - if result.find('No such file or directory') == -1: try: WPSites.objects.get(path=webpath) @@ -2110,19 +2107,19 @@ class WebsiteManager: FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php) command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin status %s --skip-plugins --skip-themes --path=%s' % ( - Vhuser, FinalPHPPath, plugin, path) + Vhuser, FinalPHPPath, plugin, path) stdoutput = ProcessUtilities.outputExecutioner(command) if stdoutput.find('Status: Active') > -1: command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin deactivate %s --skip-plugins --skip-themes --path=%s' % ( - Vhuser, FinalPHPPath, plugin, path) + Vhuser, FinalPHPPath, plugin, path) stdoutput = ProcessUtilities.outputExecutioner(command) time.sleep(3) else: command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin activate %s --skip-plugins --skip-themes --path=%s' % ( - Vhuser, FinalPHPPath, plugin, path) + Vhuser, FinalPHPPath, plugin, path) stdoutput = ProcessUtilities.outputExecutioner(command) time.sleep(3) @@ -2199,11 +2196,6 @@ class WebsiteManager: else: return ACLManager.loadError() - - - - - background = ApplicationInstaller('CreateStagingNow', extraArgs) background.start() @@ -2255,27 +2247,27 @@ class WebsiteManager: if settingValue: command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin install litespeed-cache --path=%s --skip-plugins --skip-themes" % ( - Vhuser, FinalPHPPath, path) + Vhuser, FinalPHPPath, path) stdoutput = ProcessUtilities.outputExecutioner(command) command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin activate litespeed-cache --path=%s --skip-plugins --skip-themes" % ( - Vhuser, FinalPHPPath, path) + Vhuser, FinalPHPPath, path) stdoutput = ProcessUtilities.outputExecutioner(command) else: command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin deactivate litespeed-cache --path=%s --skip-plugins --skip-themes' % ( - Vhuser, FinalPHPPath, path) + Vhuser, FinalPHPPath, path) stdoutput = ProcessUtilities.outputExecutioner(command) elif setting == 'debugging': command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp litespeed-purge all --path=%s --skip-plugins --skip-themes" % ( - Vhuser, FinalPHPPath, path) + Vhuser, FinalPHPPath, path) stdoutput = ProcessUtilities.outputExecutioner(command) if settingValue: command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp config set WP_DEBUG true --path=%s --skip-plugins --skip-themes" % ( - Vhuser, FinalPHPPath, path) + Vhuser, FinalPHPPath, path) stdoutput = ProcessUtilities.outputExecutioner(command) logging.CyberCPLogFileWriter.writeToFile("Debugging mk true 1 output:" + str(stdoutput)) @@ -2287,7 +2279,7 @@ class WebsiteManager: else: command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp config set WP_DEBUG false --path=%s --skip-plugins --skip-themes" % ( - Vhuser, FinalPHPPath, path) + Vhuser, FinalPHPPath, path) stdoutput = ProcessUtilities.outputExecutioner(command) logging.CyberCPLogFileWriter.writeToFile("Debugging mk false 0 output:" + str(stdoutput)) @@ -2298,35 +2290,35 @@ class WebsiteManager: elif setting == 'searchIndex': command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp litespeed-purge all --path=%s --skip-plugins --skip-themes" % ( - Vhuser, FinalPHPPath, path) + Vhuser, FinalPHPPath, path) stdoutput = ProcessUtilities.outputExecutioner(command) if settingValue: command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp option update blog_public 1 --path=%s --skip-plugins --skip-themes" % ( - Vhuser, FinalPHPPath, path) + Vhuser, FinalPHPPath, path) stdoutput = ProcessUtilities.outputExecutioner(command) else: command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp option update blog_public 0 --path=%s --skip-plugins --skip-themes" % ( - Vhuser, FinalPHPPath, path) + Vhuser, FinalPHPPath, path) stdoutput = ProcessUtilities.outputExecutioner(command) elif setting == 'maintenanceMode': command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp litespeed-purge all --path=%s --skip-plugins --skip-themes" % ( - Vhuser, FinalPHPPath, path) + Vhuser, FinalPHPPath, path) stdoutput = ProcessUtilities.outputExecutioner(command) if settingValue: command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp maintenance-mode activate --path=%s --skip-plugins --skip-themes" % ( - Vhuser, FinalPHPPath, path) + Vhuser, FinalPHPPath, path) stdoutput = ProcessUtilities.outputExecutioner(command) else: command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp maintenance-mode deactivate --path=%s --skip-plugins --skip-themes" % ( - Vhuser, FinalPHPPath, path) + Vhuser, FinalPHPPath, path) stdoutput = ProcessUtilities.outputExecutioner(command) elif setting == 'PasswordProtection': execPath = f"/usr/local/CyberCP/bin/python {virtualHostUtilities.cyberPanel}/plogical/virtualHostUtilities.py" @@ -2392,8 +2384,6 @@ class WebsiteManager: currentACL = ACLManager.loadedACL(userID) admin = Administrator.objects.get(pk=userID) - - extraArgs = {} extraArgs['currentACL'] = currentACL extraArgs['adminID'] = admin.pk @@ -3159,9 +3149,9 @@ class WebsiteManager: ## Fix https://github.com/usmannasir/cyberpanel/issues/998 - #from plogical.IncScheduler import IncScheduler - #isPU = IncScheduler('CalculateAndUpdateDiskUsage', {}) - #isPU.start() + # from plogical.IncScheduler import IncScheduler + # isPU = IncScheduler('CalculateAndUpdateDiskUsage', {}) + # isPU.start() command = '/usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/IncScheduler.py UpdateDiskUsageForce' ProcessUtilities.outputExecutioner(command) @@ -4269,6 +4259,18 @@ class WebsiteManager: proc = httpProc(request, 'websiteFunctions/installWordPress.html', {'domainName': self.domain}) return proc.render() + def wordpressInstallV2(self, request=None, userID=None, data=None): + currentACL = ACLManager.loadedACL(userID) + admin = Administrator.objects.get(pk=userID) + + if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + + proc = httpProc(request, 'websiteFunctions/installWordPressV2.html', {'domainName': self.domain}) + return proc.render() + def installWordpress(self, userID=None, data=None): try: @@ -4312,6 +4314,49 @@ class WebsiteManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) + def installWordpressV2(self, userID=None, data=None): + try: + + currentACL = ACLManager.loadedACL(userID) + admin = Administrator.objects.get(pk=userID) + + self.domain = data['domain'] + + if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadErrorJson('installStatus', 0) + + 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['passwordByPass'] + 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() + + time.sleep(2) + + data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None', + 'tempStatusPath': extraArgs['tempStatusPath']} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + + except BaseException as msg: + data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + def installWordpressStatus(self, userID=None, data=None): try: statusFile = data['statusFile'] @@ -4604,6 +4649,18 @@ StrictHostKeyChecking no proc = httpProc(request, 'websiteFunctions/installPrestaShop.html', {'domainName': self.domain}) return proc.render() + def installPrestaShopV2(self, request=None, userID=None, data=None): + currentACL = ACLManager.loadedACL(userID) + admin = Administrator.objects.get(pk=userID) + + if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + + proc = httpProc(request, 'websiteFunctions/installPrestaShopV2.html', {'domainName': self.domain}) + return proc.render() + def installMagento(self, request=None, userID=None, data=None): currentACL = ACLManager.loadedACL(userID) admin = Administrator.objects.get(pk=userID) @@ -4675,6 +4732,18 @@ StrictHostKeyChecking no proc = httpProc(request, 'websiteFunctions/installMautic.html', {'domainName': self.domain}) return proc.render() + def installMauticV2(self, request=None, userID=None, data=None): + currentACL = ACLManager.loadedACL(userID) + admin = Administrator.objects.get(pk=userID) + + if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + + proc = httpProc(request, 'websiteFunctions/installMauticV2.html', {'domainName': self.domain}) + return proc.render() + def mauticInstall(self, userID=None, data=None): try: @@ -4688,7 +4757,6 @@ StrictHostKeyChecking no else: return ACLManager.loadErrorJson('installStatus', 0) - #### Before installing mautic change php to 8.0 completePathToConfigFile = f'/usr/local/lsws/conf/vhosts/{self.domain}/vhost.conf' @@ -5101,7 +5169,7 @@ StrictHostKeyChecking no else: phpVersion = f'PHP {phpPath[2]}' - #php = PHPManager.getPHPString(phpVersion) + # php = PHPManager.getPHPString(phpVersion) if os.path.exists(ProcessUtilities.debugPath): logging.CyberCPLogFileWriter.writeToFile(f'PHP Version in tune settings {phpVersion}') @@ -5121,7 +5189,7 @@ StrictHostKeyChecking no json_data = json.dumps(data_ret) return HttpResponse(json_data) except BaseException as msg: - data_ret = {'status': 0, 'error_message': str(msg)} + data_ret = {'status': 0, 'error_message': str(msg)} json_data = json.dumps(data_ret) return HttpResponse(json_data) @@ -5366,6 +5434,40 @@ StrictHostKeyChecking no {'domainName': self.domain, 'folders': folders}) return proc.render() + def manageGITV2(self, request=None, userID=None, data=None): + currentACL = ACLManager.loadedACL(userID) + admin = Administrator.objects.get(pk=userID) + + if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + + try: + website = Websites.objects.get(domain=self.domain) + folders = ['/home/%s/public_html' % (self.domain)] + + databases = website.databases_set.all() + + # for database in databases: + # basePath = '/var/lib/mysql/' + # folders.append('%s%s' % (basePath, database.dbName)) + except: + + self.childWebsite = ChildDomains.objects.get(domain=self.domain) + + folders = [self.childWebsite.path] + + databases = self.childWebsite.master.databases_set.all() + + # for database in databases: + # basePath = '/var/lib/mysql/' + # folders.append('%s%s' % (basePath, database.dbName)) + + proc = httpProc(request, 'websiteFunctions/manageGITV2.html', + {'domainName': self.domain, 'folders': folders}) + return proc.render() + def folderCheck(self): try: @@ -6881,7 +6983,6 @@ StrictHostKeyChecking no final_json = json.dumps(final_dic) return HttpResponse(final_json) - def ApacheManager(self, request=None, userID=None, data=None): currentACL = ACLManager.loadedACL(userID) admin = Administrator.objects.get(pk=userID) @@ -6898,7 +6999,8 @@ StrictHostKeyChecking no else: apachemanager = 0 - proc = httpProc(request, 'websiteFunctions/ApacheManager.html', {'domainName': self.domain, 'phps': phps, 'apachemanager':apachemanager}) + proc = httpProc(request, 'websiteFunctions/ApacheManager.html', + {'domainName': self.domain, 'phps': phps, 'apachemanager': apachemanager}) return proc.render() def saveApacheConfigsToFile(self, userID=None, data=None):