Refactor RSS feeds generation, and do it through templates
*/
function html_extract_title($html)
{
- if (preg_match('!<title>(.*)</title>!is', $html, $matches)) {
+ if (preg_match('!<title>(.*?)</title>!is', $html, $matches)) {
return trim(str_replace("\n", ' ', $matches[1]));
}
return false;
if (isset($_POST['returnurl'])) {
// Prevent loops over login screen.
if (strpos($_POST['returnurl'], 'do=login') === false) {
- header('Location: '. escape($_POST['returnurl']));
+ header('Location: '. generateLocation($_POST['returnurl'], $_SERVER['HTTP_HOST']));
exit;
}
}
$title = 'Read me please.';
$html = '<html><meta>stuff</meta><title>'. $title .'</title></html>';
$this->assertEquals($title, html_extract_title($html));
+ $html = '<html><title>'. $title .'</title>blabla<title>another</title></html>';
+ $this->assertEquals($title, html_extract_title($html));
}
/**