Merge branch 'v2.3.2-dev' into stable

This commit is contained in:
Usman Nasir 2022-05-24 23:16:48 +05:00 committed by GitHub
commit 7e59b523df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
63 changed files with 16961 additions and 853 deletions

View File

@ -72,7 +72,7 @@ class secMiddleware:
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
if request.build_absolute_uri().find('api/verifyConn') > -1 or request.build_absolute_uri().find('webhook') > -1 or request.build_absolute_uri().find('saveSpamAssassinConfigurations') > -1 or request.build_absolute_uri().find('docker') > -1 or request.build_absolute_uri().find('cloudAPI') > -1 or request.build_absolute_uri().find('verifyLogin') > -1 or request.build_absolute_uri().find('submitUserCreation') > -1:
if request.build_absolute_uri().find('api/remoteTransfer') > -1 or request.build_absolute_uri().find('api/verifyConn') > -1 or request.build_absolute_uri().find('webhook') > -1 or request.build_absolute_uri().find('saveSpamAssassinConfigurations') > -1 or request.build_absolute_uri().find('docker') > -1 or request.build_absolute_uri().find('cloudAPI') > -1 or request.build_absolute_uri().find('verifyLogin') > -1 or request.build_absolute_uri().find('submitUserCreation') > -1:
continue
if key == 'key' or key == 'cert' or key == 'recordContentAAAA' or key == 'backupDestinations' or key == 'ports' \
or key == 'imageByPass' or key == 'passwordByPass' or key == 'cronCommand' \

View File

@ -24,7 +24,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'xr%j*p!*$0d%(-(e%@-*hyoz4$f%y77coq0u)6pwmjg4)q&19f'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
DEBUG = True
ALLOWED_HOSTS = ['*']

View File

@ -939,6 +939,4 @@ Subject: %s
except BaseException as msg:
logging.statusWriter(self.statusPath, "%s [903:DeleteSnapShot][5009]" % (str(msg)), 1)
return 0
return 0

View File

