Permalink simplified
This commit is contained in:
parent
040a22855e
commit
b9efbf81cc
2 changed files with 7 additions and 2 deletions
|
|
@ -4,6 +4,11 @@ $config = require __DIR__ . "/config.php";
|
|||
foreach (["videos_dir", "thumbs_dir", "uploads_dir"] as $d) if (!is_dir($config[$d])) mkdir($config[$d], 0775, true);
|
||||
if (!is_dir(__DIR__ . "/cache")) mkdir(__DIR__ . "/cache", 0775, true);
|
||||
|
||||
if (preg_match('~/index\.php(?:\?|$)~', (string)($_SERVER['REQUEST_URI'] ?? '')) && preg_match('/^[0-9]{14}[a-f0-9]{16}$/', (string)($_GET['id'] ?? ''))) {
|
||||
header('Location: /?id=' . rawurlencode((string)$_GET['id']), true, 301);
|
||||
exit;
|
||||
}
|
||||
|
||||
function h($s){ return htmlspecialchars((string)$s, ENT_QUOTES, "UTF-8"); }
|
||||
function render_description_html($s){
|
||||
$html = h($s);
|
||||
|
|
@ -536,7 +541,7 @@ $siteHeaderTitle = $headerTitles[array_rand($headerTitles)];
|
|||
$base = pathinfo($name, PATHINFO_FILENAME);
|
||||
$articleIdForVideo = video_article_id($config, $name);
|
||||
$permalinkEnabled = $articleIdForVideo !== '' && article_permalink_enabled($config, $articleIdForVideo);
|
||||
$permalinkUrl = $permalinkEnabled ? query_url(['id' => $articleIdForVideo]) : '';
|
||||
$permalinkUrl = $permalinkEnabled ? ('/?id=' . rawurlencode($articleIdForVideo)) : '';
|
||||
$shareUrl = $permalinkEnabled ? ('https://bubulescu.org/?id=' . rawurlencode($articleIdForVideo)) : '';
|
||||
$url = $config['public_videos'].'/'.rawurlencode($name);
|
||||
$m = $videoCache[$name]['metadata'] ?? video_metadata($v);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue