예제 #1
0
            }
        }
    }
} else {
    /*
     * act 参数不为空
     * 默认为评论内容列表
     * 根据 _GET 创建一个静态对象
     */
    $cmt = new stdClass();
    $cmt->id = !empty($_GET['id']) ? intval($_GET['id']) : 0;
    $cmt->type = !empty($_GET['type']) ? intval($_GET['type']) : 0;
    $cmt->page = isset($_GET['page']) && intval($_GET['page']) > 0 ? intval($_GET['page']) : 1;
}
if ($result['error'] == 0) {
    $comments = assign_zxcomment($cmt->id, $cmt->type, $cmt->page);
    $smarty->assign('comment_type', $cmt->type);
    $smarty->assign('id', $cmt->id);
    $smarty->assign('username', $_SESSION['user_name']);
    //$smarty->assign('email',        $_SESSION['email']);
    $smarty->assign('comments', $comments['comments']);
    $smarty->assign('pager', $comments['pager']);
    /* 验证码相关设置 */
    if (intval($_CFG['captcha']) & CAPTCHA_COMMENT && gd_version() > 0) {
        $smarty->assign('enabled_captcha', 1);
        $smarty->assign('rand', mt_rand());
    }
    $result['message'] = $_CFG['comment_check'] ? '您的咨询已成功发表, 请等待管理员的审核!' : '您的咨询已成功发表, 感谢您的参与!';
    $result['content'] = $smarty->fetch("library/zxcomments_list.lbi");
}
echo $json->encode($result);
예제 #2
0
/**
 * 调用咨询信息
 *
 * @access  public
 * @return  string
 */
function insert_zxcomments($arr)
{
    $need_cache = $GLOBALS['smarty']->caching;
    $need_compile = $GLOBALS['smarty']->force_compile;
    $GLOBALS['smarty']->caching = false;
    $GLOBALS['smarty']->force_compile = true;
    /* 验证码相关设置 */
    if (intval($GLOBALS['_CFG']['captcha']) & CAPTCHA_COMMENT && gd_version() > 0) {
        $GLOBALS['smarty']->assign('enabled_captcha', 1);
        $GLOBALS['smarty']->assign('rand', mt_rand());
    }
    $GLOBALS['smarty']->assign('username', stripslashes($_SESSION['user_name']));
    $GLOBALS['smarty']->assign('email', $_SESSION['email']);
    $GLOBALS['smarty']->assign('comment_type', $arr['type']);
    $GLOBALS['smarty']->assign('id', $arr['id']);
    $cmt = assign_zxcomment($arr['id'], $arr['type']);
    $GLOBALS['smarty']->assign('comments', $cmt['comments']);
    $GLOBALS['smarty']->assign('pager', $cmt['pager']);
    $val = $GLOBALS['smarty']->fetch('library/zxcomments_list.lbi');
    $GLOBALS['smarty']->caching = $need_cache;
    $GLOBALS['smarty']->force_compile = $need_compile;
    return $val;
}