示例#1
0
/**
 *
 *
 * @file modifier.encryptUrl.php
 * @package plugins
 * @author fengfei02@baidu.com
 * @date 2012-08-30 01:40
 */
function smarty_modifier_encryptUrl($url, $maxRandomStrLen = '', $encKeyStr = '')
{
    $URLEncryption = CSmarty::getURLEncryption();
    if (0 === intval($URLEncryption)) {
        return $url;
    }
    $result = encryptUrl($url, $maxRandomStrLen, $encKeyStr);
    if (false == $result) {
        $result = '';
    }
    return $result;
}
示例#2
0
function prefixEncryptUrl($url, $prefix = true)
{
    $result = encryptUrl($url);
    if (false == $result) {
        return $url;
    }
    $urlEncMaxLen = CSmarty::getUrlEncMaxLen();
    $length = strlen($result);
    if ($urlEncMaxLen > 0 && $length > $urlEncMaxLen) {
        return $url;
    }
    if (true == $prefix) {
        $prefix_str = CSmarty::getEncryptionPrefix();
        $result = $prefix_str . $result;
    }
    return $result;
}