"; ?> 0 && $pdo instanceof PDO) { $stmt = $pdo->prepare( "SELECT publication_titre, publication_file1, publication_redactionnel, publication_contenu_redactionnel, publication_contenu FROM publication WHERE id = :id LIMIT 1" ); $stmt->execute([':id' => $publicationId]); $publicationMeta = $stmt->fetch(PDO::FETCH_ASSOC) ?: []; $publicationTitle = trim((string) ($publicationMeta['publication_titre'] ?? '')); if ($publicationTitle !== '') { $headTitle = $publicationTitle; } else { $headTitle = 'Publication'; } $descriptionSource = trim((string) ($publicationMeta['publication_redactionnel'] ?? '')); if ($descriptionSource === '') { $descriptionSource = trim((string) ($publicationMeta['publication_contenu_redactionnel'] ?? '')); } if ($descriptionSource === '') { $descriptionSource = trim((string) ($publicationMeta['publication_contenu'] ?? '')); } if ($descriptionSource !== '') { $descriptionSource = strip_tags(html_entity_decode($descriptionSource, ENT_QUOTES, 'UTF-8')); $descriptionSource = preg_replace('/\s+/', ' ', $descriptionSource) ?? ''; $metaDescription = trim(mb_substr($descriptionSource, 0, 220)); } $shareScheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; $shareHost = trim((string) ($_SERVER['HTTP_HOST'] ?? '')); $trackingHash = trim((string) ($_GET['h'] ?? '')); if ($shareHost !== '') { $metaOgUrl = $shareScheme . '://' . $shareHost . '/php/ouvert/ouvert.php?page=publication_etape_4&id=' . $publicationId; if ($trackingHash !== '') { $metaOgUrl .= '&h=' . rawurlencode($trackingHash); } } $illustrationPath = trim((string) ($publicationMeta['publication_file1'] ?? '')); if ($illustrationPath !== '' && $shareHost !== '') { $illustrationUrl = ctz_public_media_url($illustrationPath); if (preg_match('#^https?://#i', $illustrationUrl)) { $metaOgImage = $illustrationUrl; } elseif ($illustrationUrl !== '') { $metaOgImage = $shareScheme . '://' . $shareHost . $illustrationUrl; } else { $metaOgImage = $illustrationPath; } } } } /*$pagesAutorisees = ['accueil', 'ouvert', 'login', 'wrongmdp']; if ($page !== '' && !in_array($page, $pagesAutorisees)) { header('Location: /php/ouvert/ouvert.php?page=login'); }*/ ?> <?= htmlspecialchars($headTitle, ENT_QUOTES, 'UTF-8') ?>
"; ?>