Sindbad~EG File Manager
<?php
require_once '../config/config.php';
// Check if user is logged in
if (!isLoggedIn()) {
redirect('login.php');
}
$db = new Database();
$conn = $db->getConnection();
// Get current settings
$query = "SELECT setting_key, setting_value FROM settings WHERE setting_key IN ('site_title', 'site_logo', 'theme_primary_color', 'theme_secondary_color')";
$stmt = $conn->prepare($query);
$stmt->execute();
$settings = [];
while ($row = $stmt->fetch()) {
$settings[$row['setting_key']] = $row['setting_value'];
}
$test_results = [];
// Test 1: Check if uploads directory exists
$uploads_dir = '../uploads/logos/';
$test_results['uploads_directory'] = [
'name' => 'Uploads Directory',
'status' => is_dir($uploads_dir) ? 'PASS' : 'FAIL',
'message' => is_dir($uploads_dir) ? 'Directory exists and is writable' : 'Directory does not exist or is not writable'
];
// Test 2: Check if logo file exists
$current_logo = $settings['site_logo'] ?? 'assets/images/logo.png';
$logo_path = '../' . $current_logo;
$test_results['logo_file'] = [
'name' => 'Current Logo File',
'status' => file_exists($logo_path) ? 'PASS' : 'FAIL',
'message' => file_exists($logo_path) ? "Logo exists at: $current_logo" : "Logo not found at: $current_logo"
];
// Test 3: Check GD extension for image processing
$test_results['gd_extension'] = [
'name' => 'GD Extension',
'status' => extension_loaded('gd') ? 'PASS' : 'FAIL',
'message' => extension_loaded('gd') ? 'GD extension is loaded' : 'GD extension is not available'
];
// Test 4: Check file upload settings
$max_upload = ini_get('upload_max_filesize');
$max_post = ini_get('post_max_size');
$test_results['upload_settings'] = [
'name' => 'Upload Settings',
'status' => 'INFO',
'message' => "Max upload: $max_upload, Max post: $max_post"
];
// Test 5: Test image functions
$test_results['image_functions'] = [
'name' => 'Image Functions',
'status' => (function_exists('imagecreatefromjpeg') && function_exists('imagecreatefrompng')) ? 'PASS' : 'FAIL',
'message' => (function_exists('imagecreatefromjpeg') && function_exists('imagecreatefrompng')) ? 'Image functions available' : 'Image functions not available'
];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Logo Upload Test - Admin Panel</title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: '<?php echo $settings['theme_primary_color'] ?? '#3B82F6'; ?>',
secondary: '<?php echo $settings['theme_secondary_color'] ?? '#F59E0B'; ?>',
accent: '#6B7280'
}
}
}
}
</script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<style>
.gradient-bg {
background: linear-gradient(135deg, <?php echo $settings['theme_primary_color'] ?? '#3B82F6'; ?> 0%, <?php echo $settings['theme_secondary_color'] ?? '#F59E0B'; ?> 50%, #6B7280 100%);
}
</style>
</head>
<body class="bg-gray-50">
<!-- Include Sidebar -->
<?php include 'includes/sidebar.php'; ?>
<!-- Main Content -->
<div class="md:ml-64">
<!-- Header -->
<header class="bg-white shadow-sm border-b">
<div class="px-6 py-4">
<h1 class="text-2xl font-bold text-gray-900">Logo Upload System Test</h1>
</div>
</header>
<!-- Content -->
<main class="p-6">
<!-- Current Settings Display -->
<div class="bg-white rounded-lg shadow mb-6">
<div class="p-6 border-b border-gray-200">
<h2 class="text-lg font-semibold text-gray-900">Current Settings</h2>
</div>
<div class="p-6">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
<div class="text-center">
<h3 class="font-medium text-gray-900 mb-2">Site Title</h3>
<p class="text-sm text-gray-600"><?php echo htmlspecialchars($settings['site_title'] ?? 'Not Set'); ?></p>
</div>
<div class="text-center">
<h3 class="font-medium text-gray-900 mb-2">Current Logo</h3>
<?php if (file_exists($logo_path)): ?>
<img src="<?php echo htmlspecialchars($current_logo); ?>"
alt="Current Logo"
class="h-16 w-16 object-contain mx-auto border border-gray-300 rounded-lg bg-white p-2">
<?php else: ?>
<div class="h-16 w-16 mx-auto border border-gray-300 rounded-lg bg-gray-100 flex items-center justify-center">
<i class="fas fa-image text-gray-400"></i>
</div>
<?php endif; ?>
</div>
<div class="text-center">
<h3 class="font-medium text-gray-900 mb-2">Primary Color</h3>
<div class="flex items-center justify-center space-x-2">
<div class="w-8 h-8 rounded border" style="background-color: <?php echo $settings['theme_primary_color'] ?? '#3B82F6'; ?>"></div>
<span class="text-xs text-gray-600"><?php echo $settings['theme_primary_color'] ?? '#3B82F6'; ?></span>
</div>
</div>
<div class="text-center">
<h3 class="font-medium text-gray-900 mb-2">Secondary Color</h3>
<div class="flex items-center justify-center space-x-2">
<div class="w-8 h-8 rounded border" style="background-color: <?php echo $settings['theme_secondary_color'] ?? '#F59E0B'; ?>"></div>
<span class="text-xs text-gray-600"><?php echo $settings['theme_secondary_color'] ?? '#F59E0B'; ?></span>
</div>
</div>
</div>
</div>
</div>
<!-- System Tests -->
<div class="bg-white rounded-lg shadow">
<div class="p-6 border-b border-gray-200">
<h2 class="text-lg font-semibold text-gray-900">System Tests</h2>
<p class="text-sm text-gray-600 mt-1">Testing logo upload system components</p>
</div>
<div class="p-6">
<div class="space-y-4">
<?php foreach ($test_results as $test): ?>
<div class="flex items-center justify-between p-4 border border-gray-200 rounded-lg">
<div class="flex items-center space-x-3">
<div class="flex-shrink-0">
<?php if ($test['status'] === 'PASS'): ?>
<i class="fas fa-check-circle text-green-500 text-xl"></i>
<?php elseif ($test['status'] === 'FAIL'): ?>
<i class="fas fa-times-circle text-red-500 text-xl"></i>
<?php else: ?>
<i class="fas fa-info-circle text-blue-500 text-xl"></i>
<?php endif; ?>
</div>
<div>
<h3 class="font-medium text-gray-900"><?php echo $test['name']; ?></h3>
<p class="text-sm text-gray-600"><?php echo $test['message']; ?></p>
</div>
</div>
<div class="flex-shrink-0">
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium
<?php
if ($test['status'] === 'PASS') echo 'bg-green-100 text-green-800';
elseif ($test['status'] === 'FAIL') echo 'bg-red-100 text-red-800';
else echo 'bg-blue-100 text-blue-800';
?>">
<?php echo $test['status']; ?>
</span>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
<!-- Quick Actions -->
<div class="mt-6 flex flex-wrap gap-4">
<a href="settings.php" class="bg-primary text-white px-6 py-2 rounded-lg hover:bg-blue-700 transition duration-300">
<i class="fas fa-cog mr-2"></i>
Go to Settings
</a>
<button onclick="window.location.reload()" class="bg-gray-600 text-white px-6 py-2 rounded-lg hover:bg-gray-700 transition duration-300">
<i class="fas fa-refresh mr-2"></i>
Refresh Tests
</button>
<a href="dashboard.php" class="bg-secondary text-white px-6 py-2 rounded-lg hover:bg-yellow-600 transition duration-300">
<i class="fas fa-dashboard mr-2"></i>
Back to Dashboard
</a>
</div>
</main>
</div>
</body>
</html>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists