Sindbad~EG File Manager
<?php
session_start();
require_once '../config/database.php';
require_once '../includes/functions.php';
if (!isset($_SESSION['user_id'])) {
header('Location: ../login.php');
exit();
}
// Check permission for settings access
if (!checkPermission('admin') && $_SESSION['user_level'] !== 'superuser') {
header('Location: ' . $_SESSION['user_level'] . '.php?error=access_denied');
exit();
}
$page_title = 'Settings';
$page_description = 'System configuration and management';
$success_message = '';
$error_message = '';
// Handle form submissions
if ($_POST) {
if (isset($_POST['update_site_settings'])) {
$site_title = sanitizeInput($_POST['site_title']);
$footer_title = sanitizeInput($_POST['footer_title']);
if (updateSetting('site_title', $site_title) && updateSetting('footer_title', $footer_title)) {
logAudit('UPDATE', 'settings', null, null, ['site_title' => $site_title, 'footer_title' => $footer_title]);
$success_message = 'Site settings updated successfully.';
} else {
$error_message = 'Failed to update site settings.';
}
}
}
// Get current settings
$site_title = getSetting('site_title', 'COP Madina Area Reports');
$footer_title = getSetting('footer_title', '© 2024 The Church of Pentecost - Madina Area');
$theme = getSetting('theme', 'blue-gradient');
$logo_path = getSetting('logo_path', 'assets/images/logo.png');
include '../includes/header.php';
?>
<?php if ($success_message): ?>
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded-lg mb-6 alert-auto-hide">
<div class="flex items-center">
<i class="fas fa-check-circle mr-2"></i>
<span><?php echo htmlspecialchars($success_message); ?></span>
</div>
</div>
<?php endif; ?>
<?php if ($error_message): ?>
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-lg mb-6 alert-auto-hide">
<div class="flex items-center">
<i class="fas fa-exclamation-circle mr-2"></i>
<span><?php echo htmlspecialchars($error_message); ?></span>
</div>
</div>
<?php endif; ?>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<!-- Site Settings -->
<div class="lg:col-span-2">
<div class="bg-white rounded-lg shadow-sm mb-8">
<div class="p-6 border-b border-gray-200">
<h3 class="text-lg font-semibold text-gray-800">Site Settings</h3>
<p class="text-gray-600 text-sm">Configure basic site information</p>
</div>
<div class="p-6">
<form method="POST" action="" class="space-y-6">
<div>
<label for="site_title" class="block text-sm font-medium text-gray-700 mb-2">
Site Title
</label>
<input type="text"
id="site_title"
name="site_title"
required
class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-cop-blue focus:border-transparent"
value="<?php echo htmlspecialchars($site_title); ?>">
</div>
<div>
<label for="footer_title" class="block text-sm font-medium text-gray-700 mb-2">
Footer Title
</label>
<input type="text"
id="footer_title"
name="footer_title"
required
class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-cop-blue focus:border-transparent"
value="<?php echo htmlspecialchars($footer_title); ?>">
</div>
<div class="flex justify-end">
<button type="submit"
name="update_site_settings"
class="bg-cop-blue text-white px-6 py-3 rounded-lg hover:bg-cop-light-blue transition duration-200">
<i class="fas fa-save mr-2"></i>Update Settings
</button>
</div>
</form>
</div>
</div>
<!-- System Management -->
<div class="bg-white rounded-lg shadow-sm">
<div class="p-6 border-b border-gray-200">
<h3 class="text-lg font-semibold text-gray-800">System Management</h3>
<p class="text-gray-600 text-sm">Backup, restore, and maintenance tools</p>
</div>
<div class="p-6">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="bg-blue-50 rounded-lg p-4">
<div class="flex items-center mb-3">
<i class="fas fa-database text-blue-600 text-xl mr-3"></i>
<h4 class="font-medium text-gray-800">Database Backup</h4>
</div>
<p class="text-sm text-gray-600 mb-4">Create a backup of the database</p>
<button class="w-full px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition duration-200">
<i class="fas fa-download mr-2"></i>Create Backup
</button>
</div>
<div class="bg-green-50 rounded-lg p-4">
<div class="flex items-center mb-3">
<i class="fas fa-upload text-green-600 text-xl mr-3"></i>
<h4 class="font-medium text-gray-800">Database Restore</h4>
</div>
<p class="text-sm text-gray-600 mb-4">Restore from backup file</p>
<button class="w-full px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition duration-200">
<i class="fas fa-upload mr-2"></i>Restore Backup
</button>
</div>
</div>
</div>
</div>
</div>
<!-- Quick Actions -->
<div class="bg-white rounded-lg shadow-sm">
<div class="p-6 border-b border-gray-200">
<h3 class="text-lg font-semibold text-gray-800">Quick Actions</h3>
</div>
<div class="p-6 space-y-4">
<a href="profile.php" class="flex items-center p-3 bg-gray-50 rounded-lg hover:bg-gray-100 transition duration-200">
<i class="fas fa-user text-gray-600 mr-3"></i>
<span class="font-medium text-gray-800">Profile Settings</span>
</a>
<a href="notifications.php" class="flex items-center p-3 bg-gray-50 rounded-lg hover:bg-gray-100 transition duration-200">
<i class="fas fa-bell text-gray-600 mr-3"></i>
<span class="font-medium text-gray-800">Notifications</span>
</a>
<a href="maintenance.php" class="flex items-center p-3 bg-gray-50 rounded-lg hover:bg-gray-100 transition duration-200">
<i class="fas fa-tools text-gray-600 mr-3"></i>
<span class="font-medium text-gray-800">System Maintenance</span>
</a>
<?php if ($_SESSION['user_role'] === 'admin' || $_SESSION['user_level'] === 'superuser'): ?>
<a href="user-management.php" class="flex items-center p-3 bg-gray-50 rounded-lg hover:bg-gray-100 transition duration-200">
<i class="fas fa-users-cog text-gray-600 mr-3"></i>
<span class="font-medium text-gray-800">User Management</span>
</a>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php include '../includes/footer.php'; ?>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists