mirror of
https://github.com/BeitDina/AutoIndex.git
synced 2026-02-28 05:20:42 +01:00
=Show Browser and Platform on Index
This commit is contained in:
@@ -150,6 +150,51 @@ class ConfigData implements Iterator
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $file we do not use explode() in PHP7+
|
||||
* The filename to read the data from
|
||||
*/
|
||||
public function dos_description($full_name, $file = './descript.ion')
|
||||
{
|
||||
if ($file === false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
$this -> valid = true;
|
||||
//trim path
|
||||
$file_dir = trim(dirname($file));
|
||||
//trim file name
|
||||
$file_name = trim(basename($full_name));
|
||||
if (strpos($full_name, '.') !== false)
|
||||
{
|
||||
// Nested file
|
||||
$filename_ext = substr(strrchr($full_name, '.'), 1);
|
||||
}
|
||||
//rebuild path
|
||||
$file_path = $file_dir . "/{$file_name}";
|
||||
|
||||
$contents = file($file);
|
||||
if ($contents === false)
|
||||
{
|
||||
throw new ExceptionFatal('Error reading file <em>' . Url::html_output($file) . '</em>');
|
||||
}
|
||||
foreach ($contents as $i => $line)
|
||||
{
|
||||
$line = rtrim($line, "\r\n");
|
||||
if (self::line_is_comment($line))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$parts = explode($file_name, $line);
|
||||
if (count($parts) > 0)
|
||||
{
|
||||
//throw new ExceptionFatal('Incorrect format for file <em>explode on ' . $full_name . ' line: ' . print_r($line, true) . ' ' . Url::html_output($file) . '</em> on line ' . ($i + 1) . '.<br />Format is "file name[space]value"');
|
||||
return empty($parts[1]) ? $parts[0] : $parts[1];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* $config[$key] will be set to $info.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user