From b939444080395e6cf06b7599a6ba2de214744822 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 26 Jun 2008 12:18:28 -0400 Subject: [PATCH] Fix bugs in the help link system * includes/functions.php: (isso_pre_parse_hook): Echo the value of fetch_help_link() (fetch_help_link): Use the new template system --- includes/functions.php | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 7b1dc43..38f4942 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -541,36 +541,43 @@ function fetch_on_bits($mask, $userinfo = null) return implode(',', $onbits); } -// #################### Start isso_pre_parse_hook #################### -// the pre-parse hook for ISSO's template engine +/** + * Pre-parse hook for BSTemplate class. This merely substitutes help links + * + * @param string Template + * @return string + */ function isso_pre_parse_hook($template) { - $template = preg_replace('#\$help\[(.*)\]#', '" . fetch_help_link("\1") . "', $template); + $template = preg_replace('#\$help\[(.*)\]#', '', $template); return $template; } -// ###################### Start fetch_help_link ###################### -// returns a prepared link to insert into templates that opens up a -// help popup in the user-end +/** + * Returns the HTML used to generate a help link for a given topic + * + * @param string Topic name + * @return string + */ function fetch_help_link($topic) { - global $bugsys; + $tpl = new BSTemplate('help_link'); + $tpl->vars = array('topic' => $topic); if (isset(bugdar::$datastore['help']["$topic"])) { - eval('$temp = "' . $bugsys->template->fetch('help_link') . '";'); - return $temp; + return $tpl->evaluate()->getTemplate(); } else { - if (BSApp::debug) + if (BSApp::get_debug()) { return "[[INVALID TOPIC: $topic]]"; } // do we want this? else if (null == 1) { - return eval('$temp = "' . $bugsys->template->fetch('help_link') . '";'); + return $tpl->evaluate()->getTemplate(); } } } -- 2.43.5