commit message

This commit is contained in:
Zarak Khan 2023-12-27 19:24:40 +05:00
parent c1ba54372f
commit 4c7935891e
11 changed files with 1147 additions and 18 deletions

View File

@ -333,17 +333,17 @@
Deploy Wordpress</a>
</li>
<li>
<a href="#"
<a href="{% url 'ListWPSitesV2' %}"
class="flex items-center w-full text-base font-normal text-white transition duration-75 rounded-lg group hover:bg-cyan-400 dark:text-white dark:hover:bg-gray-700 pl-11">•
List Wordpress</a>
List Wordpress</>
</li>
<li>
<a href="#"
<a href="{% url 'ConfigurePluginsV2' %}"
class="flex items-center w-full text-base font-normal text-white transition duration-75 rounded-lg group hover:bg-cyan-400 dark:text-white dark:hover:bg-gray-700 pl-11">•
Configure Wordpress</a>
</li>
<li>
<a href="#"
<a href="{% url 'RestoreBackupsV2' %}"
class="flex items-center w-full text-base font-normal text-white transition duration-75 rounded-lg group hover:bg-cyan-400 dark:text-white dark:hover:bg-gray-700 pl-11">•
Restore Backups</a>
</li>
@ -416,12 +416,12 @@
List Websites</a>
</li>
<li>
<a href="{% url 'CreateNewDomainV2' %}"
<a href="{% url 'CreateNewDomainV2' %}"
class="flex items-center w-full text-base font-normal text-white transition duration-75 rounded-lg group hover:bg-cyan-400 dark:text-white dark:hover:bg-gray-700 pl-11">•
Create Sub-Domains</a>
</li>
<li>
<a href="{% url 'listChildDomainsV2' %}"
<a href="{% url 'listChildDomainsV2' %}"
class="flex items-center w-full text-base font-normal text-white transition duration-75 rounded-lg group hover:bg-cyan-400 dark:text-white dark:hover:bg-gray-700 pl-11">•
List Sub-Domains</a>
</li>
@ -431,12 +431,12 @@
Modify Website</a>
</li>
<li>
<a href="{% url 'siteStateV2' %}"
<a href="{% url 'siteStateV2' %}"
class="flex items-center w-full text-base font-normal text-white transition duration-75 rounded-lg group hover:bg-cyan-400 dark:text-white dark:hover:bg-gray-700 pl-11">•
Suspend/Unsuspend</a>
</li>
<li>
<a href="{% url 'deleteWebsiteV2' %}"
<a href="{% url 'deleteWebsiteV2' %}"
class="flex items-center w-full text-base font-normal text-white transition duration-75 rounded-lg group hover:bg-cyan-400 dark:text-white dark:hover:bg-gray-700 pl-11">•
Delete Website</a>
</li>

View File

