aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--application/LinkUtils.php2
-rw-r--r--index.php2
-rw-r--r--tests/LinkUtilsTest.php2
3 files changed, 4 insertions, 2 deletions
diff --git a/application/LinkUtils.php b/application/LinkUtils.php
index 26dd6b67..d8dc8b5e 100644
--- a/application/LinkUtils.php
+++ b/application/LinkUtils.php
@@ -9,7 +9,7 @@
9 */ 9 */
10function html_extract_title($html) 10function html_extract_title($html)
11{ 11{
12 if (preg_match('!<title>(.*)</title>!is', $html, $matches)) { 12 if (preg_match('!<title>(.*?)</title>!is', $html, $matches)) {
13 return trim(str_replace("\n", ' ', $matches[1])); 13 return trim(str_replace("\n", ' ', $matches[1]));
14 } 14 }
15 return false; 15 return false;
diff --git a/index.php b/index.php
index 79c66648..74091f37 100644
--- a/index.php
+++ b/index.php
@@ -484,7 +484,7 @@ if (isset($_POST['login']))
484 if (isset($_POST['returnurl'])) { 484 if (isset($_POST['returnurl'])) {
485 // Prevent loops over login screen. 485 // Prevent loops over login screen.
486 if (strpos($_POST['returnurl'], 'do=login') === false) { 486 if (strpos($_POST['returnurl'], 'do=login') === false) {
487 header('Location: '. escape($_POST['returnurl'])); 487 header('Location: '. generateLocation($_POST['returnurl'], $_SERVER['HTTP_HOST']));
488 exit; 488 exit;
489 } 489 }
490 } 490 }
diff --git a/tests/LinkUtilsTest.php b/tests/LinkUtilsTest.php
index c2257590..609a80cb 100644
--- a/tests/LinkUtilsTest.php
+++ b/tests/LinkUtilsTest.php
@@ -15,6 +15,8 @@ class LinkUtilsTest extends PHPUnit_Framework_TestCase
15 $title = 'Read me please.'; 15 $title = 'Read me please.';
16 $html = '<html><meta>stuff</meta><title>'. $title .'</title></html>'; 16 $html = '<html><meta>stuff</meta><title>'. $title .'</title></html>';
17 $this->assertEquals($title, html_extract_title($html)); 17 $this->assertEquals($title, html_extract_title($html));
18 $html = '<html><title>'. $title .'</title>blabla<title>another</title></html>';
19 $this->assertEquals($title, html_extract_title($html));
18 } 20 }
19 21
20 /** 22 /**