function listPages()
{
$d = dir(".");
while($entry=$d->read())
{
if ( is_file($entry) && $entry != "index.php")
{
$path_parts = pathinfo($entry);
if ( realpath($entry) != __FILE__ )
{
if ( $path_parts["extension"] == "php")
{
$extension = "." . $path_parts["extension"];
$filename = str_replace($extension, "", $entry);
$fd = fopen($entry, "r");
$contents = fread($fd, filesize($entry));
preg_match_all("|<[^>]+>(.*)</[^>]+>|U", $contents, $out, PREG_PATTERN_ORDER);
echo "<a href='".$entry."' target='Core'>" . $out[1][0] . "</a><br>\n";
}
}
}
}
$d->close();
}