Autosave: 20260406-053702
This commit is contained in:
parent
22c2a878c1
commit
420d607cdd
30
admin.php
30
admin.php
@ -104,11 +104,6 @@ render_head(
|
||||
<?= h(t('Dashboard', 'لوحة القيادة')) ?>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="<?= h(app_url('admin.php', ['page' => 'profile'])) ?>" class="nav-link <?= $page === 'profile' ? 'active' : 'link-dark' ?>" <?= $page === 'profile' ? 'style="background-color: var(--accent); color: white;"' : '' ?>>
|
||||
<?= h(t('Platform Profile', 'ملف المنصة')) ?>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= h(app_url('admin.php', ['page' => 'classes'])) ?>" class="nav-link <?= $page === 'classes' ? 'active' : 'link-dark' ?>" <?= $page === 'classes' ? 'style="background-color: var(--accent); color: white;"' : '' ?>>
|
||||
<?= h(t('Classes', 'الصفوف')) ?>
|
||||
@ -134,6 +129,29 @@ render_head(
|
||||
<?= h(t('Teachers', 'المعلمون')) ?>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= h(app_url('admin.php', ['page' => 'assignments'])) ?>" class="nav-link <?= $page === 'assignments' ? 'active' : 'link-dark' ?>" <?= $page === 'assignments' ? 'style="background-color: var(--accent); color: white;"' : '' ?> >
|
||||
<?= h(t('Assignments', 'التعيينات')) ?>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item w-100 mt-2 d-none d-md-block">
|
||||
<div class="text-uppercase text-secondary fw-bold px-3 py-1" style="font-size: 0.75rem; letter-spacing: 0.5px;"><?= h(t('Settings', 'الإعدادات')) ?></div>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="<?= h(app_url('admin.php', ['page' => 'profile'])) ?>" class="nav-link <?= $page === 'profile' ? 'active' : 'link-dark' ?>" <?= $page === 'profile' ? 'style="background-color: var(--accent); color: white;"' : '' ?>>
|
||||
<?= h(t('Platform Profile', 'ملف المنصة')) ?>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item w-100 mt-2 d-none d-md-block">
|
||||
<div class="text-uppercase text-secondary fw-bold px-3 py-1" style="font-size: 0.75rem; letter-spacing: 0.5px;"><?= h(t('Integrations', 'التكاملات')) ?></div>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="<?= h(app_url('admin.php', ['page' => 'integrations'])) ?>" class="nav-link <?= $page === 'integrations' ? 'active' : 'link-dark' ?>" <?= $page === 'integrations' ? 'style="background-color: var(--accent); color: white;"' : '' ?> >
|
||||
<?= h(t('All Integrations', 'كل التكاملات')) ?>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</aside>
|
||||
@ -246,6 +264,8 @@ render_head(
|
||||
<?php require_once __DIR__ . '/admin_subjects.php'; ?>
|
||||
<?php elseif ($page === 'teachers'): ?>
|
||||
<?php require_once __DIR__ . '/admin_teachers.php'; ?>
|
||||
<?php elseif ($page === 'integrations'): ?>
|
||||
<?php require_once __DIR__ . '/admin_integrations.php'; ?>
|
||||
<?php else: ?>
|
||||
<div class="section-header mb-4">
|
||||
<div>
|
||||
|
||||
250
admin_assignments.php
Normal file
250
admin_assignments.php
Normal file
@ -0,0 +1,250 @@
|
||||
<?php
|
||||
// admin_assignments.php
|
||||
require_once __DIR__ . '/includes/app.php';
|
||||
|
||||
// Initialize table if not exists
|
||||
db()->exec("CREATE TABLE IF NOT EXISTS teacher_assignments (
|
||||
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||
teacher_id INT NOT NULL,
|
||||
class_id INT NOT NULL,
|
||||
subject_id INT NOT NULL DEFAULT 0,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE KEY unique_assignment (teacher_id, class_id, subject_id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
|
||||
|
||||
$action = $_GET['action'] ?? 'list';
|
||||
$id = (int)($_GET['id'] ?? 0);
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$post_action = $_POST['action'] ?? $action;
|
||||
$post_id = (int)($_POST['id'] ?? $id);
|
||||
|
||||
if ($post_action === 'delete' && $post_id > 0) {
|
||||
$stmt = db()->prepare("DELETE FROM teacher_assignments WHERE id = ?");
|
||||
$stmt->execute([$post_id]);
|
||||
header('Location: ' . app_url('admin.php', ['page' => 'assignments']));
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($post_action === 'add') {
|
||||
$teacher_id = (int)($_POST['teacher_id'] ?? 0);
|
||||
$class_id = (int)($_POST['class_id'] ?? 0);
|
||||
$subject_id = (int)($_POST['subject_id'] ?? 0);
|
||||
|
||||
if ($teacher_id > 0 && $class_id > 0) {
|
||||
try {
|
||||
$stmt = db()->prepare("INSERT INTO teacher_assignments (teacher_id, class_id, subject_id) VALUES (?, ?, ?)");
|
||||
$stmt->execute([$teacher_id, $class_id, $subject_id]);
|
||||
} catch (PDOException $e) {
|
||||
// Ignore duplicate key error
|
||||
}
|
||||
}
|
||||
header('Location: ' . app_url('admin.php', ['page' => 'assignments']));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch all for dropdowns
|
||||
$teachers = db()->query("SELECT id, name FROM teachers ORDER BY name")->fetchAll(PDO::FETCH_ASSOC);
|
||||
$classes = db()->query("SELECT id, name_en, name_ar FROM classes ORDER BY name_en")->fetchAll(PDO::FETCH_ASSOC);
|
||||
$subjects = db()->query("SELECT id, title_en, title_ar, class_id FROM subjects ORDER BY title_en")->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
// Fetch assignments for table
|
||||
$search = $_GET['search'] ?? '';
|
||||
$page_num = max(1, (int)($_GET['p'] ?? 1));
|
||||
$limit = 10;
|
||||
$offset = ($page_num - 1) * $limit;
|
||||
|
||||
$where = "";
|
||||
$params = [];
|
||||
if ($search !== '') {
|
||||
$where = "WHERE t.name LIKE ? OR c.name_en LIKE ? OR s.title_en LIKE ?";
|
||||
$params[] = "%$search%";
|
||||
$params[] = "%$search%";
|
||||
$params[] = "%$search%";
|
||||
}
|
||||
|
||||
$count_sql = "
|
||||
SELECT COUNT(*)
|
||||
FROM teacher_assignments ta
|
||||
JOIN teachers t ON ta.teacher_id = t.id
|
||||
JOIN classes c ON ta.class_id = c.id
|
||||
LEFT JOIN subjects s ON ta.subject_id = s.id
|
||||
$where
|
||||
";
|
||||
$total_stmt = db()->prepare($count_sql);
|
||||
$total_stmt->execute($params);
|
||||
$total = $total_stmt->fetchColumn();
|
||||
$pages = ceil($total / $limit);
|
||||
|
||||
$sql = "
|
||||
SELECT ta.id, t.name as teacher_name, c.name_en as class_name_en, c.name_ar as class_name_ar, s.title_en as subject_title_en, s.title_ar as subject_title_ar, ta.subject_id
|
||||
FROM teacher_assignments ta
|
||||
JOIN teachers t ON ta.teacher_id = t.id
|
||||
JOIN classes c ON ta.class_id = c.id
|
||||
LEFT JOIN subjects s ON ta.subject_id = s.id
|
||||
$where
|
||||
ORDER BY ta.id DESC
|
||||
LIMIT $limit OFFSET $offset
|
||||
";
|
||||
$stmt = db()->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
$items = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
?>
|
||||
<div class="section-header mb-4 d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<h1 class="section-title mb-2"><?= h(t('Teacher Assignments', 'تعيينات المعلمين')) ?></h1>
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#addAssignmentModal" style="background-color: var(--accent); border-color: var(--accent);">+ <?= h(t('Add Assignment', 'إضافة تعيين')) ?></button>
|
||||
</div>
|
||||
|
||||
<div class="panel-card mb-4">
|
||||
<form method="get" class="d-flex gap-2 align-items-center">
|
||||
<input type="hidden" name="page" value="assignments">
|
||||
<input type="text" name="search" class="form-control w-auto" placeholder="<?= h(t('Search...', 'بحث...')) ?>" value="<?= h($search) ?>">
|
||||
<button type="submit" class="btn btn-outline-secondary"><?= h(t('Filter', 'تصفية')) ?></button>
|
||||
<?php if ($search): ?>
|
||||
<a href="<?= h(app_url('admin.php', ['page'=>'assignments'])) ?>" class="btn btn-link text-secondary text-decoration-none"><?= h(t('Clear', 'مسح')) ?></a>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="panel-card">
|
||||
<div class="table-responsive">
|
||||
<table class="table align-middle dashboard-table mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= h(t('Teacher', 'المعلم')) ?></th>
|
||||
<th><?= h(t('Class', 'الصف')) ?></th>
|
||||
<th><?= h(t('Subject', 'المادة')) ?></th>
|
||||
<th><?= h(t('Actions', 'إجراءات')) ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if(empty($items)): ?>
|
||||
<tr>
|
||||
<td colspan="4" class="text-center text-muted py-4"><?= h(t('No assignments found.', 'لا توجد تعيينات.')) ?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php foreach($items as $row): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="fw-semibold"><?= h($row['teacher_name']) ?></div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="text-secondary"><?= h(current_lang() === 'ar' ? $row['class_name_ar'] : $row['class_name_en']) ?></div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="text-secondary">
|
||||
<?php if ($row['subject_id'] > 0): ?>
|
||||
<?= h(current_lang() === 'ar' ? $row['subject_title_ar'] : $row['subject_title_en']) ?>
|
||||
<?php else: ?>
|
||||
<span class="badge bg-secondary"><?= h(t('All Subjects', 'كل المواد')) ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<form method="post" action="<?= h(app_url('admin.php', ['page'=>'assignments'])) ?>" style="display:inline;" onsubmit="return confirm('<?= h(t('Are you sure you want to remove this assignment?', 'هل أنت متأكد من إزالة هذا التعيين؟')) ?>');">
|
||||
<input type="hidden" name="action" value="delete">
|
||||
<input type="hidden" name="id" value="<?= h((string)$row['id']) ?>">
|
||||
<button type="submit" class="btn btn-sm btn-outline-danger">
|
||||
<?= h(t('Remove', 'إزالة')) ?>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($pages > 1): ?>
|
||||
<nav class="mt-4">
|
||||
<ul class="pagination pagination-sm">
|
||||
<?php for ($i = 1; $i <= $pages; $i++): ?>
|
||||
<li class="page-item <?= $i === $page_num ? 'active' : '' ?>">
|
||||
<a class="page-link" href="<?= h(app_url('admin.php', ['page'=>'assignments', 'p'=>$i, 'search'=>$search])) ?>">
|
||||
<?= $i ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endfor; ?>
|
||||
</ul>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Add Assignment Modal -->
|
||||
<div class="modal fade" id="addAssignmentModal" tabindex="-1" aria-labelledby="addAssignmentModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content border-0 shadow">
|
||||
<div class="modal-header border-0 bg-dark-blue">
|
||||
<h5 class="modal-title section-title text-white" id="addAssignmentModalLabel"><?= h(t('Add Assignment', 'إضافة تعيين')) ?></h5>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form method="post" action="<?= h(app_url('admin.php', ['page'=>'assignments'])) ?>">
|
||||
<input type="hidden" name="action" value="add">
|
||||
<div class="mb-3">
|
||||
<label class="form-label"><?= h(t('Teacher', 'المعلم')) ?></label>
|
||||
<select name="teacher_id" class="form-select" required>
|
||||
<option value=""><?= h(t('Select a teacher...', 'اختر معلماً...')) ?></option>
|
||||
<?php foreach($teachers as $t): ?>
|
||||
<option value="<?= h((string)$t['id']) ?>"><?= h($t['name']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label"><?= h(t('Class', 'الصف')) ?></label>
|
||||
<select name="class_id" id="classSelect" class="form-select" required onchange="filterSubjects()">
|
||||
<option value=""><?= h(t('Select a class...', 'اختر صفاً...')) ?></option>
|
||||
<?php foreach($classes as $c): ?>
|
||||
<option value="<?= h((string)$c['id']) ?>"><?= h(current_lang() === 'ar' ? $c['name_ar'] : $c['name_en']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="form-label"><?= h(t('Subject (Optional)', 'المادة (اختياري)')) ?></label>
|
||||
<select name="subject_id" id="subjectSelect" class="form-select">
|
||||
<option value="0" class="default-opt"><?= h(t('All Subjects / Not Specified', 'كل المواد / غير محدد')) ?></option>
|
||||
<?php foreach($subjects as $s): ?>
|
||||
<option value="<?= h((string)$s['id']) ?>" data-class-id="<?= h((string)$s['class_id']) ?>" style="display:none;">
|
||||
<?= h(current_lang() === 'ar' ? $s['title_ar'] : $s['title_en']) ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<small class="text-muted d-block mt-1"><?= h(t('Select a class first to view its specific subjects.', 'اختر الصف أولاً لرؤية مواده المحددة.')) ?></small>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-end gap-2">
|
||||
<button type="button" class="btn btn-light" data-bs-dismiss="modal"><?= h(t('Cancel', 'إلغاء')) ?></button>
|
||||
<button type="submit" class="btn btn-primary" style="background-color: var(--accent); border-color: var(--accent);"><?= h(t('Save', 'حفظ')) ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function filterSubjects() {
|
||||
var classId = document.getElementById('classSelect').value;
|
||||
var subjectSelect = document.getElementById('subjectSelect');
|
||||
var options = subjectSelect.getElementsByTagName('option');
|
||||
|
||||
// reset selection to default
|
||||
subjectSelect.value = "0";
|
||||
|
||||
for (var i = 0; i < options.length; i++) {
|
||||
var opt = options[i];
|
||||
if (opt.classList.contains('default-opt')) continue;
|
||||
|
||||
if (opt.getAttribute('data-class-id') === classId && classId !== "") {
|
||||
opt.style.display = '';
|
||||
} else {
|
||||
opt.style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -112,9 +112,9 @@ $items = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
<div class="modal fade" id="editClassModal<?= $row['id'] ?>" tabindex="-1" aria-labelledby="editClassModalLabel<?= $row['id'] ?>" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content border-0 shadow">
|
||||
<div class="modal-header border-0 pb-0">
|
||||
<div class="modal-header border-0 bg-dark-blue">
|
||||
<h5 class="modal-title section-title" id="editClassModalLabel<?= $row['id'] ?>"><?= h(t('Edit Class', 'تعديل الصف')) ?></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form method="post" action="<?= h(app_url('admin.php', ['page'=>'classes'])) ?>">
|
||||
@ -172,9 +172,9 @@ $items = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
<div class="modal fade" id="addClassModal" tabindex="-1" aria-labelledby="addClassModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content border-0 shadow">
|
||||
<div class="modal-header border-0 pb-0">
|
||||
<div class="modal-header border-0 bg-dark-blue">
|
||||
<h5 class="modal-title section-title" id="addClassModalLabel"><?= h(t('Add Class', 'إضافة صف')) ?></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form method="post" action="<?= h(app_url('admin.php', ['page'=>'classes'])) ?>">
|
||||
|
||||
256
admin_integrations.php
Normal file
256
admin_integrations.php
Normal file
@ -0,0 +1,256 @@
|
||||
<?php
|
||||
// admin_integrations.php
|
||||
if (!isset($pdo)) {
|
||||
$pdo = db();
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action'])) {
|
||||
if ($_POST['action'] === 'save_wablas') {
|
||||
$domain = $_POST['wablas_domain'] ?? '';
|
||||
$token = $_POST['wablas_token'] ?? '';
|
||||
$security_key = $_POST['wablas_security_key'] ?? '';
|
||||
|
||||
$stmt = $pdo->prepare("UPDATE platform_profile SET wablas_domain = :domain, wablas_token = :token, wablas_security_key = :security_key WHERE id = 1");
|
||||
$stmt->execute([
|
||||
'domain' => $domain,
|
||||
'token' => $token,
|
||||
'security_key' => $security_key
|
||||
]);
|
||||
|
||||
header('Location: ' . app_url('admin.php', ['page' => 'integrations', 'tab' => 'wablas', 'saved' => 1]));
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($_POST['action'] === 'save_thawani') {
|
||||
$secret = $_POST['thawani_secret_key'] ?? '';
|
||||
$publishable = $_POST['thawani_publishable_key'] ?? '';
|
||||
$mode = $_POST['thawani_mode'] ?? 'test';
|
||||
|
||||
$stmt = $pdo->prepare("UPDATE platform_profile SET thawani_secret_key = :secret, thawani_publishable_key = :publishable, thawani_mode = :mode WHERE id = 1");
|
||||
$stmt->execute([
|
||||
'secret' => $secret,
|
||||
'publishable' => $publishable,
|
||||
'mode' => $mode
|
||||
]);
|
||||
|
||||
header('Location: ' . app_url('admin.php', ['page' => 'integrations', 'tab' => 'thawani', 'saved' => 1]));
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($_POST['action'] === 'save_smtp') {
|
||||
$smtp_host = $_POST['smtp_host'] ?? '';
|
||||
$smtp_port = $_POST['smtp_port'] ?? '';
|
||||
$smtp_secure = $_POST['smtp_secure'] ?? '';
|
||||
$smtp_user = $_POST['smtp_user'] ?? '';
|
||||
$smtp_pass = $_POST['smtp_pass'] ?? '';
|
||||
$smtp_from_email = $_POST['smtp_from_email'] ?? '';
|
||||
$smtp_from_name = $_POST['smtp_from_name'] ?? '';
|
||||
|
||||
$stmt = $pdo->prepare("UPDATE platform_profile SET
|
||||
smtp_host = :smtp_host,
|
||||
smtp_port = :smtp_port,
|
||||
smtp_secure = :smtp_secure,
|
||||
smtp_user = :smtp_user,
|
||||
smtp_pass = :smtp_pass,
|
||||
smtp_from_email = :smtp_from_email,
|
||||
smtp_from_name = :smtp_from_name
|
||||
WHERE id = 1");
|
||||
|
||||
$stmt->execute([
|
||||
'smtp_host' => $smtp_host,
|
||||
'smtp_port' => $smtp_port,
|
||||
'smtp_secure' => $smtp_secure,
|
||||
'smtp_user' => $smtp_user,
|
||||
'smtp_pass' => $smtp_pass,
|
||||
'smtp_from_email' => $smtp_from_email,
|
||||
'smtp_from_name' => $smtp_from_name
|
||||
]);
|
||||
|
||||
header('Location: ' . app_url('admin.php', ['page' => 'integrations', 'tab' => 'smtp', 'saved' => 1]));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$stmt = $pdo->query("SELECT * FROM platform_profile WHERE id = 1");
|
||||
$prof = $stmt->fetch(PDO::FETCH_ASSOC) ?: [];
|
||||
$thawani_mode = $prof['thawani_mode'] ?? 'test';
|
||||
$smtp_secure = $prof['smtp_secure'] ?? 'tls';
|
||||
|
||||
$active_tab = $_GET['tab'] ?? 'wablas';
|
||||
?>
|
||||
|
||||
<div class="section-header mb-4">
|
||||
<div>
|
||||
<span class="eyebrow"><?= h(t('Settings', 'الإعدادات')) ?></span>
|
||||
<h1 class="section-title mb-2"><?= h(t('All Integrations', 'كل التكاملات')) ?></h1>
|
||||
<p class="text-secondary mb-0"><?= h(t('Manage your gateway and email configurations here.', 'قم بإدارة إعدادات البوابات والبريد الإلكتروني هنا.')) ?></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($_GET['saved'])): ?>
|
||||
<div class="alert alert-success"><?= h(t('Settings updated successfully.', 'تم تحديث الإعدادات بنجاح.')) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="panel-card p-0 mb-4">
|
||||
<div class="card-header bg-white border-bottom pt-3 pb-0 px-4">
|
||||
<ul class="nav nav-tabs border-bottom-0" id="integrationsTabs" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link <?= $active_tab === 'wablas' ? 'active text-primary fw-bold' : 'text-secondary' ?>" id="wablas-tab" data-bs-toggle="tab" data-bs-target="#wablas-pane" type="button" role="tab" style="<?= $active_tab === 'wablas' ? 'border-bottom: 2px solid var(--accent); color: var(--accent) !important;' : '' ?>">
|
||||
<?= h(t('Wablas', 'Wablas')) ?>
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link <?= $active_tab === 'thawani' ? 'active text-primary fw-bold' : 'text-secondary' ?>" id="thawani-tab" data-bs-toggle="tab" data-bs-target="#thawani-pane" type="button" role="tab" style="<?= $active_tab === 'thawani' ? 'border-bottom: 2px solid var(--accent); color: var(--accent) !important;' : '' ?>">
|
||||
<?= h(t('Thawani', 'Thawani')) ?>
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link <?= $active_tab === 'smtp' ? 'active text-primary fw-bold' : 'text-secondary' ?>" id="smtp-tab" data-bs-toggle="tab" data-bs-target="#smtp-pane" type="button" role="tab" style="<?= $active_tab === 'smtp' ? 'border-bottom: 2px solid var(--accent); color: var(--accent) !important;' : '' ?>">
|
||||
<?= h(t('SMTP Mail', 'بريد SMTP')) ?>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card-body p-4">
|
||||
<div class="tab-content" id="integrationsTabsContent">
|
||||
|
||||
<!-- WABLAS TAB -->
|
||||
<div class="tab-pane fade <?= $active_tab === 'wablas' ? 'show active' : '' ?>" id="wablas-pane" role="tabpanel">
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="save_wablas">
|
||||
<div class="row">
|
||||
<div class="col-md-6 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="col-md-6 mb-3">
|
||||
<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="col-md-12 mb-4">
|
||||
<label class="form-label fw-medium"><?= h(t('Security Key', 'مفتاح الأمان')) ?></label>
|
||||
<input type="password" name="wablas_security_key" class="form-control" value="<?= h($prof['wablas_security_key'] ?? '') ?>" placeholder="Your Wablas Security Key">
|
||||
</div>
|
||||
</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 Wablas Settings', 'حفظ إعدادات Wablas')) ?>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- THAWANI TAB -->
|
||||
<div class="tab-pane fade <?= $active_tab === 'thawani' ? 'show active' : '' ?>" id="thawani-pane" role="tabpanel">
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="save_thawani">
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label fw-medium"><?= h(t('Secret Key', 'المفتاح السري')) ?></label>
|
||||
<input type="password" name="thawani_secret_key" class="form-control" value="<?= h($prof['thawani_secret_key'] ?? '') ?>" placeholder="sk_...">
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label fw-medium"><?= h(t('Publishable Key', 'المفتاح القابل للنشر')) ?></label>
|
||||
<input type="text" name="thawani_publishable_key" class="form-control" value="<?= h($prof['thawani_publishable_key'] ?? '') ?>" placeholder="pk_...">
|
||||
</div>
|
||||
<div class="col-md-12 mb-4">
|
||||
<label class="form-label fw-medium"><?= h(t('Mode', 'الوضع')) ?></label>
|
||||
<select name="thawani_mode" class="form-select">
|
||||
<option value="test" <?= $thawani_mode === 'test' ? 'selected' : '' ?>><?= h(t('Test Mode', 'وضع الاختبار')) ?></option>
|
||||
<option value="live" <?= $thawani_mode === 'live' ? 'selected' : '' ?>><?= h(t('Live Mode', 'الوضع الحي')) ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</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 Thawani Settings', 'حفظ إعدادات Thawani')) ?>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- SMTP TAB -->
|
||||
<div class="tab-pane fade <?= $active_tab === 'smtp' ? 'show active' : '' ?>" id="smtp-pane" role="tabpanel">
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="save_smtp">
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label fw-medium"><?= h(t('SMTP Host', 'خادم SMTP')) ?></label>
|
||||
<input type="text" name="smtp_host" class="form-control" value="<?= h($prof['smtp_host'] ?? '') ?>" placeholder="e.g. smtp.example.com">
|
||||
</div>
|
||||
<div class="col-md-3 mb-3">
|
||||
<label class="form-label fw-medium"><?= h(t('SMTP Port', 'منفذ SMTP')) ?></label>
|
||||
<input type="text" name="smtp_port" class="form-control" value="<?= h($prof['smtp_port'] ?? '587') ?>" placeholder="587">
|
||||
</div>
|
||||
<div class="col-md-3 mb-3">
|
||||
<label class="form-label fw-medium"><?= h(t('Encryption', 'التشفير')) ?></label>
|
||||
<select name="smtp_secure" class="form-select">
|
||||
<option value="tls" <?= $smtp_secure === 'tls' ? 'selected' : '' ?>>TLS</option>
|
||||
<option value="ssl" <?= $smtp_secure === 'ssl' ? 'selected' : '' ?>>SSL</option>
|
||||
<option value="" <?= $smtp_secure === '' ? 'selected' : '' ?>><?= h(t('None', 'لا يوجد')) ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label fw-medium"><?= h(t('SMTP Username', 'اسم المستخدم (SMTP)')) ?></label>
|
||||
<input type="text" name="smtp_user" class="form-control" value="<?= h($prof['smtp_user'] ?? '') ?>" placeholder="user@example.com">
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label fw-medium"><?= h(t('SMTP Password', 'كلمة المرور (SMTP)')) ?></label>
|
||||
<input type="password" name="smtp_pass" class="form-control" value="<?= h($prof['smtp_pass'] ?? '') ?>" placeholder="••••••••">
|
||||
</div>
|
||||
<div class="col-md-6 mb-4">
|
||||
<label class="form-label fw-medium"><?= h(t('From Email', 'البريد الإلكتروني للمرسل')) ?></label>
|
||||
<input type="email" name="smtp_from_email" class="form-control" value="<?= h($prof['smtp_from_email'] ?? '') ?>" placeholder="noreply@example.com">
|
||||
</div>
|
||||
<div class="col-md-6 mb-4">
|
||||
<label class="form-label fw-medium"><?= h(t('From Name', 'اسم المرسل')) ?></label>
|
||||
<input type="text" name="smtp_from_name" class="form-control" value="<?= h($prof['smtp_from_name'] ?? '') ?>" placeholder="My Platform">
|
||||
</div>
|
||||
</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 SMTP Settings', 'حفظ إعدادات SMTP')) ?>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Simple script to update URL when tabs are clicked so refresh keeps the same tab active
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const tabs = document.querySelectorAll('button[data-bs-toggle="tab"]');
|
||||
tabs.forEach(tab => {
|
||||
tab.addEventListener('shown.bs.tab', function (event) {
|
||||
const targetId = event.target.id;
|
||||
let tabName = 'wablas';
|
||||
if (targetId === 'thawani-tab') tabName = 'thawani';
|
||||
if (targetId === 'smtp-tab') tabName = 'smtp';
|
||||
|
||||
// Update URL parameter without reloading
|
||||
const url = new URL(window.location);
|
||||
url.searchParams.set('tab', tabName);
|
||||
|
||||
// Remove 'saved' parameter to clear alert on tab switch
|
||||
url.searchParams.delete('saved');
|
||||
window.history.replaceState({}, '', url);
|
||||
|
||||
// Update styling logic manually to match inline active styles
|
||||
tabs.forEach(t => {
|
||||
t.style.borderBottom = '';
|
||||
t.style.setProperty('color', 'var(--bs-secondary)', 'important');
|
||||
t.classList.remove('text-primary', 'fw-bold');
|
||||
t.classList.add('text-secondary');
|
||||
});
|
||||
|
||||
event.target.style.borderBottom = '2px solid var(--accent)';
|
||||
event.target.style.setProperty('color', 'var(--accent)', 'important');
|
||||
event.target.classList.remove('text-secondary');
|
||||
event.target.classList.add('text-primary', 'fw-bold');
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@ -160,9 +160,9 @@ $items = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
<div class="modal fade" id="editSubjectModal<?= $row['id'] ?>" tabindex="-1" aria-labelledby="editSubjectModalLabel<?= $row['id'] ?>" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered">
|
||||
<div class="modal-content border-0 shadow">
|
||||
<div class="modal-header border-0 pb-0">
|
||||
<div class="modal-header border-0 bg-dark-blue">
|
||||
<h5 class="modal-title section-title" id="editSubjectModalLabel<?= $row['id'] ?>"><?= h(t('Edit Subject', 'تعديل المادة')) ?></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form method="post" action="<?= h(app_url('admin.php', ['page'=>'subjects'])) ?>">
|
||||
@ -241,9 +241,9 @@ $items = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
<div class="modal fade" id="addSubjectModal" tabindex="-1" aria-labelledby="addSubjectModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered">
|
||||
<div class="modal-content border-0 shadow">
|
||||
<div class="modal-header border-0 pb-0">
|
||||
<div class="modal-header border-0 bg-dark-blue">
|
||||
<h5 class="modal-title section-title" id="addSubjectModalLabel"><?= h(t('Add Subject', 'إضافة مادة')) ?></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form method="post" action="<?= h(app_url('admin.php', ['page'=>'subjects'])) ?>">
|
||||
|
||||
@ -159,9 +159,9 @@ $items = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
<div class="modal fade" id="editTeacherModal<?= $row['id'] ?>" tabindex="-1" aria-labelledby="editTeacherModalLabel<?= $row['id'] ?>" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content border-0 shadow">
|
||||
<div class="modal-header border-0 pb-0">
|
||||
<div class="modal-header border-0 bg-dark-blue">
|
||||
<h5 class="modal-title section-title" id="editTeacherModalLabel<?= $row['id'] ?>"><?= h(t('Edit Teacher', 'تعديل المعلم')) ?></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form method="post" enctype="multipart/form-data" action="<?= h(app_url('admin.php', ['page'=>'teachers'])) ?>">
|
||||
@ -237,9 +237,9 @@ $items = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
<div class="modal fade" id="addTeacherModal" tabindex="-1" aria-labelledby="addTeacherModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content border-0 shadow">
|
||||
<div class="modal-header border-0 pb-0">
|
||||
<div class="modal-header border-0 bg-dark-blue">
|
||||
<h5 class="modal-title section-title" id="addTeacherModalLabel"><?= h(t('Add Teacher', 'إضافة معلم')) ?></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form method="post" enctype="multipart/form-data" action="<?= h(app_url('admin.php', ['page'=>'teachers'])) ?>">
|
||||
|
||||
64
admin_thawani.php
Normal file
64
admin_thawani.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
// admin_thawani.php
|
||||
if (!isset($pdo)) {
|
||||
$pdo = db();
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'save_thawani') {
|
||||
$secret = $_POST['thawani_secret_key'] ?? '';
|
||||
$publishable = $_POST['thawani_publishable_key'] ?? '';
|
||||
$mode = $_POST['thawani_mode'] ?? 'test';
|
||||
|
||||
$stmt = $pdo->prepare("UPDATE platform_profile SET thawani_secret_key = :secret, thawani_publishable_key = :publishable, thawani_mode = :mode WHERE id = 1");
|
||||
$stmt->execute([
|
||||
'secret' => $secret,
|
||||
'publishable' => $publishable,
|
||||
'mode' => $mode
|
||||
]);
|
||||
|
||||
header('Location: ' . app_url('admin.php', ['page' => 'thawani', 'saved' => 1]));
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt = $pdo->query("SELECT thawani_secret_key, thawani_publishable_key, thawani_mode FROM platform_profile WHERE id = 1");
|
||||
$prof = $stmt->fetch(PDO::FETCH_ASSOC) ?: [];
|
||||
$mode = $prof['thawani_mode'] ?? 'test';
|
||||
?>
|
||||
|
||||
<div class="section-header mb-4">
|
||||
<div>
|
||||
<span class="eyebrow"><?= h(t('Integrations', 'التكاملات')) ?></span>
|
||||
<h1 class="section-title mb-2"><?= h(t('Thawani Gateway', 'بوابة Thawani')) ?></h1>
|
||||
<p class="text-secondary mb-0"><?= h(t('Configure your Thawani payment gateway settings.', 'قم بتكوين إعدادات بوابة الدفع Thawani.')) ?></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($_GET['saved'])): ?>
|
||||
<div class="alert alert-success"><?= h(t('Thawani settings updated successfully.', 'تم تحديث إعدادات Thawani بنجاح.')) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="panel-card" style="max-width: 600px;">
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="save_thawani">
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-medium"><?= h(t('Secret Key', 'المفتاح السري')) ?></label>
|
||||
<input type="password" name="thawani_secret_key" class="form-control" value="<?= h($prof['thawani_secret_key'] ?? '') ?>" placeholder="sk_...">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-medium"><?= h(t('Publishable Key', 'المفتاح القابل للنشر')) ?></label>
|
||||
<input type="text" name="thawani_publishable_key" class="form-control" value="<?= h($prof['thawani_publishable_key'] ?? '') ?>" placeholder="pk_...">
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label class="form-label fw-medium"><?= h(t('Mode', 'الوضع')) ?></label>
|
||||
<select name="thawani_mode" class="form-select">
|
||||
<option value="test" <?= $mode === 'test' ? 'selected' : '' ?>><?= h(t('Test Mode', 'وضع الاختبار')) ?></option>
|
||||
<option value="live" <?= $mode === 'live' ? 'selected' : '' ?>><?= h(t('Live Mode', 'الوضع الحي')) ?></option>
|
||||
</select>
|
||||
</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>
|
||||
54
admin_wablas.php
Normal file
54
admin_wablas.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?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>
|
||||
@ -454,3 +454,16 @@ footer {
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Modal dark blue header */
|
||||
.modal-header.bg-dark-blue {
|
||||
background-color: #1e3a8a;
|
||||
color: #ffffff;
|
||||
border-top-left-radius: calc(var(--bs-modal-border-radius, .5rem) - 1px);
|
||||
border-top-right-radius: calc(var(--bs-modal-border-radius, .5rem) - 1px);
|
||||
}
|
||||
.modal-header.bg-dark-blue .modal-title,
|
||||
.modal-header.bg-dark-blue .section-title {
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
@ -54,6 +54,24 @@ $dkim_domain = env_val('DKIM_DOMAIN');
|
||||
$dkim_selector = env_val('DKIM_SELECTOR');
|
||||
$dkim_private_key_path = env_val('DKIM_PRIVATE_KEY_PATH');
|
||||
|
||||
// Also override with platform_profile if set
|
||||
try {
|
||||
require_once __DIR__ . '/../includes/app.php';
|
||||
$pdo_mail = db();
|
||||
$stmt_mail = $pdo_mail->query("SELECT smtp_host, smtp_port, smtp_secure, smtp_user, smtp_pass, smtp_from_email, smtp_from_name FROM platform_profile WHERE id = 1");
|
||||
if ($prof_mail = $stmt_mail->fetch(PDO::FETCH_ASSOC)) {
|
||||
if (!empty($prof_mail['smtp_host'])) $smtp_host = $prof_mail['smtp_host'];
|
||||
if (!empty($prof_mail['smtp_port'])) $smtp_port = (int)$prof_mail['smtp_port'];
|
||||
if (!empty($prof_mail['smtp_secure'])) $smtp_secure = $prof_mail['smtp_secure'];
|
||||
if (!empty($prof_mail['smtp_user'])) $smtp_user = $prof_mail['smtp_user'];
|
||||
if (!empty($prof_mail['smtp_pass'])) $smtp_pass = $prof_mail['smtp_pass'];
|
||||
if (!empty($prof_mail['smtp_from_email'])) $from_email = $prof_mail['smtp_from_email'];
|
||||
if (!empty($prof_mail['smtp_from_name'])) $from_name = $prof_mail['smtp_from_name'];
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
return [
|
||||
'transport' => $transport,
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user