bug fixes in wp manager

This commit is contained in:
Usman Nasir
2022-06-05 12:46:02 +05:00
parent 9c9a0eb214
commit 7ae3856e32
11 changed files with 187 additions and 99 deletions

View File

@@ -275,6 +275,10 @@
{# </div>#} {# </div>#}
{# </div>#} {# </div>#}
{# </div>#} {# </div>#}
<a class="header-btn" target="_blank" href="https://www.youtube.com/channel/UCS6sgUWEhaFl1TO238Ck0xw?sub_confirmation=1"
title="{% trans 'Youtube Channel' %}">
<i class="glyph-icon icon-youtube"></i>
</a>
<a class="header-btn" target="_blank" href="https://go.cyberpanel.net/community" <a class="header-btn" target="_blank" href="https://go.cyberpanel.net/community"
title="{% trans 'Community' %}"> title="{% trans 'Community' %}">
<i class="glyph-icon icon-comments"></i> <i class="glyph-icon icon-comments"></i>

View File

@@ -18,6 +18,7 @@ from shlex import split
from .CyberCPLogFileWriter import CyberCPLogFileWriter as logging from .CyberCPLogFileWriter import CyberCPLogFileWriter as logging
from dockerManager.models import Containers from dockerManager.models import Containers
from re import compile from re import compile
class ACLManager: class ACLManager:
@@ -917,4 +918,16 @@ class ACLManager:
else: else:
dic['dnsAsWhole'] = 0 dic['dnsAsWhole'] = 0
@staticmethod
def GetALLWPObjects(currentACL, userID):
from websiteFunctions.models import WPSites
wpsites = WPSites.objects.none()
websites = ACLManager.findWebsiteObjects(currentACL, userID)
for website in websites:
wpsites |= website.wpsites_set.all()
return wpsites

View File

@@ -1689,30 +1689,39 @@ $parameters = array(
DataToPass['mailDomain'] = 0 DataToPass['mailDomain'] = 0
UserID = self.data['adminID'] UserID = self.data['adminID']
ab = WebsiteManager() try:
coreResult = ab.submitWebsiteCreation(UserID, DataToPass) website = Websites.objects.get(domain=DataToPass['domainName'])
coreResult1 = json.loads((coreResult).content)
logging.writeToFile("Creating website result....%s"%coreResult1)
reutrntempath = coreResult1['tempStatusPath']
while (1):
lastLine = open(reutrntempath, 'r').read()
logging.writeToFile("Error web creating lastline ....... %s" % lastLine)
if lastLine.find('[200]') > -1:
break
elif lastLine.find('[404]') > -1:
statusFile = open(currentTemp, 'w')
statusFile.writelines('Failed to Create Website: error: %s. [404]' % lastLine)
statusFile.close()
return 0
else:
statusFile = open(currentTemp, 'w')
statusFile.writelines('Creating Website....,20')
statusFile.close()
time.sleep(2)
statusFile = open(tempStatusPath, 'w') if ACLManager.checkOwnership(website.domain, self.extraArgs['adminID'], self.extraArgs['currentACL']) == 0:
statusFile.writelines('Installing WordPress....,30') statusFile = open(tempStatusPath, 'w')
statusFile.close() statusFile.writelines('You dont own this site.[404]')
statusFile.close()
except:
ab = WebsiteManager()
coreResult = ab.submitWebsiteCreation(UserID, DataToPass)
coreResult1 = json.loads((coreResult).content)
logging.writeToFile("Creating website result....%s"%coreResult1)
reutrntempath = coreResult1['tempStatusPath']
while (1):
lastLine = open(reutrntempath, 'r').read()
logging.writeToFile("Error web creating lastline ....... %s" % lastLine)
if lastLine.find('[200]') > -1:
break
elif lastLine.find('[404]') > -1:
statusFile = open(currentTemp, 'w')
statusFile.writelines('Failed to Create Website: error: %s. [404]' % lastLine)
statusFile.close()
return 0
else:
statusFile = open(currentTemp, 'w')
statusFile.writelines('Creating Website....,20')
statusFile.close()
time.sleep(2)
statusFile = open(tempStatusPath, 'w')
statusFile.writelines('Installing WordPress....,30')
statusFile.close()
logging.writeToFile("Pluginbucket ....... %s" % str(self.data['pluginbucket'])) logging.writeToFile("Pluginbucket ....... %s" % str(self.data['pluginbucket']))

View File

@@ -50,8 +50,10 @@ function FinalDeletePluginBuucket() {
var SPVal; var SPVal;
app.controller('WPAddNewPlugin', function ($scope, $http, $timeout, $window, $compile) { app.controller('WPAddNewPlugin', function ($scope, $http, $timeout, $window, $compile) {
$scope.webSiteCreationLoading = true;
$scope.SearchPluginName = function (val) { $scope.SearchPluginName = function (val) {
$scope.webSiteCreationLoading = false;
SPVal = val; SPVal = val;
url = "/websites/SearchOnkeyupPlugin"; url = "/websites/SearchOnkeyupPlugin";
@@ -72,6 +74,7 @@ app.controller('WPAddNewPlugin', function ($scope, $http, $timeout, $window, $co
function ListInitialDatas(response) { function ListInitialDatas(response) {
$scope.webSiteCreationLoading = true;
if (response.data.status === 1) { if (response.data.status === 1) {
if (SPVal == 'add') { if (SPVal == 'add') {
@@ -138,12 +141,19 @@ app.controller('WPAddNewPlugin', function ($scope, $http, $timeout, $window, $co
function ListInitialDatas(response) { function ListInitialDatas(response) {
if (response.data.status === 1) { if (response.data.status === 1) {
alert("added.........."); new PNotify({
title: 'Success!',
text: 'Bucket created.',
type: 'success'
});
location.reload(); location.reload();
} else { } else {
// $scope.errorMessage = response.data.error_message; new PNotify({
alert("Status not = 1: Error..." + response.data.error_message) title: 'Error!',
text: response.data.error_message,
type: 'error'
});
} }
@@ -275,7 +285,7 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $
var adminEmail = $scope.adminEmail; var adminEmail = $scope.adminEmail;
var WPPassword = $scope.WPPassword; var WPPassword = $scope.WPPassword;
var WPVersions = $scope.WPVersions; var WPVersions = $scope.WPVersions;
var pluginbucket = $('#pliginbucket').val(); var pluginbucket = $scope.pluginbucket;
var autoupdates = $scope.autoupdates; var autoupdates = $scope.autoupdates;
var pluginupdates = $scope.pluginupdates; var pluginupdates = $scope.pluginupdates;
var themeupdates = $scope.themeupdates; var themeupdates = $scope.themeupdates;
@@ -305,7 +315,7 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $
function ListInitialDatas(response) { function ListInitialDatas(response) {
$scope.webSiteCreationLoading = true;
if (response.data.status === 1) { if (response.data.status === 1) {
statusFile = response.data.tempStatusPath; statusFile = response.data.tempStatusPath;
getCreationStatus(); getCreationStatus();
@@ -338,7 +348,6 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $
$scope.goBackDisable = true; $scope.goBackDisable = true;
$("#installProgress").css("width", "0%"); $("#installProgress").css("width", "0%");
}; };
function getCreationStatus() { function getCreationStatus() {
url = "/websites/installWordpressStatus"; url = "/websites/installWordpressStatus";
@@ -359,7 +368,6 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $
function ListInitialDatas(response) { function ListInitialDatas(response) {
if (response.data.abort === 1) { if (response.data.abort === 1) {
if (response.data.installStatus === 1) { if (response.data.installStatus === 1) {
@@ -377,7 +385,8 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $
$scope.currentStatus = response.data.currentStatus; $scope.currentStatus = response.data.currentStatus;
$timeout.cancel(); $timeout.cancel();
} else { }
else {
$scope.webSiteCreationLoading = true; $scope.webSiteCreationLoading = true;
$scope.installationDetailsForm = true; $scope.installationDetailsForm = true;
@@ -396,6 +405,7 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $
} }
} else { } else {
$scope.webSiteCreationLoading = false;
$("#installProgress").css("width", response.data.installationProgress + "%"); $("#installProgress").css("width", response.data.installationProgress + "%");
$scope.installPercentage = response.data.installationProgress; $scope.installPercentage = response.data.installationProgress;
$scope.currentStatus = response.data.currentStatus; $scope.currentStatus = response.data.currentStatus;

View File

@@ -20,27 +20,25 @@
<form name="websiteCreationForm" action="/" id="createPackages" <form name="websiteCreationForm" action="/" id="createPackages"
class="form-horizontal bordered-row panel-body"> class="form-horizontal bordered-row panel-body">
<label>{% trans "Plugin Bucket Name" %}</label> <label>{% trans "Plugin Bucket Name" %} <img ng-hide="webSiteCreationLoading"
src="{% static 'images/loading.gif' %}"></label>
<input name="PluginbucketName" type="text" class="form-control" <input name="PluginbucketName" type="text" class="form-control"
ng-model="PluginbucketName" ng-model="PluginbucketName"
required> required>
<label style="margin-top: 15px;">{% trans "Search Plugin Name" %}</label>
<input name="searchcontent" type="text" class="form-control" ng-model="searchcontent"
ng-keyup="$event.keyCode == 13 ? SearchPluginName('add') : null"
placeholder="{% trans "Search Plugin...." %}" required>
<label style="margin-top: 15px;">{% trans "Search Plugin Name" %}</label> <div id="mysearch" class="col-lg-12" style="display: none; border-top: none!important;
<input name="searchcontent" type="text" class="form-control" ng-model="searchcontent"
ng-keyup="SearchPluginName('add')"
placeholder="{% trans "Search Plugin...." %}" required>
<div id="mysearch" class="col-lg-12" style="display: none; border-top: none!important;
border: 1px solid rgba(90, 91, 92, 0.7); border: 1px solid rgba(90, 91, 92, 0.7);
position: absolute; z-index: 1; position: absolute; z-index: 1;
background-color: #FFFFFF"> background-color: #FFFFFF">
</div> </div>
<h3 style="margin-top: 20px;">Selected Plugin</h3> <h3 style="margin-top: 20px;">Selected Plugin</h3>

View File

@@ -1,6 +1,6 @@
{% extends "baseTemplate/index.html" %} {% extends "baseTemplate/index.html" %}
{% load i18n %} {% load i18n %}
{% block title %}{% trans "plugin - CyberPanel" %}{% endblock %} {% block title %}{% trans "Create Plugin Buckets - CyberPanel" %}{% endblock %}
{% block content %} {% block content %}
{% load static %} {% load static %}

View File

@@ -1,6 +1,6 @@
{% extends "baseTemplate/index.html" %} {% extends "baseTemplate/index.html" %}
{% load i18n %} {% load i18n %}
{% block title %}{% trans "Create New WordPress - CyberPanel" %}{% endblock %} {% block title %}{% trans "Deploy WordPress - CyberPanel" %}{% endblock %}
{% block content %} {% block content %}
{% load static %} {% load static %}
@@ -106,7 +106,7 @@
<div ng-hide="installationDetailsForm" class="form-group"> <div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Plugin/Theme" %}</label> <label class="col-sm-3 control-label">{% trans "Plugin/Theme" %}</label>
<div class="col-sm-6"> <div class="col-sm-6">
<select id="pliginbucket" ng-model="pluginbucket" class="form-control"> <select ng-model="pluginbucket" class="form-control">
<option value="-1" selected>Select Plugin Bucket</option> <option value="-1" selected>Select Plugin Bucket</option>
{% for wp in Plugins %} {% for wp in Plugins %}
<option value="{{ wp.id }}">{{ wp.Name }}</option> <option value="{{ wp.id }}">{{ wp.Name }}</option>

View File

@@ -1,6 +1,6 @@
{% extends "baseTemplate/index.html" %} {% extends "baseTemplate/index.html" %}
{% load i18n %} {% load i18n %}
{% block title %}{% trans "plugin - CyberPanel" %}{% endblock %} {% block title %}{% trans "Edit Plugin Bucket - CyberPanel" %}{% endblock %}
{% block content %} {% block content %}
{% load static %} {% load static %}

View File

@@ -1,6 +1,6 @@
{% extends "baseTemplate/index.html" %} {% extends "baseTemplate/index.html" %}
{% load i18n %} {% load i18n %}
{% block title %}{% trans "Worpress Manager - CyberPanel" %}{% endblock %} {% block title %}{% trans "WordPress Manager - CyberPanel" %}{% endblock %}
{% block content %} {% block content %}
{% load static %} {% load static %}

View File

@@ -1,6 +1,6 @@
{% extends "baseTemplate/index.html" %} {% extends "baseTemplate/index.html" %}
{% load i18n %} {% load i18n %}
{% block title %}{% trans "WordPress List - CyberPanel" %}{% endblock %} {% block title %}{% trans "WordPress Sites - CyberPanel" %}{% endblock %}
{% block content %} {% block content %}
{% load static %} {% load static %}
@@ -150,7 +150,7 @@
<div class="modal-body"> <div class="modal-body">
<form name="DeleteDocumentRootForm" action="/" class="form-horizontal"> <form name="DeleteDocumentRootForm" action="/" class="form-horizontal">
<span>Do you want to delete the site??</span> <span>Do you want to delete the site?</span>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-primary" <button type="button" class="btn btn-primary"
@@ -158,7 +158,7 @@
</button> </button>
<button type="button" ng-disabled="savingSettings" <button type="button" ng-disabled="savingSettings"
class="btn btn-default" data-dismiss="modal"> class="btn btn-default" data-dismiss="modal">
NOt Cancel
</button> </button>
</div> </div>
</div> </div>

View File

@@ -63,9 +63,7 @@ class WebsiteManager:
currentACL = ACLManager.loadedACL(userID) currentACL = ACLManager.loadedACL(userID)
adminNames = ACLManager.loadAllUsers(userID) adminNames = ACLManager.loadAllUsers(userID)
packagesName = ACLManager.loadPackages(userID, currentACL) packagesName = ACLManager.loadPackages(userID, currentACL)
phps = PHPManager.findPHPVersions()
FinalVersions = [] FinalVersions = []
#logging.CyberCPLogFileWriter.writeToFile("jassssssssss...............")
userobj = Administrator.objects.get(pk=userID) userobj = Administrator.objects.get(pk=userID)
counter = 0 counter = 0
try: try:
@@ -78,14 +76,11 @@ class WebsiteManager:
if versions['current'] not in FinalVersions: if versions['current'] not in FinalVersions:
FinalVersions.append(versions['current']) FinalVersions.append(versions['current'])
counter = counter + 1 counter = counter + 1
except: except:
FinalVersions = ['5.6', '5.5.3', '5.5.2'] FinalVersions = ['5.6', '5.5.3', '5.5.2']
Plugins = wpplugins.objects.filter(owner=userobj) Plugins = wpplugins.objects.filter(owner=userobj)
# logging.CyberCPLogFileWriter.writeToFile("FinalVersions:%s"+str(FinalVersions))
Data = {'packageList': packagesName, "owernList": adminNames, 'WPVersions': FinalVersions, 'Plugins': Plugins } Data = {'packageList': packagesName, "owernList": adminNames, 'WPVersions': FinalVersions, 'Plugins': Plugins }
proc = httpProc(request, 'websiteFunctions/WPCreate.html', proc = httpProc(request, 'websiteFunctions/WPCreate.html',
Data, 'createWebsite') Data, 'createWebsite')
@@ -94,17 +89,18 @@ class WebsiteManager:
def ListWPSites(self, request=None, userID=None, DeleteID=None): def ListWPSites(self, request=None, userID=None, DeleteID=None):
currentACL = ACLManager.loadedACL(userID) currentACL = ACLManager.loadedACL(userID)
userobj = Administrator.objects.get(pk=userID) admin = Administrator.objects.get(pk=userID)
webobjs = Websites.objects.all()
tata = {} tata = {}
tata['wp']=[] tata['wp']=[]
tata['wpsites']=[] tata['wpsites']=[]
tata['wp'] = WPSites.objects.all() tata['wp'] = ACLManager.GetALLWPObjects(currentACL, userID)
try: try:
if DeleteID != None: if DeleteID != None:
WPDelete = WPSites.objects.get(pk=DeleteID) WPDelete = WPSites.objects.get(pk=DeleteID)
WPDelete.delete()
if ACLManager.checkOwnership(WPDelete.owner.domain, admin, currentACL) == 1:
WPDelete.delete()
except BaseException as msg: except BaseException as msg:
pass pass
@@ -115,8 +111,6 @@ class WebsiteManager:
'url': sub.FinalURL 'url': sub.FinalURL
}) })
proc = httpProc(request, 'websiteFunctions/WPsitesList.html', proc = httpProc(request, 'websiteFunctions/WPsitesList.html',
{"wpsite": tata['wpsites']}) {"wpsite": tata['wpsites']})
return proc.render() return proc.render()
@@ -125,6 +119,12 @@ class WebsiteManager:
Data = {} Data = {}
currentACL = ACLManager.loadedACL(userID) currentACL = ACLManager.loadedACL(userID)
WPobj = WPSites.objects.get(pk=WPid) WPobj = WPSites.objects.get(pk=WPid)
admin = Administrator.objects.get(pk=userID)
if ACLManager.checkOwnership(WPobj.owner.domain, admin, currentACL) == 1:
pass
else:
return ACLManager.loadError()
Data['wpsite'] = WPobj Data['wpsite'] = WPobj
@@ -132,11 +132,10 @@ class WebsiteManager:
DeleteID = request.GET.get('DeleteID', None) DeleteID = request.GET.get('DeleteID', None)
if DeleteID != None: if DeleteID != None:
wstagingDelete = WPStaging.objects.get(pk=DeleteID) wstagingDelete = WPStaging.objects.get(pk=DeleteID, owner=WPobj)
wstagingDelete.delete() wstagingDelete.delete()
except BaseException as msg: except BaseException as msg:
da= str(msg) da= str(msg)
proc = httpProc(request, 'websiteFunctions/WPsiteHome.html', proc = httpProc(request, 'websiteFunctions/WPsiteHome.html',
@@ -146,7 +145,14 @@ class WebsiteManager:
def AutoLogin(self, request=None, userID=None): def AutoLogin(self, request=None, userID=None):
WPid = request.GET.get('id') WPid = request.GET.get('id')
currentACL = ACLManager.loadedACL(userID)
WPobj = WPSites.objects.get(pk=WPid) WPobj = WPSites.objects.get(pk=WPid)
admin = Administrator.objects.get(pk=userID)
if ACLManager.checkOwnership(WPobj.owner.domain, admin, currentACL) == 1:
pass
else:
return ACLManager.loadError()
#php = VirtualHost.getPHPString(self.data['PHPVersion']) #php = VirtualHost.getPHPString(self.data['PHPVersion'])
#FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php) #FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
@@ -176,27 +182,21 @@ class WebsiteManager:
data, 'createWebsite') data, 'createWebsite')
return proc.render() return proc.render()
def ConfigurePlugins(self, request=None, userID=None, data=None): def ConfigurePlugins(self, request=None, userID=None, data=None):
DataPass ={} DataPass ={}
currentACL = ACLManager.loadedACL(userID) currentACL = ACLManager.loadedACL(userID)
adminNames = ACLManager.loadAllUsers(userID)
packagesName = ACLManager.loadPackages(userID, currentACL)
phps = PHPManager.findPHPVersions()
userobj = Administrator.objects.get(pk=userID) userobj = Administrator.objects.get(pk=userID)
Selectedplugins = wpplugins.objects.filter(owner = userobj) Selectedplugins = wpplugins.objects.filter(owner = userobj)
#data['Selectedplugins'] = wpplugins.objects.filter(ProjectOwner=HostingCompany) #data['Selectedplugins'] = wpplugins.objects.filter(ProjectOwner=HostingCompany)
Data = {'packageList': packagesName, "owernList": adminNames, 'phps': phps, 'Selectedplugins' : Selectedplugins,} Data = {'Selectedplugins' : Selectedplugins,}
proc = httpProc(request, 'websiteFunctions/WPConfigurePlugins.html', proc = httpProc(request, 'websiteFunctions/WPConfigurePlugins.html',
Data, 'createWebsite') Data, 'createWebsite')
return proc.render() return proc.render()
def Addnewplugin(self, request=None, userID=None, data=None): def Addnewplugin(self, request=None, userID=None, data=None):
currentACL = ACLManager.loadedACL(userID) currentACL = ACLManager.loadedACL(userID)
adminNames = ACLManager.loadAllUsers(userID) adminNames = ACLManager.loadAllUsers(userID)
@@ -233,7 +233,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
def AddNewpluginAjax(self, userID=None, data=None): def AddNewpluginAjax(self, userID=None, data=None):
try: try:
currentACL = ACLManager.loadedACL(userID) currentACL = ACLManager.loadedACL(userID)
@@ -260,7 +259,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
def EidtPlugin(self,request=None, userID=None, pluginbID=None): def EidtPlugin(self,request=None, userID=None, pluginbID=None):
Data ={} Data ={}
currentACL = ACLManager.loadedACL(userID) currentACL = ACLManager.loadedACL(userID)
@@ -275,7 +273,6 @@ class WebsiteManager:
Data, 'createWebsite') Data, 'createWebsite')
return proc.render() return proc.render()
def deletesPlgin(self, userID=None, data=None,): def deletesPlgin(self, userID=None, data=None,):
try: try:
currentACL = ACLManager.loadedACL(userID) currentACL = ACLManager.loadedACL(userID)
@@ -304,7 +301,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
def Addplugineidt(self, userID=None, data=None,): def Addplugineidt(self, userID=None, data=None,):
try: try:
currentACL = ACLManager.loadedACL(userID) currentACL = ACLManager.loadedACL(userID)
@@ -343,7 +339,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
def modifyWebsite(self, request=None, userID=None, data=None): def modifyWebsite(self, request=None, userID=None, data=None):
currentACL = ACLManager.loadedACL(userID) currentACL = ACLManager.loadedACL(userID)
@@ -429,7 +424,6 @@ class WebsiteManager:
}) })
return proc.render() return proc.render()
def FetchWPdata(self, userID=None, data=None): def FetchWPdata(self, userID=None, data=None):
try: try:
currentACL = ACLManager.loadedACL(userID) currentACL = ACLManager.loadedACL(userID)
@@ -437,20 +431,23 @@ class WebsiteManager:
WPManagerID = data['WPid'] WPManagerID = data['WPid']
wpsite = WPSites.objects.get(pk=WPManagerID) wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
pass
else:
return ACLManager.loadError()
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id) Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion) php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php) FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp core version --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, path) command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp core version --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, path)
version = ProcessUtilities.outputExecutioner(command) version = ProcessUtilities.outputExecutioner(command)
@@ -506,7 +503,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
def GetCurrentPlugins(self, userID=None, data=None): def GetCurrentPlugins(self, userID=None, data=None):
try: try:
@@ -515,6 +511,12 @@ class WebsiteManager:
WPManagerID = data['WPid'] WPManagerID = data['WPid']
wpsite = WPSites.objects.get(pk=WPManagerID) wpsite = WPSites.objects.get(pk=WPManagerID)
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
pass
else:
return ACLManager.loadError()
path = wpsite.path path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id) Webobj= Websites.objects.get(pk=wpsite.owner_id)
@@ -540,7 +542,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
def GetCurrentThemes(self, userID=None, data=None): def GetCurrentThemes(self, userID=None, data=None):
try: try:
@@ -549,6 +550,12 @@ class WebsiteManager:
WPManagerID = data['WPid'] WPManagerID = data['WPid']
wpsite = WPSites.objects.get(pk=WPManagerID) wpsite = WPSites.objects.get(pk=WPManagerID)
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
pass
else:
return ACLManager.loadError()
path = wpsite.path path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id) Webobj= Websites.objects.get(pk=wpsite.owner_id)
@@ -577,7 +584,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
def fetchstaging(self, userID=None, data=None): def fetchstaging(self, userID=None, data=None):
try: try:
@@ -587,6 +593,10 @@ class WebsiteManager:
WPManagerID = data['WPid'] WPManagerID = data['WPid']
wpsite = WPSites.objects.get(pk=WPManagerID) wpsite = WPSites.objects.get(pk=WPManagerID)
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
pass
else:
return ACLManager.loadError()
from plogical.phpUtilities import phpUtilities from plogical.phpUtilities import phpUtilities
@@ -604,8 +614,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
def SaveUpdateConfig(self, userID=None, data=None): def SaveUpdateConfig(self, userID=None, data=None):
try: try:
@@ -619,6 +627,11 @@ class WebsiteManager:
wpsite = WPSites.objects.get(pk=WPManagerID) wpsite = WPSites.objects.get(pk=WPManagerID)
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
pass
else:
return ACLManager.loadError()
wpsite.AutoUpdates = AutomaticUpdates wpsite.AutoUpdates = AutomaticUpdates
wpsite.PluginUpdates = Plugins wpsite.PluginUpdates = Plugins
wpsite.ThemeUpdates = Themes wpsite.ThemeUpdates = Themes
@@ -634,7 +647,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
def UpdatePlugins(self, userID=None, data=None): def UpdatePlugins(self, userID=None, data=None):
try: try:
@@ -645,6 +657,12 @@ class WebsiteManager:
plugin = data['plugin'] plugin = data['plugin']
pluginarray = data['pluginarray'] pluginarray = data['pluginarray']
wpsite = WPSites.objects.get(pk=WPManagerID) wpsite = WPSites.objects.get(pk=WPManagerID)
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
pass
else:
return ACLManager.loadError()
path = wpsite.path path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id) Webobj= Websites.objects.get(pk=wpsite.owner_id)
@@ -679,7 +697,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
def UpdateThemes(self, userID=None, data=None): def UpdateThemes(self, userID=None, data=None):
try: try:
@@ -691,6 +708,12 @@ class WebsiteManager:
Theme = data['Theme'] Theme = data['Theme']
Themearray = data['Themearray'] Themearray = data['Themearray']
wpsite = WPSites.objects.get(pk=WPManagerID) wpsite = WPSites.objects.get(pk=WPManagerID)
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
pass
else:
return ACLManager.loadError()
path = wpsite.path path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id) Webobj= Websites.objects.get(pk=wpsite.owner_id)
@@ -731,8 +754,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
def DeletePlugins(self, userID=None, data=None): def DeletePlugins(self, userID=None, data=None):
try: try:
@@ -743,6 +764,12 @@ class WebsiteManager:
plugin = data['plugin'] plugin = data['plugin']
pluginarray = data['pluginarray'] pluginarray = data['pluginarray']
wpsite = WPSites.objects.get(pk=WPManagerID) wpsite = WPSites.objects.get(pk=WPManagerID)
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
pass
else:
return ACLManager.loadError()
path = wpsite.path path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id) Webobj= Websites.objects.get(pk=wpsite.owner_id)
@@ -776,7 +803,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
def DeleteThemes(self, userID=None, data=None): def DeleteThemes(self, userID=None, data=None):
try: try:
@@ -791,6 +817,11 @@ class WebsiteManager:
Webobj= Websites.objects.get(pk=wpsite.owner_id) Webobj= Websites.objects.get(pk=wpsite.owner_id)
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
pass
else:
return ACLManager.loadError()
Vhuser = Webobj.externalApp Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion) php = ACLManager.getPHPString(PHPVersion)
@@ -822,7 +853,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
def ChangeStatus(self, userID=None, data=None): def ChangeStatus(self, userID=None, data=None):
try: try:
@@ -832,6 +862,12 @@ class WebsiteManager:
WPManagerID = data['WPid'] WPManagerID = data['WPid']
plugin = data['plugin'] plugin = data['plugin']
wpsite = WPSites.objects.get(pk=WPManagerID) wpsite = WPSites.objects.get(pk=WPManagerID)
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
pass
else:
return ACLManager.loadError()
path = wpsite.path path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id) Webobj= Websites.objects.get(pk=wpsite.owner_id)
@@ -868,7 +904,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
def ChangeStatusThemes(self, userID=None, data=None): def ChangeStatusThemes(self, userID=None, data=None):
try: try:
# logging.CyberCPLogFileWriter.writeToFile("Error WP ChangeStatusThemes ....... %s") # logging.CyberCPLogFileWriter.writeToFile("Error WP ChangeStatusThemes ....... %s")
@@ -878,6 +913,12 @@ class WebsiteManager:
WPManagerID = data['WPid'] WPManagerID = data['WPid']
Theme = data['theme'] Theme = data['theme']
wpsite = WPSites.objects.get(pk=WPManagerID) wpsite = WPSites.objects.get(pk=WPManagerID)
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
pass
else:
return ACLManager.loadError()
path = wpsite.path path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id) Webobj= Websites.objects.get(pk=wpsite.owner_id)
@@ -914,7 +955,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
def CreateStagingNow(self, userID=None, data=None): def CreateStagingNow(self, userID=None, data=None):
try: try:
currentACL = ACLManager.loadedACL(userID) currentACL = ACLManager.loadedACL(userID)
@@ -927,6 +967,13 @@ class WebsiteManager:
extraArgs['WPid'] = data['WPid'] extraArgs['WPid'] = data['WPid']
extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999)) extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999))
wpsite = WPSites.objects.get(pk=data['WPid'])
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
pass
else:
return ACLManager.loadError()
background = ApplicationInstaller('CreateStagingNow', extraArgs) background = ApplicationInstaller('CreateStagingNow', extraArgs)
background.start() background.start()
@@ -943,9 +990,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
def UpdateWPSettings(self, userID=None, data=None): def UpdateWPSettings(self, userID=None, data=None):
try: try:
@@ -956,6 +1000,12 @@ class WebsiteManager:
setting = data['setting'] setting = data['setting']
settingValue = data['settingValue'] settingValue = data['settingValue']
wpsite = WPSites.objects.get(pk=WPManagerID) wpsite = WPSites.objects.get(pk=WPManagerID)
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
pass
else:
return ACLManager.loadError()
path = wpsite.path path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id) Webobj= Websites.objects.get(pk=wpsite.owner_id)
@@ -1047,18 +1097,22 @@ class WebsiteManager:
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
def submitWorpressCreation(self, userID=None, data=None): def submitWorpressCreation(self, userID=None, data=None):
try: try:
currentACL = ACLManager.loadedACL(userID) currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID) admin = Administrator.objects.get(pk=userID)
extraArgs = {} extraArgs = {}
extraArgs['currentACL'] = currentACL
extraArgs['adminID'] = admin.pk extraArgs['adminID'] = admin.pk
extraArgs['domainName'] = data['domain'] extraArgs['domainName'] = data['domain']
extraArgs['WPVersion'] = data['WPVersion'] extraArgs['WPVersion'] = data['WPVersion']
extraArgs['blogTitle'] = data['title'] extraArgs['blogTitle'] = data['title']
extraArgs['pluginbucket'] = data['pluginbucket'] try:
extraArgs['pluginbucket'] = data['pluginbucket']
except:
extraArgs['pluginbucket'] = '-1'
extraArgs['adminUser'] = data['adminUser'] extraArgs['adminUser'] = data['adminUser']
extraArgs['PasswordByPass'] = data['PasswordByPass'] extraArgs['PasswordByPass'] = data['PasswordByPass']
extraArgs['adminPassword'] = data['PasswordByPass'] extraArgs['adminPassword'] = data['PasswordByPass']