From 1173fcbe16cd8282b1d76c77e3b55d7b3951ed0d Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sun, 8 Mar 2026 02:54:06 +0000 Subject: [PATCH] add privacy --- admin_company_profile.php | 37 ++++- admin_landing_pages.php | 209 +++++++++++++++++++++++++ db/migrations/add_landing_sections.php | 24 +++ includes/app.php | 16 ++ includes/layout.php | 9 +- index.php | 51 ++++++ patch_company_profile.php | 64 ++++++++ privacy.php | 36 +++++ terms.php | 36 +++++ 9 files changed, 477 insertions(+), 5 deletions(-) create mode 100644 admin_landing_pages.php create mode 100644 db/migrations/add_landing_sections.php create mode 100644 patch_company_profile.php create mode 100644 privacy.php create mode 100644 terms.php diff --git a/admin_company_profile.php b/admin_company_profile.php index 95efdff..c83cc2f 100644 --- a/admin_company_profile.php +++ b/admin_company_profile.php @@ -21,6 +21,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { 'company_phone' => $companyPhone, 'company_address' => $companyAddress, 'platform_charge_percentage' => $platformCharge, + 'terms_en' => trim($_POST['terms_en'] ?? ''), + 'terms_ar' => trim($_POST['terms_ar'] ?? ''), + 'privacy_en' => trim($_POST['privacy_en'] ?? ''), + 'privacy_ar' => trim($_POST['privacy_ar'] ?? ''), ]; // Handle file uploads @@ -78,6 +82,10 @@ $currentAddress = $settings['company_address'] ?? ''; $currentPlatformCharge = $settings['platform_charge_percentage'] ?? '0'; $currentLogo = $settings['logo_path'] ?? ''; $currentFavicon = $settings['favicon_path'] ?? ''; +$currentTermsEn = $settings['terms_en'] ?? ''; +$currentTermsAr = $settings['terms_ar'] ?? ''; +$currentPrivacyEn = $settings['privacy_en'] ?? ''; +$currentPrivacyAr = $settings['privacy_ar'] ?? ''; render_header('Company Profile', 'admin'); ?> @@ -89,7 +97,7 @@ render_header('Company Profile', 'admin');

Company Profile

-

Update your app name, logo, favicon, contact details, and platform charge.

+

Update your app name, logo, favicon, contact details, platform charge, and legal policies.

@@ -159,6 +167,31 @@ render_header('Company Profile', 'admin');
Recommended size: 32x32px (ICO, PNG, SVG). Leave empty to keep current.
+ +
+
+
Legal & Policies
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +

@@ -168,4 +201,4 @@ render_header('Company Profile', 'admin'); - \ No newline at end of file + diff --git a/admin_landing_pages.php b/admin_landing_pages.php new file mode 100644 index 0000000..47ba94a --- /dev/null +++ b/admin_landing_pages.php @@ -0,0 +1,209 @@ +prepare("INSERT INTO landing_sections (title, subtitle, content, image_path, layout, button_text, button_link, section_order, is_active) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"); + $stmt->execute([$title, $subtitle, $content, $image_path, $layout, $button_text, $button_link, $section_order, $is_active]); + set_flash('success', 'Section created successfully.'); + } else { + $stmt = $pdo->prepare("UPDATE landing_sections SET title=?, subtitle=?, content=?, image_path=?, layout=?, button_text=?, button_link=?, section_order=?, is_active=? WHERE id=?"); + $stmt->execute([$title, $subtitle, $content, $image_path, $layout, $button_text, $button_link, $section_order, $is_active, $id]); + set_flash('success', 'Section updated successfully.'); + } + header('Location: ' . url_with_lang('admin_landing_pages.php')); + exit; + } elseif ($action === 'delete') { + $id = $_POST['id'] ?? null; + if ($id) { + $stmt = $pdo->prepare("DELETE FROM landing_sections WHERE id=?"); + $stmt->execute([$id]); + set_flash('success', 'Section deleted successfully.'); + } + header('Location: ' . url_with_lang('admin_landing_pages.php')); + exit; + } +} + +$stmt = $pdo->query("SELECT * FROM landing_sections ORDER BY section_order ASC, id ASC"); +$sections = $stmt->fetchAll(); + +$editId = $_GET['edit'] ?? null; +$editSection = null; +if ($editId) { + $stmt = $pdo->prepare("SELECT * FROM landing_sections WHERE id = ?"); + $stmt->execute([$editId]); + $editSection = $stmt->fetch(); +} + +render_header(t('app_name') . ' - Landing Pages', 'admin'); +?> + +
+
+ +
+
+ +
+

Landing Page Customization

+ Back to Dashboard +
+ + +
+ + +
+ + +
+
+
+

+
+ + + + + + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+ + + +
+ Current Image +
+ +
+ +
+ > + +
+ +
+ + + Cancel + +
+
+
+
+ +
+
+

