From: skodak <skodak> Date: Mon, 19 Mar 2007 10:37:44 +0000 (+0000) Subject: MDL-8904 please no extract()s, fixed double string filtering; merged from MOODLE_18_S... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=e683263f7fdd0207114c3eacdadd194a48bd2db8;p=moodle.git MDL-8904 please no extract()s, fixed double string filtering; merged from MOODLE_18_STABLE --- diff --git a/lib/weblib.php b/lib/weblib.php index cd800d3bc9..e59f3347b9 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -2834,7 +2834,7 @@ function check_theme_arrows() { * Prints breadcrumb trail of links, called in theme/-/header.html * * @uses $CFG - * @param string $navigation The breadcrumb navigation string to be printed + * @param mixed $navigation The breadcrumb navigation string to be printed * @param string $separator The breadcrumb trail separator. The default 0 leads to the use * of $THEME->rarrow, themes could use '→', '/', or '' for a style-sheet solution. * @param boolean $return False to echo the breadcrumb string (default), true to return it. @@ -2859,10 +2859,10 @@ function print_navigation ($navigation, $separator=0, $return=false) { foreach ($ar as $a) { if (strpos($a, '</a>') === false) { - $navigation[] = array('title' => trim(format_string($a)), 'url' => ''); + $navigation[] = array('title' => $a, 'url' => ''); } else { if (preg_match('/<a.*href="([^"]*)">(.*)<\/a>/', $a, $matches)) { - $navigation[] = array('title' => trim(format_string($matches[2])), 'url' => $matches[1]); + $navigation[] = array('title' => $matches[2], 'url' => $matches[1]); } } } @@ -2878,18 +2878,19 @@ function print_navigation ($navigation, $separator=0, $return=false) { $output .= '<h2 class="accesshide">'.$nav_text."</h2><ul>\n"; $output .= '<li class="first"><a '.$CFG->frametarget.' onclick="this.target=\''.$CFG->framename.'\'" href="' - .$CFG->wwwroot.((!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)) + .$CFG->wwwroot.((!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) && !empty($USER->id) && !empty($CFG->mymoodleredirect) && !isguest()) ? '/my' : '') .'/">'. format_string($site->shortname) ."</a></li>\n"; foreach ($navigation as $navitem) { - extract($navitem); - $title = strip_tags(format_string($title)); + $title = trim(strip_tags(format_string($navitem['title'], false))); + $url = $navitem['url']; + if (empty($url)) { $output .= '<li class="first">'."$separator $title</li>\n"; } else { - $output .= '<li class="first">' . $separator . ' <a '.$CFG->frametarget.' onclick="this.target=\''.$CFG->framename.'\'" href="' + $output .= '<li class="first">'.$separator.' <a '.$CFG->frametarget.' onclick="this.target=\''.$CFG->framename.'\'" href="' .$url.'">'."$title</a></li>\n"; } }