Use auto_prepend_file INI directive to prepend Core.php to all web requests automatically

This commit is contained in:
Alex Cabal 2023-07-15 15:17:20 -05:00
parent fa952176d1
commit 042816cf45
69 changed files with 28 additions and 162 deletions

View file

@ -16,3 +16,4 @@ slowlog = /var/log/local/php-fpm-slow.log
catch_workers_output = yes
php_admin_value[include_path] = /standardebooks.org/web/lib
php_admin_value[auto_prepend_file] = Core.php

View file

@ -16,3 +16,4 @@ slowlog = /var/log/local/php-fpm-slow.log
catch_workers_output = yes
php_admin_value[include_path] = /standardebooks.org/web/lib:/standardebooks.org/web/vendor
php_admin_value[auto_prepend_file] = Core.php

View file

@ -1,7 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'We Couldnt Find That Document', 'highlight' => '', 'description' => 'We couldnt find that document.', 'is404' => true]) ?>
<?= Template::Header(['title' => 'We Couldnt Find That Document', 'highlight' => '', 'description' => 'We couldnt find that document.', 'is404' => true]) ?>
<main>
<section class="narrow has-hero">
<hgroup>

View file

@ -1,7 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'This Ebook Is No Longer Available', 'highlight' => '', 'description' => 'This ebook is unavailable due to legal reasons.']) ?>
<?= Template::Header(['title' => 'This Ebook Is No Longer Available', 'highlight' => '', 'description' => 'This ebook is unavailable due to legal reasons.']) ?>
<main>
<section class="narrow has-hero">
<hgroup>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
$patronsCircle = [];
$anonymousPatronCount = 0;

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'Our goals', 'highlight' => 'about', 'description' => 'The goals of Standard Ebooks.']) ?>
<?= Template::Header(['title' => 'Our goals', 'highlight' => 'about', 'description' => 'The goals of Standard Ebooks.']) ?>
<main>
<article>
<h1>Our Goals</h1>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'Standard Ebooks and the public domain', 'highlight' => 'about', 'description' => 'The Standard Ebooks philosophy on copyright and the public domain.']) ?>
<?= Template::Header(['title' => 'Standard Ebooks and the public domain', 'highlight' => 'about', 'description' => 'The Standard Ebooks philosophy on copyright and the public domain.']) ?>
<main>
<article>
<h1>Standard Ebooks and the public domain</h1>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'What makes Standard Ebooks different', 'highlight' => 'about', 'description' => 'How Standard Ebooks differs from other free ebook projects.']) ?>
<?= Template::Header(['title' => 'What makes Standard Ebooks different', 'highlight' => 'about', 'description' => 'How Standard Ebooks differs from other free ebook projects.']) ?>
<main>
<article>
<h1>What makes Standard Ebooks different</h1>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use function Safe\apcu_fetch;
use function Safe\preg_replace;

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use function Safe\preg_match;
$path = HttpInput::Str(GET, 'path', false) ?? '';

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use function Safe\apcu_fetch;
$collection = null;

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
$canDownload = false;
if($GLOBALS['User'] !== null && $GLOBALS['User']->Benefits->CanBulkDownload){
$canDownload = true;

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
$collections = Library::GetEbookCollections();
?><?= Template::Header(['title' => 'Ebook Collections', 'highlight' => '', 'description' => 'Browse collections of Standard Ebooks.']) ?>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'A Basic Standard Ebooks Source Folder', 'manual' => true, 'highlight' => 'contribute', 'description' => 'All Standard Ebooks source folders have the same basic structure, described here.']) ?>
<?= Template::Header(['title' => 'A Basic Standard Ebooks Source Folder', 'manual' => true, 'highlight' => 'contribute', 'description' => 'All Standard Ebooks source folders have the same basic structure, described here.']) ?>
<main>
<article id="a-basic-standard-ebooks-source-folder">
<h1>A Basic Standard Ebooks Source Folder</h1>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'Collections Policy', 'highlight' => 'contribute', 'description' => 'Standard Ebooks only accepts certain kinds of ebooks for production and hosting. This is the full list.']) ?>
<?= Template::Header(['title' => 'Collections Policy', 'highlight' => 'contribute', 'description' => 'Standard Ebooks only accepts certain kinds of ebooks for production and hosting. This is the full list.']) ?>
<main>
<article>
<hgroup>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'Common Issues When Working on Public Domain Ebooks', 'manual' => true, 'highlight' => 'contribute', 'description' => 'A list of common issues encountered when converting from public domain transcriptions.']) ?>
<?= Template::Header(['title' => 'Common Issues When Working on Public Domain Ebooks', 'manual' => true, 'highlight' => 'contribute', 'description' => 'A list of common issues encountered when converting from public domain transcriptions.']) ?>
<main>
<article>
<h1>Common Issues When Working on Public Domain Ebooks</h1>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'How to Add a Standard Ebooks book to Goodreads', 'manual' => true, 'highlight' => 'contribute', 'description' => 'A guide to add a Standard Ebook edition of a book to the Goodreads website.']) ?>
<?= Template::Header(['title' => 'How to Add a Standard Ebooks book to Goodreads', 'manual' => true, 'highlight' => 'contribute', 'description' => 'A guide to add a Standard Ebook edition of a book to the Goodreads website.']) ?>
<main class="manual">
<article class="step-by-step-guide">
<h1>How to Add a Standard Ebooks Ebook to Goodreads</h1>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'How to create figures for music scores', 'manual' => true, 'highlight' => 'contribute', 'description' => 'A guide to producing SVG figures of music notation.']) ?>
<?= Template::Header(['title' => 'How to create figures for music scores', 'manual' => true, 'highlight' => 'contribute', 'description' => 'A guide to producing SVG figures of music notation.']) ?>
<main class="manual">
<article class="step-by-step-guide">
<h1>How to create figures for music scores</h1>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'How to Produce a Shakespeare Play', 'manual' => true, 'highlight' => 'contribute', 'description' => 'A guide to producing any play by William Shakespeare.']) ?>
<?= Template::Header(['title' => 'How to Produce a Shakespeare Play', 'manual' => true, 'highlight' => 'contribute', 'description' => 'A guide to producing any play by William Shakespeare.']) ?>
<main class="manual">
<article class="step-by-step-guide">
<h1>How to Produce a Shakespeare Play</h1>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'How to Review an Ebook Production for Publication', 'manual' => true, 'highlight' => 'contribute', 'description' => 'A guide to proofread and review an ebook production for publication.']) ?>
<?= Template::Header(['title' => 'How to Review an Ebook Production for Publication', 'manual' => true, 'highlight' => 'contribute', 'description' => 'A guide to proofread and review an ebook production for publication.']) ?>
<main class="manual">
<article class="step-by-step-guide">
<h1>How to Review an Ebook Production for Publication</h1>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'How-to Guides For Difficult Productions', 'manual' => true, 'highlight' => 'contribute', 'description' => 'Guides on how to produce more difficult productions.']) ?>
<?= Template::Header(['title' => 'How-to Guides For Difficult Productions', 'manual' => true, 'highlight' => 'contribute', 'description' => 'Guides on how to produce more difficult productions.']) ?>
<main>
<article>
<h1>How-to Guides</h1>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'Get Involved', 'highlight' => 'contribute', 'description' => 'Details on how to contribute your time and talent to the volunteer-driven Standard Ebooks project.']) ?>
<?= Template::Header(['title' => 'Get Involved', 'highlight' => 'contribute', 'description' => 'Details on how to contribute your time and talent to the volunteer-driven Standard Ebooks project.']) ?>
<main>
<article>
<h1>Get Involved</h1>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'Producing an ebook for Standard Ebooks', 'highlight' => 'contribute', 'description' => 'A high-level outline of the process of producing an ebook for Standard Ebooks.']) ?>
<?= Template::Header(['title' => 'Producing an ebook for Standard Ebooks', 'highlight' => 'contribute', 'description' => 'A high-level outline of the process of producing an ebook for Standard Ebooks.']) ?>
<main>
<article>
<h1>Producing an ebook for Standard Ebooks</h1>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'Producing an Ebook, Step by Step', 'manual' => true, 'highlight' => 'contribute', 'description' => 'A detailed step-by-step description of the complete process of producing an ebook for Standard Ebooks, start to finish.']) ?>
<?= Template::Header(['title' => 'Producing an Ebook, Step by Step', 'manual' => true, 'highlight' => 'contribute', 'description' => 'A detailed step-by-step description of the complete process of producing an ebook for Standard Ebooks, start to finish.']) ?>
<main class="manual">
<article class="step-by-step-guide">
<h1>Producing an Ebook, Step by Step</h1>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'Report Errors Upstream', 'highlight' => 'contribute', 'description' => 'Our guide to reporting errors to Gutenberg and other sources.']) ?>
<?= Template::Header(['title' => 'Report Errors Upstream', 'highlight' => 'contribute', 'description' => 'Our guide to reporting errors to Gutenberg and other sources.']) ?>
<main>
<article>
<h1>Report Errors Upstream</h1>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'Report Errors', 'highlight' => 'contribute', 'description' => 'How to report a typo or error youve found in a Standard Ebooks ebook.']) ?>
<?= Template::Header(['title' => 'Report Errors', 'highlight' => 'contribute', 'description' => 'How to report a typo or error youve found in a Standard Ebooks ebook.']) ?>
<main>
<article>
<h1>Report Errors</h1>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'Tips for Editors and Proofreaders', 'manual' => true, 'highlight' => 'contribute', 'description' => 'A list of tips and tricks for people whod like to proofread a Standard Ebooks ebook.']) ?>
<?= Template::Header(['title' => 'Tips for Editors and Proofreaders', 'manual' => true, 'highlight' => 'contribute', 'description' => 'A list of tips and tricks for people whod like to proofread a Standard Ebooks ebook.']) ?>
<main>
<article>
<h1>Tips for Editors and Proofreaders</h1>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'Uncategorized Art Resources', 'highlight' => 'contribute', 'description' => 'A list of US-PD art books for use when conducting cover art research.']) ?>
<?= Template::Header(['title' => 'Uncategorized Art Resources', 'highlight' => 'contribute', 'description' => 'A list of US-PD art books for use when conducting cover art research.']) ?>
<main>
<article id="a-basic-standard-ebooks-source-folder">
<h1>Uncategorized art books</h1>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'Wanted Ebooks', 'highlight' => 'contribute', 'description' => 'A list of ebooks the Standard Ebooks editor would like to see produced, including suggestions for first-time producers.']) ?>
<?= Template::Header(['title' => 'Wanted Ebooks', 'highlight' => 'contribute', 'description' => 'A list of ebooks the Standard Ebooks editor would like to see produced, including suggestions for first-time producers.']) ?>
<main>
<article>
<h1>Wanted Ebooks</h1>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
$newsletterSubscriberCount = floor(Db::QueryInt('
SELECT count(*)
from NewsletterSubscriptions

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
$ebooks = [];
$author = '';
$authorUrl = '';

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
// See https://developers.google.com/search/docs/data-types/book for RDFa metadata details
use function Safe\preg_match;

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use function Safe\preg_replace;
try{

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use function Safe\preg_match;
$type = '';

View file

@ -1,7 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'Atom 1.0 Ebook Feeds', 'description' => 'A list of available Atom 1.0 feeds of Standard Ebooks ebooks.']) ?>
<?= Template::Header(['title' => 'Atom 1.0 Ebook Feeds', 'description' => 'A list of available Atom 1.0 feeds of Standard Ebooks ebooks.']) ?>
<main>
<section class="narrow">
<h1>Atom 1.0 Ebook Feeds</h1>

View file

@ -1,5 +1,4 @@
<?
require_once('Core.php');
use Safe\DateTime;
$ebooks = [];

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
$http = new HTTP2();
$contentType = [

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use function Safe\apcu_fetch;
use function Safe\glob;
use function Safe\preg_replace;

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use function Safe\preg_match;
// This page is blocked by HTTP Basic auth.

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
$author = HttpInput::Str(GET, 'author', false);
$collection = HttpInput::Str(GET, 'collection', false);
$name = null;

View file

@ -1,7 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'Ebook Feeds', 'description' => 'A list of available feeds of Standard Ebooks ebooks.']) ?>
<?= Template::Header(['title' => 'Ebook Feeds', 'description' => 'A list of available feeds of Standard Ebooks ebooks.']) ?>
<main>
<section class="narrow has-hero">
<h1>Ebook Feeds</h1>

View file

@ -1,5 +1,4 @@
<?
require_once('Core.php');
use Safe\DateTime;
$ebooks = [];

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
$http = new HTTP2();
$contentType = [

View file

@ -1,7 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'RSS 2.0 Ebook Feeds', 'description' => 'A list of available RSS 2.0 feeds of Standard Ebooks ebooks.']) ?>
<?= Template::Header(['title' => 'RSS 2.0 Ebook Feeds', 'description' => 'A list of available RSS 2.0 feeds of Standard Ebooks ebooks.']) ?>
<main>
<section class="narrow">
<h1>RSS 2.0 Ebook Feeds</h1>

View file

@ -1,5 +1,4 @@
<?
require_once('Core.php');
use Safe\DateTime;
$ebooks = [];

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
$http = new HTTP2();
$contentType = [

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'How to Use Our Ebooks', 'highlight' => 'contribute', 'manual' => true, 'description' => 'Help, tips, and tricks for using the ebook files you download from Standard Ebooks.']) ?>
<?= Template::Header(['title' => 'How to Use Our Ebooks', 'highlight' => 'contribute', 'manual' => true, 'description' => 'Help, tips, and tricks for using the ebook files you download from Standard Ebooks.']) ?>
<main>
<article>
<h1>How to Use Our Ebooks</h1>

