mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-10 07:16:15 +01:00
wphomechanges1
This commit is contained in:
@@ -463,6 +463,8 @@ function DeployToProductionInitial(vall) {
|
||||
|
||||
app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $window) {
|
||||
|
||||
var CheckBoxpasssword = 0;
|
||||
|
||||
$scope.wordpresshomeloading = true;
|
||||
$scope.stagingDetailsForm = false;
|
||||
$scope.installationProgress = true;
|
||||
@@ -519,6 +521,29 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
|
||||
if (response.data.ret_data.maintenanceMode === 1) {
|
||||
$('#maintenanceMode').prop('checked', true);
|
||||
}
|
||||
if(response.data.ret_data.wpcron === 1) {
|
||||
$('#wpcron').prop('checked', true);
|
||||
}
|
||||
if (response.data.ret_data.passwordprotection == 1) {
|
||||
|
||||
var dc = '<input type="checkbox" checked \n' +
|
||||
' ng-click="UpdateWPSettings(\'PasswordProtection\')" class="custom-control-input ng-pristine ng-untouched ng-valid ng-not-empty"\n' +
|
||||
' id="passwdprotection">\n' +
|
||||
' <label class="custom-control-label"\n' +
|
||||
' for="passwdprotection"></label>'
|
||||
var mp = $compile(dc)($scope);
|
||||
angular.element(document.getElementById('prsswdprodata')).append(mp);
|
||||
CheckBoxpasssword = 1;
|
||||
} else if (response.data.ret_data.passwordprotection == 0) {
|
||||
var dc = '<input type="checkbox" data-toggle="modal"\n' +
|
||||
' data-target="#Passwordprotection"\n' +
|
||||
' class="custom-control-input ng-pristine ng-untouched ng-valid ng-not-empty"\n' +
|
||||
' id="passwdprotection">\n' +
|
||||
' <label class="custom-control-label"\n' +
|
||||
' for="passwdprotection"></label>'
|
||||
$('#prsswdprodata').append(dc);
|
||||
CheckBoxpasssword = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
new PNotify({
|
||||
@@ -550,17 +575,31 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
|
||||
$scope.UpdateWPSettings = function (setting) {
|
||||
|
||||
$scope.wordpresshomeloading = false;
|
||||
$('#wordpresshomeloading').show();
|
||||
|
||||
|
||||
var url = "/websites/UpdateWPSettings";
|
||||
|
||||
if (setting === "PasswordProtection") {
|
||||
if (CheckBoxpasssword == 0) {
|
||||
var data = {
|
||||
WPid: $('#WPid').html(),
|
||||
setting: setting,
|
||||
PPUsername: $scope.PPUsername,
|
||||
PPPassword: $scope.PPPassword,
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
var data = {
|
||||
WPid: $('#WPid').html(),
|
||||
setting: setting,
|
||||
PPUsername: '',
|
||||
PPPassword: '',
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
var settingValue = 0;
|
||||
if ($('#' + setting).is(":checked")) {
|
||||
@@ -586,6 +625,7 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
$scope.wordpresshomeloading = true;
|
||||
$('#wordpresshomeloading').hide();
|
||||
|
||||
if (response.data.status === 1) {
|
||||
new PNotify({
|
||||
@@ -605,6 +645,7 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$('#wordpresshomeloading').hide();
|
||||
$scope.wordpresshomeloading = true;
|
||||
alert(response)
|
||||
|
||||
@@ -1524,6 +1565,7 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
|
||||
$scope.installwpcore = function () {
|
||||
|
||||
$('#wordpresshomeloading').show();
|
||||
$('#wordpresshomeloadingsec').show();
|
||||
var data = {
|
||||
WPid: $('#WPid').html(),
|
||||
}
|
||||
@@ -1544,6 +1586,7 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
$('#wordpresshomeloading').hide();
|
||||
$('#wordpresshomeloadingsec').hide();
|
||||
$scope.wordpresshomeloading = true;
|
||||
|
||||
if (response.data.status === 1) {
|
||||
@@ -1565,6 +1608,7 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$('#wordpresshomeloading').hide();
|
||||
$('#wordpresshomeloadingsec').hide();
|
||||
$scope.wordpresshomeloading = true;
|
||||
alert(response)
|
||||
|
||||
@@ -1575,6 +1619,7 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
|
||||
$scope.dataintegrity = function () {
|
||||
|
||||
$('#wordpresshomeloading').show();
|
||||
$('#wordpresshomeloadingsec').show();
|
||||
var data = {
|
||||
WPid: $('#WPid').html(),
|
||||
}
|
||||
@@ -1595,6 +1640,7 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
$('#wordpresshomeloading').hide();
|
||||
$('#wordpresshomeloadingsec').hide();
|
||||
$scope.wordpresshomeloading = true;
|
||||
|
||||
if (response.data.status === 1) {
|
||||
@@ -1616,6 +1662,7 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$('#wordpresshomeloading').hide();
|
||||
$('#wordpresshomeloadingsec').hide();
|
||||
$scope.wordpresshomeloading = true;
|
||||
alert(response)
|
||||
|
||||
|
||||
@@ -130,63 +130,15 @@
|
||||
for="lscache"></label>
|
||||
</div>
|
||||
</div>
|
||||
<span style="display: none" id="#checkjq"></span>
|
||||
<div class="col-md-3">
|
||||
<h6 style="font-weight: bold">Password Protection</h6>
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="radio" data-toggle="modal"
|
||||
data-target="#Passwordprotection"
|
||||
class="custom-control-input ng-pristine ng-untouched ng-valid ng-not-empty"
|
||||
id="passwdprotection">
|
||||
<label class="custom-control-label"
|
||||
for="passwdprotection"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!------------------MOdael for passwd protection-------->
|
||||
<div id="Passwordprotection" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×
|
||||
</button>
|
||||
<h4 class="modal-title">Delete WordPress Site
|
||||
<img ng-hide="$parent.cyberPanelLoading"
|
||||
src="/static/images/loading.gif"
|
||||
style="display: none;">
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body" style="height: 100px;">
|
||||
|
||||
<div>
|
||||
<label class="col-sm-4">Username</label>
|
||||
<input ng-model="$parent.PPUsername" required class="col-lg-8"
|
||||
type="text" placeholder="Username">
|
||||
<div class="custom-control custom-switch" id="prsswdprodata">
|
||||
|
||||
</div>
|
||||
<div style="margin-top: 36px;">
|
||||
<label class="col-sm-4">Password</label>
|
||||
<input ng-model="$parent.PPPassword" required class="col-lg-8"
|
||||
type="password" placeholder="*******************">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary"
|
||||
ng-click="UpdateWPSettings('PasswordProtection')">Yes
|
||||
</button>
|
||||
<button type="button" ng-disabled="savingSettings"
|
||||
class="btn btn-default" data-dismiss="modal">
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!------------------End MOdael for passwd protection-------->
|
||||
<div style="margin-top: 4%">
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
@@ -223,14 +175,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<h6 style="font-weight: bold"> WP Corn</h6>
|
||||
<h6 style="font-weight: bold"> WP Cron</h6>
|
||||
<div class="custom-control custom-switch">
|
||||
<input
|
||||
<input ng-click="UpdateWPSettings('Wpcron')"
|
||||
type="checkbox"
|
||||
class="custom-control-input ng-pristine ng-untouched ng-valid ng-empty"
|
||||
id="maintenanceMode">
|
||||
id="wpcron">
|
||||
<label class="custom-control-label"
|
||||
for="maintenanceMode"></label>
|
||||
for="wpcron"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -429,7 +381,10 @@
|
||||
<div class="tab-pane" id="tab5">
|
||||
<div class="panel-body">
|
||||
<h3 class="content-box-header">
|
||||
{% trans "Create Backup " %} - <a href="{% url 'RestoreBackups' %}">{% trans "Restore Backups " %} <i class="glyph-icon icon-external-link-square" title="staging.cyberpanel.net"></i></a>
|
||||
{% trans "Create Backup " %} - <a
|
||||
href="{% url 'RestoreBackups' %}">{% trans "Restore Backups " %} <i
|
||||
class="glyph-icon icon-external-link-square"
|
||||
title="staging.cyberpanel.net"></i></a>
|
||||
</h3>
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
@@ -515,7 +470,9 @@
|
||||
<label class="col-sm-2 control-label mb-5"
|
||||
style="padding-top: 0px;">{% trans "Database Name" %}</label>
|
||||
<div class="col-sm-1 mb-10">
|
||||
<a target="_blank" href="{% url 'phpMyAdmin' %}"> <div id="DB_Name" class="mb-10 text-bold"></div></a>
|
||||
<a target="_blank" href="{% url 'phpMyAdmin' %}">
|
||||
<div id="DB_Name" class="mb-10 text-bold"></div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -597,6 +554,51 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!------------------MOdael for passwd protection-------->
|
||||
<div id="Passwordprotection" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×
|
||||
</button>
|
||||
<h4 class="modal-title">Enable Password Protection
|
||||
<img ng-hide="$parent.cyberPanelLoading"
|
||||
src="/static/images/loading.gif"
|
||||
style="display: none;">
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body" style="height: 100px;">
|
||||
|
||||
<div>
|
||||
<label class="col-sm-4">Username</label>
|
||||
<input ng-model="$parent.PPUsername" required class="col-lg-8"
|
||||
type="text" placeholder="Username">
|
||||
|
||||
</div>
|
||||
<div style="margin-top: 36px;">
|
||||
<label class="col-sm-4">Password</label>
|
||||
<input ng-model="$parent.PPPassword" required class="col-lg-8"
|
||||
type="password" placeholder="*******************">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary"
|
||||
ng-click="UpdateWPSettings('PasswordProtection')">Yes
|
||||
</button>
|
||||
<button type="button" ng-disabled="savingSettings"
|
||||
class="btn btn-default" data-dismiss="modal">
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!------------------End MOdael for passwd protection-------->
|
||||
|
||||
<!-------Start Model of AutoUpdateCongiguration-->
|
||||
<div id="autoUpdateConfig" class="modal fade" tabindex="-1" role="dialog"
|
||||
aria-hidden="true">
|
||||
@@ -684,7 +686,10 @@
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
×
|
||||
</button>
|
||||
<h4 class="modal-title">{% trans "Security" %}</h4>
|
||||
<h4 class="modal-title">{% trans "Security" %}<img style="display: none"
|
||||
id="wordpresshomeloadingsec"
|
||||
ng-hide="wordpresshomeloading"
|
||||
src="{% static 'images/loading.gif' %}"></h4>
|
||||
</div>
|
||||
<div class="modal-body center-div">
|
||||
<button
|
||||
|
||||
@@ -615,12 +615,33 @@ class WebsiteManager:
|
||||
else:
|
||||
maintenanceMode = 1
|
||||
|
||||
|
||||
##### Check passwd protection
|
||||
vhostName = wpsite.owner.domain
|
||||
vhostPassDir = f'/home/{vhostName}'
|
||||
path = f'{vhostPassDir}/{WPManagerID}'
|
||||
if os.path.exists(path):
|
||||
passwd = 0
|
||||
else:
|
||||
passwd = 1
|
||||
|
||||
|
||||
#### Check WP cron
|
||||
command = "sudo -u %s cat %s/wp-config.php"%(Vhuser, wpsite.path)
|
||||
stdout = ProcessUtilities.outputExecutioner(command)
|
||||
if stdout.find("'DISABLE_WP_CRON', 'true'") > -1:
|
||||
wpcron = 1
|
||||
else:
|
||||
wpcron = 0
|
||||
|
||||
fb ={
|
||||
'version': version.rstrip('\n'),
|
||||
'lscache': lscache,
|
||||
'debugging': debugging,
|
||||
'searchIndex': searchindex,
|
||||
'maintenanceMode': maintenanceMode
|
||||
'maintenanceMode': maintenanceMode,
|
||||
'passwordprotection': passwd,
|
||||
'wpcron': wpcron
|
||||
|
||||
}
|
||||
|
||||
@@ -977,9 +998,36 @@ class WebsiteManager:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
WPid = data['WPid']
|
||||
WPManagerID = data['WPid']
|
||||
wpsite = WPSites.objects.get(pk=WPManagerID)
|
||||
|
||||
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
path = wpsite.path
|
||||
|
||||
Webobj = Websites.objects.get(pk=wpsite.owner_id)
|
||||
|
||||
Vhuser = Webobj.externalApp
|
||||
PHPVersion = Webobj.phpSelection
|
||||
|
||||
php = ACLManager.getPHPString(PHPVersion)
|
||||
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
|
||||
|
||||
###fetch WP version
|
||||
|
||||
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp core version --skip-plugins --skip-themes --path=%s' % (
|
||||
Vhuser, FinalPHPPath, path)
|
||||
version = ProcessUtilities.outputExecutioner(command)
|
||||
version = version.rstrip("\n")
|
||||
|
||||
###install wp core
|
||||
command = "sudo -u %s wp core download --force --skip-content --version=%s"%(Vhuser, version)
|
||||
output = ProcessUtilities.outputExecutioner(command)
|
||||
|
||||
|
||||
time.sleep(2)
|
||||
|
||||
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None',}
|
||||
json_data = json.dumps(data_ret)
|
||||
@@ -997,9 +1045,33 @@ class WebsiteManager:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
WPid = data['WPid']
|
||||
WPManagerID = data['WPid']
|
||||
wpsite = WPSites.objects.get(pk=WPManagerID)
|
||||
|
||||
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
path = wpsite.path
|
||||
|
||||
Webobj = Websites.objects.get(pk=wpsite.owner_id)
|
||||
|
||||
Vhuser = Webobj.externalApp
|
||||
PHPVersion = Webobj.phpSelection
|
||||
|
||||
php = ACLManager.getPHPString(PHPVersion)
|
||||
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
|
||||
|
||||
###fetch WP version
|
||||
|
||||
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp core version --skip-plugins --skip-themes --path=%s' % (
|
||||
Vhuser, FinalPHPPath, path)
|
||||
version = ProcessUtilities.outputExecutioner(command)
|
||||
version = version.rstrip("\n")
|
||||
|
||||
###dataintegrity
|
||||
|
||||
time.sleep(2)
|
||||
|
||||
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None',}
|
||||
json_data = json.dumps(data_ret)
|
||||
@@ -1440,6 +1512,8 @@ class WebsiteManager:
|
||||
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)
|
||||
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)
|
||||
@@ -1454,12 +1528,19 @@ class WebsiteManager:
|
||||
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)
|
||||
stdoutput = ProcessUtilities.outputExecutioner(command)
|
||||
|
||||
|
||||
elif setting == 'PasswordProtection':
|
||||
execPath = f"/usr/local/CyberCP/bin/python {virtualHostUtilities.cyberPanel}/plogical/virtualHostUtilities.py"
|
||||
execPath = f"{execPath} EnableDisablePP --username '{PPUsername}' --password '{PPPassword}' " \
|
||||
f"--virtualHostName {Webobj.domain} --path {path} --wpid {str(wpsite.id)} --virtualHostUser {Webobj.externalApp}"
|
||||
ProcessUtilities.executioner(execPath)
|
||||
|
||||
elif setting == 'Wpcron':
|
||||
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp core version --skip-plugins --skip-themes --path=%s' % (
|
||||
Vhuser, FinalPHPPath, path)
|
||||
version = ProcessUtilities.outputExecutioner(command)
|
||||
|
||||
|
||||
data_ret = {'status': 1, 'error_message': 'None'}
|
||||
json_data = json.dumps(data_ret)
|
||||
|
||||
Reference in New Issue
Block a user