From 0d76751e59eb473d41627d3c11db9040116f84db Mon Sep 17 00:00:00 2001
From: usmannasir <01-134132-158@student.bahria.edu.pk>
Date: Fri, 16 Nov 2018 17:53:51 +0500
Subject: [PATCH] fixed php config path for ubuntu
---
install/install.py | 40 +-
managePHP/views.py | 27 +-
plogical/phpUtilities.py | 9 +-
static/filemanager/js/fileManager.js | 590 +-
static/userManagment/userManagment.js | 3 -
static/websiteFunctions/websiteFunctions.js | 5985 +++++++++----------
6 files changed, 3326 insertions(+), 3328 deletions(-)
diff --git a/install/install.py b/install/install.py
index 585c31098..864b333ec 100644
--- a/install/install.py
+++ b/install/install.py
@@ -187,30 +187,30 @@ class preFlightsChecks:
preFlightsChecks.stdOut("CyberPanel user added!")
break
- ##
+ ##
- count = 0
+ count = 0
- while (1):
+ while (1):
- command = "usermod -aG wheel cyberpanel"
- cmd = shlex.split(command)
- res = subprocess.call(cmd)
+ command = "usermod -aG wheel cyberpanel"
+ cmd = shlex.split(command)
+ res = subprocess.call(cmd)
- if preFlightsChecks.resFailed(self.distro, res):
- count = count + 1
- preFlightsChecks.stdOut(
- "We are trying to add CyberPanel user to SUDO group, trying again, try number: " + str(
- count) + "\n")
- if count == 3:
- logging.InstallLog.writeToFile(
- "Not able to add user CyberPanel to SUDO group, exiting the installer. [setup_account_cyberpanel]")
- preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
- os._exit(0)
- else:
- logging.InstallLog.writeToFile("CyberPanel user was successfully added to SUDO group!")
- preFlightsChecks.stdOut("CyberPanel user was successfully added to SUDO group!")
- break
+ if preFlightsChecks.resFailed(self.distro, res):
+ count = count + 1
+ preFlightsChecks.stdOut(
+ "We are trying to add CyberPanel user to SUDO group, trying again, try number: " + str(
+ count) + "\n")
+ if count == 3:
+ logging.InstallLog.writeToFile(
+ "Not able to add user CyberPanel to SUDO group, exiting the installer. [setup_account_cyberpanel]")
+ preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
+ os._exit(0)
+ else:
+ logging.InstallLog.writeToFile("CyberPanel user was successfully added to SUDO group!")
+ preFlightsChecks.stdOut("CyberPanel user was successfully added to SUDO group!")
+ break
###############################
diff --git a/managePHP/views.py b/managePHP/views.py
index 15426b014..30904c8d4 100644
--- a/managePHP/views.py
+++ b/managePHP/views.py
@@ -1427,7 +1427,14 @@ def getCurrentPHPConfig(request):
elif phpVers == "PHP 7.2":
phpVers = "php72"
- path = "/usr/local/lsws/ls" + phpVers + "/etc/php.ini"
+ if ProcessUtilities.decideServer() == ProcessUtilities.centos:
+ path = "/usr/local/lsws/ls" + phpVers + "/etc/php.ini"
+ else:
+ initial = phpVers[3]
+ final = phpVers[4]
+
+ completeName = str(initial) + '.' + str(final)
+ path = "/usr/local/lsws/ls" + phpVers + "/etc/php/" + completeName + "/litespeed/php.ini"
allow_url_fopen = "0"
display_errors = "0"
@@ -1605,7 +1612,14 @@ def getCurrentAdvancedPHPConfig(request):
elif phpVers == "PHP 7.2":
phpVers = "php72"
- path = "/usr/local/lsws/ls" + phpVers + "/etc/php.ini"
+ if ProcessUtilities.decideServer() == ProcessUtilities.centos:
+ path = "/usr/local/lsws/ls" + phpVers + "/etc/php.ini"
+ else:
+ initial = phpVers[3]
+ final = phpVers[4]
+
+ completeName = str(initial) + '.' + str(final)
+ path = "/usr/local/lsws/ls" + phpVers + "/etc/php/" + completeName + "/litespeed/php.ini"
configData = open(path, "r").read()
@@ -1651,7 +1665,14 @@ def savePHPConfigAdvance(request):
elif phpVers == "PHP 7.2":
phpVers = "php72"
- path = "/usr/local/lsws/ls" + phpVers + "/etc/php.ini"
+ if ProcessUtilities.decideServer() == ProcessUtilities.centos:
+ path = "/usr/local/lsws/ls" + phpVers + "/etc/php.ini"
+ else:
+ initial = phpVers[3]
+ final = phpVers[4]
+
+ completeName = str(initial) + '.' + str(final)
+ path = "/usr/local/lsws/ls" + phpVers + "/etc/php/" + completeName + "/litespeed/php.ini"
tempPath = "/home/cyberpanel/" + str(randint(1000, 9999))
diff --git a/plogical/phpUtilities.py b/plogical/phpUtilities.py
index 86560ac2b..37d1f93c9 100644
--- a/plogical/phpUtilities.py
+++ b/plogical/phpUtilities.py
@@ -94,7 +94,14 @@ class phpUtilities:
def savePHPConfigBasic(phpVers,allow_url_fopen,display_errors,file_uploads,allow_url_include,memory_limit,max_execution_time,upload_max_filesize,max_input_time,post_max_size):
try:
- path = "/usr/local/lsws/ls" + phpVers + "/etc/php.ini"
+ if ProcessUtilities.decideServer() == ProcessUtilities.centos:
+ path = "/usr/local/lsws/ls" + phpVers + "/etc/php.ini"
+ else:
+ initial = phpVers[3]
+ final = phpVers[4]
+
+ completeName = str(initial) + '.' + str(final)
+ path = "/usr/local/lsws/ls" + phpVers + "/etc/php/" + completeName + "/litespeed/php.ini"
data = open(path, 'r').readlines()
diff --git a/static/filemanager/js/fileManager.js b/static/filemanager/js/fileManager.js
index 24a4713a7..9decf19cf 100644
--- a/static/filemanager/js/fileManager.js
+++ b/static/filemanager/js/fileManager.js
@@ -1,13 +1,13 @@
var fileManager = angular.module('fileManager', ['angularFileUpload']);
-fileManager.config(['$interpolateProvider', function($interpolateProvider) {
- $interpolateProvider.startSymbol('{$');
- $interpolateProvider.endSymbol('$}');
- }]);
+fileManager.config(['$interpolateProvider', function ($interpolateProvider) {
+ $interpolateProvider.startSymbol('{$');
+ $interpolateProvider.endSymbol('$}');
+}]);
-fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $window) {
+fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader, $window) {
- $( document.body ).click(function() {
+ $(document.body).click(function () {
rightClickNode.style.display = "none";
});
@@ -17,10 +17,10 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
var domainName = $("#domainNameInitial").text();
var domainRandomSeed = "";
- var homePathBack = "/home/"+domainName;
- $scope.currentPath = "/home/"+domainName;
+ var homePathBack = "/home/" + domainName;
+ $scope.currentPath = "/home/" + domainName;
$scope.startingPath = domainName;
- $scope.completeStartingPath = "/home/"+domainName;
+ $scope.completeStartingPath = "/home/" + domainName;
$scope.editDisable = true;
// disable loading image on tree loading
@@ -31,7 +31,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
$scope.saveSuccess = true;
var allFilesAndFolders = [];
- $scope.showUploadBox = function(){
+ $scope.showUploadBox = function () {
$('#uploadBox').modal('show');
};
@@ -47,7 +47,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
// tree
- $scope.fetchChilds = function (element,completePath,functionName) {
+ $scope.fetchChilds = function (element, completePath, functionName) {
// start loading tree
$scope.treeLoading = false;
@@ -55,21 +55,21 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
var funcCompletePath = "";
var nodeForChilds = "";
- if(functionName === "primary") {
+ if (functionName === "primary") {
nodeForChilds = element.currentTarget.parentNode;
funcCompletePath = completePath;
}
- else{
+ else {
nodeForChilds = element.parentNode;
funcCompletePath = completePath;
}
- url = domainName+"/php/fileManager.php";
+ url = domainName + "/php/fileManager.php";
var data = {
- completeStartingPath : completePath,
- method : "list",
- domainRandomSeed:domainRandomSeed,
+ completeStartingPath: completePath,
+ method: "list",
+ domainRandomSeed: domainRandomSeed,
domainName: domainName
};
@@ -83,7 +83,6 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
if (response.data.fetchStatus === 1) {
-
/// node prepration
var ulNode = prepareChildNodeUL();
@@ -93,7 +92,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
var keys = Object.keys(filesData);
- for (var i=0; i < keys.length; i++) {
+ for (var i = 0; i < keys.length; i++) {
if (keys[i] === "error_message" | keys[i] === "fetchStatus") {
continue;
}
@@ -101,11 +100,11 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
path = filesData[keys[i]][0];
completePath = filesData[keys[i]][1];
dropDown = filesData[keys[i]][2];
- finalPrepration(ulNode,path,completePath,dropDown);
+ finalPrepration(ulNode, path, completePath, dropDown);
}
}
- activateMinus(nodeForChilds,funcCompletePath);
+ activateMinus(nodeForChilds, funcCompletePath);
}
else {
}
@@ -117,11 +116,11 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
};
- function finalPrepration(parentNode, path,completePath,dropDown){
- parentNode.appendChild(prepareChildNodeLI(path,completePath,dropDown));
+ function finalPrepration(parentNode, path, completePath, dropDown) {
+ parentNode.appendChild(prepareChildNodeLI(path, completePath, dropDown));
}
- function prepareChildNodeLI(path,completePath,dropDown){
+ function prepareChildNodeLI(path, completePath, dropDown) {
// text nodes are created
var spaceNode = document.createTextNode(" ");
@@ -129,37 +128,39 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
//
- var attachFunc = function(){ $scope.fetchChilds(aNode, completePath,"secondary"); };
+ var attachFunc = function () {
+ $scope.fetchChilds(aNode, completePath, "secondary");
+ };
var aNode = document.createElement('a');
- aNode.setAttribute('href','#');
+ aNode.setAttribute('href', '#');
aNode.addEventListener("click", attachFunc);
- aNode.setAttribute('onclick','return false;');
+ aNode.setAttribute('onclick', 'return false;');
var secondANode = document.createElement('a');
- secondANode.setAttribute('href','#');
- secondANode.setAttribute('onclick','return false;');
+ secondANode.setAttribute('href', '#');
+ secondANode.setAttribute('onclick', 'return false;');
//
var iNodePlus = document.createElement('i');
- iNodePlus.setAttribute('class','fa fa-plus');
- iNodePlus.setAttribute('aria-hidden','true');
+ iNodePlus.setAttribute('class', 'fa fa-plus');
+ iNodePlus.setAttribute('aria-hidden', 'true');
iNodePlus.style.color = "#007bff";
var iNodeFolder = document.createElement('i');
- iNodeFolder.setAttribute('class','fa fa-folder');
- iNodeFolder.setAttribute('aria-hidden','true');
+ iNodeFolder.setAttribute('class', 'fa fa-folder');
+ iNodeFolder.setAttribute('aria-hidden', 'true');
var iNodeFile = document.createElement('i');
- iNodeFile.setAttribute('class','fa fa-file');
- iNodeFile.setAttribute('aria-hidden','true');
+ iNodeFile.setAttribute('class', 'fa fa-file');
+ iNodeFile.setAttribute('aria-hidden', 'true');
iNodeFile.style.color = "#007bff";
//
var liNode = document.createElement('li');
- liNode.setAttribute('class','list-group-item');
+ liNode.setAttribute('class', 'list-group-item');
liNode.style.border = "None";
// node preparation
@@ -167,7 +168,9 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
if (dropDown == true) {
secondANode.appendChild(iNodeFolder);
secondANode.appendChild(pathNode);
- secondANode.addEventListener("click", function(){ $scope.fetchForTableSecondary(secondANode,"fromTree",completePath);});
+ secondANode.addEventListener("click", function () {
+ $scope.fetchForTableSecondary(secondANode, "fromTree", completePath);
+ });
// This makes completion of {{ startingPath }}
@@ -183,7 +186,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
return liNode;
}
- else{
+ else {
liNode.appendChild(iNodeFile);
liNode.appendChild(pathNode);
return liNode;
@@ -192,32 +195,34 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
}
- function prepareChildNodeUL(){
+ function prepareChildNodeUL() {
// text nodes are created
var ulNode = document.createElement('ul');
- ulNode.setAttribute('class','list-group list-group-flush');
+ ulNode.setAttribute('class', 'list-group list-group-flush');
return ulNode;
}
- function activateMinus(node,completePath){
+ function activateMinus(node, completePath) {
var collectionOfA = node.getElementsByTagName("a");
//
var aNode = document.createElement('a');
- aNode.setAttribute('href','#');
- aNode.addEventListener("click", function(){ deleteChilds(aNode,completePath);});
- aNode.setAttribute('onclick','return false;');
+ aNode.setAttribute('href', '#');
+ aNode.addEventListener("click", function () {
+ deleteChilds(aNode, completePath);
+ });
+ aNode.setAttribute('onclick', 'return false;');
//
var spaceNode = document.createTextNode(" ");
var iNodeMinus = document.createElement('i');
- iNodeMinus.setAttribute('class','fa fa-minus');
- iNodeMinus.setAttribute('aria-hidden','true');
+ iNodeMinus.setAttribute('class', 'fa fa-minus');
+ iNodeMinus.setAttribute('aria-hidden', 'true');
iNodeMinus.style.color = "#007bff";
// prepare node
@@ -225,12 +230,12 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
aNode.appendChild(iNodeMinus);
aNode.appendChild(spaceNode);
- node.insertBefore(aNode,collectionOfA[1]);
+ node.insertBefore(aNode, collectionOfA[1]);
node.removeChild(collectionOfA[0]);
}
- function deleteChilds(aNode,completePath) {
+ function deleteChilds(aNode, completePath) {
parent = aNode.parentNode;
@@ -243,17 +248,19 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
//
var newANode = document.createElement('a');
- newANode.setAttribute('href','#');
- newANode.addEventListener("click", function(){ $scope.fetchChilds(newANode, completePath,"secondary");});
- newANode.setAttribute('onclick','return false;');
+ newANode.setAttribute('href', '#');
+ newANode.addEventListener("click", function () {
+ $scope.fetchChilds(newANode, completePath, "secondary");
+ });
+ newANode.setAttribute('onclick', 'return false;');
//
var spaceNode = document.createTextNode(" ");
var iNodePlus = document.createElement('i');
- iNodePlus.setAttribute('class','fa fa-plus');
- iNodePlus.setAttribute('aria-hidden','true');
+ iNodePlus.setAttribute('class', 'fa fa-plus');
+ iNodePlus.setAttribute('aria-hidden', 'true');
iNodePlus.style.color = "#007bff";
// prepare node
@@ -261,7 +268,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
newANode.appendChild(iNodePlus);
newANode.appendChild(spaceNode);
- parent.insertBefore(newANode,collectionOfA[1]);
+ parent.insertBefore(newANode, collectionOfA[1]);
parent.removeChild(collectionOfA[0]);
@@ -278,7 +285,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
var collectionOfA = tableBody.getElementsByTagName("tr");
- for(var i = 0; i < collectionOfA.length ; i++){
+ for (var i = 0; i < collectionOfA.length; i++) {
collectionOfA[i].style.background = "aliceblue";
var getFileName = collectionOfA[i].getElementsByTagName('td')[0].innerHTML;
allFilesAndFolders.push(getFileName);
@@ -295,27 +302,27 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
var collectionOfA = tableBody.getElementsByTagName("tr");
- for(var i = 0; i < collectionOfA.length ; i++){
+ for (var i = 0; i < collectionOfA.length; i++) {
collectionOfA[i].style.background = "None";
}
$scope.buttonActivator();
};
- function addFileOrFolderToList(nodeName){
+ function addFileOrFolderToList(nodeName) {
var rightClickNode = document.getElementById("rightClick")
var check = 1;
var getFileName = nodeName.getElementsByTagName('td')[0].innerHTML;
- if(nodeName.style.backgroundColor == "aliceblue") {
+ if (nodeName.style.backgroundColor == "aliceblue") {
var tempArray = [];
nodeName.style.background = "None";
- for(var j = 0; j < allFilesAndFolders.length; j++){
- if (allFilesAndFolders[j] != getFileName){
+ for (var j = 0; j < allFilesAndFolders.length; j++) {
+ if (allFilesAndFolders[j] != getFileName) {
tempArray.push(allFilesAndFolders[j]);
}
}
@@ -328,13 +335,13 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
nodeName.style.background = "aliceblue";
- for(var j = 0; j < allFilesAndFolders.length; j++){
- if (allFilesAndFolders[j] === getFileName){
+ for (var j = 0; j < allFilesAndFolders.length; j++) {
+ if (allFilesAndFolders[j] === getFileName) {
check = 0;
break;
}
}
- if(check === 1) {
+ if (check === 1) {
allFilesAndFolders.push(getFileName);
}
@@ -347,17 +354,17 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
/*
- |
- public_html |
- 26KB |
- 26 Oct |
- 775 |
- Folder/File |
+ |
+ public_html |
+ 26KB |
+ 26 Oct |
+ 775 |
+ Folder/File |
*/
- function createTR(fileName,fileSize,lastModified,permissions,dirCheck){
+ function createTR(fileName, fileSize, lastModified, permissions, dirCheck) {
// text nodes are created
var fileNameNode = document.createTextNode(fileName);
@@ -366,19 +373,17 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
var permissionsNode = document.createTextNode(permissions);
-
-
//
var iNodeFolder = document.createElement('i');
- iNodeFolder.setAttribute('class','fa fa-folder');
- iNodeFolder.setAttribute('aria-hidden','true');
+ iNodeFolder.setAttribute('class', 'fa fa-folder');
+ iNodeFolder.setAttribute('aria-hidden', 'true');
iNodeFolder.style.color = "#007bff";
var iNodeFile = document.createElement('i');
- iNodeFile.setAttribute('class','fa fa-file');
- iNodeFile.setAttribute('aria-hidden','true');
+ iNodeFile.setAttribute('class', 'fa fa-file');
+ iNodeFile.setAttribute('aria-hidden', 'true');
iNodeFile.style.color = "#007bff";
//
@@ -395,7 +400,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
var thNode = document.createElement('th');
- thNode.setAttribute('scope','row');
+ thNode.setAttribute('scope', 'row');
//
@@ -411,20 +416,30 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
if (dirCheck == true) {
thNode.appendChild(iNodeFolder);
trNode.appendChild(thNode);
- trNode.addEventListener("dblclick", function(){ $scope.fetchForTableSecondary(firstTDNode,"doubleClick");});
- trNode.addEventListener("click", function(){ addFileOrFolderToList(trNode);});
- trNode.addEventListener("contextmenu", function(event){$scope.rightClickCallBack(event,trNode);});
+ trNode.addEventListener("dblclick", function () {
+ $scope.fetchForTableSecondary(firstTDNode, "doubleClick");
+ });
+ trNode.addEventListener("click", function () {
+ addFileOrFolderToList(trNode);
+ });
+ trNode.addEventListener("contextmenu", function (event) {
+ $scope.rightClickCallBack(event, trNode);
+ });
// Hidden td to represent file or folder
var fileOrFolderNode = document.createTextNode("Folder");
fifthTDNode.appendChild(fileOrFolderNode)
}
- else{
+ else {
thNode.appendChild(iNodeFile);
trNode.appendChild(thNode);
- trNode.addEventListener("click", function(){ addFileOrFolderToList(trNode);});
- trNode.addEventListener("contextmenu", function(event){ $scope.rightClickCallBack(event,trNode); });
+ trNode.addEventListener("click", function () {
+ addFileOrFolderToList(trNode);
+ });
+ trNode.addEventListener("contextmenu", function (event) {
+ $scope.rightClickCallBack(event, trNode);
+ });
// Hidden td to represent file or folder
@@ -448,7 +463,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
$scope.buttonActivator = function () {
// for edit button
- if (allFilesAndFolders.length === 1){
+ if (allFilesAndFolders.length === 1) {
var editNode = document.getElementById("editFile");
editNode.style.pointerEvents = "auto";
@@ -456,28 +471,28 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
var result = findFileExtension(allFilesAndFolders[0]);
- if(result !== undefined){
- if (result[0] === "js"){
+ if (result !== undefined) {
+ if (result[0] === "js") {
aceEditorMode = "ace/mode/javascript";
editNotRight.style.display = "Block";
}
- else if (result[0] === "html"){
+ else if (result[0] === "html") {
aceEditorMode = "ace/mode/html";
editNotRight.style.display = "Block";
}
- else if (result[0] === "css"){
+ else if (result[0] === "css") {
aceEditorMode = "ace/mode/css";
editNotRight.style.display = "Block";
}
- else if (result[0] === "php"){
+ else if (result[0] === "php") {
aceEditorMode = "ace/mode/php";
editNotRight.style.display = "Block";
}
- else if(result[0] === "txt"){
+ else if (result[0] === "txt") {
aceEditorMode = "";
editNotRight.style.display = "Block";
}
- else if(result[0] === "htaccess"){
+ else if (result[0] === "htaccess") {
aceEditorMode = "";
editNotRight.style.display = "Block";
}
@@ -487,20 +502,20 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
editNotRight.style.display = "None";
}
}
- else{
+ else {
var editNode = document.getElementById("editFile");
editNode.style.pointerEvents = "none";
editNotRight.style.display = "None";
}
}
- else{
+ else {
var editNode = document.getElementById("editFile");
editNode.style.pointerEvents = "none";
}
// extraction button
- if (allFilesAndFolders.length === 1){
+ if (allFilesAndFolders.length === 1) {
var extractFileNode = document.getElementById("extractFile");
extractFileNode.style.pointerEvents = "auto";
@@ -508,25 +523,25 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
var result = findFileExtension(allFilesAndFolders[0]);
- if(result !== undefined){
- if (result[0] === "gz"){
+ if (result !== undefined) {
+ if (result[0] === "gz") {
extractFileNode.style.pointerEvents = "auto";
extractNodeRight.style.display = "Block";
}
- else if (result[0] === "zip"){
+ else if (result[0] === "zip") {
extractFileNode.style.pointerEvents = "auto";
extractNodeRight.style.display = "Block";
- }else{
+ } else {
extractFileNode.style.pointerEvents = "none";
extractNodeRight.style.display = "None";
}
}
- else{
+ else {
extractFileNode.style.pointerEvents = "none";
extractNodeRight.style.display = "None";
}
}
- else{
+ else {
var extractFileNode = document.getElementById("extractFile");
extractFileNode.style.pointerEvents = "none";
}
@@ -534,24 +549,24 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
// move button
- if (allFilesAndFolders.length >= 1){
+ if (allFilesAndFolders.length >= 1) {
var moveFileNode = document.getElementById("moveFile");
moveFileNode.style.pointerEvents = "auto";
}
- else{
+ else {
var moveFileNode = document.getElementById("moveFile");
moveFileNode.style.pointerEvents = "none";
}
//copy button
- if (allFilesAndFolders.length >= 1){
+ if (allFilesAndFolders.length >= 1) {
var copeFileNode = document.getElementById("copyFile");
copeFileNode.style.pointerEvents = "auto";
}
- else{
+ else {
var copeFileNode = document.getElementById("copyFile");
copeFileNode.style.pointerEvents = "none";
}
@@ -559,12 +574,12 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
// rename button
- if (allFilesAndFolders.length === 1){
+ if (allFilesAndFolders.length === 1) {
var renameFileNode = document.getElementById("renameFile");
renameFileNode.style.pointerEvents = "auto";
}
- else{
+ else {
var renameFileNode = document.getElementById("renameFile");
renameFileNode.style.pointerEvents = "none";
}
@@ -572,11 +587,11 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
// compress button
- if (allFilesAndFolders.length >= 1){
+ if (allFilesAndFolders.length >= 1) {
var compressFile = document.getElementById("compressFile");
compressFile.style.pointerEvents = "auto";
}
- else{
+ else {
var compressFile = document.getElementById("compressFile");
compressFile.style.pointerEvents = "none";
}
@@ -584,68 +599,64 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
// move button
- if (allFilesAndFolders.length >= 1){
+ if (allFilesAndFolders.length >= 1) {
var deleteFile = document.getElementById("deleteFile");
deleteFile.style.pointerEvents = "auto";
}
- else{
+ else {
var deleteFile = document.getElementById("deleteFile");
deleteFile.style.pointerEvents = "none";
}
-
-
};
$scope.buttonActivator();
// table functions
-
- $scope.fetchForTableSecondary = function(node,functionName) {
+ $scope.fetchForTableSecondary = function (node, functionName) {
allFilesAndFolders = [];
$scope.buttonActivator();
- url = domainName+"/php/fileManager.php";
+ url = domainName + "/php/fileManager.php";
var completePathToFile = "";
- if(functionName === "startPoint"){
+ if (functionName === "startPoint") {
completePathToFile = $scope.currentPath;
}
- else if(functionName==="doubleClick"){
- completePathToFile = $scope.currentPath +"/"+ node.innerHTML;
+ else if (functionName === "doubleClick") {
+ completePathToFile = $scope.currentPath + "/" + node.innerHTML;
}
- else if(functionName==="homeFetch"){
+ else if (functionName === "homeFetch") {
completePathToFile = homePathBack;
}
- else if(functionName === "goBackOnPath"){
+ else if (functionName === "goBackOnPath") {
var pos = $scope.currentPath.lastIndexOf("/");
completePathToFile = $scope.currentPath.slice(0, pos);
}
- else if(functionName === "refresh"){
+ else if (functionName === "refresh") {
completePathToFile = $scope.currentPath;
var rightClickNode = document.getElementById("rightClick");
}
- else if(functionName === "fromTree")
- {
+ else if (functionName === "fromTree") {
completePathToFile = arguments[2];
}
$scope.currentPath = completePathToFile;
var data = {
- completeStartingPath : completePathToFile,
- method : "listForTable",
+ completeStartingPath: completePathToFile,
+ method: "listForTable",
home: homePathBack,
- domainRandomSeed:domainRandomSeed,
+ domainRandomSeed: domainRandomSeed,
domainName: domainName
};
var tableBody = document.getElementById("tableBodyFiles");
var loadingPath = "/static/filemanager/images/loading.gif";
- tableBody.innerHTML = '
';
+ tableBody.innerHTML = '
';
$http.post(url, data).then(ListInitialDatas, cantLoadInitialDatas);
@@ -664,7 +675,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
var keys = Object.keys(filesData);
- for (var i=0; i < keys.length; i++) {
+ for (var i = 0; i < keys.length; i++) {
if (keys[i] === "error_message" | keys[i] === "fetchStatus") {
continue;
}
@@ -675,18 +686,20 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
var permissions = filesData[keys[i]][4];
var dirCheck = filesData[keys[i]][5];
console.log(fileName);
- if(fileName === "..filemanagerkey"){
+ if (fileName === "..filemanagerkey") {
- continue;
+ continue;
}
- tableBody.appendChild(createTR(fileName,fileSize,lastModified,permissions,dirCheck));
+ tableBody.appendChild(createTR(fileName, fileSize, lastModified, permissions, dirCheck));
}
}
}
else {
- var notification = alertify.notify(response.data.error_message, 'error', 10, function(){ console.log('dismissed'); });
- $scope.fetchForTableSecondary(null,'homeFetch');
+ var notification = alertify.notify(response.data.error_message, 'error', 10, function () {
+ console.log('dismissed');
+ });
+ $scope.fetchForTableSecondary(null, 'homeFetch');
}
}
@@ -696,51 +709,50 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
};
- function findFileExtension(fileName){
+ function findFileExtension(fileName) {
return (/[.]/.exec(fileName)) ? /[^.]+$/.exec(fileName) : undefined;
}
// Create entry point for domain
- function createEntryPoint(){
+ function createEntryPoint() {
url = "/filemanager/createTemporaryFile";
- var data = {
- domainName:domainName
- };
+ var data = {
+ domainName: domainName
+ };
- var config = {};
+ var config = {};
- $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
-
-
- function ListInitialDatas(response) {
-
- if(response.data.createTemporaryFile === 1){
- domainRandomSeed = response.data.domainRandomSeed;
- $scope.fetchForTableSecondary(null,"startPoint");
- }
- else
- {
- var notification = alertify.notify(response.data.error_message, 'error', 10, function(){ console.log('dismissed'); });
- }
- }
- function cantLoadInitialDatas(response) {
- var notification = alertify.notify("Could not connec to server, refresh page.", 'error', 10, function(){ console.log('dismissed'); });
- }
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
+ function ListInitialDatas(response) {
+ if (response.data.createTemporaryFile === 1) {
+ domainRandomSeed = response.data.domainRandomSeed;
+ $scope.fetchForTableSecondary(null, "startPoint");
+ }
+ else {
+ var notification = alertify.notify(response.data.error_message, 'error', 10, function () {
+ console.log('dismissed');
+ });
+ }
+ }
+ function cantLoadInitialDatas(response) {
+ var notification = alertify.notify("Could not connec to server, refresh page.", 'error', 10, function () {
+ console.log('dismissed');
+ });
+ }
}
+
createEntryPoint();
-
-
// html editor
$scope.getFileContents = function () {
@@ -749,9 +761,9 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
var data = {
- fileName : completePathForFile,
- method : "readFileContents",
- domainRandomSeed:domainRandomSeed,
+ fileName: completePathForFile,
+ method: "readFileContents",
+ domainRandomSeed: domainRandomSeed,
domainName: domainName
};
@@ -776,6 +788,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
}
}
+
function cantLoadInitialDatas(response) {
}
@@ -790,10 +803,10 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
var completePathForFile = $scope.currentPath + "/" + allFilesAndFolders[0];
var data = {
- fileName : completePathForFile,
- method : "writeFileContents",
+ fileName: completePathForFile,
+ method: "writeFileContents",
fileContent: editor.getValue(),
- domainRandomSeed:domainRandomSeed,
+ domainRandomSeed: domainRandomSeed,
domainName: domainName
};
@@ -814,6 +827,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
}
}
+
function cantLoadInitialDatas(response) {
}
@@ -825,31 +839,31 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
$scope.errorMessage = true;
var uploader = $scope.uploader = new FileUploader({
- url: domainName+"/php/caller.php",
- formData: [ {
+ url: domainName + "/php/caller.php",
+ formData: [{
"method": "upload",
- "home":homePathBack
+ "home": homePathBack
}]
});
- uploader.onCompleteItem = function(fileItem, response, status, headers) {
- if(response.uploadStatus === 1) {
+ uploader.onCompleteItem = function (fileItem, response, status, headers) {
+ if (response.uploadStatus === 1) {
$scope.errorMessage = true;
$scope.fetchForTableSecondary(null, 'refresh');
}
- else{
+ else {
$scope.errorMessage = false;
$scope.fileName = response.fileName;
$scope.error_message = response.error_message;
}
};
- uploader.onAfterAddingFile = function(fileItem) {
+ uploader.onAfterAddingFile = function (fileItem) {
$scope.errorMessage = true;
fileItem.formData.push(
{
- "completePath":$scope.currentPath,
- domainRandomSeed:domainRandomSeed,
+ "completePath": $scope.currentPath,
+ domainRandomSeed: domainRandomSeed,
domainName: domainName
});
@@ -861,7 +875,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
$scope.errorMessageFolder = true;
//
- $scope.showCreateFolderModal = function(){
+ $scope.showCreateFolderModal = function () {
$scope.createSuccess = true;
$scope.errorMessageFolder = true;
$scope.newFolderName = "";
@@ -874,18 +888,17 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
var completePathForFolder = $scope.currentPath + "/" + $scope.newFolderName;
- if($scope.newFolderName.length === 0){
+ if ($scope.newFolderName.length === 0) {
$scope.errorMessageFolder = false;
$scope.error_message = "Please enter folder name!";
return;
}
-
var data = {
- folderName : completePathForFolder,
- method : "createNewFolder",
- domainRandomSeed:domainRandomSeed,
+ folderName: completePathForFolder,
+ method: "createNewFolder",
+ domainRandomSeed: domainRandomSeed,
domainName: domainName
};
@@ -896,7 +909,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
if (response.data.createStatus === 1) {
$scope.createSuccess = false;
- $scope.fetchForTableSecondary(null,'refresh');
+ $scope.fetchForTableSecondary(null, 'refresh');
$('#showCreateFolder').modal('hide');
}
else {
@@ -905,6 +918,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
}
}
+
function cantLoadInitialDatas(response) {
}
@@ -915,7 +929,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
$scope.createSuccess = true;
$scope.errorMessageFile = true;
- $scope.showCreateFileModal = function(){
+ $scope.showCreateFileModal = function () {
$scope.createSuccess = true;
$scope.errorMessageFile = true;
$scope.newFileName = "";
@@ -927,16 +941,16 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
var completePathForFile = $scope.currentPath + "/" + $scope.newFileName;
$scope.errorMessageFile = true;
- if($scope.newFileName.length === 0){
+ if ($scope.newFileName.length === 0) {
$scope.errorMessageFile = false;
$scope.error_message = "Please enter file name!";
return;
}
var data = {
- fileName : completePathForFile,
- method : "createNewFile",
- domainRandomSeed:domainRandomSeed,
+ fileName: completePathForFile,
+ method: "createNewFile",
+ domainRandomSeed: domainRandomSeed,
domainName: domainName
};
@@ -947,7 +961,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
if (response.data.createStatus === 1) {
$scope.createSuccess = false;
- $scope.fetchForTableSecondary(null,'refresh');
+ $scope.fetchForTableSecondary(null, 'refresh');
$('#showCreateFile').modal('hide');
}
else {
@@ -956,6 +970,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
}
}
+
function cantLoadInitialDatas(response) {
}
@@ -968,7 +983,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
$scope.deleteLoading = true;
- $scope.showDeleteModal = function(){
+ $scope.showDeleteModal = function () {
$('#showDelete').modal('show');
};
@@ -977,10 +992,10 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
$scope.deleteLoading = false;
var data = {
- path : $scope.currentPath,
- method : "deleteFolderOrFile",
+ path: $scope.currentPath,
+ method: "deleteFolderOrFile",
fileAndFolders: allFilesAndFolders,
- domainRandomSeed:domainRandomSeed,
+ domainRandomSeed: domainRandomSeed,
domainName: domainName
};
@@ -991,14 +1006,19 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
$scope.deleteLoading = true;
if (response.data.deleteStatus === 1) {
$('#showDelete').modal('hide');
- var notification = alertify.notify('Successfully Deleted!', 'success', 5, function(){ console.log('dismissed'); });
- $scope.fetchForTableSecondary(null,'refresh');
+ var notification = alertify.notify('Successfully Deleted!', 'success', 5, function () {
+ console.log('dismissed');
+ });
+ $scope.fetchForTableSecondary(null, 'refresh');
}
else {
- var notification = alertify.notify('Files/Folders can not be deleted', 'error', 5, function(){ console.log('dismissed'); });
+ var notification = alertify.notify('Files/Folders can not be deleted', 'error', 5, function () {
+ console.log('dismissed');
+ });
}
}
+
function cantLoadInitialDatas(response) {
}
@@ -1009,13 +1029,13 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w
$scope.compressionLoading = true;
- $scope.showCompressionModal = function(){
+ $scope.showCompressionModal = function () {
$('#showCompression').modal('show');
$scope.listOfFiles = "";
$scope.compressedFileName = "";
- for(var i=0;i