From c1ba54372fd27c3e85c1bd252a87cd8518abc871 Mon Sep 17 00:00:00 2001 From: Zarak Khan Date: Tue, 26 Dec 2023 14:51:44 +0500 Subject: [PATCH] commit message --- .../{example.html => dashboardV2.html} | 0 .../templates/baseTemplate/index.html | 2 +- .../templates/baseTemplate/newBase.html | 10 +- .../baseTemplate/visionManagementV2.html | 14 +- baseTemplate/urls.py | 2 +- baseTemplate/views.py | 4 +- .../websiteFunctions/websiteFunctionsV2.js | 566 +++++++++++++++++- .../websiteFunctions/WPCreateV2.html | 177 ++++++ .../websiteFunctions/deleteWebsiteV2.html | 42 ++ .../websiteFunctions/listChildDomains.html | 2 +- .../websiteFunctions/listChildDomainsV2.html | 397 ++++++------ .../websiteFunctions/listWebsiteV2.html | 100 ++-- .../websiteFunctions/modifyWebsiteV2.html | 85 +++ .../websiteFunctions/suspendWebsiteV2.html | 52 ++ websiteFunctions/urls.py | 4 + websiteFunctions/views.py | 34 +- websiteFunctions/website.py | 73 +++ 17 files changed, 1286 insertions(+), 278 deletions(-) rename baseTemplate/templates/baseTemplate/{example.html => dashboardV2.html} (100%) create mode 100644 websiteFunctions/templates/websiteFunctions/WPCreateV2.html create mode 100644 websiteFunctions/templates/websiteFunctions/deleteWebsiteV2.html create mode 100644 websiteFunctions/templates/websiteFunctions/modifyWebsiteV2.html create mode 100644 websiteFunctions/templates/websiteFunctions/suspendWebsiteV2.html diff --git a/baseTemplate/templates/baseTemplate/example.html b/baseTemplate/templates/baseTemplate/dashboardV2.html similarity index 100% rename from baseTemplate/templates/baseTemplate/example.html rename to baseTemplate/templates/baseTemplate/dashboardV2.html diff --git a/baseTemplate/templates/baseTemplate/index.html b/baseTemplate/templates/baseTemplate/index.html index f09190c14..30cad5ea1 100755 --- a/baseTemplate/templates/baseTemplate/index.html +++ b/baseTemplate/templates/baseTemplate/index.html @@ -302,7 +302,7 @@
+ +
- -
+
-
-
-
-
Owner
-
IP Address
-
Disk Usage
-
Package
-
SSL
-
State
-
+
+
+

-
-
-

-
-
-
- - - - - - -

Manage

-
-
-
-
-
-
- -
+
+ + +
+
+ + + + + + + + + + + +
+
+ + + + + + + + - + +
OwnerIP AddressDisk UsagePackageSSLState
+ + + + + + +

Manage

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

Modify Website

+

Packages define resources for your websites, you need to + add package before creating a website.

+
+
+
+

Modify Website

+
+
+
+
+
+

Select Website

+
+
+ +
+
+
+
+
+

Select Package

+
+
+ +
+
+
+
+

Select Owner

+
+
+ +
+
+
+
+

Email

+
+
+ +
+
+
+
+

Select PHP

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

Suspend/Unsuspend Website

+

This page can be used to suspend/unsuspend website

+
+
+
+

Suspend/Unsuspend Website

+
+
+
+
+
+

Select Website

+
+
+ +
+
+
+
+

Suspend/Unsuspend Website

