Improved Website and Domain creation.

This commit is contained in:
usmannasir
2018-07-30 17:33:28 +05:00
parent b1b90e74fc
commit c5dd1e4ed7
7 changed files with 749 additions and 295 deletions

View File

@@ -2,41 +2,54 @@
* Created by usman on 7/26/17.
*/
$("#websiteCreationFailed").hide();
$("#websiteCreated").hide();
$("#webSiteCreation").hide();
/* Java script code to create account */
app.controller('createWebsite', function($scope,$http) {
app.controller('createWebsite', function($scope, $http, $timeout, $window) {
$scope.webSiteCreationLoading = true;
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = true;
var statusFile;
$scope.createWebsite = function(){
$scope.webSiteCreationLoading = false;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = true;
$scope.currentStatus = "Starting creation..";
var ssl, dkimCheck, openBasedir;
if ($scope.sslCheck === true){
var ssl = 1;
ssl = 1;
}
else{
var ssl = 0
ssl = 0
}
if ($scope.dkimCheck === true){
var dkimCheck = 1;
dkimCheck = 1;
}
else{
var dkimCheck = 0
dkimCheck = 0
}
if ($scope.openBasedir === true){
var openBasedir = 1;
openBasedir = 1;
}
else{
var openBasedir = 0
openBasedir = 0
}
$("#webSiteCreation").fadeIn();
url = "/websites/submitWebsiteCreation";
var package = $scope.packageForWebsite;
@@ -67,35 +80,38 @@ app.controller('createWebsite', function($scope,$http) {
function ListInitialDatas(response) {
$("#webSiteCreation").fadeOut();
if(response.data.existsStatus == 1){
$scope.errorMessage = response.data.error_message;
$("#websiteCreationFailed").fadeIn();
$("#websiteCreated").hide();
}
else if (response.data.createWebSiteStatus == 0)
if (response.data.createWebSiteStatus === 1)
{
$scope.errorMessage = response.data.error_message;
$("#websiteCreationFailed").fadeIn();
$("#websiteCreated").hide();
statusFile = response.data.tempStatusPath;
getCreationStatus();
}
else{
$("#websiteCreationFailed").hide();
$("#websiteCreated").fadeIn();
$scope.websiteDomain = domainName;
$scope.webSiteCreationLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = false;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = false;
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
$("#webSiteCreation").fadeOut();
console.log("not good");
$scope.webSiteCreationLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = false;
$scope.goBackDisable = false;
}
@@ -103,6 +119,97 @@ app.controller('createWebsite', function($scope,$http) {
};
$scope.goBack = function () {
$scope.webSiteCreationLoading = true;
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = true;
$("#installProgress").css("width", "0%");
};
function getCreationStatus(){
url = "/websites/installWordpressStatus";
var data = {
statusFile: statusFile
};
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if(response.data.abort === 1){
if(response.data.installStatus === 1){
$scope.webSiteCreationLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = false;
$scope.couldNotConnect = true;
$scope.goBackDisable = false;
$("#installProgress").css("width", "100%");
$scope.installPercentage = "100";
$scope.currentStatus = response.data.currentStatus;
$timeout.cancel();
}
else{
$scope.webSiteCreationLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = false;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = false;
$scope.errorMessage = response.data.error_message;
$("#installProgress").css("width", "0%");
$scope.installPercentage = "0";
$scope.goBackDisable = false;
}
}
else{
$("#installProgress").css("width", response.data.installationProgress + "%");
$scope.installPercentage = response.data.installationProgress;
$scope.currentStatus = response.data.currentStatus;
$timeout(getCreationStatus,1000);
}
}
function cantLoadInitialDatas(response) {
$scope.webSiteCreationLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = false;
$scope.goBackDisable = false;
}
}
});
/* Java script code to create account ends here */
@@ -165,7 +272,7 @@ app.controller('listWebsites', function($scope,$http) {
function ListInitialData(response) {
if (response.data.listWebSiteStatus==1) {
if (response.data.listWebSiteStatus ===1) {
var finalData = JSON.parse(response.data.data);
$scope.WebSitesList = finalData;
@@ -309,7 +416,7 @@ app.controller('modifyWebsitesController', function($scope,$http) {
function ListInitialDatas(response) {
if (response.data.modifyStatus == 0)
if (response.data.modifyStatus === 0)
{
console.log(response.data);
$scope.errorMessage = response.data.error_message;
@@ -377,7 +484,7 @@ app.controller('modifyWebsitesController', function($scope,$http) {
packForWeb:packForWeb,
email:email,
phpVersion:phpVersion,
admin:admin,
admin:admin
};
var config = {
@@ -391,7 +498,7 @@ app.controller('modifyWebsitesController', function($scope,$http) {
function ListInitialDatas(response) {
if (response.data.saveStatus == 0)
if (response.data.saveStatus === 0)
{
$scope.errMessage = response.data.error_message;
@@ -437,7 +544,7 @@ app.controller('modifyWebsitesController', function($scope,$http) {
/* Java script code to create account */
app.controller('websitePages', function($scope,$http) {
app.controller('websitePages', function($scope, $http, $timeout, $window) {
$scope.logFileLoading = true;
$scope.logsFeteched = true;
@@ -914,7 +1021,6 @@ app.controller('websitePages', function($scope,$http) {
$scope.configurationsBoxRewrite = true;
};
$scope.fetchRewriteFules = function(){
$scope.hidsslconfigs = true;
@@ -1144,8 +1250,6 @@ app.controller('websitePages', function($scope,$http) {
};
//////// Application Installation part
$scope.installationDetailsForm = true;
@@ -1156,7 +1260,6 @@ app.controller('websitePages', function($scope,$http) {
$scope.couldNotConnect = true;
$scope.installationDetails = function(){
$scope.installationDetailsForm = !$scope.installationDetailsForm;
@@ -1171,7 +1274,6 @@ app.controller('websitePages', function($scope,$http) {
};
$scope.installWordpress = function(){
@@ -1341,9 +1443,6 @@ app.controller('websitePages', function($scope,$http) {
};
//////// SSL Part
$scope.sslSaved = true;
@@ -1363,9 +1462,6 @@ app.controller('websitePages', function($scope,$http) {
$scope.changePHPView = true;
};
$scope.saveSSL = function(){
@@ -1434,7 +1530,6 @@ app.controller('websitePages', function($scope,$http) {
};
//// Change PHP Master
$scope.failedToChangePHPMaster = true;
@@ -1455,7 +1550,6 @@ app.controller('websitePages', function($scope,$http) {
$scope.changePHPView = false;
};
$scope.changePHPVersionMaster = function(childDomain,phpSelection){
// notifcations
@@ -1522,10 +1616,7 @@ app.controller('websitePages', function($scope,$http) {
}
}
};
////// create domain part
@@ -1543,37 +1634,47 @@ app.controller('websitePages', function($scope,$http) {
// notifcations settings
$scope.domainLoading = true;
$scope.websiteCreationFailed = true;
$scope.domainCreated = true;
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = true;
var statusFile;
$scope.createDomain = function(){
// notifcations settings
$scope.domainLoading = false;
$scope.websiteCreationFailed = true;
$scope.domainCreated = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = true;
$scope.currentStatus = "Starting creation..";
var ssl, dkimCheck, openBasedir;
if ($scope.sslCheck === true){
var ssl = 1;
ssl = 1;
}
else{
var ssl = 0
ssl = 0
}
if ($scope.dkimCheck === true){
var dkimCheck = 1;
dkimCheck = 1;
}
else{
var dkimCheck = 0
dkimCheck = 0
}
if ($scope.openBasedir === true){
var openBasedir = 1;
openBasedir = 1;
}
else{
var openBasedir = 0
openBasedir = 0
}
@@ -1609,40 +1710,36 @@ app.controller('websitePages', function($scope,$http) {
function ListInitialDatas(response) {
if(response.data.createWebSiteStatus === 1){
$scope.websiteDomain = domainName;
// notifcations settings
$scope.domainLoading = true;
$scope.websiteCreationFailed = true;
$scope.domainCreated = false;
$scope.couldNotConnect = true
if (response.data.createWebSiteStatus === 1)
{
statusFile = response.data.tempStatusPath;
getCreationStatus();
}
else{
$scope.errorMessage = response.data.error_message;
// notifcations settings
$scope.domainLoading = true;
$scope.websiteCreationFailed = false;
$scope.domainCreated = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = false;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = false;
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
// notifcations settings
$scope.domainLoading = true;
$scope.websiteCreationFailed = true;
$scope.domainCreated = true;
$scope.couldNotConnect = false;
$scope.domainLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = false;
$scope.goBackDisable = false;
}
@@ -1652,6 +1749,99 @@ app.controller('websitePages', function($scope,$http) {
};
$scope.goBack = function () {
$scope.domainLoading = true;
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = true;
$("#installProgress").css("width", "0%");
};
function getCreationStatus(){
url = "/websites/installWordpressStatus";
var data = {
statusFile: statusFile
};
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if(response.data.abort === 1){
if(response.data.installStatus === 1){
$scope.domainLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = false;
$scope.couldNotConnect = true;
$scope.goBackDisable = false;
$("#installProgress").css("width", "100%");
$scope.installPercentage = "100";
$scope.currentStatus = response.data.currentStatus;
$timeout.cancel();
}
else{
$scope.domainLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = false;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = false;
$scope.errorMessage = response.data.error_message;
$("#installProgress").css("width", "0%");
$scope.installPercentage = "0";
$scope.goBackDisable = false;
}
}
else{
$("#installProgress").css("width", response.data.installationProgress + "%");
$scope.installPercentage = response.data.installationProgress;
$scope.currentStatus = response.data.currentStatus;
$timeout(getCreationStatus,1000);
}
}
function cantLoadInitialDatas(response) {
$scope.domainLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = false;
$scope.goBackDisable = false;
}
}
////// List Domains Part
@@ -2141,13 +2331,8 @@ app.controller('websitePages', function($scope,$http) {
/* Java script code to create account ends here */
/* Java script code to suspend/un-suspend Website */
app.controller('suspendWebsiteControl', function($scope,$http) {
$scope.suspendLoading = true;
@@ -2272,12 +2457,8 @@ app.controller('suspendWebsiteControl', function($scope,$http) {
});
/* Java script code to suspend/un-suspend ends here */
/* Java script code to manage cron */
app.controller('manageCronController', function($scope,$http) {
@@ -2606,10 +2787,8 @@ app.controller('manageCronController', function($scope,$http) {
});
/* Java script code to manage cron ends here */
/* Java script code to manage cron */
app.controller('manageAliasController', function($scope,$http, $timeout, $window) {
@@ -2868,7 +3047,6 @@ app.controller('manageAliasController', function($scope,$http, $timeout, $window
});
/* Java script code to manage cron ends here */
app.controller('launchChild', function($scope,$http) {
@@ -3840,11 +4018,8 @@ app.controller('launchChild', function($scope,$http) {
});
/* Application Installer */
app.controller('installWordPressCTRL', function($scope, $http, $timeout) {
$scope.installationDetailsForm = false;
@@ -4038,7 +4213,6 @@ app.controller('installWordPressCTRL', function($scope, $http, $timeout) {
});
app.controller('installJoomlaCTRL', function($scope, $http, $timeout) {
$scope.installationDetailsForm = false;
@@ -4234,7 +4408,6 @@ app.controller('installJoomlaCTRL', function($scope, $http, $timeout) {
});
app.controller('setupGit', function($scope, $http, $timeout, $window) {
$scope.installationDetailsForm = false;

View File

@@ -14,18 +14,18 @@
</div>
<div class="panel">
<div ng-controller="createWebsite" class="panel">
<div class="panel-body">
<h3 class="title-hero">
{% trans "Website Details" %} <img id="webSiteCreation" src="{% static 'images/loading.gif' %}">
{% trans "Website Details" %} <img ng-hide="webSiteCreationLoading" src="{% static 'images/loading.gif' %}">
</h3>
<div ng-controller="createWebsite" class="example-box-wrapper">
<div class="example-box-wrapper">
<form name="websiteCreationForm" action="/" id="createPackages" class="form-horizontal bordered-row">
<div class="form-group">
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Select Package" %}</label>
<div class="col-sm-6">
<select ng-model="packageForWebsite" class="form-control">
@@ -36,7 +36,7 @@
</div>
</div>
<div class="form-group">
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Select Owner" %}</label>
<div class="col-sm-6">
<select ng-model="websiteOwner" class="form-control">
@@ -48,7 +48,7 @@
</div>
<div class="form-group">
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Domain Name" %}</label>
<div class="col-sm-6">
<input name="dom" type="text" class="form-control" ng-model="domainNameCreate" placeholder="{% trans "Do not enter WWW, it will be auto created!" %}" required>
@@ -56,7 +56,7 @@
<div ng-show="websiteCreationForm.dom.$error.pattern" class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}</div>
</div>
<div class="form-group">
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Email" %}</label>
<div class="col-sm-6">
<input type="email" name="email" class="form-control" ng-model="adminEmail" required>
@@ -64,7 +64,7 @@
<div ng-show="websiteCreationForm.email.$error.email" class="current-pack">{% trans "Invalid Email" %}</div>
</div>
<div class="form-group">
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Select PHP" %}</label>
<div class="col-sm-6">
<select ng-model="phpSelection" class="form-control">
@@ -81,7 +81,7 @@
<div class="form-group">
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Additional Features" %}</label>
<div class="col-sm-9">
<div class="checkbox">
@@ -112,7 +112,7 @@
</div>
<div class="form-group">
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-4">
<button ng-disabled="websiteCreationForm.dom.$error.required || websiteCreationForm.email.$invalid" type="button" ng-click="createWebsite()" class="btn btn-primary btn-lg btn-block">{% trans "Create Website" %}</button>
@@ -122,16 +122,42 @@
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-4">
<div id="websiteCreationFailed" class="alert alert-danger">
<p>{% trans "Cannot create website. Error message:" %} {$ errorMessage $}</p>
<div ng-hide="installationProgress" class="form-group">
<label class="col-sm-2 control-label"></label>
<div class="col-sm-7">
<div class="alert alert-success text-center">
<h2>{$ currentStatus $}</h2>
</div>
<div id="websiteCreated" class="alert alert-success">
<p>{% trans "Website with domain" %} <strong>{$ websiteDomain $}</strong>{% trans " is Successfully Created" %}</p>
<div class="progress">
<div id="installProgress" class="progress-bar" role="progressbar" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="width:0%">
<span class="sr-only">70% Complete</span>
</div>
</div>
<div ng-hide="errorMessageBox" class="alert alert-danger">
<p>{% trans "Error message:" %} {$ errorMessage $}</p>
</div>
<div ng-hide="success" class="alert alert-success">
<p>{% trans "Website succesfully created." %}</p>
</div>
<div ng-hide="couldNotConnect" class="alert alert-danger">
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
</div>
</div>
</div>
<div ng-hide="installationProgress" class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-4">
<button type="button" ng-disabled="goBackDisable" ng-click="goBack()" class="btn btn-primary btn-lg btn-block">{% trans "Go Back" %}</button>
</div>
</div>

View File

@@ -302,24 +302,22 @@
<!---------- HTML For creating domains --------------->
<div class="col-md-12">
<form id="domainCreationForm" name="websiteCreationForm" action="/" class="form-horizontal bordered-row">
<div class="form-group">
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Domain Name" %}</label>
<div class="col-sm-6">
<input ng-pattern="*" name="dom" type="text" class="form-control" ng-model="domainNameCreate" required>
<input name="dom" type="text" class="form-control" ng-model="domainNameCreate" required>
</div>
<div ng-show="websiteCreationForm.dom.$error.pattern" class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}</div>
<div style="margin-bottom: 1%;" class=" col-sm-1">
<a title="{% trans 'Cancel' %}" ng-click="hideDomainCreationForm()" href=""><img src="/static/images/close-32.png"></a>
</div>
</div>
<div class="form-group">
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Path" %}</label>
<div class="col-sm-6">
<input placeholder="{% trans 'This path is relative to: ' %}{$ masterDomain $}. {% trans 'Leave empty to set default.' %}" type="text" class="form-control" ng-model="docRootPath" required>
@@ -328,7 +326,7 @@
</div>
<div class="form-group">
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Select PHP" %}</label>
<div class="col-sm-6">
<select ng-model="phpSelection" class="form-control">
@@ -345,7 +343,7 @@
<div class="form-group">
<div ng-hide="installationDetailsForm" ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Additional Features" %}</label>
<div class="col-sm-9">
<div class="checkbox">
@@ -376,35 +374,54 @@
</div>
<div class="form-group">
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-4">
<button ng-disabled="websiteCreationForm.dom.$error.required || websiteCreationForm.dom.$error.pattern || websiteCreationForm.email.$invalid" type="button" ng-click="createDomain()" class="btn btn-primary btn-lg btn-block">{% trans "Create Domain" %}</button>
<button type="button" ng-click="createDomain()" class="btn btn-primary btn-lg btn-block">{% trans "Create Domain" %}</button>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-4">
<div ng-hide="websiteCreationFailed" class="alert alert-danger">
<p>{% trans "Cannot create website. Error message:" %} {$ errorMessage $}</p>
</div>
<div ng-hide="installationProgress" class="form-group">
<label class="col-sm-2 control-label"></label>
<div class="col-sm-7">
<div ng-hide="domainCreated" class="alert alert-success">
<p>{% trans "Website with domain" %} <strong>{$ websiteDomain $}</strong>{% trans " is Successfully Created" %}</p>
</div>
<div class="alert alert-success text-center">
<h2>{$ currentStatus $}</h2>
</div>
<div ng-hide="couldNotConnect" class="alert alert-danger">
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
</div>
<div class="progress">
<div id="installProgress" class="progress-bar" role="progressbar" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="width:0%">
<span class="sr-only">70% Complete</span>
</div>
</div>
<div ng-hide="errorMessageBox" class="alert alert-danger">
<p>{% trans "Error message:" %} {$ errorMessage $}</p>
</div>
<div ng-hide="success" class="alert alert-success">
<p>{% trans "Website succesfully created." %}</p>
</div>
</div>
<div ng-hide="couldNotConnect" class="alert alert-danger">
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
</div>
</div>
</div>
<div ng-hide="installationProgress" class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-4">
<button type="button" ng-disabled="goBackDisable" ng-click="goBack()" class="btn btn-primary btn-lg btn-block">{% trans "Go Back" %}</button>
</div>
</div>
</form>
@@ -460,9 +477,6 @@
</div>
<div class="col-sm-12">
<table class="table">
<thead>

View File

@@ -223,6 +223,7 @@ def submitWebsiteCreation(request):
packageName = data['package']
websiteOwner = data['websiteOwner']
externalApp = "".join(re.findall("[a-zA-Z]+", domain))[:7]
tempStatusPath = "/home/cyberpanel/" + str(randint(1000, 9999))
####### Limitations check
@@ -247,22 +248,18 @@ def submitWebsiteCreation(request):
"' --virtualHostUser " + externalApp + " --numberOfSites " + numberOfWebsites + \
" --ssl " + str(data['ssl']) + " --sslPath " + sslpath + " --dkimCheck " + str(data['dkimCheck'])\
+ " --openBasedir " + str(data['openBasedir']) + ' --websiteOwner ' + websiteOwner \
+ ' --package ' + packageName
+ ' --package ' + packageName + ' --tempStatusPath ' + tempStatusPath
output = subprocess.check_output(shlex.split(execPath))
subprocess.Popen(shlex.split(execPath))
time.sleep(2)
if output.find("1,None") > -1:
data_ret = {'createWebSiteStatus': 1, 'error_message': "None", "existsStatus": 0}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
else:
data_ret = {'createWebSiteStatus': 0, 'error_message': output, "existsStatus": 0}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
data_ret = {'createWebSiteStatus': 1, 'error_message': "None", 'tempStatusPath': tempStatusPath}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
data_ret = {'createWebSiteStatus': 0, 'error_message': str(msg), "existsStatus": 0}
data_ret = {'createWebSiteStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -275,6 +272,7 @@ def submitDomainCreation(request):
domain = data['domainName']
phpSelection = data['phpSelection']
path = data['path']
tempStatusPath = "/home/cyberpanel/" + str(randint(1000, 9999))
try:
@@ -286,7 +284,7 @@ def submitDomainCreation(request):
execPath = execPath + " createDomain --masterDomain " + masterDomain + " --virtualHostName " + domain + \
" --phpVersion '" + phpSelection + "' --ssl " + str(data['ssl']) + " --dkimCheck " + \
str(data['dkimCheck']) + " --openBasedir " + str(data['openBasedir']) + ' --path ' + path \
+ ' --restore ' + restore
+ ' --restore ' + restore + ' --tempStatusPath ' + tempStatusPath
except:
restore = '0'
@@ -308,22 +306,17 @@ def submitDomainCreation(request):
execPath = execPath + " createDomain --masterDomain " + masterDomain + " --virtualHostName " + domain + \
" --phpVersion '" + phpSelection + "' --ssl " + str(data['ssl']) + " --dkimCheck " + str(data['dkimCheck']) \
+ " --openBasedir " + str(data['openBasedir']) + ' --path ' + path \
+ ' --restore ' + restore + ' --websiteOwner ' + admin.userName
+ ' --restore ' + restore + ' --websiteOwner ' + admin.userName + ' --tempStatusPath ' + tempStatusPath
subprocess.Popen(shlex.split(execPath))
time.sleep(2)
output = subprocess.check_output(shlex.split(execPath))
if output.find("1,None") > -1:
data_ret = {'createWebSiteStatus': 1, 'error_message': "None", "existsStatus": 0}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
else:
data_ret = {'createWebSiteStatus': 0, 'error_message': output, "existsStatus": 0}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
data_ret = {'createWebSiteStatus': 1, 'error_message': "None", 'tempStatusPath': tempStatusPath}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
data_ret = {'createWebSiteStatus': 0, 'error_message': str(msg), "existsStatus": 0}
data_ret = {'createWebSiteStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -2294,10 +2287,10 @@ def installWordpressStatus(request):
data = json.loads(request.body)
domainName = data['domainName']
statusFile = data['statusFile']
if admin.type != 1:
domainName = data['domainName']
website = Websites.objects.get(domain=domainName)
if website.admin != admin:
raise BaseException('You do not own this website.')