mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-01 10:56:23 +01:00
Dedicated Launcher for Child Domains.
This commit is contained in:
11
README.md
11
README.md
@@ -14,6 +14,7 @@ Webhosting control panel that uses OpenLiteSpeed as web server.
|
||||
* PHP Managment.
|
||||
* Firewall.
|
||||
* One click Backup and Restore.
|
||||
* Remote Backups.
|
||||
|
||||
# Supported PHPs
|
||||
|
||||
@@ -23,17 +24,13 @@ Webhosting control panel that uses OpenLiteSpeed as web server.
|
||||
* PHP 5.6
|
||||
* PHP 7.0
|
||||
* PHP 7.1
|
||||
|
||||
* PHP 7.2
|
||||
|
||||
# Installation Instructions
|
||||
|
||||
|
||||
```
|
||||
wget http://cyberpanel.net/install.tar.gz
|
||||
tar zxf install.tar.gz
|
||||
cd install
|
||||
chmod +x install.py
|
||||
python install.py [IP Address]
|
||||
sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/install.sh)
|
||||
```
|
||||
|
||||
# Resources
|
||||
@@ -41,5 +38,5 @@ python install.py [IP Address]
|
||||
* [Official Site.](https://cyberpanel.net)
|
||||
* [Documentation.](https://docs.cyberpanel.net)
|
||||
* [Forums.](https://forums.cyberpanel.net)
|
||||
|
||||
* [Blog.](https://blog.cyberpanel.net)
|
||||
|
||||
|
||||
@@ -256,6 +256,17 @@ milter_default_action = accept
|
||||
writeToFile.close()
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[installOpenDKIM]")
|
||||
|
||||
@staticmethod
|
||||
def restartServices():
|
||||
try:
|
||||
command = 'systemctl restart postfix'
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
command = 'systemctl restart dovecot'
|
||||
subprocess.call(shlex.split(command))
|
||||
except BaseException,msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [restartServices]")
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ from os import listdir, rmdir
|
||||
from shutil import move
|
||||
import randomPassword as randomPassword
|
||||
from mailUtilities import mailUtilities
|
||||
from multiprocessing import Process
|
||||
|
||||
## If you want justice, you have come to the wrong place.
|
||||
|
||||
@@ -555,7 +556,7 @@ class virtualHostUtilities:
|
||||
## OpenBase Dir Protection
|
||||
|
||||
phpIniOverride = "phpIniOverride {\n"
|
||||
php_admin_value = 'php_admin_value open_basedir "/tmp:$VH_ROOT"\n'
|
||||
php_admin_value = 'php_admin_value open_basedir "/tmp:/usr/local/lsws/Example/html/FileManager:$VH_ROOT"\n'
|
||||
endPHPIniOverride = "}\n"
|
||||
|
||||
if openBasedir == 1:
|
||||
@@ -807,14 +808,20 @@ class virtualHostUtilities:
|
||||
return [int(0), int(0)]
|
||||
|
||||
@staticmethod
|
||||
def addRewriteRules(virtualHostName):
|
||||
def addRewriteRules(virtualHostName, fileName = None):
|
||||
|
||||
try:
|
||||
path = virtualHostUtilities.Server_root + "/conf/vhosts/" + virtualHostName + "/vhost.conf"
|
||||
|
||||
data = open(path, "r").readlines()
|
||||
|
||||
dataToWritten = "rewriteFile /home/"+virtualHostName+"/public_html/.htaccess"+"\n"
|
||||
if fileName == None:
|
||||
dataToWritten = "rewriteFile /home/"+virtualHostName+"/public_html/.htaccess"+"\n"
|
||||
else:
|
||||
dataToWritten = "rewriteFile " + fileName + "\n"
|
||||
|
||||
|
||||
|
||||
|
||||
### Data if re-writes are not already enabled
|
||||
|
||||
@@ -1236,7 +1243,7 @@ def saveVHostConfigs(fileName,tempPath):
|
||||
def saveRewriteRules(virtualHost,fileName,tempPath):
|
||||
try:
|
||||
|
||||
virtualHostUtilities.addRewriteRules(virtualHost)
|
||||
virtualHostUtilities.addRewriteRules(virtualHost, fileName)
|
||||
|
||||
vhost = open(fileName, "w")
|
||||
|
||||
@@ -1702,11 +1709,8 @@ def issueSSLForMailServer(virtualHost,path):
|
||||
|
||||
writeFile.close()
|
||||
|
||||
command = 'systemctl restart postfix'
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
command = 'systemctl restart dovecot'
|
||||
subprocess.call(shlex.split(command))
|
||||
p = Process(target=mailUtilities.restartServices, args=('restart',))
|
||||
p.start()
|
||||
|
||||
print "1,None"
|
||||
|
||||
|
||||
@@ -2867,3 +2867,975 @@ app.controller('manageAliasController', function($scope,$http, $timeout, $window
|
||||
|
||||
|
||||
/* Java script code to manage cron ends here */
|
||||
|
||||
app.controller('launchChild', function($scope,$http) {
|
||||
|
||||
$scope.logFileLoading = true;
|
||||
$scope.logsFeteched = true;
|
||||
$scope.couldNotFetchLogs = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.fetchedData = true;
|
||||
$scope.hideLogs = true;
|
||||
$scope.hideErrorLogs = true;
|
||||
|
||||
$scope.hidelogsbtn = function(){
|
||||
$scope.hideLogs = true;
|
||||
};
|
||||
|
||||
$scope.hideErrorLogsbtn = function(){
|
||||
$scope.hideLogs = true;
|
||||
};
|
||||
|
||||
$scope.fileManagerURL = "/filemanager/"+$("#domainNamePage").text();
|
||||
$scope.previewUrl = "/preview/"+$("#childDomain").text()+"/";
|
||||
|
||||
var logType = 0;
|
||||
$scope.pageNumber = 1;
|
||||
|
||||
$scope.fetchLogs = function(type){
|
||||
|
||||
var pageNumber = $scope.pageNumber;
|
||||
|
||||
|
||||
if(type==3){
|
||||
pageNumber = $scope.pageNumber+1;
|
||||
$scope.pageNumber = pageNumber;
|
||||
}
|
||||
else if(type==4){
|
||||
pageNumber = $scope.pageNumber-1;
|
||||
$scope.pageNumber = pageNumber;
|
||||
}
|
||||
else{
|
||||
logType = type;
|
||||
}
|
||||
|
||||
|
||||
$scope.logFileLoading = false;
|
||||
$scope.logsFeteched = true;
|
||||
$scope.couldNotFetchLogs = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.fetchedData = false;
|
||||
$scope.hideErrorLogs = true;
|
||||
|
||||
|
||||
|
||||
url = "/websites/getDataFromLogFile";
|
||||
|
||||
var domainNamePage = $("#domainNamePage").text();
|
||||
|
||||
|
||||
var data = {
|
||||
logType: logType,
|
||||
virtualHost:domainNamePage,
|
||||
page:pageNumber,
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers : {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.logstatus == 1){
|
||||
|
||||
|
||||
$scope.logFileLoading = true;
|
||||
$scope.logsFeteched = false;
|
||||
$scope.couldNotFetchLogs = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.fetchedData = false;
|
||||
$scope.hideLogs = false;
|
||||
|
||||
|
||||
$scope.records = JSON.parse(response.data.data);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
$scope.logFileLoading = true;
|
||||
$scope.logsFeteched = true;
|
||||
$scope.couldNotFetchLogs = false;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.fetchedData = true;
|
||||
$scope.hideLogs = false;
|
||||
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
console.log(domainNamePage)
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.logFileLoading = true;
|
||||
$scope.logsFeteched = true;
|
||||
$scope.couldNotFetchLogs = true;
|
||||
$scope.couldNotConnect = false;
|
||||
$scope.fetchedData = true;
|
||||
$scope.hideLogs = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
$scope.errorPageNumber = 1;
|
||||
|
||||
|
||||
$scope.fetchErrorLogs = function(type){
|
||||
|
||||
var errorPageNumber = $scope.errorPageNumber;
|
||||
|
||||
|
||||
if(type==3){
|
||||
errorPageNumber = $scope.errorPageNumber+1;
|
||||
$scope.errorPageNumber = errorPageNumber;
|
||||
}
|
||||
else if(type==4){
|
||||
errorPageNumber = $scope.errorPageNumber-1;
|
||||
$scope.errorPageNumber = errorPageNumber;
|
||||
}
|
||||
else{
|
||||
logType = type;
|
||||
}
|
||||
|
||||
// notifications
|
||||
|
||||
$scope.logFileLoading = false;
|
||||
$scope.logsFeteched = true;
|
||||
$scope.couldNotFetchLogs = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.fetchedData = true;
|
||||
$scope.hideErrorLogs = true;
|
||||
$scope.hideLogs = false;
|
||||
|
||||
|
||||
|
||||
url = "/websites/fetchErrorLogs";
|
||||
|
||||
var domainNamePage = $("#domainNamePage").text();
|
||||
|
||||
|
||||
var data = {
|
||||
virtualHost:domainNamePage,
|
||||
page:errorPageNumber,
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers : {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.logstatus == 1){
|
||||
|
||||
|
||||
// notifications
|
||||
|
||||
$scope.logFileLoading = true;
|
||||
$scope.logsFeteched = false;
|
||||
$scope.couldNotFetchLogs = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.fetchedData = true;
|
||||
$scope.hideLogs = false;
|
||||
$scope.hideErrorLogs = false;
|
||||
|
||||
|
||||
$scope.errorLogsData = response.data.data;
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
// notifications
|
||||
|
||||
$scope.logFileLoading = true;
|
||||
$scope.logsFeteched = true;
|
||||
$scope.couldNotFetchLogs = false;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.fetchedData = true;
|
||||
$scope.hideLogs = true;
|
||||
$scope.hideErrorLogs = true;
|
||||
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
// notifications
|
||||
|
||||
$scope.logFileLoading = true;
|
||||
$scope.logsFeteched = true;
|
||||
$scope.couldNotFetchLogs = true;
|
||||
$scope.couldNotConnect = false;
|
||||
$scope.fetchedData = true;
|
||||
$scope.hideLogs = true;
|
||||
$scope.hideErrorLogs = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
///////// Configurations Part
|
||||
|
||||
$scope.configurationsBox = true;
|
||||
$scope.configsFetched = true;
|
||||
$scope.couldNotFetchConfigs = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.fetchedConfigsData = true;
|
||||
$scope.configFileLoading = true;
|
||||
$scope.configSaved = true;
|
||||
$scope.couldNotSaveConfigurations = true;
|
||||
|
||||
$scope.hideconfigbtn = function(){
|
||||
|
||||
$scope.configurationsBox = true;
|
||||
};
|
||||
|
||||
$scope.fetchConfigurations = function(){
|
||||
|
||||
|
||||
$scope.hidsslconfigs = true;
|
||||
$scope.configurationsBoxRewrite = true;
|
||||
$scope.changePHPView = true;
|
||||
|
||||
|
||||
//Rewrite rules
|
||||
$scope.configurationsBoxRewrite = true;
|
||||
$scope.rewriteRulesFetched = true;
|
||||
$scope.couldNotFetchRewriteRules = true;
|
||||
$scope.rewriteRulesSaved = true;
|
||||
$scope.couldNotSaveRewriteRules = true;
|
||||
$scope.fetchedRewriteRules = true;
|
||||
$scope.saveRewriteRulesBTN = true;
|
||||
|
||||
///
|
||||
|
||||
$scope.configFileLoading = false;
|
||||
|
||||
|
||||
|
||||
url = "/websites/getDataFromConfigFile";
|
||||
|
||||
var virtualHost = $("#childDomain").text();
|
||||
|
||||
|
||||
|
||||
var data = {
|
||||
virtualHost: virtualHost,
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers : {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.configstatus === 1){
|
||||
|
||||
//Rewrite rules
|
||||
|
||||
$scope.configurationsBoxRewrite = true;
|
||||
$scope.rewriteRulesFetched = true;
|
||||
$scope.couldNotFetchRewriteRules = true;
|
||||
$scope.rewriteRulesSaved = true;
|
||||
$scope.couldNotSaveRewriteRules = true;
|
||||
$scope.fetchedRewriteRules = true;
|
||||
$scope.saveRewriteRulesBTN = true;
|
||||
|
||||
///
|
||||
|
||||
$scope.configurationsBox = false;
|
||||
$scope.configsFetched = false;
|
||||
$scope.couldNotFetchConfigs = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.fetchedConfigsData = false;
|
||||
$scope.configFileLoading = true;
|
||||
$scope.configSaved = true;
|
||||
$scope.couldNotSaveConfigurations = true;
|
||||
$scope.saveConfigBtn = false;
|
||||
|
||||
|
||||
|
||||
$scope.configData = response.data.configData;
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
//Rewrite rules
|
||||
$scope.configurationsBoxRewrite = true;
|
||||
$scope.rewriteRulesFetched = true;
|
||||
$scope.couldNotFetchRewriteRules = true;
|
||||
$scope.rewriteRulesSaved = true;
|
||||
$scope.couldNotSaveRewriteRules = true;
|
||||
$scope.fetchedRewriteRules = true;
|
||||
$scope.saveRewriteRulesBTN = true;
|
||||
|
||||
///
|
||||
$scope.configurationsBox = false;
|
||||
$scope.configsFetched = true;
|
||||
$scope.couldNotFetchConfigs = false;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.fetchedConfigsData = true;
|
||||
$scope.configFileLoading = true;
|
||||
$scope.configSaved = true;
|
||||
$scope.couldNotSaveConfigurations = true;
|
||||
|
||||
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
//Rewrite rules
|
||||
$scope.configurationsBoxRewrite = true;
|
||||
$scope.rewriteRulesFetched = true;
|
||||
$scope.couldNotFetchRewriteRules = true;
|
||||
$scope.rewriteRulesSaved = true;
|
||||
$scope.couldNotSaveRewriteRules = true;
|
||||
$scope.fetchedRewriteRules = true;
|
||||
$scope.saveRewriteRulesBTN = true;
|
||||
///
|
||||
|
||||
$scope.configurationsBox = false;
|
||||
$scope.configsFetched = true;
|
||||
$scope.couldNotFetchConfigs = true;
|
||||
$scope.couldNotConnect = false;
|
||||
$scope.fetchedConfigsData = true;
|
||||
$scope.configFileLoading = true;
|
||||
$scope.configSaved = true;
|
||||
$scope.couldNotSaveConfigurations = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
$scope.saveCongiruations = function(){
|
||||
|
||||
$scope.configFileLoading = false;
|
||||
|
||||
|
||||
|
||||
url = "/websites/saveConfigsToFile";
|
||||
|
||||
var virtualHost = $("#childDomain").text();
|
||||
var configData = $scope.configData;
|
||||
|
||||
|
||||
|
||||
var data = {
|
||||
virtualHost: virtualHost,
|
||||
configData:configData,
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers : {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.configstatus == 1){
|
||||
|
||||
$scope.configurationsBox = false;
|
||||
$scope.configsFetched = true;
|
||||
$scope.couldNotFetchConfigs = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.fetchedConfigsData = true;
|
||||
$scope.configFileLoading = true;
|
||||
$scope.configSaved = false;
|
||||
$scope.couldNotSaveConfigurations = true;
|
||||
$scope.saveConfigBtn = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$scope.configurationsBox = false;
|
||||
$scope.configsFetched = true;
|
||||
$scope.couldNotFetchConfigs = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.fetchedConfigsData = false;
|
||||
$scope.configFileLoading = true;
|
||||
$scope.configSaved = true;
|
||||
$scope.couldNotSaveConfigurations = false;
|
||||
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.configurationsBox = false;
|
||||
$scope.configsFetched = true;
|
||||
$scope.couldNotFetchConfigs = true;
|
||||
$scope.couldNotConnect = false;
|
||||
$scope.fetchedConfigsData = true;
|
||||
$scope.configFileLoading = true;
|
||||
$scope.configSaved = true;
|
||||
$scope.couldNotSaveConfigurations = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
///////// Rewrite Rules
|
||||
|
||||
$scope.configurationsBoxRewrite = true;
|
||||
$scope.rewriteRulesFetched = true;
|
||||
$scope.couldNotFetchRewriteRules = true;
|
||||
$scope.rewriteRulesSaved = true;
|
||||
$scope.couldNotSaveRewriteRules = true;
|
||||
$scope.fetchedRewriteRules = true;
|
||||
$scope.saveRewriteRulesBTN = true;
|
||||
|
||||
$scope.hideRewriteRulesbtn = function() {
|
||||
$scope.configurationsBoxRewrite = true;
|
||||
};
|
||||
|
||||
|
||||
$scope.fetchRewriteFules = function(){
|
||||
|
||||
$scope.hidsslconfigs = true;
|
||||
$scope.configurationsBox = true;
|
||||
$scope.changePHPView = true;
|
||||
|
||||
|
||||
$scope.configurationsBox = true;
|
||||
$scope.configsFetched = true;
|
||||
$scope.couldNotFetchConfigs = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.fetchedConfigsData = true;
|
||||
$scope.configFileLoading = true;
|
||||
$scope.configSaved = true;
|
||||
$scope.couldNotSaveConfigurations = true;
|
||||
$scope.saveConfigBtn = true;
|
||||
|
||||
$scope.configFileLoading = false;
|
||||
|
||||
|
||||
|
||||
url = "/websites/getRewriteRules";
|
||||
|
||||
var virtualHost = $("#childDomain").text();
|
||||
|
||||
|
||||
|
||||
var data = {
|
||||
virtualHost: virtualHost,
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers : {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.rewriteStatus == 1){
|
||||
|
||||
|
||||
// from main
|
||||
|
||||
$scope.configurationsBox = true;
|
||||
$scope.configsFetched = true;
|
||||
$scope.couldNotFetchConfigs = true;
|
||||
$scope.fetchedConfigsData = true;
|
||||
$scope.configSaved = true;
|
||||
$scope.couldNotSaveConfigurations = true;
|
||||
$scope.saveConfigBtn = true;
|
||||
|
||||
// main ends
|
||||
|
||||
$scope.configFileLoading = true;
|
||||
|
||||
//
|
||||
|
||||
|
||||
$scope.configurationsBoxRewrite = false;
|
||||
$scope.rewriteRulesFetched = false;
|
||||
$scope.couldNotFetchRewriteRules = true;
|
||||
$scope.rewriteRulesSaved = true;
|
||||
$scope.couldNotSaveRewriteRules = true;
|
||||
$scope.fetchedRewriteRules = false;
|
||||
$scope.saveRewriteRulesBTN = false;
|
||||
$scope.couldNotConnect = true;
|
||||
|
||||
|
||||
|
||||
$scope.rewriteRules = response.data.rewriteRules;
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// from main
|
||||
$scope.configurationsBox = true;
|
||||
$scope.configsFetched = true;
|
||||
$scope.couldNotFetchConfigs = true;
|
||||
$scope.fetchedConfigsData = true;
|
||||
$scope.configFileLoading = true;
|
||||
$scope.configSaved = true;
|
||||
$scope.couldNotSaveConfigurations = true;
|
||||
$scope.saveConfigBtn = true;
|
||||
// from main
|
||||
|
||||
$scope.configFileLoading = true;
|
||||
|
||||
///
|
||||
|
||||
$scope.configurationsBoxRewrite = true;
|
||||
$scope.rewriteRulesFetched = true;
|
||||
$scope.couldNotFetchRewriteRules = false;
|
||||
$scope.rewriteRulesSaved = true;
|
||||
$scope.couldNotSaveRewriteRules = true;
|
||||
$scope.fetchedRewriteRules = true;
|
||||
$scope.saveRewriteRulesBTN = true;
|
||||
$scope.couldNotConnect = true;
|
||||
|
||||
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function cantLoadInitialDatas(response) {
|
||||
// from main
|
||||
|
||||
$scope.configurationsBox = true;
|
||||
$scope.configsFetched = true;
|
||||
$scope.couldNotFetchConfigs = true;
|
||||
$scope.fetchedConfigsData = true;
|
||||
$scope.configFileLoading = true;
|
||||
$scope.configSaved = true;
|
||||
$scope.couldNotSaveConfigurations = true;
|
||||
$scope.saveConfigBtn = true;
|
||||
|
||||
// from main
|
||||
|
||||
$scope.configFileLoading = true;
|
||||
|
||||
///
|
||||
|
||||
$scope.configurationsBoxRewrite = true;
|
||||
$scope.rewriteRulesFetched = true;
|
||||
$scope.couldNotFetchRewriteRules = true;
|
||||
$scope.rewriteRulesSaved = true;
|
||||
$scope.couldNotSaveRewriteRules = true;
|
||||
$scope.fetchedRewriteRules = true;
|
||||
$scope.saveRewriteRulesBTN = true;
|
||||
|
||||
$scope.couldNotConnect = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
$scope.saveRewriteRules = function(){
|
||||
|
||||
$scope.configFileLoading = false;
|
||||
|
||||
|
||||
|
||||
url = "/websites/saveRewriteRules";
|
||||
|
||||
var virtualHost = $("#childDomain").text();
|
||||
var rewriteRules = $scope.rewriteRules;
|
||||
|
||||
|
||||
|
||||
var data = {
|
||||
virtualHost: virtualHost,
|
||||
rewriteRules:rewriteRules,
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers : {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.rewriteStatus == 1){
|
||||
|
||||
$scope.configurationsBoxRewrite = false;
|
||||
$scope.rewriteRulesFetched = true;
|
||||
$scope.couldNotFetchRewriteRules = true;
|
||||
$scope.rewriteRulesSaved = false;
|
||||
$scope.couldNotSaveRewriteRules = true;
|
||||
$scope.fetchedRewriteRules = true;
|
||||
$scope.saveRewriteRulesBTN = true;
|
||||
$scope.configFileLoading = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$scope.configurationsBoxRewrite = false;
|
||||
$scope.rewriteRulesFetched = false;
|
||||
$scope.couldNotFetchRewriteRules = true;
|
||||
$scope.rewriteRulesSaved = true;
|
||||
$scope.couldNotSaveRewriteRules = false;
|
||||
$scope.fetchedRewriteRules = true;
|
||||
$scope.saveRewriteRulesBTN = false;
|
||||
|
||||
$scope.configFileLoading = true;
|
||||
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.configurationsBoxRewrite = false;
|
||||
$scope.rewriteRulesFetched = false;
|
||||
$scope.couldNotFetchRewriteRules = true;
|
||||
$scope.rewriteRulesSaved = true;
|
||||
$scope.couldNotSaveRewriteRules = true;
|
||||
$scope.fetchedRewriteRules = true;
|
||||
$scope.saveRewriteRulesBTN = false;
|
||||
|
||||
$scope.configFileLoading = true;
|
||||
|
||||
$scope.couldNotConnect = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
//////// SSL Part
|
||||
|
||||
$scope.sslSaved = true;
|
||||
$scope.couldNotSaveSSL = true;
|
||||
$scope.hidsslconfigs = true;
|
||||
$scope.couldNotConnect = true;
|
||||
|
||||
|
||||
$scope.hidesslbtn = function(){
|
||||
$scope.hidsslconfigs = true;
|
||||
};
|
||||
|
||||
$scope.addSSL = function(){
|
||||
$scope.hidsslconfigs = false;
|
||||
$scope.configurationsBox = true;
|
||||
$scope.configurationsBoxRewrite = true;
|
||||
$scope.changePHPView = true;
|
||||
};
|
||||
|
||||
|
||||
$scope.saveSSL = function(){
|
||||
|
||||
|
||||
$scope.configFileLoading = false;
|
||||
|
||||
url = "/websites/saveSSL";
|
||||
|
||||
var virtualHost = $("#childDomain").text();
|
||||
var cert = $scope.cert;
|
||||
var key = $scope.key;
|
||||
|
||||
|
||||
|
||||
var data = {
|
||||
virtualHost: virtualHost,
|
||||
cert:cert,
|
||||
key:key,
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers : {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.sslStatus == 1){
|
||||
|
||||
$scope.sslSaved = false;
|
||||
$scope.couldNotSaveSSL = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.configFileLoading = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
$scope.sslSaved = true;
|
||||
$scope.couldNotSaveSSL = false;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.configFileLoading = true;
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.sslSaved = true;
|
||||
$scope.couldNotSaveSSL = true;
|
||||
$scope.couldNotConnect = false;
|
||||
$scope.configFileLoading = true;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//// 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:$("#childDomain").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 = $("#childDomain").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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Open_basedir protection
|
||||
|
||||
$scope.baseDirLoading = true;
|
||||
$scope.operationFailed = true;
|
||||
$scope.operationSuccessfull = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.openBaseDirBox = true;
|
||||
|
||||
|
||||
$scope.openBaseDirView = function(){
|
||||
$scope.openBaseDirBox = false;
|
||||
};
|
||||
|
||||
$scope.hideOpenBasedir = function () {
|
||||
$scope.openBaseDirBox = true;
|
||||
};
|
||||
|
||||
$scope.applyOpenBasedirChanges = function(childDomain,phpSelection){
|
||||
|
||||
// notifcations
|
||||
|
||||
$scope.baseDirLoading = false;
|
||||
$scope.operationFailed = true;
|
||||
$scope.operationSuccessfull = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.openBaseDirBox = false;
|
||||
|
||||
|
||||
var url = "/websites/changeOpenBasedir";
|
||||
|
||||
var data = {
|
||||
domainName:$("#childDomain").text(),
|
||||
openBasedirValue:$scope.openBasedirValue
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers : {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
|
||||
if(response.data.changeOpenBasedir === 1){
|
||||
|
||||
$scope.baseDirLoading = true;
|
||||
$scope.operationFailed = true;
|
||||
$scope.operationSuccessfull = false;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.openBaseDirBox = false;
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
$scope.baseDirLoading = true;
|
||||
$scope.operationFailed = false;
|
||||
$scope.operationSuccessfull = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.openBaseDirBox = false;
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.baseDirLoading = true;
|
||||
$scope.operationFailed = true;
|
||||
$scope.operationSuccessfull = true;
|
||||
$scope.couldNotConnect = false;
|
||||
$scope.openBaseDirBox = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
672
websiteFunctions/templates/websiteFunctions/launchChild.html
Normal file
672
websiteFunctions/templates/websiteFunctions/launchChild.html
Normal file
@@ -0,0 +1,672 @@
|
||||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{{ childDomain }} - CyberPanel{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
|
||||
<div ng-controller="launchChild" class="container">
|
||||
|
||||
<div id="page-title">
|
||||
<h2 ><span id="childDomain">{{ childDomain }}</span><span style="display: none" id="domainNamePage">{{ domain }}</span> - <a target="_blank" href="{$ previewUrl $}" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "Preview" %}</span></a></h2>
|
||||
<p>{% trans "All functions related to a particular site." %}</p>
|
||||
</div>
|
||||
|
||||
{% if not error %}
|
||||
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
<div style="border-radius: 25px;border-color:#3498db" class="content-box">
|
||||
|
||||
<h3 class="content-box-header bg-blue">
|
||||
{% trans "Resource Usage" %}
|
||||
</h3>
|
||||
|
||||
|
||||
<div class="content-box-wrapper">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-6">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans "Resource" %}</th>
|
||||
<th>{% trans "Usage" %}</th>
|
||||
<th>{% trans "Allowed" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>{% trans "FTP" %}</code></td>
|
||||
<td><span class="bs-badge badge-success">{{ ftpUsed }}</span></td>
|
||||
<td><span class="bs-badge badge-success">{{ ftpTotal }}</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>{% trans "Databases" %}</code></td>
|
||||
<td><span class="bs-badge badge-success">{{ databasesUsed }}</span></td>
|
||||
<td><span class="bs-badge badge-success">{{ databasesTotal }}</span></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td><code>{% trans "Disk Usage" %}</code></td>
|
||||
<td><span class="bs-badge badge-success">{{ diskInMB }} (MB)</span></td>
|
||||
<td><span class="bs-badge badge-success">{{ diskInMBTotal }} (MB)</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>{% trans "Bandwidth Usage" %}</code></td>
|
||||
<td><span class="bs-badge badge-success">{{ bwInMB }} (MB)</span></td>
|
||||
<td><span class="bs-badge badge-success">{{ bwInMBTotal }} (MB)</span></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="panel">
|
||||
<div class="panel-body">
|
||||
<div class="example-box-wrapper">
|
||||
<h3 class="title-hero">
|
||||
{% trans "Disk Usage" %}
|
||||
</h3>
|
||||
<div class="progressbar" data-value="{{ diskUsage }}">
|
||||
<div class="progressbar-value bg-primary">
|
||||
<div class="progress-overlay"></div>
|
||||
<div class="progress-label">{{ diskUsage }}%</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<h3 class="title-hero">
|
||||
{% trans "Bandwidth Usage" %}
|
||||
</h3>
|
||||
<div class="progressbar" data-value="{{ bwUsage }}">
|
||||
<div class="progressbar-value bg-primary">
|
||||
<div class="progress-overlay"></div>
|
||||
<div class="progress-label">{{ bwUsage }}%</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
<div style="border-radius: 25px;border-color:#3498db" class="content-box">
|
||||
<h3 class="content-box-header bg-blue">
|
||||
{% trans "Logs" %} <img ng-hide="logFileLoading" src="/static/images/loading.gif">
|
||||
</h3>
|
||||
|
||||
<div class="content-box-wrapper">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-6" style="margin-bottom: 2%;">
|
||||
<a ng-click="fetchLogs(1)" href="" title="{% trans 'Load Access Logs' %}">
|
||||
<img src="{% static 'images/icons/log-file-format.png' %}">
|
||||
</a>
|
||||
<a ng-click="fetchLogs(1)" href="" title="{% trans 'Load Access Logs' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "Access Logs" %}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-6" style="margin-bottom: 2%;">
|
||||
<a ng-click="fetchErrorLogs(1)" href="" title="{% trans 'Load Error Logs' %}">
|
||||
<img src="{% static 'images/icons/warning.png' %}">
|
||||
</a>
|
||||
<a ng-click="fetchErrorLogs(1)" href="" title="{% trans 'Load Error Logs' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "Error Logs" %}</span>
|
||||
</a>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-12">
|
||||
|
||||
<form ng-hide="hideLogs" class="form-horizontal bordered-row">
|
||||
|
||||
<div ng-hide="logsFeteched" class="alert alert-success">
|
||||
<p>{% trans "Logs Fetched" %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="couldNotFetchLogs" class="alert alert-danger">
|
||||
<p>{% trans "Could not fetch logs, see the logs file through command line. Error message:" %} {$ errorMessage $}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="couldNotConnect" class="alert alert-danger">
|
||||
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div ng-hide="fetchedData" class="form-group">
|
||||
|
||||
<div class="col-sm-3">
|
||||
<input placeholder="Search..." ng-model="logSearch" name="dom" type="text" class="form-control" ng-model="domainNameCreate" required>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-2">
|
||||
<input placeholder="Page Number" type="number" class="form-control" ng-model="pageNumber" required>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<button ng-click="fetchLogs(3)" type="button" class="btn ra-100 btn-purple">{% trans "Next" %}</button>
|
||||
<button ng-click="fetchLogs(4)" type="button" class="btn ra-100 btn-purple">{% trans "Previous" %}</button>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 1%;" class=" col-sm-1">
|
||||
<a ng-click="hidelogsbtn()" href=""><img src="/static/images/close-32.png"></a>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Domain</th>
|
||||
<th>IP Address</th>
|
||||
<th>Time</th>
|
||||
<th>Resource</th>
|
||||
<th>Size</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="record in records | filter:logSearch">
|
||||
<td ng-bind="record.domain"></td>
|
||||
<td ng-bind="record.ipAddress"></td>
|
||||
<td ng-bind="record.time"></td>
|
||||
<td ng-bind="record.resource"></td>
|
||||
<td ng-bind="record.size"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="hideErrorLogs" class="form-group">
|
||||
|
||||
<div class="col-sm-2">
|
||||
<input placeholder="Page Number" type="number" class="form-control" ng-model="errorPageNumber" required>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-9">
|
||||
<button ng-click="fetchErrorLogs(3)" type="button" class="btn ra-100 btn-purple">{% trans "Next" %}</button>
|
||||
<button ng-click="fetchErrorLogs(4)" type="button" class="btn ra-100 btn-purple">{% trans "Previous" %}</button>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 1%;" class=" col-sm-1">
|
||||
<a ng-click="hideErrorLogsbtn()" href=""><img src="/static/images/close-32.png"></a>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12">
|
||||
<textarea ng-model="errorLogsData" rows="25" class="form-control"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
<div style="border-radius: 25px;border-color:#3498db" class="content-box" style="margin-bottom: 2%;">
|
||||
<h3 class="content-box-header bg-blue">
|
||||
{% trans "Configurations" %} <img ng-hide="configFileLoading" src="/static/images/loading.gif">
|
||||
</h3>
|
||||
|
||||
|
||||
<div class="content-box-wrapper">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-3" style="margin-bottom: 2%;">
|
||||
|
||||
<a ng-click="fetchConfigurations()" href="" title="{% trans 'Edit vHost Main Configurations' %}">
|
||||
<img src="{% static 'images/icons/file.png' %}">
|
||||
</a>
|
||||
<a ng-click="fetchConfigurations()" href="" title="{% trans 'Edit vHost Main Configurations' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "vHost Conf" %}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-3" style="margin-bottom: 2%;">
|
||||
|
||||
<a ng-click="fetchRewriteFules()" href="" title="{% trans 'Add Rewrite Rules (.htaccess)' %}">
|
||||
<img src="{% static 'images/icons/pencilcase.png' %}">
|
||||
</a>
|
||||
<a ng-click="fetchRewriteFules()" href="" title="{% trans 'Rewrite Rules (.htaccess)' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "Rewrite Rules" %}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-3" style="margin-bottom: 2%;">
|
||||
|
||||
<a ng-click="addSSL()" href="" title="{% trans 'Add Your Own SSL' %}">
|
||||
<img src="{% static 'images/icons/locked.png' %}">
|
||||
</a>
|
||||
<a ng-click="addSSL()" href="" title="{% trans 'Add Your Own SSL' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "Add SSL" %}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-3" style="margin-bottom: 2%;">
|
||||
|
||||
<a ng-click="changePHPMaster()" href="" title="{% trans 'Change PHP Version' %}">
|
||||
<img src="{% static 'images/icons/laptop.png' %}">
|
||||
</a>
|
||||
<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>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<!---- HTML for main ssl file ---->
|
||||
|
||||
<div class="col-md-12">
|
||||
|
||||
<form ng-hide="hidsslconfigs" class="form-horizontal bordered-row">
|
||||
|
||||
<div ng-hide="sslSaved" class="alert alert-success">
|
||||
<p>{% trans "SSL Saved" %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="couldNotSaveSSL" class="alert alert-danger">
|
||||
<p>{% trans "Could not save SSL. Error message:" %} {$ errorMessage $}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="couldNotConnect" class="alert alert-danger">
|
||||
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="" class="form-group">
|
||||
<div style="margin-bottom: 1%;" class="col-sm-offset-11 col-sm-1">
|
||||
<a ng-click="hidesslbtn()" href=""><img src="/static/images/close-32.png"></a>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<textarea placeholder="Paste Your Cert" ng-model="cert" rows="10" class="form-control"></textarea>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<textarea placeholder="Paste Your Key" ng-model="key" rows="10" class="form-control"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-click="saveSSL()" class="btn btn-primary btn-lg btn-block">{% trans "Save" %}</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!----- HTML For SSL ---->
|
||||
|
||||
|
||||
<!---- HTML for main conf file ---->
|
||||
|
||||
<div class="col-md-12">
|
||||
|
||||
<form ng-hide="configurationsBox" class="form-horizontal bordered-row">
|
||||
|
||||
<div ng-hide="configsFetched" class="alert alert-success">
|
||||
<p>{% trans "Current configuration in the file fetched." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="couldNotFetchConfigs" class="alert alert-danger">
|
||||
<p>{% trans "Could not fetch current configuration. Error message:" %} {$ errorMessage $}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="couldNotConnect" class="alert alert-danger">
|
||||
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
|
||||
</div>
|
||||
|
||||
<div ng-hide="configSaved" class="alert alert-success">
|
||||
<p>{% trans "Configurations saved." %}</p>
|
||||
</div>
|
||||
|
||||
<div ng-hide="couldNotSaveConfigurations" class="alert alert-danger">
|
||||
<p>{% trans "Could not fetch current configuration. Error message:" %} {$ errorMessage $}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="fetchedConfigsData" class="form-group">
|
||||
<div style="margin-bottom: 1%;" class="col-sm-offset-11 col-sm-1">
|
||||
<a ng-click="hideconfigbtn()" href=""><img src="/static/images/close-32.png"></a>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<textarea ng-model="configData" rows="20" class="form-control"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="saveConfigBtn" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-click="saveCongiruations()" class="btn btn-primary btn-lg btn-block">{% trans "Save" %}</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- HTML For rewrite rules-->
|
||||
|
||||
<div class="col-md-12">
|
||||
|
||||
<form ng-hide="configurationsBoxRewrite" class="form-horizontal bordered-row">
|
||||
|
||||
|
||||
<div ng-hide="rewriteRulesFetched" class="alert alert-success">
|
||||
<p>{% trans "Current rewrite rules in the file fetched." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="couldNotFetchRewriteRules" class="alert alert-danger">
|
||||
<p>{% trans "Could not fetch current rewrite rules. Error message:" %} {$ errorMessage $}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="couldNotConnect" class="alert alert-danger">
|
||||
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
|
||||
</div>
|
||||
|
||||
<div ng-hide="rewriteRulesSaved" class="alert alert-success">
|
||||
<p>{% trans "Configurations saved." %}</p>
|
||||
</div>
|
||||
|
||||
<div ng-hide="couldNotSaveRewriteRules" class="alert alert-danger">
|
||||
<p>{% trans "Could not save rewrite rules. Error message:" %} {$ errorMessage $}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="fetchedRewriteRules" class="form-group">
|
||||
<div style="margin-bottom: 1%;" class="col-sm-offset-11 col-sm-1">
|
||||
<a ng-click="hideRewriteRulesbtn()" href=""><img src="/static/images/close-32.png"></a>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<textarea ng-model="rewriteRules" rows="10" class="form-control"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="saveRewriteRulesBTN" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-click="saveRewriteRules()" class="btn btn-primary btn-lg btn-block">{% trans "Save Rewrite Rules" %}</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</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>
|
||||
<option>PHP 7.2</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>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
<div style="border-radius: 25px;border-color:#3498db" class="content-box">
|
||||
<h3 class="content-box-header bg-blue">
|
||||
{% trans "Files" %}
|
||||
</h3>
|
||||
|
||||
<div class="content-box-wrapper">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-3" style="margin-bottom: 2%;">
|
||||
|
||||
<a href="{$ fileManagerURL $}" target="_blank" title="{% trans 'File Manager' %}">
|
||||
<img src="{% static 'images/icons/office-material.png' %}">
|
||||
</a>
|
||||
<a href="{$ fileManagerURL $}" target="_blank" title="{% trans 'File Manager' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "File Manager" %}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-3" style="margin-bottom: 2%;">
|
||||
|
||||
<a ng-click="openBaseDirView()" href="" title="{% trans 'open_basedir Protection' %}">
|
||||
<img src="{% static 'images/icons/open_basedir.png' %}">
|
||||
</a>
|
||||
<a ng-click="openBaseDirView()" href="" title="{% trans 'open_basedir Protection' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "open_basedir" %}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-3" style="margin-bottom: 2%;">
|
||||
|
||||
<a href="{% url 'createFTPAccount' %}" title="{% trans 'Create FTP Account' %}">
|
||||
<img src="{% static 'images/icons/ftp-upload.png' %}">
|
||||
</a>
|
||||
<a href="{% url 'createFTPAccount' %}" title="{% trans 'Create FTP Account' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "Create FTP Acct" %}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-3" style="margin-bottom: 2%;">
|
||||
|
||||
<a href="{% url 'deleteFTPAccount' %}" title="{% trans 'Delete FTP Account' %}">
|
||||
<img src="{% static 'images/icons/delete-ftp.png' %}">
|
||||
</a>
|
||||
<a href="{% url 'deleteFTPAccount' %}" title="{% trans 'Delete FTP Account' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "Delete FTP Acct" %}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!--- HTML To change open_basedir --->
|
||||
|
||||
<div ng-hide="openBaseDirBox" class="col-md-12">
|
||||
|
||||
<form action="/" class="form-horizontal bordered-row">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "open_basedir Protection" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-model="openBasedirValue" class="form-control">
|
||||
<option>Enable</option>
|
||||
<option>Disable</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div ng-hide="baseDirLoading" style="margin-bottom: 1%;" class=" col-sm-1">
|
||||
<img src="{% static 'images/loading.gif' %}">
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 2%;" class=" col-sm-1">
|
||||
<a title="{% trans 'Cancel' %}" ng-click="hideOpenBasedir()" 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="applyOpenBasedirChanges()" class="btn btn-primary btn-lg btn-block">{% trans "Apply Changes" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<div ng-hide="operationFailed" class="alert alert-danger">
|
||||
<p>{% trans "Error message:" %} {$ errorMessage $} </p>
|
||||
</div>
|
||||
|
||||
<div ng-hide="operationSuccessfull" class="alert alert-success">
|
||||
<p>{% trans "Changes successfully saved." %}</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>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!--- HTML To change open_basedir --->
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
|
||||
<div class="alert alert-danger">
|
||||
<p>{{ domain }}</p>
|
||||
</div>
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@@ -468,6 +468,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Domain</th>
|
||||
<th>Launch</th>
|
||||
<th>Path</th>
|
||||
<th>open_basedir</th>
|
||||
<th>PHP</th>
|
||||
@@ -478,6 +479,7 @@
|
||||
<tbody>
|
||||
<tr ng-repeat="record in childDomains | filter:logSearch">
|
||||
<td ng-bind="record.childDomain"></td>
|
||||
<td><a href="{$ record.childLunch $}"><img width="30px" height="30" class="center-block" src="{% static 'baseTemplate/assets/image-resources/webPanel.png' %}"></a></td>
|
||||
<td ng-bind="record.path"></td>
|
||||
<td >
|
||||
<select ng-change="changeChildBaseDir(record.childDomain,childBaseDir)" ng-model="childBaseDir" class="form-control">
|
||||
|
||||
@@ -24,7 +24,7 @@ urlpatterns = [
|
||||
url(r'^getWebsiteDetails', views.submitWebsiteModify, name='getWebsiteDetails'),
|
||||
url(r'^saveWebsiteChanges', views.saveWebsiteChanges, name='saveWebsiteChanges'),
|
||||
|
||||
|
||||
url(r'^(?P<domain>([\da-z\.-]+\.[a-z\.]{2,12}|[\d\.]+)([\/:?=&#]{1}[\da-z\.-]+)*[\/\?]?)/(?P<childDomain>([\da-z\.-]+\.[a-z\.]{2,12}|[\d\.]+)([\/:?=&#]{1}[\da-z\.-]+)*[\/\?]?)$', views.launchChild, name='launchChild'),
|
||||
url(r'^(?P<domain>([\da-z\.-]+\.[a-z\.]{2,12}|[\d\.]+)([\/:?=&#]{1}[\da-z\.-]+)*[\/\?]?)$', views.domain, name='domain'),
|
||||
url(r'^getDataFromLogFile', views.getDataFromLogFile, name='getDataFromLogFile'),
|
||||
url(r'^fetchErrorLogs', views.fetchErrorLogs, name='fetchErrorLogs'),
|
||||
|
||||
@@ -716,6 +716,7 @@ def fetchDomains(request):
|
||||
dic = {
|
||||
'childDomain': items.domain,
|
||||
'path': items.path,
|
||||
'childLunch': '/websites/' + masterDomain + '/' + items.domain
|
||||
}
|
||||
|
||||
if checker == 0:
|
||||
@@ -1236,6 +1237,103 @@ def domain(request,domain):
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def launchChild(request,domain, childDomain):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
|
||||
if ChildDomains.objects.filter(domain=childDomain).exists():
|
||||
if admin.type == 1:
|
||||
website = Websites.objects.get(domain=domain)
|
||||
|
||||
Data = {}
|
||||
|
||||
Data['ftpTotal'] = website.package.ftpAccounts
|
||||
Data['ftpUsed'] = website.users_set.all().count()
|
||||
|
||||
Data['databasesUsed'] = website.databases_set.all().count()
|
||||
Data['databasesTotal'] = website.package.dataBases
|
||||
|
||||
Data['domain'] = domain
|
||||
Data['childDomain'] = childDomain
|
||||
|
||||
diskUsageDetails = virtualHostUtilities.getDiskUsage("/home/"+domain,website.package.diskSpace)
|
||||
|
||||
## bw usage calculation
|
||||
|
||||
try:
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
||||
execPath = execPath + " findDomainBW --virtualHostName " + domain + " --bandwidth " + str(website.package.bandwidth)
|
||||
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
bwData = output.split(",")
|
||||
except BaseException,msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
bwData = [0,0]
|
||||
|
||||
## bw usage calculations
|
||||
|
||||
Data['bwInMBTotal'] = website.package.bandwidth
|
||||
Data['bwInMB'] = bwData[0]
|
||||
Data['bwUsage'] = bwData[1]
|
||||
|
||||
|
||||
|
||||
if diskUsageDetails!=None:
|
||||
if diskUsageDetails[1] > 100:
|
||||
diskUsageDetails[1] = 100
|
||||
|
||||
Data['diskUsage'] = diskUsageDetails[1]
|
||||
Data['diskInMB'] = diskUsageDetails[0]
|
||||
Data['diskInMBTotal'] = website.package.diskSpace
|
||||
else:
|
||||
Data['diskUsage'] = 0
|
||||
Data['diskInMB'] = 0
|
||||
Data['diskInMBTotal'] = website.package.diskSpace
|
||||
|
||||
|
||||
return render(request, 'websiteFunctions/launchChild.html', Data)
|
||||
else:
|
||||
website = Websites.objects.get(domain=domain)
|
||||
if website.admin == admin:
|
||||
|
||||
Data = {}
|
||||
|
||||
Data['ftpTotal'] = website.package.ftpAccounts
|
||||
Data['ftpUsed'] = website.users_set.all().count()
|
||||
|
||||
Data['databasesUsed'] = website.databases_set.all().count()
|
||||
Data['databasesTotal'] = website.package.dataBases
|
||||
|
||||
Data['domain'] = domain
|
||||
Data['childDomain'] = childDomain
|
||||
|
||||
diskUsageDetails = virtualHostUtilities.getDiskUsage("/home/" + domain, website.package.diskSpace)
|
||||
|
||||
if diskUsageDetails != None:
|
||||
if diskUsageDetails[1] > 100:
|
||||
diskUsageDetails[1] = 100
|
||||
|
||||
Data['diskUsage'] = diskUsageDetails[1]
|
||||
Data['diskInMB'] = diskUsageDetails[0]
|
||||
Data['diskInMBTotal'] = website.package.diskSpace
|
||||
else:
|
||||
Data['diskUsage'] = 0
|
||||
Data['diskInMB'] = 0
|
||||
Data['diskInMBTotal'] = website.package.diskSpace
|
||||
|
||||
return render(request, 'websiteFunctions/launchChild.html', Data)
|
||||
else:
|
||||
return render(request, 'websiteFunctions/launchChild.html',
|
||||
{"error": 1, "domain": "You do not own this domain."})
|
||||
|
||||
else:
|
||||
return render(request, 'websiteFunctions/launchChild.html', {"error":1,"domain": "This child domain does not exists"})
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def getDataFromLogFile(request):
|
||||
data = json.loads(request.body)
|
||||
logType = data['logType']
|
||||
@@ -1714,8 +1812,11 @@ def saveRewriteRules(request):
|
||||
|
||||
## writing data temporary to file
|
||||
|
||||
|
||||
filePath = "/home/" + virtualHost + "/public_html/.htaccess"
|
||||
try:
|
||||
childDomain = ChildDomains.objects.get(domain=virtualHost)
|
||||
filePath = childDomain.path + '/.htaccess'
|
||||
except:
|
||||
filePath = "/home/" + virtualHost + "/public_html/.htaccess"
|
||||
|
||||
## save configuration data
|
||||
|
||||
|
||||
Reference in New Issue
Block a user