]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Merge pull request #515 from ArthurHoaro/template-feeds
authorArthur <arthur@hoa.ro>
Fri, 25 Mar 2016 18:20:55 +0000 (19:20 +0100)
committerArthur <arthur@hoa.ro>
Fri, 25 Mar 2016 18:20:55 +0000 (19:20 +0100)
Refactor RSS feeds generation, and do it through templates

application/LinkUtils.php
index.php
tests/LinkUtilsTest.php

index 26dd6b6794c402464c007b647a5cd5dbe9a9b19f..d8dc8b5e01a2dc01112cdb5b874626012c650d10 100644 (file)
@@ -9,7 +9,7 @@
  */
 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;
index 79c66648fdb882944060dbdf1ac624f48095b3f8..74091f37703a63d90c2102da7804b6ab4e524763 100644 (file)
--- a/index.php
+++ b/index.php
@@ -484,7 +484,7 @@ if (isset($_POST['login']))
         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;
             }
         }
index c22575907c144e37dccfa6489731f1260d82347c..609a80cbe6b223f25b7060389f55e7ae807d26f3 100644 (file)
@@ -15,6 +15,8 @@ class LinkUtilsTest extends PHPUnit_Framework_TestCase
         $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));
     }
 
     /**