/
var
/
www
/
vhosts
/
m-auto.co
/
httpdocs
/
admin
/
/var/www/vhosts/m-auto.co/httpdocs/admin
mkdir
upload
Name
Size
Mode
Actions
assets/
-
0755
rm
includes/
-
0755
rm
7-6-2026.zip
10206
0644
edit
dl
rm
about_edit.php
3899
0644
edit
dl
rm
about_process.php
1367
0644
edit
dl
rm
auth.php
684
0644
edit
dl
rm
bookings.php
5367
0644
edit
dl
rm
booking_delete.php
924
0644
edit
dl
rm
branches.php
2470
0644
edit
dl
rm
branch_delete.php
1290
0644
edit
dl
rm
branch_form.php
4694
0644
edit
dl
rm
branch_process.php
1233
0644
edit
dl
rm
brands.php
2578
0644
edit
dl
rm
brand_delete.php
1327
0644
edit
dl
rm
brand_form.php
2369
0644
edit
dl
rm
brand_process.php
1660
0644
edit
dl
rm
cars.php
6946
0644
edit
dl
rm
car_delete.php
2886
0644
edit
dl
rm
car_form.php
40348
0644
edit
dl
rm
car_image_actions.php
5142
0644
edit
dl
rm
car_process.php
10426
0644
edit
dl
rm
categories.php
2167
0644
edit
dl
rm
category_delete.php
746
0644
edit
dl
rm
category_form.php
1607
0644
edit
dl
rm
category_process.php
943
0644
edit
dl
rm
dashboard.php
4965
0644
edit
dl
rm
index.php
2713
0644
edit
dl
rm
login_process.php
1532
0644
edit
dl
rm
logout.php
100
0644
edit
dl
rm
news.php
3448
0644
edit
dl
rm
news_delete.php
771
0644
edit
dl
rm
news_form.php
6769
0644
edit
dl
rm
news_process.php
2527
0644
edit
dl
rm
offers.php
2810
0644
edit
dl
rm
offer_delete.php
1327
0644
edit
dl
rm
offer_form.php
4573
0644
edit
dl
rm
offer_process.php
2115
0644
edit
dl
rm
settings.php
5217
0644
edit
dl
rm
settings_process.php
692
0644
edit
dl
rm
slider.php
3529
0644
edit
dl
rm
slider_delete.php
1345
0644
edit
dl
rm
slider_form.php
4529
0644
edit
dl
rm
slider_process.php
1983
0644
edit
dl
rm
themes.php
4703
0644
edit
dl
rm
theme_delete.php
1332
0644
edit
dl
rm
theme_form.php
1522
0644
edit
dl
rm
theme_process.php
1785
0644
edit
dl
rm
users.php
4480
0644
edit
dl
rm
user_delete.php
1055
0644
edit
dl
rm
user_form.php
5463
0644
edit
dl
rm
user_process.php
3193
0644
edit
dl
rm
videos.php
4942
0644
edit
dl
rm
video_delete.php
1717
0644
edit
dl
rm
video_form.php
7181
0644
edit
dl
rm
video_process.php
3336
0644
edit
dl
rm
Edit:
/var/www/vhosts/m-auto.co/httpdocs/admin/themes.php
(4703B)
<?php include 'includes/header.php'; if (!has_permission('themes_view')) { echo "<div class='alert alert-danger'>ليس لديك الصلاحية لعرض هذه الصفحة.</div>"; include 'includes/footer.php'; exit; } $activeCount = 0; $activeResult = $conn->query("SELECT COUNT(*) AS total FROM `themes` WHERE `is_active` = 1"); if ($activeResult) { $activeRow = $activeResult->fetch_assoc(); if ($activeRow) { $activeCount = (int) $activeRow['total']; } } $defaultThemes = [ ['name' => 'الثيم الافتراضي', 'css_file' => 'style.css'], ['name' => 'ثيم الكريسماس', 'css_file' => 'christmas.css'], ['name' => 'ثيم رمضان', 'css_file' => 'ramadan.css'], ['name' => 'ثيم نصر أكتوبر', 'css_file' => 'october_war.css'], ['name' => 'ثيم عيد الفطر', 'css_file' => 'eid_al_fitr.css'], ['name' => 'ثيم عيد الأضحى', 'css_file' => 'eid_al_adha.css'] ]; foreach ($defaultThemes as $defaultTheme) { $existingStmt = $conn->prepare("SELECT `id`, `name` FROM `themes` WHERE `css_file` = ? LIMIT 1"); $existingStmt->bind_param('s', $defaultTheme['css_file']); $existingStmt->execute(); $existingResult = $existingStmt->get_result(); $existingTheme = $existingResult ? $existingResult->fetch_assoc() : null; if ($existingTheme) { if ($existingTheme['name'] !== $defaultTheme['name']) { $updateStmt = $conn->prepare("UPDATE `themes` SET `name` = ? WHERE `id` = ?"); $updateStmt->bind_param('si', $defaultTheme['name'], $existingTheme['id']); $updateStmt->execute(); } } else { $isActive = $defaultTheme['css_file'] === 'style.css' && $activeCount === 0 ? 1 : 0; $insertStmt = $conn->prepare("INSERT INTO `themes` (`name`, `css_file`, `is_active`) VALUES (?, ?, ?)"); $insertStmt->bind_param('ssi', $defaultTheme['name'], $defaultTheme['css_file'], $isActive); $insertStmt->execute(); if ($isActive === 1) { $activeCount = 1; } } } // Handle theme activation if (isset($_GET['activate']) && is_numeric($_GET['activate'])) { $theme_id = $_GET['activate']; // Deactivate all themes $conn->query("UPDATE `themes` SET `is_active` = 0"); // Activate the selected theme $stmt = $conn->prepare("UPDATE `themes` SET `is_active` = 1 WHERE `id` = ?"); $stmt->bind_param('i', $theme_id); $stmt->execute(); // Update the active_theme setting $stmt = $conn->prepare("UPDATE `settings` SET `setting_value` = ? WHERE `setting_key` = 'active_theme'"); $stmt->bind_param('s', $theme_id); $stmt->execute(); echo "<div class='alert alert-success'>تم تفعيل الثيم بنجاح.</div>"; } // Fetch all themes $result = $conn->query("SELECT * FROM `themes`"); $themes = $result->fetch_all(MYSQLI_ASSOC); ?> <div class="container-fluid"> <h1 class="mt-4">إدارة الثيمات</h1> <a href="theme_form.php" class="btn btn-success mb-3">إضافة ثيم جديد</a> <table class="table table-bordered"> <thead> <tr> <th>اسم الثيم</th> <th>ملف الـ CSS</th> <th>الحالة</th> <th>إجراءات</th> </tr> </thead> <tbody> <?php foreach ($themes as $theme): ?> <tr> <td><?php echo htmlspecialchars($theme['name']); ?></td> <td><?php echo htmlspecialchars($theme['css_file']); ?></td> <td> <?php if ($theme['is_active']): ?> <span class="badge bg-success">نشط</span> <?php else: ?> <span class="badge bg-secondary">غير نشط</span> <?php endif; ?> </td> <td> <?php if (!$theme['is_active']): ?> <a href="themes.php?activate=<?php echo $theme['id']; ?>" class="btn btn-primary btn-sm">تفعيل</a> <?php endif; ?> <a href="theme_form.php?id=<?php echo $theme['id']; ?>" class="btn btn-warning btn-sm">تعديل</a> <a href="theme_delete.php?id=<?php echo $theme['id']; ?>" class="btn btn-danger btn-sm" onclick="return confirm('هل أنت متأكد من رغبتك في حذف هذا الثيم؟');">حذف</a> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> <?php include 'includes/footer.php'; ?>
Save
cmd:
run