$companyName, 'company_email' => $companyEmail, 'company_phone' => $companyPhone, 'company_address' => $companyAddress, 'platform_charge_percentage' => $platformCharge, 'timezone' => $timezone, '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 $uploadDir = __DIR__ . '/uploads/logos/'; if (!is_dir($uploadDir)) { mkdir($uploadDir, 0775, true); } if (isset($_FILES['logo_file']) && $_FILES['logo_file']['error'] === UPLOAD_ERR_OK) { $tmpName = $_FILES['logo_file']['tmp_name']; $ext = strtolower(pathinfo($_FILES['logo_file']['name'], PATHINFO_EXTENSION)); $allowedExt = ['jpg', 'jpeg', 'png', 'gif', 'svg', 'webp']; if (in_array($ext, $allowedExt, true)) { $logoName = 'logo_' . time() . '.' . $ext; $dest = $uploadDir . $logoName; if (move_uploaded_file($tmpName, $dest)) { $updates['logo_path'] = '/uploads/logos/' . $logoName; } } else { $errors[] = "Invalid logo format."; } } if (isset($_FILES['favicon_file']) && $_FILES['favicon_file']['error'] === UPLOAD_ERR_OK) { $tmpName = $_FILES['favicon_file']['tmp_name']; $ext = strtolower(pathinfo($_FILES['favicon_file']['name'], PATHINFO_EXTENSION)); $allowedExt = ['ico', 'png', 'svg', 'gif']; if (in_array($ext, $allowedExt, true)) { $faviconName = 'favicon_' . time() . '.' . $ext; $dest = $uploadDir . $faviconName; if (move_uploaded_file($tmpName, $dest)) { $updates['favicon_path'] = '/uploads/logos/' . $faviconName; } } else { $errors[] = "Invalid favicon format."; } } if (empty($errors)) { $pdo = db(); foreach ($updates as $key => $val) { $stmt = $pdo->prepare("INSERT INTO settings (setting_key, setting_value) VALUES (:k, :v) ON DUPLICATE KEY UPDATE setting_value = :v2"); $stmt->execute([':k' => $key, ':v' => $val, ':v2' => $val]); } $success = "Company profile updated successfully."; } } // Fetch current settings $settings = get_settings(); $currentName = $settings['company_name'] ?? t('app_name'); $currentEmail = $settings['company_email'] ?? ''; $currentPhone = $settings['company_phone'] ?? ''; $currentAddress = $settings['company_address'] ?? ''; $currentPlatformCharge = $settings['platform_charge_percentage'] ?? '0'; $currentTimezone = $settings['timezone'] ?? 'UTC'; $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', true); ?>
Update your app name, logo, favicon, contact details, platform charge, and legal policies.