@ -1,33 +1,34 @@
# CyberPanel
Webhosting control panel that uses OpenLiteSpeed as web server.
Web Hosting Control Panel that uses OpenLiteSpeed as the underlying Web Server.
## Features
## Features & Services
* Different Level Of users.
* Different User Access Levels (via ACLs).
* Auto SSL.
* FTP Server.
* Light weight DNS Server (PowerDNS).
* PHPMYAdmin.
* Email Support (Rainloop).
* FileManager.
* Light-weight DNS Server (PowerDNS).
* phpMyAdmin to manage DBs (MariaDB).
* Email Support (SnappyMail).
* File Manager.
* PHP Managment.
* Firewall (FirewallD & ConfigServer Firewall Intregration).
* One click Backup and Restore.
* Firewall (FirewallD & ConfigServer Firewall Integration).
* One-click Backups and Restores.
# Supported PHPs
# Supported PHP Versions
* PHP 5.3
* PHP 5.4
* PHP 5.5
* PHP 5.6
* PHP 7.0
* PHP 7.1
* PHP 7.2
* PHP 7.3
* PHP 7.4
* PHP 8.0
* PHP 8.1
* PHP 8.0
* PHP 7.4
* PHP 7.3
* PHP 7.2
* PHP 7.1
* PHP 7.0
* PHP 5.6
* PHP 5.5
* PHP 5.4
* PHP 5.3
# Installation Instructions
@ -36,7 +37,7 @@ Webhosting control panel that uses OpenLiteSpeed as web server.
sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/install.sh)
```
# Upgrading
# Upgrading CyberPanel
```
@ -46,8 +47,10 @@ sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgr
# Resources
* [Official Site.](https://cyberpanel.net)
* [Documentation.](https://docs.cyberpanel.net)
* [Forums.](https://forums.cyberpanel.net)
* [Docs (Old).](https://docs.cyberpanel.net)
* [Docs (New).](https://community.cyberpanel.net/docs)
* [Changelog.](https://community.cyberpanel.net/t/change-logs/161)
* [Forums.](https://community.cyberpanel.net)
* [Discord.](https://discord.gg/g8k8Db3)
* [Facebook Group.](https://www.facebook.com/groups/cyberpanel)
* [YouTube Channel.](https://www.youtube.com/channel/UCS6sgUWEhaFl1TO238Ck0xw)

52
README.md.bak Normal file
View File

@ -0,0 +1,52 @@
# CyberPanel
Webhosting control panel that uses OpenLiteSpeed as web server.
## Features
* Different Level Of users.
* Auto SSL.
* FTP Server.
* Light weight DNS Server (PowerDNS).
* PHPMYAdmin.
* Email Support (Rainloop).
* FileManager.
* PHP Managment.
* Firewall (FirewallD & ConfigServer Firewall Intregration).
* One click Backup and Restore.
# Supported PHPs
* PHP 5.3
* PHP 5.4
* PHP 5.5
* PHP 5.6
* PHP 7.0
* PHP 7.1
* PHP 7.2
* PHP 7.3
* PHP 7.4
* PHP 8.0
# Installation Instructions
```
sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/install.sh)
```
# Upgrading
```
sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh)
```
# Resources
* [Official Site.](https://cyberpanel.net)
* [Documentation.](https://docs.cyberpanel.net)
* [Forums.](https://forums.cyberpanel.net)
* [Discord.](https://discord.gg/g8k8Db3)
* [Facebook Group.](https://www.facebook.com/groups/cyberpanel)

View File

@ -435,10 +435,14 @@ def remoteTransfer(request):
## Accounts to transfer is a path to file, containing accounts.
execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/remoteTransferUtilities.py"
execPath = execPath + " remoteTransfer --ipAddress " + ipAddress + " --dir " + dir + " --accountsToTransfer " + path
execPath = execPath + " remoteTransfer --ipAddress " + ipAddress.rstrip('\n') + " --dir " + dir + " --accountsToTransfer " + path
ProcessUtilities.popenExecutioner(execPath)
if os.path.exists('/usr/local/CyberCP/debug'):
logging.writeToFile('Repor of %s' % repr(execPath))
return HttpResponse(json.dumps({"transferStatus": 1, "dir": dir}))
##

View File

@ -1163,6 +1163,10 @@ class BackupManager:
r = requests.post(url, data=finalData, verify=False)
if os.path.exists('/usr/local/CyberCP/debug'):
message = 'Remote transfer initiation status: %s' % (r.text)
logging.CyberCPLogFileWriter.writeToFile(message)
data = json.loads(r.text)
if data['transferStatus'] == 1:

View File

@ -297,31 +297,31 @@
<ul id="sidebar-menu">
<li class="header"><span>{% trans "Overview" %}</span></li>
<li>
<a href="#" title="{% trans 'Server IP Address' %}">
<a id="sidebar-menu-item-server-ip-address" href="#" title="{% trans 'Server IP Address' %}">
<i class="glyph-icon tooltip-button icon-laptop" title="{% trans 'Server IP Address' %}"
data-original-title=".icon-laptop"></i>
<span style="color: #db6868;font-weight: bold;">{{ ipAddress }}</span>
</a>
<a href="{% url 'index' %}" title="{% trans 'Dashboard' %}">
<a id="sidebar-menu-item-dashboard" href="{% url 'index' %}" title="{% trans 'Dashboard' %}">
<i class="glyph-icon icon-dashboard"></i>
<span>{% trans "Dashboard" %}</span>
</a>
{% if admin or versionManagement %}
<a href="{% url 'versionManagment' %}"
<a id="sidebar-menu-item-version-management" href="{% url 'versionManagment' %}"
title="{% trans 'Version Management' %}">
<i class="glyph-icon tooltip-button icon-info"
title="{% trans 'Version Management' %}" data-original-title=".icon-cloud-upload"
aria-describedby="tooltip896208"></i>
<span>{% trans "Version Management" %}</span>
</a>
<a href="{% url 'design' %}"
<a id="sidebar-menu-item-design" href="{% url 'design' %}"
title="{% trans 'Design' %}">
<i class="glyph-icon tooltip-button icon-cog"
title="{% trans 'Design' %}" data-original-title=".icon-cloud-upload"
aria-describedby="tooltip896208"></i>
<span>{% trans "Design" %}</span>
</a>
<a href="https://go.cyberpanel.net/cloud"
<a id="sidebar-menu-item-connect" href="https://go.cyberpanel.net/cloud"
title="{% trans 'Connect' %}">
<i class="glyph-icon tooltip-button icon-link" title="{% trans 'Connect' %}"
data-original-title=".icon-cloud-upload" aria-describedby="tooltip896208"></i>
@ -339,7 +339,7 @@
<li class="divider"></li>
<li class="header"><span>{% trans "Main" %}</span></li>
<li>
<li id="sidebar-menu-item-users">
<a href="{% url 'loadUsersHome' %}" title="{% trans 'Users' %}">
<i class="glyph-icon icon-users" title="{% trans 'Users' %}"></i>
<span>{% trans "Users" %}</span>
@ -389,6 +389,34 @@
</div><!-- .sidebar-submenu -->
</li>
<li id="sidebar-menu-item-websites">
<!-------------WordPress--------------------------->
<li>
<a href="{% url 'loadWebsitesHome' %}" title="{% trans 'WordPress' %}">
<div class="glyph-icon icon-wordpress" title="{% trans 'WordPress' %}"></div>
<span>{% trans "Wordpresss" %}</span>
</a>
<div class="sidebar-submenu">
<ul>
{% if admin or createWebsite %}
<li><a href="{% url 'createWordpress' %}"
title="{% trans 'Create Worpress' %}"><span>{% trans "Create Worpress" %}</span></a>
</li>
{% endif %}
<li><a href="{% url 'ListWPSites' %}"
title="{% trans 'List Websites' %}"><span>{% trans "List Worpress" %}</span></a>
</li>
<li><a href="{% url 'ConfigurePlugins' %}"
title="{% trans 'ConfigurePlugins' %}"><span>{% trans "Configure Plugins" %}</span></a>
</li>
</ul>
</div><!-- .sidebar-submenu -->
</li>
<li>
<a href="{% url 'loadWebsitesHome' %}" title="{% trans 'Websites' %}">
<div class="glyph-icon icon-globe" title="{% trans 'Websites' %}"></div>
@ -397,11 +425,12 @@
<div class="sidebar-submenu">
<ul>
{% if admin or createWebsite %}
{% if admin or createWebsite %}
<li><a href="{% url 'createWebsite' %}"
title="{% trans 'Create Website' %}"><span>{% trans "Create Website" %}</span></a>
</li>
{% endif %}
<li><a href="{% url 'listWebsites' %}"
title="{% trans 'List Websites' %}"><span>{% trans "List Websites" %}</span></a>
</li>
@ -430,7 +459,7 @@
</div><!-- .sidebar-submenu -->
</li>
<li>
<li id="sidebar-menu-item-packages">
<a id="packageHome" href="{% url 'packagesHome' %}" title="{% trans 'Packages' %}">
<i class="glyph-icon icon-cubes"></i>
<span>{% trans "Packages" %}</span>
@ -462,7 +491,7 @@
</div><!-- .sidebar-submenu -->
</li>
<li>
<li id="sidebar-menu-item-databases">
<a title="{% trans 'Databases' %}">
<i class="glyph-icon icon-database" title="{% trans 'Databases' %}"></i>
<span>{% trans "Databases" %}</span>
@ -497,7 +526,7 @@
{% if dnsAsWhole %}
<li class="dnsAsWhole">
<li id="sidebar-menu-item-dns" class="dnsAsWhole">
<a title="{% trans 'DNS' %}">
<i class="glyph-icon icon-sitemap"></i>
<span>{% trans "DNS" %}</span>
@ -545,7 +574,7 @@
{% if emailAsWhole %}
<li class="emailAsWhole">
<li id="sidebar-menu-item-email" class="emailAsWhole">
<a href="{% url 'loadEmailHome' %}" title="{% trans 'Email' %}">
<i class="glyph-icon icon-paper-plane"></i>
<span>{% trans "Email" %}</span>
@ -584,7 +613,7 @@
</li>
{% endif %}
{% if admin or createEmail %}
<li><a href="/rainloop/index.php" title="{% trans 'Access Webmail' %}"
<li><a href="/snappymail/index.php" title="{% trans 'Access Webmail' %}"
target="_blank"><span>{% trans "Access Webmail" %}</span></a>
</li>
{% endif %}
@ -596,7 +625,7 @@
{% endif %}
{% if ftpAsWhole %}
<li class="ftpAsWhole">
<li id="sidebar-menu-item-ftp" class="ftpAsWhole">
<a href="{% url 'ftpHome' %}" title="{% trans 'FTP' %}">
<i class="glyph-icon icon-cloud-upload"></i>
<span>{% trans "FTP" %}</span>
@ -626,7 +655,7 @@
{% endif %}
<li>
<li id="sidebar-menu-item-backup">
<a href="{% url 'loadBackupHome' %}" title="{% trans 'Backup' %}">
<i class="glyph-icon tooltip-button icon-copy" title=".icon-folder"></i>
<span>{% trans "Backup" %}</span>
@ -670,7 +699,7 @@
</li>
<li>
<li id="sidebar-menu-item-incremental-backup">
<a href="{% url 'loadBackupHome' %}" title="{% trans 'Incremental Backup - Beta' %}">
<i class="glyph-icon tooltip-button icon-save" title="Incremental Backup"></i>
<span>{% trans "Incremental Backup" %}</span>
@ -704,7 +733,7 @@
</li>
<li>
<li id="sidebar-menu-item-ssl">
<a href="{% url 'loadSSLHome' %}" title="{% trans 'Backup' %}">
<i class="glyph-icon tooltip-button icon-lock" title="{% trans 'SSL' %}"></i>
<span>{% trans "SSL" %}</span>
@ -762,7 +791,7 @@
{# </div><!-- .sidebar-submenu -->#}
{# </li>#}
<li>
<li id="sidebar-menu-item-cloudlinux">
<a href="#" title="{% trans 'CloudLinux' %}">
<i class="glyph-icon icon-linecons-fire"></i>
<span>{% trans "CloudLinux" %}</span>
@ -794,7 +823,7 @@
</div><!-- .sidebar-submenu -->
</li>
<li>
<li id="sidebar-menu-item-containerization">
<a href="#" title="{% trans 'Containerization' %}">
<i class="glyph-icon icon-linecons-fire"></i>
<span>{% trans "Containerization" %}</span>
@ -811,7 +840,7 @@
</div><!-- .sidebar-submenu -->
</li>
<li>
<li id="sidebar-menu-item-docker">
<a href="#" title="{% trans 'Docker' %}">
<i class="glyph-icon icon-cogs"></i>
<span>{% trans "Docker Manager" %}</span>
@ -834,7 +863,7 @@
</div><!-- .sidebar-submenu -->
</li>
<li>
<li id="sidebar-menu-item-tuning">
<a href="#" title="{% trans 'Tuning' %}">
<i class="glyph-icon icon-adjust"></i>
<span>{% trans "Tuning" %}</span>
@ -853,7 +882,7 @@
</div><!-- .sidebar-submenu -->
</li>
<li>
<li id="sidebar-menu-item-server-status">
<a href="#" title="{% trans 'Server Status' %}">
<i class="glyph-icon icon-cog"></i>
<span>{% trans "Server Status" %}</span>
@ -878,7 +907,7 @@
</div><!-- .sidebar-submenu -->
</li>
<li>
<li id="sidebar-menu-item-php">
<a href="{% url 'loadPHPHome' %}" title="{% trans 'PHP' %}">
<i class="glyph-icon icon-code"></i>
<span>{% trans "PHP" %}</span>
@ -897,7 +926,7 @@
</div><!-- .sidebar-submenu -->
</li>
<li>
<li id="sidebar-menu-item-server-status">
<a href="{% url 'logsHome' %}" title="{% trans 'Server Status' %}">
<i class="glyph-icon icon-file"></i>
<span>{% trans "Logs" %}</span>
@ -931,7 +960,7 @@
</div><!-- .sidebar-submenu -->
</li>
<li>
<li id="sidebar-menu-item-security">
<a href="{% url 'securityHome' %}" title="{% trans 'Security' %}">
<i class="glyph-icon icon-shield"></i>
<span>{% trans "Security" %}</span>
@ -968,7 +997,7 @@
</div><!-- .sidebar-submenu -->
</li>
<li class="emailAsWhole">
<li id="sidebar-menu-item-mail-settings" class="emailAsWhole">
<a href="#" title="{% trans 'Mail Settings' %}">
<i class="glyph-icon icon-envelope"></i>
<span>{% trans "Mail Settings" %}</span>
@ -1000,7 +1029,7 @@
</div><!-- .sidebar-submenu -->
</li>
<li>
<li id="sidebar-menu-item-manage-services">
<a href="#" title="{% trans 'Manage Services' %}">
<i class="glyph-icon icon-folder-open"></i>
<span>{% trans "Manage Services" %}</span>
@ -1028,7 +1057,7 @@
</div><!-- .sidebar-submenu -->
</li>
<li>
<li id="sidebar-menu-item-plugins">
<a href="#" title="{% trans 'Plugins' %}">
<i class="glyph-icon icon-plug"></i>
<span>{% trans "Plugins" %}</span>

File diff suppressed because it is too large Load Diff

View File

@ -1,87 +1,97 @@
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{% trans "Version Management - CyberPanel" %}"{% endblock %}
{% block title %}{% trans "Version Management - CyberPanel" %}{% endblock %}
{% block content %}
{% load static %}
{% load static %}
<div class="container">
<div id="page-title">
<h2>{% trans "Version Management" %}</h2>
<p>{% trans "On this page you can manage versions and or upgrade to latest version of CyberPanel" %}</p>
</div>
{% if Notecheck %}
<div class="container">
<div id="page-title">
<h2>{% trans "Version Management" %}</h2>
<p>{% trans "On this page you can manage versions and or upgrade to latest version of CyberPanel" %}</p>
</div>
{% if Notecheck %}
<div class="alert alert-info">
<p style="color:red; font-weight: bold ;">{% trans "Note: Latest commit does not match, please upgrade." %}</p>
<p style="color:red; font-weight: bold ;">{% trans "Note: Latest commit does not match, please upgrade." %}</p>
</div>
{% endif %}
<div class="panel">
<div class="panel-body">
<h3 class="title-hero">
CyberPanel
</h3>
<div ng-controller="versionManagment" class="example-box-wrapper">
<div class="panel">
<div class="panel-body">
<h3 class="title-hero">
CyberPanel
</h3>
<div ng-controller="versionManagment" class="example-box-wrapper">
<form action="/" class="form-horizontal bordered-row">
<div class="form-group">
<form action="/" class="form-horizontal bordered-row">
<div class="form-group">
<label class="col-sm-3 control-label " style="margin: 0px!important; padding: 0px!important;">{% trans "Current Version :" %}&nbsp&nbsp</label>
<div class="current-pack col-sm-9" style="margin: 0px!important; padding: 0px!important;">{{ currentVersion }} </div>
<label class="col-sm-3 control-label "
style="margin: 0px!important; padding: 0px!important;">{% trans "Current Version :" %}&nbsp&nbsp</label>
<div class="current-pack col-sm-9"
style="margin: 0px!important; padding: 0px!important;">{{ currentVersion }} </div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label "
style="margin: 0px!important; padding: 0px!important;">{% trans "Build :" %}&nbsp&nbsp</label>
<div class="current-pack col-sm-9"
style="margin: 0px!important; padding: 0px!important;">{{ build }} </div>
<label class="col-sm-3 control-label "
style="margin: 0px!important; padding: 0px!important;">{% trans "Current Commit :" %}&nbsp&nbsp</label>
<div class="current-pack col-sm-9"
style="margin: 0px!important; padding: 0px!important;">{{ Currentcomt }} </div>
<div class="form-group">
<label class="col-sm-3 control-label " style="margin: 0px!important; padding: 0px!important;">{% trans "Build :" %}&nbsp&nbsp</label>
<div class="current-pack col-sm-9" style="margin: 0px!important; padding: 0px!important;">{{ build }} </div>
<label class="col-sm-3 control-label " style="margin: 0px!important; padding: 0px!important;">{% trans "Current Commit :" %}&nbsp&nbsp</label>
<div class="current-pack col-sm-9" style="margin: 0px!important; padding: 0px!important;">{{ Currentcomt }} </div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label "
style="margin: 0px!important; padding: 0px!important;">{% trans "Latest Version :" %}&nbsp&nbsp</label>
<div class="current-pack col-sm-9"
style="margin: 0px!important; padding: 0px!important;">{{ latestVersion }} </div>
<div class="form-group">
<label class="col-sm-3 control-label " style="margin: 0px!important; padding: 0px!important;">{% trans "Latest Version :" %}&nbsp&nbsp</label>
<div class="current-pack col-sm-9" style="margin: 0px!important; padding: 0px!important;">{{ latestVersion }} </div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label "
style="margin: 0px!important; padding: 0px!important;">{% trans "Latest Build :" %}&nbsp&nbsp</label>
<div class="current-pack col-sm-9"
style="margin: 0px!important; padding: 0px!important;">{{ latestBuild }} </div>
<label class="col-sm-3 control-label "
style="margin: 0px!important; padding: 0px!important;">{% trans "Latest Commit :" %}&nbsp&nbsp</label>
<div class="current-pack col-sm-9"
style="margin: 0px!important; padding: 0px!important;">{{ latestcomit }} </div>
{% comment %}<label class="col-sm-3 control-label "
style="margin: 0px!important; padding: 0px!important;">{% trans "# commits since update :" %}&nbsp&nbsp</label>
<div class="current-pack col-sm-9"
style="margin: 0px!important; padding: 0px!important;">{{ numCommits }} </div>{% endcomment %}
</div>
<div ng-hide="upgradelogBox" class="form-group">
<div class="col-sm-12">
<textarea ng-model="upgradeLog" rows="30" class="form-control">{{ logs }}</textarea>
</div>
</div>
</form>
</div>
<div class="form-group">
<label class="col-sm-3 control-label " style="margin: 0px!important; padding: 0px!important;">{% trans "Latest Build :" %}&nbsp&nbsp</label>
<div class="current-pack col-sm-9" style="margin: 0px!important; padding: 0px!important;">{{ latestBuild }} </div>
<label class="col-sm-3 control-label " style="margin: 0px!important; padding: 0px!important;">{% trans "Latest Commit :" %}&nbsp&nbsp</label>
<div class="current-pack col-sm-9" style="margin: 0px!important; padding: 0px!important;">{{ latestcomit }} </div>
</div>
<div ng-hide="upgradelogBox" class="form-group">
<div class="col-sm-12">
<textarea ng-model="upgradeLog" rows="30" class="form-control">{{ logs }}</textarea>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% endblock %}

View File

@ -119,10 +119,18 @@ def versionManagment(request):
output = ProcessUtilities.outputExecutioner(command)
Currentcomt = output.rstrip("\n")
notechk = True;
notechk = True
# command ="git fetch -C /usr/local/CyberCP/"
# output = ProcessUtilities.outputExecutioner(command)
#
# command ="git -C /usr/local/CyberCP/ log %s..%s --pretty=oneline | wc -l" % ( Currentcomt, latestcomit)
# output = ProcessUtilities.outputExecutioner(command)
#
# numCommits = output.rstrip("\n")
if(Currentcomt == latestcomit):
notechk = False;
notechk = False
template = 'baseTemplate/versionManagment.html'
@ -241,6 +249,13 @@ def design(request):
cosmetic = CyberPanelCosmetic()
cosmetic.save()
val = request.session['userID']
currentACL = ACLManager.loadedACL(val)
if currentACL['admin'] == 1:
pass
else:
return ACLManager.loadErrorJson('reboot', 0)
finalData = {}
if request.method == 'POST':

View File

@ -266,12 +266,12 @@ elif grep -q -E "CloudLinux 7|CloudLinux 8" /etc/os-release ; then
Server_OS="CloudLinux"
elif grep -q -E "Rocky Linux" /etc/os-release ; then
Server_OS="RockyLinux"
elif grep -q -E "Ubuntu 18.04|Ubuntu 20.04|Ubuntu 20.10" /etc/os-release ; then
elif grep -q -E "Ubuntu 18.04|Ubuntu 20.04|Ubuntu 20.10|Ubuntu 22.04" /etc/os-release ; then
Server_OS="Ubuntu"
else
echo -e "Unable to detect your system..."
echo -e "\nCyberPanel is supported on Ubuntu 18.04 x86_64, Ubuntu 20.04 x86_64, Ubuntu 20.10 x86_64, CentOS 7.x, CentOS 8.x, AlmaLinux 8.x, RockyLinux 8.x, CloudLinux 7.x, CloudLinux 8.x...\n"
Debug_Log2 "CyberPanel is supported on Ubuntu 18.04 x86_64, Ubuntu 20.04 x86_64, Ubuntu 20.10 x86_64, CentOS 7.x, CentOS 8.x, AlmaLinux 8.x, RockyLinux 8.x, CloudLinux 7.x, CloudLinux 8.x... [404]"
echo -e "\nCyberPanel is supported on Ubuntu 18.04 x86_64, Ubuntu 20.04 x86_64, Ubuntu 20.10 x86_64, Ubuntu 22.04 x86_64, CentOS 7.x, CentOS 8.x, AlmaLinux 8.x, RockyLinux 8.x, CloudLinux 7.x, CloudLinux 8.x...\n"
Debug_Log2 "CyberPanel is supported on Ubuntu 18.04 x86_64, Ubuntu 20.04 x86_64, Ubuntu 20.10 x86_64, Ubuntu 22.04 x86_64, CentOS 7.x, CentOS 8.x, AlmaLinux 8.x, RockyLinux 8.x, CloudLinux 7.x, CloudLinux 8.x... [404]"
exit
fi
@ -998,8 +998,13 @@ else
apt install -y --allow-downgrades libgnutls30=3.6.13-2ubuntu1.3
fi
DEBIAN_FRONTEND=noninteracitve apt install -y dnsutils net-tools htop telnet libcurl4-gnutls-dev libgnutls28-dev libgcrypt20-dev libattr1 libattr1-dev liblzma-dev libgpgme-dev libmariadbclient-dev libcurl4-gnutls-dev libssl-dev nghttp2 libnghttp2-dev idn2 libidn2-dev libidn2-0-dev librtmp-dev libpsl-dev nettle-dev libgnutls28-dev libldap2-dev libgssapi-krb5-2 libk5crypto3 libkrb5-dev libcomerr2 libldap2-dev virtualenv git socat vim unzip zip
Check_Return
if [[ "$Server_OS_Version" = "22" ]] ; then
DEBIAN_FRONTEND=noninteracitve apt install -y dnsutils net-tools htop telnet libcurl4-gnutls-dev libgnutls28-dev libgcrypt20-dev libattr1 libattr1-dev liblzma-dev libgpgme-dev libcurl4-gnutls-dev libssl-dev nghttp2 libnghttp2-dev idn2 libidn2-dev libidn2-0-dev librtmp-dev libpsl-dev nettle-dev libgnutls28-dev libldap2-dev libgssapi-krb5-2 libk5crypto3 libkrb5-dev libcomerr2 libldap2-dev virtualenv git socat vim unzip zip libmariadb-dev-compat libmariadb-dev
Check_Return
else
DEBIAN_FRONTEND=noninteracitve apt install -y dnsutils net-tools htop telnet libcurl4-gnutls-dev libgnutls28-dev libgcrypt20-dev libattr1 libattr1-dev liblzma-dev libgpgme-dev libmariadbclient-dev libcurl4-gnutls-dev libssl-dev nghttp2 libnghttp2-dev idn2 libidn2-dev libidn2-0-dev librtmp-dev libpsl-dev nettle-dev libgnutls28-dev libldap2-dev libgssapi-krb5-2 libk5crypto3 libkrb5-dev libcomerr2 libldap2-dev virtualenv git socat vim unzip zip
Check_Return
fi
DEBIAN_FRONTEND=noninteractive apt install -y python3-pip
Check_Return
@ -1027,8 +1032,13 @@ Retry_Command "pip install --default-timeout=3600 virtualenv==16.7.9"
Download_Requirement
if [[ "$Server_OS" = "Ubuntu" ]] && [[ "$Server_OS_Version" = "22" ]] ; then
python3 -m venv /usr/local/CyberPanel
Check_Return
else
virtualenv -p /usr/bin/python3 /usr/local/CyberPanel
Check_Return
fi
if [[ "$Server_OS" = "Ubuntu" ]] && [[ "$Server_OS_Version" != "20" ]] ; then
# shellcheck disable=SC1091
@ -1187,6 +1197,10 @@ if ! grep -q "pid_max" /etc/rc.local 2>/dev/null ; then
systemctl mask systemd-resolved >/dev/null 2>&1
fi
# Backup previous resolv.conf file
cp /etc/resolv.conf /etc/resolv.conf_bak
# Delete resolv.conf file
rm -f /etc/resolv.conf
if [[ "$Server_Provider" = "Tencent Cloud" ]] ; then
@ -1204,6 +1218,21 @@ if ! grep -q "pid_max" /etc/rc.local 2>/dev/null ; then
sleep 3
#take a break ,or installer will break
# Check Connectivity
if ping -q -c 1 -W 1 cyberpanel.sh >/dev/null; then
echo -e "\nSuccessfully set up nameservers..\n"
echo -e "\nThe network is up.. :)\n"
echo -e "\nContinue installation..\n"
else
echo -e "\nThe network is down.. :(\n"
rm -f /etc/resolv.conf
mv /etc/resolv.conf_bak /etc/resolv.conf
systemctl restart systemd-networkd >/dev/null 2>&1
echo -e "\nReturns the nameservers settings to default..\n"
echo -e "\nContinue installation..\n"
sleep 3
fi
cp /etc/resolv.conf /etc/resolv.conf-tmp
Line1="$(grep -n "f.write('nameserver 8.8.8.8')" installCyberPanel.py | head -n 1 | cut -d: -f1)"
@ -1282,7 +1311,7 @@ sed -i "s|https://www.litespeedtech.com/|https://cyberpanel.sh/www.litespeedtech
sed -i 's|composer.sh|composer_cn.sh|g' install.py
sed -i 's|./composer_cn.sh|COMPOSER_ALLOW_SUPERUSER=1 ./composer_cn.sh|g' install.py
sed -i 's|http://www.litespeedtech.com|https://cyberpanel.sh/www.litespeedtech.com|g' install.py
sed -i 's|https://www.rainloop.net/repository/webmail/rainloop-community-latest.zip|https://cyberpanel.sh/www.rainloop.net/repository/webmail/rainloop-community-latest.zip|g' install.py
sed -i 's|https://snappymail.eu/repository/latest.tar.gz|https://cyberpanel.sh/www.snappymail.eu/repository/latest.tar.gz|g' install.py
sed -i "s|rep.cyberpanel.net|cyberpanel.sh/rep.cyberpanel.net|g" installCyberPanel.py
sed -i "s|rep.cyberpanel.net|cyberpanel.sh/rep.cyberpanel.net|g" install.py
@ -1617,7 +1646,7 @@ fi
}
Post_Install_Display_Final_Info() {
RainloopAdminPass=$(grep SetPassword /usr/local/CyberCP/public/rainloop.php| sed -e 's|$oConfig->SetPassword(||g' -e "s|');||g" -e "s|'||g")
snappymailAdminPass=$(grep SetPassword /usr/local/CyberCP/public/snappymail.php| sed -e 's|$oConfig->SetPassword(||g' -e "s|');||g" -e "s|'||g")
Elapsed_Time="$((Time_Count / 3600)) hrs $(((SECONDS / 60) % 60)) min $((Time_Count % 60)) sec"
echo "###################################################################"
echo " CyberPanel Successfully Installed "
@ -1639,9 +1668,9 @@ fi
#echo " WebAdmin console username: admin "
#echo " WebAdmin console password: $Webadmin_Pass "
#echo " "
#echo " Visit: https://$Server_IP:8090/rainloop/?admin "
#echo " Rainloop Admin username: admin "
#echo " Rainloop Admin password: $RainloopAdminPass "
#echo " Visit: https://$Server_IP:8090/snappymail/?admin "
#echo " snappymail Admin username: admin "
#echo " snappymail Admin password: $snappymailAdminPass "
echo " "
echo -e " Run \e[31mcyberpanel help\e[39m to get FAQ info"
echo -e " Run \e[31mcyberpanel upgrade\e[39m to upgrade it to latest version."
@ -1723,7 +1752,14 @@ rm -f /root/cyberpanel/cert_conf
Post_Install_Required_Components() {
Debug_Log2 "Finalization..,80"
if [[ "$Server_OS" = "Ubuntu" ]] && [[ "$Server_OS_Version" = "22" ]] ; then
python3 -m venv /usr/local/CyberCP
Check_Return
else
virtualenv -p /usr/bin/python3 /usr/local/CyberCP
Check_Return
fi
if [[ "$Server_OS" = "Ubuntu" ]] && [[ "$Server_OS_Version" = "20" ]] ; then
# shellcheck disable=SC1091
@ -1789,6 +1825,7 @@ mkdir -p /etc/opendkim
echo '/usr/local/CyberPanel/bin/python /usr/local/CyberCP/plogical/adminPass.py --password $@' > /usr/bin/adminPass
echo "systemctl restart lscpd" >> /usr/bin/adminPass
echo "echo \$@ > /etc/cyberpanel/adminPass" >> /usr/bin/adminPass
chmod 700 /usr/bin/adminPass
rm -f /usr/bin/php

1963
cyberpanel.sh.bak Normal file

File diff suppressed because it is too large Load Diff

View File

@ -674,7 +674,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
var data = {
completeStartingPath: completePathToFile,
method: "listForTable",
home: homePathBack,
home: "/",
domainRandomSeed: domainRandomSeed,
domainName: domainName
};
@ -1201,9 +1201,11 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
pathbase = $scope.currentPath;
}
$scope.extractionLoading = false;
var completeFileToExtract = $scope.currentRPath + "/" + allFilesAndFolders[0];
var completeFileToExtract = pathbase + "/" + allFilesAndFolders[0];
var extractionType = "";
if (findFileExtension(completeFileToExtract) == "gz") {
@ -1825,4 +1827,4 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
};
});
});

View File

@ -1,5 +0,0 @@
[CyberPanel]
name=CyberPanel
baseurl=https://rep.cyberpanel.net/
gpgkey=https://rep.cyberpanel.net/RPM-GPG-KEY-cyberpanel
gpgcheck=1

View File

@ -1,5 +0,0 @@
[CyberPanel]
name=CyberPanel
baseurl=https://rep.cyberpanel.net/
gpgkey=https://rep.cyberpanel.net/RPM-GPG-KEY-cyberpanel
gpgcheck=1

View File

@ -119,7 +119,7 @@ def recursive_permissions(path, dir_mode=755, file_mode=644, topdir=True):
# Set recursive chown for a path
# recursive_chown(my_path, 'root', 'root')
# for changing group recursively without affecting user
# recursive_chown('/usr/local/lscp/cyberpanel/rainloop/data', -1, 'lscpd')
# recursive_chown('/usr/local/lscp/cyberpanel/snappymail/data', -1, 'lscpd')
# explicitly set permissions for directories/folders to 0755 and files to 0644
# recursive_permissions(my_path, 755, 644)

View File

@ -0,0 +1,190 @@
import os
import shutil
import pathlib
import stat
def mkdir_p(path, exist_ok=True):
"""
Creates the directory and paths leading up to it like unix mkdir -p .
Defaults to exist_ok so if it exists were not throwing fatal errors
https://docs.python.org/3.7/library/os.html#os.makedirs
"""
if not os.path.exists(path):
print('creating directory: ' + path)
os.makedirs(path, exist_ok)
def chmod_digit(file_path, perms):
"""
Helper function to chmod like you would in unix without having to preface 0o or converting to octal yourself.
Credits: https://stackoverflow.com/a/60052847/1621381
"""
try:
os.chmod(file_path, int(str(perms), base=8))
except:
print(f'Could not chmod : {file_path} to {perms}')
pass
def touch(filepath: str, exist_ok=True):
"""
Touches a file like unix `touch somefile` would.
"""
try:
pathlib.Path(filepath).touch(exist_ok)
except FileExistsError:
print('Could touch : ' + filepath)
pass
def symlink(src, dst):
"""
Symlink a path to another if the src exists.
"""
try:
if os.access(src, os.R_OK):
os.symlink(src, dst)
except:
print(f'Could not symlink Source: {src} > Destination: {dst}')
pass
def chown(path, user, group=-1):
"""
Chown file/path to user/group provided. Passing -1 to user or group will leave it unchanged.
Useful if just changing user or group vs both.
"""
try:
shutil.chown(path, user, group)
except PermissionError:
print(f'Could not change permissions for: {path} to {user}:{group}')
pass
def recursive_chown(path, owner, group=-1):
"""
Recursively chown a path and contents to owner.
https://docs.python.org/3/library/shutil.html
"""
for dirpath, dirnames, filenames in os.walk(path):
try:
shutil.chown(dirpath, owner, group)
except PermissionError:
print('Could not change permissions for: ' + dirpath + ' to: ' + owner)
pass
for filename in filenames:
try:
shutil.chown(os.path.join(dirpath, filename), owner, group)
except PermissionError:
print('Could not change permissions for: ' + os.path.join(dirpath, filename) + ' to: ' + owner)
pass
def recursive_permissions(path, dir_mode=755, file_mode=644, topdir=True):
"""
Recursively chmod a path and contents to mode.
Defaults to chmod top level directory but can be optionally
toggled off when you want to chmod only contents of like a user's homedir vs homedir itself
https://docs.python.org/3.6/library/os.html#os.walk
"""
# Here we are converting the integers to string and then to octal.
# so this function doesn't need to be called with 0o prefixed for the file and dir mode
dir_mode = int(str(dir_mode), base=8)
file_mode = int(str(file_mode), base=8)
if topdir:
# Set chmod on top level path
try:
os.chmod(path, dir_mode)
except:
print('Could not chmod :' + path + ' to ' + str(dir_mode))
for root, dirs, files in os.walk(path):
for d in dirs:
try:
os.chmod(os.path.join(root, d), dir_mode)
except:
print('Could not chmod :' + os.path.join(root, d) + ' to ' + str(dir_mode))
pass
for f in files:
try:
os.chmod(os.path.join(root, f), file_mode)
except:
print('Could not chmod :' + path + ' to ' + str(file_mode))
pass
# Left intentionally here for reference.
# Set recursive chown for a path
# recursive_chown(my_path, 'root', 'root')
# for changing group recursively without affecting user
# recursive_chown('/usr/local/lscp/cyberpanel/rainloop/data', -1, 'lscpd')
# explicitly set permissions for directories/folders to 0755 and files to 0644
# recursive_permissions(my_path, 755, 644)
# Fix permissions and use default values
# recursive_permissions(my_path)
# =========================================================
# Below is a helper class for getting and working with permissions
# Original credits to : https://github.com/keysemble/perfm
def perm_octal_digit(rwx):
digit = 0
if rwx[0] == 'r':
digit += 4
if rwx[1] == 'w':
digit += 2
if rwx[2] == 'x':
digit += 1
return digit
class FilePerm:
def __init__(self, filepath):
filemode = stat.filemode(os.stat(filepath).st_mode)
permissions = [filemode[-9:][i:i + 3] for i in range(0, len(filemode[-9:]), 3)]
self.filepath = filepath
self.access_dict = dict(zip(['user', 'group', 'other'], [list(perm) for perm in permissions]))
def mode(self):
mode = 0
for shift, digit in enumerate(self.octal()[::-1]):
mode += digit << (shift * 3)
return mode
def digits(self):
"""Get the octal chmod equivalent value 755 in single string"""
return "".join(map(str, self.octal()))
def octal(self):
"""Get the octal value in a list [7, 5, 5]"""
return [perm_octal_digit(p) for p in self.access_dict.values()]
def access_bits(self, access):
if access in self.access_dict.keys():
r, w, x = self.access_dict[access]
return [r == 'r', w == 'w', x == 'x']
def update_bitwise(self, settings):
def perm_list(read=False, write=False, execute=False):
pl = ['-', '-', '-']
if read:
pl[0] = 'r'
if write:
pl[1] = 'w'
if execute:
pl[2] = 'x'
return pl
self.access_dict = dict(
[(access, perm_list(read=r, write=w, execute=x)) for access, [r, w, x] in settings.items()])
os.chmod(self.filepath, self.mode())
# project_directory = os.path.abspath(os.path.dirname(sys.argv[0]))
# home_directory = os.path.expanduser('~')
# print(f'Path: {home_directory} Mode: {FilePerm(home_directory).mode()} Octal: {FilePerm(home_directory).octal()} '
# f'Digits: {FilePerm(home_directory).digits()}')
# Example: Output
# Path: /home/cooluser Mode: 493 Octal: [7, 5, 5] Digits: 755

View File

@ -96,6 +96,7 @@ class preFlightsChecks:
debug = 1
cyberPanelMirror = "mirror.cyberpanel.net/pip"
cdn = 'cyberpanel.sh'
SnappyVersion = '2.15.3'
def __init__(self, rootPath, ip, path, cwd, cyberPanelPath, distro, remotemysql=None, mysqlhost=None, mysqldb=None,
mysqluser=None, mysqlpassword=None, mysqlport=None):
@ -546,7 +547,7 @@ password="%s"
command = "chown -R root:root /usr/local/lscp"
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = "chown -R lscpd:lscpd /usr/local/lscp/cyberpanel/rainloop/data"
command = "chown -R lscpd:lscpd /usr/local/lscp/cyberpanel/rainloop"
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = "chmod 700 /usr/local/CyberCP/cli/cyberPanel.py"
@ -648,11 +649,11 @@ password="%s"
command = 'chmod 640 /usr/local/lscp/cyberpanel/logs/access.log'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'mkdir -p/usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/configs/'
command = 'mkdir -p/usr/local/lscp/cyberpanel/snappymail/data/_data_/_default_/configs/'
rainloopinipath = '/usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/configs/application.ini'
snappymailinipath = '/usr/local/lscp/cyberpanel/snappymail/data/_data_/_default_/configs/application.ini'
command = 'chmod 600 /usr/local/CyberCP/public/rainloop.php'
command = 'chmod 600 /usr/local/CyberCP/public/snappymail.php'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
###
@ -1236,24 +1237,28 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
if not os.path.exists("/usr/local/CyberCP/public"):
os.mkdir("/usr/local/CyberCP/public")
if os.path.exists("/usr/local/CyberCP/public/rainloop"):
if os.path.exists("/usr/local/CyberCP/public/snappymail"):
return 0
os.chdir("/usr/local/CyberCP/public")
command = 'wget https://www.rainloop.net/repository/webmail/rainloop-community-latest.zip'
command = 'wget https://github.com/the-djmaze/snappymail/releases/download/v%s/snappymail-%s.zip' % (preFlightsChecks.SnappyVersion, preFlightsChecks.SnappyVersion)
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
#############
command = 'unzip rainloop-community-latest.zip -d /usr/local/CyberCP/public/rainloop'
command = 'unzip snappymail-%s.zip -d /usr/local/CyberCP/public/snappymail' % (preFlightsChecks.SnappyVersion)
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
os.remove("rainloop-community-latest.zip")
try:
os.remove("snappymail-%s.zip" % (preFlightsChecks.SnappyVersion))
except:
pass
#######
os.chdir("/usr/local/CyberCP/public/rainloop")
os.chdir("/usr/local/CyberCP/public/snappymail")
command = 'find . -type d -exec chmod 755 {} \;'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
@ -1277,15 +1282,16 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
labsData = """[labs]
imap_folder_list_limit = 0
autocreate_system_folders = On
"""
writeToFile = open(labsPath, 'w')
writeToFile = open(labsPath, 'a')
writeToFile.write(labsData)
writeToFile.close()
iPath = os.listdir('/usr/local/CyberCP/public/rainloop/rainloop/v/')
iPath = os.listdir('/usr/local/CyberCP/public/snappymail/snappymail/v/')
path = "/usr/local/CyberCP/public/rainloop/rainloop/v/%s/include.php" % (iPath[0])
path = "/usr/local/CyberCP/public/snappymail/snappymail/v/%s/include.php" % (iPath[0])
data = open(path, 'r').readlines()
writeToFile = open(path, 'w')
@ -1299,8 +1305,22 @@ imap_folder_list_limit = 0
writeToFile.close()
includeFileOldPath = '/usr/local/CyberCP/public/snappymail/_include.php'
includeFileNewPath = '/usr/local/CyberCP/public/snappymail/include.php'
if os.path.exists(includeFileOldPath):
writeToFile = open(includeFileOldPath, 'a')
writeToFile.write("\ndefine('APP_DATA_FOLDER_PATH', '/usr/local/lscp/cyberpanel/rainloop/data/');\n")
writeToFile.close()
command = 'mv %s %s' % (includeFileOldPath, includeFileNewPath)
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = "sed -i 's|autocreate_system_folders = Off|autocreate_system_folders = On|g' %s" % (labsPath)
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
except BaseException as msg:
logging.InstallLog.writeToFile('[ERROR] ' + str(msg) + " [downoad_and_install_rainloop]")
logging.InstallLog.writeToFile('[ERROR] ' + str(msg) + " [downoad_and_install_snappymail]")
return 0
return 1
@ -1827,6 +1847,10 @@ imap_folder_list_limit = 0
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
if self.distro == cent8:
command = 'dnf install opendkim-tools -y'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
if self.distro == ubuntu:
command = 'apt install opendkim-tools -y'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
@ -2047,6 +2071,8 @@ milter_default_action = accept
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'yum install -y restic'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'restic self-update'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
else:
command = 'apt-get update -y'
@ -2054,6 +2080,9 @@ milter_default_action = accept
command = 'apt-get install restic -y'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'restic self-update'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
except:
pass
@ -2337,10 +2366,10 @@ def main():
# checks.disablePackegeUpdates()
try:
# command = 'mkdir -p /usr/local/lscp/cyberpanel/rainloop/data/data/default/configs/'
# command = 'mkdir -p /usr/local/lscp/cyberpanel/snappymail/data/data/default/configs/'
# subprocess.call(shlex.split(command))
writeToFile = open('/usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/configs/application.ini', 'a')
writeToFile = open('/usr/local/lscp/cyberpanel/snappymail/data/_data_/_default_/configs/application.ini', 'a')
writeToFile.write("""
[security]
@ -2353,23 +2382,23 @@ admin_password = "12345"
content = """<?php
$_ENV['RAINLOOP_INCLUDE_AS_API'] = true;
include '/usr/local/CyberCP/public/rainloop/index.php';
$_ENV['snappymail_INCLUDE_AS_API'] = true;
include '/usr/local/CyberCP/public/snappymail/index.php';
$oConfig = \RainLoop\Api::Config();
$oConfig = \snappymail\Api::Config();
$oConfig->SetPassword('%s');
echo $oConfig->Save() ? 'Done' : 'Error';
?>""" % (randomPassword.generate_pass())
writeToFile = open('/usr/local/CyberCP/public/rainloop.php', 'w')
writeToFile = open('/usr/local/CyberCP/public/snappymail.php', 'w')
writeToFile.write(content)
writeToFile.close()
command = '/usr/local/lsws/lsphp72/bin/php /usr/local/CyberCP/public/rainloop.php'
command = '/usr/local/lsws/lsphp72/bin/php /usr/local/CyberCP/public/snappymail.php'
subprocess.call(shlex.split(command))
command = "chown -R lscpd:lscpd /usr/local/lscp/cyberpanel/rainloop/data"
command = "chown -R lscpd:lscpd /usr/local/lscp/cyberpanel/snappymail/data"
subprocess.call(shlex.split(command))
except:
pass

2383
install/install.py.bak Normal file

File diff suppressed because it is too large Load Diff

View File

@ -86,7 +86,7 @@ if [[ $SERVER_COUNTRY == "CN" ]] ; then
#sed -i "${line2}i\ \ \ \ \ \ \ \ command = 'wget cyberpanel.sh/cyberpanel-git.tar.gz'" install.py
sed -i 's|wget https://rpms.litespeedtech.com/debian/|wget --no-check-certificate https://rpms.litespeedtech.com/debian/|g' install.py
sed -i 's|https://repo.powerdns.com/repo-files/centos-auth-42.repo|https://'$DOWNLOAD_SERVER'/powerdns/powerdns.repo|g' installCyberPanel.py
sed -i 's|https://www.rainloop.net/repository/webmail/rainloop-community-latest.zip|https://'$DOWNLOAD_SERVER'/misc/rainloop-community-latest.zip|g' install.py
sed -i 's|https://snappymail.eu/repository/latest.tar.gz|https://'$DOWNLOAD_SERVER'/repository/latest.tar.gz|g' install.py
sed -i 's|rpm -ivh https://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm|curl -o /etc/yum.repos.d/litespeed.repo https://'$DOWNLOAD_SERVER'/litespeed/litespeed.repo|g' install.py

1290
install/venvsetup.sh.bak Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -183,7 +183,7 @@ class MailServerManager(multi.Thread):
checker = 0
count = 1
for items in emails:
dic = {'id': count, 'email': items.email}
dic = {'id': count, 'email': items.email, 'DiskUsage': '%sMB' % items.DiskUsage}
count = count + 1
if checker == 0:
@ -543,6 +543,7 @@ class MailServerManager(multi.Thread):
for items in records:
dic = {'email': items.email,
'DiskUsage': '%sMB' % items.DiskUsage
}
if checker == 0:
@ -1475,7 +1476,7 @@ milter_default_action = accept
command = "chown -R root:root /usr/local/lscp"
ProcessUtilities.executioner(command)
command = "chown -R lscpd:lscpd /usr/local/lscp/cyberpanel/rainloop/data"
command = "chown -R lscpd:lscpd /usr/local/lscp/cyberpanel/snappymail/data"
ProcessUtilities.executioner(command)
command = "chmod 700 /usr/local/CyberCP/cli/cyberPanel.py"

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,7 @@ class EUsers(models.Model):
email = models.CharField(primary_key=True, max_length=80)
password = models.CharField(max_length=200)
mail = models.CharField(max_length=200, default='')
DiskUsage = models.CharField(max_length=200, default='0')
class Meta:

View File

@ -96,7 +96,7 @@
</div>
<div class="col-md-3 btn-min-width">
<a href="/rainloop/index.php" title="{% trans 'Access Webmail' %}"
<a href="/snappymail/index.php" title="{% trans 'Access Webmail' %}"
class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "Access Webmail" %}

View File

@ -0,0 +1,121 @@
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{% trans "Mail Functions - CyberPanel" %}{% endblock %}
{% block content %}
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
<div class="container">
<div id="page-title">
<h2>{% trans "Mail Functions" %}</h2>
<p>{% trans "Manage email accounts on this page." %}</p>
</div>
<div class="panel col-md-12">
<div class="panel-body">
<h3 class="content-box-header">
{% trans "Available Functions" %}
</h3>
<div class="example-box-wrapper">
<div class="row">
<div class="col-md-3 btn-min-width">
<a href="{% url 'createEmailAccount' %}" title="{% trans 'Create Email' %}"
class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "Create Email" %}
</div>
<div class="tile-content-wrapper">
<i class="fa fa-plus-square"></i>
</div>
</a>
</div>
<div class="col-md-3 btn-min-width">
<a href="{% url 'listEmails' %}" title="{% trans 'List Emails' %}"
class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "List Emails" %}
</div>
<div class="tile-content-wrapper">
<i class="fa fa-plus-square"></i>
</div>
</a>
</div>
<div class="col-md-3 btn-min-width">
<a href="{% url 'deleteEmailAccount' %}" title="{% trans 'Delete Email' %}"
class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "Delete Email" %}
</div>
<div class="tile-content-wrapper">
<i class="fa fa-trash"></i>
</div>
</a>
</div>
<div class="col-md-3 btn-min-width">
<a href="{% url 'emailForwarding' %}" title="{% trans 'Email Forwarding' %}"
class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "Email Forwarding" %}
</div>
<div class="tile-content-wrapper">
<i class="fa fa-plus-square"></i>
</div>
</a>
</div>
<div class="col-md-3 btn-min-width">
<a href="{% url 'changeEmailAccountPassword' %}" title="{% trans 'Change Password' %}"
class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "Change Password" %}
</div>
<div class="tile-content-wrapper">
<i class="fa fa-key"></i>
</div>
</a>
</div>
<div class="col-md-3 btn-min-width">
<a href="{% url 'dkimManager' %}" title="{% trans 'DKIM Manager' %}"
class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "DKIM Manager" %}
</div>
<div class="tile-content-wrapper">
<i class="fa fa-key"></i>
</div>
</a>
</div>
<div class="col-md-3 btn-min-width">
<a href="/snappymail/index.php" title="{% trans 'Access Webmail' %}"
class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "Access Webmail" %}
</div>
<div class="tile-content-wrapper">
<i class="fa fa-key"></i>
</div>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -163,12 +163,14 @@
<thead>
<tr>
<th>{% trans "Emails" %}</th>
<th>{% trans "Disk Usage" %}</th>
<th>{% trans "Actions" %}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="record in records track by $index">
<td ng-bind="record.email"></td>
<td ng-bind="record.DiskUsage"></td>
<td>
<a data-toggle="modal" data-target="#settings"
ng-click="changePasswordInitial(record.email)"

281
managePHP/php81.xml Normal file
View File

@ -0,0 +1,281 @@
<?xml version="1.0" ?>
<php>
<name>php81</name>
<extension>
<extensionName>lsphp81-debuginfo</extensionName>
<extensionDescription>Debug information for package lsphp81</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-pecl-igbinary-debuginfo</extensionName>
<extensionDescription>Debug information for package lsphp81-pecl-igbinary</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-pecl-mcrypt-debuginfo</extensionName>
<extensionDescription>lsphp81 lsphp81-pecl-mcrypt-debuginfo Extension</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-bcmath</extensionName>
<extensionDescription>A extension for PHP applications for using the bcmath library.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-common</extensionName>
<extensionDescription>Common files for PHP.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-dba</extensionName>
<extensionDescription>A database abstraction layer extension for PHP applications.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-devel</extensionName>
<extensionDescription>Files needed for building PHP extensions.</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-enchant</extensionName>
<extensionDescription>Enchant spelling extension for PHP applications.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-gd</extensionName>
<extensionDescription>A extension for PHP applications for using the gd graphics library.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-gmp</extensionName>
<extensionDescription>A extension for PHP applications for using the GNU MP library.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-imap</extensionName>
<extensionDescription>A extension for PHP applications that use IMAP.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-intl</extensionName>
<extensionDescription>Internationalization extension for PHP applications.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-json</extensionName>
<extensionDescription>lsphp81 Json PHP Extension</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-ldap</extensionName>
<extensionDescription>A extension for PHP applications that use LDAP.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-mbstring</extensionName>
<extensionDescription>A extension for PHP applications which need multi-byte string handling.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-mysqlnd</extensionName>
<extensionDescription>A extension for PHP applications that use MySQL databases.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-odbc</extensionName>
<extensionDescription>A extension for PHP applications that use ODBC databases.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-opcache</extensionName>
<extensionDescription>The Zend OPcache.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-pdo</extensionName>
<extensionDescription>A database access abstraction extension for PHP applications.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-pear</extensionName>
<extensionDescription>PHP Extension and Application Repository framework.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-pecl-apcu</extensionName>
<extensionDescription>APC User Cache.</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-pecl-apcu-devel</extensionName>
<extensionDescription>APCu developer files (header).</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-pecl-apcu-panel</extensionName>
<extensionDescription>APCu control panel.</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-pecl-igbinary</extensionName>
<extensionDescription>Replacement for the standard PHP serializer.</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-pecl-igbinary-devel</extensionName>
<extensionDescription>Igbinary developer files (header).</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-pecl-mcrypt</extensionName>
<extensionDescription>lsphp81 lsphp81-pecl-mcrypt Extension.</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-pecl-memcache</extensionName>
<extensionDescription>Extension to work with the Memcached caching daemon.</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-pecl-memcached</extensionName>
<extensionDescription>Extension to work with the Memcached caching daemon.</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-pecl-msgpack</extensionName>
<extensionDescription>API for communicating with MessagePack serialization.</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-pecl-msgpack-devel</extensionName>
<extensionDescription>MessagePack developer files (header).</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-pecl-redis</extensionName>
<extensionDescription>Extension for communicating with the Redis key-value store.</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-pgsql</extensionName>
<extensionDescription>A PostgreSQL database extension for PHP.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-process</extensionName>
<extensionDescription>extensions for PHP script using system process interfaces.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-pspell</extensionName>
<extensionDescription>A extension for PHP applications for using pspell interfaces.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-recode</extensionName>
<extensionDescription>A extension for PHP applications for using the recode library.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-snmp</extensionName>
<extensionDescription>A extension for PHP applications that query SNMP-managed devices.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-soap</extensionName>
<extensionDescription>A extension for PHP applications that use the SOAP protocol.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-tidy</extensionName>
<extensionDescription>Standard PHP extension provides tidy library support.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-xml</extensionName>
<extensionDescription>A module for PHP applications which use XML.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-xmlrpc</extensionName>
<extensionDescription>A extension for PHP applications which use the XML-RPC protocol.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-zip</extensionName>
<extensionDescription>ZIP archive management extension for PHP</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-mcrypt</extensionName>
<extensionDescription>Standard PHP extension provides mcrypt library support.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-dbg</extensionName>
<extensionDescription>php73-dbg lsphp81-package</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-ioncube</extensionName>
<extensionDescription>ioncube loaders</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-pecl-imagick</extensionName>
<extensionDescription>Extension to create and modify images using ImageMagick</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-sodium</extensionName>
<extensionDescription>The php-sodium extension provides strong encryption capabilities in an easy and consistent way.</extensionDescription>
<status>0</status>
</extension>
</php>

View File

@ -297,6 +297,11 @@ app.controller('editPHPConfig', function ($scope, $http, $timeout) {
$scope.fetchPHPDetails = function () {
var phpSelection = $scope.phpSelection;
if (!phpSelection) {
return;
}
$scope.loadingPHP = false;
$scope.canNotFetch = true;
$scope.detailsSaved = true;
@ -309,8 +314,6 @@ app.controller('editPHPConfig', function ($scope, $http, $timeout) {
url = "/managephp/getCurrentPHPConfig";
var phpSelection = $scope.phpSelection;
var data = {
phpSelection: phpSelection,
};
@ -440,14 +443,16 @@ app.controller('editPHPConfig', function ($scope, $http, $timeout) {
};
$scope.fetchAdvancePHPDetails = function () {
var phpSelection = $scope.phpSelection;
if (!phpSelection) {
return;
}
$scope.loadingPHP = false;
$scope.savebtnAdvance = true;
url = "/managephp/getCurrentAdvancedPHPConfig";
var phpSelection = $scope.phpSelection;
var data = {
phpSelection: phpSelection,
};

View File

@ -23,14 +23,14 @@
<div class="example-box-wrapper">
<ul class="nav nav-tabs">
<li class="col-md-2 nav-item tab-mod active">
<li class="col-md-2 nav-item tab-mod active" ng-click="fetchPHPDetails()">
<a href="#tab-example-1" data-toggle="tab" class="h4 nav-link">
<i class="fa fa-cog btn-icon"></i>
<span>{% trans "Basic" %}</span>
</a>
</li>
<li class="col-md-2 tab-mod nav-item">
<li class="col-md-2 tab-mod nav-item" ng-click="fetchAdvancePHPDetails()">
<a href="#tab-example-3" data-toggle="tab" class="h4 nav-link">
<i class="fa fa-cogs btn-icon"></i>
<span>{% trans "Advanced" %}</span>

131
managePHP/ubuntuphp81.xml Normal file
View File

@ -0,0 +1,131 @@
<?xml version="1.0" ?>
<php>
<name>php81</name>
<extension>
<extensionName>lsphp81-common</extensionName>
<extensionDescription>Most of what you need.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-curl</extensionName>
<extensionDescription>Curl (common web tools) required for PHP</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-dbg</extensionName>
<extensionDescription>Debugging extension</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-dev</extensionName>
<extensionDescription>Development features almost always required.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-imap</extensionName>
<extensionDescription>Email extensions for PHP.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-intl</extensionName>
<extensionDescription>Extensions for countries other than the U.S.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-json</extensionName>
<extensionDescription>PHP extensions for JavaScript Object Notation.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-ldap</extensionName>
<extensionDescription>PHP extensions for LDAP (directory access protocol)</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-modules-source</extensionName>
<extensionDescription>PHP source modules for virtually everything. Very large.</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-mysql</extensionName>
<extensionDescription>PHP extension for MySQL or MariaDB databases.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-opcache</extensionName>
<extensionDescription>PHP low-level caching of code. Very important for performance.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-pgsql</extensionName>
<extensionDescription>A PostgreSQL database extension for PHP.</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-pspell</extensionName>
<extensionDescription>PHP spell checking extensions.</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-recode</extensionName>
<extensionDescription>PHP extension to transform data between different character sets.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-snmp</extensionName>
<extensionDescription>PHP network management extensions.</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-sqlite3</extensionName>
<extensionDescription>An extension for PHP applications that use the SQLite v3 features.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-sybase</extensionName>
<extensionDescription>An extension for PHP applications that use Sybase databases.</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-tidy</extensionName>
<extensionDescription>PHP extensions for manipulating HTML, XHTML and XML documents.</extensionDescription>
<status>1</status>
</extension>
<extension>
<extensionName>lsphp81-ioncube</extensionName>
<extensionDescription>ioncube loaders</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-imagick</extensionName>
<extensionDescription>Extension to create and modify images using ImageMagick</extensionDescription>
<status>0</status>
</extension>
<extension>
<extensionName>lsphp81-sodium</extensionName>
<extensionDescription>The php-sodium extension provides strong encryption capabilities in an easy and consistent way.</extensionDescription>
<status>0</status>
</extension>
</php>

View File

@ -1237,7 +1237,36 @@ def installExtensions(request):
phpExtension.save()
except:
pass
try:
newPHP81 = PHP(phpVers="php81")
newPHP81.save()
php81Path = ''
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
php81Path = os.path.join('/usr', 'local', 'CyberCP', 'managePHP', 'php81.xml')
else:
php81Path = os.path.join('/usr', 'local', 'CyberCP', 'managePHP', 'ubuntuphp81.xml')
php81 = ElementTree.parse(php81Path)
php81Extensions = php81.findall('extension')
for extension in php81Extensions:
extensionName = extension.find('extensionName').text
extensionDescription = extension.find('extensionDescription').text
status = int(extension.find('status').text)
phpExtension = installedPackages(phpVers=newPHP81,
extensionName=extensionName,
description=extensionDescription,
status=status)
phpExtension.save()
except:
pass
proc = httpProc(request, 'managePHP/installExtensions.html',
{'phps': PHPManager.findPHPVersions()}, 'admin')
return proc.render()

Binary file not shown.

View File

@ -378,6 +378,7 @@ class IncScheduler(multi.Thread):
GDriveJobLogs(owner=items, status=backupSchedule.INFO,
message='Job Completed').save()
print("job com[leted")
#logging.writeToFile('job completed')
@ -877,6 +878,16 @@ Automatic backup failed for %s on %s.
except:
config = {}
eDomains = website.domains_set.all()
for eDomain in eDomains:
for email in eDomain.eusers_set.all():
emailPath = '/home/vmail/%s/%s' % (website.domain, email.email.split('@')[0])
email.DiskUsage = virtualHostUtilities.getDiskUsageofPath(emailPath)
email.save()
print('Disk Usage of %s is %s' % (email.email,email.DiskUsage))
config['DiskUsage'], config['DiskUsagePercentage'] = virtualHostUtilities.getDiskUsage(
"/home/" + website.domain, website.package.diskSpace)

View File

@ -542,6 +542,32 @@ class ACLManager:
return websiteNames
@staticmethod
def getPHPString(phpVersion):
if phpVersion == "PHP 5.3":
php = "53"
elif phpVersion == "PHP 5.4":
php = "54"
elif phpVersion == "PHP 5.5":
php = "55"
elif phpVersion == "PHP 5.6":
php = "56"
elif phpVersion == "PHP 7.0":
php = "70"
elif phpVersion == "PHP 7.1":
php = "71"
elif phpVersion == "PHP 7.2":
php = "72"
elif phpVersion == "PHP 7.3":
php = "73"
elif phpVersion == "PHP 7.4":
php = "74"
elif phpVersion == "PHP 8.0":
php = "80"
return php
@staticmethod
def searchWebsiteObjects(currentACL, userID, searchTerm):
@ -615,7 +641,7 @@ class ACLManager:
doms = items.websites_set.all().order_by('domain')
for dom in doms:
domainsList.append(dom.domain)
for childs in items.childdomains_set.all():
for childs in dom.childdomains_set.all():
domainsList.append(childs.domain)
return domainsList

View File

@ -1,9 +1,12 @@
#!/usr/local/CyberCP/bin/python
import argparse
import os, sys
import time
from loginSystem.models import Administrator
from plogical.acl import ACLManager
sys.path.append('/usr/local/CyberCP')
import django
@ -11,8 +14,9 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
django.setup()
import threading as multi
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
import plogical.CyberCPLogFileWriter as logging
import subprocess
from websiteFunctions.models import ChildDomains, Websites
from websiteFunctions.models import ChildDomains, Websites, WPSites
from plogical import randomPassword
from plogical.mysqlUtilities import mysqlUtilities
from databases.models import Databases
@ -33,11 +37,13 @@ class ApplicationInstaller(multi.Thread):
multi.Thread.__init__(self)
self.installApp = installApp
self.extraArgs = extraArgs
if extraArgs != None:
try:
self.tempStatusPath = self.extraArgs['tempStatusPath']
except:
pass
self.data = self.extraArgs
def run(self):
try:
@ -56,6 +62,18 @@ class ApplicationInstaller(multi.Thread):
self.updatePackage()
elif self.installApp == 'mautic':
self.installMautic()
elif self.installApp == 'wordpressInstallNew':
self.wordpressInstallNew()
elif self.installApp == 'UpdateWPTheme':
self.UpdateWPTheme()
elif self.installApp == 'UpdateWPPlugin':
self.UpdateWPPlugin()
elif self.installApp == 'DeleteThemes':
self.DeleteThemes()
elif self.installApp == 'DeletePlugins':
self.DeletePlugins()
elif self.installApp == 'ChangeStatusThemes':
self.ChangeStatusThemes()
except BaseException as msg:
logging.writeToFile(str(msg) + ' [ApplicationInstaller.run]')
@ -473,7 +491,6 @@ $parameters = array(
def installWordPress(self):
try:
domainName = self.extraArgs['domainName']
home = self.extraArgs['home']
tempStatusPath = self.extraArgs['tempStatusPath']
@ -1622,6 +1639,253 @@ $parameters = array(
statusFile.close()
return 0
def wordpressInstallNew(self):
try:
from websiteFunctions.website import WebsiteManager
import json
tempStatusPath = self.data['tempStatusPath']
statusFile = open(tempStatusPath, 'w')
statusFile.writelines('Creating Website...')
statusFile.close()
DataToPass = {}
currentTemp = self.extraArgs['tempStatusPath']
DataToPass['domainName'] = self.data['domainName']
DataToPass['adminEmail'] = self.data['adminEmail']
DataToPass['phpSelection'] = "PHP 7.4"
DataToPass['websiteOwner'] = self.data['websiteOwner']
DataToPass['package'] = self.data['package']
DataToPass['ssl'] = 1
DataToPass['dkimCheck'] = 0
DataToPass['openBasedir'] = 0
DataToPass['mailDomain'] = 0
UserID = self.data['adminID']
ab = WebsiteManager()
coreResult = ab.submitWebsiteCreation(UserID, DataToPass)
coreResult1 = json.loads((coreResult).content)
logging.CyberCPLogFileWriter.writeToFile("Creating website result....%s"%coreResult1)
reutrntempath = coreResult1['tempStatusPath']
while (1):
lastLine = open(reutrntempath, 'r').read()
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....')
statusFile.close()
## Install WordPress
currentTemp = self.extraArgs['tempStatusPath']
self.extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999))
self.installWordPress()
while (1):
lastLine = open(self.extraArgs['tempStatusPath'], 'r').read()
if lastLine.find('[200]') > -1:
break
elif lastLine.find('[404]') > -1:
statusFile = open(currentTemp, 'w')
statusFile.writelines('Failed to install WordPress: error: %s[404]' % lastLine)
statusFile.close()
return 0
else:
statusFile = open(currentTemp, 'w')
statusFile.writelines('Installing WordPress....,30')
statusFile.close()
time.sleep(2)
statusFile = open(currentTemp, 'w')
statusFile.writelines('WordPress installed..,70')
statusFile.close()
webobj = Websites.objects.get(domain= self.extraArgs['domainName'])
path ="/home/%s/public_html"%(self.extraArgs['domainName'])
Finalurl = (self.extraArgs['domainName'])
wpobj = WPSites(owner=webobj, title=self.extraArgs['blogTitle'], path=path, FinalURL=Finalurl,
AutoUpdates=(self.extraArgs['updates']), PluginUpdates=(self.extraArgs['Plugins']),
ThemeUpdates=(self.extraArgs['Themes']),)
wpobj.save()
statusFile = open(currentTemp, 'w')
statusFile.writelines('WordPress installed..,[200]')
statusFile.close()
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile("Error WP web creating ....... %s" % str(msg))
return 0
def UpdateWPTheme(self):
try:
FinalPHPPath = self.data['FinalPHPPath']
Vhuser=self.data['Vhuser']
path=self.data['path']
if self.data['Theme'] == 'all':
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme update --all --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
elif self.data['Theme'] == 'selected':
ThemeList = ''
for plugin in self.data['Themearray']:
ThemeList = '%s %s' % (ThemeList, plugin)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme update %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, ThemeList, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
else:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme update %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, self.data['Theme'], path)
stdoutput = ProcessUtilities.outputExecutioner(command)
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile("Error WP UpdateWPTheme ....... %s" % str(msg))
return 0
def UpdateWPPlugin(self):
try:
FinalPHPPath = self.data['FinalPHPPath']
Vhuser=self.data['Vhuser']
path=self.data['path']
if self.data['plugin'] == 'all':
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme update --all --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
elif self.data['plugin'] == 'selected':
pluginsList = ''
for plug in self.data['pluginarray']:
pluginsList = '%s %s' % (pluginsList, plug)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin update %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, pluginsList, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
else:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme update %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, self.data['plugin'], path)
stdoutput = ProcessUtilities.outputExecutioner(command)
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile("Error WP UpdateWPTheme ....... %s" % str(msg))
return 0
def DeleteThemes(self):
try:
FinalPHPPath = self.data['FinalPHPPath']
Vhuser = self.data['Vhuser']
path = self.data['path']
if self.data['Theme'] == 'selected':
ThemeList = ''
for plugin in self.data['Themearray']:
ThemeList = '%s %s' % (ThemeList, plugin)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme delete %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, ThemeList, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
else:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme delete %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, self.data['Theme'], path)
stdoutput = ProcessUtilities.outputExecutioner(command)
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile("Error WP DeleteThemes ....... %s" % str(msg))
return 0
def DeletePlugins(self):
try:
FinalPHPPath = self.data['FinalPHPPath']
Vhuser = self.data['Vhuser']
path = self.data['path']
plugin = self.data['plugin']
pluginarray = self.data['pluginarray']
if plugin == 'selected':
pluginsList = ''
for plug in pluginarray:
pluginsList = '%s %s' % (pluginsList, plug)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin delete %s --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, pluginsList, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
else:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin delete %s --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, plugin, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile("Error WP DeletePlugins ....... %s" % str(msg))
return 0
def ChangeStatusThemes(self):
try:
FinalPHPPath = self.data['FinalPHPPath']
Vhuser = self.data['Vhuser']
path = self.data['path']
Theme = self.data['Theme']
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme status %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, Theme, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
if stdoutput.find('Status: Active') > -1:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme deactivate %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, Theme, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
else:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme activate %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, Theme, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile("Error WP ChangeStatusThemes ....... %s" % str(msg))
return 0
def main():
parser = argparse.ArgumentParser(description='CyberPanel Application Installer')
parser.add_argument('function', help='Specify a function to call!')

View File

@ -89,8 +89,21 @@ class backupSchedule:
ifRunning = ProcessUtilities.outputExecutioner('ps aux')
if os.path.exists('/usr/local/CyberCP/debug'):
message = 'Output of px aux when running remote backup status check: %s' % (ifRunning)
logging.CyberCPLogFileWriter.writeToFile(message)
if (ifRunning.find('startBackup') > -1 or ifRunning.find('BackupRoot') > -1) and ifRunning.find('/%s/' % (backupDomain)):
if os.path.exists('/usr/local/CyberCP/debug'):
message = 'If running found.'
logging.CyberCPLogFileWriter.writeToFile(message)
if os.path.exists(status):
if os.path.exists('/usr/local/CyberCP/debug'):
message = 'If running found. and status file exists'
logging.CyberCPLogFileWriter.writeToFile(message)
status = open(status, 'r').read()
time.sleep(2)
@ -115,6 +128,9 @@ class backupSchedule:
return 1, tempStoragePath
elif status.find("[5009]") > -1:
if os.path.exists('/usr/local/CyberCP/debug'):
message = 'If running found. status file exists but error'
logging.CyberCPLogFileWriter.writeToFile(message)
## removing status file, so that backup can re-run
try:
command = 'sudo rm -f ' + status
@ -150,6 +166,9 @@ class backupSchedule:
return 0, tempStoragePath
elif os.path.exists(schedulerPath):
if os.path.exists('/usr/local/CyberCP/debug'):
message = 'If running found. status file exists, scheduler path also exists hence killed'
logging.CyberCPLogFileWriter.writeToFile(message)
backupSchedule.remoteBackupLogging(backupLogPath, 'Backup process killed. Error: %s' % (
open(schedulerPath, 'r').read()),
backupSchedule.ERROR)
@ -157,8 +176,15 @@ class backupSchedule:
command = 'rm -rf %s' % (tempStoragePath)
ProcessUtilities.normalExecutioner(command)
return 0, 'Backup process killed.'
else:
if os.path.exists('/usr/local/CyberCP/debug'):
message = 'If running not found.'
logging.CyberCPLogFileWriter.writeToFile(message)
if os.path.exists(status):
if os.path.exists('/usr/local/CyberCP/debug'):
message = 'if running not found, Status file exists'
logging.CyberCPLogFileWriter.writeToFile(message)
status = open(status, 'r').read()
time.sleep(2)
@ -182,6 +208,11 @@ class backupSchedule:
pass
return 1, tempStoragePath
elif os.path.exists(schedulerPath):
if os.path.exists('/usr/local/CyberCP/debug'):
message = 'if running not found, Status file exists, scheduler path exists thus killed.'
logging.CyberCPLogFileWriter.writeToFile(message)
backupSchedule.remoteBackupLogging(backupLogPath, 'Backup process killed. Error: %s' % (open(schedulerPath, 'r').read()),
backupSchedule.ERROR)
os.remove(schedulerPath)
@ -189,13 +220,23 @@ class backupSchedule:
ProcessUtilities.normalExecutioner(command)
return 0, 'Backup process killed.'
else:
if os.path.exists('/usr/local/CyberCP/debug'):
message = 'Status file does not exists.'
logging.CyberCPLogFileWriter.writeToFile(message)
if killCounter == 1:
if os.path.exists('/usr/local/CyberCP/debug'):
message = 'if running not found, Status file does not exists, kill counter 1, thus killed'
logging.CyberCPLogFileWriter.writeToFile(message)
command = 'rm -rf %s' % (tempStoragePath)
ProcessUtilities.normalExecutioner(command)
return 0, 'Backup process killed without reporting any error. [184]'
elif os.path.exists(schedulerPath):
if os.path.exists('/usr/local/CyberCP/debug'):
message = 'if running not found, Status file does not exists, scheduler path found thus killed'
logging.CyberCPLogFileWriter.writeToFile(message)
backupSchedule.remoteBackupLogging(backupLogPath, 'Backup process killed. Error: %s' % (
open(schedulerPath, 'r').read()),
backupSchedule.ERROR)

View File

@ -645,7 +645,7 @@ class backupUtilities:
dbName = database.find('dbName').text
if VERSION == '2.1' and int(BUILD) >= 1:
if (VERSION == '2.1' or VERSION == '2.3') and int(BUILD) >= 1:
logging.CyberCPLogFileWriter.writeToFile('Backup version 2.1.1+ detected..')
databaseUsers = database.findall('databaseUsers')
@ -912,7 +912,7 @@ class backupUtilities:
dbName = database.find('dbName').text
if VERSION == '2.1' and int(BUILD) >= 1:
if (VERSION == '2.1' or VERSION == '2.3') and int(BUILD) >= 1:
logging.CyberCPLogFileWriter.writeToFile('Backup version 2.1.1+ detected..')
@ -963,6 +963,7 @@ class backupUtilities:
# /home/backup/backup-example.com-02.13.2018_10-24-52/public_html.tar.gz
## Moving above v2.0.0 extracting webhome data is not required, thus commenting below lines
if not twoPointO:
tar = tarfile.open(pathToCompressedHome)
tar.extractall(websiteHome)

View File

@ -119,7 +119,7 @@ def recursive_permissions(path, dir_mode=755, file_mode=644, topdir=True):
# Set recursive chown for a path
# recursive_chown(my_path, 'root', 'root')
# for changing group recursively without affecting user
# recursive_chown('/usr/local/lscp/cyberpanel/rainloop/data', -1, 'lscpd')
# recursive_chown('/usr/local/lscp/cyberpanel/snappymail/data', -1, 'lscpd')
# explicitly set permissions for directories/folders to 0755 and files to 0644
# recursive_permissions(my_path, 755, 644)

View File

@ -0,0 +1,190 @@
import os
import shutil
import pathlib
import stat
def mkdir_p(path, exist_ok=True):
"""
Creates the directory and paths leading up to it like unix mkdir -p .
Defaults to exist_ok so if it exists were not throwing fatal errors
https://docs.python.org/3.7/library/os.html#os.makedirs
"""
if not os.path.exists(path):
print('creating directory: ' + path)
os.makedirs(path, exist_ok)
def chmod_digit(file_path, perms):
"""
Helper function to chmod like you would in unix without having to preface 0o or converting to octal yourself.
Credits: https://stackoverflow.com/a/60052847/1621381
"""
try:
os.chmod(file_path, int(str(perms), base=8))
except:
print(f'Could not chmod : {file_path} to {perms}')
pass
def touch(filepath: str, exist_ok=True):
"""
Touches a file like unix `touch somefile` would.
"""
try:
pathlib.Path(filepath).touch(exist_ok)
except FileExistsError:
print('Could touch : ' + filepath)
pass
def symlink(src, dst):
"""
Symlink a path to another if the src exists.
"""
try:
if os.access(src, os.R_OK):
os.symlink(src, dst)
except:
print(f'Could not symlink Source: {src} > Destination: {dst}')
pass
def chown(path, user, group=-1):
"""
Chown file/path to user/group provided. Passing -1 to user or group will leave it unchanged.
Useful if just changing user or group vs both.
"""
try:
shutil.chown(path, user, group)
except PermissionError:
print(f'Could not change permissions for: {path} to {user}:{group}')
pass
def recursive_chown(path, owner, group=-1):
"""
Recursively chown a path and contents to owner.
https://docs.python.org/3/library/shutil.html
"""
for dirpath, dirnames, filenames in os.walk(path):
try:
shutil.chown(dirpath, owner, group)
except PermissionError:
print('Could not change permissions for: ' + dirpath + ' to: ' + owner)
pass
for filename in filenames:
try:
shutil.chown(os.path.join(dirpath, filename), owner, group)
except PermissionError:
print('Could not change permissions for: ' + os.path.join(dirpath, filename) + ' to: ' + owner)
pass
def recursive_permissions(path, dir_mode=755, file_mode=644, topdir=True):
"""
Recursively chmod a path and contents to mode.
Defaults to chmod top level directory but can be optionally
toggled off when you want to chmod only contents of like a user's homedir vs homedir itself
https://docs.python.org/3.6/library/os.html#os.walk
"""
# Here we are converting the integers to string and then to octal.
# so this function doesn't need to be called with 0o prefixed for the file and dir mode
dir_mode = int(str(dir_mode), base=8)
file_mode = int(str(file_mode), base=8)
if topdir:
# Set chmod on top level path
try:
os.chmod(path, dir_mode)
except:
print('Could not chmod :' + path + ' to ' + str(dir_mode))
for root, dirs, files in os.walk(path):
for d in dirs:
try:
os.chmod(os.path.join(root, d), dir_mode)
except:
print('Could not chmod :' + os.path.join(root, d) + ' to ' + str(dir_mode))
pass
for f in files:
try:
os.chmod(os.path.join(root, f), file_mode)
except:
print('Could not chmod :' + path + ' to ' + str(file_mode))
pass
# Left intentionally here for reference.
# Set recursive chown for a path
# recursive_chown(my_path, 'root', 'root')
# for changing group recursively without affecting user
# recursive_chown('/usr/local/lscp/cyberpanel/rainloop/data', -1, 'lscpd')
# explicitly set permissions for directories/folders to 0755 and files to 0644
# recursive_permissions(my_path, 755, 644)
# Fix permissions and use default values
# recursive_permissions(my_path)
# =========================================================
# Below is a helper class for getting and working with permissions
# Original credits to : https://github.com/keysemble/perfm
def perm_octal_digit(rwx):
digit = 0
if rwx[0] == 'r':
digit += 4
if rwx[1] == 'w':
digit += 2
if rwx[2] == 'x':
digit += 1
return digit
class FilePerm:
def __init__(self, filepath):
filemode = stat.filemode(os.stat(filepath).st_mode)
permissions = [filemode[-9:][i:i + 3] for i in range(0, len(filemode[-9:]), 3)]
self.filepath = filepath
self.access_dict = dict(zip(['user', 'group', 'other'], [list(perm) for perm in permissions]))
def mode(self):
mode = 0
for shift, digit in enumerate(self.octal()[::-1]):
mode += digit << (shift * 3)
return mode
def digits(self):
"""Get the octal chmod equivalent value 755 in single string"""
return "".join(map(str, self.octal()))
def octal(self):
"""Get the octal value in a list [7, 5, 5]"""
return [perm_octal_digit(p) for p in self.access_dict.values()]
def access_bits(self, access):
if access in self.access_dict.keys():
r, w, x = self.access_dict[access]
return [r == 'r', w == 'w', x == 'x']
def update_bitwise(self, settings):
def perm_list(read=False, write=False, execute=False):
pl = ['-', '-', '-']
if read:
pl[0] = 'r'
if write:
pl[1] = 'w'
if execute:
pl[2] = 'x'
return pl
self.access_dict = dict(
[(access, perm_list(read=r, write=w, execute=x)) for access, [r, w, x] in settings.items()])
os.chmod(self.filepath, self.mode())
# project_directory = os.path.abspath(os.path.dirname(sys.argv[0]))
# home_directory = os.path.expanduser('~')
# print(f'Path: {home_directory} Mode: {FilePerm(home_directory).mode()} Octal: {FilePerm(home_directory).octal()} '
# f'Digits: {FilePerm(home_directory).digits()}')
# Example: Output
# Path: /home/cooluser Mode: 493 Octal: [7, 5, 5] Digits: 755

View File

@ -18,19 +18,20 @@ class findBWUsage:
if not os.path.exists(path):
return 0
logData = open(path, 'r').readlines()
from processUtilities import ProcessUtilities
logData = ProcessUtilities.outputExecutioner('cat %s' % (path), 'nobody').splitlines()
logDataLines = len(logData)
if not os.path.exists("/home/"+domainName+"/logs"):
return 0
bwmeta = "/home/" + domainName + "/logs/bwmeta"
bwmeta = "/home/cyberpanel/%s.bwmeta" % (domainName)
if not os.path.exists(path):
writeMeta = open(bwmeta, 'w')
writeMeta.writelines('0\n0\n')
writeMeta.close()
os.chmod(bwmeta, 0o600)
return 1
if os.path.exists(bwmeta):
@ -56,6 +57,8 @@ class findBWUsage:
writeMeta.writelines(str(currentLinesRead) + "\n")
writeMeta.close()
os.chmod(bwmeta, 0o600)
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [calculateBandwidth]")
return 0
@ -148,5 +151,4 @@ class findBWUsage:
return 1
findBWUsage.startCalculations()

View File

@ -814,12 +814,13 @@ class MailServerManagerUtils(multi.Thread):
def install_postfix_dovecot(self):
try:
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
command = 'yum remove postfix -y'
ProcessUtilities.executioner(command)
elif ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu:
command = 'apt-get -y remove postfix'
ProcessUtilities.executioner(command)
command = 'yum remove postfix* dovecot* -y'
ProcessUtilities.executioner(command, None, True)
elif ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20:
command = 'apt-get -y remove postfix* dovecot*'
ProcessUtilities.executioner(command, None, True)
### On Ubuntu 18 find if old dovecot and remove
@ -827,7 +828,7 @@ class MailServerManagerUtils(multi.Thread):
try:
command = 'apt-get purge dovecot* -y'
os.system(command)
ProcessUtilities.executioner(command, None, True)
command = 'apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 18A348AEED409DA1'
ProcessUtilities.executioner(command)
@ -854,14 +855,12 @@ class MailServerManagerUtils(multi.Thread):
command = 'yum install --enablerepo=gf-plus -y postfix3 postfix3-ldap postfix3-mysql postfix3-pcre'
elif ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
command = 'dnf --nogpg install -y https://mirror.ghettoforge.org/distributions/gf/el/8/gf/x86_64/gf-release-8-11.gf.el8.noarch.rpm'
command = 'dnf --nogpg install -y https://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el8.noarch.rpm'
ProcessUtilities.executioner(command)
command = 'dnf install --enablerepo=gf-plus postfix3 postfix3-mysql -y'
ProcessUtilities.executioner(command)
else:
import socket
command = 'apt-get install -y debconf-utils'
ProcessUtilities.executioner(command)
@ -1038,6 +1037,9 @@ class MailServerManagerUtils(multi.Thread):
def centos_lib_dir_to_ubuntu(self, filename, old, new):
try:
#command = "sed -i 's|%s|%s|g' %s" % (old, new, filename)
#ProcessUtilities.executioner(command, None, True)
fd = open(filename, 'r')
lines = fd.readlines()
fd.close()
@ -1101,7 +1103,7 @@ class MailServerManagerUtils(multi.Thread):
ProcessUtilities.executioner(command)
# Cleanup config files for ubuntu
if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu:
if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20:
self.centos_lib_dir_to_ubuntu("/usr/local/CyberCP/install/email-configs-one/master.cf", "/usr/libexec/",
"/usr/lib/")
self.centos_lib_dir_to_ubuntu("/usr/local/CyberCP/install/email-configs-one/main.cf",
@ -1502,6 +1504,8 @@ class MailServerManagerUtils(multi.Thread):
virtualHostUtilities.issueSSLForMailServer(self.mailHostName,
'/home/%s/public_html' % (self.mailHostName))
MailServerSSLCheck = 0
from websiteFunctions.models import ChildDomains
from plogical.virtualHostUtilities import virtualHostUtilities
for websites in Websites.objects.all():
@ -1513,6 +1517,15 @@ class MailServerManagerUtils(multi.Thread):
except:
pass
if self.MailSSL == 0 and MailServerSSLCheck == 0:
logging.CyberCPLogFileWriter.statusWriter(self.extraArgs['tempStatusPath'],
'Setting up Mail Server SSL as no hostname SSL found..,80')
from plogical.virtualHostUtilities import virtualHostUtilities
virtualHostUtilities.issueSSLForMailServer(websites.domain,
'/home/%s/public_html' % (websites.domain))
MailServerSSLCheck = 1
logging.CyberCPLogFileWriter.statusWriter(self.extraArgs['tempStatusPath'], 'Fixing permissions..,90')
self.fixCyberPanelPermissions()
@ -1526,6 +1539,10 @@ class MailServerManagerUtils(multi.Thread):
def configureOpenDKIM(self):
try:
if ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
command = 'dnf install opendkim-tools -y'
ProcessUtilities.executioner(command)
## Configure OpenDKIM specific settings
openDKIMConfigurePath = "/etc/opendkim.conf"

View File

@ -170,10 +170,11 @@ class ProcessUtilities(multi.Thread):
return ProcessUtilities.ubuntu20
return ProcessUtilities.ubuntu
else:
if open('/etc/redhat-release', 'r').read().find('CentOS Linux release 8') > -1 or open('/etc/redhat-release', 'r').read().find('AlmaLinux release 8') > -1:
if open('/etc/redhat-release', 'r').read().find('CentOS Linux release 8') > -1 or open('/etc/redhat-release', 'r').read().find('AlmaLinux release 8') > -1 or open('/etc/redhat-release', 'r').read().find('Rocky Linux release 8') > -1:
return ProcessUtilities.cent8
return ProcessUtilities.centos
@staticmethod
def containerCheck():
try:
@ -225,7 +226,8 @@ class ProcessUtilities(multi.Thread):
command = 'sudo %s' % (command)
if os.path.exists(ProcessUtilities.debugPath):
logging.writeToFile(ProcessUtilities.token + command)
if command.find('cat') == -1:
logging.writeToFile(ProcessUtilities.token + command)
if dir == None:
sock.sendall((ProcessUtilities.token + command).encode('utf-8'))
@ -238,8 +240,11 @@ class ProcessUtilities(multi.Thread):
else:
command = '%s-u %s -d %s %s' % (ProcessUtilities.token, user, dir, command)
command = command.replace('sudo', '')
if os.path.exists(ProcessUtilities.debugPath):
logging.writeToFile(command)
if command.find('cat') == -1:
logging.writeToFile(command)
sock.sendall(command.encode('utf-8'))

View File

@ -34,6 +34,7 @@ class Upgrade:
CentOSPath = '/etc/redhat-release'
UbuntuPath = '/etc/lsb-release'
FromCloud = 0
SnappyVersion = '2.15.3'
AdminACL = '{"adminStatus":1, "versionManagement": 1, "createNewUser": 1, "listUsers": 1, "deleteUser":1 , "resellerCenter": 1, ' \
'"changeUserACL": 1, "createWebsite": 1, "modifyWebsite": 1, "suspendWebsite": 1, "deleteWebsite": 1, ' \
@ -366,33 +367,33 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
try:
#######
if os.path.exists("/usr/local/CyberCP/public/rainloop"):
if os.path.exists("/usr/local/lscp/cyberpanel/rainloop/data"):
pass
else:
command = "mv /usr/local/CyberCP/public/rainloop/data /usr/local/lscp/cyberpanel/rainloop/data"
Upgrade.executioner(command, 0)
command = "chown -R lscpd:lscpd /usr/local/lscp/cyberpanel/rainloop/data"
Upgrade.executioner(command, 0)
iPath = os.listdir('/usr/local/CyberCP/public/rainloop/rainloop/v/')
path = "/usr/local/CyberCP/public/rainloop/rainloop/v/%s/include.php" % (iPath[0])
data = open(path, 'r').readlines()
writeToFile = open(path, 'w')
for items in data:
if items.find("$sCustomDataPath = '';") > -1:
writeToFile.writelines(
" $sCustomDataPath = '/usr/local/lscp/cyberpanel/rainloop/data';\n")
else:
writeToFile.writelines(items)
writeToFile.close()
return 0
# if os.path.exists("/usr/local/CyberCP/public/rainloop"):
#
# if os.path.exists("/usr/local/lscp/cyberpanel/rainloop/data"):
# pass
# else:
# command = "mv /usr/local/CyberCP/public/rainloop/data /usr/local/lscp/cyberpanel/rainloop/data"
# Upgrade.executioner(command, 0)
#
# command = "chown -R lscpd:lscpd /usr/local/lscp/cyberpanel/rainloop/data"
# Upgrade.executioner(command, 0)
#
# iPath = os.listdir('/usr/local/CyberCP/public/rainloop/rainloop/v/')
#
# path = "/usr/local/CyberCP/public/snappymail/snappymail/v/%s/include.php" % (iPath[0])
#
# data = open(path, 'r').readlines()
# writeToFile = open(path, 'w')
#
# for items in data:
# if items.find("$sCustomDataPath = '';") > -1:
# writeToFile.writelines(
# " $sCustomDataPath = '/usr/local/lscp/cyberpanel/rainloop/data';\n")
# else:
# writeToFile.writelines(items)
#
# writeToFile.close()
# return 0
cwd = os.getcwd()
@ -404,7 +405,7 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
count = 1
while (1):
command = 'wget https://www.rainloop.net/repository/webmail/rainloop-community-latest.zip'
command = 'wget https://github.com/the-djmaze/snappymail/releases/download/v%s/snappymail-%s.zip' % (Upgrade.SnappyVersion, Upgrade.SnappyVersion)
cmd = shlex.split(command)
res = subprocess.call(cmd)
if res != 0:
@ -418,8 +419,11 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
count = 0
if os.path.exists('/usr/local/CyberCP/public/snappymail'):
shutil.rmtree('/usr/local/CyberCP/public/snappymail')
while (1):
command = 'unzip rainloop-community-latest.zip -d /usr/local/CyberCP/public/rainloop'
command = 'unzip snappymail-%s.zip -d /usr/local/CyberCP/public/snappymail' % (Upgrade.SnappyVersion)
cmd = shlex.split(command)
res = subprocess.call(cmd)
@ -429,12 +433,14 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
break
else:
break
os.remove("rainloop-community-latest.zip")
try:
os.remove("snappymail-%s.zip" % (Upgrade.SnappyVersion))
except:
pass
#######
os.chdir("/usr/local/CyberCP/public/rainloop")
os.chdir("/usr/local/CyberCP/public/snappymail")
count = 0
@ -465,9 +471,9 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
break
######
iPath = os.listdir('/usr/local/CyberCP/public/rainloop/rainloop/v/')
iPath = os.listdir('/usr/local/CyberCP/public/snappymail/snappymail/v/')
path = "/usr/local/CyberCP/public/rainloop/rainloop/v/%s/include.php" % (iPath[0])
path = "/usr/local/CyberCP/public/snappymail/snappymail/v/%s/include.php" % (iPath[0])
data = open(path, 'r').readlines()
writeToFile = open(path, 'w')
@ -482,18 +488,33 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
writeToFile.close()
command = "mkdir -p /usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/configs/"
Upgrade.executioner(command, 'mkdir rainloop configs', 0)
Upgrade.executioner(command, 'mkdir snappymail configs', 0)
labsPath = '/usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/configs/application.ini'
labsData = """[labs]
imap_folder_list_limit = 0
autocreate_system_folders = On
"""
writeToFile = open(labsPath, 'w')
writeToFile = open(labsPath, 'a')
writeToFile.write(labsData)
writeToFile.close()
includeFileOldPath = '/usr/local/CyberCP/public/snappymail/_include.php'
includeFileNewPath = '/usr/local/CyberCP/public/snappymail/include.php'
if os.path.exists(includeFileOldPath):
writeToFile = open(includeFileOldPath, 'a')
writeToFile.write("\ndefine('APP_DATA_FOLDER_PATH', '/usr/local/lscp/cyberpanel/rainloop/data/');\n")
writeToFile.close()
command = 'mv %s %s' % (includeFileOldPath, includeFileNewPath)
Upgrade.executioner(command, 'mkdir snappymail configs', 0)
command = "sed -i 's|autocreate_system_folders = Off|autocreate_system_folders = On|g' %s" % (labsPath)
Upgrade.executioner(command, 'mkdir snappymail configs', 0)
os.chdir(cwd)
except BaseException as msg:
@ -615,6 +636,7 @@ imap_folder_list_limit = 0
'CREATE TABLE `loginSystem_acl` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `name` varchar(50) NOT NULL UNIQUE, `adminStatus` integer NOT NULL DEFAULT 0, `versionManagement` integer NOT NULL DEFAULT 0, `createNewUser` integer NOT NULL DEFAULT 0, `deleteUser` integer NOT NULL DEFAULT 0, `resellerCenter` integer NOT NULL DEFAULT 0, `changeUserACL` integer NOT NULL DEFAULT 0, `createWebsite` integer NOT NULL DEFAULT 0, `modifyWebsite` integer NOT NULL DEFAULT 0, `suspendWebsite` integer NOT NULL DEFAULT 0, `deleteWebsite` integer NOT NULL DEFAULT 0, `createPackage` integer NOT NULL DEFAULT 0, `deletePackage` integer NOT NULL DEFAULT 0, `modifyPackage` integer NOT NULL DEFAULT 0, `createDatabase` integer NOT NULL DEFAULT 0, `deleteDatabase` integer NOT NULL DEFAULT 0, `listDatabases` integer NOT NULL DEFAULT 0, `createNameServer` integer NOT NULL DEFAULT 0, `createDNSZone` integer NOT NULL DEFAULT 0, `deleteZone` integer NOT NULL DEFAULT 0, `addDeleteRecords` integer NOT NULL DEFAULT 0, `createEmail` integer NOT NULL DEFAULT 0, `deleteEmail` integer NOT NULL DEFAULT 0, `emailForwarding` integer NOT NULL DEFAULT 0, `changeEmailPassword` integer NOT NULL DEFAULT 0, `dkimManager` integer NOT NULL DEFAULT 0, `createFTPAccount` integer NOT NULL DEFAULT 0, `deleteFTPAccount` integer NOT NULL DEFAULT 0, `listFTPAccounts` integer NOT NULL DEFAULT 0, `createBackup` integer NOT NULL DEFAULT 0, `restoreBackup` integer NOT NULL DEFAULT 0, `addDeleteDestinations` integer NOT NULL DEFAULT 0, `scheduleBackups` integer NOT NULL DEFAULT 0, `remoteBackups` integer NOT NULL DEFAULT 0, `manageSSL` integer NOT NULL DEFAULT 0, `hostnameSSL` integer NOT NULL DEFAULT 0, `mailServerSSL` integer NOT NULL DEFAULT 0)')
except:
pass
try:
cursor.execute('ALTER TABLE loginSystem_administrator ADD token varchar(500)')
except:
@ -834,6 +856,11 @@ imap_folder_list_limit = 0
except:
pass
try:
cursor.execute('ALTER TABLE e_users ADD DiskUsage varchar(200)')
except:
pass
try:
connection.close()
except:
@ -1906,20 +1933,20 @@ imap_folder_list_limit = 0
return ''.join(random.choice(chars) for x in range(size))
content = """<?php
$_ENV['RAINLOOP_INCLUDE_AS_API'] = true;
include '/usr/local/CyberCP/public/rainloop/index.php';
$_ENV['snappymail_INCLUDE_AS_API'] = true;
include '/usr/local/CyberCP/public/snappymail/index.php';
$oConfig = \RainLoop\Api::Config();
$oConfig = \snappymail\Api::Config();
$oConfig->SetPassword('%s');
echo $oConfig->Save() ? 'Done' : 'Error';
?>""" % (generate_pass())
writeToFile = open('/usr/local/CyberCP/public/rainloop.php', 'w')
writeToFile = open('/usr/local/CyberCP/public/snappymail.php', 'w')
writeToFile.write(content)
writeToFile.close()
command = "chown -R lscpd:lscpd /usr/local/lscp/cyberpanel/rainloop/data"
command = "chown -R lscpd:lscpd /usr/local/lscp/cyberpanel/snappymail/data"
subprocess.call(shlex.split(command))
except:
@ -1971,7 +1998,7 @@ echo $oConfig->Save() ? 'Done' : 'Error';
command = "chown -R root:root /usr/local/lscp"
Upgrade.executioner(command, 'chown core code', 0)
command = "chown -R lscpd:lscpd /usr/local/lscp/cyberpanel/rainloop/data"
command = "chown -R lscpd:lscpd /usr/local/lscp/cyberpanel/rainloop"
Upgrade.executioner(command, 'chown core code', 0)
command = "chmod 700 /usr/local/CyberCP/cli/cyberPanel.py"
@ -2079,10 +2106,10 @@ echo $oConfig->Save() ? 'Done' : 'Error';
command = 'chmod 640 /usr/local/lscp/cyberpanel/logs/access.log'
Upgrade.executioner(command, 0)
command = '/usr/local/lsws/lsphp72/bin/php /usr/local/CyberCP/public/rainloop.php'
command = '/usr/local/lsws/lsphp72/bin/php /usr/local/CyberCP/public/snappymail.php'
Upgrade.executioner(command, 0)
command = 'chmod 600 /usr/local/CyberCP/public/rainloop.php'
command = 'chmod 600 /usr/local/CyberCP/public/snappymail.php'
Upgrade.executioner(command, 0)
###
@ -2341,6 +2368,8 @@ echo $oConfig->Save() ? 'Done' : 'Error';
if Upgrade.installedOutput.find('restic') == -1:
command = 'yum install restic -y'
Upgrade.executioner(command, 'Install Restic')
command = 'restic self-update'
Upgrade.executioner(command, 'Install Restic')
else:
if Upgrade.installedOutput.find('restic/bionic,now 0.8') == -1:
@ -2349,6 +2378,9 @@ echo $oConfig->Save() ? 'Done' : 'Error';
command = 'apt-get install restic -y'
Upgrade.executioner(command, 'Install Restic')
command = 'restic self-update'
Upgrade.executioner(command, 'Install Restic')
@staticmethod
def UpdateMaxSSLCons():

2696
plogical/upgrade.py.bak Normal file

File diff suppressed because it is too large Load Diff

View File

@ -749,7 +749,7 @@ class vhost:
print("0,0")
return 0,0
bwmeta = "/home/" + domainName + "/logs/bwmeta"
bwmeta = "/home/cyberpanel/%s.bwmeta" % (domainName)
if not os.path.exists(path):
print("0,0")

View File

@ -1195,6 +1195,14 @@ class virtualHostUtilities:
except:
return [int(0), int(0)]
@staticmethod
def getDiskUsageofPath(path):
try:
return subprocess.check_output('du -hs %s --block-size=1M' % (path), shell=True).decode("utf-8").split()[0]
except BaseException:
return '0MB'
@staticmethod
def permissionControl(path):
try:

View File

@ -38,6 +38,10 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
var domainName = $("#domainNameInitial").text();
var domainRandomSeed = "";
$scope.currentRPath = "/";
var homeRPathBack = "/";
var homePathBack = "/home/" + domainName;
$scope.currentPath = "/home/" + domainName;
$scope.startingPath = domainName;
@ -439,8 +443,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
var fileOrFolderNode = document.createTextNode("Folder");
fifthTDNode.appendChild(fileOrFolderNode)
}
else {
} else {
thNode.appendChild(iNodeFile);
trNode.appendChild(thNode);
trNode.addEventListener("click", function () {
@ -472,10 +475,10 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
$scope.buttonActivator = function () {
// for restore button
if($scope.currentPath === trashPath) {
if ($scope.currentPath === trashPath) {
var restoreBTN = document.getElementById("restoreRight");
restoreBTN.style.display = "block";
}else{
} else {
var restoreBTN = document.getElementById("restoreRight");
restoreBTN.style.display = "none";
}
@ -502,12 +505,10 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
} else if (result[0] === "php") {
aceEditorMode = "ace/mode/php";
editNotRight.style.display = "Block";
}
else if (result[0] === "py") {
} else if (result[0] === "py") {
aceEditorMode = "ace/mode/python";
editNotRight.style.display = "Block";
}
else if (result[0] === "txt") {
} else if (result[0] === "txt") {
aceEditorMode = "";
editNotRight.style.display = "Block";
} else if (result[0] === "htaccess") {
@ -523,8 +524,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
editNode.style.pointerEvents = "none";
editNotRight.style.display = "None";
}
}
else {
} else {
var editNode = document.getElementById("editFile");
editNode.style.pointerEvents = "none";
}
@ -631,28 +631,50 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
url = "/filemanager/controller";
var completePathToFile = "";
if (functionName === "startPoint") {
completePathToFile = $scope.currentPath;
} else if (functionName === "doubleClick") {
completePathToFile = $scope.currentPath + "/" + node.innerHTML;
} else if (functionName === "homeFetch") {
completePathToFile = homePathBack;
} else if (functionName === "goBackOnPath") {
var pos = $scope.currentPath.lastIndexOf("/");
completePathToFile = $scope.currentPath.slice(0, pos);
} else if (functionName === "refresh") {
completePathToFile = $scope.currentPath;
var rightClickNode = document.getElementById("rightClick");
} else if (functionName === "fromTree") {
completePathToFile = arguments[2];
if (domainName === "") {
if (functionName === "startPoint") {
completePathToFile = $scope.currentRPath;
} else if (functionName === "doubleClick") {
completePathToFile = $scope.currentRPath + "/" + node.innerHTML;
} else if (functionName === "homeFetch") {
completePathToFile = homeRPathBack;
} else if (functionName === "goBackOnPath") {
var pos = $scope.currentRPath.lastIndexOf("/");
completePathToFile = $scope.currentRPath.slice(0, pos);
} else if (functionName === "refresh") {
completePathToFile = $scope.currentRPath;
var rightClickNode = document.getElementById("rightClick");
} else if (functionName === "fromTree") {
completePathToFile = arguments[2];
}
$scope.currentRPath = completePathToFile;
} else {
if (functionName === "startPoint") {
completePathToFile = $scope.currentPath;
} else if (functionName === "doubleClick") {
completePathToFile = $scope.currentPath + "/" + node.innerHTML;
} else if (functionName === "homeFetch") {
completePathToFile = homePathBack;
} else if (functionName === "goBackOnPath") {
var pos = $scope.currentPath.lastIndexOf("/");
completePathToFile = $scope.currentPath.slice(0, pos);
} else if (functionName === "refresh") {
completePathToFile = $scope.currentPath;
var rightClickNode = document.getElementById("rightClick");
} else if (functionName === "fromTree") {
completePathToFile = arguments[2];
}
$scope.currentPath = completePathToFile;
}
$scope.currentPath = completePathToFile;
var data = {
completeStartingPath: completePathToFile,
method: "listForTable",
home: homePathBack,
home: "/",
domainRandomSeed: domainRandomSeed,
domainName: domainName
};
@ -816,7 +838,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
/// code mirror open
$scope.editWithCodeMirror = function(){
$scope.editWithCodeMirror = function () {
var completePathForFile = $scope.currentPath + "/" + allFilesAndFolders[0];
var finalURL = 'https://' + window.location.hostname + ':' + window.location.port + '/filemanager/editFile?domainName=' + domainName + '&fileName=' + completePathForFile;
window.open(finalURL);
@ -826,17 +848,32 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
// uploads
$scope.errorMessage = true;
var uploader;
if (domainName == "") {
uploader = $scope.uploader = new FileUploader({
url: "/filemanager/upload",
headers: {
'X-CSRFToken': getCookie('csrftoken') // X-CSRF-TOKEN is used for Ruby on Rails Tokens
},
formData: [{
"method": "upload",
"home": homeRPathBack
}]
});
} else {
uploader = $scope.uploader = new FileUploader({
url: "/filemanager/upload",
headers: {
'X-CSRFToken': getCookie('csrftoken') // X-CSRF-TOKEN is used for Ruby on Rails Tokens
},
formData: [{
"method": "upload",
"home": homePathBack
}]
});
}
var uploader = $scope.uploader = new FileUploader({
url: "/filemanager/upload",
headers: {
'X-CSRFToken': getCookie('csrftoken') // X-CSRF-TOKEN is used for Ruby on Rails Tokens
},
formData: [{
"method": "upload",
"home": homePathBack
}]
});
uploader.onCompleteItem = function (fileItem, response, status, headers) {
if (response.uploadStatus === 1) {
@ -850,10 +887,16 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
};
uploader.onAfterAddingFile = function (fileItem) {
var basepath;
if (domainName == "") {
basepath = $scope.currentRPath;
} else {
basepath = $scope.currentPath
}
$scope.errorMessage = true;
fileItem.formData.push(
{
"completePath": $scope.currentPath,
"completePath": basepath,
domainRandomSeed: domainRandomSeed,
domainName: domainName
@ -883,9 +926,14 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
$scope.createNewFolder = function () {
$scope.errorMessageFolder = true;
var completePathForFolder = $scope.currentPath + "/" + $scope.newFolderName;
var completePathForFolder;
if (domainName === "") {
completePathForFolder = $scope.currentRPath + "/" + $scope.newFolderName;
$scope.errorMessageFile = true;
} else {
completePathForFolder = $scope.currentPath + "/" + $scope.newFolderName;
$scope.errorMessageFile = true;
}
if ($scope.newFolderName.length === 0) {
$scope.errorMessageFolder = false;
@ -951,9 +999,15 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
};
$scope.createNewFile = function () {
var completePathForFile;
if (domainName === "") {
completePathForFile = $scope.currentRPath + "/" + $scope.newFileName;
$scope.errorMessageFile = true;
} else {
completePathForFile = $scope.currentPath + "/" + $scope.newFileName;
$scope.errorMessageFile = true;
}
var completePathForFile = $scope.currentPath + "/" + $scope.newFileName;
$scope.errorMessageFile = true;
if ($scope.newFileName.length === 0) {
$scope.errorMessageFile = false;
@ -1008,16 +1062,26 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
};
$scope.deleteFolderOrFile = function () {
var pth;
var trash;
if (domainName === "") {
pth = $scope.currentRPath;
trash = true;
} else {
pth = $scope.currentPath;
trash = $scope.skipTrash
}
$scope.deleteLoading = false;
var data = {
path: $scope.currentPath,
path: pth,
method: "deleteFolderOrFile",
fileAndFolders: allFilesAndFolders,
domainRandomSeed: domainRandomSeed,
domainName: domainName,
skipTrash: $scope.skipTrash
skipTrash: trash
};
@ -1067,12 +1131,19 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
};
$scope.startCompression = function () {
var basepathh;
if (domainName === "") {
basepathh = $scope.currentRPath;
} else {
basepathh = $scope.currentPath;
}
$scope.compressionLoading = false;
var data = {
home: homePathBack,
basePath: $scope.currentPath,
basePath: basepathh,
listOfFiles: allFilesAndFolders,
compressedFileName: $scope.compressedFileName,
compressionType: $scope.compressionType,
@ -1123,10 +1194,18 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
$scope.startExtraction = function () {
var pathbase;
if (domainName === "") {
pathbase = $scope.currentRPath;
} else {
pathbase = $scope.currentPath;
}
$scope.extractionLoading = false;
var basePath = $scope.currentPath;
var completeFileToExtract = $scope.currentPath + "/" + allFilesAndFolders[0];
var completeFileToExtract = pathbase + "/" + allFilesAndFolders[0];
var extractionType = "";
if (findFileExtension(completeFileToExtract) == "gz") {
@ -1137,7 +1216,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
var data = {
home: homePathBack,
basePath: basePath,
basePath: pathbase,
fileToExtract: completeFileToExtract,
extractionType: extractionType,
extractionLocation: $scope.extractionLocation,
@ -1197,11 +1276,18 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
$scope.startMoving = function () {
var basepth;
if (domainName == "") {
basepth = $scope.currentRPath;
} else {
basepth = $scope.currentPath;
}
$scope.moveLoading = false;
var data = {
home: homePathBack,
basePath: $scope.currentPath,
basePath: basepth,
newPath: $scope.pathToMoveTo,
fileAndFolders: allFilesAndFolders,
method: 'move',
@ -1258,12 +1344,19 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
$scope.startCopying = function () {
var basepath;
if (domainName == "") {
basepath = $scope.currentRPath;
} else {
basepath = $scope.currentPath;
}
$scope.copyLoading = false;
var data = {
home: homePathBack,
basePath: $scope.currentPath,
basePath: basepath,
newPath: $scope.pathToCopyTo,
fileAndFolders: allFilesAndFolders,
method: 'copy',
@ -1393,10 +1486,17 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
$scope.renameFile = function () {
var bpath;
if (domainName === "") {
bpath = $scope.currentRPath;
} else {
bpath = $scope.currentPath;
}
$scope.renameLoading = false;
var data = {
basePath: $scope.currentPath,
basePath: bpath,
existingName: $scope.fileToRename,
newFileName: $scope.newFileName,
method: 'rename',
@ -1490,6 +1590,12 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
window.location.href = url + '?domainName=' + domainName + '&fileToDownload=' + downloadURL;
};
$scope.RootDownloadFile = function () {
url = "/filemanager/RootDownloadFile";
var downloadURL = $scope.currentPath + "/" + allFilesAndFolders[0];
window.location.href = url + '?fileToDownload=' + downloadURL;
};
// Change permissions
@ -1721,4 +1827,4 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
};
});
});

View File

@ -99,3 +99,25 @@ class NormalBackupJobLogs(models.Model):
owner = models.ForeignKey(NormalBackupJobs, on_delete=models.CASCADE)
status = models.IntegerField()
message = models.TextField()
class wpplugins(models.Model):
owner = models.ForeignKey(Administrator, on_delete=models.CASCADE)
Name = models.CharField(max_length=255, default='')
config = models.TextField()
class WPSites(models.Model):
owner = models.ForeignKey(Websites, on_delete=models.CASCADE)
title = models.CharField(max_length=255, default='')
path = models.CharField(max_length=255, default='')
FinalURL = models.CharField(max_length=255, default='')
AutoUpdates = models.CharField(max_length=100, default='Disabled')
PluginUpdates = models.CharField(max_length=15, default='Disabled')
ThemeUpdates = models.CharField(max_length=15, default='Disabled')
date = models.DateTimeField(default=datetime.now)
WPLockState = models.IntegerField(default=1)
class WPStaging(models.Model):
owner = models.ForeignKey(WPSites, on_delete=models.CASCADE)
wpsite = models.ForeignKey(WPSites, on_delete=models.CASCADE, related_name='actual_wpsite')

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,71 @@
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{% trans "plugin - CyberPanel" %}{% endblock %}
{% block content %}
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
<div class="container">
<div id="page-title">
<h2 id="domainNamePage">{% trans "Add New Plugin" %}
</h2>
</div>
<div ng-controller="WPAddNewPlugin" class="panel">
<div class="panel-body">
<div class="example-box-wrapper">
<form name="websiteCreationForm" action="/" id="createPackages"
class="form-horizontal bordered-row panel-body">
<label>{% trans "Plugin Bucket Name" %}</label>
<input name="PluginbucketName" type="text" class="form-control"
ng-model="PluginbucketName"
required>
<label>{% trans "Search Plugin Name" %}</label>
<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);
position: absolute; z-index: 1;
background-color: #FFFFFF">
</div>
<h3>Selected Plugin</h3>
<div id="selJS" style="display: none; display: flex; flex-direction: row;">
</div>
<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="AddNewplugin()"
class="btn btn-primary btn-lg">{% trans "Add Plugin Bucket" %}</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,103 @@
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{% trans "plugin - CyberPanel" %}{% endblock %}
{% block content %}
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
<div class="container">
<div id="page-title">
<h2 id="domainNamePage"><h2>{% trans "Configure Plugins" %}</h2>
<a class="pull-right btn btn-primary" href="{% url "Addnewplugin" %}">{% trans "Add New Plugin" %}</a>
</h2>
</div>
<h3>List of Saved Plugins Bucket</h3>
<table class="table table-hover dataTable no-footer" id="basicTable" role="grid">
<thead style="background-color: #0a6ebd">
<tr role="row" class="plans-head">
<th style="color: #fff0ff" class="sorting_desc" tabindex="0"
aria-controls="basicTable" rowspan="1" colspan="1"
aria-sort="descending"
aria-label="Title: activate to sort column ascending">ID
</th>
<th style="color: #fff0ff" class="sorting" tabindex="0"
aria-controls="basicTable" rowspan="1" colspan="1"
aria-label="Places: activate to sort column ascending">File name
</th>
<th style="color: #fff0ff" class="sorting" tabindex="0"
aria-controls="basicTable" rowspan="1" colspan="1"
aria-label="Places: activate to sort column ascending">Action
</th>
</tr>
</thead>
<tbody>
{% for sub in Selectedplugins %}
<tr role="row" class="odd">
<td class="v-align-middle sorting_1">
<p>{{ sub.id }}</p>
</td>
<td class="v-align-middle">
<p>{{ sub.Name }}</p>
</td>
<td class="row">
<div class="col-md-2">
<a href="{% url 'EidtPlugin'%}?ID={{sub.id}}"
type="button" class="btn btn-border btn-alt border-green btn-link font-green">
Edit
</a>
</div>
<div class="col-md-2">
<button
onclick="DeletePluginBuucket('{% url 'ConfigurePlugins' %}?delete={{ sub.id }}')"
data-toggle="modal"
data-target="#DeleteMember" aria-label=""
type="button" class="btn btn-border btn-alt border-red btn-link font-red">
Delete
</button>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!------------Modal---->
<div class="modal fade stick-up" id="DeleteMember" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Deleting Plugin Bucket</h4>
</div>
<div class="modal-body">
<p>Are you sure?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">No</button>
<button type="button" onclick="FinalDeletePluginBuucket()" class="btn btn-primary">Yes</button>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,257 @@
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{% trans "Create New WordPress - CyberPanel" %}{% endblock %}
{% block content %}
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
<div class="container">
<div id="page-title">
<h2>{% trans "Create Wordpress Site" %}</h2>
<p>{% trans "On this page you can launch, list, modify and delete websites from your server." %}</p>
</div>
<div ng-controller="createWordpress" class="panel">
<div class="panel-body">
<h3 class="content-box-header">
{% trans "Website Details" %} <img ng-hide="webSiteCreationLoading"
src="{% static 'images/loading.gif' %}">
</h3>
<div class="example-box-wrapper">
<form name="websiteCreationForm" action="/" id="createPackages"
class="form-horizontal bordered-row panel-body">
<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">
{% for items in packageList %}
<option>{{ items }}</option>
{% endfor %}
</select>
</div>
</div>
<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">
{% for items in owernList %}
<option>{{ items }}</option>
{% endfor %}
</select>
</div>
</div>
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Title" %}</label>
<div class="col-sm-6">
<input type="text" name="WPtitle" class="form-control" ng-model="WPtitle" required>
</div>
</div>
<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>
</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>
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Username" %}</label>
<div class="col-sm-6">
<input name="Username" type="text" class="form-control" ng-model="WPUsername"
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>
<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>
</div>
<div ng-show="websiteCreationForm.email.$error.email"
class="current-pack">{% trans "Invalid Email" %}</div>
</div>
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Password" %}</label>
<div class="col-sm-6">
<input name="password" type="password" class="form-control" ng-model="WPPassword"
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>
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Select WP Version" %}</label>
<div class="col-sm-6">
<select ng-model="WPVersions" class="form-control">
{% for wp in WPVersions %}
<option>{{ wp }}</option>
{% endfor %}
</select>
</div>
</div>
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Plugin/Theme" %}</label>
<div class="col-sm-6">
<select ng-model="pluginbucket" class="form-control">
<option value="-1" selected>Select Plugin Bucket</option>
{% for wp in Plugins %}
<option value="{{ wp.id }}">{{ wp.Name }}</option>
{% endfor %}
</select>
</div>
</div>
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Automatic Updates" %}</label>
<div class="col-sm-6">
<select ng-model="autoupdates" class="form-control">
<option>Disabled</option>
<option>All (minor and major)</option>
<option>Minor and Security Updates</option>
</select>
</div>
</div>
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Plugins Updates" %}</label>
<div class="col-sm-6">
<select ng-model="pluginupdates" class="form-control">
<option>Enabled</option>
<option>Disabled</option>
</select>
</div>
</div>
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Themes Updates" %}</label>
<div class="col-sm-6">
<select ng-model="themeupdates" class="form-control">
<option>Enabled</option>
<option>Disabled</option>
</select>
</div>
</div>
<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">
<label>
<input ng-model="sslCheck" type="checkbox" value="">
SSL
</label>
</div>
</div>
<label class="col-sm-3 control-label"></label>
<div class="col-sm-9">
<div class="checkbox">
<label>
<input ng-model="dkimCheck" type="checkbox" value="">
DKIM Support
</label>
</div>
</div>
<label class="col-sm-3 control-label"></label>
<div class="col-sm-9">
<div class="checkbox">
<label>
<input ng-model="openBasedir" type="checkbox" value="">
open_basedir Protection
</label>
</div>
</div>
<label class="col-sm-3 control-label"></label>
<div class="col-sm-9">
<div class="checkbox">
<label>
<input ng-model="mailDomain" type="checkbox" value="">
Create Mail Domain
</label>
</div>
</div>
</div>
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-4">
<button type="button" ng-click="createWordPresssite()"
class="btn btn-primary btn-lg">{% trans "Create Website" %}</button>
</div>
</div>
<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 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">{% trans "Go Back" %}</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,81 @@
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{% trans "plugin - CyberPanel" %}{% endblock %}
{% block content %}
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
<div class="container">
<span id="pluginbID" style="display: none">{{ pluginbID }}</span>
<div id="page-title">
<h2 id="domainNamePage">{% trans "Eidt Plugin Bucket" %}
</h2>
</div>
<div ng-controller="WPAddNewPlugin" class="panel">
<div class="panel-body">
<div class="example-box-wrapper">
<form name="websiteCreationForm" action="/" id="createPackages"
class="form-horizontal bordered-row panel-body">
<label>{% trans "Search Plugin Name" %}</label>
<input name="searchcontent" type="text" class="form-control" ng-model="searchcontent"
ng-keyup="SearchPluginName('eidt')"
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);
position: absolute; z-index: 1;
background-color: #FFFFFF">
</div>
<h3>Selected Plugin</h3>
<div id="sedplugn" style=" display: flex; flex-direction: row;">
{% for plugin in Selectedplugins %}
<div id="selplug"
style="background-color: #12207a; color: #FFFFFF; padding: 5px; border-radius: 30px">
{{plugin}}
<svg ng-click="deletesPlgin('{{plugin}}')" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"
role="img" width="1em" height="1em"
preserveAspectRatio="xMidYMid meet" viewBox="0 0 16 16">
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
stroke-width="1.5" d="m11.25 4.75l-6.5 6.5m0-6.5l6.5 6.5"/>
</svg>
</div>
&nbsp &nbsp
{% endfor %}
</div>
</div>
<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="AddNewplugin()"
class="btn btn-primary btn-lg">{% trans "Add Plugin Bucket" %}</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,416 @@
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{% trans "Websites Hosted - CyberPanel" %}{% endblock %}
{% block content %}
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
<div style="display: none" id="wordpresshome"></div>
<div style="display: none" id="WPid">{{ wpsite.id }}</div>
<div ng-controller="WPsiteHome" class="container">
<div class="col-sm-12">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-lg-4">
<!-- Product image -->
<a target="_blank" style="border: 1px solid greenyellow"
href="http://{{ wpsite.FinalURL }}" class="text-center d-block mb-4">
<img src="https://cdn.statically.io/screenshot/{{ wpsite.FinalURL }}"
class="img-fluid"
alt="{{ wpsite.FinalURL }}">
</a>
<hr>
<div class="d-lg-flex d-none justify-content-center">
<a href="/websites/{{ wpsite.owner.domain }}">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true"
focusable="false" width="1em" height="1em"
style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32">
<path d="M16 18H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2zM6 6v10h10V6z"
fill="#626262"></path>
<path d="M26 12v4h-4v-4h4m0-2h-4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2z"
fill="#626262"></path>
<path d="M26 22v4h-4v-4h4m0-2h-4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2z"
fill="#626262"></path>
<path d="M16 22v4h-4v-4h4m0-2h-4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2z"
fill="#626262"></path>
</svg>
Manage Application
</a>
<a ng-click="autoUpdateConfigurationsInit()" data-toggle="modal"
data-target="#autoUpdateConfig" style="margin-left: 3%"
href="javascript: void(0);">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true"
focusable="false" width="1em" height="1em"
style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
preserveAspectRatio="xMidYMid meet" viewBox="0 0 20 20">
<path d="M10.2 3.28c3.53 0 6.43 2.61 6.92 6h2.08l-3.5 4l-3.5-4h2.32a4.439 4.439 0 0 0-4.32-3.45c-1.45 0-2.73.71-3.54 1.78L4.95 5.66a6.965 6.965 0 0 1 5.25-2.38zm-.4 13.44c-3.52 0-6.43-2.61-6.92-6H.8l3.5-4c1.17 1.33 2.33 2.67 3.5 4H5.48a4.439 4.439 0 0 0 4.32 3.45c1.45 0 2.73-.71 3.54-1.78l1.71 1.95a6.95 6.95 0 0 1-5.25 2.38z"
fill="#626262"></path>
</svg>
Autoupdate Configurations
</a>
<div id="autoUpdateConfig" class="modal fade" tabindex="-1" role="dialog"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div class="text-center mt-2 mb-4">
</div>
<form>
<h3 style="margin-top: 2%">UPDATES</h3>
<p>Configure setting for automatic updates.</p>
<div class="row">
<h5 class="font-arial">Automatic Updates
(Currently: {{ wpsite.AutoUpdates }})</h5>
<div class="col-12">
<select id="AutomaticUpdates"
class="form-group form-group-default"
style="padding: 10px">
<option>Disabled</option>
<option>Minor and Security Updates</option>
<option>All (minor and major)</option>
</select>
</div>
</div>
<div class="row">
<h5 class="font-arial">Plugins
(Currently: {{ wpsite.PluginUpdates }})</h5>
<div class="col-12">
<select id="Plugins"
class="form-group form-group-default"
style="padding: 10px">
<option>Enabled</option>
<option>Disabled</option>
</select>
</div>
</div>
<div class="row">
<h5 class="font-arial">Themes
(Currently: {{ wpsite.ThemeUpdates }})</h5>
<div class="col-12">
<select id="Themes"
class="form-group form-group-default"
style="padding: 10px">
<option>Enabled</option>
<option>Disabled</option>
</select>
</div>
</div>
<div class="row bg-dark"
style="border-radius: 2%;margin-top: 1%">
<div class="v-align-middle col-12 ">
<button onclick="SaveAutoUpdateSettings()"
aria-label=""
type="button"
class="v-align-middle btn bg-dark col-12"
style="color: white; padding: 15px">
Save Changes <img
class="LPLoader"
style="margin-left: 2%"
src="{% static 'BaseTemplates/images/loader.gif' %}">
</button>
</div>
</div>
</form>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
</div>
</div>
<div class="col-sm-8">
<!-- Product title -->
<h2 style="display: inline" class="mt-0">{{ wpsite.title }}</h2>
<p style="display: inline;">({{ wpsite.path }}) <img ng-hide="wordpresshomeloading"
src="{% static 'images/loading.gif' %}">
</p>
<div class="panel-body">
<div class="example-box-wrapper">
<ul class="nav-responsive nav nav-tabs">
<li class="active"><a href="#tab1" data-toggle="tab"
aria-selected="true">General</a></li>
<li class=""><a href="#tab2" ng-click="GetCurrentPlugins()"
data-toggle="tab">Plugins</a></li>
<li class=""><a href="#tab3" ng-click="GetCurrentThemes()"
data-toggle="tab">Themes</a></li>
<li><a href="#tab4" data-toggle="tab">Staging</a></li>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab1">
<div class="d-lg-flex d-none">
<a target="_blank" href="http://{{ wpsite.FinalURL }}">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
aria-hidden="true" focusable="false" width="1em"
height="1em"
style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 24 24">
<path d="M13 3l3.293 3.293l-7 7l1.414 1.414l7-7L21 11V3z"
fill="#626262"></path>
<path d="M19 19H5V5h7l-2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2h14c1.103 0 2-.897 2-2v-5l-2-2v7z"
fill="#626262"></path>
</svg>
Open
</a>
<a target="_blank"
href="/filemanager/{{ wpsite.owner.domain }}"
style="margin-left: 4%">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
aria-hidden="true" focusable="false" width="1em"
height="1em"
style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 1024 1024">
<path d="M159 768h612.3l103.4-256H262.3z"
fill-opacity=".15"
fill="#626262"/>
<path d="M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 0 0-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12c0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z"
fill="#626262"/>
</svg>
File Manager
</a>
<a ng-click="autoLogin()"
style="margin-left: 4%"
href="javascript: void(0);">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
aria-hidden="true" focusable="false" width="1em"
height="1em"
style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 20 20">
<path d="M14 10L8 5v3H1v4h7v3l6-5zm3 7H9v2h8c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2H9v2h8v14z"
fill="#626262"></path>
</svg>
Login
</a>
<a style="margin-left: 4%" target="_blank"
href="/websites/{{ wpsite.owner.domain}}/manageGIT">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
aria-hidden="true" focusable="false" width="1em"
height="1em"
style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 24 24">
<path d="M17.5 4C15.57 4 14 5.57 14 7.5c0 1.554 1.025 2.859 2.43 3.315c-.146.932-.547 1.7-1.23 2.323c-1.946 1.773-5.527 1.935-7.2 1.907V8.837c1.44-.434 2.5-1.757 2.5-3.337C10.5 3.57 8.93 2 7 2S3.5 3.57 3.5 5.5c0 1.58 1.06 2.903 2.5 3.337v6.326c-1.44.434-2.5 1.757-2.5 3.337C3.5 20.43 5.07 22 7 22s3.5-1.57 3.5-3.5c0-.551-.14-1.065-.367-1.529c2.06-.186 4.657-.757 6.409-2.35c1.097-.997 1.731-2.264 1.904-3.768C19.915 10.438 21 9.1 21 7.5C21 5.57 19.43 4 17.5 4zm-12 1.5C5.5 4.673 6.173 4 7 4s1.5.673 1.5 1.5S7.827 7 7 7s-1.5-.673-1.5-1.5zM7 20c-.827 0-1.5-.673-1.5-1.5a1.5 1.5 0 0 1 1.482-1.498l.13.01A1.495 1.495 0 0 1 7 20zM17.5 9c-.827 0-1.5-.673-1.5-1.5S16.673 6 17.5 6s1.5.673 1.5 1.5S18.327 9 17.5 9z"
fill="#626262"></path>
</svg>
Git Manager
</a>
</div>
<div style="margin-top: 4%">
<div class="row">
<div class="col-md-4">
<h6 class="font-14">WordPress Version</h6>
<p id="WPVersion" class="text-sm lh-150"></p>
</div>
<div class="col-md-4">
<h6 class="font-14">PHP</h6>
<p class="text-sm lh-150">{{ wpsite.owner.phpSelection }}</p>
</div>
<div class="col-md-4">
<h6 class="font-14">LSCache</h6>
<div class="custom-control custom-switch">
<input ng-click="UpdateWPSettings('lscache')"
type="checkbox"
class="custom-control-input ng-pristine ng-untouched ng-valid ng-not-empty"
id="lscache">
<label class="custom-control-label"
for="lscache"></label>
</div>
</div>
</div>
</div>
<div style="margin-top: 4%">
<div class="row">
<div class="col-md-4">
<h6 class="font-14">Debugging</h6>
<div class="custom-control custom-switch">
<input ng-click="UpdateWPSettings('debugging')"
type="checkbox"
class="custom-control-input ng-pristine ng-untouched ng-valid ng-empty"
id="debugging">
<label class="custom-control-label"
for="debugging"></label>
</div>
</div>
<div class="col-md-4">
<h6 class="font-14">Search Engine Indexing</h6>
<div class="custom-control custom-switch">
<input ng-click="UpdateWPSettings('searchIndex')"
type="checkbox"
class="custom-control-input ng-pristine ng-untouched ng-valid ng-not-empty"
id="searchIndex">
<label class="custom-control-label"
for="searchIndex"></label>
</div>
</div>
<div class="col-md-4">
<h6 class="font-14">Maintenance mode</h6>
<div class="custom-control custom-switch">
<input ng-click="UpdateWPSettings('maintenanceMode')"
type="checkbox"
class="custom-control-input ng-pristine ng-untouched ng-valid ng-empty"
id="maintenanceMode">
<label class="custom-control-label"
for="maintenanceMode"></label>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane" id="tab2">
<div class="row mb-2">
<div class="col-sm-8">
<a ng-click="UpdatePlugins('all')"
href="javascript:void(0);"
class="btn btn-sm btn-default">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
aria-hidden="true" focusable="false" width="1em"
height="1em"
style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 24 24">
<path fill="none" stroke="#626262" stroke-width="2"
d="M2.998 7V1H17.5L21 4.5V23h-6m1-22v5h5M8 23A7 7 0 1 0 8 9a7 7 0 0 0 0 14zm-3.5-6.5L8 13l3.5 3.5m-3.5-3V20"></path>
</svg>
Update All</a>
<a ng-click="UpdatePlugins('selected')"
href="javascript:void(0);"
class="btn btn-sm btn-default"> Update
Selected</a>
</div>
<div class="col-sm-4">
<div class="text-sm-right">
<button data-toggle="modal" data-target="#DeleteWebsite"
ng-click="DeletePlugins('selected')"
aria-label=""
class="btn btn-danger btn-icon-left m-b-10"
type="button">Delete Selected
</button>
</div>
</div><!-- end col-->
</div>
<table class="table table-hover mb-0">
<thead>
<tr>
<th>
{% comment %}<div class="custom-control custom-checkbox" style="padding-left: 0px">
<input type="checkbox" id="CheckAll">
<label for="CheckAll"></label>
</div>{% endcomment %}
</th>
<th>Plugin</th>
<th>State</th>
<th>Updates</th>
<th>Version</th>
<th>Delete</th>
</tr>
</thead>
<tbody id="PluginBody">
</tbody>
</table>
</div>
<div class="tab-pane" id="tab3">
<div class="row mb-2">
<div class="col-sm-8">
<a ng-click="UpdateThemes('all')" href="javascript:void(0);"
class="btn btn-sm btn-default">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
aria-hidden="true" focusable="false" width="1em"
height="1em"
style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 24 24">
<path fill="none" stroke="#626262" stroke-width="2"
d="M2.998 7V1H17.5L21 4.5V23h-6m1-22v5h5M8 23A7 7 0 1 0 8 9a7 7 0 0 0 0 14zm-3.5-6.5L8 13l3.5 3.5m-3.5-3V20"></path>
</svg>
Update All</a>
<a ng-click="UpdateThemes('selected')"
href="javascript:void(0);"
class="btn btn-sm btn-default"> Update
Selected</a>
</div>
<div class="col-sm-4">
<div class="text-sm-right">
<button data-toggle="modal" data-target="#DeleteWebsite"
ng-click="DeleteThemes('selected')"
aria-label=""
class="btn btn-danger btn-icon-left m-b-10"
type="button">Delete
Selected
</button>
</div>
</div><!-- end col-->
</div>
<table class="table table-hover mb-0">
<thead>
<tr>
<th>
{% comment %}<div class="custom-control custom-checkbox" style="padding-left: 0px">
<input type="checkbox" id="CheckAll">
<label for="CheckAll"></label>
</div>{% endcomment %}
</th>
<th>Theme</th>
<th>State</th>
<th>Updates</th>
<th>Version</th>
<th>Delete</th>
</tr>
</thead>
<tbody id="ThemeBody">
</tbody>
</table>
</div>
<div class="tab-pane" id="tab4">
<p>Howdy, I'm in Section 4.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,95 @@
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{% trans "Websites Hosted - CyberPanel" %}{% endblock %}
{% block content %}
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
<script>
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
});
</script>
<div ng-controller="listWebsites" class="container">
<div id="page-title">
<h2 id="domainNamePage">{% trans "List WordPress Websites" %}
<a class="pull-right btn btn-primary" href="{% url "createWordpress" %}">{% trans "Create WordPress Website" %}</a>
</h2>
<img ng-hide="cyberPanelLoading" src="{% static 'images/loading.gif' %}">
<p>{% trans "On this page you can launch, list, modify and delete websites from your server." %}</p>
</div>
<table class="table table-hover dataTable no-footer" id="basicTable" role="grid">
<thead style="background-color: #0a6ebd">
<tr role="row" class="plans-head">
<th style="color: #fff0ff" class="sorting_desc" tabindex="0"
aria-controls="basicTable" rowspan="1" colspan="1"
aria-sort="descending"
aria-label="Title: activate to sort column ascending">ID
</th>
<th style="color: #fff0ff" class="sorting" tabindex="0"
aria-controls="basicTable" rowspan="1" colspan="1"
aria-label="Places: activate to sort column ascending">WordPress Site Title
</th>
<th style="color: #fff0ff" class="sorting" tabindex="0"
aria-controls="basicTable" rowspan="1" colspan="1"
aria-label="Places: activate to sort column ascending">URL
</th>
<th style="color: #fff0ff" class="sorting" tabindex="0"
aria-controls="basicTable" rowspan="1" colspan="1"
aria-label="Places: activate to sort column ascending">Action
</th>
</tr>
</thead>
<tbody>
{% for sub in wpsite %}
<tr role="row" class="odd">
<td class="v-align-middle sorting_1">
<p>{{ sub.id }}</p>
</td>
<td class="v-align-middle sorting_1">
<a href="{% url 'WPHome'%}?ID={{sub.id}}">
<p>{{ sub.title }}</p>
</a>
</td>
<td class="v-align-middle">
<p>{{ sub.url }}</p>
</td>
<td class="row">
<button
data-toggle="modal"
data-target="#DeleteMember" aria-label=""
type="button" class="btn btn-border btn-alt border-red btn-link font-red">
Delete
</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}

View File

@ -41,234 +41,223 @@
style="padding: 0px; box-shadow: 0px 0px 1px 0px #888888;">
<div class="">
<div class="table-responsive no-gutter text-nowrap" style="overflow-x: hidden;">
<div style="background-image: url('https://cdn.statically.io/screenshot/{$ web.domain $}?fullPage=true');;
height: 160px;
width: 200px;
background-position: top;
background-repeat: no-repeat;
background-size: cover;
position: relative;" class="col-lg-3 col-md-12">
<div style="border-bottom: 1px solid #888888" class="col-md-12">
<div class="col-lg-10 content-box-header" style="text-transform: none;">
<a href="http://{$ web.domain $}" target="_blank" title="Visit Site">
<h2 style="display: inline; color: #414C59;" ng-bind="web.domain"></h2>
</a>
<a target="_blank" href="/filemanager/{$ web.masterDomain $}" title="Open File Manager">
--
File Manager</a>
</div>
<div class="col-md-2 content-box-header" style="text-transform: none;">
<a href="/websites/{$ web.masterDomain $}/{$ web.domain $}" target="_blank"
title="Manage Website">
<i class="p fa fa-external-link btn-icon">&emsp;</i>
<span>Manage</span>
</a>
</div>
</div>
<div class="col-lg-9" style="text-transform: none">
<div style="border-bottom: 1px solid #888888" class="col-md-12">
<div class="col-lg-10 content-box-header" style="text-transform: none;">
<a href="http://{$ web.domain $}" target="_blank" title="Visit Site">
<h2 style="display: inline; color: #414C59;" ng-bind="web.domain"></h2>
</a>
<a target="_blank" href="/filemanager/{$ web.masterDomain $}" title="Open File Manager">
--
File Manager</a>
</div>
<div class="col-md-2 content-box-header" style="text-transform: none;">
<a href="/websites/{$ web.masterDomain $}/{$ web.domain $}" target="_blank"
title="Manage Website">
<i class="p fa fa-external-link btn-icon">&emsp;</i>
<span>Manage</span>
</a>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4 content-box-header">
<i class="p fa fa-trash-o btn-icon text-muted" data-toggle="tooltip"
data-placement="right"
title="Delete Child Domain">&emsp;</i>
<span><a ng-click='deleteDomainInit(web.domain)' data-toggle="modal" data-target="#DeleteChild" href=""
style="text-transform: none">Delete</a></span>
<div id="DeleteChild" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;
</button>
<h4 class="modal-title">Delete Child Domain
<img ng-hide="$parent.cyberPanelLoading"
src="/static/images/loading.gif"
style="display: none;">
</h4>
</div>
<div class="modal-body">
<form name="DeleteDocumentRootForm" action="/" class="form-horizontal">
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-2 control-label">{% trans "" %}</label>
<div class="col-sm-8">
<input ng-model="$parent.DeleteDocRoot" type="checkbox" value="">
Delete Document Root
</div>
<div class="col-md-12">
<div class="col-md-4 content-box-header">
<i class="p fa fa-trash-o btn-icon text-muted" data-toggle="tooltip"
data-placement="right"
title="Delete Child Domain">&emsp;</i>
<span><a ng-click='deleteDomainInit(web.domain)' data-toggle="modal" data-target="#DeleteChild" href=""
style="text-transform: none">Delete</a></span>
<div id="DeleteChild" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;
</button>
<h4 class="modal-title">Delete Child Domain
<img ng-hide="$parent.cyberPanelLoading"
src="/static/images/loading.gif"
style="display: none;">
</h4>
</div>
<div class="modal-body">
<form name="DeleteDocumentRootForm" action="/" class="form-horizontal">
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-2 control-label">{% trans "" %}</label>
<div class="col-sm-8">
<input ng-model="$parent.DeleteDocRoot" type="checkbox" value="">
Delete Document Root
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary"
ng-click="deleteChildDomain()">Delete Now
</button>
<button type="button" ng-disabled="savingSettings"
class="btn btn-default" data-dismiss="modal">
Close
</button>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary"
ng-click="deleteChildDomain()">Delete Now
</button>
<button type="button" ng-disabled="savingSettings"
class="btn btn-default" data-dismiss="modal">
Close
</button>
</div>
</div>
</div>
</div>
<div class="col-md-4 content-box-header">
<i class="p fa fa-map-marker btn-icon text-muted" data-toggle="tooltip"
data-placement="right" title="IP Address">&emsp;</i>
<span ng-bind="web.ipAddress"></span>
</div>
<div class="col-md-4 content-box-header">
<i class="p fa fa-lock btn-icon text-muted" data-toggle="tooltip" data-placement="right"
title="SSL">&emsp;</i>
<span><a ng-click="issueSSL(web.domain)" href=""
style="text-transform: none">Issue SSL</a></span>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4 content-box-header">
<i class="p fa fa-map-marker btn-icon text-muted" data-toggle="tooltip"
data-placement="right" title="IP Address">&emsp;</i>
<span ng-bind="web.ipAddress"></span>
</div>
<div class="col-md-4 content-box-header">
<i class="p fa fa-lock btn-icon text-muted" data-toggle="tooltip" data-placement="right"
title="SSL">&emsp;</i>
<span><a ng-click="issueSSL(web.domain)" href=""
style="text-transform: none">Issue SSL</a></span>
</div>
</div>
<div class="col-md-4 content-box-header">
<i class="p fa fa-cubes btn-icon text-muted" data-toggle="tooltip"
data-placement="right"
title="Packages">&emsp;</i>
<span ng-bind="web.package" style="text-transform: none"></span>
</div>
<div class="col-md-4 content-box-header">
<i class="p fa fa-user btn-icon text-muted" data-toggle="tooltip" data-placement="right"
title="Owner">&emsp;</i>
<span ng-bind="web.admin" style="text-transform: none"></span>
</div>
<div class="col-md-12">
<div class="col-md-4 content-box-header">
<i class="p fa fa-cubes btn-icon text-muted" data-toggle="tooltip"
data-placement="right"
title="Packages">&emsp;</i>
<span ng-bind="web.package" style="text-transform: none"></span>
</div>
<div class="col-md-4 content-box-header">
<i class="p fa fa-user btn-icon text-muted" data-toggle="tooltip" data-placement="right"
title="Owner">&emsp;</i>
<span ng-bind="web.admin" style="text-transform: none"></span>
</div>
<div class="col-md-4 content-box-header">
<i class="p fa fa-arrows-h btn-icon text-muted" data-toggle="tooltip"
data-placement="right"
title="Convert to Website">&emsp;</i>
<span><a data-toggle="modal" data-target="#settings" href=""
style="text-transform: none" ng-click="initConvert(web.domain)">Convert to Website</a></span>
<div id="settings" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="col-md-4 content-box-header">
<i class="p fa fa-arrows-h btn-icon text-muted" data-toggle="tooltip"
data-placement="right"
title="Convert to Website">&emsp;</i>
<span><a data-toggle="modal" data-target="#settings" href=""
style="text-transform: none" ng-click="initConvert(web.domain)">Convert to Website</a></span>
<div id="settings" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;
</button>
<h4 class="modal-title">Convert Child Domain to normal Website
<img ng-hide="$parent.cyberPanelLoading"
src="/static/images/loading.gif"
style="display: none;">
</h4>
</div>
<div class="modal-body">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;
</button>
<h4 class="modal-title">Convert Child Domain to normal Website
<img ng-hide="$parent.cyberPanelLoading"
src="/static/images/loading.gif"
style="display: none;">
</h4>
</div>
<div class="modal-body">
<form name="containerSettingsForm" action="/" class="form-horizontal">
<form name="containerSettingsForm" action="/" class="form-horizontal">
<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="domainName"
placeholder="{% trans "Do not enter WWW, it will be auto created!" %}"
readonly>
</div>
<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="domainName"
placeholder="{% trans "Do not enter WWW, it will be auto created!" %}"
readonly>
</div>
</div>
<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="$parent.websiteOwner"
class="form-control">
{% for items in owernList %}
<option>{{ items }}</option>
{% endfor %}
</select>
</div>
<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="$parent.websiteOwner"
class="form-control">
{% for items in owernList %}
<option>{{ items }}</option>
{% endfor %}
</select>
</div>
</div>
<hr ng-hide="installationDetailsForm">
<hr ng-hide="installationDetailsForm">
<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="$parent.packageForWebsite"
class="form-control">
{% for items in packageList %}
<option>{{ items }}</option>
{% endfor %}
</select>
</div>
<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="$parent.packageForWebsite"
class="form-control">
{% for items in packageList %}
<option>{{ items }}</option>
{% endfor %}
</select>
</div>
</div>
<hr ng-hide="installationDetailsForm">
<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="$parent.adminEmail" required>
</div>
<hr ng-hide="installationDetailsForm">
<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="$parent.adminEmail" required>
</div>
</div>
<hr ng-hide="installationDetailsForm">
<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="$parent.phpSelection"
class="form-control">
{% for php in phps %}
<option>{{ php }}</option>
{% endfor %}
</select>
</div>
<hr ng-hide="installationDetailsForm">
<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="$parent.phpSelection"
class="form-control">
{% for php in phps %}
<option>{{ php }}</option>
{% endfor %}
</select>
</div>
</div>
<div ng-hide="installationProgress" class="form-group">
<label class="col-sm-1 control-label"></label>
<div class="col-sm-10">
<div ng-hide="installationProgress" class="form-group">
<label class="col-sm-1 control-label"></label>
<div class="col-sm-10">
<div class="alert alert-success text-center">
<h2>{$ currentStatus $}</h2>
<div class="alert alert-success text-center">
<h2>{$ currentStatus $}</h2>
</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 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>
</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">{% trans "Go Back" %}</button>
</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">{% trans "Go Back" %}</button>
</div>
</div>
</form>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary"
ng-click="convert()">Convert
</button>
<button type="button" ng-disabled="savingSettings"
class="btn btn-default" data-dismiss="modal">
Close
</button>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary"
ng-click="convert()">Convert
</button>
<button type="button" ng-disabled="savingSettings"
class="btn btn-default" data-dismiss="modal">
Close
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="listFail" class="alert alert-danger">

View File

@ -43,71 +43,62 @@
style="padding: 0px; box-shadow: 0px 0px 1px 0px #888888;">
<div class="">
<div class="table-responsive no-gutter text-nowrap" style="overflow-x: hidden;">
<div style="background-image: url('https://cdn.statically.io/screenshot/{$ web.domain $}?fullPage=true');
height: 160px;
width: 200px;
background-position: top;
background-repeat: no-repeat;
background-size: cover;
position: relative;"
class="col-lg-3 col-md-12">
<div style="border-bottom: 1px solid #888888" class="col-md-12">
<div class="col-lg-10 content-box-header" style="text-transform: none;">
<a href="http://{$ web.domain $}" target="_blank" title="Visit Site">
<h2 style="display: inline; color: #414C59;" ng-bind="web.domain"></h2>
</a>
<a target="_self" href="/filemanager/{$ web.domain $}" title="Open File Manager"> --
{% trans "File Manager" %}</a>
</div>
<div class="col-md-2 content-box-header" style="text-transform: none;">
<a href="/websites/{$ web.domain $}" target="_self" title="Manage Website">
<i class="p fa fa-external-link btn-icon">&emsp;</i>
<span>{% trans "Manage" %}</span>
</a>
</div>
</div>
<div class="col-lg-9" style="text-transform: none">
<div style="border-bottom: 1px solid #888888" class="col-md-12">
<div class="col-lg-10 content-box-header" style="text-transform: none;">
<a href="http://{$ web.domain $}" target="_blank" title="Visit Site">
<h2 style="display: inline; color: #414C59;" ng-bind="web.domain"></h2>
</a>
<a target="_self" href="/filemanager/{$ web.domain $}" title="Open File Manager"> --
{% trans "File Manager" %}</a>
</div>
<div class="col-md-2 content-box-header" style="text-transform: none;">
<a href="/websites/{$ web.domain $}" target="_self" title="Manage Website">
<i class="p fa fa-external-link btn-icon">&emsp;</i>
<span>{% trans "Manage" %}</span>
</a>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4 content-box-header">
<i class="p fa fa-sticky-note btn-icon text-muted" data-toggle="tooltip"
data-placement="right" title="State">&emsp;</i>
<span ng-bind="web.state" style="text-transform: none"></span>
</div>
<div class="col-md-4 content-box-header">
<i class="p fa fa-map-marker btn-icon text-muted" data-toggle="tooltip"
data-placement="right" title="IP Address">&emsp;</i>
<span ng-bind="web.ipAddress"></span>
</div>
<div class="col-md-4 content-box-header">
<i class="p fa fa-lock btn-icon text-muted" data-toggle="tooltip" data-placement="right"
title="SSL">&emsp;</i>
<span><a ng-click="issueSSL(web.domain)" href=""
style="text-transform: none">{% trans "Issue SSL" %}</a></span>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4 content-box-header">
<i class="p fa fa-hdd-o btn-icon text-muted" data-toggle="tooltip"
data-placement="right"
title="Disk Usage">&emsp;</i>
<span ng-bind="web.diskUsed" style="text-transform: none"></span>
</div>
<div class="col-md-4 content-box-header">
<i class="p fa fa-cubes btn-icon text-muted" data-toggle="tooltip"
data-placement="right"
title="Packages">&emsp;</i>
<span ng-bind="web.package" style="text-transform: none"></span>
</div>
<div class="col-md-4 content-box-header">
<i class="p fa fa-user btn-icon text-muted" data-toggle="tooltip" data-placement="right"
title="Owner">&emsp;</i>
<span ng-bind="web.admin" style="text-transform: none"></span>
</div>
<div class="col-md-12">
<div class="col-md-4 content-box-header">
<i class="p fa fa-sticky-note btn-icon text-muted" data-toggle="tooltip"
data-placement="right" title="State">&emsp;</i>
<span ng-bind="web.state" style="text-transform: none"></span>
</div>
<div class="col-md-4 content-box-header">
<i class="p fa fa-map-marker btn-icon text-muted" data-toggle="tooltip"
data-placement="right" title="IP Address">&emsp;</i>
<span ng-bind="web.ipAddress"></span>
</div>
<div class="col-md-4 content-box-header">
<i class="p fa fa-lock btn-icon text-muted" data-toggle="tooltip" data-placement="right"
title="SSL">&emsp;</i>
<span><a ng-click="issueSSL(web.domain)" href=""
style="text-transform: none">{% trans "Issue SSL" %}</a></span>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4 content-box-header">
<i class="p fa fa-hdd-o btn-icon text-muted" data-toggle="tooltip"
data-placement="right"
title="Disk Usage">&emsp;</i>
<span ng-bind="web.diskUsed" style="text-transform: none"></span>
</div>
<div class="col-md-4 content-box-header">
<i class="p fa fa-cubes btn-icon text-muted" data-toggle="tooltip"
data-placement="right"
title="Packages">&emsp;</i>
<span ng-bind="web.package" style="text-transform: none"></span>
</div>
<div class="col-md-4 content-box-header">
<i class="p fa fa-user btn-icon text-muted" data-toggle="tooltip" data-placement="right"
title="Owner">&emsp;</i>
<span ng-bind="web.admin" style="text-transform: none"></span>
</div>
</div>
<!--table cellpadding="0" cellspacing="0" border="0" class="table" style="margin:0px 0px; id="datatable-example">
<thead>
<tr>
@ -130,8 +121,6 @@
</tbody>
</table-->
</div>
<div id="listFail" class="alert alert-danger">
<p>{% trans "Cannot list websites. Error message:" %} {$ errorMessage $}</p>
</div>

View File

@ -16,6 +16,42 @@ urlpatterns = [
url(r'^CreateNewDomain$', views.CreateNewDomain, name='CreateNewDomain'),
### WordPress
url(r'^createWordpress$', views.WPCreate, name='createWordpress'),
url(r'^ListWPSites$', views.ListWPSites, name='ListWPSites'),
url(r'^WPHome$', views.WPHome, name='WPHome'),
url(r'^AutoLogin$', views.AutoLogin, name='AutoLogin'),
###WordPress Ajax
url(r'^submitWorpressCreation', views.submitWorpressCreation, name='submitWorpressCreation'),
url(r'^FetchWPdata', views.FetchWPdata, name='FetchWPdata'),
url(r'^GetCurrentPlugins', views.GetCurrentPlugins, name='GetCurrentPlugins'),
url(r'^GetCurrentThemes', views.GetCurrentThemes, name='GetCurrentThemes'),
url(r'^UpdateWPSettings', views.UpdateWPSettings, name='UpdateWPSettings'),
url(r'^UpdatePlugins', views.UpdatePlugins, name='UpdatePlugins'),
url(r'^DeletePlugins', views.DeletePlugins, name='DeletePlugins'),
url(r'^ChangeStatus', views.ChangeStatus, name='ChangeStatus'),
url(r'^UpdateThemes', views.UpdateThemes, name='UpdateThemes'),
url(r'^DeleteThemes', views.DeleteThemes, name='DeleteThemes'),
url(r'^StatusThemes', views.StatusThemes, name='StatusThemes'),
#### AddPlugin
url(r'^ConfigurePlugins$', views.ConfigurePlugins, name='ConfigurePlugins'),
url(r'^Addnewplugin$', views.Addnewplugin, name='Addnewplugin'),
url(r'^EidtPlugin$', views.EidtPlugin, name='EidtPlugin'),
## AddPlugin Ajax
url(r'^SearchOnkeyupPlugin$', views.SearchOnkeyupPlugin, name='SearchOnkeyupPlugin'),
url(r'^AddNewpluginAjax$', views.AddNewpluginAjax, name='AddNewpluginAjax'),
url(r'^deletesPlgin', views.deletesPlgin, name='deletesPlgin'),
url(r'^Addplugineidt', views.Addplugineidt, name='Addplugineidt'),
# Website modification url

View File

@ -6,8 +6,11 @@ from django.http import HttpResponse
from loginSystem.models import Administrator
from loginSystem.views import loadLoginPage
import json
import plogical.CyberCPLogFileWriter as logging
from plogical.httpProc import httpProc
from websiteFunctions.models import wpplugins
from websiteFunctions.website import WebsiteManager
from websiteFunctions.pluginManager import pluginManager
from django.views.decorators.csrf import csrf_exempt
@ -26,6 +29,408 @@ def createWebsite(request):
return wm.createWebsite(request, userID)
except KeyError:
return redirect(loadLoginPage)
def WPCreate(request):
try:
userID = request.session['userID']
wm = WebsiteManager()
return wm.WPCreate(request, userID)
except KeyError:
return redirect(loadLoginPage)
def ListWPSites(request):
try:
userID = request.session['userID']
wm = WebsiteManager()
return wm.ListWPSites(request, userID)
except KeyError:
return redirect(loadLoginPage)
def WPHome(request):
try:
userID = request.session['userID']
WPid = request.GET.get('ID')
wm = WebsiteManager()
return wm.WPHome(request, userID, WPid)
except KeyError:
return redirect(loadLoginPage)
def AutoLogin(request):
try:
userID = request.session['userID']
WPid = request.GET.get('ID')
wm = WebsiteManager()
return wm.AutoLogin(request, userID, WPid)
except KeyError:
return redirect(loadLoginPage)
def ConfigurePlugins(request):
try:
userID = request.session['userID']
userobj = Administrator.objects.get(pk=userID)
DeleteFileID = request.GET.get('delete', None)
if DeleteFileID != None:
try:
jobobj = wpplugins.objects.get(pk=DeleteFileID, owner=userobj)
jobobj.delete()
Deleted = 1
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile("DeleteFileID ....... %s....msg.....%s" % (DeleteFileID,msg))
Deleted = 0
wm = WebsiteManager()
return wm.ConfigurePlugins(request, userID)
except KeyError:
return redirect(loadLoginPage)
def Addnewplugin(request):
try:
userID = request.session['userID']
wm = WebsiteManager()
return wm.Addnewplugin(request, userID)
except KeyError:
return redirect(loadLoginPage)
def SearchOnkeyupPlugin(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.SearchOnkeyupPlugin(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def AddNewpluginAjax(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.AddNewpluginAjax(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def EidtPlugin(request):
try:
userID = request.session['userID']
pluginbID = request.GET.get('ID')
wm = WebsiteManager()
return wm.EidtPlugin(request, userID, pluginbID)
except KeyError:
return redirect(loadLoginPage)
def deletesPlgin(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.deletesPlgin(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def Addplugineidt(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.Addplugineidt(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def submitWorpressCreation(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.submitWorpressCreation(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def FetchWPdata(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.FetchWPdata(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def GetCurrentPlugins(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.GetCurrentPlugins(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def GetCurrentThemes(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.GetCurrentThemes(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def UpdateWPSettings(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.UpdateWPSettings(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def UpdatePlugins(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.UpdatePlugins(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def UpdateThemes(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.UpdateThemes(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def DeletePlugins(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.DeletePlugins(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def DeleteThemes(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.DeleteThemes(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def ChangeStatus(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.ChangeStatus(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def StatusThemes(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.ChangeStatusThemes(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def modifyWebsite(request):
try:

View File

@ -12,7 +12,7 @@ django.setup()
import json
from plogical.acl import ACLManager
import plogical.CyberCPLogFileWriter as logging
from websiteFunctions.models import Websites, ChildDomains, GitLogs
from websiteFunctions.models import Websites, ChildDomains, GitLogs, wpplugins, WPSites
from plogical.virtualHostUtilities import virtualHostUtilities
import subprocess
import shlex
@ -59,6 +59,262 @@ class WebsiteManager:
Data, 'createWebsite')
return proc.render()
def WPCreate(self, request=None, userID=None, data=None):
currentACL = ACLManager.loadedACL(userID)
adminNames = ACLManager.loadAllUsers(userID)
packagesName = ACLManager.loadPackages(userID, currentACL)
phps = PHPManager.findPHPVersions()
FinalVersions = []
#logging.CyberCPLogFileWriter.writeToFile("jassssssssss...............")
userobj = Administrator.objects.get(pk=userID)
counter = 0
try:
import requests
WPVersions = json.loads(requests.get('https://api.wordpress.org/core/version-check/1.7/').text)['offers']
for versions in WPVersions:
if counter == 7:
break
if versions['current'] not in FinalVersions:
FinalVersions.append(versions['current'])
counter = counter + 1
except:
FinalVersions = ['5.6', '5.5.3', '5.5.2']
Plugins = wpplugins.objects.filter(owner=userobj)
# logging.CyberCPLogFileWriter.writeToFile("FinalVersions:%s"+str(FinalVersions))
Data = {'packageList': packagesName, "owernList": adminNames, 'WPVersions': FinalVersions, 'Plugins': Plugins }
proc = httpProc(request, 'websiteFunctions/WPCreate.html',
Data, 'createWebsite')
return proc.render()
def ListWPSites(self, request=None, userID=None, data=None):
currentACL = ACLManager.loadedACL(userID)
userobj = Administrator.objects.get(pk=userID)
webobjs = Websites.objects.all()
tata = {}
tata['wp']=[]
tata['wpsites']=[]
tata['wp'] = WPSites.objects.all()
for sub in tata['wp']:
tata['wpsites'].append({'id': sub.id,
'title': sub.title,
'url': sub.FinalURL
})
proc = httpProc(request, 'websiteFunctions/WPsitesList.html',
{"wpsite": tata['wpsites']})
return proc.render()
def WPHome(self, request=None, userID=None, WPid=None):
Data = {}
currentACL = ACLManager.loadedACL(userID)
WPobj = WPSites.objects.get(pk=WPid)
Data['wpsite'] = WPobj
proc = httpProc(request, 'websiteFunctions/WPsiteHome.html',
Data, 'createWebsite')
return proc.render()
def AutoLogin(self, request=None, userID=None, WPid=None):
pass
# data = {}
# currentACL = ACLManager.loadedACL(userID)
# WPobj = WPSites.objects.get(pk=WPid)
#
# data['wpsite'] = WPobj
#
# if data['wpsite'].FinalURL.endswith('/'):
# FinalURL = data['wpsite'].FinalURL[:-1]
# else:
# FinalURL = data['wpsite'].FinalURL
#
# data['url'] = 'https://%s' % (FinalURL)
# data['userName'] = 'autologin'
# data['password'] = message
#
# proc = httpProc(request, 'websiteFunctions/WPsiteHome.html',
# Data, 'createWebsite')
# return proc.render()
def ConfigurePlugins(self, request=None, userID=None, data=None):
DataPass ={}
currentACL = ACLManager.loadedACL(userID)
adminNames = ACLManager.loadAllUsers(userID)
packagesName = ACLManager.loadPackages(userID, currentACL)
phps = PHPManager.findPHPVersions()
userobj = Administrator.objects.get(pk=userID)
Selectedplugins = wpplugins.objects.filter(owner = userobj)
#data['Selectedplugins'] = wpplugins.objects.filter(ProjectOwner=HostingCompany)
Data = {'packageList': packagesName, "owernList": adminNames, 'phps': phps, 'Selectedplugins' : Selectedplugins,}
proc = httpProc(request, 'websiteFunctions/WPConfigurePlugins.html',
Data, 'createWebsite')
return proc.render()
def Addnewplugin(self, request=None, userID=None, data=None):
currentACL = ACLManager.loadedACL(userID)
adminNames = ACLManager.loadAllUsers(userID)
packagesName = ACLManager.loadPackages(userID, currentACL)
phps = PHPManager.findPHPVersions()
Data = {'packageList': packagesName, "owernList": adminNames, 'phps': phps}
proc = httpProc(request, 'websiteFunctions/WPAddNewPlugin.html',
Data, 'createWebsite')
return proc.render()
def SearchOnkeyupPlugin(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
pluginname = data['pluginname']
# logging.CyberCPLogFileWriter.writeToFile("Plugin Name ....... %s"%pluginname)
url = "http://api.wordpress.org/plugins/info/1.1/?action=query_plugins&request[search]=%s" % str(pluginname)
import requests
res = requests.get(url)
r = res.json()
# return proc.ajax(1, 'Done', {'plugins': r})
data_ret = {'status': 1,'plugns': r,}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'createWebSiteStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def AddNewpluginAjax(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
userobj = Administrator.objects.get(pk=userID)
config = data['config']
Name = data['Name']
# pluginname = data['pluginname']
# logging.CyberCPLogFileWriter.writeToFile("config ....... %s"%config)
# logging.CyberCPLogFileWriter.writeToFile(" Name ....... %s"%Name)
addpl = wpplugins(Name=Name, config=json.dumps(config), owner=userobj)
addpl.save()
data_ret = {'status': 1}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'AddNewpluginAjax': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def EidtPlugin(self,request=None, userID=None, pluginbID=None):
Data ={}
currentACL = ACLManager.loadedACL(userID)
pluginobj = wpplugins.objects.get(pk=pluginbID)
lmo = json.loads(pluginobj.config)
Data['Selectedplugins'] = lmo
Data['pluginbID'] = pluginbID
proc = httpProc(request, 'websiteFunctions/WPEidtPlugin.html',
Data, 'createWebsite')
return proc.render()
def deletesPlgin(self, userID=None, data=None,):
try:
currentACL = ACLManager.loadedACL(userID)
userobj = Administrator.objects.get(pk=userID)
pluginname = data['pluginname']
pluginbBucketID = data['pluginbBucketID']
# logging.CyberCPLogFileWriter.writeToFile("pluginbID ....... %s" % pluginbBucketID)
# logging.CyberCPLogFileWriter.writeToFile("pluginname ....... %s" % pluginname)
obj = wpplugins.objects.get(pk=pluginbBucketID, owner=userobj)
ab = []
ab = json.loads(obj.config)
ab.remove(pluginname)
obj.config = json.dumps(ab)
obj.save()
data_ret = {'status': 1}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'deletesPlgin': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def Addplugineidt(self, userID=None, data=None,):
try:
currentACL = ACLManager.loadedACL(userID)
userobj = Administrator.objects.get(pk=userID)
pluginname = data['pluginname']
pluginbBucketID = data['pluginbBucketID']
#logging.CyberCPLogFileWriter.writeToFile("pluginbID ....... %s" % pluginbBucketID)
#logging.CyberCPLogFileWriter.writeToFile("pluginname ....... %s" % pluginname)
pObj = wpplugins.objects.get(pk=pluginbBucketID, owner=userobj)
listofplugin = json.loads(pObj.config)
try:
index = listofplugin.index(pluginname)
print('index.....%s' % index)
if (index >= 0):
data_ret = {'status': 0, 'deletesPlgin': 0, 'error_message': str('Already Save in your Plugin lis')}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except:
ab = []
ab = json.loads(pObj.config)
ab.append(pluginname)
pObj.config = json.dumps(ab)
pObj.save()
data_ret = {'status': 1}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'deletesPlgin': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def modifyWebsite(self, request=None, userID=None, data=None):
currentACL = ACLManager.loadedACL(userID)
@ -144,6 +400,578 @@ class WebsiteManager:
})
return proc.render()
def FetchWPdata(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion)
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)
version = ProcessUtilities.outputExecutioner(command)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin status litespeed-cache --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, path)
lscachee = ProcessUtilities.outputExecutioner(command)
if lscachee.find('Status: Active') > -1:
lscache = 1
else:
lscache = 0
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config list --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, path)
stdout = ProcessUtilities.outputExecutioner(command)
debugging = 0
for items in stdout.split('\n'):
if items.find('WP_DEBUG true constant') > -1:
debugging = 1
break
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp option get blog_public --skip-plugins --skip-themes --path=%s' %(Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
searchindex = int(stdoutput.splitlines()[-1])
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp maintenance-mode status --skip-plugins --skip-themes --path=%s' %(Vhuser, FinalPHPPath, path)
maintenanceMod = ProcessUtilities.outputExecutioner(command)
result = maintenanceMod.splitlines()[-1]
if result.find('not active') > -1:
maintenanceMode = 0
else:
maintenanceMode = 1
fb ={
'version': version.rstrip('\n'),
'lscache': lscache,
'debugging': debugging,
'searchIndex': searchindex,
'maintenanceMode': maintenanceMode
}
data_ret = {'status': 1, 'error_message': 'None', 'ret_data':fb}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def GetCurrentPlugins(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin list --skip-plugins --skip-themes --format=json --path=%s' % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
json_data = stdoutput.splitlines()[-1]
data_ret = {'status': 1, 'error_message': 'None', 'plugins': json_data}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def GetCurrentThemes(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme list --skip-plugins --skip-themes --format=json --path=%s' % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
json_data = stdoutput.splitlines()[-1]
data_ret = {'status': 1, 'error_message': 'None', 'themes': json_data}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def UpdatePlugins(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
plugin = data['plugin']
pluginarray = data['pluginarray']
wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
extraArgs = {}
extraArgs['adminID'] = admin.pk
extraArgs['plugin'] = plugin
extraArgs['pluginarray'] = pluginarray
extraArgs['FinalPHPPath'] = FinalPHPPath
extraArgs['path'] = path
extraArgs['Vhuser'] = Vhuser
background = ApplicationInstaller('UpdateWPPlugin', extraArgs)
background.start()
time.sleep(2)
data_ret = {'status': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def UpdateThemes(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
Theme = data['Theme']
Themearray = data['Themearray']
wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
extraArgs = {}
extraArgs['adminID'] = admin.pk
extraArgs['Theme'] = Theme
extraArgs['Themearray'] = Themearray
extraArgs['FinalPHPPath'] = FinalPHPPath
extraArgs['path'] = path
extraArgs['Vhuser'] = Vhuser
background = ApplicationInstaller('UpdateWPTheme', extraArgs)
background.start()
time.sleep(2)
data_ret = {'status': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def DeletePlugins(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
plugin = data['plugin']
pluginarray = data['pluginarray']
wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
extraArgs = {}
extraArgs['adminID'] = admin.pk
extraArgs['plugin'] = plugin
extraArgs['pluginarray'] = pluginarray
extraArgs['FinalPHPPath'] = FinalPHPPath
extraArgs['path'] = path
extraArgs['Vhuser'] = Vhuser
background = ApplicationInstaller('DeletePlugins', extraArgs)
background.start()
time.sleep(2)
data_ret = {'status': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def DeleteThemes(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
Theme = data['Theme']
Themearray = data['Themearray']
wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
extraArgs = {}
extraArgs['adminID'] = admin.pk
extraArgs['Theme'] = Theme
extraArgs['Themearray'] = Themearray
extraArgs['FinalPHPPath'] = FinalPHPPath
extraArgs['path'] = path
extraArgs['Vhuser'] = Vhuser
background = ApplicationInstaller('DeleteThemes', extraArgs)
background.start()
data_ret = {'status': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def ChangeStatus(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
plugin = data['plugin']
wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin status %s --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, plugin, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
if stdoutput.find('Status: Active') > -1:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin deactivate %s --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, plugin, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
time.sleep(3)
else:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin activate %s --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, plugin, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
time.sleep(3)
data_ret = {'status': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def ChangeStatusThemes(self, userID=None, data=None):
try:
# logging.CyberCPLogFileWriter.writeToFile("Error WP ChangeStatusThemes ....... %s")
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
Theme = data['theme']
wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
extraArgs = {}
extraArgs['adminID'] = admin.pk
extraArgs['Theme'] = Theme
extraArgs['FinalPHPPath'] = FinalPHPPath
extraArgs['path'] = path
extraArgs['Vhuser'] = Vhuser
background = ApplicationInstaller('ChangeStatusThemes', extraArgs)
background.start()
data_ret = {'status': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def UpdateWPSettings(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
setting = data['setting']
settingValue = data['settingValue']
wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
if setting == 'lscache':
if settingValue:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin install litespeed-cache --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin activate litespeed-cache --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
else:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin deactivate litespeed-cache --path=%s --skip-plugins --skip-themes' % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
elif setting == 'debugging':
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp litespeed-purge all --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
if settingValue:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp config set WP_DEBUG true --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
logging.CyberCPLogFileWriter.writeToFile("Debugging mk true 1 output:" + str(stdoutput))
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config list --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, path)
stdout = ProcessUtilities.outputExecutioner(command)
logging.CyberCPLogFileWriter.writeToFile("Debugging output:" + str(stdout))
else:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp config set WP_DEBUG false --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
logging.CyberCPLogFileWriter.writeToFile("Debugging mk false 0 output:" + str(stdoutput))
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config list --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, path)
stdout = ProcessUtilities.outputExecutioner(command)
logging.CyberCPLogFileWriter.writeToFile("Debugging output:" + str(stdout))
elif setting == 'searchIndex':
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp litespeed-purge all --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
if settingValue:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp option update blog_public 1 --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
else:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp option update blog_public 0 --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
elif setting == 'maintenanceMode':
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp litespeed-purge all --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
if settingValue:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp maintenance-mode activate --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
else:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp maintenance-mode deactivate --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
data_ret = {'status': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def submitWorpressCreation(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
extraArgs = {}
extraArgs['adminID'] = admin.pk
extraArgs['domainName'] = data['domain']
extraArgs['WPVersion'] = data['WPVersion']
extraArgs['blogTitle'] = data['title']
extraArgs['PluginsThemes'] = data['PluginsThemes']
extraArgs['adminUser'] = data['adminUser']
extraArgs['PasswordByPass'] = data['PasswordByPass']
extraArgs['adminPassword'] = data['PasswordByPass']
extraArgs['adminEmail'] = data['Email']
extraArgs['updates'] = data['AutomaticUpdates']
extraArgs['Plugins'] = data['Plugins']
extraArgs['Themes'] = data['Themes']
extraArgs['websiteOwner'] = data['websiteOwner']
extraArgs['package'] = data['package']
extraArgs['home'] = "1"
extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999))
background = ApplicationInstaller('wordpressInstallNew', extraArgs)
background.start()
time.sleep(2)
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None',
'tempStatusPath': extraArgs['tempStatusPath']}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def submitWebsiteCreation(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
@ -1844,7 +2672,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
@ -2312,11 +3139,11 @@ StrictHostKeyChecking no
adminEmail = data['ownerEmail']
websiteOwner = data['websiteOwner']
ownerPassword = data['ownerPassword']
data['ssl'] = 0
data['ssl'] = 1
data['dkimCheck'] = 0
data['openBasedir'] = 1
data['adminEmail'] = data['ownerEmail']
data['phpSelection'] = "PHP 7.0"
data['phpSelection'] = "PHP 7.4"
data['package'] = data['packageName']
try:
websitesLimit = data['websitesLimit']