-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsection.php
More file actions
108 lines (102 loc) · 4.67 KB
/
Copy pathsection.php
File metadata and controls
108 lines (102 loc) · 4.67 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
/**
* Section configuration — the only real difference between the poetry site
* at / and the prose site at /mer-vi.
*
* Both used to be complete copies of every page. They differed in exactly two
* ways: the genre they query for, and a handful of words (Poet/Writer,
* לידער/דערצײלונגען). Everything else was duplicated, which meant every fix —
* including the SQL injection and the graph.php command injection — had to be
* made twice, and in practice sometimes wasn't.
*
* A page under /mer-vi sets $GENRE = 'story' and then includes the shared page
* from the root. URLs are unchanged: /mer-vi/poem.php?poem=x still works.
*/
require_once __DIR__ . '/media.php';
$GENRE = $GENRE ?? 'poem';
if (!in_array($GENRE, ['poem', 'story'], true)) {
$GENRE = 'poem';
}
$SECTIONS = [
'poem' => [
'genre' => 'poem',
'home' => '/',
'title' => 'Treasury of Yiddish Poetry',
'h1_e' => 'The Online Treasury of Yiddish Poetry',
'h1_y' => 'דער „אױפֿן־װעב“ אוצר פֿון ייִדישע לידער',
'author_e' => 'The Poet',
'author_y' => 'דער דיכטער',
'more_author' => 'More on the poet:',
'more_work' => 'More on the poem:',
'expand' => 'Expand or Shrink the Poem',
'browse_e' => 'Browse the Poems from',
'browse_y' => 'בלעטערט איבער די לידער פֿון',
// index.php browse buttons and headings
'works_e' => 'Poems',
'works_y' => 'די לידער',
'authors_e' => 'Poets',
'authors_y' => 'די דיכטערס',
'br_works_e' => 'Browse the Poems',
'br_works_y' => 'בלעטערט איבער די לידער',
'br_authors_e' => 'Browse the Poets',
'br_authors_y' => 'בלעטערט איבער די דיכטערס',
// Lowercase forms for running text — the graph links and the
// statistics panel. Spelled out rather than derived from the plurals
// above: singularising by trimming an "s" turns Stories into Storie,
// and a special case for that is worse than simply saying the word.
'work_one' => 'poem',
'works_many' => 'poems',
'author_one' => 'poet',
'authors_many' => 'poets',
'fish_icon' => true, // fish rather than the coffee cup
],
'story' => [
'genre' => 'story',
'home' => '/', // mer-vi is a subdomain: its own root
'title' => 'Treasury of Yiddish Stories',
'h1_e' => 'The Online Treasury of Yiddish <s>Poetry</s> Stories',
'h1_y' => 'דער „אױפֿן־װעב“ אוצר פֿון ייִדישע <s>לידער</s> דערצײלונגען',
'author_e' => 'The Writer',
'author_y' => 'דער שרײַבער',
'more_author' => 'More on the writer:',
'more_work' => 'More on the story:',
'expand' => 'Expand or Shrink the Story',
'browse_e' => 'Browse the Stories from',
'browse_y' => 'בלעטערט איבער די דערצײלונגען פֿון',
// index.php browse buttons and headings
'works_e' => 'Stories',
'works_y' => 'די דערצײלונגען',
'authors_e' => 'Writers',
'authors_y' => 'די שרײַבערס',
'br_works_e' => 'Browse the Stories',
'br_works_y' => 'בלעטערט איבער די דערצײלונגען',
'br_authors_e' => 'Browse the Writers',
'br_authors_y' => 'בלעטערט איבער די שרײַבערס',
'work_one' => 'story',
'works_many' => 'stories',
'author_one' => 'writer',
'authors_many' => 'writers',
// Was false: the prose site showed the plain coffee cup, because the
// old header.php only pulled in the fish script for poetry. Both
// sections share one donation link, so they may as well share the
// icon.
'fish_icon' => true,
],
];
$S = $SECTIONS[$GENRE];
/**
* Prefix for root-relative asset URLs.
*
* Empty for BOTH sections: mer-vi is served as its own subdomain, so a
* request for /style.css there already resolves inside mer-vi/. The directory
* happens to sit inside the lider tree on disk, but that nesting is never
* visible in a URL. Kept as a variable so the pages document the intent.
*/
$SECTION_BASE = '';
/** Escape for HTML. Short name because it is used constantly in templates. */
if (!function_exists('e')) {
function e(?string $s): string
{
return htmlspecialchars((string)$s, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
}
}