Implementing Manual Expiration Dates
This commit is contained in:
@@ -285,6 +285,7 @@ class DomainController extends Controller
|
||||
$groupId = !empty($_POST['notification_group_id']) ? (int)$_POST['notification_group_id'] : null;
|
||||
$isActive = isset($_POST['is_active']) ? 1 : 0;
|
||||
$tagsInput = trim($_POST['tags'] ?? '');
|
||||
$manualExpirationDate = !empty($_POST['manual_expiration_date']) ? $_POST['manual_expiration_date'] : null;
|
||||
|
||||
// Validate tags
|
||||
$tagValidation = \App\Helpers\InputValidator::validateTags($tagsInput);
|
||||
@@ -317,7 +318,8 @@ class DomainController extends Controller
|
||||
$this->domainModel->update($id, [
|
||||
'notification_group_id' => $groupId,
|
||||
'tags' => $tags,
|
||||
'is_active' => $isActive
|
||||
'is_active' => $isActive,
|
||||
'expiration_date' => $manualExpirationDate
|
||||
]);
|
||||
|
||||
// Send notification if monitoring status changed and has notification group
|
||||
@@ -403,12 +405,15 @@ class DomainController extends Controller
|
||||
return;
|
||||
}
|
||||
|
||||
$status = $this->whoisService->getDomainStatus($whoisData['expiration_date'], $whoisData['status'] ?? []);
|
||||
// Use WHOIS expiration date if available, otherwise preserve manual expiration date
|
||||
$expirationDate = $whoisData['expiration_date'] ?? $domain['expiration_date'];
|
||||
|
||||
$status = $this->whoisService->getDomainStatus($expirationDate, $whoisData['status'] ?? []);
|
||||
|
||||
$this->domainModel->update($id, [
|
||||
'registrar' => $whoisData['registrar'],
|
||||
'registrar_url' => $whoisData['registrar_url'] ?? null,
|
||||
'expiration_date' => $whoisData['expiration_date'],
|
||||
'expiration_date' => $expirationDate,
|
||||
'updated_date' => $whoisData['updated_date'] ?? null,
|
||||
'abuse_email' => $whoisData['abuse_email'] ?? null,
|
||||
'last_checked' => date('Y-m-d H:i:s'),
|
||||
@@ -707,12 +712,15 @@ class DomainController extends Controller
|
||||
continue;
|
||||
}
|
||||
|
||||
$status = $this->whoisService->getDomainStatus($whoisData['expiration_date'], $whoisData['status'] ?? []);
|
||||
// Use WHOIS expiration date if available, otherwise preserve manual expiration date
|
||||
$expirationDate = $whoisData['expiration_date'] ?? $domain['expiration_date'];
|
||||
|
||||
$status = $this->whoisService->getDomainStatus($expirationDate, $whoisData['status'] ?? []);
|
||||
|
||||
$this->domainModel->update($id, [
|
||||
'registrar' => $whoisData['registrar'],
|
||||
'registrar_url' => $whoisData['registrar_url'] ?? null,
|
||||
'expiration_date' => $whoisData['expiration_date'],
|
||||
'expiration_date' => $expirationDate,
|
||||
'updated_date' => $whoisData['updated_date'] ?? null,
|
||||
'abuse_email' => $whoisData['abuse_email'] ?? null,
|
||||
'last_checked' => date('Y-m-d H:i:s'),
|
||||
|
||||
@@ -30,9 +30,38 @@ class DomainHelper
|
||||
// Determine expiry color for labels
|
||||
$domain['expiryColor'] = self::getExpiryColor($domain['daysLeft']);
|
||||
|
||||
// Check if expiration date is manual (not from WHOIS/RDAP)
|
||||
$domain['isManualExpiration'] = self::isManualExpiration($domain);
|
||||
|
||||
return $domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if expiration date is manually set (not from WHOIS/RDAP)
|
||||
*/
|
||||
private static function isManualExpiration(array $domain): bool
|
||||
{
|
||||
// If no expiration date, it's not manual
|
||||
if (empty($domain['expiration_date'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Parse WHOIS data to check if it contains expiration date
|
||||
$whoisData = json_decode($domain['whois_data'] ?? '{}', true);
|
||||
|
||||
// If WHOIS data doesn't have expiration date, it's likely manual
|
||||
if (empty($whoisData['expiration_date'])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If WHOIS expiration date is different from stored expiration date, it's manual
|
||||
if ($whoisData['expiration_date'] !== $domain['expiration_date']) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine domain status from WHOIS data
|
||||
*/
|
||||
|
||||
@@ -119,6 +119,38 @@ ob_start();
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Manual Expiration Date -->
|
||||
<div>
|
||||
<label for="manual_expiration_date" class="block text-sm font-medium text-gray-700 mb-1.5">
|
||||
Manual Expiration Date
|
||||
<span class="text-gray-400 font-normal">(Optional)</span>
|
||||
</label>
|
||||
<div class="relative">
|
||||
<i class="fas fa-calendar-alt absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 text-sm"></i>
|
||||
<input type="date"
|
||||
id="manual_expiration_date"
|
||||
name="manual_expiration_date"
|
||||
value="<?= $domain['expiration_date'] ? date('Y-m-d', strtotime($domain['expiration_date'])) : '' ?>"
|
||||
class="w-full pl-10 pr-3 py-2.5 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-colors text-sm">
|
||||
</div>
|
||||
<p class="mt-1.5 text-xs text-gray-500">
|
||||
<i class="fas fa-info-circle mr-1"></i>
|
||||
Set a manual expiration date if WHOIS/RDAP doesn't provide one (e.g., for .nl domains).
|
||||
This will be used for expiration notifications and status calculations.
|
||||
</p>
|
||||
<?php if ($domain['expiration_date']): ?>
|
||||
<p class="mt-1 text-xs text-green-600">
|
||||
<i class="fas fa-check-circle mr-1"></i>
|
||||
Current expiration date: <?= date('M j, Y', strtotime($domain['expiration_date'])) ?>
|
||||
</p>
|
||||
<?php else: ?>
|
||||
<p class="mt-1 text-xs text-amber-600">
|
||||
<i class="fas fa-exclamation-triangle mr-1"></i>
|
||||
No expiration date available from WHOIS/RDAP. Consider setting a manual date.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- Active Monitoring -->
|
||||
<div class="bg-gray-50 rounded-lg p-4 border border-gray-200">
|
||||
<label class="flex items-center cursor-pointer">
|
||||
|
||||
@@ -359,7 +359,14 @@ $currentFilters = $filters ?? ['search' => '', 'status' => '', 'group' => '', 's
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<?php if (!empty($domain['expiration_date'])): ?>
|
||||
<div class="text-sm">
|
||||
<div class="font-medium text-gray-900"><?= date('M d, Y', strtotime($domain['expiration_date'])) ?></div>
|
||||
<div class="font-medium text-gray-900 flex items-center">
|
||||
<?= date('M d, Y', strtotime($domain['expiration_date'])) ?>
|
||||
<?php if ($domain['isManualExpiration']): ?>
|
||||
<span class="ml-1 inline-flex items-center px-1 py-0.5 rounded text-xs font-medium bg-amber-100 text-amber-800" title="Manual expiration date">
|
||||
<i class="fas fa-edit" style="font-size: 8px;"></i>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="text-xs <?= $expiryClass ?>">
|
||||
<?= $daysLeft ?> days
|
||||
</div>
|
||||
|
||||
@@ -154,7 +154,15 @@ ob_start();
|
||||
<i class="fas fa-exclamation-triangle text-white text-xs"></i>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-xs text-gray-600 font-medium">Expiration</p>
|
||||
<p class="text-xs text-gray-600 font-medium">
|
||||
Expiration
|
||||
<?php if ($domain['isManualExpiration']): ?>
|
||||
<span class="ml-1 inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-amber-100 text-amber-800">
|
||||
<i class="fas fa-edit mr-1" style="font-size: 8px;"></i>
|
||||
Manual
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
<p class="text-xs font-semibold text-gray-900"><?= date('M j, Y', strtotime($domain['expiration_date'])) ?></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user