1
|
|
|
<?php |
2
|
|
|
// |
3
|
|
|
// SourceForge: Breaking Down the Barriers to Open Source Development |
4
|
|
|
// Copyright 1999-2000 (c) The SourceForge Crew |
5
|
|
|
// http://sourceforge.net |
6
|
|
|
// |
7
|
|
|
// |
8
|
|
|
|
9
|
|
|
|
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* help_button() - Show a help button. |
13
|
|
|
* |
14
|
|
|
* @param type the php script or html page that contains/generates help |
15
|
|
|
* @param helpid if specified this is an argument passed to the PHP script |
16
|
|
|
* if false then it is a static HTML page |
17
|
|
|
* @param prompt what to display to point to the help |
18
|
|
|
*/ |
19
|
|
|
function help_button($type,$helpid=false,$prompt='[?]') { |
20
|
|
|
$purifier = Codendi_HTMLPurifier::instance(); |
21
|
|
|
// Generic processing derives the script name from the help type |
22
|
|
|
if ($helpid == false) { |
23
|
|
|
// $type is a static HTML page from the Codendi User Guide |
24
|
|
|
$script = '/help/show_help.php?section='.$purifier->purify($type, CODENDI_PURIFIER_JS_QUOTE); |
25
|
|
|
} else { |
26
|
|
|
// $type is a php script - the invoker probably wants to customize |
27
|
|
|
// the help display somehow |
28
|
|
|
$script = '/help/'.$purifier->purify($type, CODENDI_PURIFIER_JS_QUOTE); |
29
|
|
|
$script .= '.php?helpid='.$purifier->purify(urlencode($helpid), CODENDI_PURIFIER_JS_QUOTE); |
30
|
|
|
} |
31
|
|
|
$prompt_purified = $purifier->purify($prompt); |
32
|
|
|
return ('<A href="javascript:help_window(\''.$script.'\')"><B>'.$prompt_purified.'</B></A>'); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* help_header() - Show a help page header |
38
|
|
|
* |
39
|
|
|
* @param string Header title |
40
|
|
|
*/ |
41
|
|
|
function help_header($title, $help_banner=true) { |
42
|
|
|
global $Language; |
43
|
|
|
?> |
44
|
|
|
<HTML> |
45
|
|
|
<HEAD> |
46
|
|
|
<TITLE><?php print $title; ?></TITLE> |
47
|
|
|
<LINK rel="stylesheet" href="<? echo util_get_css_theme(); ?>" type="text/css"> |
|
|
|
|
48
|
|
|
</HEAD> |
49
|
|
|
<BODY class="bg_help"> |
50
|
|
|
<?php print ($help_banner ? '<H4>'.$GLOBALS['sys_name'].' '.$Language->getText('include_help','site_help_sys').'</H4>' : ''); ?> |
51
|
|
|
<H2><?php print $title; ?></H2> |
52
|
|
|
<HR> |
53
|
|
|
<?php |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* help_footer() - Show a help page footer |
58
|
|
|
*/ |
59
|
|
|
function help_footer() { |
60
|
|
|
?> |
61
|
|
|
</BODY> |
62
|
|
|
</HTML> |
63
|
|
|
<?php |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
?> |
67
|
|
|
|
Short opening tags are disabled in PHP’s default configuration. In such a case, all content of this file is output verbatim to the browser without being parsed, or executed.
As a precaution to avoid these problems better use the long opening tag
<?php
.