コード例 #1
0
ファイル: lib_insert.php プロジェクト: moonlight-wang/feilun
/**
 * 调用评论信息
 *
 * @access  public
 * @return  string
 */
function insert_question($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_QUESTION && gd_version() > 0) {
        $GLOBALS['smarty']->assign('enabled_captcha_question', 1);
        $GLOBALS['smarty']->assign('rand', mt_rand());
    }
    $GLOBALS['smarty']->assign('username', stripslashes($_SESSION['user_name']));
    $GLOBALS['smarty']->assign('email', $_SESSION['email']);
    $GLOBALS['smarty']->assign('id', $arr['id']);
    $cmt = assign_question($arr['id']);
    $GLOBALS['smarty']->assign('question_list', $cmt['comments']);
    $GLOBALS['smarty']->assign('pager', $cmt['pager']);
    $val = $GLOBALS['smarty']->fetch('library/question_list.lbi');
    $GLOBALS['smarty']->caching = $need_cache;
    $GLOBALS['smarty']->force_compile = $need_compile;
    return $val;
}
コード例 #2
0
ファイル: question.php プロジェクト: firsteam/falcons
        }
    }
} 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 = !empty($_GET['page']) ? intval($_GET['page']) : 1;
    $cmt->question_type = !empty($_GET['question_type']) ? intval($_GET['question_type']) : 0;
}
if ($result['error'] == 0) {
    $comments = assign_question($cmt->id, $cmt->page, $cmt->question_type);
    $smarty->assign('id', $cmt->id);
    $smarty->assign('username', $_SESSION['user_name']);
    $smarty->assign('email', $_SESSION['email']);
    $smarty->assign('question_list', $comments['comments']);
    $smarty->assign('pager', $comments['pager']);
    /* 验证码相关设置 */
    if (intval($_CFG['captcha']) & CAPTCHA_QUESTION && gd_version() > 0) {
        $smarty->assign('enabled_captcha_question', 1);
        $smarty->assign('rand', mt_rand());
    }
    $result['message'] = $_CFG['comment_check'] ? '您的咨询已成功提交, 请等待管理员的审核!' : '您的咨询已成功提交, 感谢您的参与!';
    $result['content'] = $smarty->fetch("library/question_list.lbi");
    $result['question_type'] = $cmt->question_type;
    $result['goods_id'] = $cmt->id;
}