add install file

This commit is contained in:
Flatlogic Bot 2026-04-07 13:34:58 +00:00
parent 4418e1cdac
commit 506cba22cd
3 changed files with 828 additions and 0 deletions

365
db/migrations/schema.sql Normal file
View File

@ -0,0 +1,365 @@
/*M!999999\- enable the sandbox mode */
-- MariaDB dump 10.19 Distrib 10.11.14-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: 127.0.0.1 Database: app_39496
-- ------------------------------------------------------
-- Server version 10.11.14-MariaDB-0+deb12u2
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `classes`
--
DROP TABLE IF EXISTS `classes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `classes` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name_en` varchar(255) NOT NULL,
`name_ar` varchar(255) NOT NULL,
`description_en` text DEFAULT NULL,
`description_ar` text DEFAULT NULL,
`created_at` timestamp NULL DEFAULT current_timestamp(),
`status` enum('active','inactive') NOT NULL DEFAULT 'active',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `course_activities`
--
DROP TABLE IF EXISTS `course_activities`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `course_activities` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`course_id` int(10) unsigned NOT NULL,
`title_en` varchar(255) NOT NULL,
`title_ar` varchar(255) NOT NULL,
`description_en` text DEFAULT NULL,
`description_ar` text DEFAULT NULL,
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
KEY `course_id` (`course_id`),
CONSTRAINT `course_activities_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `course_live_lessons`
--
DROP TABLE IF EXISTS `course_live_lessons`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `course_live_lessons` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`course_id` int(11) NOT NULL,
`title` varchar(255) NOT NULL,
`scheduled_at` datetime NOT NULL,
`status` enum('scheduled','live','ended') DEFAULT 'scheduled',
`room_name` varchar(255) NOT NULL,
`meet_url` varchar(500) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `course_students`
--
DROP TABLE IF EXISTS `course_students`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `course_students` (
`course_id` int(10) unsigned NOT NULL,
`student_id` int(10) unsigned NOT NULL,
`assigned_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`course_id`,`student_id`),
KEY `student_id` (`student_id`),
CONSTRAINT `course_students_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`) ON DELETE CASCADE,
CONSTRAINT `course_students_ibfk_2` FOREIGN KEY (`student_id`) REFERENCES `student_subscriptions` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `courses`
--
DROP TABLE IF EXISTS `courses`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `courses` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name_en` varchar(255) NOT NULL,
`name_ar` varchar(255) NOT NULL,
`description_en` text DEFAULT NULL,
`description_ar` text DEFAULT NULL,
`price` decimal(10,2) DEFAULT 0.00,
`picture` varchar(255) DEFAULT NULL,
`status` enum('active','inactive') DEFAULT 'active',
`created_at` timestamp NULL DEFAULT current_timestamp(),
`teacher_id` int(11) DEFAULT NULL,
`max_students` int(11) DEFAULT NULL,
`registration_open` tinyint(1) DEFAULT 1,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `landing_settings`
--
DROP TABLE IF EXISTS `landing_settings`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `landing_settings` (
`setting_key` varchar(100) NOT NULL,
`value_en` text DEFAULT NULL,
`value_ar` text DEFAULT NULL,
PRIMARY KEY (`setting_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `module_progress`
--
DROP TABLE IF EXISTS `module_progress`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `module_progress` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`subscription_id` int(10) unsigned NOT NULL,
`subject_slug` varchar(100) NOT NULL,
`module_index` int(10) unsigned NOT NULL,
`completed_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `subscription_id` (`subscription_id`,`subject_slug`,`module_index`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `plans`
--
DROP TABLE IF EXISTS `plans`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `plans` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`plan_key` varchar(50) NOT NULL,
`name_en` varchar(120) NOT NULL,
`name_ar` varchar(120) NOT NULL,
`price_monthly` decimal(10,3) NOT NULL,
`price_yearly` decimal(10,3) NOT NULL,
`subjects_limit` int(11) DEFAULT 1,
`features_en` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`features_en`)),
`features_ar` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`features_ar`)),
PRIMARY KEY (`id`),
UNIQUE KEY `plan_key` (`plan_key`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `platform_profile`
--
DROP TABLE IF EXISTS `platform_profile`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `platform_profile` (
`id` int(11) NOT NULL DEFAULT 1,
`name` varchar(255) DEFAULT NULL,
`description` text DEFAULT NULL,
`logo_path` varchar(255) DEFAULT NULL,
`favicon_path` varchar(255) DEFAULT NULL,
`ctr_no` varchar(255) DEFAULT NULL,
`telephone_no` varchar(255) DEFAULT NULL,
`email_id` varchar(255) DEFAULT NULL,
`wablas_domain` varchar(255) DEFAULT NULL,
`wablas_token` varchar(255) DEFAULT NULL,
`thawani_secret_key` varchar(255) DEFAULT NULL,
`thawani_publishable_key` varchar(255) DEFAULT NULL,
`thawani_mode` varchar(50) DEFAULT 'test',
`wablas_security_key` varchar(255) DEFAULT NULL,
`smtp_host` varchar(255) DEFAULT NULL,
`smtp_port` varchar(50) DEFAULT NULL,
`smtp_secure` varchar(50) DEFAULT NULL,
`smtp_user` varchar(255) DEFAULT NULL,
`smtp_pass` varchar(255) DEFAULT NULL,
`smtp_from_email` varchar(255) DEFAULT NULL,
`smtp_from_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `student_assessments`
--
DROP TABLE IF EXISTS `student_assessments`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `student_assessments` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`activity_id` int(10) unsigned NOT NULL,
`student_id` int(10) unsigned NOT NULL,
`score` decimal(5,2) DEFAULT NULL,
`feedback` text DEFAULT NULL,
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `activity_id` (`activity_id`,`student_id`),
KEY `student_id` (`student_id`),
CONSTRAINT `student_assessments_ibfk_1` FOREIGN KEY (`activity_id`) REFERENCES `course_activities` (`id`) ON DELETE CASCADE,
CONSTRAINT `student_assessments_ibfk_2` FOREIGN KEY (`student_id`) REFERENCES `student_subscriptions` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `student_subscriptions`
--
DROP TABLE IF EXISTS `student_subscriptions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `student_subscriptions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`full_name` varchar(120) NOT NULL,
`email` varchar(190) NOT NULL,
`password` varchar(255) DEFAULT NULL,
`reset_token` varchar(255) DEFAULT NULL,
`reset_expires` datetime DEFAULT NULL,
`whatsapp` varchar(40) NOT NULL,
`preferred_language` varchar(5) NOT NULL DEFAULT 'en',
`plan_key` varchar(20) NOT NULL,
`billing_cycle` varchar(20) NOT NULL DEFAULT 'monthly',
`payment_status` varchar(20) NOT NULL DEFAULT 'active',
`payment_gateway` varchar(30) NOT NULL DEFAULT 'Thawani',
`thawani_reference` varchar(80) NOT NULL,
`wablas_opt_in` tinyint(1) NOT NULL DEFAULT 0,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`status` enum('active','inactive') NOT NULL DEFAULT 'active',
`picture` varchar(255) DEFAULT NULL,
`civil_id` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `subjects`
--
DROP TABLE IF EXISTS `subjects`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `subjects` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`slug` varchar(100) NOT NULL,
`title_en` varchar(255) NOT NULL,
`title_ar` varchar(255) NOT NULL,
`summary_en` text DEFAULT NULL,
`summary_ar` text DEFAULT NULL,
`teacher_en` varchar(120) DEFAULT NULL,
`teacher_ar` varchar(120) DEFAULT NULL,
`level_en` varchar(50) DEFAULT NULL,
`level_ar` varchar(50) DEFAULT NULL,
`duration_en` varchar(50) DEFAULT NULL,
`duration_ar` varchar(50) DEFAULT NULL,
`next_live_en` varchar(120) DEFAULT NULL,
`next_live_ar` varchar(120) DEFAULT NULL,
`meet_url` varchar(255) DEFAULT NULL,
`modules_en` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`modules_en`)),
`modules_ar` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`modules_ar`)),
`created_at` timestamp NULL DEFAULT current_timestamp(),
`class_id` int(10) unsigned DEFAULT NULL,
`status` enum('active','inactive') NOT NULL DEFAULT 'active',
PRIMARY KEY (`id`),
UNIQUE KEY `slug` (`slug`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `teacher_assignments`
--
DROP TABLE IF EXISTS `teacher_assignments`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `teacher_assignments` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`teacher_id` int(11) NOT NULL,
`class_id` int(11) NOT NULL,
`subject_id` int(11) NOT NULL DEFAULT 0,
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `unique_assignment` (`teacher_id`,`class_id`,`subject_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `teachers`
--
DROP TABLE IF EXISTS `teachers`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `teachers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`email` varchar(255) DEFAULT NULL,
`bio` text DEFAULT NULL,
`photo_path` varchar(255) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT current_timestamp(),
`phone` varchar(50) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`status` enum('active','inactive') NOT NULL DEFAULT 'active',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`reset_token` varchar(255) DEFAULT NULL,
`reset_expires` datetime DEFAULT NULL,
`role` enum('admin','user') DEFAULT 'admin',
`created_at` timestamp NULL DEFAULT current_timestamp(),
`phone` varchar(50) DEFAULT NULL,
`profile_picture` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2026-04-07 13:32:08

198
db/migrations/seeds.sql Normal file
View File

@ -0,0 +1,198 @@
/*M!999999\- enable the sandbox mode */
-- MariaDB dump 10.19 Distrib 10.11.14-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: 127.0.0.1 Database: app_39496
-- ------------------------------------------------------
-- Server version 10.11.14-MariaDB-0+deb12u2
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Dumping data for table `classes`
--
LOCK TABLES `classes` WRITE;
/*!40000 ALTER TABLE `classes` DISABLE KEYS */;
INSERT IGNORE INTO `classes` (`id`, `name_en`, `name_ar`, `description_en`, `description_ar`, `created_at`, `status`) VALUES (2,'Grade 11','الصف الحادي عشر','','','2026-04-06 04:07:29','active'),
(3,'Grade 10','الصف العاشر','','','2026-04-06 04:17:59','active'),
(4,'Grade 12','الصف الثاني عشر','','','2026-04-06 04:29:58','active');
/*!40000 ALTER TABLE `classes` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `course_activities`
--
LOCK TABLES `course_activities` WRITE;
/*!40000 ALTER TABLE `course_activities` DISABLE KEYS */;
INSERT IGNORE INTO `course_activities` (`id`, `course_id`, `title_en`, `title_ar`, `description_en`, `description_ar`, `created_at`) VALUES (1,1,'Quiz1','Quiz1','test','test','2026-04-06 12:44:52');
/*!40000 ALTER TABLE `course_activities` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `course_live_lessons`
--
LOCK TABLES `course_live_lessons` WRITE;
/*!40000 ALTER TABLE `course_live_lessons` DISABLE KEYS */;
INSERT IGNORE INTO `course_live_lessons` (`id`, `course_id`, `title`, `scheduled_at`, `status`, `room_name`, `meet_url`, `created_at`) VALUES (1,1,'test1','2026-04-06 17:52:00','live','room_fa6f9f9238',NULL,'2026-04-06 13:53:01');
/*!40000 ALTER TABLE `course_live_lessons` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `course_students`
--
LOCK TABLES `course_students` WRITE;
/*!40000 ALTER TABLE `course_students` DISABLE KEYS */;
/*!40000 ALTER TABLE `course_students` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `courses`
--
LOCK TABLES `courses` WRITE;
/*!40000 ALTER TABLE `courses` DISABLE KEYS */;
INSERT IGNORE INTO `courses` (`id`, `name_en`, `name_ar`, `description_en`, `description_ar`, `price`, `picture`, `status`, `created_at`, `teacher_id`, `max_students`, `registration_open`) VALUES (1,'Biology Grade 12','أحياء الثاني عشر','Learn the basics of HTML, CSS, and JavaScript to build modern websites.','تعلم أساسيات HTML و CSS و JavaScript لبناء مواقع حديثة.',20.00,'assets/images/uploads/1775471381_أحياء 12.jfif','active','2026-04-06 10:15:06',1,NULL,1),
(2,'Physics Grade 12','فيزياء الثاني عشر','Deep dive into Python architecture, data structures, and algorithms.','تعمق في بنية بايثون وهياكل البيانات والخوارزميات.',20.00,'assets/images/uploads/1775471335_فيزياء 12.jfif','active','2026-04-06 10:15:06',1,NULL,1),
(3,'Chemistry Grade 12','الكيمياء الثاني عشر','Master SEO, social media marketing, and online ad strategies.','إتقان تحسين محركات البحث وتسويق وسائل التواصل الاجتماعي.',20.00,'assets/images/uploads/1775471215_كيماء 12.webp','active','2026-04-06 10:15:06',1,NULL,1);
/*!40000 ALTER TABLE `courses` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `landing_settings`
--
LOCK TABLES `landing_settings` WRITE;
/*!40000 ALTER TABLE `landing_settings` DISABLE KEYS */;
INSERT IGNORE INTO `landing_settings` (`setting_key`, `value_en`, `value_ar`) VALUES ('courses_eyebrow','Featured Courses','الدورات المميزة'),
('courses_title','Enroll in specialized short courses designed to accelerate your skills.','سجل في دورات قصيرة متخصصة لتسريع تطوير مهاراتك.'),
('flow_eyebrow','Delivery flow','مسار التسليم'),
('flow_title','One thin slice from discovery to live access.','شريحة رشيقة من الاكتشاف حتى الوصول المباشر.'),
('hero_desc','Launch a polished e-learning experience for students, teachers, and admins with English/Arabic support, Thawani billing flows, and Wablas-ready WhatsApp notifications.','أطلق تجربة تعليم إلكتروني مصقولة للطلاب والمعلمين والإدارة مع دعم الإنجليزية والعربية وتدفقات دفع ثواني وإشعارات واتساب جاهزة عبر وابلاس.'),
('hero_eyebrow','Single platform LMS','منصة تعليم موحدة'),
('hero_title','Subscriptions, multilingual classrooms, and live Google Meet learning in one precise workspace.','الاشتراكات والفصول متعددة اللغات والتعلم المباشر عبر Google Meet في مساحة واحدة دقيقة.'),
('plans_eyebrow','Plans','الخطط'),
('plans_title','Plan-based access for a shared marketplace.','وصول قائم على الخطط لمنصة مشتركة.'),
('subjects_eyebrow','Featured subjects','المواد المميزة'),
('subjects_title','Separate pages for catalog, detail, checkout, and dashboards.','صفحات منفصلة للكتالوج والتفاصيل والدفع ولوحات التحكم.');
/*!40000 ALTER TABLE `landing_settings` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `module_progress`
--
LOCK TABLES `module_progress` WRITE;
/*!40000 ALTER TABLE `module_progress` DISABLE KEYS */;
/*!40000 ALTER TABLE `module_progress` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `plans`
--
LOCK TABLES `plans` WRITE;
/*!40000 ALTER TABLE `plans` DISABLE KEYS */;
INSERT IGNORE INTO `plans` (`id`, `plan_key`, `name_en`, `name_ar`, `price_monthly`, `price_yearly`, `subjects_limit`, `features_en`, `features_ar`) VALUES (1,'core','Core Plan','الخطة الأساسية',29.000,290.000,2,'[\"Access to 2 subjects\",\"Weekly live classroom\",\"Student dashboard\",\"Thawani-ready billing\"]','[\"\\u0627\\u0644\\u0648\\u0635\\u0648\\u0644 \\u0625\\u0644\\u0649 \\u0645\\u0627\\u062f\\u062a\\u064a\\u0646\",\"\\u0641\\u0635\\u0644 \\u0645\\u0628\\u0627\\u0634\\u0631 \\u0623\\u0633\\u0628\\u0648\\u0639\\u064a\",\"\\u0644\\u0648\\u062d\\u0629 \\u0627\\u0644\\u0637\\u0627\\u0644\\u0628\",\"\\u062f\\u0641\\u0639 \\u062c\\u0627\\u0647\\u0632 \\u0644\\u062b\\u0648\\u0627\\u0646\\u064a\"]'),
(2,'plus','Plus Plan','الخطة المتقدمة',59.000,590.000,4,'[\"All subjects\",\"Unlimited live rooms\",\"Teacher Q&A\",\"Wablas reminders\"]','[\"\\u062c\\u0645\\u064a\\u0639 \\u0627\\u0644\\u0645\\u0648\\u0627\\u062f\",\"\\u063a\\u0631\\u0641 \\u0645\\u0628\\u0627\\u0634\\u0631\\u0629 \\u063a\\u064a\\u0631 \\u0645\\u062d\\u062f\\u0648\\u062f\\u0629\",\"\\u0623\\u0633\\u0626\\u0644\\u0629 \\u0648\\u0623\\u062c\\u0648\\u0628\\u0629 \\u0645\\u0639 \\u0627\\u0644\\u0645\\u0639\\u0644\\u0645\",\"\\u062a\\u0630\\u0643\\u064a\\u0631\\u0627\\u062a \\u0639\\u0628\\u0631 \\u0648\\u0627\\u0628\\u0644\\u0627\\u0633\"]'),
(3,'pro','Pro Campus','الخطة الاحترافية',89.000,890.000,999,'[\"Priority support\",\"Arabic + English tracks\",\"Admin reporting\",\"Live classroom operations\"]','[\"\\u062f\\u0639\\u0645 \\u0623\\u0648\\u0644\\u0648\\u064a\\u0629\",\"\\u0645\\u0633\\u0627\\u0631\\u0627\\u062a \\u0639\\u0631\\u0628\\u064a\\u0629 \\u0648\\u0625\\u0646\\u062c\\u0644\\u064a\\u0632\\u064a\\u0629\",\"\\u062a\\u0642\\u0627\\u0631\\u064a\\u0631 \\u0625\\u062f\\u0627\\u0631\\u064a\\u0629\",\"\\u062a\\u0634\\u063a\\u064a\\u0644 \\u0627\\u0644\\u0641\\u0635\\u0648\\u0644 \\u0627\\u0644\\u0645\\u0628\\u0627\\u0634\\u0631\\u0629\"]');
/*!40000 ALTER TABLE `plans` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `platform_profile`
--
LOCK TABLES `platform_profile` WRITE;
/*!40000 ALTER TABLE `platform_profile` DISABLE KEYS */;
INSERT IGNORE INTO `platform_profile` (`id`, `name`, `description`, `logo_path`, `favicon_path`, `ctr_no`, `telephone_no`, `email_id`, `wablas_domain`, `wablas_token`, `thawani_secret_key`, `thawani_publishable_key`, `thawani_mode`, `wablas_security_key`, `smtp_host`, `smtp_port`, `smtp_secure`, `smtp_user`, `smtp_pass`, `smtp_from_email`, `smtp_from_name`) VALUES (1,' منصة سمو التعليمية ','منصة تعليمية إلكترونية مرخصة من قبل الجهات المعنية','','','45434','6584','',NULL,NULL,'3333','3333','live',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
/*!40000 ALTER TABLE `platform_profile` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `student_assessments`
--
LOCK TABLES `student_assessments` WRITE;
/*!40000 ALTER TABLE `student_assessments` DISABLE KEYS */;
INSERT IGNORE INTO `student_assessments` (`id`, `activity_id`, `student_id`, `score`, `feedback`, `created_at`) VALUES (1,1,1,85.50,'Good job','2026-04-06 12:45:29');
/*!40000 ALTER TABLE `student_assessments` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `student_subscriptions`
--
LOCK TABLES `student_subscriptions` WRITE;
/*!40000 ALTER TABLE `student_subscriptions` DISABLE KEYS */;
INSERT IGNORE INTO `student_subscriptions` (`id`, `full_name`, `email`, `password`, `reset_token`, `reset_expires`, `whatsapp`, `preferred_language`, `plan_key`, `billing_cycle`, `payment_status`, `payment_gateway`, `thawani_reference`, `wablas_opt_in`, `created_at`, `status`, `picture`, `civil_id`) VALUES (1,'Test Student','test.student@example.com',NULL,NULL,NULL,'+96890000000','en','plus','monthly','active','Thawani','THW-20260406033249-179',1,'2026-04-06 03:32:49','active',NULL,NULL),
(2,'Demo Student','demo.student@example.com',NULL,NULL,NULL,'+96891111111','en','plus','monthly','active','Thawani','THW-20260406033255-559',1,'2026-04-06 03:32:55','active',NULL,NULL),
(3,'Mohammed','aalabry@gmail.com',NULL,NULL,NULL,'96899359472','ar','plus','monthly','active','Thawani','THW-20260406123732-241',0,'2026-04-06 12:37:32','active',NULL,NULL),
(4,'Mohammed','aa@aa.aa',NULL,NULL,NULL,'99359472','ar','plus','monthly','active','Thawani','THW-20260406164246-388',0,'2026-04-06 16:42:46','active',NULL,NULL),
(5,'Ahmed Ali','aq@aa.aa',NULL,NULL,NULL,'66643211','ar','plus','monthly','active','Thawani','THW-20260406170007-801',0,'2026-04-06 17:00:07','active',NULL,NULL);
/*!40000 ALTER TABLE `student_subscriptions` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `subjects`
--
LOCK TABLES `subjects` WRITE;
/*!40000 ALTER TABLE `subjects` DISABLE KEYS */;
INSERT IGNORE INTO `subjects` (`id`, `slug`, `title_en`, `title_ar`, `summary_en`, `summary_ar`, `teacher_en`, `teacher_ar`, `level_en`, `level_ar`, `duration_en`, `duration_ar`, `next_live_en`, `next_live_ar`, `meet_url`, `modules_en`, `modules_ar`, `created_at`, `class_id`, `status`) VALUES (1,'english-fluency','English Fluency Studio','استوديو الطلاقة في الإنجليزية','Speaking-first classrooms for teens and adults with weekly live workshops.','فصول تركّز على المحادثة للمراهقين والبالغين مع ورش مباشرة أسبوعية.','Sarah Coleman','سارة كولمان','Intermediate','متوسط','12 weeks','12 أسبوعاً','Wednesday, April 8, 2026 · 6:00 PM UTC','الأربعاء 8 أبريل 2026 · 6:00 مساءً UTC','https://meet.google.com/','[\"Live speaking labs\",\"Pronunciation clinic\",\"Writing feedback\",\"Weekly vocabulary sprints\"]','[\"\\u0645\\u062e\\u062a\\u0628\\u0631\\u0627\\u062a \\u0645\\u062d\\u0627\\u062f\\u062b\\u0629 \\u0645\\u0628\\u0627\\u0634\\u0631\\u0629\",\"\\u0639\\u064a\\u0627\\u062f\\u0629 \\u0627\\u0644\\u0646\\u0637\\u0642\",\"\\u0645\\u0644\\u0627\\u062d\\u0638\\u0627\\u062a \\u0639\\u0644\\u0649 \\u0627\\u0644\\u0643\\u062a\\u0627\\u0628\\u0629\",\"\\u062f\\u0641\\u0639\\u0627\\u062a \\u0645\\u0641\\u0631\\u062f\\u0627\\u062a \\u0623\\u0633\\u0628\\u0648\\u0639\\u064a\\u0629\"]','2026-04-06 03:37:49',NULL,'active'),
(2,'stem-lab','STEM Lab Foundations','أساسيات مختبر STEM','Math and science pathways with assignments, quizzes, and teacher office hours.','مسارات في الرياضيات والعلوم مع واجبات واختبارات وساعات مكتبية للمعلم.','Omar Al-Harthy','عمر الحارثي','Beginner to Advanced','من مبتدئ إلى متقدم','16 weeks','16 أسبوعاً','Thursday, April 9, 2026 · 5:00 PM UTC','الخميس 9 أبريل 2026 · 5:00 مساءً UTC','https://meet.google.com/','[\"Algebra tracks\",\"Physics demos\",\"Guided worksheets\",\"Lab challenge reviews\"]','[\"\\u0645\\u0633\\u0627\\u0631\\u0627\\u062a \\u0627\\u0644\\u062c\\u0628\\u0631\",\"\\u0639\\u0631\\u0648\\u0636 \\u0641\\u064a\\u0632\\u064a\\u0627\\u0621\",\"\\u0623\\u0648\\u0631\\u0627\\u0642 \\u0639\\u0645\\u0644 \\u0645\\u0648\\u062c\\u0647\\u0629\",\"\\u0645\\u0631\\u0627\\u062c\\u0639\\u0627\\u062a \\u062a\\u062d\\u062f\\u064a\\u0627\\u062a \\u0627\\u0644\\u0645\\u062e\\u062a\\u0628\\u0631\"]','2026-04-06 03:37:49',NULL,'active'),
(3,'arabic-academy','Arabic Language Academy','أكاديمية اللغة العربية','Modern Standard Arabic with reading circles and live grammar sessions.','العربية الفصحى مع حلقات قراءة وجلسات قواعد مباشرة.','Maha Al-Rashdi','مها الراشدي','All levels','جميع المستويات','10 weeks','10 أسابيع','Saturday, April 11, 2026 · 4:00 PM UTC','السبت 11 أبريل 2026 · 4:00 مساءً UTC','https://meet.google.com/','[\"Reading comprehension\",\"Live grammar board\",\"Listening practice\",\"Culture sessions\"]','[\"\\u0641\\u0647\\u0645 \\u0627\\u0644\\u0645\\u0642\\u0631\\u0648\\u0621\",\"\\u0633\\u0628\\u0648\\u0631\\u0629 \\u0642\\u0648\\u0627\\u0639\\u062f \\u0645\\u0628\\u0627\\u0634\\u0631\\u0629\",\"\\u062a\\u062f\\u0631\\u064a\\u0628 \\u0627\\u0644\\u0627\\u0633\\u062a\\u0645\\u0627\\u0639\",\"\\u062c\\u0644\\u0633\\u0627\\u062a \\u062b\\u0642\\u0627\\u0641\\u064a\\u0629\"]','2026-04-06 03:37:49',NULL,'active'),
(4,'design-systems','English','اللغة الإنجليزية','UI foundations, product thinking, and portfolio reviews in live cohorts.','أساسيات الواجهات والتفكير المنتج ومراجعات المحافظ ضمن مجموعات مباشرة.','Lina Mercer','لينا ميرسر','Professional','احترافي','8 weeks','8 أسابيع','Monday, April 13, 2026 · 7:00 PM UTC','الإثنين 13 أبريل 2026 · 7:00 مساءً UTC','https://meet.google.com/','[\"UI critique rooms\",\"Systems thinking\",\"Component audits\",\"Portfolio feedback\"]','[\"\\u063a\\u0631\\u0641 \\u0646\\u0642\\u062f \\u0627\\u0644\\u0648\\u0627\\u062c\\u0647\\u0627\\u062a\",\"\\u062a\\u0641\\u0643\\u064a\\u0631 \\u0627\\u0644\\u0623\\u0646\\u0638\\u0645\\u0629\",\"\\u062a\\u062f\\u0642\\u064a\\u0642 \\u0627\\u0644\\u0645\\u0643\\u0648\\u0646\\u0627\\u062a\",\"\\u0645\\u0644\\u0627\\u062d\\u0638\\u0627\\u062a \\u0639\\u0644\\u0649 \\u0627\\u0644\\u0645\\u062d\\u0641\\u0638\\u0629\"]','2026-04-06 03:37:49',4,'active'),
(5,'english-1b1cc','English','اللغة الإنجليزية','','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-04-06 04:43:35',3,'active');
/*!40000 ALTER TABLE `subjects` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `teacher_assignments`
--
LOCK TABLES `teacher_assignments` WRITE;
/*!40000 ALTER TABLE `teacher_assignments` DISABLE KEYS */;
INSERT IGNORE INTO `teacher_assignments` (`id`, `teacher_id`, `class_id`, `subject_id`, `created_at`) VALUES (1,1,3,5,'2026-04-06 05:46:28');
/*!40000 ALTER TABLE `teacher_assignments` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `teachers`
--
LOCK TABLES `teachers` WRITE;
/*!40000 ALTER TABLE `teachers` DISABLE KEYS */;
INSERT IGNORE INTO `teachers` (`id`, `name`, `email`, `bio`, `photo_path`, `created_at`, `phone`, `password`, `status`) VALUES (1,'Moosa Ali Al-Abri','aalabry@gmail.com','','assets/images/uploads/teacher_1775489347_men.webp','2026-04-06 05:07:32','99359472','$2y$10$Uvj7/WOix7t9Z59YDqP4MuOKhlm.X23QSoVW5TiQ7noBWa9aRE1zS','active');
/*!40000 ALTER TABLE `teachers` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `users`
--
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT IGNORE INTO `users` (`id`, `name`, `email`, `password`, `reset_token`, `reset_expires`, `role`, `created_at`, `phone`, `profile_picture`) VALUES (1,'Admin','admin@example.com','$2y$10$jpNfKXoZdT8yhnnK/95cGOQ./14fzBrKQmCkq4jR8mIqqFGNAQedm',NULL,NULL,'admin','2026-04-07 04:13:06',NULL,NULL);
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2026-04-07 13:32:18

265
install.php Normal file
View File

@ -0,0 +1,265 @@
<?php
session_start();
// Define steps
$step = isset($_GET['step']) ? (int)$_GET['step'] : 1;
$error = '';
$success = '';
// Check if config exists
$configFile = __DIR__ . '/db/config.php';
$configExists = file_exists($configFile);
$dbHost = '127.0.0.1';
$dbName = '';
$dbUser = '';
$dbPass = '';
if ($configExists) {
require_once $configFile;
if (defined('DB_HOST')) $dbHost = DB_HOST;
if (defined('DB_NAME')) $dbName = DB_NAME;
if (defined('DB_USER')) $dbUser = DB_USER;
if (defined('DB_PASS')) $dbPass = DB_PASS;
}
// Handle form submissions
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if ($step === 2) {
$dbHost = $_POST['db_host'] ?? '127.0.0.1';
$dbName = $_POST['db_name'] ?? '';
$dbUser = $_POST['db_user'] ?? '';
$dbPass = $_POST['db_pass'] ?? '';
try {
// Test connection
$pdo = new PDO("mysql:host=$dbHost;dbname=$dbName;charset=utf8mb4", $dbUser, $dbPass, [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
]);
// Save configuration
$configContent = "<?php\n" .
"// Generated by install.php\n" .
"define('DB_HOST', " . var_export($dbHost, true) . ");\n" .
"define('DB_NAME', " . var_export($dbName, true) . ");\n" .
"define('DB_USER', " . var_export($dbUser, true) . ");\n" .
"define('DB_PASS', " . var_export($dbPass, true) . ");\n\n" .
"function db() {\n" .
" static \$pdo;\n" .
" if (!\$pdo) {\n" .
" \$pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8mb4', DB_USER, DB_PASS, [\n" .
" PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,\n" .
" PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,\n" .
" ]);\n" .
" }\n" .
" return \$pdo;\n" .
"}\n";
if (!is_dir(__DIR__ . '/db')) {
mkdir(__DIR__ . '/db', 0755, true);
}
file_put_contents($configFile, $configContent);
header("Location: ?step=3");
exit;
} catch (PDOException $e) {
$error = "Database Connection Failed: " . $e->getMessage();
}
} elseif ($step === 3) {
require_once $configFile;
try {
$pdo = db();
$schemaFile = __DIR__ . '/db/migrations/schema.sql';
if (!file_exists($schemaFile)) {
throw new Exception("Schema file not found at $schemaFile");
}
$sql = file_get_contents($schemaFile);
$pdo->exec($sql);
header("Location: ?step=4");
exit;
} catch (Exception $e) {
$error = "Migration Failed: " . $e->getMessage();
}
} elseif ($step === 4) {
require_once $configFile;
try {
$pdo = db();
$seedsFile = __DIR__ . '/db/migrations/seeds.sql';
if (!file_exists($seedsFile)) {
throw new Exception("Seeds file not found at $seedsFile");
}
$sql = file_get_contents($seedsFile);
$pdo->exec($sql);
header("Location: ?step=5");
exit;
} catch (Exception $e) {
$error = "Seeding Failed: " . $e->getMessage();
}
}
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Platform Installer - Step <?php echo $step; ?></title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
<style>
body { background: #f4f7f6; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0; }
.install-card { background: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); overflow: hidden; max-width: 600px; width: 100%; margin: 2rem; }
.install-header { background: #007bff; color: #fff; padding: 2rem; text-align: center; }
.install-header h1 { margin: 0; font-size: 1.8rem; font-weight: 600; }
.install-body { padding: 2rem; }
.step-indicator { display: flex; justify-content: space-between; margin-bottom: 2rem; position: relative; }
.step-indicator::before { content: ''; position: absolute; top: 15px; left: 0; right: 0; height: 3px; background: #e9ecef; z-index: 1; }
.step { width: 32px; height: 32px; border-radius: 50%; background: #e9ecef; color: #6c757d; display: flex; align-items: center; justify-content: center; font-weight: bold; position: relative; z-index: 2; transition: all 0.3s; }
.step.active { background: #007bff; color: #fff; box-shadow: 0 0 0 4px rgba(0,123,255,0.2); }
.step.completed { background: #28a745; color: #fff; }
.btn-primary { background: #007bff; border: none; padding: 0.75rem 1.5rem; font-weight: 500; border-radius: 8px; }
.btn-primary:hover { background: #0056b3; }
.alert { border-radius: 8px; }
.code-block { background: #f8f9fa; padding: 1rem; border-radius: 8px; font-family: monospace; border: 1px solid #dee2e6; }
</style>
</head>
<body>
<div class="install-card">
<div class="install-header">
<h1>Installation Wizard</h1>
<p class="mb-0 mt-2 opacity-75">Setup your platform in 5 easy steps</p>
</div>
<div class="install-body">
<div class="step-indicator">
<?php for ($i = 1; $i <= 5; $i++): ?>
<div class="step <?php echo $i === $step ? 'active' : ($i < $step ? 'completed' : ''); ?>">
<?php echo $i < $step ? '✓' : $i; ?>
</div>
<?php endfor; ?>
</div>
<?php if ($error): ?>
<div class="alert alert-danger"><?php echo htmlspecialchars($error); ?></div>
<?php endif; ?>
<?php if ($step === 1): ?>
<h3 class="mb-3">Step 1: Welcome & Requirements</h3>
<p>Welcome to the platform installation wizard! We will guide you through setting up the database, migrating tables, and loading the initial data.</p>
<ul class="list-group mb-4">
<li class="list-group-item d-flex justify-content-between align-items-center">
PHP Version >= 8.0
<?php if (version_compare(PHP_VERSION, '8.0.0', '>=')): ?>
<span class="badge bg-success rounded-pill">OK (<?php echo PHP_VERSION; ?>)</span>
<?php else: ?>
<span class="badge bg-danger rounded-pill">Fail (<?php echo PHP_VERSION; ?>)</span>
<?php endif; ?>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
PDO MySQL Extension
<?php if (extension_loaded('pdo_mysql')):
?>
<span class="badge bg-success rounded-pill">OK</span>
<?php else:
?>
<span class="badge bg-danger rounded-pill">Fail</span>
<?php endif; ?>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
Writable Config Directory (db/)
<?php if (is_writable(__DIR__ . '/db') || is_writable(__DIR__)): ?>
<span class="badge bg-success rounded-pill">OK</span>
<?php else:
?>
<span class="badge bg-danger rounded-pill">Fail</span>
<?php endif; ?>
</li>
</ul>
<div class="d-flex justify-content-end">
<a href="?step=2" class="btn btn-primary">Next Step: Database Config &rarr;</a>
</div>
<?php elseif ($step === 2): ?>
<h3 class="mb-3">Step 2: Database Configuration</h3>
<p class="text-muted">Enter your database credentials below. If `db/config.php` already exists, the fields will be pre-filled.</p>
<form method="POST">
<div class="mb-3">
<label class="form-label">Database Host</label>
<input type="text" name="db_host" class="form-control" value="<?php echo htmlspecialchars($dbHost); ?>" required>
</div>
<div class="mb-3">
<label class="form-label">Database Name</label>
<input type="text" name="db_name" class="form-control" value="<?php echo htmlspecialchars($dbName); ?>" required>
</div>
<div class="mb-3">
<label class="form-label">Database User</label>
<input type="text" name="db_user" class="form-control" value="<?php echo htmlspecialchars($dbUser); ?>" required>
</div>
<div class="mb-3">
<label class="form-label">Database Password</label>
<input type="password" name="db_pass" class="form-control" value="<?php echo htmlspecialchars($dbPass); ?>">
</div>
<div class="d-flex justify-content-between mt-4">
<a href="?step=1" class="btn btn-outline-secondary">&larr; Back</a>
<button type="submit" class="btn btn-primary">Save & Test Connection &rarr;</button>
</div>
</form>
<?php elseif ($step === 3): ?>
<h3 class="mb-3">Step 3: Database Migrations</h3>
<p>Your database configuration is valid! The next step is to create the necessary tables in your database using the schema file.</p>
<div class="alert alert-info">
<strong>Action:</strong> Running this will execute `db/migrations/schema.sql` to build the database structure. Existing tables might be dropped and recreated.
</div>
<form method="POST">
<div class="d-flex justify-content-between mt-4">
<a href="?step=2" class="btn btn-outline-secondary">&larr; Back</a>
<button type="submit" class="btn btn-primary">Run Migrations &rarr;</button>
</div>
</form>
<?php elseif ($step === 4): ?>
<h3 class="mb-3">Step 4: Database Seeding</h3>
<p>Tables have been created successfully! The next step is to insert the initial data (seeds) into the database.</p>
<div class="alert alert-info">
<strong>Action:</strong> Running this will execute `db/migrations/seeds.sql` to load default data, including the admin account and platform settings.
</div>
<form method="POST">
<div class="d-flex justify-content-between mt-4">
<a href="?step=3" class="btn btn-outline-secondary">&larr; Back</a>
<button type="submit" class="btn btn-success">Run Seeds &rarr;</button>
</div>
</form>
<?php elseif ($step === 5): ?>
<div class="text-center py-4">
<div class="mb-4">
<svg style="color: #28a745; width: 64px; height: 64px;" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
</div>
<h3 class="mb-3">Installation Complete!</h3>
<p class="text-muted">Your platform has been successfully installed and configured.</p>
<div class="alert alert-warning text-start">
<strong>Security Warning:</strong> Please delete the <code>install.php</code> file from your server to prevent unauthorized re-installation.
</div>
<div class="mt-4">
<a href="index.php" class="btn btn-primary me-2">Go to Landing Page</a>
<a href="login.php" class="btn btn-outline-primary">Go to Admin Login</a>
</div>
</div>
<?php endif; ?>
</div>
</div>
</body>
</html>