+
+
+ +
+
+
+
+
+ +
+
+{% endblock %} diff --git a/websiteFunctions/urls.py b/websiteFunctions/urls.py index 412eb7b50..164ca32f2 100755 --- a/websiteFunctions/urls.py +++ b/websiteFunctions/urls.py @@ -8,8 +8,11 @@ url(r'^listChildDomains$', views.listChildDomains, name='listChildDomains'), url(r'^listChildDomainsV2$', views.listChildDomainsV2, name='listChildDomainsV2'), url(r'^modifyWebsite$', views.modifyWebsite, name='modifyWebsite'), + url(r'^modifyWebsiteV2$', views.modifyWebsiteV2, name='modifyWebsiteV2'), url(r'^deleteWebsite$', views.deleteWebsite, name='deleteWebsite'), + url(r'^deleteWebsiteV2$', views.deleteWebsiteV2, name='deleteWebsiteV2'), url(r'^siteState$', views.siteState, name='siteState'), + url(r'^siteStateV2$', views.siteStateV2, name='siteStateV2'), url(r'^createWebsiteV2$', views.createWebsiteV2, name='createWebsiteV2'), url(r'^listWebsitesV2$', views.listWebsitesV2, name='listWebsitesV2'), @@ -19,6 +22,7 @@ ### WordPress url(r'^createWordpress$', views.WPCreate, name='createWordpress'), + url(r'^createWordpressV2$', views.WPCreateV2, name='createWordpressV2'), url(r'^ListWPSites$', views.ListWPSites, name='ListWPSites'), url(r'^WPHome$', views.WPHome, name='WPHome'), url(r'^RestoreBackups$', views.RestoreBackups, name='RestoreBackups'), diff --git a/websiteFunctions/views.py b/websiteFunctions/views.py index ef7b0e727..e879e447d 100755 --- a/websiteFunctions/views.py +++ b/websiteFunctions/views.py @@ -49,6 +49,13 @@ def WPCreate(request): except KeyError: return redirect(loadLoginPage) +def WPCreateV2(request): + try: + userID = request.session['userID'] + wm = WebsiteManager() + return wm.WPCreateV2(request, userID, ) + except KeyError: + return redirect(loadLoginPage) def ListWPSites(request): try: @@ -832,6 +839,17 @@ def modifyWebsite(request): except KeyError: return redirect(loadLoginPage) +def modifyWebsiteV2(request): + try: + userID = request.session['userID'] + wm = WebsiteManager() + return wm.modifyWebsiteV2(request, userID) + except BaseException as msg: + return HttpResponse(str(msg)) + + except KeyError: + return redirect(loadLoginPage) + def deleteWebsite(request): try: @@ -841,7 +859,13 @@ def deleteWebsite(request): except KeyError: return redirect(loadLoginPage) - +def deleteWebsiteV2(request): + try: + userID = request.session['userID'] + wm = WebsiteManager() + return wm.deleteWebsiteV2(request, userID) + except KeyError: + return redirect(loadLoginPage) def CreateNewDomain(request): try: userID = request.session['userID'] @@ -866,6 +890,14 @@ def siteState(request): except KeyError: return redirect(loadLoginPage) +def siteStateV2(request): + try: + userID = request.session['userID'] + wm = WebsiteManager() + return wm.siteStateV2(request, userID) + except KeyError: + return redirect(loadLoginPage) + def listWebsites(request): try: diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 5d0e67a11..2fc0ca4e8 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -161,6 +161,54 @@ def WPCreate(self, request=None, userID=None, data=None): from django.shortcuts import reverse return redirect(reverse('pricing')) + def WPCreateV2(self, request=None, userID=None, data=None): + url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission" + data = { + "name": "wp-manager", + "IP": ACLManager.GetServerIP() + } + + import requests + response = requests.post(url, data=json.dumps(data)) + Status = response.json()['status'] + + if (Status == 1) or ProcessUtilities.decideServer() == ProcessUtilities.ent: + currentACL = ACLManager.loadedACL(userID) + adminNames = ACLManager.loadAllUsers(userID) + packagesName = ACLManager.loadPackages(userID, currentACL) + FinalVersions = [] + userobj = Administrator.objects.get(pk=userID) + counter = 0 + try: + import requests + WPVersions = json.loads(requests.get('https://api.wordpress.org/core/version-check/1.7/').text)[ + 'offers'] + + for versions in WPVersions: + if counter == 7: + break + if versions['current'] not in FinalVersions: + FinalVersions.append(versions['current']) + counter = counter + 1 + except: + FinalVersions = ['5.6', '5.5.3', '5.5.2'] + + Plugins = wpplugins.objects.filter(owner=userobj) + rnpss = randomPassword.generate_pass(10) + + ## + + test_domain_status = 1 + + Data = {'packageList': packagesName, "owernList": adminNames, 'WPVersions': FinalVersions, + 'Plugins': Plugins, 'Randam_String': rnpss.lower(), 'test_domain_data': test_domain_status} + proc = httpProc(request, 'websiteFunctions/WPCreateV2.html', + Data, 'createWebsite') + return proc.render() + else: + from django.shortcuts import reverse + return redirect(reverse('pricing')) + def ListWPSites(self, request=None, userID=None, DeleteID=None): currentACL = ACLManager.loadedACL(userID) @@ -716,6 +764,15 @@ def modifyWebsite(self, request=None, userID=None, data=None): {'websiteList': websitesName, 'phps': phps}, 'modifyWebsite') return proc.render() + def modifyWebsiteV2(self, request=None, userID=None, data=None): + currentACL = ACLManager.loadedACL(userID) + + websitesName = ACLManager.findAllSites(currentACL, userID) + phps = PHPManager.findPHPVersions() + proc = httpProc(request, 'websiteFunctions/modifyWebsiteV2.html', + {'websiteList': websitesName, 'phps': phps}, 'modifyWebsite') + return proc.render() + def deleteWebsite(self, request=None, userID=None, data=None): currentACL = ACLManager.loadedACL(userID) websitesName = ACLManager.findAllSites(currentACL, userID) @@ -723,6 +780,13 @@ def deleteWebsite(self, request=None, userID=None, data=None): {'websiteList': websitesName}, 'deleteWebsite') return proc.render() + def deleteWebsiteV2(self, request=None, userID=None, data=None): + currentACL = ACLManager.loadedACL(userID) + websitesName = ACLManager.findAllSites(currentACL, userID) + proc = httpProc(request, 'websiteFunctions/deleteWebsiteV2.html', + {'websiteList': websitesName}, 'deleteWebsite') + return proc.render() + def CreateNewDomain(self, request=None, userID=None, data=None): currentACL = ACLManager.loadedACL(userID) websitesName = ACLManager.findAllSites(currentACL, userID) @@ -780,6 +844,15 @@ def siteState(self, request=None, userID=None, data=None): {'websiteList': websitesName}, 'suspendWebsite') return proc.render() + def siteStateV2(self, request=None, userID=None, data=None): + currentACL = ACLManager.loadedACL(userID) + + websitesName = ACLManager.findAllSites(currentACL, userID) + + proc = httpProc(request, 'websiteFunctions/suspendWebsiteV2.html', + {'websiteList': websitesName}, 'suspendWebsite') + return proc.render() + def listWebsites(self, request=None, userID=None, data=None): currentACL = ACLManager.loadedACL(userID) pagination = self.websitePagination(currentACL, userID)