Fix the Remote Backup Storage Issue

This commit is contained in:
Usman Nasir
2019-06-08 21:41:43 +00:00
parent 8e2ad7f4b2
commit 0399a43830
3284 changed files with 2254 additions and 1140 deletions

845
static/managePHP/managePHP.js Normal file → Executable file
View File

@@ -3,571 +3,558 @@
*/
app.controller('installExtensions', function($scope,$http,$timeout) {
app.controller('installExtensions', function ($scope, $http, $timeout) {
var size = 0;
var extName='';
var size = 0;
var extName = '';
$scope.availableExtensions = true;
$scope.loadingExtensions = true;
$scope.canNotFetch = true;
$scope.couldNotConnect = true;
$scope.phpSelectionDisabled = false;
$scope.request = true;
$scope.canNotPerform = true;
$scope.goback = true;
$scope.fetchPHPDetails = function () {
$scope.loadingExtensions = false;
$scope.phpSelectionDisabled = false;
populateCurrentRecords();
$scope.request = true;
};
$scope.installExt = function (extensionName) {
extName = extensionName;
$scope.phpSelectionDisabled = true;
$scope.requestData = "";
$scope.loadingExtensions = false;
$scope.availableExtensions = true;
$scope.request = false;
$scope.goback = true;
url = "/managephp/submitExtensionRequest";
var data = {
extensionName: extensionName,
type: "install"
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.extensionRequestStatus === 1) {
getRequestStatus();
$scope.canNotPerform = true;
}
else {
$scope.canNotPerform = false;
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
$scope.availableExtensions = true;
$scope.loadingExtensions = true;
$scope.canNotFetch = true;
$scope.couldNotConnect = true;
$scope.phpSelectionDisabled = false;
$scope.request = true;
$scope.couldNotConnect = false;
$scope.canNotPerform = true;
$scope.goback = true;
$scope.fetchPHPDetails = function(){
$scope.loadingExtensions = false;
$scope.phpSelectionDisabled = false;
populateCurrentRecords();
$scope.request = true;
};
$scope.installExt = function(extensionName){
extName = extensionName;
$scope.phpSelectionDisabled = true;
$scope.requestData = "";
$scope.loadingExtensions = false;
$scope.availableExtensions = true;
$scope.request = false;
$scope.goback = true;
url = "/managephp/submitExtensionRequest";
var data = {
extensionName:extensionName,
type:"install"
};
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
$scope.uninstallExt = function (extensionName) {
extName = extensionName;
$scope.phpSelectionDisabled = true;
$scope.requestData = "";
$scope.goback = true;
$scope.loadingExtensions = false;
$scope.availableExtensions = true;
$scope.request = false;
url = "/managephp/submitExtensionRequest";
var data = {
extensionName: extensionName,
type: "uninstall"
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
function ListInitialDatas(response) {
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
if(response.data.extensionRequestStatus === 1){
getRequestStatus();
$scope.canNotPerform = true;
function ListInitialDatas(response) {
}
else{
$scope.canNotPerform = false;
$scope.errorMessage = response.data.error_message;
}
if (response.data.extensionRequestStatus == 1) {
getRequestStatus();
$scope.canNotPerform = true;
}
else {
$scope.canNotPerform = false;
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
$scope.canNotFetch = true;
$scope.couldNotConnect = false;
$scope.canNotPerform = true;
}
};
function populateCurrentRecords() {
var phpSelection = $scope.phpSelection;
url = "/managephp/getExtensionsInformation";
var data = {
phpSelection: phpSelection,
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.fetchStatus === 1) {
$scope.records = JSON.parse(response.data.data);
$scope.availableExtensions = false;
$scope.loadingExtensions = true;
$scope.canNotFetch = true;
$scope.couldNotConnect = true;
}
else {
$scope.errorMessage = response.data.error_message;
$scope.canNotFetch = false;
$scope.couldNotConnect = true;
}
}
function cantLoadInitialDatas(response) {
$scope.canNotFetch = true;
$scope.couldNotConnect = false;
}
}
function getRequestStatus() {
url = "/managephp/getRequestStatus";
var data = {
size: size,
extensionName: extName,
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.extensionRequestStatus === 1) {
if (response.data.finished === 1) {
$scope.loadingExtensions = true;
$scope.phpSelectionDisabled = false;
$scope.requestData = response.data.requestStatus;
$scope.goback = false;
$timeout.cancel();
}
function cantLoadInitialDatas(response) {
$scope.canNotFetch = true;
$scope.couldNotConnect = false;
$scope.canNotPerform = true;
else {
size = Number(response.data.size);
$scope.requestData = response.data.requestStatus;
$timeout(getRequestStatus, 1000);
}
};
}
else {
$scope.uninstallExt = function(extensionName){
}
extName = extensionName;
}
$scope.phpSelectionDisabled = true;
$scope.requestData = "";
$scope.goback = true;
function cantLoadInitialDatas(response) {
$scope.loadingExtensions = false;
$scope.availableExtensions = true;
$scope.request = false;
$scope.canNotFetch = true;
$scope.couldNotConnect = false;
url = "/managephp/submitExtensionRequest";
var data = {
extensionName:extensionName,
type:"uninstall"
};
}
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if(response.data.extensionRequestStatus == 1){
getRequestStatus();
$scope.canNotPerform = true;
}
else{
$scope.canNotPerform = false;
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
$scope.canNotFetch = true;
$scope.couldNotConnect = false;
$scope.canNotPerform = true;
}
};
function populateCurrentRecords(){
var phpSelection = $scope.phpSelection;
url = "/managephp/getExtensionsInformation";
var data = {
phpSelection:phpSelection,
};
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if(response.data.fetchStatus === 1){
$scope.records = JSON.parse(response.data.data);
$scope.availableExtensions = false;
$scope.loadingExtensions = true;
$scope.canNotFetch = true;
$scope.couldNotConnect = true;
}
else{
$scope.errorMessage = response.data.error_message;
$scope.canNotFetch = false;
$scope.couldNotConnect = true;
}
}
function cantLoadInitialDatas(response) {
$scope.canNotFetch = true;
$scope.couldNotConnect = false;
}
};
function getRequestStatus(){
url = "/managephp/getRequestStatus";
var data = {
size:size,
extensionName:extName,
};
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if(response.data.extensionRequestStatus === 1){
if(response.data.finished === 1){
$scope.loadingExtensions = true;
$scope.phpSelectionDisabled = false;
$scope.requestData = response.data.requestStatus;
$scope.goback = false;
$timeout.cancel();
}
else{
size = Number(response.data.size);
$scope.requestData = response.data.requestStatus;
$timeout(getRequestStatus,1000);
}
}
else{
}
}
function cantLoadInitialDatas(response) {
$scope.canNotFetch = true;
$scope.couldNotConnect = false;
}
};
}
});
app.controller('editPHPConfig', function($scope,$http,$timeout) {
app.controller('editPHPConfig', function ($scope, $http, $timeout) {
$scope.loadingPHP = true;
$scope.canNotFetch = true;
$scope.phpDetailsBox = true;
$scope.couldNotConnect = true;
$scope.detailsSaved = true;
$scope.savebtn = true;
$scope.configDataView = true;
$scope.canNotFetchAdvanced = true;
$scope.detailsSavedAdvanced = true;
$scope.savebtnAdvance = true;
$scope.loadingPHP = true;
$scope.canNotFetch = true;
$scope.phpDetailsBox = true;
$scope.couldNotConnect = true;
$scope.detailsSaved = true;
$scope.savebtn = true;
$scope.configDataView = true;
$scope.canNotFetchAdvanced = true;
$scope.detailsSavedAdvanced = true;
$scope.savebtnAdvance = true;
var allow_url_fopen = false;
var display_errors = false;
var file_uploads = false;
var allow_url_include = false;
var allow_url_fopen = false;
var display_errors = false;
var file_uploads = false;
var allow_url_include = false;
$('#allow_url_fopen').change(function() {
allow_url_fopen = $(this).prop('checked');
});
$('#allow_url_fopen').change(function () {
allow_url_fopen = $(this).prop('checked');
});
$('#display_errors').change(function() {
display_errors = $(this).prop('checked');
});
$('#display_errors').change(function () {
display_errors = $(this).prop('checked');
});
$('#file_uploads').change(function() {
file_uploads = $(this).prop('checked');
});
$('#file_uploads').change(function () {
file_uploads = $(this).prop('checked');
});
$('#allow_url_include').change(function() {
allow_url_include = $(this).prop('checked');
});
$('#allow_url_include').change(function () {
allow_url_include = $(this).prop('checked');
});
$scope.fetchPHPDetails = function(){
$scope.loadingPHP = false;
$scope.canNotFetch = true;
$scope.detailsSaved = true;
$scope.fetchPHPDetails = function () {
$scope.loadingPHP = false;
$scope.canNotFetch = true;
$scope.detailsSaved = true;
$('#allow_url_fopen').bootstrapToggle('off');
$('#display_errors').bootstrapToggle('off');
$('#file_uploads').bootstrapToggle('off');
$('#allow_url_include').bootstrapToggle('off');
$('#allow_url_fopen').bootstrapToggle('off');
$('#display_errors').bootstrapToggle('off');
$('#file_uploads').bootstrapToggle('off');
$('#allow_url_include').bootstrapToggle('off');
url = "/managephp/getCurrentPHPConfig";
url = "/managephp/getCurrentPHPConfig";
var phpSelection = $scope.phpSelection;
var phpSelection = $scope.phpSelection;
var data = {
phpSelection:phpSelection,
};
var data = {
phpSelection: phpSelection,
};
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
function ListInitialDatas(response) {
if(response.data.fetchStatus == 1){
if (response.data.fetchStatus == 1) {
$scope.savebtn = false;
$scope.savebtn = false;
if(response.data.allow_url_fopen==="1"){
$('#allow_url_fopen').bootstrapToggle('on');
}
if(response.data.display_errors==="1"){
$('#display_errors').bootstrapToggle('on');
}
if(response.data.file_uploads==="1"){
$('#file_uploads').bootstrapToggle('on');
}
if(response.data.allow_url_include==="1"){
$('#allow_url_include').bootstrapToggle('on');
}
$scope.loadingPHP = true;
$scope.memory_limit = response.data.memory_limit;
$scope.max_execution_time = response.data.max_execution_time;
$scope.upload_max_filesize = response.data.upload_max_filesize;
$scope.max_input_time = response.data.max_input_time;
$scope.post_max_size = response.data.post_max_size;
$scope.phpDetailsBox = false;
}
else{
$scope.errorMessage = response.data.error_message;
$scope.canNotFetch = false;
$scope.loadingPHP = true;
$scope.phpDetailsBox = true;
}
if (response.data.allow_url_fopen === "1") {
$('#allow_url_fopen').bootstrapToggle('on');
}
function cantLoadInitialDatas(response) {
$scope.couldNotConnect = false;
if (response.data.display_errors === "1") {
$('#display_errors').bootstrapToggle('on');
}
if (response.data.file_uploads === "1") {
$('#file_uploads').bootstrapToggle('on');
}
if (response.data.allow_url_include === "1") {
$('#allow_url_include').bootstrapToggle('on');
}
};
$scope.loadingPHP = true;
$scope.memory_limit = response.data.memory_limit;
$scope.max_execution_time = response.data.max_execution_time;
$scope.upload_max_filesize = response.data.upload_max_filesize;
$scope.max_input_time = response.data.max_input_time;
$scope.post_max_size = response.data.post_max_size;
$scope.phpDetailsBox = false;
$scope.saveChanges = function () {
$scope.loadingPHP = false;
}
else {
var phpSelection = $scope.phpSelection;
$scope.errorMessage = response.data.error_message;
$scope.canNotFetch = false;
$scope.loadingPHP = true;
$scope.phpDetailsBox = true;
}
url = "/managephp/savePHPConfigBasic";
}
var data = {
phpSelection:phpSelection,
allow_url_fopen:allow_url_fopen,
display_errors:display_errors,
file_uploads:file_uploads,
allow_url_include:allow_url_include,
memory_limit:$scope.memory_limit,
max_execution_time:$scope.max_execution_time,
upload_max_filesize:$scope.upload_max_filesize,
max_input_time:$scope.max_input_time,
post_max_size: $scope.post_max_size,
};
function cantLoadInitialDatas(response) {
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
$scope.couldNotConnect = false;
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
}
};
function ListInitialDatas(response) {
$scope.saveChanges = function () {
if(response.data.saveStatus === 1){
$scope.loadingPHP = false;
$scope.detailsSaved = false;
$scope.loadingPHP = true;
var phpSelection = $scope.phpSelection;
}
else{
$scope.errorMessage = response.data.error_message;
$scope.canNotFetch = false;
$scope.couldNotConnect = true;
$scope.loadingPHP = true;
}
url = "/managephp/savePHPConfigBasic";
}
function cantLoadInitialDatas(response) {
var data = {
phpSelection: phpSelection,
allow_url_fopen: allow_url_fopen,
display_errors: display_errors,
file_uploads: file_uploads,
allow_url_include: allow_url_include,
memory_limit: $scope.memory_limit,
max_execution_time: $scope.max_execution_time,
upload_max_filesize: $scope.upload_max_filesize,
max_input_time: $scope.max_input_time,
post_max_size: $scope.post_max_size,
};
$scope.canNotFetch = true;
$scope.couldNotConnect = false;
$scope.loadingPHP = true;
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
}
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
};
function ListInitialDatas(response) {
$scope.fetchAdvancePHPDetails = function(){
$scope.loadingPHP = false;
$scope.savebtnAdvance = true;
if (response.data.saveStatus === 1) {
$scope.detailsSaved = false;
$scope.loadingPHP = true;
url = "/managephp/getCurrentAdvancedPHPConfig";
}
else {
$scope.errorMessage = response.data.error_message;
$scope.canNotFetch = false;
$scope.couldNotConnect = true;
$scope.loadingPHP = true;
}
var phpSelection = $scope.phpSelection;
}
var data = {
phpSelection:phpSelection,
};
function cantLoadInitialDatas(response) {
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
$scope.canNotFetch = true;
$scope.couldNotConnect = false;
$scope.loadingPHP = true;
}
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
};
function ListInitialDatas(response) {
$scope.fetchAdvancePHPDetails = function () {
$scope.loadingPHP = false;
$scope.savebtnAdvance = true;
if(response.data.fetchStatus == 1){
$scope.configDataView = false;
$scope.configData = response.data.configData;
$scope.loadingPHP = true;
url = "/managephp/getCurrentAdvancedPHPConfig";
$scope.canNotFetchAdvanced = true;
$scope.detailsSavedAdvanced = true;
$scope.savebtnAdvance = false;
var phpSelection = $scope.phpSelection;
var data = {
phpSelection: phpSelection,
};
}
else{
$scope.canNotFetchAdvanced = false;
$scope.detailsSavedAdvanced = true;
$scope.loadingPHP = true;
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$scope.errorMessage = response.data.error_message;
$scope.configDataView = true;
}
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
}
function cantLoadInitialDatas(response) {
function ListInitialDatas(response) {
$scope.couldNotConnect = false;
$scope.loadingPHP = true;
if (response.data.fetchStatus == 1) {
}
$scope.configDataView = false;
$scope.configData = response.data.configData;
$scope.loadingPHP = true;
};
$scope.canNotFetchAdvanced = true;
$scope.detailsSavedAdvanced = true;
$scope.savebtnAdvance = false;
}
else {
$scope.canNotFetchAdvanced = false;
$scope.detailsSavedAdvanced = true;
$scope.loadingPHP = true;
$scope.saveChangesAdvance = function () {
$scope.errorMessage = response.data.error_message;
$scope.configDataView = true;
$scope.loadingPHP = false;
}
var phpSelection = $scope.phpSelection;
}
url = "/managephp/savePHPConfigAdvance";
function cantLoadInitialDatas(response) {
var data = {
phpSelection:phpSelection,
configData:$scope.configData,
};
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
$scope.couldNotConnect = false;
$scope.loadingPHP = true;
}
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
};
function ListInitialDatas(response) {
$scope.saveChangesAdvance = function () {
$scope.loadingPHP = false;
if(response.data.saveStatus == 1){
var phpSelection = $scope.phpSelection;
$scope.detailsSavedAdvanced = false;
$scope.loadingPHP = true;
url = "/managephp/savePHPConfigAdvance";
}
else{
$scope.errorMessage = response.data.error_message;
$scope.canNotFetchAdvanced = false;
$scope.couldNotConnect = true;
$scope.loadingPHP = true;
}
var data = {
phpSelection: phpSelection,
configData: $scope.configData,
};
}
function cantLoadInitialDatas(response) {
$scope.couldNotConnect = false;
$scope.canNotFetchAdvanced = true;
$scope.couldNotConnect = true;
$scope.loadingPHP = true;
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
}
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
};
function ListInitialDatas(response) {
if (response.data.saveStatus == 1) {
$scope.detailsSavedAdvanced = false;
$scope.loadingPHP = true;
}
else {
$scope.errorMessage = response.data.error_message;
$scope.canNotFetchAdvanced = false;
$scope.couldNotConnect = true;
$scope.loadingPHP = true;
}
}
function cantLoadInitialDatas(response) {
$scope.couldNotConnect = false;
$scope.canNotFetchAdvanced = true;
$scope.couldNotConnect = true;
$scope.loadingPHP = true;
}
};
});