本文整理汇总了PHP中FORMAT::parse_bbcode方法的典型用法代码示例。如果您正苦于以下问题:PHP FORMAT::parse_bbcode方法的具体用法?PHP FORMAT::parse_bbcode怎么用?PHP FORMAT::parse_bbcode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FORMAT
的用法示例。
在下文中一共展示了FORMAT::parse_bbcode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: questions_list_action
public function questions_list_action()
{
if ($_GET['feature_id']) {
$topic_ids = $this->model('feature')->get_topics_by_feature_id($_GET['feature_id']);
if ($topic_ids) {
$answers = $this->model('reader')->fetch_answers_list_by_topic_ids($topic_ids, $_GET['page'], 20);
}
} else {
$answers = $this->model('reader')->fetch_answers_list($_GET['page'], 20);
}
$output = array();
if ($answers) {
foreach ($answers as $key => $val) {
$question_ids[$val['question_id']] = $val['question_id'];
$uids[$val['uid']] = $val['uid'];
}
$questions_info = $this->model('question')->get_question_info_by_ids($question_ids);
$question_topics = $this->model('topic')->get_topics_by_item_ids($question_ids, 'question');
$users_info = $this->model('account')->get_user_info_by_uids($uids, TRUE);
foreach ($answers as $key => $val) {
$output['answers'][$val['answer_id']] = array('answer_id' => $val['answer_id'], 'question_id' => $val['question_id'], 'avatar' => get_avatar_url($val['uid'], 'mid'), 'user_name' => $users_info[$val['uid']]['user_name'], 'signature' => $users_info[$val['uid']]['signature'], 'agree_count' => $val['agree_count'], 'agree_users' => $this->model('answer')->get_vote_user_by_answer_id($val['answer_id']), 'answer_content' => FORMAT::parse_attachs(nl2br(FORMAT::parse_bbcode($val['answer_content']))), 'add_time' => date_friendly($val['add_time']), 'uid' => $val['uid']);
}
foreach ($questions_info as $key => $val) {
$output['questions'][$val['question_id']] = array('question_id' => $val['question_id'], 'question_content' => $val['question_content'], 'question_detail' => FORMAT::parse_attachs(nl2br(FORMAT::parse_bbcode($val['question_detail']))), 'answer_users' => $val['answer_users'], 'focus_count' => $val['focus_count'], 'view_count' => $val['view_count'], 'topics' => $question_topics[$val['question_id']]);
}
}
echo json_encode($output);
}
示例2: index_action
public function index_action()
{
if (is_digits($_GET['id'])) {
if (!($topic_info = $this->model('topic')->get_topic_by_id($_GET['id']))) {
$topic_info = $this->model('topic')->get_topic_by_title($_GET['id']);
}
} else {
if (!($topic_info = $this->model('topic')->get_topic_by_title($_GET['id']))) {
$topic_info = $this->model('topic')->get_topic_by_url_token($_GET['id']);
}
}
if (!$topic_info) {
H::redirect_msg(AWS_APP::lang()->_t('专题不存在'), '/');
}
// if ($topic_info['merged_id'] AND $topic_info['merged_id'] != $topic_info['topic_id'])
// {
// if ($this->model('topic')->get_topic_by_id($topic_info['merged_id']))
// {
// HTTP::redirect('/topic/' . $topic_info['merged_id'] . '?rf=' . $topic_info['topic_id']);
// }
// else
// {
// $this->model('topic')->remove_merge_topic($topic_info['topic_id'], $topic_info['merged_id']);
// }
// }
// if (urldecode($topic_info['url_token']) != $_GET['id'])
// {
// HTTP::redirect('/topic/' . $topic_info['url_token'] . '?rf=' . $_GET['rf']);
// }
// if (is_digits($_GET['rf']) and $_GET['rf'])
// {
// if ($from_topic = $this->model('topic')->get_topic_by_id($_GET['rf']))
// {
// $redirect_message[] = AWS_APP::lang()->_t('话题 (%s) 已与当前话题合并', $from_topic['topic_title']);
// }
// }
if ($topic_info['seo_title']) {
TPL::assign('page_title', $topic_info['seo_title']);
} else {
$this->crumb($topic_info['topic_title'], '/topic/' . $topic_info['url_token']);
}
if ($this->user_id) {
$topic_info['has_focus'] = $this->model('topic')->has_focus_topic($this->user_id, $topic_info['topic_id']);
}
if ($topic_info['topic_description']) {
TPL::set_meta('description', $topic_info['topic_title'] . ' - ' . cjk_substr(str_replace("\r\n", ' ', strip_tags($topic_info['topic_description'])), 0, 128, 'UTF-8', '...'));
}
$topic_info['topic_description'] = nl2br(FORMAT::parse_bbcode($topic_info['topic_description']));
//是否首页精选
$topic_info['is_recommend_homepage'] = $this->model('recommend')->recommend_homepage_check('topic', $topic_info['topic_id']);
TPL::assign('topic_info', $topic_info);
// TPL::assign('best_answer_users', $this->model('topic')->get_best_answer_users_by_topic_id($topic_info['topic_id'], 5));
switch ($topic_info['model_type']) {
default:
// $related_topics_ids = array();
// if ($related_topics = $this->model('topic')->related_topics($topic_info['topic_id']))
// {
// foreach ($related_topics AS $key => $val)
// {
// $related_topics_ids[$val['topic_id']] = $val['topic_id'];
// }
// }
// if ($child_topic_ids = $this->model('topic')->get_child_topic_ids($topic_info['topic_id']))
// {
// foreach ($child_topic_ids AS $key => $topic_id)
// {
// $related_topics_ids[$topic_id] = $topic_id;
// }
// }
// TPL::assign('related_topics', $related_topics);
// $log_list = ACTION_LOG::get_action_by_event_id($topic_info['topic_id'], 10, ACTION_LOG::CATEGORY_TOPIC, implode(',', array(
// ACTION_LOG::ADD_TOPIC,
// ACTION_LOG::MOD_TOPIC,
// ACTION_LOG::MOD_TOPIC_DESCRI,
// ACTION_LOG::MOD_TOPIC_PIC,
// ACTION_LOG::DELETE_TOPIC,
// ACTION_LOG::ADD_RELATED_TOPIC,
// ACTION_LOG::DELETE_RELATED_TOPIC
// )), -1);
// $log_list = $this->model('topic')->analysis_log($log_list);
// $contents_topic_id = $topic_info['topic_id'];
// $contents_topic_title = $topic_info['topic_title'];
// if ($merged_topics = $this->model('topic')->get_merged_topic_ids($topic_info['topic_id']))
// {
// foreach ($merged_topics AS $key => $val)
// {
// $merged_topic_ids[] = $val['source_id'];
// }
// $contents_topic_id .= ',' . implode(',', $merged_topic_ids);
// if ($merged_topics_info = $this->model('topic')->get_topics_by_ids($merged_topic_ids))
// {
// foreach($merged_topics_info AS $key => $val)
// {
// $merged_topic_title[] = $val['topic_title'];
// }
// }
// if ($merged_topic_title)
// {
// $contents_topic_title .= ',' . implode(',', $merged_topic_title);
// }
//.........这里部分代码省略.........
示例3: load_answers_action
function load_answers_action()
{
// 获取问题
if (!($question_info = $this->model('question')->get_question_info_by_id($_GET['question_id']))) {
return;
}
$this->model('question')->calc_popular_value($question_info['question_id']);
$this->model('question')->update_views($question_info['question_id']);
if (!$_GET['sort'] or $_GET['sort'] != 'ASC') {
$_GET['sort'] = 'DESC';
} else {
$_GET['sort'] = 'ASC';
}
if (is_digits($_GET['uid'])) {
$answer_list_where[] = 'uid = ' . intval($_GET['uid']);
$answer_count_where = 'uid = ' . intval($_GET['uid']);
} else {
if ($_GET['uid'] == 'focus' and $this->user_id) {
if ($friends = $this->model('follow')->get_user_friends($this->user_id, false)) {
foreach ($friends as $key => $val) {
$follow_uids[] = $val['uid'];
}
} else {
$follow_uids[] = 0;
}
$answer_list_where[] = 'uid IN(' . implode($follow_uids, ',') . ')';
$answer_count_where = 'uid IN(' . implode($follow_uids, ',') . ')';
$answer_order_by = 'add_time ASC';
} else {
if ($_GET['sort_key'] == 'popularity') {
$answer_order_by = "agree_count " . $_GET['sort'] . ", against_count ASC, add_time ASC";
} else {
$answer_order_by = "add_time " . $_GET['sort'];
}
}
}
if ($answer_count_where) {
$answer_count = $this->model('answer')->get_answer_count_by_question_id($question_info['question_id'], $answer_count_where);
} else {
$answer_count = $question_info['answer_count'];
}
if (isset($_GET['answer_id']) and (!$this->user_id or $_GET['single'])) {
$answer_list = $this->model('answer')->get_answer_list_by_question_id($question_info['question_id'], 1, 'answer_id = ' . intval($_GET['answer_id']));
} else {
if (!$this->user_id and !$this->user_info['permission']['answer_show']) {
if ($question_info['best_answer']) {
$answer_list = $this->model('answer')->get_answer_list_by_question_id($question_info['question_id'], 1, 'answer_id = ' . intval($question_info['best_answer']));
} else {
$answer_list = $this->model('answer')->get_answer_list_by_question_id($question_info['question_id'], 1, null, 'agree_count DESC');
}
} else {
if ($answer_list_where) {
$answer_list_where = implode(' AND ', $answer_list_where);
}
$answer_list = $this->model('answer')->get_answer_list_by_question_id($question_info['question_id'], calc_page_limit($_GET['page'], 100), $answer_list_where, $answer_order_by);
}
}
// 最佳回复预留
$answers[0] = '';
if (!is_array($answer_list)) {
$answer_list = array();
}
$answer_ids = array();
$answer_uids = array();
foreach ($answer_list as $answer) {
$answer_ids[] = $answer['answer_id'];
$answer_uids[] = $answer['uid'];
if ($answer['has_attach']) {
$has_attach_answer_ids[] = $answer['answer_id'];
}
}
if (!in_array($question_info['best_answer'], $answer_ids) and intval($_GET['page']) < 2) {
$answer_list = array_merge($this->model('answer')->get_answer_list_by_question_id($question_info['question_id'], 1, 'answer_id = ' . $question_info['best_answer']), $answer_list);
}
if ($answer_ids) {
$answer_agree_users = $this->model('answer')->get_vote_user_by_answer_ids($answer_ids);
$answer_vote_status = $this->model('answer')->get_answer_vote_status($answer_ids, $this->user_id);
$answer_users_rated_thanks = $this->model('answer')->users_rated('thanks', $answer_ids, $this->user_id);
$answer_users_rated_uninterested = $this->model('answer')->users_rated('uninterested', $answer_ids, $this->user_id);
$answer_attachs = $this->model('publish')->get_attachs('answer', $has_attach_answer_ids, 'min');
}
foreach ($answer_list as $answer) {
if ($answer['has_attach']) {
$answer['attachs'] = $answer_attachs[$answer['answer_id']];
$answer['insert_attach_ids'] = FORMAT::parse_attachs($answer['answer_content'], true);
}
$answer['user_rated_thanks'] = $answer_users_rated_thanks[$answer['answer_id']];
$answer['user_rated_uninterested'] = $answer_users_rated_uninterested[$answer['answer_id']];
$answer['answer_content'] = $this->model('question')->parse_at_user(FORMAT::parse_attachs(nl2br(FORMAT::parse_bbcode($answer['answer_content']))));
$answer['agree_users'] = $answer_agree_users[$answer['answer_id']];
$answer['agree_status'] = $answer_vote_status[$answer['answer_id']];
if ($question_info['best_answer'] == $answer['answer_id'] and intval($_GET['page']) < 2) {
$answers[0] = $answer;
} else {
$answers[] = $answer;
}
// 获取回答评论列表
$comments = $this->model('answer')->get_answer_comments($answer['answer_id']);
$user_infos = $this->model('account')->get_user_info_by_uids(fetch_array_value($comments, 'uid'));
foreach ($comments as $key => $val) {
//.........这里部分代码省略.........
示例4: index_action
public function index_action()
{
if (!($article_info = $this->model('article')->get_article_info_by_id($_GET['id']))) {
H::redirect_msg(AWS_APP::lang()->_t('文章不存在或已被删除'), '/');
}
if ($article_info['has_attach']) {
$article_info['attachs'] = $this->model('publish')->get_attach('article', $article_info['id'], 'min');
$article_info['attachs_ids'] = FORMAT::parse_attachs($article_info['message'], true);
}
$article_info['user_info'] = $this->model('account')->get_user_info_by_uid($article_info['uid'], true);
$article_info['message'] = FORMAT::parse_attachs(nl2br(FORMAT::parse_bbcode($article_info['message'])));
if ($this->user_id) {
$article_info['vote_info'] = $this->model('article')->get_article_vote_by_id('article', $article_info['id'], null, $this->user_id);
}
//赞了该文章的用户信息
$article_info['vote_users'] = $this->model('article')->get_article_vote_users_by_id('article', $article_info['id'], 1, 10);
//文章话题
$article_topics = $this->model('topic')->get_topics_by_item_id($article_info['id'], 'article');
$comments = $this->model('article')->get_comments($article_info['id'], $_GET['page'], 100);
if ($comments and $this->user_id) {
foreach ($comments as $key => $val) {
$comments[$key]['vote_info'] = $this->model('article')->get_article_vote_by_id('comment', $val['id'], 1, $this->user_id);
$comments[$key]['message'] = $this->model('question')->parse_at_user($val['message']);
}
}
$article_info['user_follow_check'] = 0;
if ($this->user_id and $this->model('follow')->user_follow_check($this->user_id, $article_info['uid'])) {
$article_info['user_follow_check'] = 1;
}
$this->model('article')->update_views($article_info['id']);
//作者信息
if ($article_info['user_info']) {
$article_info['user_info'] = $this->model('myapi')->get_clean_user_info($article_info['user_info']);
}
//点赞者信息
if (!empty($article_info['vote_users'])) {
foreach ($article_info['vote_users'] as $key => $value) {
$article_info['vote_users'][$key] = $this->model('myapi')->get_clean_user_info($value);
}
}
$topics_key = array('topic_id', 'topic_title');
if ($article_topics) {
foreach ($article_topics as $kk => $vv) {
foreach ($vv as $k => $v) {
if (!in_array($k, $topics_key)) {
unset($article_topics[$kk][$k]);
}
}
}
}
//评论里评论者信息
if (!empty($comments)) {
foreach ($comments as $key => $value) {
if (!empty($value['user_info'])) {
$comments[$key]['user_info'] = $this->model('myapi')->get_clean_user_info($value['user_info']);
}
if (!empty($value['at_user_info'])) {
$comments[$key]['at_user_info'] = $this->model('myapi')->get_clean_user_info($value['at_user_info']);
}
}
}
H::ajax_json_output(AWS_APP::RSM(array('article_info' => $article_info, 'article_topics' => $article_topics, 'comments' => $comments), 1, null));
}
示例5: save_answer_action
public function save_answer_action()
{
//Mobile 默认关注
if (!isset($_POST['auto_focus'])) {
$_POST['auto_focus'] = 1;
}
if ($this->user_info['integral'] < 0 and get_setting('integral_system_enabled') == 'Y') {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你的剩余积分已经不足以进行此操作')));
}
if (!($question_info = $this->model('question')->get_question_info_by_id($_POST['question_id']))) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('问题不存在')));
}
if ($question_info['lock'] and !($this->user_info['permission']['is_administortar'] or $this->user_info['permission']['is_moderator'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('已经锁定的问题不能回复')));
}
$answer_content = trim($_POST['answer_content'], "\r\n\t");
if (!$answer_content) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('请输入回复内容')));
}
// 判断是否是问题发起者
if (get_setting('answer_self_question') == 'N' and $question_info['published_uid'] == $this->user_id) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('不能回复自己发布的问题,你可以修改问题内容')));
}
// 判断是否已回复过问题
if (get_setting('answer_unique') == 'Y' && $this->model('answer')->has_answer_by_uid($_POST['question_id'], $this->user_id)) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('一个问题只能回复一次,你可以编辑回复过的回复')));
}
if (strlen($answer_content) < get_setting('answer_length_lower')) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('回复内容字数不得少于 %s 字节', get_setting('answer_length_lower'))));
}
if (!$this->user_info['permission']['publish_url'] && FORMAT::outside_url_exists($answer_content)) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你所在的用户组不允许发布站外链接')));
}
$this->model('draft')->delete_draft($question_info['question_id'], 'answer', $this->user_id);
if ($this->publish_approval_valid($answer_content)) {
$this->model('publish')->publish_approval('answer', array('question_id' => $question_info['question_id'], 'answer_content' => $answer_content, 'anonymous' => $_POST['anonymous'], 'attach_access_key' => $_POST['attach_access_key'], 'auto_focus' => $_POST['auto_focus']), $this->user_id, $_POST['attach_access_key']);
H::ajax_json_output(AWS_APP::RSM(null, '0', AWS_APP::lang()->_t('发布成功, 请等待管理员审核...')));
} else {
$answer_id = $this->model('publish')->publish_answer($question_info['question_id'], $answer_content, $this->user_id, $_POST['anonymous'], $_POST['attach_access_key'], $_POST['auto_focus']);
$this->model('answer')->set_answer_publish_source($answer_id, 'mobile');
$answer_info = $this->model('answer')->get_answer_by_id($answer_id);
if ($answer_info['has_attach']) {
$answer_info['attachs'] = $this->model('publish')->get_attach('answer', $answer_id, 'min');
$answer_info['insert_attach_ids'] = FORMAT::parse_attachs($answer_info['answer_content'], true);
}
//$answer_info['user_info'] = $this->user_info;
$answer_info['answer_content'] = $this->model('question')->parse_at_user(FORMAT::parse_attachs(nl2br(FORMAT::parse_bbcode($answer_info['answer_content']))));
H::ajax_json_output(AWS_APP::RSM(array('answer_id' => $answer_id, 'answer_info' => $answer_info), 1, null));
}
}
示例6: index_action
//.........这里部分代码省略.........
}
}
// 最佳回复预留
$answers[0] = '';
if (!is_array($answer_list)) {
$answer_list = array();
}
$answer_ids = array();
$answer_uids = array();
foreach ($answer_list as $answer) {
$answer_ids[] = $answer['answer_id'];
$answer_uids[] = $answer['uid'];
if ($answer['has_attach']) {
$has_attach_answer_ids[] = $answer['answer_id'];
}
}
if (!in_array($question_info['best_answer'], $answer_ids) and intval($_GET['page']) < 2) {
$answer_list = array_merge($this->model('answer')->get_answer_list_by_question_id($question_info['question_id'], 1, 'answer_id = ' . $question_info['best_answer']), $answer_list);
}
if ($answer_ids) {
$answer_agree_users = $this->model('answer')->get_vote_user_by_answer_ids($answer_ids);
$answer_vote_status = $this->model('answer')->get_answer_vote_status($answer_ids, $this->user_id);
$answer_users_rated_thanks = $this->model('answer')->users_rated('thanks', $answer_ids, $this->user_id);
$answer_users_rated_uninterested = $this->model('answer')->users_rated('uninterested', $answer_ids, $this->user_id);
$answer_attachs = $this->model('publish')->get_attachs('answer', $has_attach_answer_ids, 'min');
}
foreach ($answer_list as $answer) {
if ($answer['has_attach']) {
$answer['attachs'] = $answer_attachs[$answer['answer_id']];
$answer['insert_attach_ids'] = FORMAT::parse_attachs($answer['answer_content'], true);
}
$answer['user_rated_thanks'] = $answer_users_rated_thanks[$answer['answer_id']];
$answer['user_rated_uninterested'] = $answer_users_rated_uninterested[$answer['answer_id']];
$answer['answer_content'] = $this->model('question')->parse_at_user(FORMAT::parse_attachs(nl2br(FORMAT::parse_bbcode($answer['answer_content']))));
$answer['agree_users'] = $answer_agree_users[$answer['answer_id']];
$answer['agree_status'] = $answer_vote_status[$answer['answer_id']];
if ($question_info['best_answer'] == $answer['answer_id'] and intval($_GET['page']) < 2) {
$answers[0] = $answer;
} else {
$answers[] = $answer;
}
}
if (!$answers[0]) {
unset($answers[0]);
}
if (get_setting('answer_unique') == 'Y') {
if ($this->model('answer')->has_answer_by_uid($question_info['question_id'], $this->user_id)) {
TPL::assign('user_answered', 1);
} else {
TPL::assign('user_answered', 0);
}
}
TPL::assign('answers', $answers);
TPL::assign('answer_count', $answer_count);
}
if ($this->user_id) {
TPL::assign('question_thanks', $this->model('question')->get_question_thanks($question_info['question_id'], $this->user_id));
TPL::assign('invite_users', $this->model('question')->get_invite_users($question_info['question_id']));
TPL::assign('user_follow_check', $this->model('follow')->user_follow_check($this->user_id, $question_info['published_uid']));
if ($this->user_info['draft_count'] > 0) {
TPL::assign('draft_content', $this->model('draft')->get_data($question_info['question_id'], 'answer', $this->user_id));
}
}
$question_info['question_detail'] = FORMAT::parse_attachs(nl2br(FORMAT::parse_bbcode($question_info['question_detail'])));
TPL::assign('question_info', $question_info);
TPL::assign('question_focus', $this->model('question')->has_focus_question($question_info['question_id'], $this->user_id));
示例7: get_all_question
public function get_all_question()
{
// return "helloword23333333";
if ($result = $this->fetch_all('question', "", "update_time DESC")) {
foreach ($result as $key => $val) {
$data[$key]['question_info'] = $val;
// here should parse answer_content for get img url directly by anxiang.xiao 20150827
$data[$key]['question_info']['question_detail'] = $this->model('question')->parse_at_user(FORMAT::parse_attachs2(nl2br(FORMAT::parse_bbcode($data[$key]['question_info']['question_detail']))));
$data[$key]['question_publish_user_info'] = $this->fetch_row('users', 'uid = ' . $val['published_uid']);
if ($data[$key]['question_publish_user_info']['avatar_file']) {
$data[$key]['question_publish_user_info']['avatar_file'] = get_avatar_url($data[$key]['question_publish_user_info']['uid'], 'min');
}
$data[$key]['category_info'] = $this->fetch_row('category', 'id = ' . $val['category_id']);
$data[$key]['question_newest_answer_info'] = $this->fetch_row('answer', 'question_id = ' . $val['question_id'], "add_time DESC");
/*
*
* $data[$key]['question_info'] = $val;
if ($val['published_uid'] != 0)
$data[$key]['question_publish_user_info'] = $this->fetch_row('users','uid = ' .$val['published_uid'] );
else
$data[$key]['question_publish_user_info'] = "{}";
if ($val['category_id'] != 0)
$data[$key]['category_info'] = $this->fetch_row('category','id = ' .$val['category_id'] );
else
$data[$key]['category_info'] = "{}";
*/
}
return $data;
// return $posts_index;
}
}
示例8: save_answer_action
public function save_answer_action()
{
if ($this->user_info['integral'] < 0 and get_setting('integral_system_enabled') == 'Y') {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你的剩余积分已经不足以进行此操作')));
}
if (!($question_info = $this->model('question')->get_question_info_by_id($_POST['question_id']))) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('问题不存在')));
}
if ($question_info['lock'] and !($this->user_info['permission']['is_administortar'] or $this->user_info['permission']['is_moderator'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('已经锁定的问题不能回复')));
}
$answer_content = trim($_POST['answer_content'], "\r\n\t");
if (!$answer_content) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('请输入回复内容')));
}
// 判断是否是问题发起者
if (get_setting('answer_self_question') == 'N' and $question_info['published_uid'] == $this->user_id) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('不能回复自己发布的问题,你可以修改问题内容')));
}
// 判断是否已回复过问题
if (get_setting('answer_unique') == 'Y' and $this->model('answer')->has_answer_by_uid($question_info['question_id'], $this->user_id)) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('一个问题只能回复一次,你可以编辑回复过的回复')));
}
if (strlen($answer_content) < get_setting('answer_length_lower')) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('回复内容字数不得少于 %s 字节', get_setting('answer_length_lower'))));
}
if (!$this->user_info['permission']['publish_url'] and FORMAT::outside_url_exists($answer_content)) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你所在的用户组不允许发布站外链接')));
}
if (!$this->model('publish')->insert_attach_is_self_upload($answer_content, $_POST['attach_ids'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('只允许插入当前页面上传的附件')));
}
if (human_valid('answer_valid_hour') and !AWS_APP::captcha()->is_validate($_POST['seccode_verify'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('请填写正确的验证码')));
}
// !注: 来路检测后面不能再放报错提示
if (!valid_post_hash($_POST['post_hash'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('页面停留时间过长,或内容已提交,请刷新页面')));
}
$this->model('draft')->delete_draft($question_info['question_id'], 'answer', $this->user_id);
if ($this->publish_approval_valid($answer_content)) {
$this->model('publish')->publish_approval('answer', array('question_id' => $question_info['question_id'], 'answer_content' => $answer_content, 'anonymous' => $_POST['anonymous'], 'attach_access_key' => $_POST['attach_access_key'], 'auto_focus' => $_POST['auto_focus']), $this->user_id, $_POST['attach_access_key']);
H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/publish/wait_approval/question_id-' . $question_info['question_id'] . '__is_mobile-' . $_POST['_is_mobile'])), 1, null));
} else {
$answer_id = $this->model('publish')->publish_answer($question_info['question_id'], $answer_content, $this->user_id, $_POST['anonymous'], $_POST['attach_access_key'], $_POST['auto_focus']);
if ($_POST['_is_mobile']) {
//$url = get_js_url('/m/question/id-' . $question_info['question_id'] . '__item_id-' . $answer_id . '__rf-false');
$this->model('answer')->set_answer_publish_source($answer_id, 'mobile');
} else {
//$url = get_js_url('/question/' . $question_info['question_id'] . '?item_id=' . $answer_id . '&rf=false');
}
$answer_info = $this->model('answer')->get_answer_by_id($answer_id);
if ($answer_info['has_attach']) {
$answer_info['attachs'] = $this->model('publish')->get_attach('answer', $answer_id, 'min');
$answer_info['insert_attach_ids'] = FORMAT::parse_attachs($answer_info['answer_content'], true);
}
$answer_info['user_info'] = $this->user_info;
$answer_info['answer_content'] = $this->model('question')->parse_at_user(FORMAT::parse_attachs(nl2br(FORMAT::parse_bbcode($answer_info['answer_content']))));
TPL::assign('answer_info', $answer_info);
if (is_mobile()) {
H::ajax_json_output(AWS_APP::RSM(array('ajax_html' => TPL::output('m/ajax/question_answer', false)), 1, null));
} else {
H::ajax_json_output(AWS_APP::RSM(array('ajax_html' => TPL::output('question/ajax/answer', false)), 1, null));
}
}
}
示例9: topic_best_answer_list_action
public function topic_best_answer_list_action()
{
if (!$_GET['topic_id']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('参数错误')));
}
$_GET['page'] = $_GET['page'] ? $_GET['page'] - 1 : 0;
$per_page = get_setting('contents_per_page');
if ($_GET['per_page']) {
$per_page = intval($_GET['per_page']);
}
//$action_list = $this->model('topic')->get_topic_best_answer_action_list(intval($_GET['topic_id']), $this->user_id, intval($_GET['page']) * get_setting('contents_per_page') . ', ' . get_setting('contents_per_page'));
$action_list = $this->model('topic')->get_topic_best_answer_action_list(intval($_GET['topic_id']), $this->user_id, intval($_GET['page']) * $per_page . ', ' . $per_page);
$question_info_key = array('question_id', 'question_content');
$answer_info_key = array('answer_id', 'answer_content', 'add_time', 'against_count', 'agree_count', 'comment_count', 'thanks_count', 'agree_status');
if ($action_list) {
foreach ($action_list as $key => $val) {
foreach ($val as $kk => $vv) {
if (!in_array($kk, array('question_info', 'user_info', 'answer_info'))) {
unset($action_list[$key][$kk]);
}
if ($kk == 'question_info') {
foreach ($vv as $k => $v) {
if (!in_array($k, $question_info_key)) {
unset($action_list[$key][$kk][$k]);
}
}
}
if ($kk == 'user_info') {
$action_list[$key][$kk] = $this->model('myapi')->get_clean_user_info($vv);
}
if ($kk == 'answer_info') {
foreach ($vv as $k => $v) {
if (!in_array($k, $answer_info_key)) {
unset($action_list[$key][$kk][$k]);
}
}
$vv['answer_content'] = $this->model('question')->parse_at_user(FORMAT::parse_attachs(nl2br(FORMAT::parse_bbcode($vv['answer_content']))));
$action_list[$key][$kk]['answer_content'] = cjk_substr(trim(strip_tags($vv['answer_content'])), 0, 100);
}
}
}
} else {
$action_list = null;
}
H::ajax_json_output(AWS_APP::RSM(array('total_rows' => count($action_list), 'rows' => array_values($action_list)), 1, null));
}
示例10: reply_ticket
public function reply_ticket($ticket_id, $message, $uid, $attach_access_key = null)
{
$ticket_info = $this->get_ticket_info_by_id($ticket_id);
if (!$ticket_info or $ticket_info['status'] == 'closed') {
return false;
}
$now = time();
$reply_id = $this->insert('ticket_reply', array('ticket_id' => $ticket_info['id'], 'message' => htmlspecialchars($message), 'uid' => intval($uid), 'time' => $now, 'uid' => intval($uid), 'ip' => ip2long(fetch_ip())));
if (!$reply_id) {
return false;
}
set_human_valid('answer_valid_hour');
if ($attach_access_key) {
$this->model('publish')->update_attach('ticket_reply', $reply_id, $attach_access_key);
}
if (!$ticket_info['reply_time']) {
$this->shutdown_update('ticket', array('reply_time' => $now), 'id = ' . $ticket_info['id']);
}
if ($ticket_info['weibo_msg_id']) {
$this->model('openid_weibo_weibo')->reply_answer_to_sina($question_info['question_id'], cjk_substr($answer_content, 0, 110, 'UTF-8', '...'));
}
if ($ticket_info['received_email_id']) {
$this->model('edm')->reply_answer_by_email($question_info['question_id'], nl2br(FORMAT::parse_bbcode($answer_content)));
}
return $reply_id;
}
示例11: question_action
public function question_action()
{
TPL::assign('body_class', 'active');
if (!$this->user_id and !$this->user_info['permission']['visit_question']) {
HTTP::redirect('/m/login/url-' . base64_encode(get_js_url($_SERVER['QUERY_STRING'])));
}
if (!isset($_GET['id'])) {
HTTP::redirect('/m/explore/');
}
if ($_GET['notification_id']) {
$this->model('notify')->read_notification($_GET['notification_id'], $this->user_id);
}
if (!($question_info = $this->model('question')->get_question_info_by_id($_GET['id']))) {
H::redirect_msg(AWS_APP::lang()->_t('问题不存在或已被删除'), '/m/explore/');
}
$question_info['redirect'] = $this->model('question')->get_redirect($question_info['question_id']);
if ($question_info['redirect']['target_id']) {
$target_question = $this->model('question')->get_question_info_by_id($question_info['redirect']['target_id']);
}
if (is_digits($_GET['rf']) and $_GET['rf']) {
if ($from_question = $this->model('question')->get_question_info_by_id($_GET['rf'])) {
$redirect_message[] = AWS_APP::lang()->_t('从问题') . ' <a href="' . get_js_url('/m/question/' . $_GET['rf'] . '?rf=false') . '">' . $from_question['question_content'] . '</a> ' . AWS_APP::lang()->_t('跳转而来');
}
}
if ($question_info['redirect'] and !$_GET['rf']) {
if ($target_question) {
HTTP::redirect('/m/question/' . $question_info['redirect']['target_id'] . '?rf=' . $question_info['question_id']);
} else {
$redirect_message[] = AWS_APP::lang()->_t('重定向目标问题已被删除, 将不再重定向问题');
}
} else {
if ($question_info['redirect']) {
if ($target_question) {
$message = AWS_APP::lang()->_t('此问题将跳转至') . ' <a href="' . get_js_url('/m/question/' . $question_info['redirect']['target_id'] . '?rf=' . $question_info['question_id']) . '">' . $target_question['question_content'] . '</a>';
if ($this->user_id and ($this->user_info['permission']['is_administortar'] or $this->user_info['permission']['is_moderator'] or !$this->question_info['lock'] and $this->user_info['permission']['redirect_question'])) {
$message .= ' (<a href="javascript:;" onclick="AWS.ajax_request(G_BASE_URL + \'/question/ajax/redirect/\', \'item_id=' . $question_info['question_id'] . '\');">' . AWS_APP::lang()->_t('撤消重定向') . '</a>)';
}
$redirect_message[] = $message;
} else {
$redirect_message[] = AWS_APP::lang()->_t('重定向目标问题已被删除, 将不再重定向问题');
}
}
}
if ($question_info['has_attach']) {
$question_info['attachs'] = $this->model('publish')->get_attach('question', $question_info['question_id'], 'min');
$question_info['attachs_ids'] = FORMAT::parse_attachs($question_info['question_detail'], true);
}
$this->model('question')->update_views($question_info['question_id']);
if (get_setting('answer_unique') == 'Y') {
if ($this->model('answer')->has_answer_by_uid($question_info['question_id'], $this->user_id)) {
TPL::assign('user_answered', TRUE);
}
}
$question_info['question_detail'] = FORMAT::parse_attachs(nl2br(FORMAT::parse_bbcode($question_info['question_detail'])));
TPL::assign('question_id', $question_info['question_id']);
TPL::assign('question_info', $question_info);
TPL::assign('question_focus', $this->model('question')->has_focus_question($question_info['question_id'], $this->user_id));
TPL::assign('question_topics', $this->model('topic')->get_topics_by_item_id($question_info['question_id'], 'question'));
$this->crumb($question_info['question_content'], '/m/question/' . $question_info['question_id']);
TPL::assign('redirect_message', $redirect_message);
if ($this->user_id) {
TPL::assign('question_thanks', $this->model('question')->get_question_thanks($question_info['question_id'], $this->user_id));
TPL::assign('invite_users', $this->model('question')->get_invite_users($question_info['question_id']));
//TPL::assign('user_follow_check', $this->model("follow")->user_follow_check($this->user_id, $question_info['published_uid']));
if ($this->user_info['draft_count'] > 0) {
TPL::assign('draft_content', $this->model('draft')->get_data($question_info['question_id'], 'answer', $this->user_id));
}
}
if (isset($_GET['answer_id']) and (!$this->user_id or $_GET['single'])) {
$answer_list = $this->model('answer')->get_answer_list_by_question_id($question_info['question_id'], 1, 'answer_id = ' . intval($_GET['answer_id']));
} else {
if (!$this->user_id and !$this->user_info['permission']['answer_show']) {
if ($question_info['best_answer']) {
$answer_list = $this->model('answer')->get_answer_list_by_question_id($question_info['question_id'], 1, 'answer_id = ' . intval($question_info['best_answer']));
} else {
$answer_list = $this->model('answer')->get_answer_list_by_question_id($question_info['question_id'], 1, null, 'agree_count DESC');
}
} else {
$answer_list = $this->model('answer')->get_answer_list_by_question_id($question_info['question_id'], calc_page_limit($_GET['page'], 20), null, 'agree_count DESC, against_count ASC, add_time ASC');
}
}
// 最佳回复预留
$answers[0] = '';
if (!is_array($answer_list)) {
$answer_list = array();
}
$answer_ids = array();
$answer_uids = array();
foreach ($answer_list as $answer) {
$answer_ids[] = $answer['answer_id'];
$answer_uids[] = $answer['uid'];
if ($answer['has_attach']) {
$has_attach_answer_ids[] = $answer['answer_id'];
}
}
if (!in_array($question_info['best_answer'], $answer_ids) and intval($_GET['page']) < 2) {
$answer_list = array_merge($this->model('answer')->get_answer_list_by_question_id($question_info['question_id'], 1, 'answer_id = ' . $question_info['best_answer']), $answer_list);
}
if ($answer_ids) {
$answer_agree_users = $this->model('answer')->get_vote_user_by_answer_ids($answer_ids);
//.........这里部分代码省略.........
示例12: publish_answer
public function publish_answer($question_id, $answer_content, $uid, $anonymous = null, $attach_access_key = null, $auto_focus = true, $reply_to_openid = true)
{
if (!($question_info = $this->model('question')->get_question_info_by_id($question_id))) {
return false;
}
if (!($answer_id = $this->model('answer')->save_answer($question_id, $answer_content, $uid, $anonymous))) {
return false;
}
if ($at_users = $this->model('question')->parse_at_user($answer_content, false, true)) {
foreach ($at_users as $user_id) {
if ($user_id != $uid) {
$this->model('notify')->send($uid, $user_id, notify_class::TYPE_ANSWER_AT_ME, notify_class::CATEGORY_QUESTION, $question_info['question_id'], array('from_uid' => $uid, 'question_id' => $question_info['question_id'], 'item_id' => $answer_id, 'anonymous' => intval($anonymous)));
}
}
}
set_human_valid('answer_valid_hour');
if ($auto_focus) {
if (!$this->model('question')->has_focus_question($question_id, $uid)) {
$this->model('question')->add_focus_question($question_id, $uid, $anonymous, false);
}
}
ACTION_LOG::save_action($uid, $answer_id, ACTION_LOG::CATEGORY_ANSWER, ACTION_LOG::ANSWER_QUESTION, $answer_content, $question_id);
ACTION_LOG::save_action($uid, $question_id, ACTION_LOG::CATEGORY_QUESTION, ACTION_LOG::ANSWER_QUESTION, $answer_content, $answer_id, 0, intval($anonymous));
if ($question_info['published_uid'] != $uid) {
$this->model('integral')->process($uid, 'ANSWER_QUESTION', get_setting('integral_system_config_new_answer'), '回答问题 #' . $question_id, $question_id);
if (get_setting('integral_system_config_answer_change_source') == 'Y' and get_setting('integral_system_config_new_answer') <= 0) {
$this->model('integral')->process($question_info['published_uid'], 'QUESTION_ANSWER', -get_setting('integral_system_config_new_answer'), '问题被回答 #' . $question_id, $question_id);
}
}
$this->model('question')->save_last_answer($question_id, $answer_id);
if ($focus_uids = $this->model('question')->get_focus_uid_by_question_id($question_id)) {
foreach ($focus_uids as $focus_user) {
if ($focus_user['uid'] != $uid) {
$this->model('email')->action_email('NEW_ANSWER', $focus_user['uid'], get_js_url('/question/' . $question_id), array('question_title' => $question_info['question_content']));
$this->model('notify')->send($uid, $focus_user['uid'], notify_class::TYPE_NEW_ANSWER, notify_class::CATEGORY_QUESTION, $question_id, array('question_id' => $question_id, 'from_uid' => $uid, 'item_id' => $answer_id, 'anonymous' => intval($anonymous)));
}
}
}
// 删除回复邀请
$this->model('question')->answer_question_invite($question_id, $uid);
if ($attach_access_key) {
$this->model('publish')->update_attach('answer', $answer_id, $attach_access_key);
}
$this->model('question')->delete_question_uninterested($uid, $question_id);
if ($weixin_user = $this->model('openid_weixin_weixin')->get_user_info_by_uid($question_info['published_uid']) and $question_info['published_uid'] != $uid) {
$weixin_user_info = $this->model('account')->get_user_info_by_uid($weixin_user['uid']);
if ($weixin_user_info['weixin_settings']['NEW_ANSWER'] != 'N') {
$this->model('weixin')->send_text_message($weixin_user['openid'], "您的问题 [" . $question_info['question_content'] . "] 收到了新的回答:\n\n" . strip_tags($answer_content), $this->model('openid_weixin_weixin')->redirect_url('/m/question/' . $question_id));
}
}
$this->model('posts')->set_posts_index($question_id, 'question');
if ($reply_to_openid) {
if ($question_info['weibo_msg_id']) {
$this->model('openid_weibo_weibo')->reply_answer_to_sina($question_info['question_id'], cjk_substr($answer_content, 0, 110, 'UTF-8', '...'));
}
if ($question_info['received_email_id']) {
$this->model('edm')->reply_answer_by_email($question_info['question_id'], nl2br(FORMAT::parse_bbcode($answer_content)));
}
}
return $answer_id;
}
示例13: index_action
//.........这里部分代码省略.........
$answer_uids[] = $answer['uid'];
if ($answer['has_attach']) {
$has_attach_answer_ids[] = $answer['answer_id'];
}
}
if (!in_array($question_info['best_answer'], $answer_ids) and intval($_GET['page']) < 2) {
$answer_list = array_merge($this->model('answer')->get_answer_list_by_question_id($question_info['question_id'], 1, 'answer_id = ' . $question_info['best_answer']), $answer_list);
}
if ($answer_ids) {
$answer_vote_status = $this->model('answer')->get_answer_vote_status($answer_ids, $this->user_id);
$answer_users_rated_thanks = $this->model('answer')->users_rated('thanks', $answer_ids, $this->user_id);
$answer_users_rated_uninterested = $this->model('answer')->users_rated('uninterested', $answer_ids, $this->user_id);
}
foreach ($answer_list as $answer) {
$answer['user_rated_thanks'] = $answer_users_rated_thanks[$answer['answer_id']];
$answer['user_rated_uninterested'] = $answer_users_rated_uninterested[$answer['answer_id']];
$answer['answer_content'] = cjk_substr(strip_ubb($answer['answer_content']), 0, 100);
//$answer['agree_users'] = $answer_agree_users[$answer['answer_id']];
$answer['agree_status'] = $answer_vote_status[$answer['answer_id']];
$answer['user_info']['avatar_file'] = get_avatar_url($answer['uid']);
if ($question_info['best_answer'] == $answer['answer_id'] and intval($_GET['page']) < 2) {
$answers[0] = $answer;
} else {
$answers[] = $answer;
}
}
if (!$answers[0]) {
unset($answers[0]);
}
$question_info['user_answered'] = 0;
//如果系统设置了用户只能回答一次
if (get_setting('answer_unique') == 'Y') {
if ($this->model('answer')->has_answer_by_uid($question_info['question_id'], $this->user_id)) {
$question_info['user_answered'] = 1;
} else {
$question_info['user_answered'] = 0;
}
}
}
$question_info['user_follow_check'] = 0;
$question_info['user_question_focus'] = 0;
$question_info['user_thanks'] = 0;
if ($this->user_id) {
if ($this->model('question')->get_question_thanks($question_info['question_id'], $this->user_id)) {
$question_info['user_thanks'] = 1;
}
//当前用户是否已关注该问题作者
if ($this->model('follow')->user_follow_check($this->user_id, $question_info['published_uid'])) {
$question_info['user_follow_check'] = 1;
}
if ($this->model('question')->has_focus_question($question_info['question_id'], $this->user_id)) {
$question_info['user_question_focus'] = 1;
}
}
$question_info['question_detail'] = FORMAT::parse_attachs(nl2br(FORMAT::parse_bbcode($question_info['question_detail'])));
$question_topics = $this->model('topic')->get_topics_by_item_id($question_info['question_id'], 'question');
$question_info['answer_count'] = $answer_count;
//clean
$question_key = array('question_id', 'question_content', 'question_detail', 'add_time', 'update_time', 'answer_count', 'view_count', 'agree_count', 'focus_count', 'against_count', 'thanks_count', 'comment_count', 'user_info', 'user_answered', 'user_thanks', 'user_follow_check', 'user_question_focus');
$user_key = array('uid', 'user_name', 'namecard_pic', 'signature');
$topics_key = array('topic_id', 'topic_title');
foreach ($question_info as $k => $v) {
if (!in_array($k, $question_key)) {
unset($question_info[$k]);
}
}
//作者信息
if (!empty($question_info['user_info'])) {
foreach ($question_info['user_info'] as $k => $v) {
if (!in_array($k, $user_key)) {
unset($question_info['user_info'][$k]);
}
}
$question_info['user_info']['avatar_file'] = get_avatar_url($question_info['user_info']['uid'], 'mid');
}
if (!empty($answers)) {
foreach ($answers as $key => $value) {
if (!empty($value['user_info'])) {
foreach ($value['user_info'] as $k => $v) {
if (!in_array($k, $user_key)) {
unset($answers[$key]['user_info'][$k]);
}
}
$answers[$key]['user_info']['avatar_file'] = get_avatar_url($answers[$key]['user_info']['uid'], 'mid');
}
$answers[$key]['answer_content'] = strip_tags($value['answer_content']);
}
}
if (!empty($question_topics)) {
foreach ($question_topics as $key => $val) {
foreach ($val as $k => $v) {
if (!in_array($k, $topics_key)) {
unset($question_topics[$key][$k]);
}
}
}
}
//$question_info['answers'] = $answers;
H::ajax_json_output(AWS_APP::RSM(array('question_info' => $question_info, 'question_topics' => $question_topics, 'answers' => array_values($answers)), 1, null));
}
示例14: load_detailed_question_info
public function load_detailed_question_info($question_id)
{
if (!($question_info = $this->get_question_info_by_id($question_id))) {
return false;
}
$question_info['user_info'] = $this->model('account')->get_user_info_by_uid($question_info['published_uid'], true);
if ($question_info['category_id'] and get_setting('category_enable') == 'Y') {
$question_info['category_info'] = $this->model('system')->get_category_info($question_info['category_id']);
}
if ($question_info['has_attach']) {
$question_info['attachs'] = $this->model('publish')->get_attach('question', $question_info['question_id'], 'min');
$question_info['attachs_ids'] = FORMAT::parse_attachs($question_info['question_detail'], true);
}
$question_info['question_detail'] = FORMAT::parse_attachs(nl2br(FORMAT::parse_bbcode($question_info['question_detail'])));
// 答题选项
if (intval($question_info['quiz_id']) > 0) {
$question_info['question_quiz'] = $this->model('quiz')->get_question_quiz_info_by_id($question_info['quiz_id']);
}
return $question_info;
}
示例15: preview_action
public function preview_action()
{
if (!$_GET['action'] or $_GET['action'] != 'edit') {
$_GET['action'] = 'preview';
} else {
$this->crumb(AWS_APP::lang()->_t('待审项修改'), 'admin/approval/edit/');
TPL::assign('menu_list', $this->model('admin')->fetch_menu_list(300));
}
switch ($_GET['type']) {
case 'weibo_msg':
if (get_setting('weibo_msg_enabled') != 'question') {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('导入微博消息至问题未启用')));
}
$approval_item = $this->model('openid_weibo_weibo')->get_msg_info_by_id($_GET['id']);
if ($approval_item['question_id']) {
exit;
}
$approval_item['type'] = 'weibo_msg';
break;
case 'received_email':
$receiving_email_global_config = get_setting('receiving_email_global_config');
if ($receiving_email_global_config['enabled'] != 'question') {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('导入邮件至问题未启用')));
}
$approval_item = $this->model('edm')->get_received_email_by_id($_GET['id']);
if ($approval_item['question_id']) {
exit;
}
$approval_item['type'] = 'received_email';
break;
default:
$approval_item = $this->model('publish')->get_approval_item($_GET['id']);
break;
}
if (!$approval_item) {
exit;
}
switch ($approval_item['type']) {
case 'question':
$approval_item['title'] = htmlspecialchars($approval_item['data']['question_content']);
$approval_item['content'] = htmlspecialchars($approval_item['data']['question_detail']);
$approval_item['topics'] = htmlspecialchars(implode(',', $approval_item['data']['topics']));
break;
case 'answer':
$approval_item['content'] = htmlspecialchars($approval_item['data']['answer_content']);
break;
case 'article':
$approval_item['title'] = htmlspecialchars($approval_item['data']['title']);
$approval_item['content'] = htmlspecialchars($approval_item['data']['message']);
break;
case 'article_comment':
$approval_item['content'] = htmlspecialchars($approval_item['data']['message']);
break;
case 'weibo_msg':
$approval_item['content'] = htmlspecialchars($approval_item['text']);
if ($approval_item['has_attach']) {
$approval_item['attachs'] = $this->model('publish')->get_attach('weibo_msg', $_GET['id']);
}
break;
case 'received_email':
$approval_item['title'] = htmlspecialchars($approval_item['subject']);
$approval_item['content'] = htmlspecialchars($approval_item['content']);
break;
}
if ($approval_item['data']['attach_access_key']) {
$approval_item['attachs'] = $this->model('publish')->get_attach_by_access_key($approval_item['type'], $approval_item['data']['attach_access_key']);
}
if ($_GET['action'] != 'edit') {
$approval_item['content'] = nl2br(FORMAT::parse_bbcode($approval_item['content']));
}
TPL::assign('approval_item', $approval_item);
TPL::output('admin/approval/' . $_GET['action']);
}