@ -3155,16 +3155,661 @@ newapp.controller('createWordpressV2', function ($scope, $http, $timeout, $compi
});
newapp.controller('listWebsitesV2', function ($scope, $http) {
$scope.currentPage = 1;
$scope.recordsToShow = 10;
$scope.getFurtherWebsitesFromDB = function () {
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
var data = {
page: $scope.currentPage,
recordsToShow: $scope.recordsToShow
};
dataurl = "/websites/fetchWebsitesList";
$http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
function ListInitialData(response) {
if (response.data.listWebSiteStatus === 1) {
$scope.WebSitesList = JSON.parse(response.data.data);
$scope.pagination = response.data.pagination;
$scope.clients = JSON.parse(response.data.data);
$("#listFail").hide();
} else {
$("#listFail").fadeIn();
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialData(response) {
}
};
$scope.getFurtherWebsitesFromDB();
$scope.cyberPanelLoading = true;
$scope.issueSSL = function (virtualHost) {
$scope.cyberPanelLoading = false;
var url = "/manageSSL/issueSSL";
var data = {
virtualHost: virtualHost
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.cyberPanelLoading = true;
if (response.data.SSL === 1) {
new PNotify({
title: 'Success!',
text: 'SSL successfully issued.',
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.cyberPanelLoading = true;
$scope.searchWebsites = function () {
$scope.cyberPanelLoading = false;
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
var data = {
patternAdded: $scope.patternAdded
};
dataurl = "/websites/searchWebsites";
$http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
function ListInitialData(response) {
$scope.cyberPanelLoading = true;
if (response.data.listWebSiteStatus === 1) {
var finalData = JSON.parse(response.data.data);
$scope.WebSitesList = finalData;
$("#listFail").hide();
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialData(response) {
$scope.cyberPanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Connect disrupted, refresh the page.',
type: 'error'
});
}
};
$scope.ScanWordpressSite = function () {
$('#cyberPanelLoading').show();
var url = "/websites/ScanWordpressSite";
var data = {}
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$('#cyberPanelLoading').hide();
if (response.data.status === 1) {
new PNotify({
title: 'Success!',
text: 'Successfully Saved!.',
type: 'success'
});
location.reload();
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$('#cyberPanelLoading').hide();
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
};
});
app.controller('listWebsites', function ($scope, $http) {
$scope.currentPage = 1;
$scope.recordsToShow = 10;
$scope.getFurtherWebsitesFromDB = function () {
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
var data = {
page: $scope.currentPage,
recordsToShow: $scope.recordsToShow
};
dataurl = "/websites/fetchWebsitesList";
$http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
function ListInitialData(response) {
if (response.data.listWebSiteStatus === 1) {
$scope.WebSitesList = JSON.parse(response.data.data);
$scope.pagination = response.data.pagination;
$scope.clients = JSON.parse(response.data.data);
$("#listFail").hide();
} else {
$("#listFail").fadeIn();
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialData(response) {
}
};
$scope.getFurtherWebsitesFromDB();
$scope.cyberPanelLoading = true;
$scope.issueSSL = function (virtualHost) {
$scope.cyberPanelLoading = false;
var url = "/manageSSL/issueSSL";
var data = {
virtualHost: virtualHost
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.cyberPanelLoading = true;
if (response.data.SSL === 1) {
new PNotify({
title: 'Success!',
text: 'SSL successfully issued.',
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.cyberPanelLoading = true;
$scope.searchWebsites = function () {
$scope.cyberPanelLoading = false;
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
var data = {
patternAdded: $scope.patternAdded
};
dataurl = "/websites/searchWebsites";
$http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
function ListInitialData(response) {
$scope.cyberPanelLoading = true;
if (response.data.listWebSiteStatus === 1) {
var finalData = JSON.parse(response.data.data);
$scope.WebSitesList = finalData;
$("#listFail").hide();
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialData(response) {
$scope.cyberPanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Connect disrupted, refresh the page.',
type: 'error'
});
}
};
$scope.ScanWordpressSite = function () {
$('#cyberPanelLoading').show();
var url = "/websites/ScanWordpressSite";
var data = {}
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$('#cyberPanelLoading').hide();
if (response.data.status === 1) {
new PNotify({
title: 'Success!',
text: 'Successfully Saved!.',
type: 'success'
});
location.reload();
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$('#cyberPanelLoading').hide();
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
};
});
newapp.controller('WPAddNewPluginV2', function ($scope, $http, $timeout, $window, $compile) {
$scope.webSiteCreationLoading = true;
$scope.SearchPluginName = function (val) {
$scope.webSiteCreationLoading = false;
SPVal = val;
url = "/websites/SearchOnkeyupPlugin";
var searchcontent = $scope.searchcontent;
var data = {
pluginname: searchcontent
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.webSiteCreationLoading = true;
if (response.data.status === 1) {
if (SPVal == 'add') {
$('#mysearch').show()
document.getElementById('mysearch').innerHTML = "";
var res = response.data.plugns.plugins
// console.log(res);
for (i = 0; i <= res.length; i++) {
//
var tml = '<option onclick="selectpluginJs(\'' + res[i].slug + '\')" style=" border-bottom: 1px solid rgba(90, 91, 92, 0.5); padding: 5px; " value="' + res[i].slug + '">' + res[i].name + '</option> <br>';
$('#mysearch').append(tml);
}
} else if (SPVal == 'eidt') {
$('#mysearch').show()
document.getElementById('mysearch').innerHTML = "";
var res = response.data.plugns.plugins
// console.log(res);
for (i = 0; i <= res.length; i++) {
//
var tml = '<option ng-click="Addplugin(\'' + res[i].slug + '\')" style=" border-bottom: 1px solid rgba(90, 91, 92, 0.5); padding: 5px; " value="' + res[i].slug + '">' + res[i].name + '</option> <br>';
var temp = $compile(tml)($scope)
angular.element(document.getElementById('mysearch')).append(temp);
}
}
} else {
// $scope.errorMessage = response.data.error_message;
alert("Status not = 1: Error..." + response.data.error_message)
}
}
function cantLoadInitialDatas(response) {
alert("Error..." + response)
}
}
$scope.AddNewplugin = function () {
url = "/websites/AddNewpluginAjax";
var bucketname = $scope.PluginbucketName
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
var data = {
config: arry,
Name: bucketname
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.status === 1) {
new PNotify({
title: 'Success!',
text: 'Bucket created.',
type: 'success'
});
location.reload();
} else {
new PNotify({
title: 'Error!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
alert("Error..." + response)
}
}
$scope.deletesPlgin = function (val) {
url = "/websites/deletesPlgin";
var data = {
pluginname: val,
pluginbBucketID: $('#pluginbID').html()
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.status === 1) {
location.reload();
} else {
// $scope.errorMessage = response.data.error_message;
alert("Status not = 1: Error..." + response.data.error_message)
}
}
function cantLoadInitialDatas(response) {
alert("Error..." + response)
}
}
$scope.Addplugin = function (slug) {
$('#mysearch').hide()
url = "/websites/Addplugineidt";
var data = {
pluginname: slug,
pluginbBucketID: $('#pluginbID').html()
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.status === 1) {
location.reload();
} else {
// $scope.errorMessage = response.data.error_message;
alert("Status not = 1: Error..." + response.data.error_message)
}
}
function cantLoadInitialDatas(response) {
alert("Error..." + response)
}
}
});
function openModal() {
const modal = document.getElementById("myModal");
modal.classList.remove("hidden");
}
function closeModal() {
const modal = document.getElementById("myModal");
modal.classList.add("hidden");
}
document.addEventListener("DOMContentLoaded", function () {
const openModalButton = document.getElementById("openModalButton");
const closeModalButton = document.getElementById("closeModalButton");
openModalButton.addEventListener("click", openModal);
closeModalButton.addEventListener("click", closeModal);
});
// function openModalDelete() {
// document.getElementById('modal').classList.remove('hidden');
// }
// var modal = document.getElementById('popup-modal');
// modal.classList.remove('hidden');
// }
//
// function closeModalDelete() {
// var modal = document.getElementById('popup-modal');
// modal.classList.add('hidden');
// }
//
// document.addEventListener("DOMContentLoaded", function () {
// var deleteButton = document.querySelector('[data-modal-toggle="popup-modal"]');
// var closeButton = document.querySelector('[data-modal-hide="popup-modal"]');
//
// deleteButton.addEventListener("click", openModalDelete);
// closeButton.addEventListener("click", closeModalDelete);
// });
//
//
// function closeModalDelete() {
// document.getElementById('modal').classList.add('hidden');
// }
// function openModal() {
// document.getElementById('settings').classList.remove('hidden');
// }
@ -3172,4 +3817,17 @@ newapp.controller('createWordpressV2', function ($scope, $http, $timeout, $compi
// function closeModal() {
// document.getElementById('settings').classList.add('hidden');
// }
// function openModal() {
// document.getElementById('modal').classList.remove('hidden');
// }
//
// function closeModal() {
// document.getElementById('modal').classList.add('hidden');
// }
//
// function deleteChildDomain() {
// // Implement your delete logic here
// console.log('Deleting child domain...');
// closeModal();
// }

View File

@ -0,0 +1,41 @@
{% extends "baseTemplate/newBase.html" %}
{% load i18n %}
{% block titleNew %}{% trans "Home - CyberPanel" %}{% endblock %}
{% block newContent %}
{% load static %}
<div ng-controller="listWebsitesV2" class="p-8">
<div>
<p class="text-4xl font-bold">Restore Backups</p>
<p class="text-xs text-gray-600 py-2 font-semibold">On this page you can restore,list,modify and
delete backup wordpress sites
from your server</p>
</div>
<div>
<div class="py-4">
{# <p class="text-xl font-bold">Website Details</p>#}
</div>
<hr>
<div>
<div class="flex mt-4 py-2 px-6">
<div>
<p class="font-semibold w-60">Choose Restoring Method</p>
</div>
<div>
<select ng-model="packageForWebsite" class="form-control w-80 bg-gray-100 rounded px-2 py-1">
{% for items in packageList %}
<option>{{ items }}</option>
{% endfor %}
</select>
</div>
</div>
</div>
</div>
<div class="flex justify-center mt-3">
<button ng-click="goBack()" class="bg-orange-500 px-3 py-4 rounded-lg text-xl font-semibold text-white">
Restore Backup Now
</button>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,50 @@
{% extends "baseTemplate/newBase.html" %}
{% load i18n %}
{% block titleNew %}{% trans "Home - CyberPanel" %}{% endblock %}
{% block newContent %}
{% load static %}
<div ng-controller="WPAddNewPluginV2" class="p-8">
<div class="flex lg:flex-row justify-between items-center sm:flex-col mb-5">
<div>
<p class="text-4xl font-bold">Add New Plugin</p>
</div>
</div>
<hr>
<div>
<div class="flex mt-4 py-2 px-6">
<div>
<p class="font-semibold w-48">Plugin Bucket Name</p>
</div>
<div>
<input name="PluginbucketName" type="text" class="form-control w-80 bg-gray-100 rounded px-2 py-1"
ng-model="PluginbucketName"
required>
</div>
</div>
<div class="flex py-2 px-6">
<div>
<p class="font-semibold w-48">Select Plugin Name</p>
</div>
<div>
<input name="searchcontent" type="text" class="form-control w-80 bg-gray-100 rounded px-2 py-1"
ng-model="searchcontent"
ng-keyup="$event.keyCode == 13 ? SearchPluginName('add') : null"
placeholder="{% trans "Search Plugin...." %}" required>
</div>
</div>
</div>
<div class="py-4 px-6 mt-3">
<p class="text-gray-500 font-bold">Selected Plugin</p>
</div>
<hr>
<div class="flex justify-center mt-3">
<button ng-disabled="websiteCreationForm.dom.$error.required || websiteCreationForm.email.$invalid"
ng-click="AddNewplugin()"
class="bg-orange-500 px-3 py-4 rounded-lg text-xl font-semibold text-white">
Add Plugin Bucket
</button>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,51 @@
{% extends "baseTemplate/newBase.html" %}
{% load i18n %}
{% block titleNew %}{% trans "Home - CyberPanel" %}{% endblock %}
{% block newContent %}
{% load static %}
<div ng-controller="listTableUsersV2" class="p-8">
<div class="flex lg:flex-row justify-between items-center sm:flex-col">
<div>
<p class="text-4xl font-bold">Configure Plugin</p>
<p class="text-xs text-gray-600 py-2 font-semibold">You can configure list of plugins that will
automatically get installed while deploying WordPress.</p>
</div>
<div>
<div class="sm:mt-6">
<a href="{% url 'AddnewpluginV2' %}"
class="bg-orange-500 px-3 py-3 rounded-lg text-xl font-semibold text-white">Create
New Bucket
</a>
</div>
</div>
</div>
<div>
<div class="py-4">
<p class="text-xl font-bold">Plugin Buckets</p>
</div>
<hr>
</div>
<div class="mt-4">
<div>
<div class="flex gap-4">
<div class="w-80 bg-gray-100 rounded px-4 py-1">ID</div>
<div class="w-80 bg-gray-100 rounded px-4 py-1">File Name</div>
<div class="w-80 bg-gray-100 rounded px-4 py-1">Action</div>
</div>
{% for sub in Selectedplugins %}
<div class="flex gap-4 mt-3">
<div class="w-80 px-4 py-1">{{ sub.id }}</div>
<div class="w-80 px-4 py-1">{{ sub.Name }}</div>
<div class="w-80 px-4 py-1">
<a href="{% url 'EidtPluginV2' %}?ID={{ sub.id }}"><button class="bg-orange-500 hover:bg-orange-700 text-white font-bold py-1 px-4 rounded">EDIT</button></a>
<button onclick="DeletePluginBuucket('{% url 'ConfigurePlugins' %}?delete={{ sub.id }}')" class="bg-red-500 hover:bg-red-700 text-white font-bold py-1 px-4 rounded">DELETE</button>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>

View File

@ -0,0 +1,110 @@
{% extends "baseTemplate/newBase.html" %}
{% load i18n %}
{% block titleNew %}{% trans "Home - CyberPanel" %}{% endblock %}
{% block newContent %}
{% load static %}
<div ng-controller="listWebsitesV2" class="p-8">
<div class="flex lg:flex-row justify-between items-center sm:flex-col">
<div>
<p class="text-4xl font-bold">List Wordpress Website</p>
<p class="text-xs text-gray-600 py-2 font-semibold">On this page you can launch,list,modify and
delete wordpress sites
from your server</p>
</div>
</div>
<div class="py-8 overflow-x-auto">
<div class="px-5">
<table>
<thead>
<div>
<tr>
<th class="w-72 text-xl">Wordpress Site Title</th>
<th class="w-52 text-xl">Login</th>
<th class="w-52 text-xl">Domain</th>
<th class="w-52 text-xl">Action</th>
</tr>
</div>
</thead>
</table>
</div>
<div class="border shadow-lg rounded-lg px-3 mt-5">
<div class="px-2">
<div class="py-3 mb-3 rounded-b-lg">
<table>
<tbody>
<div>
{% for sub in wpsite %}
<tr>
<th class="w-72 pt-2 font-semibold text-sm"><a
href="{% url 'WPHome' %}?ID={{ sub.id }}">
<p style="font-weight: bold; text-transform: uppercase; ">{{ sub.title }}</p>
</a>
</th>
<th class="w-52 pt-2 font-semibold text-sm flex justify-center">
<a title="Auto Login"
style="margin-right: 2%; margin-left: 10px;"
target="_blank"
href="{% url 'AutoLogin' %}?id={{ sub.id }}">
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img"
width="20"
style="margin: 3px;" height="20"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 16 16">
<g fill="#006600">
<path d="M12.633 7.653c0-.848-.305-1.435-.566-1.892l-.08-.13c-.317-.51-.594-.958-.594-1.48c0-.63.478-1.218 1.152-1.218c.02 0 .039.002.058.003l.031.003A6.838 6.838 0 0 0 8 1.137A6.855 6.855 0 0 0 2.266 4.23c.16.005.313.009.442.009c.717 0 1.828-.087 1.828-.087c.37-.022.414.521.044.565c0 0-.371.044-.785.065l2.5 7.434l1.5-4.506l-1.07-2.929c-.369-.022-.719-.065-.719-.065c-.37-.022-.326-.588.043-.566c0 0 1.134.087 1.808.087c.718 0 1.83-.087 1.83-.087c.37-.022.413.522.043.566c0 0-.372.043-.785.065l2.48 7.377l.684-2.287l.054-.173c.27-.86.469-1.495.469-2.046zM1.137 8a6.864 6.864 0 0 0 3.868 6.176L1.73 5.206A6.837 6.837 0 0 0 1.137 8z"></path>
<path d="M6.061 14.583L8.121 8.6l2.109 5.78c.014.033.03.064.049.094a6.854 6.854 0 0 1-4.218.109zm7.96-9.876c.03.219.047.453.047.706c0 .696-.13 1.479-.522 2.458l-2.096 6.06a6.86 6.86 0 0 0 2.572-9.224z"></path>
<path fill-rule="evenodd"
d="M0 8c0-4.411 3.589-8 8-8c4.41 0 8 3.589 8 8s-3.59 8-8 8c-4.411 0-8-3.589-8-8zm.367 0c0 4.209 3.424 7.633 7.633 7.633c4.208 0 7.632-3.424 7.632-7.633C15.632 3.79 12.208.367 8 .367C3.79.367.367 3.79.367 8z"></path>
</g>
</svg>
</a>
</th>
<th class="w-52 pt-2 font-semibold text-sm"><a target="_blank"
style="color: #6aa7ff"
href="http://{{ sub.url }}">Visit
<i class="glyph-icon icon-external-link-square"
title="{{ sub.url }}"></i></a>
</th>
<th class="w-52 pt-2 font-semibold text-sm">
<div class="flex items-center justify-center">
<button id="openModalButton"
onclick="DeleteWPNow('{% url 'ListWPSites' %}?DeleteID={{ sub.id }}')"
class="bg-orange-500 hover:bg-orange-700 text-white font-bold py-2 px-4 rounded">
Delete
</button>
<div id="myModal" class="fixed inset-0 bg-black bg-opacity-50 hidden">
<div class="flex items-center justify-center h-full">
<div class="bg-white p-8 rounded max-w-md">
<h2 class="text-lg font-bold mb-4">Delete WordPress
Site</h2>
<p>Do You want to delete this site ?</p>
<button onclick="FinalDeleteWPNow()"
class="mt-4 bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded">
Delete
</button>
<button id="closeModalButton"
class="mt-4 bg-gray-500 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded">
Cancel
</button>
</div>
</div>
</div>
</div>
</th>
</tr>
{% endfor %}
</div>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -193,8 +193,8 @@
<div class="col-md-4 content-box-header">
<i class="p fa fa-arrows-h btn-icon text-muted" data-toggle="tooltip"
data-placement="right" title="Delete">&emsp;</i>
<span>
<a onclick="openModal()" href="#" style="text-transform: none">Delete</a>
<span><a onclick="openModal()" href="#"
style="text-transform: none">Delete</a>
<!-- Modal -->
<div id="modal"

View File

@ -24,8 +24,10 @@ urlpatterns = [
url(r'^createWordpress$', views.WPCreate, name='createWordpress'),
url(r'^createWordpressV2$', views.WPCreateV2, name='createWordpressV2'),
url(r'^ListWPSites$', views.ListWPSites, name='ListWPSites'),
url(r'^ListWPSitesV2$', views.ListWPSitesV2, name='ListWPSitesV2'),
url(r'^WPHome$', views.WPHome, name='WPHome'),
url(r'^RestoreBackups$', views.RestoreBackups, name='RestoreBackups'),
url(r'^RestoreBackupsV2$', views.RestoreBackupsV2, name='RestoreBackupsV2'),
url(r'^RestoreHome$', views.RestoreHome, name='RestoreHome'),
url(r'^AutoLogin$', views.AutoLogin, name='AutoLogin'),
url(r'^RemoteBackupConfig$', views.RemoteBackupConfig, name='RemoteBackupConfig'),
@ -62,8 +64,11 @@ urlpatterns = [
#### AddPlugin
url(r'^ConfigurePlugins$', views.ConfigurePlugins, name='ConfigurePlugins'),
url(r'^ConfigurePluginsV2$', views.ConfigurePluginsV2, name='ConfigurePluginsV2'),
url(r'^Addnewplugin$', views.Addnewplugin, name='Addnewplugin'),
url(r'^AddnewpluginV2$', views.AddnewpluginV2, name='AddnewpluginV2'),
url(r'^EidtPlugin$', views.EidtPlugin, name='EidtPlugin'),
url(r'^EidtPluginV2$', views.EidtPluginV2, name='EidtPluginV2'),
## AddPlugin Ajax
url(r'^SearchOnkeyupPlugin$', views.SearchOnkeyupPlugin, name='SearchOnkeyupPlugin'),

View File

@ -65,7 +65,14 @@ def ListWPSites(request):
return wm.ListWPSites(request, userID, DeleteID)
except KeyError:
return redirect(loadLoginPage)
def ListWPSitesV2(request):
try:
userID = request.session['userID']
DeleteID = request.GET.get('DeleteID')
wm = WebsiteManager()
return wm.ListWPSitesV2(request, userID, DeleteID)
except KeyError:
return redirect(loadLoginPage)
def WPHome(request):
try:
@ -144,6 +151,16 @@ def RestoreBackups(request):
except KeyError:
return redirect(loadLoginPage)
def RestoreBackupsV2(request):
try:
userID = request.session['userID']
DeleteID = request.GET.get('DeleteID')
wm = WebsiteManager()
return wm.RestoreBackupsV2(request, userID, DeleteID)
except KeyError:
return redirect(loadLoginPage)
def AutoLogin(request):
try:
@ -173,6 +190,24 @@ def ConfigurePlugins(request):
except KeyError:
return redirect(loadLoginPage)
def ConfigurePluginsV2(request):
try:
userID = request.session['userID']
userobj = Administrator.objects.get(pk=userID)
DeleteFileID = request.GET.get('delete', None)
if DeleteFileID != None:
try:
jobobj = wpplugins.objects.get(pk=DeleteFileID, owner=userobj)
jobobj.delete()
Deleted = 1
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile("DeleteFileID ....... %s....msg.....%s" % (DeleteFileID, msg))
Deleted = 0
wm = WebsiteManager()
return wm.ConfigurePluginsV2(request, userID)
except KeyError:
return redirect(loadLoginPage)
def Addnewplugin(request):
try:
@ -182,6 +217,15 @@ def Addnewplugin(request):
except KeyError:
return redirect(loadLoginPage)
def AddnewpluginV2(request):
try:
userID = request.session['userID']
wm = WebsiteManager()
return wm.AddnewpluginV2(request, userID)
except KeyError:
return redirect(loadLoginPage)
def SearchOnkeyupPlugin(request):
try:
@ -237,6 +281,16 @@ def EidtPlugin(request):
except KeyError:
return redirect(loadLoginPage)
def EidtPluginV2(request):
try:
userID = request.session['userID']
pluginbID = request.GET.get('ID')
wm = WebsiteManager()
return wm.EidtPluginV2(request, userID, pluginbID)
except KeyError:
return redirect(loadLoginPage)
def deletesPlgin(request):
try:

View File

@ -238,6 +238,35 @@ class WebsiteManager:
{"wpsite": tata['wpsites']})
return proc.render()
def ListWPSitesV2(self, request=None, userID=None, DeleteID=None):
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
tata = {}
tata['wp'] = []
tata['wpsites'] = []
tata['wp'] = ACLManager.GetALLWPObjects(currentACL, userID)
try:
if DeleteID != None:
WPDelete = WPSites.objects.get(pk=DeleteID)
if ACLManager.checkOwnership(WPDelete.owner.domain, admin, currentACL) == 1:
WPDelete.delete()
except BaseException as msg:
pass
for sub in tata['wp']:
tata['wpsites'].append({'id': sub.id,
'title': sub.title,
'url': sub.FinalURL
})
proc = httpProc(request, 'websiteFunctions/WPsitesListV2.html',
{"wpsite": tata['wpsites']})
return proc.render()
def WPHome(self, request=None, userID=None, WPid=None, DeleteID=None):
Data = {}
currentACL = ACLManager.loadedACL(userID)
@ -513,6 +542,75 @@ class WebsiteManager:
from django.shortcuts import reverse
return redirect(reverse('pricing'))
def RestoreBackupsV2(self, request=None, userID=None, DeleteID=None):
Data = {}
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
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:
backobj = WPSitesBackup.objects.filter(owner=admin).order_by('-id')
if ACLManager.CheckIPBackupObjectOwner(currentACL, backobj, admin) == 1:
pass
else:
return ACLManager.loadError()
try:
if DeleteID != None:
DeleteIDobj = WPSitesBackup.objects.get(pk=DeleteID)
if ACLManager.CheckIPBackupObjectOwner(currentACL, DeleteIDobj, admin) == 1:
config = DeleteIDobj.config
conf = json.loads(config)
FileName = conf['name']
command = "rm -r /home/backup/%s.tar.gz" % FileName
ProcessUtilities.executioner(command)
DeleteIDobj.delete()
except BaseException as msg:
pass
Data['job'] = []
for sub in backobj:
try:
wpsite = WPSites.objects.get(pk=sub.WPSiteID)
web = wpsite.title
except:
web = "Website Not Found"
try:
config = sub.config
conf = json.loads(config)
Backuptype = conf['Backuptype']
BackupDestination = conf['BackupDestination']
except:
Backuptype = "Backup type not exists"
Data['job'].append({
'id': sub.id,
'title': web,
'Backuptype': Backuptype,
'BackupDestination': BackupDestination
})
proc = httpProc(request, 'websiteFunctions/RestoreBackupsV2.html',
Data, 'createWebsite')
return proc.render()
else:
from django.shortcuts import reverse
return redirect(reverse('pricing'))
def AutoLogin(self, request=None, userID=None):
WPid = request.GET.get('id')
@ -589,6 +687,23 @@ class WebsiteManager:
from django.shortcuts import reverse
return redirect(reverse('pricing'))
def ConfigurePluginsV2(self, request=None, userID=None, data=None):
if ACLManager.CheckForPremFeature('wp-manager'):
currentACL = ACLManager.loadedACL(userID)
userobj = Administrator.objects.get(pk=userID)
Selectedplugins = wpplugins.objects.filter(owner=userobj)
# data['Selectedplugins'] = wpplugins.objects.filter(ProjectOwner=HostingCompany)
Data = {'Selectedplugins': Selectedplugins, }
proc = httpProc(request, 'websiteFunctions/WPConfigurePluginsV2.html',
Data, 'createWebsite')
return proc.render()
else:
from django.shortcuts import reverse
return redirect(reverse('pricing'))
def Addnewplugin(self, request=None, userID=None, data=None):
from django.shortcuts import reverse
if ACLManager.CheckForPremFeature('wp-manager'):
@ -604,6 +719,21 @@ class WebsiteManager:
return redirect(reverse('pricing'))
def AddnewpluginV2(self, request=None, userID=None, data=None):
from django.shortcuts import reverse
if ACLManager.CheckForPremFeature('wp-manager'):
currentACL = ACLManager.loadedACL(userID)
adminNames = ACLManager.loadAllUsers(userID)
packagesName = ACLManager.loadPackages(userID, currentACL)
phps = PHPManager.findPHPVersions()
Data = {'packageList': packagesName, "owernList": adminNames, 'phps': phps}
proc = httpProc(request, 'websiteFunctions/WPAddNewPluginV2.html',
Data, 'createWebsite')
return proc.render()
return redirect(reverse('pricing'))
def SearchOnkeyupPlugin(self, userID=None, data=None):
try:
if ACLManager.CheckForPremFeature('wp-manager'):
@ -680,6 +810,26 @@ class WebsiteManager:
Data, 'createWebsite')
return proc.render()
def EidtPluginV2(self, request=None, userID=None, pluginbID=None):
Data = {}
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
pluginobj = wpplugins.objects.get(pk=pluginbID)
if ACLManager.CheckIPPluginObjectOwner(currentACL, pluginobj, admin) == 1:
pass
else:
return ACLManager.loadError()
lmo = json.loads(pluginobj.config)
Data['Selectedplugins'] = lmo
Data['pluginbID'] = pluginbID
Data['BucketName'] = pluginobj.Name
proc = httpProc(request, 'websiteFunctions/WPEditPluginV2.html',
Data, 'createWebsite')
return proc.render()
def deletesPlgin(self, userID=None, data=None, ):
try:
currentACL = ACLManager.loadedACL(userID)