55 lines
2.4 KiB
PHP
55 lines
2.4 KiB
PHP
<?php
|
|
// admin_wablas.php
|
|
if (!isset($pdo)) {
|
|
$pdo = db();
|
|
}
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'save_wablas') {
|
|
$domain = $_POST['wablas_domain'] ?? '';
|
|
$token = $_POST['wablas_token'] ?? '';
|
|
|
|
$stmt = $pdo->prepare("UPDATE platform_profile SET wablas_domain = :domain, wablas_token = :token WHERE id = 1");
|
|
$stmt->execute([
|
|
'domain' => $domain,
|
|
'token' => $token
|
|
]);
|
|
|
|
header('Location: ' . app_url('admin.php', ['page' => 'wablas', 'saved' => 1]));
|
|
exit;
|
|
}
|
|
|
|
$stmt = $pdo->query("SELECT wablas_domain, wablas_token FROM platform_profile WHERE id = 1");
|
|
$prof = $stmt->fetch(PDO::FETCH_ASSOC) ?: [];
|
|
?>
|
|
|
|
<div class="section-header mb-4">
|
|
<div>
|
|
<span class="eyebrow"><?= h(t('Integrations', 'التكاملات')) ?></span>
|
|
<h1 class="section-title mb-2"><?= h(t('Wablas Gateway', 'بوابة Wablas')) ?></h1>
|
|
<p class="text-secondary mb-0"><?= h(t('Configure your Wablas WhatsApp gateway settings.', 'قم بتكوين إعدادات بوابة Wablas لرسائل الواتساب.')) ?></p>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if (!empty($_GET['saved'])): ?>
|
|
<div class="alert alert-success"><?= h(t('Wablas settings updated successfully.', 'تم تحديث إعدادات Wablas بنجاح.')) ?></div>
|
|
<?php endif; ?>
|
|
|
|
<div class="panel-card" style="max-width: 600px;">
|
|
<form method="post">
|
|
<input type="hidden" name="action" value="save_wablas">
|
|
<div class="mb-3">
|
|
<label class="form-label fw-medium"><?= h(t('Wablas Domain / URL', 'نطاق Wablas / الرابط')) ?></label>
|
|
<input type="text" name="wablas_domain" class="form-control" value="<?= h($prof['wablas_domain'] ?? '') ?>" placeholder="e.g. https://solo.wablas.com">
|
|
</div>
|
|
<div class="mb-4">
|
|
<label class="form-label fw-medium"><?= h(t('API Token', 'رمز API')) ?></label>
|
|
<input type="password" name="wablas_token" class="form-control" value="<?= h($prof['wablas_token'] ?? '') ?>" placeholder="Your Wablas API token">
|
|
</div>
|
|
<div class="d-flex justify-content-end">
|
|
<button type="submit" class="btn btn-primary px-4" style="background-color: var(--accent); border-color: var(--accent);">
|
|
<?= h(t('Save Settings', 'حفظ الإعدادات')) ?>
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|