Sindbad~EG File Manager
<?php
header('Content-Type: application/json');
require_once '../config/config.php';
require_once '../classes/EmailService.php';
// Check if user is logged in and has proper access
if (!isLoggedIn()) {
http_response_code(401);
echo json_encode(['error' => 'Unauthorized']);
exit;
}
if (!isSuperuser() && getAccessLevel() !== 'area') {
http_response_code(403);
echo json_encode(['error' => 'Insufficient permissions']);
exit;
}
$action = $_GET['action'] ?? '';
$emailService = new EmailService();
try {
switch ($action) {
case 'stats':
$stats = $emailService->getEmailStats();
echo json_encode(['success' => true, 'stats' => $stats]);
break;
case 'queue':
$limit = intval($_GET['limit'] ?? 20);
$emails = $emailService->getRecentEmails($limit);
echo json_encode(['success' => true, 'emails' => $emails]);
break;
case 'process':
// Manual processing trigger
$processed = $emailService->processPendingEmails(10);
echo json_encode(['success' => true, 'processed' => $processed]);
break;
case 'test_connection':
// Test email configuration
if ($emailService->isEnabled()) {
echo json_encode(['success' => true, 'message' => 'Email system is enabled and configured']);
} else {
echo json_encode(['success' => false, 'message' => 'Email system is disabled']);
}
break;
default:
http_response_code(400);
echo json_encode(['error' => 'Invalid action']);
break;
}
} catch (Exception $e) {
http_response_code(500);
echo json_encode(['error' => 'Server error: ' . $e->getMessage()]);
}
?>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists