-
Notifications
You must be signed in to change notification settings - Fork 42
/
help.php
44 lines (35 loc) · 991 Bytes
/
help.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* Help Page
*
* Browses the manual
*
* @package videoDB
* @author Andreas Gohr <[email protected]>
* @version $Id: help.php,v 1.10 2004/09/20 15:15:41 andig2 Exp $
*/
require_once './core/functions.php';
function _replace_anchors_callback($matches)
{
if (!preg_match('=^https?://=',$matches[2]))
{
$matches[2] = 'help.php?page='.$matches[2];
}
return $matches[1].$matches[2].$matches[3];
}
/**
* input
*/
$page = req_string('page');
if (empty($page) || !preg_match('#^([a-z]{3,20})\.html$#', $page, $match)) $page = 'index.html';
$page = 'doc/manual/' . $page;
if (!file_exists($page)) $page = 'doc/manual/index.html';
$html = file_get_contents($page);
$html = preg_replace_callback("/(<a\s+.*?href\s*=\s*\")(.*?)(\".*?>)/is", '_replace_anchors_callback', $html);
preg_match('=<body.*?>(.*)</body>=is',$html,$matches);
$html = $matches[1];
// prepare templates
tpl_page();
$smarty->assign('helptext', $html);
// display templates
tpl_display('help.tpl');