[SPIP] ~2.1.12 -->2.1.25
[velocampus/web/www.git] / www / ecrire / inc / filtres_mini.php
index 077b239..55e5dde 100644 (file)
@@ -3,7 +3,7 @@
 /***************************************************************************\
  *  SPIP, Systeme de publication pour l'internet                           *
  *                                                                         *
- *  Copyright (c) 2001-2011                                                *
+ *  Copyright (c) 2001-2014                                                *
  *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
  *                                                                         *
  *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
@@ -23,17 +23,15 @@ if (!defined('_ECRIRE_INC_VERSION')) return;
 // inspire (de loin) par PEAR:NetURL:resolvePath
 //
 // http://doc.spip.org/@resolve_path
-function resolve_path($url) {
-       list($url, $query) = explode('?', $url,2);
-       while (preg_match(',/\.?/,', $url, $regs)               # supprime // et /./
+function resolve_path($url_o) {
+       preg_match('@^([^?]*)(.*)$@', $url_o, $regs);
+       list(,$url, $query) = $regs;
+       while (preg_match(',/\.?/,', $url, $regs)       # supprime // et /./
        OR preg_match(',/[^/]*/\.\./,S', $url, $regs)   # supprime /toto/../
-       OR preg_match(',^/\.\./,S', $url, $regs))               # supprime les /../ du haut
+       OR preg_match(',^/\.\./,S', $url, $regs))       # supprime les /../ du haut
                $url = str_replace($regs[0], '/', $url);
 
-       if ($query)
-               $url .= '?'.$query;
-
-       return '/'.preg_replace(',^/,S', '', $url);
+       return '/'.preg_replace(',^/,S', '', $url . $query);
 }
 
 //