Current Sections

+ +

No custom sections added yet.

+ +
+ +
+
+
+ Order: | Layout: +
+
+ Edit +
+ + + +
+
+
+ +
+ +
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/db/migrations/add_landing_sections.php b/db/migrations/add_landing_sections.php new file mode 100644 index 0000000..eba5fdd --- /dev/null +++ b/db/migrations/add_landing_sections.php @@ -0,0 +1,24 @@ +exec(" + CREATE TABLE IF NOT EXISTS landing_sections ( + id INT AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(255) NOT NULL, + subtitle TEXT NULL, + content TEXT NULL, + image_path VARCHAR(255) NULL, + layout ENUM('text_left', 'text_right', 'center') NOT NULL DEFAULT 'text_left', + button_text VARCHAR(100) NULL, + button_link VARCHAR(255) NULL, + section_order INT NOT NULL DEFAULT 0, + is_active TINYINT(1) NOT NULL DEFAULT 1, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + "); + echo "landing_sections table created.\n"; +} catch (Exception $e) { + echo "Error: " . $e->getMessage() . "\n"; +} + diff --git a/includes/app.php b/includes/app.php index 1af88b7..b93ee41 100644 --- a/includes/app.php +++ b/includes/app.php @@ -164,6 +164,22 @@ function e($value): string function ensure_schema(): void { + db()->exec(" + CREATE TABLE IF NOT EXISTS landing_sections ( + id INT AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(255) NOT NULL, + subtitle TEXT NULL, + content TEXT NULL, + image_path VARCHAR(255) NULL, + layout ENUM('text_left', 'text_right', 'center') NOT NULL DEFAULT 'text_left', + button_text VARCHAR(100) NULL, + button_link VARCHAR(255) NULL, + section_order INT NOT NULL DEFAULT 0, + is_active TINYINT(1) NOT NULL DEFAULT 1, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + "); + $sql = <<Resources
@@ -211,7 +211,7 @@ function render_admin_sidebar(string $active = 'dashboard'): void $settingsActive = in_array($active, ['company_profile', 'integrations']); $locationsActive = in_array($active, ['countries', 'cities']); $usersActive = in_array($active, ['shippers', 'truck_owners', 'register']); - $pagesActive = in_array($active, ['faqs']); + $pagesActive = in_array($active, ['faqs', 'landing_pages']); ?>
diff --git a/index.php b/index.php index 9554ec0..bb66e79 100644 --- a/index.php +++ b/index.php @@ -235,4 +235,55 @@ render_header(t('app_name'), 'home'); +query("SELECT * FROM landing_sections WHERE is_active = 1 ORDER BY section_order ASC, id ASC"); + $landingSections = $stmt->fetchAll(); + foreach ($landingSections as $sec): +?> +
+ +
+ + + +

+ +

+ + +
+ + + + +
+ +
+
+ + + +
+
+
+

+ +
+ + +
+ + + + +
+
+
+ +
+ \ No newline at end of file diff --git a/patch_company_profile.php b/patch_company_profile.php new file mode 100644 index 0000000..a5ffd2e --- /dev/null +++ b/patch_company_profile.php @@ -0,0 +1,64 @@ + \$companyName, + 'company_email' => \$companyEmail, + 'company_phone' => \$companyPhone, + 'company_address' => \$companyAddress, + 'platform_charge_percentage' => \$platformCharge, + 'terms_en' => trim(\\\$_POST['terms_en'] ?? ''), + 'terms_ar' => trim(\\\$_POST['terms_ar'] ?? ''), + 'privacy_en' => trim(\\\$_POST['privacy_en'] ?? ''), + 'privacy_ar' => trim(\\\$_POST['privacy_ar'] ?? ''), + ]; +PHP; + +$content = preg_replace("/\\\\\$updates = \\\\[\\\\\s\\\\\\S]*?'platform_charge_percentage' => \\\\$platformCharge,\\n \\\\];/', $php_updates, $content); + +$fetch_vars = << +
+
Legal & Policies
+ + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +HTML; + +$content = str_replace(" \n \n
+", $html_fields . "\n \n
+", $content); + +file_put_contents('admin_company_profile.php', $content); + diff --git a/privacy.php b/privacy.php new file mode 100644 index 0000000..caa1d3a --- /dev/null +++ b/privacy.php @@ -0,0 +1,36 @@ + + +
+
+
+

+
+
> + +

+ +

+ +
+ +
+ +
+
+
+
+
+ + diff --git a/terms.php b/terms.php new file mode 100644 index 0000000..2a5155d --- /dev/null +++ b/terms.php @@ -0,0 +1,36 @@ + + +
+
+
+

+
+
> + +

+ +

+ +
+ +
+ +
+
+
+
+
+ +