Allow permalink pages without showing on index
This commit is contained in:
parent
a600e035d5
commit
43e8476098
1 changed files with 20 additions and 3 deletions
23
index.php
23
index.php
|
|
@ -84,6 +84,24 @@ function shown_video_paths($config){
|
||||||
return $videos;
|
return $videos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function permalink_video_paths($config, $articleId){
|
||||||
|
$articleId = strtolower(trim((string)$articleId));
|
||||||
|
if (!preg_match('/^[0-9]{14}[a-f0-9]{16}$/', $articleId)) return [];
|
||||||
|
foreach (glob($config['uploads_dir'].'/*', GLOB_ONLYDIR) ?: [] as $dir) {
|
||||||
|
if (!is_file($dir . '/.mvlog-permalink')) continue;
|
||||||
|
if (read_article_id($dir) !== $articleId) continue;
|
||||||
|
$stateFile = $dir . '/.movmaker-state.json';
|
||||||
|
if (!is_file($stateFile)) return [];
|
||||||
|
$state = json_decode((string)file_get_contents($stateFile), true);
|
||||||
|
if (!is_array($state)) return [];
|
||||||
|
$name = basename((string)($state['output'] ?? ''));
|
||||||
|
if ($name === '' || preg_match('/_preview\.(mp4|webm|mov|m4v)$/i', $name)) return [];
|
||||||
|
$path = $config['videos_dir'] . '/' . $name;
|
||||||
|
return is_file($path) ? [$path] : [];
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
function public_url_path($path){
|
function public_url_path($path){
|
||||||
$path = str_replace('\\', '/', trim((string)$path));
|
$path = str_replace('\\', '/', trim((string)$path));
|
||||||
if ($path === '') return '';
|
if ($path === '') return '';
|
||||||
|
|
@ -309,9 +327,8 @@ if ($articleId !== '') {
|
||||||
if (!article_permalink_enabled($config, $articleId)) {
|
if (!article_permalink_enabled($config, $articleId)) {
|
||||||
render_404_page();
|
render_404_page();
|
||||||
}
|
}
|
||||||
$videos = array_values(array_filter($allVideos, function($v) use ($articleId, $config) {
|
// Permalink pages are allowed when Permalink is ON, even if Show is OFF.
|
||||||
return video_article_id($config, basename($v)) === $articleId;
|
$videos = permalink_video_paths($config, $articleId);
|
||||||
}));
|
|
||||||
$rawKeyword = '';
|
$rawKeyword = '';
|
||||||
$keywordType = 'general';
|
$keywordType = 'general';
|
||||||
$keywordValue = '';
|
$keywordValue = '';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue