コード例 #1
0
ファイル: comment.func.php プロジェクト: World3D/iCMS
function comment_form($vars)
{
    if (!iCMS::$hooks['enable_comment']) {
        iPHP::warning('此页面禁止调用 iCMS:comment:form 标签!');
    }
    if ($vars['ref']) {
        $_vars = iCMS::app_ref($vars['ref']);
        unset($vars['ref']);
        $vars = array_merge($vars, $_vars);
    }
    $vars['iid'] or iPHP::warning('iCMS:comment:form 标签出错! 缺少"iid"属性或"iid"值为空.');
    $vars['cid'] or iPHP::warning('iCMS:comment:form 标签出错! 缺少"cid"属性或"cid"值为空.');
    $vars['appid'] or iPHP::warning('iCMS:comment:form 标签出错! 缺少"appid"属性或"appid"值为空.');
    $vars['title'] or iPHP::warning('iCMS:comment:form 标签出错! 缺少"title"属性或"title"值为空.');
    switch ($vars['display']) {
        case 'iframe':
            $tpl = 'form.iframe';
            $vars['do'] = 'form';
            break;
        default:
            isset($vars['_display']) && ($vars['display'] = $vars['_display']);
            $vars['param'] = array('suid' => $vars['suid'], 'iid' => $vars['iid'], 'cid' => $vars['cid'], 'appid' => $vars['appid'], 'title' => $vars['title']);
            $tpl = 'form.default';
            break;
    }
    unset($vars['method'], $vars['_display']);
    $vars['query'] = http_build_query($vars);
    iPHP::assign('comment_vars', $vars);
    echo iPHP::view('iCMS://comment/' . $tpl . '.htm');
}