Move nocacheUrl() from Util to Horde
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 5 Mar 2010 06:18:18 +0000 (23:18 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 5 Mar 2010 07:09:41 +0000 (00:09 -0700)
framework/Core/lib/Horde.php
framework/Core/package.xml
framework/Util/lib/Horde/Util.php
framework/Util/package.xml
imp/lib/IMP.php

index f2cbfe8..2140d94 100644 (file)
@@ -1395,11 +1395,34 @@ HTML;
         $url = self::url($url, $full, 0, $force_ssl);
 
         return $nocache
-            ? Horde_Util::nocacheUrl($url, !$full)
+            ? self::nocacheUrl($url)
             : $url;
     }
 
     /**
+     * Returns a url with the 'nocache' parameter added, if the browser is
+     * buggy and caches old URLs.
+     *
+     * @param Horde_Url|string $url  The URL to modify.
+     *
+     * @return Horde_Url  The requested URL.
+     */
+    static public function nocacheUrl($url)
+    {
+        if (!$url instanceof Horde_Url) {
+            $url = new Horde_Url($url);
+        }
+
+        /* We may need to set a dummy parameter 'nocache' since some
+         * browsers do not always honor the 'no-cache' header. */
+        if ($GLOBALS['browser']->hasQuirk('cache_same_url')) {
+            $url->add('nocache', uniqid());
+        }
+
+        return $url;
+    }
+
+    /**
      * Constructs a correctly-pathed link to an image.
      *
      * @param string $src   The image file.
index 9e6ccbc..6982f79 100644 (file)
@@ -37,7 +37,8 @@ Application Framework.
   <api>beta</api>
  </stability>
  <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
- <notes>* Remove dependency on Horde_DOM package.
+ <notes>* Add Horde::nocacheUrl().
+ * Remove dependency on Horde_DOM package.
  * Added Horde_Registry_Api:: and Horde_Registry_Application:: classes.
  * Moved Horde_Exception to Exception package.
  * Renamed Menu:: as Horde_Menu::.
index 3765ebf..c6a0919 100644 (file)
@@ -67,13 +67,6 @@ class Horde_Util
     );
 
     /**
-     * Random number for nocacheUrl().
-     *
-     * @var integer.
-     */
-    static protected $_randnum = null;
-
-    /**
      * TODO
      */
     static protected $_magicquotes = null;
@@ -273,29 +266,6 @@ class Horde_Util
     }
 
     /**
-     * Returns a url with the 'nocache' parameter added, if the browser is
-     * buggy and caches old URLs.
-     *
-     * @param Horde_Url|string $url  The URL to modify.
-     * @param boolean $encode        Encode the argument separator?
-     *
-     * @return string  The requested URL.
-     */
-    static public function nocacheUrl($url, $encode = true)
-    {
-        /* We may need to set a dummy parameter 'nocache' since some
-         * browsers do not always honor the 'no-cache' header. */
-        if ($GLOBALS['browser']->hasQuirk('cache_same_url')) {
-            if (is_null(self::$_randnum)) {
-                self::$_randnum = base_convert(microtime(), 10, 36);
-            }
-            return self::addParameter($url, 'nocache', self::$_randnum, $encode);
-        }
-
-        return $url;
-    }
-
-    /**
      * Returns a hidden form input containing the session name and id.
      *
      * @param boolean $append_session  0 = only if needed, 1 = always.
index f2b11b6..b00b643 100644 (file)
@@ -29,7 +29,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
   <api>beta</api>
  </stability>
  <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
- <notes>* Added Horde_Util::convertToUtf8().
+ <notes>* Removed Horde_Util::closeWindowJs() and Horde_Util::nocacheUrl().
+ * Added Horde_Util::convertToUtf8().
  * Added Horde_Util::abbreviate().
  * Removed Horde_Array::combine() and Horde_Util::hmac().
  * Initial Horde 4 package.
@@ -80,10 +81,6 @@ http://pear.php.net/dtd/package-2.0.xsd">
     <name>PEAR</name>
     <channel>pear.php.net</channel>
    </package>
-   <package>
-    <name>Browser</name>
-    <channel>pear.horde.org</channel>
-   </package>
    <extension>
     <name>iconv</name>
    </extension>
index ebdbfc5..fb0bdf6 100644 (file)
@@ -497,7 +497,7 @@ class IMP
         }
 
         if ($conf['user']['allow_folders']) {
-            $menu->add(Horde_Util::nocacheUrl(Horde::applicationUrl('folders.php')), _("_Folders"), 'folders/folder.png');
+            $menu->add(Horde::nocacheUrl(Horde::applicationUrl('folders.php')), _("_Folders"), 'folders/folder.png');
         }
 
         if ($_SESSION['imp']['protocol'] != 'pop') {