96 lines
5.2 KiB
PHP
96 lines
5.2 KiB
PHP
<?php require __DIR__ . '/../app/controllers/ViewController.php'; ?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>SafePaste — View</title>
|
|
<link rel="stylesheet" href="/assets/css/style.css">
|
|
</head>
|
|
<body>
|
|
<div class="page-wrapper">
|
|
<header class="site-header">
|
|
<a href="/" class="logo">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="2" width="6" height="4" rx="1"/><path d="M5 4h-1a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-1"/><path d="M9 12h6M9 16h4"/></svg>
|
|
SafePaste
|
|
</a>
|
|
<a href="/" class="btn-new-paste">+ New Paste</a>
|
|
</header>
|
|
|
|
<main class="main-card">
|
|
<?php if ($needsPassword): ?>
|
|
|
|
<div class="card-header">
|
|
<div class="lock-icon">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>
|
|
</div>
|
|
<h1>Password Required</h1>
|
|
<p>This paste is protected. Enter the password to view it.</p>
|
|
</div>
|
|
|
|
<form method="POST" action="<?= htmlspecialchars($_SERVER['REQUEST_URI']) ?>" class="password-form">
|
|
<?php if ($wrongPassword): ?>
|
|
<div class="alert alert-error">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
|
|
Incorrect password. Please try again.
|
|
</div>
|
|
<?php endif; ?>
|
|
<div class="field">
|
|
<input
|
|
type="password"
|
|
name="password"
|
|
class="input-password"
|
|
placeholder="Enter password..."
|
|
autofocus
|
|
autocomplete="current-password"
|
|
>
|
|
</div>
|
|
<button type="submit" class="btn-primary">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>
|
|
Unlock Paste
|
|
</button>
|
|
</form>
|
|
|
|
<?php else: ?>
|
|
|
|
<div class="paste-meta">
|
|
<?php if ($data['expire_time']): ?>
|
|
<span class="meta-badge">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
|
|
Expires <?= htmlspecialchars(date('M j, Y H:i', (int)$data['expire_time'])) ?>
|
|
</span>
|
|
<?php else: ?>
|
|
<span class="meta-badge">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg>
|
|
No expiry
|
|
</span>
|
|
<?php endif; ?>
|
|
<span class="meta-badge">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18M9 21V9"/></svg>
|
|
<?= number_format(mb_strlen($decrypted)) ?> chars
|
|
</span>
|
|
</div>
|
|
|
|
<div class="paste-box">
|
|
<div class="paste-toolbar">
|
|
<span class="paste-toolbar-title">Content</span>
|
|
<button id="copyBtn" class="btn-icon" title="Copy to clipboard">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
|
|
<span>Copy</span>
|
|
</button>
|
|
</div>
|
|
<pre id="pasteContent"><?= htmlspecialchars($decrypted) ?></pre>
|
|
</div>
|
|
|
|
<?php endif; ?>
|
|
</main>
|
|
|
|
<footer class="site-footer">
|
|
AES-256-CBC encrypted · Open source · No tracking
|
|
</footer>
|
|
</div>
|
|
|
|
<script src="/assets/js/app.js"></script>
|
|
</body>
|
|
</html>
|