Sindbad~EG File Manager
<?php
/**
* Add New Modules to Sidebar
* Adds Member Codes and Events modules to module_management table
*/
require_once '../config/config.php';
try {
$db = Database::getInstance()->getConnection();
echo "<h2>Adding New Modules to Sidebar</h2>\n";
// Check if modules already exist
$stmt = $db->prepare("SELECT COUNT(*) as count FROM module_management WHERE module_url IN ('modules/membership/codes.php', 'modules/events/index.php')");
$stmt->execute();
$existingCount = $stmt->fetch()['count'];
if ($existingCount > 0) {
echo "<p style='color: orange;'>⚠️ Some modules already exist. Skipping duplicates.</p>\n";
}
// Get current max display order
$stmt = $db->query("SELECT MAX(display_order) as max_order FROM module_management");
$maxOrder = $stmt->fetch()['max_order'] ?? 0;
// Add Member Codes module (under Membership)
$stmt = $db->prepare("
INSERT IGNORE INTO module_management (
module_name, module_url, module_icon, display_order, is_active, created_at
) VALUES (?, ?, ?, ?, 1, NOW())
");
// Member Codes
$stmt->execute([
'Member Codes',
'modules/membership/codes.php',
'qrcode',
$maxOrder + 1
]);
if ($stmt->rowCount() > 0) {
echo "<p style='color: green;'>✅ Added Member Codes module</p>\n";
}
// Events Management
$stmt->execute([
'Events',
'modules/events/index.php',
'calendar-alt',
$maxOrder + 2
]);
if ($stmt->rowCount() > 0) {
echo "<p style='color: green;'>✅ Added Events module</p>\n";
}
// Show all current modules
echo "<h3>Current Modules in Sidebar:</h3>\n";
$stmt = $db->query("SELECT * FROM module_management ORDER BY display_order");
$modules = $stmt->fetchAll();
echo "<table border='1' cellpadding='5' cellspacing='0'>";
echo "<tr><th>Name</th><th>URL</th><th>Icon</th><th>Order</th><th>Active</th></tr>";
foreach ($modules as $module) {
echo "<tr>";
echo "<td>" . htmlspecialchars($module['module_name']) . "</td>";
echo "<td>" . htmlspecialchars($module['module_url']) . "</td>";
echo "<td><i class='fas fa-" . htmlspecialchars($module['module_icon']) . "'></i> " . htmlspecialchars($module['module_icon']) . "</td>";
echo "<td>" . $module['display_order'] . "</td>";
echo "<td>" . ($module['is_active'] ? 'Yes' : 'No') . "</td>";
echo "</tr>";
}
echo "</table>";
echo "<p style='color: green;'>✅ Modules added successfully!</p>\n";
} catch (PDOException $e) {
echo "<p style='color: red;'>❌ Error: " . htmlspecialchars($e->getMessage()) . "</p>\n";
}
echo "<hr>";
echo "<p><a href='../dashboard.php'>← Back to Dashboard</a></p>";
?>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists