63 lines
4.2 KiB
PHP
63 lines
4.2 KiB
PHP
<div class="page-header">
|
|
<h1><?= $t['settings'] ?? 'Settings' ?></h1>
|
|
</div>
|
|
|
|
<?php if ($flashSuccess = $this->session->getFlash('success')): ?>
|
|
<div class="alert alert-success"><span><?= $this->escape($flashSuccess) ?></span></div>
|
|
<?php endif; ?>
|
|
<?php if ($flashError = $this->session->getFlash('error')): ?>
|
|
<div class="alert alert-error"><span><?= $this->escape($flashError) ?></span></div>
|
|
<?php endif; ?>
|
|
|
|
<div class="detail-grid">
|
|
<!-- Telegram Settings -->
|
|
<div class="glass-panel">
|
|
<h3 style="margin-bottom: 20px;">
|
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" style="vertical-align: middle; margin-right: 8px; color: #229ED9;"><path d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"/></svg>
|
|
<?= $t['telegram_notifications'] ?? 'Telegram Notifications' ?>
|
|
</h3>
|
|
<form action="/admin/settings/save" method="POST" class="form-stacked">
|
|
<input type="hidden" name="_csrf" value="<?= $this->session->getCsrfToken() ?>">
|
|
|
|
<div class="form-group">
|
|
<label class="form-label"><?= $t['telegram_bot_token'] ?? 'Bot Token' ?></label>
|
|
<input type="text" name="telegram_bot_token" class="form-control" value="<?= $this->escape($tg_token) ?>" placeholder="123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11">
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="form-label"><?= $t['telegram_chat_id'] ?? 'Chat ID' ?></label>
|
|
<input type="text" name="telegram_chat_id" class="form-control" value="<?= $this->escape($tg_chat_id) ?>" placeholder="-1001234567890">
|
|
<small style="color: var(--text-muted); font-size: 0.8rem; margin-top: 4px; display: block;">
|
|
<?= $t['telegram_chat_id_hint'] ?? 'Note: For Telegram channels/groups, you must add the bot as an Administrator with post permissions.' ?>
|
|
</small>
|
|
</div>
|
|
<div class="form-group" style="display: flex; align-items: center; gap: 10px;">
|
|
<label class="form-label" style="margin: 0;"><?= $t['telegram_enabled'] ?? 'Enable' ?></label>
|
|
<input type="checkbox" name="telegram_enabled" value="1" <?= $tg_enabled === '1' ? 'checked' : '' ?> style="width: 20px; height: 20px;">
|
|
</div>
|
|
<div style="display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap;">
|
|
<button type="submit" name="action" value="save" class="btn btn-primary"><?= $t['save'] ?? 'Save' ?></button>
|
|
<button type="submit" name="action" value="test" class="btn btn-secondary"><?= $t['test_notification'] ?? 'Send Test' ?></button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- Help Info -->
|
|
<div class="glass-panel">
|
|
<h3 style="margin-bottom: 16px;">How to set up Telegram</h3>
|
|
<ol style="line-height: 2; padding-left: 20px; color: var(--text-muted);">
|
|
<li>Create a bot via <a href="https://t.me/BotFather" target="_blank">@BotFather</a> on Telegram</li>
|
|
<li>Copy the bot token (e.g., <code>123456:ABC-DEF1234ghIkl</code>)</li>
|
|
<li>Add the bot to your group/channel</li>
|
|
<li>Send any message in the group</li>
|
|
<li>Visit <code>https://api.telegram.org/bot<TOKEN>/getUpdates</code></li>
|
|
<li>Copy your Chat ID from the response</li>
|
|
<li>Click "Send Test" to verify</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
|
|
<style>
|
|
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
|
|
.form-stacked { display: flex; flex-direction: column; gap: 16px; }
|
|
@media (max-width: 768px) { .detail-grid { grid-template-columns: 1fr; } }
|
|
</style>
|