| Server IP : 213.255.246.8 / Your IP : 216.73.217.178 Web Server : Apache System : Linux dublin.stapolin.com 5.14.0-362.18.1.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jan 29 07:05:48 EST 2024 x86_64 User : stapolin ( 1019) PHP Version : 8.4.24 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/stapolin/public_html/tracking.stapolin.com/admin/ |
Upload File : |
<?php
declare(strict_types=1);
require_once __DIR__ . '/../includes/bootstrap.php';
$currentUser = require_login();
$pageTitle = 'Websites';
$websites = db_fetch_all(
'SELECT w.*, COUNT(d.id) AS domain_count FROM websites w LEFT JOIN website_domains d ON d.website_id = w.id GROUP BY w.id ORDER BY w.created_at DESC'
);
require APP_ROOT . '/templates/admin_header.php';
?>
<div class="d-flex flex-wrap justify-content-between align-items-center gap-3 mb-4">
<h1 class="h3 mb-0">Websites</h1>
<a class="btn btn-primary" href="<?= e(app_url('admin/websites-edit.php')) ?>">Add website</a>
</div>
<div class="card">
<div class="table-responsive">
<table class="table table-hover mb-0">
<thead>
<tr>
<th>Name</th>
<th>Primary URL</th>
<th>Status</th>
<th>Domains</th>
<th>Retention</th>
<th class="text-end">Actions</th>
</tr>
</thead>
<tbody>
<?php if ($websites === []): ?>
<tr><td colspan="6" class="text-center text-muted py-5">No websites have been added yet.</td></tr>
<?php endif; ?>
<?php foreach ($websites as $website): ?>
<tr>
<td><strong><?= e($website['name']) ?></strong><br><small class="text-muted"><?= e($website['public_id']) ?></small></td>
<td><a href="<?= e($website['primary_url']) ?>" rel="noreferrer" target="_blank"><?= e($website['primary_url']) ?></a></td>
<td><span class="badge text-bg-<?= $website['status'] === 'active' ? 'success' : ($website['status'] === 'disabled' ? 'warning' : 'secondary') ?>"><?= e($website['status']) ?></span></td>
<td><?= (int) $website['domain_count'] ?></td>
<td><?= (int) $website['retention_days'] ?> days</td>
<td class="text-end">
<a class="btn btn-sm btn-outline-primary" href="<?= e(app_url('admin/websites-view.php?id=' . (int) $website['id'])) ?>">View</a>
<a class="btn btn-sm btn-outline-secondary" href="<?= e(app_url('admin/websites-edit.php?id=' . (int) $website['id'])) ?>">Edit</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<?php require APP_ROOT . '/templates/admin_footer.php'; ?>