コード例 #1
0
/**
 * Get an image file
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_imagefilename($params, $smarty)
{
    if (!isset($params['id'])) {
        $params['id'] = 0;
    }
    if (!isset($params['w'])) {
        $params['w'] = 0;
    }
    if (!isset($params['w'])) {
        $params['h'] = 0;
    }
    require_once $smarty->_get_plugin_filepath('function', 'geturl');
    $hash = Default_Model_DbTable_BlogPostImage::GetImageHash($params['id'], $params['w'], $params['h']);
    $options = array('controller' => 'utility', 'action' => 'image');
    return sprintf('%s?username=%s&id=%d&w=%d&h=%d&hash=%s', smarty_function_geturl($options, $smarty), $params['username'], $params['id'], $params['w'], $params['h'], $hash);
}
コード例 #2
0
function smarty_function_imagefilename($params, $smarty)
{
    if (!isset($params['id'])) {
        $params['id'] = 0;
    }
    if (!isset($params['w'])) {
        $params['w'] = 0;
    }
    if (!isset($params['h'])) {
        $params['h'] = 0;
    }
    require_once $smarty->_get_plugin_filepath('function', 'geturl');
    $hash = DatabaseObject_Image::GetImageHash($params['id'], $params['w'], $params['h']);
    $options = array('controller' => 'utility', 'action' => 'image');
    $username = $params['username'];
    return sprintf('%s?id=%d&w=%d&h=%d&hash=%s&username=%s', smarty_function_geturl($options, $smarty), $params['id'], $params['w'], $params['h'], $hash, $username);
}
コード例 #3
0
function smarty_insert_get_auth($params, $smarty)
{
    require_once $smarty->_get_plugin_filepath('function', 'geturl');
    if (isset($params['section']) && strlen($params['section']) > 0) {
        $section = $params['section'];
    }
    $auth = Zend_Auth::getInstance();
    if ($auth->hasIdentity()) {
        $html = '<li';
        if ($section == 'account') {
            $html .= ' class="active">';
        } else {
            $html .= '>';
        }
        $html .= '<a href="' . smarty_function_geturl(array('controller' => 'account'), $smarty);
        $html .= '">Your Account</a></li>';
        $html .= '<li';
        if ($section == 'blogmanager') {
            $html .= ' class="active">';
        } else {
            $html .= '>';
        }
        $html .= '<a href="' . smarty_function_geturl(array('controller' => 'blogmanager'), $smarty);
        $html .= '">Your Blog</a></li>';
        $html .= '<li><a href="' . smarty_function_geturl(array('controller' => 'account', 'action' => 'logout'), $smarty) . '">Logout</a></li>';
        return $html;
    } else {
        $html = '<li';
        if ($section == 'register') {
            $html .= ' class="active">';
        } else {
            $html .= '>';
        }
        $html .= '<a href="' . smarty_function_geturl(array('controller' => 'account', 'action' => 'register'), $smarty);
        $html .= '">Register</a></li>';
        $html .= '<li';
        if ($section == 'login') {
            $html .= ' class="active">';
        } else {
            $html .= '>';
        }
        $html .= '<a href="' . smarty_function_geturl(array('controller' => 'account', 'action' => 'login'), $smarty) . '">login</a></li>';
        return $html;
    }
}