\n";
echo "
Providing all the help you need 24x7
\n";
echo "\n";
// read dir
$files = array();
$d = opendir($help_path);
while($entry = readdir($d))
{
array_push($files, $entry);
}
closedir($d);
// sort dir
sort($files);
// display dir
while (list($key,$file) = each($files))
{
if(!preg_match("/(.+)\\.help$/", $file, $arr))
continue;
$id = $arr[1];
$title = get_help_title("$help_path/$file");
echo " - $title
\n";
}
echo "
\n";
echo "Need more help? Contact me at ".APPDB_OWNER_EMAIL."
\n";
echo "\n";
apidb_footer();
}
function display_help ($topic)
{
global $help_path;
$file = "$help_path/$topic.help";
$title = get_help_title($file);
if(! $title) {
$title = "Help on $topic";
}
apidb_header($title);
echo "
\n";
if(file_exists($file)) {
include($file);
} else {
echo "
No help available on that topic
\n";
}
echo "
\n";
apidb_footer();
}
function get_help_title ($file)
{
$fp = @fopen($file, "r");
if(!$fp)
return null;
$line = fgets($fp, 1024);
if(!$line)
return null;
$line = trim($line);
if(preg_match("/^$/i", $line, $arr))
{
return $arr[1];
}
return "Internal Error: missing title";
}
?>