$queryString .= '&_t=' . $now . '&_h=';
- return $queryString . Horde_Util::uriB64Encode(hash_hmac('sha1', $queryString, $GLOBALS['conf']['secret_key'], true));
+ return $queryString . Horde_Url::uriB64Encode(hash_hmac('sha1', $queryString, $GLOBALS['conf']['secret_key'], true));
}
/**
$queryString = substr($data, 0, $pos);
$hmac = substr($data, $pos);
- if ($hmac != Horde_Util::uriB64Encode(hash_hmac('sha1', $queryString, $GLOBALS['conf']['secret_key'], true))) {
+ if ($hmac != Horde_Url::uriB64Encode(hash_hmac('sha1', $queryString, $GLOBALS['conf']['secret_key'], true))) {
return false;
}
*/
public function generateId($seed = '')
{
- return Horde_Util::uriB64Encode(pack('H*', sha1(uniqid(mt_rand(), true) . $seed . (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''))));
+ return Horde_Url::uriB64Encode(pack('H*', sha1(uniqid(mt_rand(), true) . $seed . (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''))));
}
/**
<channel>pear.horde.org</channel>
</package>
<package>
+ <name>Url</name>
+ <channel>pear.horde.org</channel>
+ </package>
+ <package>
<name>Util</name>
<channel>pear.horde.org</channel>
</package>
return $link . '>';
}
+ /**
+ * URL-safe base64 encoding, with trimmed '='.
+ *
+ * @param string $string String to encode.
+ *
+ * @return string URL-safe, base64 encoded data.
+ */
+ static public function uriB64Encode($string)
+ {
+ return str_replace(array('+', '/', '='), array('-', '_', ''), base64_encode($string));
+ }
+
+ /**
+ * Decode URL-safe base64 data, dealing with missing '='.
+ *
+ * @param string $string Encoded data.
+ *
+ * @return string Decoded data.
+ */
+ static public function uriB64Decode($string)
+ {
+ $data = str_replace(array('-', '_'), array('+', '/'), $string);
+ $mod4 = strlen($data) % 4;
+ if ($mod4) {
+ $data .= substr('====', $mod4);
+ }
+ return base64_decode($data);
+ }
+
}
<api>beta</api>
</stability>
<license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
- <notes>* Initial package.
+ <notes>* Added Horde_Url::uriB64Encode() and Horde_Url::uriB64Decode().
+ * Initial package.
</notes>
<contents>
<dir name="/">
}
/**
- * URL-safe base64 encoding, with trimmed '='.
- *
- * @param string $string String to encode.
- *
- * @return string URL-safe, base64 encoded data.
- */
- static public function uriB64Encode($string)
- {
- return str_replace(array('+', '/', '='), array('-', '_', ''), base64_encode($string));
- }
-
- /**
- * Decode URL-safe base64 data, dealing with missing '='.
- *
- * @param string $string Encoded data
- *
- * @return string Decoded data.
- */
- static public function uriB64Decode($string)
- {
- $data = str_replace(array('-', '_'), array('+', '/'), $string);
- $mod4 = strlen($data) % 4;
- if ($mod4) {
- $data .= substr('====', $mod4);
- }
- return base64_decode($data);
- }
-
- /**
* Convert a variable to UTF-8. Recursively handles inner variables.
*
* @param mixed $in The variable to convert.
<api>beta</api>
</stability>
<license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
- <notes>* Removed Horde_Util::strftime2date() and Horde_Util::date2strftime().
+ <notes>* Removed Horde_Util::uriB64Encode() and Horde_Util::uriB64Decode().
+ * Removed Horde_Util::strftime2date() and Horde_Util::date2strftime().
* Removed Horde_Util::closeWindowJs() and Horde_Util::nocacheUrl().
* Added Horde_Util::convertToUtf8().
* Added Horde_Util::abbreviate().