[Pkg-mediawiki-commits] r419 - in mediawiki-extensions/trunk: . debian debian/patches dist/mediawiki-extensions-base/usr/share/mediawiki-extensions/base/RSS_Reader

Thorsten Glaser tg at alioth.debian.org
Sat Dec 29 22:39:55 UTC 2012


Author: tg
Date: 2012-12-29 22:39:54 +0000 (Sat, 29 Dec 2012)
New Revision: 419

Modified:
   mediawiki-extensions/trunk/debian/changelog
   mediawiki-extensions/trunk/debian/patches/fix_rssreader.patch
   mediawiki-extensions/trunk/dist/mediawiki-extensions-base/usr/share/mediawiki-extensions/base/RSS_Reader/RSSReader.php
   mediawiki-extensions/trunk/svn-revisions
Log:
make a new upstream version of RSS_Reader based on our changes and rebase against that


Modified: mediawiki-extensions/trunk/debian/changelog
===================================================================
--- mediawiki-extensions/trunk/debian/changelog	2012-12-29 22:31:00 UTC (rev 418)
+++ mediawiki-extensions/trunk/debian/changelog	2012-12-29 22:39:54 UTC (rev 419)
@@ -1,8 +1,9 @@
-mediawiki-extensions (3.2) xexperimental; urgency=medium
+mediawiki-extensions (3.2) experimental; urgency=medium
 
   * Merge mediawiki-extensions (2.11) upload (Closes: #696179)
+  * Rebase RSS_Reader extension against new upstream version
 
- -- Thorsten Glaser <tg at mirbsd.de>  Sat, 29 Dec 2012 22:57:53 +0100
+ -- Thorsten Glaser <tg at mirbsd.de>  Sat, 29 Dec 2012 23:39:12 +0100
 
 mediawiki-extensions (3.1) experimental; urgency=high
 

Modified: mediawiki-extensions/trunk/debian/patches/fix_rssreader.patch
===================================================================
--- mediawiki-extensions/trunk/debian/patches/fix_rssreader.patch	2012-12-29 22:31:00 UTC (rev 418)
+++ mediawiki-extensions/trunk/debian/patches/fix_rssreader.patch	2012-12-29 22:39:54 UTC (rev 419)
@@ -1,126 +1,24 @@
 $Id$
 
 Fix RSS_Reader extension:
+* apply lastRSS patch as shown on upstream website (Debian-originated)
 * set $egCache to false by default, since we have no www-data writable
   cache directory, and I don't think we want it
-* add $egCacheDir which can be overridden by people who like to cache
-* fix installation path
-* fix rendering path to CSS
-* fix id="RSSMainBody" being used multiple times by making it into
-  a CSS class that can be used for styling RSS output instead
-* XHTML/1.0 Transitional validity of output
-* fix a bunch of PHP warnings
-* fix a user security issue wrt. HTML in RSS <title>s
-* stop using $rss->unhtmlentities and sanitise RSS bodies correctly
 
 Also add documentation of these changes as README.Debian and point to
 upstream's documentation in form of a wikipage.
 
-Bump the version to 0.2.6 to denote fixing the RSS title and body
-input sanitisation vulnerability, but do not rebase against the new
-upstream version to keep the diff small.
-
 --- a/dist/mediawiki-extensions-base/usr/share/mediawiki-extensions/base/RSS_Reader/RSSReader.php
 +++ b/dist/mediawiki-extensions-base/usr/share/mediawiki-extensions/base/RSS_Reader/RSSReader.php
-@@ -22,10 +22,11 @@ if ( !defined('MEDIAWIKI') ) {
- }
- 
- $wgExtensionFunctions[] = 'efRSSReader';
-+$wgRSSReaderExtVersion = '0.2.6';
- 
- $wgExtensionCredits['parserhook'][] = array(
- 	'name' => 'RSS Reader',
--	'version' => '0.2.5',
-+	'version' => $wgRSSReaderExtVersion,
- 	'author' => 'Artem Kaznatcheev',
- 	'description' => 'Adds <tt><rss></tt> tag',
- 	'url' => 'http://www.mediawiki.org/wiki/Extension:RSS_Reader'
-@@ -33,11 +34,12 @@ $wgExtensionCredits['parserhook'][] = ar
- 
- ### Global Variables ###
- //path to follow for server scripts
--$egRSSReaderPath  = $wgScriptPath."/extensions/RSSReader";
-+$egRSSReaderPath  = $wgScriptPath."/extensions/RSS_Reader";
+@@ -39,7 +39,7 @@ $egRSSReaderPath  = $wgScriptPath."/exte
  $egCacheTime      = 3600; //default cache time in seconds
  $egCacheTimeMin   = 1800; //minimum cache time in seconds
  $egCacheTimeMax   = 7200; //maximum cache time in seconds
 -$egCache          = true; //boolean to determine if caching should be done
 +$egCache          = false; //boolean to determine if caching should be done
-+$egCacheDir       = dirname( __FILE__ ).'/cache/'; //directory of cache
+ $egCacheDir       = dirname( __FILE__ ).'/cache/'; //directory of cache
  //boolean to determine if links created should have rel="nofollow"
  $egNoFollow       = false;
- $egWidthMin       = 200;  //minimim width in pixels
-@@ -69,6 +71,7 @@ function efRSSReader() {
- 
- function efCreateRSSReader($input, $argv, $parser){
-   global $wgOut, $egRSSReaderPath, $egCacheTime, $egCacheTimeMin,
-+    $egCacheDir, $wgRSSReaderExtVersion,
-     $egCacheTimeMax, $egCache, $rssType, $egNoFollow, $egWidthMin,
-     $egWidthMax;
- 
-@@ -152,17 +155,20 @@ function efCreateRSSReader($input, $argv
-       if ($argv["title"]=="off") $dispTitle = false;
-     }
- 
--    $wgOut->addScript('<link rel="stylesheet" type="text/css" href="'.
--      $egRSSReaderPath.'/RSSReader.css" />'); //add CSS
-+    $wgOut->addLink(array(
-+	'rel' => 'stylesheet',
-+	'type' => 'text/css',
-+	'href' => "$egRSSReaderPath/RSSReader.css?$wgRSSReaderExtVersion",
-+    ));
- 
-     if (!$width) {
-       $output = '
--        <table  style="background: inherit;"; id="RSSMainBody">
-+        <table class="RSSMainBody" style="background:inherit;">
-         <tr>
-       ';
-     } else {
-       $output = '
--        <table id="RSSMainBody" style="background: inherit;float:right;width:'.$width.'">
-+        <table class="RSSMainBody" style="background:inherit; float:right; width:'.$width.'">
-         <tr>
-       ';
-     }
-@@ -173,8 +179,8 @@ function efCreateRSSReader($input, $argv
-     // Create cURLRSS or wikiRSS or lastRSS object
-     $rss = new $rssType; //initialize an object of rssType
-     // Set public variables
--    if (is_a($rssType, 'lastRSS') && $egCache) {
--      $rss->cache_dir = dirname( __FILE__ ).'/cache/'; //directory of cache
-+    if (($rssType instanceof lastRSS) && $egCache) {
-+      $rss->cache_dir = $egCacheDir;
-     }
-     $rss->cache = $egCache; //cache attribute
-     $rss->cache_time = $cacheTime; //refresh time in seconds
-@@ -183,7 +189,7 @@ function efCreateRSSReader($input, $argv
-     foreach ($fields as $field) {
-       //table cell that contains a single RSS feed
-       $output .= '<td valign="top" style="width: '.$width.'%;">';
--      if ($rssArray = $rss->get($field)){
-+      if (($rssArray = $rss->get($field)) && (isset($rssArray['link']) || isset($rssArray['title']) || isset($rssArray['description']))) {
-         if ($dispTitle) { //check if title should be displayed
-           $output .=
-             '<div class="RSSReader-head">'.
-@@ -209,10 +215,15 @@ function efCreateRSSReader($input, $argv
-           $output .= '<a href="'.$item['link'].'" ';
-           //decide if nofollow is needed
-           if ($egNoFollow) $output .= 'rel="nofollow"';
--          $item_title=preg_replace("|\[rsslist:.+?\]|", "", $rss->unhtmlentities($item['title']));
-+          $item_title=preg_replace("|\[rsslist:.+?\]|", "",
-+            htmlspecialchars(html_entity_decode(html_entity_decode($item['title'],
-+            ENT_QUOTES, "UTF-8"), ENT_QUOTES, "UTF-8"), ENT_QUOTES, "UTF-8"));
-           $output .= '>'.$item_title.'</a>';
-           if ($text) {
--            $desc = preg_replace("|\[rsslist:.+?\]|", "", $rss->unhtmlentities($item['description']));
-+            $desc = preg_replace("|\[rsslist:.+?\]|", "",
-+              Sanitizer::removeHTMLtags(html_entity_decode($item['description'],
-+              ENT_QUOTES, "UTF-8"), null, array(),
-+              array('a', /* does not work */ 'img')));
-             $output .= "</h3>\n$desc</div>\n";
-           } else $output .= "</li>\n";
-           /*if reached the number of desired display items stop working on
 --- a/dist/mediawiki-extensions-base/usr/share/mediawiki-extensions/base/RSS_Reader/lastRSS.php
 +++ b/dist/mediawiki-extensions-base/usr/share/mediawiki-extensions/base/RSS_Reader/lastRSS.php
 @@ -149,14 +149,14 @@ class lastRSS {
@@ -151,14 +49,13 @@
  					}
 --- /dev/null
 +++ b/dist/mediawiki-extensions-base/usr/share/doc/mediawiki-extensions/base/RSS_Reader/README.Debian
-@@ -0,0 +1,10 @@
+@@ -0,0 +1,9 @@
 +User-visible changes to the RSS_Reader extension:
 +* set $egCache to false by default, since we have no www-data writable
 +  cache directory, and I don't think we want it
-+* add $egCacheDir which can be overridden by people who like to cache
 +
 +Upstream provided installation instruction for this version can be found at:
-+http://www.mediawiki.org/w/index.php?title=Extension:RSS_Reader&oldid=390491
++http://www.mediawiki.org/w/index.php?title=Extension:RSS_Reader&oldid=622104
 +
 +
 +$Id$

Modified: mediawiki-extensions/trunk/dist/mediawiki-extensions-base/usr/share/mediawiki-extensions/base/RSS_Reader/RSSReader.php
===================================================================
--- mediawiki-extensions/trunk/dist/mediawiki-extensions-base/usr/share/mediawiki-extensions/base/RSS_Reader/RSSReader.php	2012-12-29 22:31:00 UTC (rev 418)
+++ mediawiki-extensions/trunk/dist/mediawiki-extensions-base/usr/share/mediawiki-extensions/base/RSS_Reader/RSSReader.php	2012-12-29 22:39:54 UTC (rev 419)
@@ -1,6 +1,7 @@
 <?php
-/* RSSReader 0.2.5 - a parser hook for MediaWiki
+/* RSSReader 0.2.6 - a parser hook for MediaWiki
  * Copyright © 2008  Artem Kaznatcheev
+ * Copyright © 2012  Thorsten Glaser
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,10 +23,11 @@
 }
 
 $wgExtensionFunctions[] = 'efRSSReader';
+$wgRSSReaderExtVersion = '0.2.6';
 
 $wgExtensionCredits['parserhook'][] = array(
 	'name' => 'RSS Reader',
-	'version' => '0.2.5',
+	'version' => $wgRSSReaderExtVersion,
 	'author' => 'Artem Kaznatcheev',
 	'description' => 'Adds <tt><rss></tt> tag',
 	'url' => 'http://www.mediawiki.org/wiki/Extension:RSS_Reader'
@@ -33,11 +35,12 @@
 
 ### Global Variables ###
 //path to follow for server scripts
-$egRSSReaderPath  = $wgScriptPath."/extensions/RSSReader";
+$egRSSReaderPath  = $wgScriptPath."/extensions/RSS_Reader";
 $egCacheTime      = 3600; //default cache time in seconds
 $egCacheTimeMin   = 1800; //minimum cache time in seconds
 $egCacheTimeMax   = 7200; //maximum cache time in seconds
 $egCache          = true; //boolean to determine if caching should be done
+$egCacheDir       = dirname( __FILE__ ).'/cache/'; //directory of cache
 //boolean to determine if links created should have rel="nofollow"
 $egNoFollow       = false;
 $egWidthMin       = 200;  //minimim width in pixels
@@ -69,6 +72,7 @@
 
 function efCreateRSSReader($input, $argv, $parser){
   global $wgOut, $egRSSReaderPath, $egCacheTime, $egCacheTimeMin,
+    $egCacheDir, $wgRSSReaderExtVersion,
     $egCacheTimeMax, $egCache, $rssType, $egNoFollow, $egWidthMin,
     $egWidthMax;
 
@@ -152,17 +156,20 @@
       if ($argv["title"]=="off") $dispTitle = false;
     }
 
-    $wgOut->addScript('<link rel="stylesheet" type="text/css" href="'.
-      $egRSSReaderPath.'/RSSReader.css" />'); //add CSS
+    $wgOut->addLink(array(
+	'rel' => 'stylesheet',
+	'type' => 'text/css',
+	'href' => "$egRSSReaderPath/RSSReader.css?$wgRSSReaderExtVersion",
+    ));
 
     if (!$width) {
       $output = '
-        <table  style="background: inherit;"; id="RSSMainBody">
+        <table class="RSSMainBody" style="background:inherit;">
         <tr>
       ';
     } else {
       $output = '
-        <table id="RSSMainBody" style="background: inherit;float:right;width:'.$width.'">
+        <table class="RSSMainBody" style="background:inherit; float:right; width:'.$width.'">
         <tr>
       ';
     }
@@ -173,8 +180,8 @@
     // Create cURLRSS or wikiRSS or lastRSS object
     $rss = new $rssType; //initialize an object of rssType
     // Set public variables
-    if (is_a($rssType, 'lastRSS') && $egCache) {
-      $rss->cache_dir = dirname( __FILE__ ).'/cache/'; //directory of cache
+    if (($rssType instanceof lastRSS) && $egCache) {
+      $rss->cache_dir = $egCacheDir;
     }
     $rss->cache = $egCache; //cache attribute
     $rss->cache_time = $cacheTime; //refresh time in seconds
@@ -183,7 +190,7 @@
     foreach ($fields as $field) {
       //table cell that contains a single RSS feed
       $output .= '<td valign="top" style="width: '.$width.'%;">';
-      if ($rssArray = $rss->get($field)){
+      if (($rssArray = $rss->get($field)) && (isset($rssArray['link']) || isset($rssArray['title']) || isset($rssArray['description']))) {
         if ($dispTitle) { //check if title should be displayed
           $output .=
             '<div class="RSSReader-head">'.
@@ -209,10 +216,15 @@
           $output .= '<a href="'.$item['link'].'" ';
           //decide if nofollow is needed
           if ($egNoFollow) $output .= 'rel="nofollow"';
-          $item_title=preg_replace("|\[rsslist:.+?\]|", "", $rss->unhtmlentities($item['title']));
+          $item_title=preg_replace("|\[rsslist:.+?\]|", "",
+            htmlspecialchars(html_entity_decode(html_entity_decode($item['title'],
+            ENT_QUOTES, "UTF-8"), ENT_QUOTES, "UTF-8"), ENT_QUOTES, "UTF-8"));
           $output .= '>'.$item_title.'</a>';
           if ($text) {
-            $desc = preg_replace("|\[rsslist:.+?\]|", "", $rss->unhtmlentities($item['description']));
+            $desc = preg_replace("|\[rsslist:.+?\]|", "",
+              Sanitizer::removeHTMLtags(html_entity_decode($item['description'],
+              ENT_QUOTES, "UTF-8"), null, array(),
+              array('a', /* does not work */ 'img')));
             $output .= "</h3>\n$desc</div>\n";
           } else $output .= "</li>\n";
           /*if reached the number of desired display items stop working on

Modified: mediawiki-extensions/trunk/svn-revisions
===================================================================
--- mediawiki-extensions/trunk/svn-revisions	2012-12-29 22:31:00 UTC (rev 418)
+++ mediawiki-extensions/trunk/svn-revisions	2012-12-29 22:39:54 UTC (rev 419)
@@ -207,5 +207,5 @@
 svn://svn.debian.org/svn/pkg-mediawiki/unversioned/GraphViz/Graphviz.php - GraphViz - graphviz - usr/share - yes - 250
 svn://svn.debian.org/svn/pkg-mediawiki/unversioned/RSS_Reader/INFO - none - none - none - no - -1
 svn://svn.debian.org/svn/pkg-mediawiki/unversioned/RSS_Reader/RSSReader.css - RSS_Reader - base - usr/share - no - 157
-svn://svn.debian.org/svn/pkg-mediawiki/unversioned/RSS_Reader/RSSReader.php - RSS_Reader - base - usr/share - yes - 248
+svn://svn.debian.org/svn/pkg-mediawiki/unversioned/RSS_Reader/RSSReader.php - RSS_Reader - base - usr/share - yes - 418
 svn://svn.debian.org/svn/pkg-mediawiki/unversioned/RSS_Reader/lastRSS.php - RSS_Reader - base - usr/share - no - 156




More information about the Pkg-mediawiki-commits mailing list