65 lines
2.9 KiB
PHP
65 lines
2.9 KiB
PHP
<?php
|
|
$content = file_get_contents('admin_company_profile.php');
|
|
|
|
$php_updates = <<<PHP
|
|
\$updates = [
|
|
'company_name' => \$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 = <<<PHP
|
|
\$currentLogo = \$settings['logo_path'] ?? '';
|
|
\$currentFavicon = \$settings['favicon_path'] ?? '';
|
|
\$currentTermsEn = \$settings['terms_en'] ?? '';
|
|
\$currentTermsAr = \$settings['terms_ar'] ?? '';
|
|
\$currentPrivacyEn = \$settings['privacy_en'] ?? '';
|
|
\$currentPrivacyAr = \$settings['privacy_ar'] ?? '';
|
|
PHP;
|
|
|
|
$content = str_replace("\\\$currentFavicon = \\\$settings['favicon_path'] ?? '';", $fetch_vars, $content);
|
|
|
|
$html_fields = <<<HTML
|
|
<div class="col-md-12">
|
|
<hr class="my-2">
|
|
<h5 class="fw-bold mb-3">Legal & Policies</h5>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label class="form-label fw-bold">Terms of Service (English)</label>
|
|
<textarea name="terms_en" class="form-control" rows="5"><?= htmlspecialchars(\\$currentTermsEn, ENT_QUOTES, 'UTF-8') ?></textarea>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label class="form-label fw-bold">Terms of Service (Arabic)</label>
|
|
<textarea name="terms_ar" class="form-control" rows="5" dir="rtl"><?= htmlspecialchars(\\$currentTermsAr, ENT_QUOTES, 'UTF-8') ?></textarea>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label class="form-label fw-bold">Privacy Policy (English)</label>
|
|
<textarea name="privacy_en" class="form-control" rows="5"><?= htmlspecialchars(\\$currentPrivacyEn, ENT_QUOTES, 'UTF-8') ?></textarea>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label class="form-label fw-bold">Privacy Policy (Arabic)</label>
|
|
<textarea name="privacy_ar" class="form-control" rows="5" dir="rtl"><?= htmlspecialchars(\\$currentPrivacyAr, ENT_QUOTES, 'UTF-8') ?></textarea>
|
|
</div>
|
|
</div>
|
|
HTML;
|
|
|
|
$content = str_replace(" </div>\n \n <hr class=\"my-4\">
|
|
", $html_fields . "\n \n <hr class=\"my-4\">
|
|
", $content);
|
|
|
|
file_put_contents('admin_company_profile.php', $content);
|
|
|