diff --git a/filemanager/static/filemanager/css/fileManager.css b/filemanager/static/filemanager/css/fileManager.css index c15925364..520ce5cdd 100755 --- a/filemanager/static/filemanager/css/fileManager.css +++ b/filemanager/static/filemanager/css/fileManager.css @@ -1,60 +1,32 @@ -:root { - /* Modern color palette */ - --primary-color: #4f46e5; - --primary-hover: #4338ca; - --secondary-color: #6b7280; - --background-light: #f9fafb; - --background-lighter: #ffffff; - --text-primary: #111827; - --text-secondary: #4b5563; - --border-color: #e5e7eb; - --success-color: #10b981; - --danger-color: #ef4444; - --warning-color: #f59e0b; - --hover-bg: #f3f4f6; - --logo-bg: #f8fafc; - - /* Enhanced shadows */ - --card-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); - --card-shadow-hover: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1); - --button-shadow: 0 2px 4px 0 rgb(0 0 0 / 0.05); - --button-shadow-hover: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); - - /* Modern transitions */ - --transition-base: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); - --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); - --transition-bounce: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); +#logo { + width: 200px; + height: auto; } -body { - color: var(--text-primary); - font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; - background-color: var(--background-light); - line-height: 1.6; -} - -/* Enhanced Navbar Styling */ +/*#navBar{ + background: -moz-linear-gradient(#a4dbf5, #8cc5e0); + background: -webkit-linear-gradient(#a4dbf5, #8cc5e0); + background: -o-linear-gradient(#a4dbf5, #8cc5e0); +}*/ #navBar { - background: var(--background-lighter); - box-shadow: var(--card-shadow); - padding: 1.25rem; - border-bottom: 1px solid var(--border-color); - position: sticky; - top: 0; - z-index: 100; - backdrop-filter: blur(12px); - -webkit-backdrop-filter: blur(12px); + background: linear-gradient(135deg, #4158D0 0%, #C850C0 46%, #FFCC70 100%); + box-shadow: 0 2px 4px rgba(0,0,0,0.1); + padding: 0.5rem 0; +} +.navbar-brand { + margin: 0 1rem; + color: #fff !important; + font-weight: 500; +} +#mainRow { + margin: 2rem 1.5rem; } -/* Modern Header Logo */ -.header-logo { - display: flex; - align-items: center; - gap: 1rem; - padding: 0.875rem 1.25rem; - background: var(--logo-bg); - border-radius: 1.25rem; - transition: var(--transition-bounce); +#tableHead { + background: #f8f9fa; + color: #2c3e50; + font-weight: 500; + border-radius: 8px 8px 0 0; } .header-logo:hover { @@ -68,11 +40,24 @@ body { filter: brightness(0.8) contrast(1.2); } -.header-logo a { - display: flex; - align-items: center; - gap: 0.75rem; - text-decoration: none; +.my-drop-zone { + border: 2px dashed #cbd5e0; + border-radius: 8px; + padding: 2rem; + background: #f7fafc; + transition: all 0.3s ease; + margin-bottom: 2%; +} + +.my-drop-zone:hover { + border-color: #4158D0; + background: #f0f5ff; +} + +#queueProg { + margin-bottom: 2%; + height: 6px; + border-radius: 3px; } .header-logo span { @@ -291,20 +276,14 @@ body { border-radius: 1rem 1rem 0 0; } -.path-nav-item { - display: inline-flex; - align-items: center; - padding: 0.5rem 1rem; - font-size: 0.875rem; - color: var(--text-secondary); - border-radius: 0.75rem; - transition: var(--transition-bounce); +a.nav-link { + color: rgba(255,255,255,0.9) !important; font-weight: 500; + padding: 0.5rem 1rem; + transition: all 0.2s ease; } - -.path-nav-item:hover { - color: var(--primary-color); - background: var(--hover-bg); +a.nav-link:hover { + color: #ffffff !important; transform: translateY(-1px); } @@ -344,267 +323,142 @@ i.fa.fa-folder { font-size: 1.25rem; transition: var(--transition-smooth); } - -i.fa.fa-file { - color: var(--secondary-color) !important; - margin-right: 0.75rem; - font-size: 1.25rem; - transition: var(--transition-smooth); -} - -/* Modern Permissions Display */ -.permissions { - font-family: 'SF Mono', 'Roboto Mono', monospace; - font-size: 0.875rem; - color: var(--text-secondary); - background: var(--background-light); - padding: 0.375rem 0.75rem; - border-radius: 0.5rem; - border: 1px solid var(--border-color); -} - -/* Enhanced Navigation Actions */ -.nav-actions { - display: flex; - align-items: center; - gap: 1rem; - padding: 1.25rem; - background: var(--background-lighter); - border-bottom: 1.5px solid var(--border-color); - border-radius: 1.25rem 1.25rem 0 0; -} - -.nav-action { - display: inline-flex; - align-items: center; - justify-content: center; - padding: 0.75rem 1.5rem; - color: var(--text-secondary); - font-size: 0.875rem; - text-decoration: none; - border-radius: 0.75rem; - transition: var(--transition-bounce); - border: 1.5px solid var(--border-color); - background: var(--background-lighter); - min-width: 130px; - font-weight: 600; - box-shadow: var(--button-shadow); -} - -.nav-action:hover { - color: var(--primary-color); - background: var(--background-lighter); - border-color: var(--primary-color); - transform: translateY(-2px); - box-shadow: var(--button-shadow-hover); -} - -.nav-action i { - margin-right: 0.5rem; - font-size: 1rem; -} - -.nav-action.home-action { - color: var(--primary-color); - background: var(--background-lighter); - border-color: var(--primary-color); -} - -.nav-action.home-action:hover { - background: rgba(37, 99, 235, 0.1); -} - -.nav-action.back-action i, -.nav-action.refresh-action i { - margin-right: 0.25rem; -} - -.nav-action.select-action, -.nav-action.unselect-action { - background: var(--background-light); - border: 1px solid var(--border-color); -} - -.nav-action.select-action:hover, -.nav-action.unselect-action:hover { - background: var(--hover-bg); - border-color: var(--primary-color); - color: var(--primary-color); -} - -/* File Table Header */ -.file-table-header { - display: grid; - grid-template-columns: minmax(200px, 2fr) minmax(100px, 1fr) minmax(150px, 1fr) minmax(100px, 1fr); - gap: 1rem; - padding: 0.75rem 1rem; - background: var(--background-light); - border-bottom: 1px solid var(--border-color); -} - -.file-table-header th { - color: var(--text-secondary); - font-weight: 600; - font-size: 0.75rem; - text-transform: uppercase; - letter-spacing: 0.05em; -} - -/* File Table Row */ -.file-table-row { - display: grid; - grid-template-columns: minmax(200px, 2fr) minmax(100px, 1fr) minmax(150px, 1fr) minmax(100px, 1fr); - gap: 1rem; - padding: 0.75rem 1rem; - border-bottom: 1px solid var(--border-color); - transition: background-color 0.15s ease; -} - -.file-table-row:hover { - background-color: var(--hover-bg); -} - -.file-name-cell { - display: flex; - align-items: center; - gap: 0.5rem; -} - -.file-icon { - color: var(--warning-color); - font-size: 1rem; -} - -.file-name { - color: var(--text-primary); - font-size: 0.875rem; -} - -.file-size, -.file-date, -.file-permissions { - color: var(--text-secondary); - font-size: 0.875rem; -} - -.file-permissions { - font-family: monospace; -} - -/* Responsive Enhancements */ -@media (max-width: 768px) { - .nav-item .nav-link { - padding: 0.625rem 1rem; - } - - #treeView { - height: auto; - max-height: 350px; - } - - .table td, .table th { - padding: 1rem; - } - - .file-actions { - opacity: 1; - } - - .nav-action { - min-width: auto; - padding: 0.625rem 1rem; - } -} - -/* File Manager Navigation */ -.file-manager-nav { - display: flex; - align-items: center; - gap: 0.75rem; - padding: 0.75rem 1rem; - background: var(--background-lighter); - border-bottom: 1px solid var(--border-color); -} - -.file-manager-nav a { - display: inline-flex; - align-items: center; +.form-control { padding: 0.5rem 1rem; + border: 1px solid #e2e8f0; + border-radius: 6px; + color: #4a5568; + font-size: 0.95rem; + transition: all 0.3s ease; +} +.form-control:focus { + border-color: #4158D0; + box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15); +} +.form-control[readonly] { + background-color: #f8f9fa; +} +a { + color: #4158D0; + transition: color 0.2s ease; +} +a:hover { + color: #C850C0; +} + +.table { + background: white; + border-radius: 8px; + box-shadow: 0 0 20px rgba(0,0,0,0.05); + margin-bottom: 2rem; +} +.table td, .table th { + padding: .75rem; + vertical-align: middle; + border-top: 1px solid #edf2f7; +} +.table thead th { + border-bottom: 2px solid #edf2f7; + font-weight: 600; font-size: 0.875rem; - color: var(--text-secondary); - text-decoration: none; - border: 1px solid var(--border-color); - border-radius: 0.375rem; - transition: all 0.15s ease; - background: var(--background-lighter); + text-transform: uppercase; + letter-spacing: 0.5px; } -.file-manager-nav a:hover { - color: var(--primary-color); - border-color: var(--primary-color); - background: var(--hover-bg); +.table td { + font-size: 0.9rem; + color: #4a5568; +} +.list-group-item { + padding: 0.75rem 1.25rem; + border: 1px solid #edf2f7; + margin-bottom: -1px; + background-color: white; + transition: all 0.2s ease; +} +.list-group-item:hover { + background-color: #f7fafc; } -.file-manager-nav a i { - margin-right: 0.5rem; +i.fa.fa-file, +i.fa.fa-minus, +i.fa.fa-plus { + color: #4158D0 !important; +} +.bg-lightgray { + background: #f8f9fa; + border-radius: 8px; } -.file-manager-nav a.home-link { - color: var(--primary-color); - border-color: var(--primary-color); +.progress-bar { + background: linear-gradient(135deg, #4158D0 0%, #C850C0 100%); } -.file-manager-nav a.home-link:hover { - background: rgba(37, 99, 235, 0.1); +/* Card styles */ +.card { + border: none; + border-radius: 8px; + box-shadow: 0 0 20px rgba(0,0,0,0.05); } -/* Table Header */ -.table-header { - display: grid; - grid-template-columns: minmax(300px, 2fr) minmax(100px, 1fr) minmax(150px, 1fr) minmax(120px, 1fr); - padding: 0.75rem 1rem; - background: var(--background-light); - border-bottom: 1px solid var(--border-color); +.card-header { + background: #f8f9fa; + border-bottom: 1px solid #edf2f7; + padding: 1rem 1.25rem; font-weight: 500; - color: var(--text-secondary); + border-radius: 8px 8px 0 0; } -.table-header div { - font-size: 0.875rem; - text-transform: uppercase; - letter-spacing: 0.05em; -} - -.col-sm-9 .nav { - display: flex; - align-items: center; - gap: 0.5rem; - padding: 0.75rem; - background: var(--background-lighter); - border-bottom: 1px solid var(--border-color); - margin-bottom: 0 !important; -} - -.col-sm-9 .nav .nav-item a { - display: inline-flex; - align-items: center; +/* Navigation link styles */ +a.nav-link { + color: rgba(255,255,255,0.9) !important; + font-weight: 500; padding: 0.5rem 1rem; - color: var(--text-secondary); - text-decoration: none; - border: 1px solid var(--border-color); - border-radius: 0.375rem; - transition: all 0.15s ease; - background: var(--background-lighter); - margin: 0 !important; + transition: all 0.2s ease; } -.col-sm-9 .nav .nav-item a:hover { - color: var(--primary-color); - border-color: var(--primary-color); - background: var(--hover-bg); - text-decoration: none; +a.nav-link:hover { + color: #ffffff !important; + transform: translateY(-1px); } -.col-sm-9 .nav .nav-item a i { - margin-right: 0.5rem; +/* Utility classes */ +.bg-lightgray { + background: #f8f9fa; + border-radius: 8px; +} + +/* Custom scrollbar */ +::-webkit-scrollbar { + width: 8px; +} + +::-webkit-scrollbar-track { + background: #f1f1f1; +} + +::-webkit-scrollbar-thumb { + background: #c8c8c8; + border-radius: 4px; +} + +::-webkit-scrollbar-thumb:hover { + background: #a8a8a8; +} + +.btn { + padding: 0.5rem 1rem; + border-radius: 6px; + font-weight: 500; + transition: all 0.3s ease; +} + +.btn-primary { + background: linear-gradient(135deg, #4158D0 0%, #C850C0 100%); + border: none; +} + +.btn-primary:hover { + transform: translateY(-1px); + box-shadow: 0 4px 12px rgba(65, 88, 208, 0.15); } diff --git a/install/install.py b/install/install.py index dec901953..42603eb43 100755 --- a/install/install.py +++ b/install/install.py @@ -2329,8 +2329,26 @@ milter_default_action = accept command = "chmod +x /usr/local/CyberCP/cli/cyberPanel.py" preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + def setupPHPSymlink(self): + try: + # Remove existing PHP symlink if it exists + if os.path.exists('/usr/bin/php'): + os.remove('/usr/bin/php') + + # Create symlink to PHP 8.0 + command = 'ln -s /usr/local/lsws/lsphp80/bin/php /usr/bin/php' + preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + + logging.InstallLog.writeToFile("[setupPHPSymlink] PHP symlink created successfully.") + + except OSError as msg: + logging.InstallLog.writeToFile('[ERROR] ' + str(msg) + " [setupPHPSymlink]") + return 0 + def setupPHPAndComposer(self): try: + # First setup the PHP symlink + self.setupPHPSymlink() if self.distro == ubuntu: if not os.access('/usr/local/lsws/lsphp70/bin/php', os.R_OK): diff --git a/manageSSL/static/manageSSL/manageSSL.js b/manageSSL/static/manageSSL/manageSSL.js index 0a4e406d2..0f3de8365 100755 --- a/manageSSL/static/manageSSL/manageSSL.js +++ b/manageSSL/static/manageSSL/manageSSL.js @@ -12,21 +12,54 @@ app.controller('sslIssueCtrl', function ($scope, $http) { $scope.canNotIssue = true; $scope.sslIssued = true; $scope.couldNotConnect = true; + $scope.sslDetails = null; $scope.showbtn = function () { $scope.issueSSLBtn = false; + $scope.fetchSSLDetails(); + }; + + $scope.fetchSSLDetails = function() { + if (!$scope.virtualHost) return; + + var url = "/manageSSL/getSSLDetails"; + var data = { + virtualHost: $scope.virtualHost + }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(function(response) { + if (response.data.status === 1) { + $scope.sslDetails = response.data; + } else { + $scope.sslDetails = null; + new PNotify({ + title: 'Error', + text: response.data.error_message, + type: 'error' + }); + } + }, function(response) { + $scope.sslDetails = null; + new PNotify({ + title: 'Error', + text: 'Could not fetch SSL details', + type: 'error' + }); + }); }; $scope.issueSSL = function () { $scope.manageSSLLoading = false; var url = "/manageSSL/issueSSL"; - - var data = { virtualHost: $scope.virtualHost, }; - var config = { headers: { 'X-CSRFToken': getCookie('csrftoken') @@ -35,22 +68,16 @@ app.controller('sslIssueCtrl', function ($scope, $http) { $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { - - if (response.data.SSL == 1) { - $scope.sslIssueCtrl = true; $scope.manageSSLLoading = true; $scope.issueSSLBtn = false; $scope.canNotIssue = true; $scope.sslIssued = false; $scope.couldNotConnect = true; - $scope.sslDomain = $scope.virtualHost; - - + $scope.fetchSSLDetails(); // Refresh SSL details after issuing } else { $scope.sslIssueCtrl = true; $scope.manageSSLLoading = true; @@ -59,10 +86,7 @@ app.controller('sslIssueCtrl', function ($scope, $http) { $scope.sslIssued = true; $scope.couldNotConnect = true; $scope.errorMessage = response.data.error_message; - } - - } function cantLoadInitialDatas(response) { @@ -72,10 +96,7 @@ app.controller('sslIssueCtrl', function ($scope, $http) { $scope.canNotIssue = true; $scope.sslIssued = true; $scope.couldNotConnect = false; - } - - }; }); @@ -85,21 +106,54 @@ app.controller('sslIssueCtrl', function ($scope, $http) { app.controller('sslIssueCtrlV2', function ($scope, $http) { $scope.manageSSLLoading = true; + $scope.sslDetails = null; $scope.showbtn = function () { $scope.issueSSLBtn = false; + $scope.fetchSSLDetails(); + }; + + $scope.fetchSSLDetails = function() { + if (!$scope.virtualHost) return; + + var url = "/manageSSL/getSSLDetails"; + var data = { + virtualHost: $scope.virtualHost + }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(function(response) { + if (response.data.status === 1) { + $scope.sslDetails = response.data; + } else { + $scope.sslDetails = null; + new PNotify({ + title: 'Error', + text: response.data.error_message, + type: 'error' + }); + } + }, function(response) { + $scope.sslDetails = null; + new PNotify({ + title: 'Error', + text: 'Could not fetch SSL details', + type: 'error' + }); + }); }; $scope.issueSSL = function () { $scope.manageSSLLoading = false; var url = "/manageSSL/v2IssueSSL"; - - var data = { virtualHost: $scope.virtualHost, }; - var config = { headers: { 'X-CSRFToken': getCookie('csrftoken') @@ -108,24 +162,16 @@ app.controller('sslIssueCtrlV2', function ($scope, $http) { $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { - $scope.manageSSLLoading = true; - - if (response.data.SSL === 1) { - $scope.sslStatus = 'Issued.'; $scope.sslLogs = response.data.sslLogs; - + $scope.fetchSSLDetails(); // Refresh SSL details after issuing } else { $scope.sslStatus = 'Failed.'; $scope.sslLogs = response.data.sslLogs; - } - - } function cantLoadInitialDatas(response) { @@ -135,12 +181,8 @@ app.controller('sslIssueCtrlV2', function ($scope, $http) { $scope.canNotIssue = true; $scope.sslIssued = true; $scope.couldNotConnect = false; - } - - }; - }); /* Java script code to issue SSL V2 ends here */ diff --git a/manageSSL/templates/manageSSL/manageSSL.html b/manageSSL/templates/manageSSL/manageSSL.html index 2b3f41e78..8efaf8311 100755 --- a/manageSSL/templates/manageSSL/manageSSL.html +++ b/manageSSL/templates/manageSSL/manageSSL.html @@ -14,7 +14,7 @@ style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title="">{% trans "SSL Docs" %} -

{% trans "This page can be used to issue Let’s Encrypt SSL for existing websites on server." %}

+

{% trans "This page can be used to issue Let's Encrypt SSL for existing websites on server." %}

@@ -39,6 +39,28 @@
+
+
+
+
+

SSL Details

+
+
+
+

Status: Active

+

Issued By: {$ sslDetails.authority $}

+

Expiry Date: {$ sslDetails.expiryDate $}

+

Days Remaining: {$ sslDetails.days $}

+
+
+

Status: No SSL Certificate

+

Error: {$ sslDetails.error_message $}

+
+
+
+
+
+
diff --git a/manageSSL/templates/manageSSL/v2ManageSSL.html b/manageSSL/templates/manageSSL/v2ManageSSL.html index 36440c3f4..182432207 100755 --- a/manageSSL/templates/manageSSL/v2ManageSSL.html +++ b/manageSSL/templates/manageSSL/v2ManageSSL.html @@ -66,7 +66,7 @@
diff --git a/websiteFunctions/templates/websiteFunctions/website.html b/websiteFunctions/templates/websiteFunctions/website.html index 9a9c6e966..ff1cc0f51 100755 --- a/websiteFunctions/templates/websiteFunctions/website.html +++ b/websiteFunctions/templates/websiteFunctions/website.html @@ -1,483 +1,613 @@ {% extends "baseTemplate/index.html" %} {% load i18n %} +{% load static %} {% block title %}{{ domain }} - CyberPanel{% endblock %} {% block content %} - {% load static %} {% get_current_language as LANGUAGE_CODE %} -
+ -
-

{{ domain }} - {% trans "Preview" %}

-

{% trans "All functions related to a particular site." %}

+
+ +
+

+ {{ domain }} + {% trans "PREVIEW" %} +

+

{% trans "All functions related to a particular site." %}

{% if not error %} + -
+
+
+ + + + {% trans "Resource Usage" %} +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{% trans "Resource" %}{% trans "Usage" %}{% trans "Allowed" %}
FTP{{ ftpUsed }}{{ ftpTotal }}
Databases{{ databasesUsed }}{{ databasesTotal }}
Disk Usage{{ diskInMB }} (MB){{ diskInMBTotal }} (MB)
Bandwidth Usage{{ bwInMB }} (MB){{ bwInMBTotal }} (MB)
+
+
+ {% if viewSSL == 1 %} +
+ {{ authority }}
+ Your SSL will expire in {{ days }} days. +
+ {% endif %} +
+ Disk Usage +
+
{{ diskUsage }}%
+
+
+
+ Bandwidth Usage +
+
{{ bwUsage }}%
+
+
+
+
+
-
+ +
+
+ + + + {% trans "Real-time Resource Usage" %} +
+
+
+ +
+
+ +
+
+
+
+ +
+
+
-

- {% trans "Resource Usage" %} +

+
+
+
+

{% trans "Logs Fetched" %}

+
+
+

{% trans "Could not fetch logs, see the logs file through command line. Error message:" %} + {$ errorMessage $}

+
+
+

{% trans "Could not connect to server. Please refresh this page." %}

+
+
+
+ +
+
+ +
-
-
+
+ + +
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{% trans "Resource" %}{% trans "Usage" %}{% trans "Allowed" %}
{% trans "FTP" %}{{ ftpUsed }}{{ ftpTotal }}
{% trans "Databases" %}{{ databasesUsed }}{{ databasesTotal }}
{% trans "Disk Usage" %}{{ diskInMB }} (MB){{ diskInMBTotal }} (MB)
{% trans "Bandwidth Usage" %}{{ bwInMB }} (MB){{ bwInMBTotal }} (MB)
-
+ +
+ + + + + + + + + + + + + + + + + + + +
TypeIP AddressTimeResourceSize
+
+
-
-
-
- {% if viewSSL == 1 %} -
-
-

{{ authority }}

-

Your SSL will expire in {{ days }} days.

-
-
- {% endif %} -
-

- {% trans "Disk Usage" %} -

-
-
-
-
{{ diskUsage }}%
-
-
-

- {% trans "Bandwidth Usage" %} -

-
-
-
-
{{ bwUsage }}%
-
-
+ +
+ +
+ +
+ +
+ + +
+ + +
+ +
+
+ +
+
+
+
+
+ +
+
+

+ {% trans "Domains" %} +

+
+
+ + + + + + + + + + +
+
+ +
+ +
+ +
+
+ +

+
+
+
+ +
+ +
+ +
+
{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}
+
+ +
+ +
+ +
+
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
-
+ +
+ +
+ + +
+
+ +
+ +
+ +
+

{$ currentStatus $}

+
+ +
+
+ 70% Complete +
+
+ +
+

{% trans "Error message:" %} {$ errorMessage $}

+
+ +
+

{% trans "Website succesfully created." %}

+
+ + +
+

{% trans "Could not connect to server. Please refresh this page." %}

+
+ + +
+
+ +
+ +
+ +
+
+ + +
-
-
-
+ -
-
-

- {% trans "Logs" %} -

+ -
-
- - +
-
-
-
-

{% trans "Logs Fetched" %}

-
-
-

{% trans "Could not fetch logs, see the logs file through command line. Error message:" %} - {$ errorMessage $}

-
-
-

{% trans "Could not connect to server. Please refresh this page." %}

-
-
-
- -
-
- -
+ -
- - -
- -
- - - - - - - - - - - - - - - - - - - -
TypeIP AddressTimeResourceSize
-
+
+

{% trans "PHP Version Changed to:" %} {$ changedPHPVersion $}

+
+ +
+

{% trans "Deleted:" %} {$ deletedDomain $}

+
+ +
+

{% trans "SSL Issued:" %} {$ sslDomainIssued $}

+
+ +
+

{% trans "Changes applied successfully." %}

+
+ + +
+

{$ errorMessage $}

+
+ + +
+

{% trans "Could not connect to server. Please refresh this page." %}

+
+ + +
+ +
+
- -
- -
- -
- -
- - -
- - -
- -
-
- -
-
-
-
-
- -
-
-

- {% trans "Domains" %} -

-
-
- - - - - - - - - - -
-
- -
- -
- -
-
- -

-
-
-
- -
- -
- -
-
{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}
-
- -
- -
- -
-
- -
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
- -
- -
- - -
-
- -
- -
- -
-

{$ currentStatus $}

-
- -
-
- 70% Complete -
-
- -
-

{% trans "Error message:" %} {$ errorMessage $}

-
- -
-

{% trans "Website succesfully created." %}

-
- - -
-

{% trans "Could not connect to server. Please refresh this page." %}

-
- - -
-
- -
- -
- -
-
- - -
-
- - - - - -
- -
- - -
-

{% trans "PHP Version Changed to:" %} {$ changedPHPVersion $}

-
- -
-

{% trans "Deleted:" %} {$ deletedDomain $}

-
- -
-

{% trans "SSL Issued:" %} {$ sslDomainIssued $}

-
- -
-

{% trans "Changes applied successfully." %}

-
- - -
-

{$ errorMessage $}

-
- - -
-

{% trans "Could not connect to server. Please refresh this page." %}

-
- - -
- -
+
+
-
-
-

- {% trans "Configurations" %} -

-
-
- +
+
+

+ {% trans "Configurations" %} +

+
+
+ - + - + - + - + - + -
+
-
+ -
-

{% trans "SSL Saved" %}

+
+

{% trans "SSL Saved" %}

+
+ + +
+

{% trans "Could not save SSL. Error message:" %} {$ errorMessage $}

+
+ + +
+

{% trans "Could not connect to server. Please refresh this page." %}

+
+ + +
+
+
- - -
-

{% trans "Could not save SSL. Error message:" %} {$ errorMessage $}

+
+
- - -
-

{% trans "Could not connect to server. Please refresh this page." %}

+
+
+
- -
-
- -
-
- -
-
- -
+
+ +
+
+
+ +
-
- -
- -
+ + + + + + +
+
+
+

{% trans "Current configuration in the file fetched." %}

+
+ +
+

{% trans "Could not fetch current configuration. Error message:" %} {$ + errorMessage $}

+
+ +
+

{% trans "Could not connect to server. Please refresh this page." %}

+
+ +
+

{% trans "Configurations saved." %}

+
+ +
+

{% trans "Could not fetch current configuration. Error message:" %} {$ + errorMessage $}

+
+ +
+
+
- -
- - - - - - - -
-
-
-

{% trans "Current configuration in the file fetched." %}

+
+
+
-
-

{% trans "Could not fetch current configuration. Error message:" %} {$ - errorMessage $}

+
+ +
+
+
+ +
-
-

{% trans "Could not connect to server. Please refresh this page." %}

-
+ -
-

{% trans "Configurations saved." %}

-
+
+
+
+

{% trans "It is not required to modify rules if you are using OpenLiteSpeed." %} + Click + to read more about whats changed in rewrite + rules from v1.8 onwards.

+
-
-

{% trans "Could not fetch current configuration. Error message:" %} {$ - errorMessage $}

-
- -
-
- -
-
- -
-
- -
- -
- -
-
-
-
- - - -
-
-
-

{% trans "It is not required to modify rules if you are using OpenLiteSpeed." %} - Click - to read more about whats changed in rewrite - rules from v1.8 onwards.

-
- - - -
- -
- -
-
- -
- -
-

{% trans "Could not fetch current rewrite rules. Error message:" %} {$ - errorMessage $}

-
- -
-

{% trans "Could not connect to server. Please refresh this page." %}

-
- -
-

{% trans "Configurations saved." %}

-
- -
-

{% trans "Could not save rewrite rules. Error message:" %} {$ errorMessage - $}

-
+
-
- -
-
- -
-
- -
- -
- -
-
- -
- -
- - - -
- -
- - -
- +
- + + + +
- -
-

-
- -
- - -
- -
- -
-
- - -
- - -
-
-

{% trans "Failed to change PHP version. Error message:" %} {$ - errorMessage $}

-
- -
-

{% trans "PHP successfully changed for: " %} {$ websiteDomain - $}

-
- -
-

{% trans "Could not connect to server. Please refresh this page." %}

-
-
-
+ +
+

{% trans "Could not fetch current rewrite rules. Error message:" %} {$ + errorMessage $}

+
+ +
+

{% trans "Could not connect to server. Please refresh this page." %}

+
+ +
+

{% trans "Configurations saved." %}

+
+ +
+

{% trans "Could not save rewrite rules. Error message:" %} {$ errorMessage + $}

+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+ + + +
+ +
+ + +
+ +
+ +
+ +
+

+
+ +
+ + +
+ +
+ +
+
+ + +
+ + +
+
+

{% trans "Failed to change PHP version. Error message:" %} {$ + errorMessage $}

+
+ +
+

{% trans "PHP successfully changed for: " %} {$ websiteDomain + $}

+
+ +
+

{% trans "Could not connect to server. Please refresh this page." %}

+
+
+
+ +
+
+
+
-
-
-

- {% trans "Files" %} -

-
-
+
+
+

+ {% trans "Files" %} +

+
+
+ + + + + + {% if ftp %} + + {% endif %} - {% if ftp %} + -
- - - - - {% trans "Create FTP Acct" %} - +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
-
- - - - - {% trans "Delete FTP Acct" %} - + +
+ +
+ +
+
+
+ + +
+
+

{% trans "Error message:" %} {$ errorMessage $}

+
+ +
+

{% trans "Changes successfully saved." %}

+
+ +
+

{% trans "Could not connect to server. Please refresh this page." %}

+
+
+
- {% endif %} - - - -
- -
- -
- -
- -
- -
- -
- -
-
- - -
- -
- -
-
-
- - -
-
-

{% trans "Error message:" %} {$ errorMessage $}

-
- -
-

{% trans "Changes successfully saved." %}

-
- -
-

{% trans "Could not connect to server. Please refresh this page." %}

-
-
- -
- - - -
- - - +
+ + + +
+
- {% if email %} + {% if email %} - {% if marketingStatus %} + {% if marketingStatus %} -
-
-

- {% trans "Email Marketing" %} -

- -
-
- - - - - - - - - + {% endif %} -
-
-

- {% trans "Application Installer" %} +
+

+ {% trans "Application Installer" %} -

+

- {% else %} @@ -1090,3 +1219,10 @@ {% endblock %} + +{% block footer_scripts %} +{{ block.super }} + + + +{% endblock %} diff --git a/websiteFunctions/urls.py b/websiteFunctions/urls.py index 263492a83..9b68b8712 100755 --- a/websiteFunctions/urls.py +++ b/websiteFunctions/urls.py @@ -200,4 +200,6 @@ urlpatterns = [ # Catch all for domains path('/', views.launchChild, name='launchChild'), path('', views.domain, name='domain'), + + path('get_website_resources/', views.get_website_resources, name='get_website_resources'), ] diff --git a/websiteFunctions/views.py b/websiteFunctions/views.py index ddfe3276e..a1cad4436 100755 --- a/websiteFunctions/views.py +++ b/websiteFunctions/views.py @@ -2,11 +2,12 @@ from django.shortcuts import redirect -from django.http import HttpResponse +from django.http import HttpResponse, JsonResponse from loginSystem.models import Administrator from loginSystem.views import loadLoginPage import json import plogical.CyberCPLogFileWriter as logging +from plogical.acl import ACLManager from plogical.httpProc import httpProc @@ -17,6 +18,7 @@ from django.views.decorators.csrf import csrf_exempt from .dockerviews import startContainer as docker_startContainer from .dockerviews import stopContainer as docker_stopContainer from .dockerviews import restartContainer as docker_restartContainer +from .resource_monitoring import get_website_resource_usage def loadWebsitesHome(request): val = request.session['userID'] @@ -1882,4 +1884,42 @@ def restartContainer(request): return docker_restartContainer(request) return HttpResponse('Not allowed') except KeyError: - return redirect(loadLoginPage) \ No newline at end of file + return redirect(loadLoginPage) + +@csrf_exempt +def get_website_resources(request): + try: + data = json.loads(request.body) + domain = data['domain'] + + # Get userID from session + try: + userID = request.session['userID'] + admin = Administrator.objects.get(pk=userID) + except: + return JsonResponse({'status': 0, 'error_message': 'Unauthorized access'}) + + # Verify domain ownership + currentACL = ACLManager.loadedACL(userID) + + from websiteFunctions.models import Websites + try: + website = Websites.objects.get(domain=domain) + except Websites.DoesNotExist: + return JsonResponse({'status': 0, 'error_message': 'Website not found'}) + + if ACLManager.checkOwnership(domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + + # Get resource usage data using externalApp + resource_data = get_website_resource_usage(website.externalApp) + if resource_data['status'] == 0: + return JsonResponse(resource_data) + + return JsonResponse(resource_data) + + except BaseException as msg: + logging.CyberCPLogFileWriter.writeToFile(f'Error in get_website_resources: {str(msg)}') + return JsonResponse({'status': 0, 'error_message': str(msg)}) \ No newline at end of file diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index f254d2a62..e28c7b50f 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -1955,19 +1955,43 @@ class WebsiteManager: return HttpResponse(json_data) def UpdateWPSettings(self, userID=None, data=None): + # Map old setting names to new ones + setting_map = { + 'PasswordProtection': 'password-protection', + 'searchIndex': 'search-indexing', + 'debugging': 'debugging', + 'maintenanceMode': 'maintenance-mode', + 'lscache': 'lscache', + 'Wpcron': 'wpcron', + # Add more mappings as needed + } + + siteId = data.get('siteId') or data.get('WPid') + if not siteId: + resp = {'status': 0, 'error_message': 'Missing siteId or WPid'} + return JsonResponse(resp) + + # Accept both new and old setting names + setting = data.get('setting') + if not setting: + for old_key in setting_map: + if old_key in data: + setting = old_key + data['settingValue'] = data[old_key] + break + + # Map to new setting name if needed + setting = setting_map.get(setting, setting) + value = data.get('value') or data.get('settingValue') + try: currentACL = ACLManager.loadedACL(userID) admin = Administrator.objects.get(pk=userID) - - siteId = data['siteId'] - setting = data['setting'] - value = data['value'] - wpsite = WPSites.objects.get(pk=siteId) - + if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) != 1: return ACLManager.loadError() - + # Get PHP version and path Webobj = Websites.objects.get(pk=wpsite.owner_id) Vhuser = Webobj.externalApp @@ -1977,10 +2001,8 @@ class WebsiteManager: # Update the appropriate setting based on the setting type if setting == 'search-indexing': - # Update search engine indexing command = f'sudo -u {Vhuser} {FinalPHPPath} -d error_reporting=0 /usr/bin/wp option update blog_public {value} --skip-plugins --skip-themes --path={wpsite.path}' elif setting == 'debugging': - # Update debugging in wp-config.php if value: command = f'sudo -u {Vhuser} {FinalPHPPath} -d error_reporting=0 /usr/bin/wp config set WP_DEBUG true --raw --skip-plugins --skip-themes --path={wpsite.path}' else: @@ -1990,76 +2012,84 @@ class WebsiteManager: vhostPassDir = f'/home/{vhostName}' path = f'{vhostPassDir}/{siteId}' if value: - # Enable password protection tempPath = f'/home/cyberpanel/{str(randint(1000, 9999))}' os.makedirs(tempPath) - - # Create temporary .htpasswd file htpasswd = f'{tempPath}/.htpasswd' htaccess = f'{tempPath}/.htaccess' password = randomPassword.generate_pass(12) - - # Create .htpasswd file command = f"htpasswd -cb {htpasswd} admin {password}" ProcessUtilities.executioner(command) - - # Create .htaccess file content htaccess_content = f""" AuthType Basic AuthName "Restricted Access" AuthUserFile {path}/.htpasswd Require valid-user """ - with open(htaccess, 'w') as f: f.write(htaccess_content) - - # Create final directory and move files command = f"mkdir -p {path}" ProcessUtilities.executioner(command, wpsite.owner.externalApp) - - # Move files to final location command = f"mv {htpasswd} {path}/.htpasswd" ProcessUtilities.executioner(command, wpsite.owner.externalApp) - - command = f"mv {htaccess} {wpsite.path}/.htaccess" + command = f"mv {htaccess} {wpsite.path}/.htaccess" ProcessUtilities.executioner(command, wpsite.owner.externalApp) - - # Cleanup temp directory command = f"rm -rf {tempPath}" ProcessUtilities.executioner(command) - else: - # Disable password protection if os.path.exists(path): command = f"rm -rf {path}" ProcessUtilities.executioner(command, wpsite.owner.externalApp) - htaccess = f'{wpsite.path}/.htaccess' if os.path.exists(htaccess): command = f"rm -f {htaccess}" ProcessUtilities.executioner(command, wpsite.owner.externalApp) - - return JsonResponse({'status': 1, 'error_message': 'None'}) + resp = {'status': 1, 'error_message': 'None'} + if data.get('legacy_response'): + import json + return HttpResponse(json.dumps(resp)) + else: + return JsonResponse(resp) elif setting == 'maintenance-mode': if value: command = f'sudo -u {Vhuser} {FinalPHPPath} -d error_reporting=0 /usr/bin/wp maintenance-mode activate --skip-plugins --skip-themes --path={wpsite.path}' else: command = f'sudo -u {Vhuser} {FinalPHPPath} -d error_reporting=0 /usr/bin/wp maintenance-mode deactivate --skip-plugins --skip-themes --path={wpsite.path}' + elif setting == 'lscache': + if value: + command = f'sudo -u {Vhuser} {FinalPHPPath} -d error_reporting=0 /usr/bin/wp plugin activate litespeed-cache --skip-plugins --skip-themes --path={wpsite.path}' + else: + command = f'sudo -u {Vhuser} {FinalPHPPath} -d error_reporting=0 /usr/bin/wp plugin deactivate litespeed-cache --skip-plugins --skip-themes --path={wpsite.path}' else: - return JsonResponse({'status': 0, 'error_message': 'Invalid setting type'}) - + resp = {'status': 0, 'error_message': 'Invalid setting type'} + if data.get('legacy_response'): + import json + return HttpResponse(json.dumps(resp)) + else: + return JsonResponse(resp) + result = ProcessUtilities.outputExecutioner(command) if result.find('Error:') > -1: - return JsonResponse({'status': 0, 'error_message': result}) - - return JsonResponse({'status': 1, 'error_message': 'None'}) + resp = {'status': 0, 'error_message': result} + if data.get('legacy_response'): + import json + return HttpResponse(json.dumps(resp)) + else: + return JsonResponse(resp) + + resp = {'status': 1, 'error_message': 'None'} + if data.get('legacy_response'): + import json + return HttpResponse(json.dumps(resp)) + else: + return JsonResponse(resp) except BaseException as msg: - return JsonResponse({'status': 0, 'error_message': str(msg)}) - - - + resp = {'status': 0, 'error_message': str(msg)} + if data and data.get('legacy_response'): + import json + return HttpResponse(json.dumps(resp)) + else: + return JsonResponse(resp) def submitWorpressCreation(self, userID=None, data=None): try: @@ -4572,8 +4602,7 @@ StrictHostKeyChecking no websites = ACLManager.searchWebsiteObjects(currentlACL, userID, searchTerm) - json_data = "[" - checker = 0 + json_data = [] try: ipFile = "/etc/cyberpanel/machineIP" @@ -4604,19 +4633,34 @@ StrictHostKeyChecking no PHPVersionActual = 'PHP 8.1' diskUsed = "%sMB" % str(DiskUsage) - dic = {'domain': items.domain, 'adminEmail': items.adminEmail, 'ipAddress': ipAddress, - 'admin': items.admin.userName, 'package': items.package.packageName, 'state': state, - 'diskUsed': diskUsed, 'phpVersion': PHPVersionActual} - if checker == 0: - json_data = json_data + json.dumps(dic) - checker = 1 - else: - json_data = json_data + ',' + json.dumps(dic) + # Get WordPress sites for this website + wp_sites = [] + try: + wp_sites = WPSites.objects.filter(owner=items) + wp_sites = [{ + 'id': wp.id, + 'title': wp.title, + 'url': wp.FinalURL, + 'version': wp.version if hasattr(wp, 'version') else 'Unknown', + 'phpVersion': wp.phpVersion if hasattr(wp, 'phpVersion') else 'Unknown' + } for wp in wp_sites] + except: + pass - json_data = json_data + ']' + json_data.append({ + 'domain': items.domain, + 'adminEmail': items.adminEmail, + 'ipAddress': ipAddress, + 'admin': items.admin.userName, + 'package': items.package.packageName, + 'state': state, + 'diskUsed': diskUsed, + 'phpVersion': PHPVersionActual, + 'wp_sites': wp_sites + }) - return json_data + return json.dumps(json_data) def findWebsitesJson(self, currentACL, userID, pageNumber): finalPageNumber = ((pageNumber * 10)) - 10 @@ -4779,7 +4823,6 @@ StrictHostKeyChecking no return ACLManager.loadErrorJson() tempStatusPath = "/home/cyberpanel/" + str(randint(1000, 9999)) - execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " switchServer --phpVersion '" + phpVersion + "' --server " + str( server) + " --virtualHostName " + domainName + " --tempStatusPath " + tempStatusPath @@ -7221,5 +7264,4 @@ StrictHostKeyChecking no except BaseException as msg: data_ret = {'status': 0, 'fetchStatus': 0, 'error_message': str(msg)} json_data = json.dumps(data_ret) - return HttpResponse(json_data) - + return HttpResponse(json_data) \ No newline at end of file