diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js index 35401ce35..f3cec616b 100755 --- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js +++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js @@ -18,6 +18,7 @@ function getCookie(name) { return cookieValue; } + var arry = [] function selectpluginJs(val) { @@ -252,6 +253,28 @@ app.controller('WPAddNewPlugin', function ($scope, $http, $timeout, $window, $co }); +var domain_check = 0; + +function checkbox_function() { + + var checkBox = document.getElementById("myCheck"); + // Get the output text + + + // If the checkbox is checked, display the output text + if (checkBox.checked == true) { + domain_check = 0; + document.getElementById('Test_Domain').style.display= "block"; + document.getElementById('Own_Domain').style.display = "none"; + + } else { + document.getElementById('Test_Domain').style.display = "none"; + document.getElementById('Own_Domain').style.display = "block"; + domain_check = 1; + } + + // alert(domain_check); +} app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $window) { $scope.webSiteCreationLoading = true; @@ -262,6 +285,7 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $ $scope.couldNotConnect = true; $scope.goBackDisable = true; + var statusFile; $scope.createWordPresssite = function () { @@ -280,7 +304,17 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $ var package = $scope.packageForWebsite; var websiteOwner = $scope.websiteOwner; var WPtitle = $scope.WPtitle; - var domainNameCreate = $scope.domainNameCreate; + + if (domain_check == 0) { + var Part2_domainNameCreate = document.getElementById('Part2_domainNameCreate').value; + var domainNameCreate = document.getElementById('TestDomainNameCreate').value + Part2_domainNameCreate; + } + if (domain_check == 1) { + + var domainNameCreate = $scope.own_domainNameCreate; + } + + var WPUsername = $scope.WPUsername; var adminEmail = $scope.adminEmail; var WPPassword = $scope.WPPassword; @@ -290,7 +324,17 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $ var pluginupdates = $scope.pluginupdates; var themeupdates = $scope.themeupdates; - var path = $scope.installPath; + if (domain_check == 0) { + + var path = ""; + + } + if (domain_check = 1) { + + var path = $scope.installPath; + + } + var home = "1"; @@ -298,6 +342,7 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $ home = "0"; } + alert(domainNameCreate); var data = { title: WPtitle, @@ -315,6 +360,7 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $ home: home, path: path, } + var config = { headers: { 'X-CSRFToken': getCookie('csrftoken') @@ -2278,6 +2324,29 @@ app.controller('BackupSchedule', function ($scope, $http, $timeout, $window) { }; }); /* Java script code to create account */ + +var website_create_domain_check = 0; + +function website_create_checkbox_function() { + + var checkBox = document.getElementById("myCheck"); + // Get the output text + + + // If the checkbox is checked, display the output text + if (checkBox.checked == true) { + website_create_domain_check = 0; + document.getElementById('Website_Create_Test_Domain').style.display= "block"; + document.getElementById('Website_Create_Own_Domain').style.display = "none"; + + } else { + document.getElementById('Website_Create_Test_Domain').style.display = "none"; + document.getElementById('Website_Create_Own_Domain').style.display = "block"; + website_create_domain_check = 1; + } + + // alert(domain_check); +} app.controller('createWebsite', function ($scope, $http, $timeout, $window) { $scope.webSiteCreationLoading = true; @@ -2332,7 +2401,18 @@ app.controller('createWebsite', function ($scope, $http, $timeout, $window) { url = "/websites/submitWebsiteCreation"; var package = $scope.packageForWebsite; - var domainName = $scope.domainNameCreate; + + if (website_create_domain_check == 0) { + var Part2_domainNameCreate = document.getElementById('Part2_domainNameCreate').value; + var domainName = document.getElementById('TestDomainNameCreate').value + Part2_domainNameCreate; + } + if (website_create_domain_check == 1) { + + var domainName = $scope.own_domainNameCreate; + } + + // var domainName = $scope.domainNameCreate; + var adminEmail = $scope.adminEmail; var phpSelection = $scope.phpSelection; var websiteOwner = $scope.websiteOwner; @@ -2647,9 +2727,7 @@ app.controller('listWebsites', function ($scope, $http) { var url = "/websites/ScanWordpressSite"; - var data = { - - } + var data = {} var config = { @@ -5084,7 +5162,7 @@ RewriteRule ^/(xmlrpc|wp-trackback)\.php - [F,L,NC] $scope.rewriteRules = nonWWWToWWW + $scope.rewriteRules; } else if ($scope.rewriteTemplate === "Force WWW -> NON-WWW") { $scope.rewriteRules = WWWToNonWWW + $scope.rewriteRules; - } else if ($scope.rewriteTemplate === "Disable Wordpress XMLRPC & Trackback") { + } else if ($scope.rewriteTemplate === "Disable Wordpress XMLRPC & Trackback") { $scope.rewriteRules = WordpressProtect + $scope.rewriteRules; } }; diff --git a/websiteFunctions/templates/websiteFunctions/WPCreate.html b/websiteFunctions/templates/websiteFunctions/WPCreate.html index fe6c8e6ba..4fe5f52cc 100644 --- a/websiteFunctions/templates/websiteFunctions/WPCreate.html +++ b/websiteFunctions/templates/websiteFunctions/WPCreate.html @@ -6,6 +6,61 @@ {% load static %} {% get_current_language as LANGUAGE_CODE %} +
@@ -14,6 +69,7 @@
+

@@ -54,40 +110,92 @@

-{#
#} -{# #} -{#
#} -{# #} -{#
#} -{#
{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}
#} -{#
#} + {#
#} + {# #} + {#
#} + {# #} + {#
#} + {#
{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}
#} + {#
#} + + {# My Work #}
- -
-
+ + +

+ + +
+
+ +
+
- - / - + + + + +
+
+
{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}
+
+
+
Looks like you have not subscripted to temporary domain feature,click here + for more details. +
+
+
+ + -
{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}
+
- - + {# My Work End#} + {# #}
diff --git a/websiteFunctions/templates/websiteFunctions/createWebsite.html b/websiteFunctions/templates/websiteFunctions/createWebsite.html index 5c6403205..4d008084e 100755 --- a/websiteFunctions/templates/websiteFunctions/createWebsite.html +++ b/websiteFunctions/templates/websiteFunctions/createWebsite.html @@ -6,6 +6,61 @@ {% load static %} {% get_current_language as LANGUAGE_CODE %} +
@@ -14,6 +69,7 @@
+

@@ -47,15 +103,77 @@

+ {# My Work #}
- -
- + + +

+ + +
+
+ +
+
+ + + + + +
+
+
{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}
+
+
+
Looks like you have not subscripted to temporary domain feature, click here + for more details. +
+
-
{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}
+ + +
+ {# My Work End#} + {# #}
diff --git a/websiteFunctions/views.py b/websiteFunctions/views.py index e188f09ce..13a3214b0 100755 --- a/websiteFunctions/views.py +++ b/websiteFunctions/views.py @@ -33,7 +33,7 @@ def WPCreate(request): try: userID = request.session['userID'] wm = WebsiteManager() - return wm.WPCreate(request, userID) + return wm.WPCreate(request, userID,) except KeyError: return redirect(loadLoginPage) diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 62e8558e8..74e5e6d76 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -52,12 +52,25 @@ class WebsiteManager: self.childDomain = childDomain def createWebsite(self, request=None, userID=None, data=None): + url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission" + + test_domain_data = { + "name": "test-domain", + "IP": ACLManager.GetServerIP(), + } + + import requests + response = requests.post(url, data=json.dumps(test_domain_data)) + test_domain_status = response.json()['status'] + currentACL = ACLManager.loadedACL(userID) adminNames = ACLManager.loadAllUsers(userID) packagesName = ACLManager.loadPackages(userID, currentACL) phps = PHPManager.findPHPVersions() - Data = {'packageList': packagesName, "owernList": adminNames, 'phps': phps} + rnpss = randomPassword.generate_pass(10) + + Data = {'packageList': packagesName, "owernList": adminNames, 'phps': phps,'Randam_String': rnpss.lower(), 'test_domain_data': test_domain_status} proc = httpProc(request, 'websiteFunctions/createWebsite.html', Data, 'createWebsite') return proc.render() @@ -68,6 +81,17 @@ class WebsiteManager: "name": "wp-manager", "IP": ACLManager.GetServerIP() } + test_domain_data = { + "name": "test-domain", + "IP": ACLManager.GetServerIP(), + } + + import requests + response = requests.post(url, data=json.dumps(test_domain_data)) + test_domain_status = response.json()['status'] + + + import requests response = requests.post(url, data=json.dumps(data)) @@ -94,8 +118,9 @@ class WebsiteManager: FinalVersions = ['5.6', '5.5.3', '5.5.2'] Plugins = wpplugins.objects.filter(owner=userobj) + rnpss = randomPassword.generate_pass(10) - Data = {'packageList': packagesName, "owernList": adminNames, 'WPVersions': FinalVersions, 'Plugins': Plugins } + Data = {'packageList': packagesName, "owernList": adminNames, 'WPVersions': FinalVersions, 'Plugins': Plugins,'Randam_String': rnpss.lower(), 'test_domain_data': test_domain_status} proc = httpProc(request, 'websiteFunctions/WPCreate.html', Data, 'createWebsite') return proc.render() @@ -1419,7 +1444,7 @@ class WebsiteManager: wpobj.save() - + data_ret = {'status': 1, 'error_message': 'None',} json_data = json.dumps(data_ret) @@ -2021,6 +2046,27 @@ class WebsiteManager: admin = Administrator.objects.get(pk=userID) + + if data['domain'].find("cyberpanel.website") > -1: + url = "https://platform.cyberpersons.com/CyberpanelAdOns/CreateDomain" + + domain_data = { + "name": "test-domain", + "IP": ACLManager.GetServerIP(), + "domain": data['domain'] + } + + import requests + response = requests.post(url, data=json.dumps(domain_data)) + domain_status = response.json()['status'] + + if domain_status == 0: + data_ret = {'status': 0, 'installStatus': 0, 'error_message': response.json()['error_message']} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + + + extraArgs = {} extraArgs['currentACL'] = currentACL extraArgs['adminID'] = admin.pk @@ -2075,6 +2121,24 @@ class WebsiteManager: packageName = data['package'] websiteOwner = data['websiteOwner'].lower() + if data['domainName'].find("cyberpanel.website") > -1: + url = "https://platform.cyberpersons.com/CyberpanelAdOns/CreateDomain" + + domain_data = { + "name": "test-domain", + "IP": ACLManager.GetServerIP(), + "domain": data['domainName'] + } + + import requests + response = requests.post(url, data=json.dumps(domain_data)) + domain_status = response.json()['status'] + + if domain_status == 0: + data_ret = {'status': 0, 'installStatus': 0, 'error_message': response.json()['error_message']} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + loggedUser = Administrator.objects.get(pk=userID) newOwner = Administrator.objects.get(userName=websiteOwner) @@ -2433,6 +2497,18 @@ class WebsiteManager: def submitWebsiteDeletion(self, userID=None, data=None): try: + if data['websiteName'].find("cyberpanel.website") > -1: + url = "https://platform.cyberpersons.com/CyberpanelAdOns/DeleteDomain" + + domain_data = { + "name": "test-domain", + "IP": ACLManager.GetServerIP(), + "domain": data['websiteName'] + } + + import requests + response = requests.post(url, data=json.dumps(domain_data)) + currentACL = ACLManager.loadedACL(userID) if ACLManager.currentContextPermission(currentACL, 'deleteWebsite') == 0: @@ -2464,10 +2540,25 @@ class WebsiteManager: def submitDomainDeletion(self, userID=None, data=None): try: + if data['websiteName'].find("cyberpanel.website") > -1: + url = "https://platform.cyberpersons.com/CyberpanelAdOns/DeleteDomain" + + domain_data = { + "name": "test-domain", + "IP": ACLManager.GetServerIP(), + "domain": data['websiteName'] + } + + import requests + response = requests.post(url, data=json.dumps(domain_data)) + currentACL = ACLManager.loadedACL(userID) admin = Administrator.objects.get(pk=userID) websiteName = data['websiteName'] + + + try: DeleteDocRoot = int(data['DeleteDocRoot']) except: