From: Michael M Slusarz Date: Fri, 5 Mar 2010 06:18:18 +0000 (-0700) Subject: Move nocacheUrl() from Util to Horde X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=8a43555fd152047db51107508bab3c8c57aa8331;p=horde.git Move nocacheUrl() from Util to Horde --- diff --git a/framework/Core/lib/Horde.php b/framework/Core/lib/Horde.php index f2cbfe832..2140d940b 100644 --- a/framework/Core/lib/Horde.php +++ b/framework/Core/lib/Horde.php @@ -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. diff --git a/framework/Core/package.xml b/framework/Core/package.xml index 9e6ccbc07..6982f79b6 100644 --- a/framework/Core/package.xml +++ b/framework/Core/package.xml @@ -37,7 +37,8 @@ Application Framework. beta LGPL - * Remove dependency on Horde_DOM package. + * 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::. diff --git a/framework/Util/lib/Horde/Util.php b/framework/Util/lib/Horde/Util.php index 3765ebf8e..c6a09199d 100644 --- a/framework/Util/lib/Horde/Util.php +++ b/framework/Util/lib/Horde/Util.php @@ -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. diff --git a/framework/Util/package.xml b/framework/Util/package.xml index f2b11b6ba..b00b6432c 100644 --- a/framework/Util/package.xml +++ b/framework/Util/package.xml @@ -29,7 +29,8 @@ http://pear.php.net/dtd/package-2.0.xsd"> beta LGPL - * Added Horde_Util::convertToUtf8(). + * 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"> PEAR pear.php.net - - Browser - pear.horde.org - iconv diff --git a/imp/lib/IMP.php b/imp/lib/IMP.php index ebdbfc5f4..fb0bdf6c1 100644 --- a/imp/lib/IMP.php +++ b/imp/lib/IMP.php @@ -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') {