#3: supporting other filenames than index.html (enhancement)

This commit is contained in:
Eric van der Vlist 2011-06-04 17:18:47 +02:00
parent 136dad5a15
commit 5a50ccf29c
1 changed files with 15 additions and 15 deletions

View File

@ -445,25 +445,25 @@ if (!class_exists("Owark")) {
echo "<br />This snapshot has been taken on {$link->arc_date} for the website <a href=\"{$home_url}\">{$blog_title}</a> which contains a link to this page and has saved a copy to be displayed in the page ever disappears."; echo "<br />This snapshot has been taken on {$link->arc_date} for the website <a href=\"{$home_url}\">{$blog_title}</a> which contains a link to this page and has saved a copy to be displayed in the page ever disappears.";
echo '</div></div><div style="position:relative">'; echo '</div></div><div style="position:relative">';
$dir = opendir('.'.$loc); $file_location = '.'. $loc .'/index.html';
$filename = false; if (!file_exists($file_location)) {
while (false !== ($file = readdir($dir))) { // If index.html doesn't exist, find another html file!
if ('.html' === substr($file, strlen($file) - 5)) { $dir = opendir('.'.$loc);
$filename = $file; while (false !== ($file = readdir($dir))) {
break; if ('.html' === substr($file, strlen($file) - 5)) {
$file_location = '.'.$loc.'/' . $file;
break;
}
} }
closedir($dir);
} }
closedir($dir);
if ($filename) { $f = fopen($file_location, "r");
$file_location = '.'.$loc.'/' . $filename; echo fread($f, filesize($file_location));
$f = fopen($file_location, "r"); fclose($f);
echo fread($f, filesize($file_location)); echo '</div>';
fclose($f);
echo '</div>';
} }
}
/** /**
* Check if we've got something to archive * Check if we've got something to archive