Skip to content

Commit

Permalink
+ Domain registration and expiration warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Nicholas K. Dionysopoulos <nicholas@akeeba.com>
  • Loading branch information
nikosdion committed Sep 9, 2024
1 parent f7d030f commit a48f6c5
Show file tree
Hide file tree
Showing 17 changed files with 1,017 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .idea/Akeeba Panopticon.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions .idea/codeception.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/CLI_site_info_refresh.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php die(); ?>
Akeeba Panopticon 1.2.3
================================================================================
+ Domain registration and expiration warnings
# [HIGH] Cannot connect to really old WordPress installations (WordPress 5.5 and earlier)
# [HIGH] Cannot connect to old Akeeba Backup for WordPress (version 7)
# [HIGH] PHP error when WordPress fails to provide version information
Expand Down
20 changes: 20 additions & 0 deletions ViewTemplates/Sites/form_other_features.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,26 @@
</div>
</div>

<div class="row mt-3 mb-4">
<label for="config_ssl_warning" class="col-sm-3 col-form-label">
@lang('PANOPTICON_SITES_FIELD_CONFIG_DOMAIN_WARNING')
</label>
<div class="col-sm-9">
<div class="input-group">
<input type="text" class="form-control"
name="config[config.domain.warning]" id="config_domain_warning"
value="{{ $config->get('config.domain.warning', 180) }}"
>
<div class="input-group-text">
@lang('PANOPTICON_SYSCONFIG_LBL_UOM_DAYS')
</div>
</div>
<div class="form-text">
@lang('PANOPTICON_SITES_FIELD_CONFIG_DOMAIN_WARNING_HELP')
</div>
</div>
</div>

<div class="row mt-3 mb-4">
<label for="config_backup_max_age" class="col-sm-3 col-form-label">
@lang('PANOPTICON_SITES_FIELD_CONFIG_BACKUP_MAX_AGE')
Expand Down
3 changes: 3 additions & 0 deletions ViewTemplates/Sites/item.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class="mx-1 p-1 border rounded"
alt="">
@endif
<span class="flex-grow-1">{{{ $this->item->name }}}</span>
@if (!empty($this->siteConfig->get('whois')))
@include('Sites/item_whois')
@endif
@if (!empty($this->siteConfig->get('ssl')))
@include('Sites/item_ssl')
@endif
Expand Down
153 changes: 153 additions & 0 deletions ViewTemplates/Sites/item_whois.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
<?php
/**
* @package panopticon
* @copyright Copyright (c)2023-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license https://www.gnu.org/licenses/agpl-3.0.txt GNU Affero General Public License, version 3 or later
*/
defined('AKEEBA') || die;
use Awf\Uri\Uri;
/** @var \Akeeba\Panopticon\View\Sites\Html $this */
$domain = $this->siteConfig->get('whois.domain', null)
?: Uri::getInstance($this->item->getBaseUrl())->getHost();
$created = $this->siteConfig->get('whois.created', null);
$expiration = $this->siteConfig->get('whois.expiration', null);
$registrar = $this->siteConfig->get('whois.registrar', null);
$nameservers = $this->siteConfig->get('whois.nameservers', []) ?: [];
$validityStatus = $this->item->getDomainValidityStatus();
$hasError = !in_array($validityStatus, [0, 2]);
$hasWarning = !$hasError && $validityStatus === 2;
?>
<button type="button"
class="btn {{ $hasError ? 'btn-outline-danger' : ($hasWarning ? 'btn-outline-warning' : 'btn-outline-success') }}"
data-bs-toggle="modal" data-bs-target="#whoisInfoModal"
>
<span class="fa fa-fw fa-globe" aria-hidden="true"
data-bs-toggle="tooltip" data-bs-placement="bottom"
data-bs-title="@lang('PANOPTICON_MAIN_SITES_LBL_WHOISINFO')"></span>
<span class="visually-hidden">@lang('PANOPTICON_MAIN_SITES_LBL_WHOISINFO')</span>
</button>

<div class="modal fade fs-6 fw-normal text-start" id="whoisInfoModal" tabindex="-1"
aria-labelledby="whoisInfoModal_label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title fs-5" id="sslTlsInfoModal_label">
@lang('PANOPTICON_MAIN_SITES_LBL_WHOISINFO')
</h3>
<button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="@lang('PANOPTICON_APP_LBL_MESSAGE_CLOSE')"></button>
</div>
<div class="modal-body">
@if($validityStatus === -1)
<div class="alert alert-warning">
<h4 class="alert-heading fs-6">
<span class="fa fa-fw fa-triangle-exclamation" aria-hidden="true"></span>
@lang('PANOPTICON_MAIN_SITES_LBL_WHOISINFO_ERR_DATE_INVALID_HEAD')
</h4>
@lang('PANOPTICON_MAIN_SITES_LBL_WHOISINFO_ERR_DATE_INVALID')
</div>
@elseif($validityStatus === 1)
<div class="alert alert-danger">
<h4 class="alert-heading fs-6">
<span class="fa fa-fw fa-circle-exclamation" aria-hidden="true"></span>
@lang('PANOPTICON_MAIN_SITES_LBL_WHOISINFO_TOOSOON_HEAD')
</h4>
@lang('PANOPTICON_MAIN_SITES_LBL_WHOISINFO_TOOSOON')
</div>
@elseif($validityStatus === 2)
<div class="alert alert-warning">
<h4 class="alert-heading fs-6">
<span class="fa fa-fw fa-triangle-exclamation" aria-hidden="true"></span>
@lang('PANOPTICON_MAIN_SITES_LBL_WHOISINFO_EXPIRING_HEAD')
</h4>
@lang('PANOPTICON_MAIN_SITES_LBL_WHOISINFO_EXPIRING')
</div>
@elseif($validityStatus === 3)
<div class="alert alert-danger">
<h4 class="alert-heading fs-6">
<span class="fa fa-fw fa-circle-exclamation" aria-hidden="true"></span>
@lang('PANOPTICON_MAIN_SITES_LBL_WHOISINFO_EXPIRED_HEAD')
</h4>
@lang('PANOPTICON_MAIN_SITES_LBL_WHOISINFO_EXPIRED')
</div>
@elseif(empty($nameservers))
<div class="alert alert-danger">
<h4 class="alert-heading fs-6">
<span class="fa fa-fw fa-circle-exclamation" aria-hidden="true"></span>
@lang('PANOPTICON_MAIN_SITES_LBL_WHOISINFO_NONAMESERVERS_HEAD')
</h4>
@lang('PANOPTICON_MAIN_SITES_LBL_WHOISINFO_NONAMESERVERS')
</div>
@endif

<table class="table">
<caption class="visually-hidden">
@lang('PANOPTICON_MAIN_SITES_LBL_WHOISINFO_TABLE_CAPTION')
</caption>
<tbody>
<tr>
<th scope="row">@lang('PANOPTICON_MAIN_SITES_LBL_WHOISINFO_DOMAIN')</th>
<td>
{{{ $domain }}}
</td>
</tr>
<tr>
<th scope="row">@lang('PANOPTICON_MAIN_SITES_LBL_WHOISINFO_REGISTERED')</th>
<td>
@if (empty($created))
&ndash;
@else
{{ $this->getContainer()->html->basic->date($created, $this->getLanguage()->text('DATE_FORMAT_LC7')) }}
@endif
</td>
</tr>
<tr>
<th scope="row">@lang('PANOPTICON_MAIN_SITES_LBL_WHOISINFO_EXPIRES')</th>
<td>
@if (empty($expiration))
&ndash;
@else
{{ $this->getContainer()->html->basic->date($expiration, $this->getLanguage()->text('DATE_FORMAT_LC7')) }}
@endif
</td>
</tr>
<tr>
<th scope="row">@lang('PANOPTICON_MAIN_SITES_LBL_WHOISINFO_REGISTRAR')</th>
<td>
{{{ $registrar }}}
</td>
</tr>
<tr>
<th scope="row">@lang('PANOPTICON_MAIN_SITES_LBL_WHOISINFO_NAMESERVERS')</th>
<td>
@if (empty($nameservers))
&ndash;
@else
<ul>
@foreach($nameservers as $ns)
<li>
{{{ $ns }}}
</li>
@endforeach
</ul>
@endif
</td>
</tr>
</tbody>
</table>

<div class="my-3 text-muted small">
@lang('PANOPTICON_MAIN_SITES_LBL_WHOISINFO_CACHING_NOTICE')
</div>

</div>
</div>
</div>
</div>
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"dragonmantank/cron-expression": "^3.3.2",
"guzzlehttp/guzzle": "^7.5",
"jfcherng/php-diff": "^6.15",
"io-developer/php-whois": "^4.1.10",
"kevinrob/guzzle-cache-middleware": "^5.0",
"league/commonmark": "^2.4",
"mcrumley/php-complexify": "^0.4.1",
Expand Down
Loading

0 comments on commit a48f6c5

Please sign in to comment.