diff --git a/.gitignore b/.gitignore index 73e6db3..f665e46 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,5 @@ thumbs/ *.log cache/ push.json -in-dir_renames.txt node_modules/ +bin/.personality_index diff --git a/404.php b/404.php new file mode 100644 index 0000000..a33a2e7 --- /dev/null +++ b/404.php @@ -0,0 +1,51 @@ + + + + + + +404 — MVLog + + + + + + +
+
+

404 — Not found

+

The narrator claimed he knew where he was going.

+

The narrator is unreliable.

+
+
+ + + diff --git a/_header.php b/_header.php index 2f3376d..3abd245 100644 --- a/_header.php +++ b/_header.php @@ -1,3 +1,5 @@ +$brandUrl = $brandUrl ?? 'index.php'; +if ($brandUrl === '') $brandUrl = 'index.php'; +?> diff --git a/index.php b/index.php index fbbd7c2..4e9323a 100644 --- a/index.php +++ b/index.php @@ -112,6 +112,12 @@ function article_og_image_url($articleId){ return 'https://bubulescu.org/out-dir/' . rawurlencode($articleId . '_og.jpg'); } +function render_404_page(){ + http_response_code(404); + include __DIR__ . '/404.php'; + exit; +} + function video_metadata($path){ $base = pathinfo($path, PATHINFO_FILENAME); $meta = [ @@ -223,6 +229,9 @@ usort($videos, function($a, $b) use ($videoCache) { }); $articleId = trim((string)($_GET['id'] ?? '')); +if ($articleId === '' || !preg_match('/^[0-9]{14}[a-f0-9]{16}$/', $articleId) || count(array_diff_key($_GET, ['id' => true])) > 0) { + render_404_page(); +} if ($articleId !== '') { $videos = array_values(array_filter($videos, function($v) use ($articleId, $config) { @@ -289,6 +298,9 @@ $total = count($videos); $pages = max(1, (int)ceil($total / $per)); $page = min($page, $pages); $slice = array_slice($videos, ($page - 1) * $per, $per); +if (!$slice) { + render_404_page(); +} $activeFilterCount = ($keywordValue !== '') ? 1 : 0; $baseParams = ($rawKeyword !== '') ? ['q' => $rawKeyword] : []; @@ -347,6 +359,7 @@ $headerTitles = [ 'My Vices Last', ]; $siteHeaderTitle = $headerTitles[array_rand($headerTitles)]; +$brandUrl = '?id=' . rawurlencode($articleId); ?> @@ -430,12 +443,14 @@ $siteHeaderTitle = $headerTitles[array_rand($headerTitles)]; +

Showing article(s) 0): ?> with active filter(s)

No videos found for current filter.

+

- - + +

@@ -471,8 +486,8 @@ $siteHeaderTitle = $headerTitles[array_rand($headerTitles)];

- - + +

diff --git a/login.php b/login.php index 841383c..1ad737d 100644 --- a/login.php +++ b/login.php @@ -18,6 +18,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { function h($s){ return htmlspecialchars((string)$s, ENT_QUOTES, 'UTF-8'); } ?> MVLog Login - +

Log in

diff --git a/new.php b/new.php index 48fe852..41ce08f 100644 --- a/new.php +++ b/new.php @@ -1309,7 +1309,7 @@ $runningJobs = active_worker_jobs($config); -
RenderingEdit

No videoPreview video

· files

+
RenderingEdit

No videoPreview video

· files

Edit input dir

in-dir/

This input directory is . Editing is disabled until the job completes.

Edit input dir

in-dir/

Files and captions

No caption for audio files

Add new movie input