diff --git a/admin.php b/admin.php
index 670eb6e..83cf318 100644
--- a/admin.php
+++ b/admin.php
@@ -23,53 +23,6 @@ try {
$page = $_GET['page'] ?? 'dashboard';
$action = $_GET['action'] ?? '';
-// Handle Profile Update
-if ($_SERVER['REQUEST_METHOD'] === 'POST' && $page === 'profile') {
- $name = $_POST['name'] ?? '';
- $description = $_POST['description'] ?? '';
-
- $logo_path = get_platform_profile()['logo_path'] ?? '';
- $favicon_path = get_platform_profile()['favicon_path'] ?? '';
-
- $upload_dir = __DIR__ . '/assets/images/uploads/';
- if (!is_dir($upload_dir)) {
- mkdir($upload_dir, 0777, true);
- }
-
- if (!empty($_FILES['logo']['tmp_name'])) {
- $filename = 'logo_' . time() . '_' . basename($_FILES['logo']['name']);
- $target = $upload_dir . $filename;
- if (move_uploaded_file($_FILES['logo']['tmp_name'], $target)) {
- $logo_path = 'assets/images/uploads/' . $filename;
- }
- }
-
- if (!empty($_FILES['favicon']['tmp_name'])) {
- $filename = 'favicon_' . time() . '_' . basename($_FILES['favicon']['name']);
- $target = $upload_dir . $filename;
- if (move_uploaded_file($_FILES['favicon']['tmp_name'], $target)) {
- $favicon_path = 'assets/images/uploads/' . $filename;
- }
- }
-
- $ctr_no = $_POST['ctr_no'] ?? '';
- $telephone_no = $_POST['telephone_no'] ?? '';
- $email_id = $_POST['email_id'] ?? '';
-
- $stmt = db()->prepare("UPDATE platform_profile SET name = :name, description = :description, logo_path = :logo, favicon_path = :favicon, ctr_no = :ctr_no, telephone_no = :telephone_no, email_id = :email_id WHERE id = 1");
- $stmt->execute([
- 'name' => $name,
- 'description' => $description,
- 'logo' => $logo_path,
- 'favicon' => $favicon_path,
- 'ctr_no' => $ctr_no,
- 'telephone_no' => $telephone_no,
- 'email_id' => $email_id
- ]);
-
- header('Location: ' . app_url('admin.php', ['page' => 'profile', 'saved' => 1]));
- exit;
-}
$metrics = subscription_metrics();
$recent = fetch_recent_subscriptions();
@@ -109,7 +62,9 @@ render_head(
= h(t('Admin', 'المدير')) ?>
+
- = h(t('Platform Profile', 'ملف المنصة')) ?>
+
- = h(t('View Site', 'عرض الموقع')) ?>
- = h(t('Logout', 'تسجيل خروج')) ?>
@@ -212,6 +167,7 @@ render_head(
-
-
-
-
- = h(t('Profile updated successfully.', 'تم تحديث الملف بنجاح.')) ?>
-
-
-
-
+
+
diff --git a/admin_profile.php b/admin_profile.php
new file mode 100644
index 0000000..14e7a6d
--- /dev/null
+++ b/admin_profile.php
@@ -0,0 +1,119 @@
+prepare("UPDATE platform_profile SET name = :name, description = :description, logo_path = :logo, favicon_path = :favicon, ctr_no = :ctr_no, telephone_no = :telephone_no, email_id = :email_id WHERE id = 1");
+ $stmt->execute([
+ 'name' => $name,
+ 'description' => $description,
+ 'logo' => $logo_path,
+ 'favicon' => $favicon_path,
+ 'ctr_no' => $ctr_no,
+ 'telephone_no' => $telephone_no,
+ 'email_id' => $email_id
+ ]);
+
+ header('Location: ' . app_url('admin.php', ['page' => 'profile', 'saved' => 1]));
+ exit;
+}
+
+$prof = get_platform_profile();
+?>
+
+
+ = h(t('Profile updated successfully.', 'تم تحديث الملف بنجاح.')) ?>
+
+
+
+
diff --git a/admin_roles.php b/admin_roles.php
index b99ab3d..b0d25af 100644
--- a/admin_roles.php
+++ b/admin_roles.php
@@ -28,6 +28,7 @@ $pages = [
'roles' => t('Role Groups', 'مجموعات الصلاحيات'),
'integrations' => t('Integrations', 'عمليات الربط'),
'landing' => t('Landing Page', 'الصفحة الرئيسية'),
+ 'profile' => t('Platform Profile', 'ملف المنصة'),
];
$action = $_GET['action'] ?? 'list';
diff --git a/includes/app.php b/includes/app.php
index f20cc43..d285399 100644
--- a/includes/app.php
+++ b/includes/app.php
@@ -621,15 +621,29 @@ if (!empty($prof['favicon_path'])):
function nav_items(): array
{
- return [
+ $items = [
'index.php' => t('Home', 'الرئيسية'),
'catalog.php' => t('Subjects', 'المواد'),
'courses.php' => t('Courses', 'الدورات'),
'pricing.php' => t('Plans', 'الخطط'),
- 'dashboard.php' => t('Student', 'الطالب'),
- 'teacher.php' => t('Teacher', 'المعلم'),
- 'admin.php' => t('Admin', 'الإدارة'),
];
+
+ if (!empty($_SESSION['user_id'])) {
+ $stmt = db()->prepare("SELECT role FROM users WHERE id = ?");
+ $stmt->execute([$_SESSION['user_id']]);
+ $user = $stmt->fetch(PDO::FETCH_ASSOC);
+ if ($user) {
+ if ($user['role'] === 'student') {
+ $items['dashboard.php'] = t('Student', 'الطالب');
+ } elseif ($user['role'] === 'teacher') {
+ $items['teacher.php'] = t('Teacher', 'المعلم');
+ } elseif ($user['role'] === 'admin') {
+ $items['admin.php'] = t('Admin', 'الإدارة');
+ }
+ }
+ }
+
+ return $items;
}
function render_nav(string $active = ''): void