View file

@ -1,10 +1,7 @@
<?
use function Safe\session_unset;
use Gregwar\Captcha\CaptchaBuilder;
require_once('Core.php');
session_start();
header('Content-type: image/jpeg');

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
?><?= Template::Header(['description' => 'Free and liberated ebooks, carefully produced for the true book lover. Download free ebooks with professional-quality formatting and typography, in formats compatible with your ereader.']) ?>
<?= Template::Header(['description' => 'Free and liberated ebooks, carefully produced for the true book lover. Download free ebooks with professional-quality formatting and typography, in formats compatible with your ereader.']) ?>
<main class="front-page">
<h1>Free and liberated ebooks,<br/> carefully produced for the true book lover.</h1>
<picture>

View file

@ -1,5 +1,4 @@
<?
require_once('Core.php');
use function Safe\glob;
use function Safe\preg_replace;
use function Safe\sort;

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
session_start();
$subscription = new NewsletterSubscription();

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use function Safe\preg_match;
$requestType = HttpInput::RequestType();

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use function \Safe\session_unset;
session_start();

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use function Safe\session_unset;
session_start();

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use Ramsey\Uuid\Uuid;
use function Safe\session_unset;

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
// We use a 'succes' page and don't redirect directly to the vote ID resource, because
// we don't want to reveal the vote ID to the web browser. It should only be sent via email
// confirmation link.

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use Safe\DateTime;
$poll = new Poll();

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
$pastPolls = Db::Query('
SELECT *
from Polls

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use function Safe\session_unset;
session_start();

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
$poll = new Poll();
try{

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use function Safe\session_unset;
session_start();

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use function Safe\preg_match;
use function Safe\session_unset;

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use function Safe\session_unset;
session_start();

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use function Safe\preg_match;
use function Safe\session_unset;

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
$colorScheme = $_COOKIE['color-scheme'] ?? 'auto';
?><?= Template::Header(['title' => 'Website Settings', 'description' => 'Adjust your settings for viewing the Standard Ebooks website.']) ?>

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use function Safe\strtotime;
$hideDonationAlert = HttpInput::Bool(POST, 'hide-donation-alert');

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use function Safe\substr;
use function Safe\file_get_contents;
use function Safe\preg_replace;

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use function Safe\curl_exec;
use function Safe\curl_init;
use function Safe\curl_setopt;

View file

@ -1,6 +1,4 @@
<?
require_once('Core.php');
use Safe\DateTime;
use function Safe\file_get_contents;
use function Safe\preg_match;