mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 22:06:05 +01:00
Allow normal user to change PHP Version.
This commit is contained in:
11
dns/views.py
11
dns/views.py
@@ -265,9 +265,14 @@ def addDeleteDNSRecords(request):
|
|||||||
for items in domains:
|
for items in domains:
|
||||||
domainsList.append(items.name)
|
domainsList.append(items.name)
|
||||||
else:
|
else:
|
||||||
domains = admin.domains_set.all()
|
websites = admin.websites_set.all()
|
||||||
for items in domains:
|
|
||||||
domainsList.append(items.name)
|
for web in websites:
|
||||||
|
try:
|
||||||
|
tempDomain = Domains.objects.get(name = web.domain)
|
||||||
|
domainsList.append(web.domain)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
return render(request, 'dns/addDeleteDNSRecords.html',{"domainsList":domainsList})
|
return render(request, 'dns/addDeleteDNSRecords.html',{"domainsList":domainsList})
|
||||||
|
|||||||
@@ -672,6 +672,7 @@ app.controller('websitePages', function($scope,$http) {
|
|||||||
|
|
||||||
$scope.hidsslconfigs = true;
|
$scope.hidsslconfigs = true;
|
||||||
$scope.configurationsBoxRewrite = true;
|
$scope.configurationsBoxRewrite = true;
|
||||||
|
$scope.changePHPView = true;
|
||||||
|
|
||||||
|
|
||||||
//Rewrite rules
|
//Rewrite rules
|
||||||
@@ -898,6 +899,7 @@ app.controller('websitePages', function($scope,$http) {
|
|||||||
|
|
||||||
$scope.hidsslconfigs = true;
|
$scope.hidsslconfigs = true;
|
||||||
$scope.configurationsBox = true;
|
$scope.configurationsBox = true;
|
||||||
|
$scope.changePHPView = true;
|
||||||
|
|
||||||
|
|
||||||
$scope.configurationsBox = true;
|
$scope.configurationsBox = true;
|
||||||
@@ -1124,8 +1126,6 @@ app.controller('websitePages', function($scope,$http) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////// Application Installation part
|
//////// Application Installation part
|
||||||
|
|
||||||
$scope.installationDetailsForm = true;
|
$scope.installationDetailsForm = true;
|
||||||
@@ -1340,9 +1340,12 @@ app.controller('websitePages', function($scope,$http) {
|
|||||||
$scope.hidsslconfigs = false;
|
$scope.hidsslconfigs = false;
|
||||||
$scope.configurationsBox = true;
|
$scope.configurationsBox = true;
|
||||||
$scope.configurationsBoxRewrite = true;
|
$scope.configurationsBoxRewrite = true;
|
||||||
|
$scope.changePHPView = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$scope.saveSSL = function(){
|
$scope.saveSSL = function(){
|
||||||
|
|
||||||
|
|
||||||
@@ -1412,6 +1415,98 @@ app.controller('websitePages', function($scope,$http) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//// Change PHP Master
|
||||||
|
|
||||||
|
$scope.failedToChangePHPMaster = true;
|
||||||
|
$scope.phpChangedMaster = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
|
||||||
|
$scope.changePHPView = true;
|
||||||
|
|
||||||
|
|
||||||
|
$scope.hideChangePHPMaster = function(){
|
||||||
|
$scope.changePHPView = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.changePHPMaster = function(){
|
||||||
|
$scope.hidsslconfigs = true;
|
||||||
|
$scope.configurationsBox = true;
|
||||||
|
$scope.configurationsBoxRewrite = true;
|
||||||
|
$scope.changePHPView = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$scope.changePHPVersionMaster = function(childDomain,phpSelection){
|
||||||
|
|
||||||
|
// notifcations
|
||||||
|
|
||||||
|
$scope.configFileLoading = false;
|
||||||
|
|
||||||
|
var url = "/websites/changePHP";
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
childDomain:$("#domainNamePage").text(),
|
||||||
|
phpSelection:$scope.phpSelectionMaster,
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers : {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
|
if(response.data.changePHP === 1){
|
||||||
|
|
||||||
|
$scope.configFileLoading = true;
|
||||||
|
$scope.websiteDomain = $("#domainNamePage").text();
|
||||||
|
|
||||||
|
|
||||||
|
// notifcations
|
||||||
|
|
||||||
|
$scope.failedToChangePHPMaster = true;
|
||||||
|
$scope.phpChangedMaster = false;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
$scope.configFileLoading = true;
|
||||||
|
$scope.errorMessage = response.data.error_message;
|
||||||
|
|
||||||
|
// notifcations
|
||||||
|
|
||||||
|
$scope.failedToChangePHPMaster = false;
|
||||||
|
$scope.phpChangedMaster = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
|
||||||
|
$scope.configFileLoading = true;
|
||||||
|
|
||||||
|
// notifcations
|
||||||
|
|
||||||
|
$scope.failedToChangePHPMaster = true;
|
||||||
|
$scope.phpChangedMaster = true;
|
||||||
|
$scope.couldNotConnect = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////// create domain part
|
////// create domain part
|
||||||
|
|
||||||
$("#domainCreationForm").hide();
|
$("#domainCreationForm").hide();
|
||||||
|
|||||||
@@ -672,6 +672,7 @@ app.controller('websitePages', function($scope,$http) {
|
|||||||
|
|
||||||
$scope.hidsslconfigs = true;
|
$scope.hidsslconfigs = true;
|
||||||
$scope.configurationsBoxRewrite = true;
|
$scope.configurationsBoxRewrite = true;
|
||||||
|
$scope.changePHPView = true;
|
||||||
|
|
||||||
|
|
||||||
//Rewrite rules
|
//Rewrite rules
|
||||||
@@ -898,6 +899,7 @@ app.controller('websitePages', function($scope,$http) {
|
|||||||
|
|
||||||
$scope.hidsslconfigs = true;
|
$scope.hidsslconfigs = true;
|
||||||
$scope.configurationsBox = true;
|
$scope.configurationsBox = true;
|
||||||
|
$scope.changePHPView = true;
|
||||||
|
|
||||||
|
|
||||||
$scope.configurationsBox = true;
|
$scope.configurationsBox = true;
|
||||||
@@ -1124,8 +1126,6 @@ app.controller('websitePages', function($scope,$http) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////// Application Installation part
|
//////// Application Installation part
|
||||||
|
|
||||||
$scope.installationDetailsForm = true;
|
$scope.installationDetailsForm = true;
|
||||||
@@ -1340,9 +1340,12 @@ app.controller('websitePages', function($scope,$http) {
|
|||||||
$scope.hidsslconfigs = false;
|
$scope.hidsslconfigs = false;
|
||||||
$scope.configurationsBox = true;
|
$scope.configurationsBox = true;
|
||||||
$scope.configurationsBoxRewrite = true;
|
$scope.configurationsBoxRewrite = true;
|
||||||
|
$scope.changePHPView = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$scope.saveSSL = function(){
|
$scope.saveSSL = function(){
|
||||||
|
|
||||||
|
|
||||||
@@ -1412,6 +1415,98 @@ app.controller('websitePages', function($scope,$http) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//// Change PHP Master
|
||||||
|
|
||||||
|
$scope.failedToChangePHPMaster = true;
|
||||||
|
$scope.phpChangedMaster = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
|
||||||
|
$scope.changePHPView = true;
|
||||||
|
|
||||||
|
|
||||||
|
$scope.hideChangePHPMaster = function(){
|
||||||
|
$scope.changePHPView = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.changePHPMaster = function(){
|
||||||
|
$scope.hidsslconfigs = true;
|
||||||
|
$scope.configurationsBox = true;
|
||||||
|
$scope.configurationsBoxRewrite = true;
|
||||||
|
$scope.changePHPView = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$scope.changePHPVersionMaster = function(childDomain,phpSelection){
|
||||||
|
|
||||||
|
// notifcations
|
||||||
|
|
||||||
|
$scope.configFileLoading = false;
|
||||||
|
|
||||||
|
var url = "/websites/changePHP";
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
childDomain:$("#domainNamePage").text(),
|
||||||
|
phpSelection:$scope.phpSelectionMaster,
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers : {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
|
if(response.data.changePHP === 1){
|
||||||
|
|
||||||
|
$scope.configFileLoading = true;
|
||||||
|
$scope.websiteDomain = $("#domainNamePage").text();
|
||||||
|
|
||||||
|
|
||||||
|
// notifcations
|
||||||
|
|
||||||
|
$scope.failedToChangePHPMaster = true;
|
||||||
|
$scope.phpChangedMaster = false;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
$scope.configFileLoading = true;
|
||||||
|
$scope.errorMessage = response.data.error_message;
|
||||||
|
|
||||||
|
// notifcations
|
||||||
|
|
||||||
|
$scope.failedToChangePHPMaster = false;
|
||||||
|
$scope.phpChangedMaster = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
|
||||||
|
$scope.configFileLoading = true;
|
||||||
|
|
||||||
|
// notifcations
|
||||||
|
|
||||||
|
$scope.failedToChangePHPMaster = true;
|
||||||
|
$scope.phpChangedMaster = true;
|
||||||
|
$scope.couldNotConnect = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////// create domain part
|
////// create domain part
|
||||||
|
|
||||||
$("#domainCreationForm").hide();
|
$("#domainCreationForm").hide();
|
||||||
|
|||||||
@@ -241,8 +241,8 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="example-box-wrapper">
|
<div class="example-box-wrapper">
|
||||||
|
|
||||||
<div style="border-radius: 25px;border-color:#3498db" class="content-box">
|
<div style="border-radius: 25px;border-color:#3498db" class="content-box">
|
||||||
|
|
||||||
<h3 class="content-box-header bg-blue">
|
<h3 class="content-box-header bg-blue">
|
||||||
{% trans "Domains" %} <img ng-hide="domainLoading" src="/static/images/loading.gif">
|
{% trans "Domains" %} <img ng-hide="domainLoading" src="/static/images/loading.gif">
|
||||||
</h3>
|
</h3>
|
||||||
@@ -271,13 +271,12 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<!---------- HTML For creating domains --------------->
|
<!---------- HTML For creating domains --------------->
|
||||||
|
|
||||||
|
|
||||||
<form id="domainCreationForm" name="websiteCreationForm" action="/" class="form-horizontal bordered-row">
|
<form id="domainCreationForm" name="websiteCreationForm" action="/" class="form-horizontal bordered-row">
|
||||||
|
|
||||||
|
|
||||||
@@ -367,12 +366,10 @@
|
|||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
<!---------- HTML For creating domains --------------->
|
<!---------- HTML For creating domains --------------->
|
||||||
|
|
||||||
<!---------- HTML For Listing domains --------------->
|
<!---------- HTML For Listing domains --------------->
|
||||||
|
|
||||||
|
|
||||||
<div id="listDomains" class="col-md-12">
|
<div id="listDomains" class="col-md-12">
|
||||||
|
|
||||||
<form ng-hide="" class="form-horizontal bordered-row">
|
<form ng-hide="" class="form-horizontal bordered-row">
|
||||||
@@ -460,9 +457,11 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!---------- HTML For Listing domains --------------->
|
<!---------- HTML For Listing domains --------------->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@@ -515,10 +514,10 @@
|
|||||||
|
|
||||||
<div class="col-md-3" style="margin-bottom: 2%;">
|
<div class="col-md-3" style="margin-bottom: 2%;">
|
||||||
|
|
||||||
<a ng-click="changePHPVersion()" href="" title="{% trans 'Change PHP Version' %}">
|
<a ng-click="changePHPMaster()" href="" title="{% trans 'Change PHP Version' %}">
|
||||||
<img src="{% static 'images/icons/laptop.png' %}">
|
<img src="{% static 'images/icons/laptop.png' %}">
|
||||||
</a>
|
</a>
|
||||||
<a ng-click="changePHPVersion()" href="" title="{% trans 'Change PHP Version' %}">
|
<a ng-click="changePHPMaster()" href="" title="{% trans 'Change PHP Version' %}">
|
||||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "Change PHP" %}</span>
|
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "Change PHP" %}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
@@ -575,8 +574,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!----- HTML For SSL ---->
|
||||||
<!----- HTML For SSL
|
|
||||||
|
|
||||||
|
|
||||||
<!---- HTML for main conf file ---->
|
<!---- HTML for main conf file ---->
|
||||||
@@ -683,13 +681,72 @@
|
|||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--- HTML To change PHP --->
|
||||||
|
|
||||||
|
<div class="col-md-12">
|
||||||
|
|
||||||
|
<form ng-hide="changePHPView" name="" action="/" class="form-horizontal bordered-row">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">{% trans "Select PHP" %}</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<select ng-model="phpSelectionMaster" class="form-control">
|
||||||
|
<option>PHP 5.3</option>
|
||||||
|
<option>PHP 5.4</option>
|
||||||
|
<option>PHP 5.5</option>
|
||||||
|
<option>PHP 5.6</option>
|
||||||
|
<option>PHP 7.0</option>
|
||||||
|
<option>PHP 7.1</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 1%;" class=" col-sm-1">
|
||||||
|
<a title="{% trans 'Cancel' %}" ng-click="hideChangePHPMaster()" href=""><img src="/static/images/close-32.png"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label"></label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<button type="button" ng-click="changePHPVersionMaster()" class="btn btn-primary btn-lg btn-block">{% trans "Change PHP" %}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
|
||||||
|
<label class="col-sm-3 control-label"></label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<div ng-hide="failedToChangePHPMaster" class="alert alert-danger">
|
||||||
|
<p>{% trans "Failed to change PHP version. Error message:" %} {$ errorMessage $}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div ng-hide="phpChangedMaster" class="alert alert-success">
|
||||||
|
<p>{% trans "PHP successfully changed for: " %} <strong>{$ websiteDomain $}</strong></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div ng-hide="couldNotConnect" class="alert alert-danger">
|
||||||
|
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user