v2
This commit is contained in:
parent
c993331930
commit
c5ff318833
39
i18n.php
Normal file
39
i18n.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// Supported languages
|
||||||
|
$supported_langs = ['en', 'ar', 'fr'];
|
||||||
|
$default_lang = 'ar';
|
||||||
|
|
||||||
|
// Get language from query string or session
|
||||||
|
$lang_code = isset($_GET['lang']) && in_array($_GET['lang'], $supported_langs) ? $_GET['lang'] : ($default_lang);
|
||||||
|
|
||||||
|
// Store in session
|
||||||
|
if (isset($_GET['lang']) && in_array($_GET['lang'], $supported_langs)) {
|
||||||
|
$_SESSION['lang'] = $_GET['lang'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set current language from session or default
|
||||||
|
$current_lang = isset($_SESSION['lang']) && in_array($_SESSION['lang'], $supported_langs) ? $_SESSION['lang'] : $default_lang;
|
||||||
|
|
||||||
|
// Load language file
|
||||||
|
$lang_file = __DIR__ . '/lang/' . $current_lang . '.php';
|
||||||
|
if (file_exists($lang_file)) {
|
||||||
|
require_once $lang_file;
|
||||||
|
} else {
|
||||||
|
// Fallback to default language if file not found
|
||||||
|
require_once __DIR__ . '/lang/' . $default_lang . '.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Translation function
|
||||||
|
function t($key) {
|
||||||
|
global $lang;
|
||||||
|
return $lang[$key] ?? $key;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function to get current language direction (for CSS)
|
||||||
|
function get_lang_dir() {
|
||||||
|
global $current_lang;
|
||||||
|
return ($current_lang === 'ar') ? 'rtl' : 'ltr';
|
||||||
|
}
|
||||||
|
?>
|
||||||
58
index.php
58
index.php
@ -1,25 +1,34 @@
|
|||||||
|
<?php require_once 'i18n.php'; ?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="ar" dir="rtl">
|
<html lang="<?php echo $current_lang; ?>" dir="<?php echo get_lang_dir(); ?>">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>مساعد البريد الذكي</title>
|
<title><?php echo t('dashboard'); ?></title>
|
||||||
<meta name="description" content="تطبيق داخلي لمدير المدرسة يقرأ الإيميلات ويقترح ردودًا. Built with Flatlogic Generator.">
|
<meta name="description" content="تطبيق داخلي لمدير المدرسة يقرأ الإيميلات ويقترح ردودًا. Built with Flatlogic Generator.">
|
||||||
<meta name="keywords" content="إدارة المدرسة, مساعد بريد, ذكاء اصطناعي, ردود تلقائية, تنظيم الايميلات, التعليم, إدارة, إنتاجية, Built with Flatlogic Generator">
|
<meta name="keywords" content="إدارة المدرسة, مساعد بريد, ذكاء اصطناعي, ردود تلقائية, تنظيم الايميلات, التعليم, إدارة, إنتاجية, Built with Flatlogic Generator">
|
||||||
<meta property="og:title" content="مساعد البريد الذكي">
|
<meta property="og:title" content="<?php echo t('dashboard'); ?>">
|
||||||
<meta property="og:description" content="تطبيق داخلي لمدير المدرسة يقرأ الإيميلات ويقترح ردودًا. Built with Flatlogic Generator.">
|
<meta property="og:description" content="تطبيق داخلي لمدير المدرسة يقرأ الإيميلات ويقترح ردودًا. Built with Flatlogic Generator.">
|
||||||
<meta property="og:image" content="">
|
<meta property="og:image" content="">
|
||||||
<meta name="twitter:card" content="summary_large_image">
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
<meta name="twitter:image" content="">
|
<meta name="twitter:image" content="">
|
||||||
|
|
||||||
<!-- Bootstrap 5 RTL -->
|
<!-- Bootstrap 5 -->
|
||||||
|
<?php if (get_lang_dir() === 'rtl'): ?>
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.rtl.min.css" rel="stylesheet" integrity="sha384-nU14brUcp6StFntEOOEBvcJm4huWjB0OcIeQ3fltAfSmuZFrkAif0T+UtNGlKKQv" crossorigin="anonymous">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.rtl.min.css" rel="stylesheet" integrity="sha384-nU14brUcp6StFntEOOEBvcJm4huWjB0OcIeQ3fltAfSmuZFrkAif0T+UtNGlKKQv" crossorigin="anonymous">
|
||||||
|
<?php else: ?>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||||
|
<?php endif; ?>
|
||||||
<!-- Bootstrap Icons -->
|
<!-- Bootstrap Icons -->
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
|
||||||
<!-- Google Fonts (Tajawal) -->
|
<!-- Google Fonts (Tajawal for Arabic, Poppins for LTR) -->
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<?php if (get_lang_dir() === 'rtl'): ?>
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap" rel="stylesheet">
|
||||||
|
<?php else: ?>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap" rel="stylesheet">
|
||||||
|
<?php endif; ?>
|
||||||
<!-- Custom CSS -->
|
<!-- Custom CSS -->
|
||||||
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
</head>
|
</head>
|
||||||
@ -29,20 +38,21 @@
|
|||||||
<header class="row border-bottom py-2">
|
<header class="row border-bottom py-2">
|
||||||
<div class="col d-flex align-items-center">
|
<div class="col d-flex align-items-center">
|
||||||
<i class="bi bi-robot fs-3 text-primary me-3"></i>
|
<i class="bi bi-robot fs-3 text-primary me-3"></i>
|
||||||
<h4 class="mb-0">مساعد البريد الذكي</h4>
|
<h4 class="mb-0"><?php echo t('dashboard'); ?></h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto d-flex align-items-center">
|
<div class="col-auto d-flex align-items-center">
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<button class="btn btn-outline-secondary dropdown-toggle" type="button" id="langDropdown" data-bs-toggle="dropdown" aria-expanded="false">
|
<button class="btn btn-outline-secondary dropdown-toggle" type="button" id="langDropdown" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
<i class="bi bi-translate me-1"></i> العربية
|
<i class="bi bi-translate me-1"></i> <?php echo t('language'); ?>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu" aria-labelledby="langDropdown">
|
<ul class="dropdown-menu" aria-labelledby="langDropdown">
|
||||||
<li><a class="dropdown-item active" href="#">العربية</a></li>
|
<li><a class="dropdown-item <?php if($current_lang == 'ar') echo 'active'; ?>" href="?lang=ar"><?php echo t('arabic'); ?></a></li>
|
||||||
<li><a class="dropdown-item" href="#">English</a></li>
|
<li><a class="dropdown-item <?php if($current_lang == 'en') echo 'active'; ?>" href="?lang=en"><?php echo t('english'); ?></a></li>
|
||||||
|
<li><a class="dropdown-item <?php if($current_lang == 'fr') echo 'active'; ?>" href="?lang=fr"><?php echo t('french'); ?></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<a href="manual_email.php" class="btn btn-outline-primary ms-2"><i class="bi bi-plus-circle me-1"></i> إدخال يدوي</a>
|
<a href="manual_email.php" class="btn btn-outline-primary ms-2"><i class="bi bi-plus-circle me-1"></i> <?php echo t('manual_entry'); ?></a>
|
||||||
<a href="settings.php" class="btn btn-light ms-2" title="الإعدادات"><i class="bi bi-gear"></i></a>
|
<a href="settings.php" class="btn btn-light ms-2" title="<?php echo t('settings'); ?>"><i class="bi bi-gear"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
@ -51,7 +61,7 @@
|
|||||||
<div id="email-list-col" class="col-md-3 border-end p-0 d-flex flex-column">
|
<div id="email-list-col" class="col-md-3 border-end p-0 d-flex flex-column">
|
||||||
<div class="p-3 border-bottom">
|
<div class="p-3 border-bottom">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control" placeholder="بحث في البريد...">
|
<input type="text" class="form-control" placeholder="<?php echo t('health_check'); ?>...">
|
||||||
<button class="btn btn-outline-secondary" type="button"><i class="bi bi-search"></i></button>
|
<button class="btn btn-outline-secondary" type="button"><i class="bi bi-search"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -63,19 +73,19 @@
|
|||||||
<!-- Email Detail Column -->
|
<!-- Email Detail Column -->
|
||||||
<div id="email-detail-col" class="col-md-5 p-0 d-flex flex-column">
|
<div id="email-detail-col" class="col-md-5 p-0 d-flex flex-column">
|
||||||
<div class="p-3 border-bottom bg-light">
|
<div class="p-3 border-bottom bg-light">
|
||||||
<h5 id="email-subject" class="mb-1">اختر رسالة لعرضها</h5>
|
<h5 id="email-subject" class="mb-1"><?php echo t('select_message_to_display'); ?></h5>
|
||||||
<small id="email-from" class="text-muted"></small>
|
<small id="email-from" class="text-muted"></small>
|
||||||
</div>
|
</div>
|
||||||
<div id="email-body-container" class="flex-grow-1 p-4 overflow-auto">
|
<div id="email-body-container" class="flex-grow-1 p-4 overflow-auto">
|
||||||
<p class="text-muted">محتوى الرسالة سيظهر هنا.</p>
|
<p class="text-muted"><?php echo t('message_content_here'); ?></p>
|
||||||
</div>
|
</div>
|
||||||
<div id="email-attachments" class="p-3 border-top bg-light">
|
<div id="email-attachments" class="p-3 border-top bg-light">
|
||||||
<!-- Attachments will be injected here by JS -->
|
<!-- Attachments will be injected here by JS -->
|
||||||
</div>
|
</div>
|
||||||
<div class="p-3 border-top d-flex gap-2">
|
<div class="p-3 border-top d-flex gap-2">
|
||||||
<button class="btn btn-primary"><i class="bi bi-reply-fill me-1"></i> رد</button>
|
<button class="btn btn-primary"><i class="bi bi-reply-fill me-1"></i> <?php echo t('reply'); ?></button>
|
||||||
<button class="btn btn-outline-secondary"><i class="bi bi-reply-all-fill me-1"></i> رد على الكل</button>
|
<button class="btn btn-outline-secondary"><i class="bi bi-reply-all-fill me-1"></i> <?php echo t('reply_all'); ?></button>
|
||||||
<button class="btn btn-outline-secondary"><i class="bi bi-arrow-right-short me-1"></i> تمرير</button>
|
<button class="btn btn-outline-secondary"><i class="bi bi-arrow-right-short me-1"></i> <?php echo t('forward'); ?></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -83,23 +93,23 @@
|
|||||||
<div id="ai-assistant-col" class="col-md-4 border-start p-0 d-flex flex-column bg-light">
|
<div id="ai-assistant-col" class="col-md-4 border-start p-0 d-flex flex-column bg-light">
|
||||||
<div class="p-3 border-bottom d-flex align-items-center">
|
<div class="p-3 border-bottom d-flex align-items-center">
|
||||||
<i class="bi bi-magic fs-5 text-primary me-2"></i>
|
<i class="bi bi-magic fs-5 text-primary me-2"></i>
|
||||||
<h5 class="mb-0">المساعد الذكي</h5>
|
<h5 class="mb-0"><?php echo t('ai_assistant'); ?></h5>
|
||||||
</div>
|
</div>
|
||||||
<div id="ai-assistant-body" class="flex-grow-1 p-4 overflow-auto">
|
<div id="ai-assistant-body" class="flex-grow-1 p-4 overflow-auto">
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<h6><i class="bi bi-card-text me-2"></i>ملخص الرسالة</h6>
|
<h6><i class="bi bi-card-text me-2"></i><?php echo t('message_summary'); ?></h6>
|
||||||
<p id="ai-summary" class="text-muted small">اختر رسالة ليقوم المساعد بتلخيصها.</p>
|
<p id="ai-summary" class="text-muted small"><?php echo t('select_message_for_summary'); ?></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<h6><i class="bi bi-lightbulb me-2"></i>إجراءات مقترحة</h6>
|
<h6><i class="bi bi-lightbulb me-2"></i><?php echo t('suggested_actions'); ?></h6>
|
||||||
<div id="ai-actions" class="d-flex flex-wrap gap-2">
|
<div id="ai-actions" class="d-flex flex-wrap gap-2">
|
||||||
<span class="badge bg-secondary bg-opacity-25 text-dark-emphasis">لا إجراءات مقترحة</span>
|
<span class="badge bg-secondary bg-opacity-25 text-dark-emphasis"><?php echo t('no_suggested_actions'); ?></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h6><i class="bi bi-pencil-square me-2"></i>الردود المقترحة</h6>
|
<h6><i class="bi bi-pencil-square me-2"></i><?php echo t('suggested_replies'); ?></h6>
|
||||||
<div id="ai-replies" class="list-group list-group-flush">
|
<div id="ai-replies" class="list-group list-group-flush">
|
||||||
<div class="list-group-item text-muted small">اختر رسالة لعرض الردود المقترحة.</div>
|
<div class="list-group-item text-muted small"><?php echo t('select_message_for_replies'); ?></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
48
lang/ar.php
Normal file
48
lang/ar.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
$lang = [
|
||||||
|
// Index
|
||||||
|
"dashboard" => "لوحة التحكم",
|
||||||
|
"manual_entry" => "إدخال يدوي",
|
||||||
|
"settings" => "الإعدادات",
|
||||||
|
"php_version" => "إصدار PHP",
|
||||||
|
"current_time" => "الوقت الحالي",
|
||||||
|
"health_check" => "بحث في البريد...",
|
||||||
|
"select_message_to_display" => "اختر رسالة لعرضها",
|
||||||
|
"message_content_here" => "محتوى الرسالة سيظهر هنا.",
|
||||||
|
"reply" => "رد",
|
||||||
|
"reply_all" => "رد على الكل",
|
||||||
|
"forward" => "تمرير",
|
||||||
|
"ai_assistant" => "المساعد الذكي",
|
||||||
|
"message_summary" => "ملخص الرسالة",
|
||||||
|
"select_message_for_summary" => "اختر رسالة ليقوم المساعد بتلخيصها.",
|
||||||
|
"suggested_actions" => "إجراءات مقترحة",
|
||||||
|
"no_suggested_actions" => "لا إجراءات مقترحة",
|
||||||
|
"suggested_replies" => "الردود المقترحة",
|
||||||
|
"select_message_for_replies" => "اختر رسالة لعرض الردود المقترحة.",
|
||||||
|
|
||||||
|
// Manual Email
|
||||||
|
"option_1" => "الخيار 1: رفع ملف بريد إلكتروني",
|
||||||
|
"choose_email_file" => "اختر ملف البريد الإلكتروني (.eml أو .txt)",
|
||||||
|
"analyze_and_populate" => "تحليل الملف وتعبئة الحقول",
|
||||||
|
"option_2" => "الخيار 2: إدخال يدوي",
|
||||||
|
"from" => "من",
|
||||||
|
"subject" => "الموضوع",
|
||||||
|
"message" => "الرسالة",
|
||||||
|
"save_email" => "حفظ البريد",
|
||||||
|
"saved_emails" => "رسائل البريد الإلكتروني المحفوظة",
|
||||||
|
"sender" => "المرسل",
|
||||||
|
"date" => "التاريخ",
|
||||||
|
"no_saved_emails" => "لا توجد رسائل بريد إلكتروني محفوظة حتى الآن.",
|
||||||
|
"email_saved_successfully" => "تم حفظ البريد الإلكتروني بنجاح.",
|
||||||
|
|
||||||
|
// Settings
|
||||||
|
"application_settings" => "إعدادات التطبيق",
|
||||||
|
"under_construction" => "هذه الصفحة قيد الإنشاء.",
|
||||||
|
|
||||||
|
// Language
|
||||||
|
"language" => "اللغة",
|
||||||
|
"arabic" => "العربية",
|
||||||
|
"english" => "English",
|
||||||
|
"french" => "Français"
|
||||||
|
];
|
||||||
|
?>
|
||||||
48
lang/en.php
Normal file
48
lang/en.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
$lang = [
|
||||||
|
// Index
|
||||||
|
"dashboard" => "Dashboard",
|
||||||
|
"manual_entry" => "Manual Entry",
|
||||||
|
"settings" => "Settings",
|
||||||
|
"php_version" => "PHP Version",
|
||||||
|
"current_time" => "Current Time",
|
||||||
|
"health_check" => "Search mail...",
|
||||||
|
"select_message_to_display" => "Select a message to display",
|
||||||
|
"message_content_here" => "Message content will appear here.",
|
||||||
|
"reply" => "Reply",
|
||||||
|
"reply_all" => "Reply All",
|
||||||
|
"forward" => "Forward",
|
||||||
|
"ai_assistant" => "AI Assistant",
|
||||||
|
"message_summary" => "Message Summary",
|
||||||
|
"select_message_for_summary" => "Select a message for the assistant to summarize.",
|
||||||
|
"suggested_actions" => "Suggested Actions",
|
||||||
|
"no_suggested_actions" => "No suggested actions",
|
||||||
|
"suggested_replies" => "Suggested Replies",
|
||||||
|
"select_message_for_replies" => "Select a message to display suggested replies.",
|
||||||
|
|
||||||
|
// Manual Email
|
||||||
|
"option_1" => "Option 1: Upload Email File",
|
||||||
|
"choose_email_file" => "Choose an email file (.eml or .txt)",
|
||||||
|
"analyze_and_populate" => "Analyze and Populate Fields",
|
||||||
|
"option_2" => "Option 2: Manual Entry",
|
||||||
|
"from" => "From",
|
||||||
|
"subject" => "Subject",
|
||||||
|
"message" => "Message",
|
||||||
|
"save_email" => "Save Email",
|
||||||
|
"saved_emails" => "Saved Emails",
|
||||||
|
"sender" => "Sender",
|
||||||
|
"date" => "Date",
|
||||||
|
"no_saved_emails" => "No saved emails yet.",
|
||||||
|
"email_saved_successfully" => "Email saved successfully.",
|
||||||
|
|
||||||
|
// Settings
|
||||||
|
"application_settings" => "Application Settings",
|
||||||
|
"under_construction" => "This page is under construction.",
|
||||||
|
|
||||||
|
// Language
|
||||||
|
"language" => "Language",
|
||||||
|
"arabic" => "العربية",
|
||||||
|
"english" => "English",
|
||||||
|
"french" => "Français"
|
||||||
|
];
|
||||||
|
?>
|
||||||
48
lang/fr.php
Normal file
48
lang/fr.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
$lang = [
|
||||||
|
// Index
|
||||||
|
"dashboard" => "Tableau de bord",
|
||||||
|
"manual_entry" => "Saisie manuelle",
|
||||||
|
"settings" => "Paramètres",
|
||||||
|
"php_version" => "Version PHP",
|
||||||
|
"current_time" => "Heure actuelle",
|
||||||
|
"health_check" => "Rechercher un e-mail...",
|
||||||
|
"select_message_to_display" => "Sélectionnez un message à afficher",
|
||||||
|
"message_content_here" => "Le contenu du message apparaîtra ici.",
|
||||||
|
"reply" => "Répondre",
|
||||||
|
"reply_all" => "Répondre à tous",
|
||||||
|
"forward" => "Transférer",
|
||||||
|
"ai_assistant" => "Assistant IA",
|
||||||
|
"message_summary" => "Résumé du message",
|
||||||
|
"select_message_for_summary" => "Sélectionnez un message pour que l'assistant le résume.",
|
||||||
|
"suggested_actions" => "Actions suggérées",
|
||||||
|
"no_suggested_actions" => "Aucune action suggérée",
|
||||||
|
"suggested_replies" => "Réponses suggérées",
|
||||||
|
"select_message_for_replies" => "Sélectionnez un message pour afficher les réponses suggérées.",
|
||||||
|
|
||||||
|
// Manual Email
|
||||||
|
"option_1" => "Option 1 : Télécharger un fichier e-mail",
|
||||||
|
"choose_email_file" => "Choisissez un fichier e-mail (.eml ou .txt)",
|
||||||
|
"analyze_and_populate" => "Analyser et remplir les champs",
|
||||||
|
"option_2" => "Option 2 : Saisie manuelle",
|
||||||
|
"from" => "De",
|
||||||
|
"subject" => "Sujet",
|
||||||
|
"message" => "Message",
|
||||||
|
"save_email" => "Enregistrer l'e-mail",
|
||||||
|
"saved_emails" => "E-mails enregistrés",
|
||||||
|
"sender" => "Expéditeur",
|
||||||
|
"date" => "Date",
|
||||||
|
"no_saved_emails" => "Aucun e-mail enregistré pour le moment.",
|
||||||
|
"email_saved_successfully" => "E-mail enregistré avec succès.",
|
||||||
|
|
||||||
|
// Settings
|
||||||
|
"application_settings" => "Paramètres de l'application",
|
||||||
|
"under_construction" => "Cette page est en construction.",
|
||||||
|
|
||||||
|
// Language
|
||||||
|
"language" => "Langue",
|
||||||
|
"arabic" => "العربية",
|
||||||
|
"english" => "English",
|
||||||
|
"french" => "Français"
|
||||||
|
];
|
||||||
|
?>
|
||||||
175
manual_email.php
175
manual_email.php
@ -1,14 +1,44 @@
|
|||||||
<?php
|
<?php
|
||||||
|
require_once 'i18n.php';
|
||||||
require_once 'db/config.php';
|
require_once 'db/config.php';
|
||||||
|
|
||||||
$page_title = 'Manual Email Entry';
|
|
||||||
$page_description = 'A page to manually enter email content.';
|
|
||||||
$from = '';
|
$from = '';
|
||||||
$subject = '';
|
$subject = '';
|
||||||
$message = '';
|
$message = '';
|
||||||
$success_message = '';
|
$success_message = '';
|
||||||
|
$upload_error = '';
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
// Handle File Upload and Parsing
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['email_file']) && $_FILES['email_file']['error'] == UPLOAD_ERR_OK) {
|
||||||
|
$file_tmp_path = $_FILES['email_file']['tmp_name'];
|
||||||
|
$file_content = file_get_contents($file_tmp_path);
|
||||||
|
|
||||||
|
if ($file_content) {
|
||||||
|
// Basic EML parsing
|
||||||
|
$headers = [];
|
||||||
|
$body_started = false;
|
||||||
|
$body_lines = [];
|
||||||
|
$lines = explode("\n", $file_content);
|
||||||
|
|
||||||
|
foreach ($lines as $line) {
|
||||||
|
if (!$body_started) {
|
||||||
|
if (preg_match('/^From:\s*(.*)/i', $line, $matches)) {
|
||||||
|
$from = trim($matches[1]);
|
||||||
|
} elseif (preg_match('/^Subject:\s*(.*)/i', $line, $matches)) {
|
||||||
|
$subject = trim($matches[1]);
|
||||||
|
} elseif (trim($line) === '') {
|
||||||
|
$body_started = true; // Headers are done, body begins
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$body_lines[] = $line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$message = implode("\n", $body_lines);
|
||||||
|
} else {
|
||||||
|
$upload_error = 'Failed to read uploaded file.';
|
||||||
|
}
|
||||||
|
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
// Handle Manual Form Submission
|
||||||
$from = isset($_POST['from']) ? $_POST['from'] : '';
|
$from = isset($_POST['from']) ? $_POST['from'] : '';
|
||||||
$subject = isset($_POST['subject']) ? $_POST['subject'] : '';
|
$subject = isset($_POST['subject']) ? $_POST['subject'] : '';
|
||||||
$message = isset($_POST['message']) ? $_POST['message'] : '';
|
$message = isset($_POST['message']) ? $_POST['message'] : '';
|
||||||
@ -18,10 +48,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
$pdo = db();
|
$pdo = db();
|
||||||
$stmt = $pdo->prepare('INSERT INTO manual_emails (sender, subject, message) VALUES (?, ?, ?)');
|
$stmt = $pdo->prepare('INSERT INTO manual_emails (sender, subject, message) VALUES (?, ?, ?)');
|
||||||
$stmt->execute([$from, $subject, $message]);
|
$stmt->execute([$from, $subject, $message]);
|
||||||
$success_message = 'تم حفظ البريد الإلكتروني بنجاح!';
|
$success_message = t('email_saved_successfully');
|
||||||
|
// Clear fields after successful save
|
||||||
|
$from = '';
|
||||||
|
$subject = '';
|
||||||
|
$message = '';
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
// For development, it's useful to see the error. In production, you'd log this.
|
$success_message = 'Error saving email: ' . $e->getMessage();
|
||||||
$success_message = 'خطأ في حفظ البريد: ' . $e->getMessage();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -33,80 +66,122 @@ try {
|
|||||||
$stmt = $pdo->query('SELECT sender, subject, message, created_at FROM manual_emails ORDER BY created_at DESC');
|
$stmt = $pdo->query('SELECT sender, subject, message, created_at FROM manual_emails ORDER BY created_at DESC');
|
||||||
$saved_emails = $stmt->fetchAll();
|
$saved_emails = $stmt->fetchAll();
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
// Handle error, e.g., by showing a message
|
$db_error = 'Error fetching emails: ' . $e->getMessage();
|
||||||
$db_error = 'خطأ في استرجاع رسائل البريد الإلكتروني: ' . $e->getMessage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="ar" dir="rtl">
|
<html lang="<?php echo $current_lang; ?>" dir="<?php echo get_lang_dir(); ?>">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title><?php echo htmlspecialchars($page_title); ?></title>
|
<title><?php echo t('manual_entry'); ?></title>
|
||||||
<meta name="description" content="<?php echo htmlspecialchars($page_description); ?>">
|
<!-- Bootstrap 5 -->
|
||||||
|
<?php if (get_lang_dir() === 'rtl'): ?>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.rtl.min.css" rel="stylesheet">
|
||||||
|
<?php else:
|
||||||
|
?>
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<style>
|
<?php endif; ?>
|
||||||
body { background-color: #f8f9fa; }
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
|
||||||
.container { max-width: 800px; }
|
<!-- Google Fonts -->
|
||||||
.card { margin-top: 2rem; }
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
.card-header { background-color: #0d6efd; color: white; }
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
.result-box { margin-top: 2rem; padding: 1.5rem; border: 1px solid #dee2e6; border-radius: .25rem; background-color: #fff; }
|
<?php if (get_lang_dir() === 'rtl'): ?>
|
||||||
.email-item { border-bottom: 1px solid #eee; padding-bottom: 1rem; margin-bottom: 1rem; }
|
<link href="https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap" rel="stylesheet">
|
||||||
.email-item:last-child { border-bottom: none; }
|
<?php else:
|
||||||
</style>
|
?>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap" rel="stylesheet">
|
||||||
|
<?php endif; ?>
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container py-4">
|
||||||
<header class="d-flex justify-content-between align-items-center py-3 mb-4 border-bottom">
|
<header class="d-flex justify-content-between align-items-center pb-3 mb-4 border-bottom">
|
||||||
<h1 class="h4">إدخال البريد الإلكتروني يدوياً</h1>
|
<h1 class="h4"><a href="index.php" class="text-dark text-decoration-none"><i class="bi bi-robot"></i> <?php echo t('dashboard'); ?></a></h1>
|
||||||
<a href="index.php" class="btn btn-sm btn-outline-secondary">العودة للرئيسية</a>
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="dropdown me-2">
|
||||||
|
<button class="btn btn-outline-secondary dropdown-toggle" type="button" id="langDropdown" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<i class="bi bi-translate me-1"></i> <?php echo t('language'); ?>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu" aria-labelledby="langDropdown">
|
||||||
|
<li><a class="dropdown-item <?php if($current_lang == 'ar') echo 'active'; ?>" href="?lang=ar"><?php echo t('arabic'); ?></a></li>
|
||||||
|
<li><a class="dropdown-item <?php if($current_lang == 'en') echo 'active'; ?>" href="?lang=en"><?php echo t('english'); ?></a></li>
|
||||||
|
<li><a class="dropdown-item <?php if($current_lang == 'fr') echo 'active'; ?>" href="?lang=fr"><?php echo t('french'); ?></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<a href="settings.php" class="btn btn-light" title="<?php echo t('settings'); ?>"><i class="bi bi-gear"></i></a>
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
<h2 class="mb-4"><?php echo t('manual_entry'); ?></h2>
|
||||||
|
|
||||||
<?php if ($success_message): ?>
|
<?php if ($success_message): ?>
|
||||||
<div class="alert alert-success"><?php echo $success_message; ?></div>
|
<div class="alert alert-success"><?php echo $success_message; ?></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<?php if ($upload_error): ?>
|
||||||
|
<div class="alert alert-danger"><?php echo $upload_error; ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card mb-4">
|
||||||
<div class="card-header">نموذج إدخال البريد</div>
|
<div class="card-header"><?php echo t('option_1'); ?></div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form action="manual_email.php" method="POST">
|
<form action="manual_email.php" method="POST" enctype="multipart/form-data">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="from" class="form-label">من:</label>
|
<label for="email_file" class="form-label"><?php echo t('choose_email_file'); ?></label>
|
||||||
<input type="email" class="form-control" id="from" name="from" required>
|
<input type="file" class="form-control" id="email_file" name="email_file" accept=".eml,.txt">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<button type="submit" class="btn btn-secondary"><?php echo t('analyze_and_populate'); ?></button>
|
||||||
<label for="subject" class="form-label">الموضوع:</label>
|
|
||||||
<input type="text" class="form-control" id="subject" name="subject" required>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="message" class="form-label">نص الرسالة:</label>
|
|
||||||
<textarea class.form-control" id="message" name="message" rows="8" required></textarea>
|
|
||||||
</div>
|
|
||||||
<button type="submit" class="btn btn-primary">حفظ البريد</button>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="result-box">
|
<div class="card mb-4">
|
||||||
<h2 class="h5 mb-4">الرسائل المحفوظة</h2>
|
<div class="card-header bg-primary text-white"><?php echo t('option_2'); ?></div>
|
||||||
|
<div class="card-body">
|
||||||
|
<form action="manual_email.php" method="POST">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="from" class="form-label"><?php echo t('from'); ?></label>
|
||||||
|
<input type="email" class="form-control" id="from" name="from" value="<?php echo htmlspecialchars($from); ?>" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="subject" class="form-label"><?php echo t('subject'); ?></label>
|
||||||
|
<input type="text" class="form-control" id="subject" name="subject" value="<?php echo htmlspecialchars($subject); ?>" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="message" class="form-label"><?php echo t('message'); ?></label>
|
||||||
|
<textarea class="form-control" id="message" name="message" rows="8" required><?php echo htmlspecialchars($message); ?></textarea>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary"><?php echo t('save_email'); ?></button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header"><?php echo t('saved_emails'); ?></div>
|
||||||
|
<div class="card-body">
|
||||||
<?php if (isset($db_error)): ?>
|
<?php if (isset($db_error)): ?>
|
||||||
<div class="alert alert-danger"><?php echo $db_error; ?></div>
|
<div class="alert alert-danger"><?php echo $db_error; ?></div>
|
||||||
<?php elseif (empty($saved_emails)): ?>
|
<?php elseif (empty($saved_emails)): ?>
|
||||||
<p>لا توجد رسائل محفوظة حتى الآن.</p>
|
<p><?php echo t('no_saved_emails'); ?></p>
|
||||||
<?php else: ?>
|
<?php else:
|
||||||
<?php foreach ($saved_emails as $email): ?>
|
?>
|
||||||
<div class="email-item">
|
<?php foreach ($saved_emails as $email):
|
||||||
<p><strong>من:</strong> <?php echo htmlspecialchars($email['sender']); ?></p>
|
?>
|
||||||
<p><strong>الموضوع:</strong> <?php echo htmlspecialchars($email['subject']); ?></p>
|
<div class="email-item border-bottom pb-3 mb-3">
|
||||||
<p><strong>الرسالة:</strong></p>
|
<p><strong><?php echo t('from'); ?>:</strong> <?php echo htmlspecialchars($email['sender']); ?></p>
|
||||||
<pre style="white-space: pre-wrap; background-color: #f1f1f1; padding: 1rem; border-radius: .25rem;"><?php echo htmlspecialchars($email['message']); ?></pre>
|
<p><strong><?php echo t('subject'); ?>:</strong> <?php echo htmlspecialchars($email['subject']); ?></p>
|
||||||
<small class="text-muted">تم الاستلام في: <?php echo $email['created_at']; ?></small>
|
<p><strong><?php echo t('message'); ?>:</strong></p>
|
||||||
|
<pre class="bg-light p-2 rounded"><?php echo htmlspecialchars($email['message']); ?></pre>
|
||||||
|
<small class="text-muted"><?php echo t('date'); ?>: <?php echo $email['created_at']; ?></small>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach;
|
||||||
|
?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
72
settings.php
72
settings.php
@ -1,49 +1,61 @@
|
|||||||
<?php
|
<?php
|
||||||
|
require_once 'i18n.php';
|
||||||
// settings.php
|
// settings.php
|
||||||
// You can add PHP logic here for handling settings in the future.
|
// You can add PHP logic here for handling settings in the future.
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="ar" dir="rtl">
|
<html lang="<?php echo $current_lang; ?>" dir="<?php echo get_lang_dir(); ?>">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>الإعدادات</title>
|
<title><?php echo t('settings'); ?></title>
|
||||||
|
<!-- Bootstrap 5 -->
|
||||||
|
<?php if (get_lang_dir() === 'rtl'): ?>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.rtl.min.css" rel="stylesheet">
|
||||||
|
<?php else: ?>
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
<?php endif; ?>
|
||||||
<style>
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
|
||||||
body {
|
<!-- Google Fonts -->
|
||||||
background-color: #f8f9fa;
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
}
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
.container {
|
<?php if (get_lang_dir() === 'rtl'): ?>
|
||||||
max-width: 800px;
|
<link href="https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap" rel="stylesheet">
|
||||||
}
|
<?php else: ?>
|
||||||
.header {
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap" rel="stylesheet">
|
||||||
background-color: #ffffff;
|
<?php endif; ?>
|
||||||
padding: 1rem;
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
border-bottom: 1px solid #dee2e6;
|
|
||||||
margin-bottom: 2rem;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="header">
|
<div class="container py-4">
|
||||||
<h1 class="h4">الإعدادات</h1>
|
<header class="d-flex justify-content-between align-items-center pb-3 mb-4 border-bottom">
|
||||||
<a href="index.php" class="btn btn-secondary">العودة للرئيسية</a>
|
<h1 class="h4"><a href="index.php" class="text-dark text-decoration-none"><i class="bi bi-robot"></i> <?php echo t('dashboard'); ?></a></h1>
|
||||||
</div>
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="dropdown me-2">
|
||||||
|
<button class="btn btn-outline-secondary dropdown-toggle" type="button" id="langDropdown" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<i class="bi bi-translate me-1"></i> <?php echo t('language'); ?>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu" aria-labelledby="langDropdown">
|
||||||
|
<li><a class="dropdown-item <?php if($current_lang == 'ar') echo 'active'; ?>" href="?lang=ar"><?php echo t('arabic'); ?></a></li>
|
||||||
|
<li><a class="dropdown-item <?php if($current_lang == 'en') echo 'active'; ?>" href="?lang=en"><?php echo t('english'); ?></a></li>
|
||||||
|
<li><a class="dropdown-item <?php if($current_lang == 'fr') echo 'active'; ?>" href="?lang=fr"><?php echo t('french'); ?></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<a href="manual_email.php" class="btn btn-outline-primary"><i class="bi bi-plus-circle me-1"></i> <?php echo t('manual_entry'); ?></a>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<h2 class="mb-4"><?php echo t('settings'); ?></h2>
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body text-center">
|
||||||
<h5 class="card-title">إعدادات التطبيق</h5>
|
<i class="bi bi-gear-wide-connected fs-1 text-muted mb-3"></i>
|
||||||
<p class="card-text">هذه الصفحة مخصصة لإعدادات التطبيق المستقبلية.</p>
|
<h5 class="card-title"><?php echo t('application_settings'); ?></h5>
|
||||||
<!-- Add settings form or options here later -->
|
<p class="card-text text-muted"><?php echo t('under_construction'); ?></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user