Repository navigation
Expand file tree
/
Copy pathpbook.php
More file actions
55 lines (44 loc) · 1.79 KB
/
Copy pathpbook.php
File metadata and controls
55 lines (44 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/**
* PowerBook - PHP Guestbook System
* Gästebuch (öffentliche Seite)
*
* @license MIT
* @copyright PowerScripts.org
*
* @see https://www.powerscripts.org
*/
declare(strict_types=1);
// pbook.php/irgendwas: relative Pfade (CSS, Bilder) würden ins Leere zeigen.
$pbPathInfo = $_SERVER['PATH_INFO'] ?? '';
if (is_string($pbPathInfo) && $pbPathInfo !== '' && PHP_SAPI !== 'cli') {
header('Location: ' . (string) ($_SERVER['SCRIPT_NAME'] ?? '/pbook.php'), true, 301);
exit;
}
// guestbook.inc.php lehnt Aufrufe ohne diese Konstante ab.
if (!defined('PB_ENTRY')) {
define('PB_ENTRY', true);
}
require_once __DIR__ . '/pb_inc/config.inc.php';
require_once __DIR__ . '/pb_inc/layout.inc.php';
// Inhalt zuerst erzeugen: Nach dem Eintragen leitet guestbook.inc.php um,
// bevor etwas ausgegeben ist; außerdem setzt es den Seitentitel.
ob_start();
include __DIR__ . '/pb_inc/guestbook.inc.php';
$pbContent = (string) ob_get_clean();
$pbSiteTitle = trim((string) ($config_title ?? '')) !== '' ? (string) $config_title : 'Gästebuch';
if (!headers_sent()) {
header('Content-Type: text/html; charset=UTF-8');
// Skripte nur von hier und vom Bootstrap-CDN – auch wenn ein Design oder
// ein Eintrag doch einmal Markup durchschmuggeln sollte.
header("Content-Security-Policy: script-src 'self' https://cdn.jsdelivr.net; object-src 'none'; base-uri 'self'; frame-ancestors 'self'");
}
pb_layout_header(isset($pbPageTitle) && is_string($pbPageTitle) && $pbPageTitle !== '' ? $pbPageTitle : $pbSiteTitle, [
'showNav' => true,
'adminLink' => 'pb_inc/admincenter/',
'siteName' => $pbSiteTitle,
'homeLink' => trim((string) ($config_guestbook_name ?? '')) !== '' ? (string) $config_guestbook_name : 'pbook.php',
'brandHeading' => true,
]);
echo $pbContent;
pb_layout_footer();