mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Fix #2114 Allow specifying file formats to be indexed
This commit is contained in:
parent
22abeb7a88
commit
9611fc7bda
5 changed files with 36 additions and 1 deletions
|
|
@ -400,7 +400,30 @@ class FileController extends File
|
|||
$url = getNotEncodedUrl('', 'module', 'file', 'act', 'procFileOutput', 'file_srl', $file_srl, 'file_key', $file_key, 'force_download', Context::get('force_download') === 'Y' ? 'Y' : null);
|
||||
}
|
||||
|
||||
header('X-Robots-Tag: noindex');
|
||||
$allow_indexing = false;
|
||||
// Handles extension to allow indexing
|
||||
if($file_module_config->allow_indexing_format)
|
||||
{
|
||||
$allow_indexing_format_array = array();
|
||||
$allow_indexing_format_array = explode(',', $file_module_config->allow_indexing_format);
|
||||
if(!is_array($allow_indexing_format_array)) $allow_indexing_format_array[0] = $file_module_config->allow_indexing_format;
|
||||
|
||||
foreach($allow_indexing_format_array as $val)
|
||||
{
|
||||
$val = trim($val);
|
||||
if(preg_match("/\.{$val}$/i", $filename))
|
||||
{
|
||||
$allow_indexing = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!$allow_indexing)
|
||||
{
|
||||
header('X-Robots-Tag: noindex');
|
||||
}
|
||||
|
||||
header('Location: ' . $url);
|
||||
Context::close();
|
||||
exit();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue