Skip to content

Commit

Permalink
解析bbcode从controller层移至view层
Browse files Browse the repository at this point in the history
  • Loading branch information
name committed Jan 1, 2019
1 parent 9fb684d commit 02c3cec
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 15 deletions.
2 changes: 0 additions & 2 deletions app/article/main.php
Expand Up @@ -47,8 +47,6 @@ public function index_action()

$article_info['user_info'] = $this->model('account')->get_user_info_by_uid($article_info['uid'], true);

$article_info['message'] = 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);
Expand Down
2 changes: 1 addition & 1 deletion app/question/ajax.php
Expand Up @@ -596,7 +596,7 @@ public function save_answer_action()
$answer_info = $this->model('answer')->get_answer_by_id($answer_id);

$answer_info['user_info'] = $this->user_info;
$answer_info['answer_content'] = $this->model('question')->parse_at_user(nl2br(FORMAT::parse_bbcode($answer_info['answer_content'])));
$answer_info['answer_content'] = $this->model('question')->parse_at_user($answer_info['answer_content']);

TPL::assign('answer_info', $answer_info);

Expand Down
4 changes: 1 addition & 3 deletions app/question/main.php
Expand Up @@ -226,7 +226,7 @@ public function index_action()
{
$answer['answer_thanks'] = $answer_users_rated_thanks[$answer['answer_id']];

$answer['answer_content'] = $this->model('question')->parse_at_user(nl2br(FORMAT::parse_bbcode($answer['answer_content'])));
$answer['answer_content'] = $this->model('question')->parse_at_user($answer['answer_content']);

//$answer['agree_users'] = $answer_agree_users[$answer['answer_id']];
$answer['agree_status'] = $answer_vote_status[$answer['answer_id']];
Expand Down Expand Up @@ -276,8 +276,6 @@ public function index_action()
}
}

$question_info['question_detail'] = 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));

Expand Down
2 changes: 0 additions & 2 deletions app/topic/main.php
Expand Up @@ -97,8 +97,6 @@ public function index_action()
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']));

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));
Expand Down
2 changes: 1 addition & 1 deletion views/default/article/index.tpl.htm
Expand Up @@ -68,7 +68,7 @@ <h1>
</div>
<div class="mod-body">
<div class="content markitup-box">
<?php echo $this->article_info['message']; ?>
<?php echo FORMAT::html($this->article_info['message']); ?>
</div>
<div class="meta clearfix">
<div class="aw-article-vote pull-left<?php if (!$this->user_id OR $this->user_id == $this->article_info['uid']) { ?> disabled<?php } ?>">
Expand Down
2 changes: 1 addition & 1 deletion views/default/question/ajax/answer.tpl.htm
Expand Up @@ -42,7 +42,7 @@
<?php if (!$this->answer_info['answer_content']) { ?>
<i class="text-color-999"><?php _e('已删除'); ?></i>
<?php } else { ?>
<?php echo $this->answer_info['answer_content']; ?>
<?php echo FORMAT::html($this->answer_info['answer_content']); ?>
<?php } ?>
</div>
<!-- end 内容 -->
Expand Down
6 changes: 3 additions & 3 deletions views/default/question/index.tpl.htm
Expand Up @@ -103,7 +103,7 @@ <h1>
</div>
<div class="mod-body">
<div class="content markitup-box">
<?php echo $this->question_info['question_detail']; ?>
<?php echo FORMAT::html($this->question_info['question_detail']); ?>
</div>
</div>
<div class="mod-footer">
Expand Down Expand Up @@ -274,15 +274,15 @@ <h2 class="hidden-xs"><?php if ($_GET['single']) { ?><?php _e('查看单个回
<?php if (!$val['answer_content']) { ?>
<i class="text-color-999"><?php _e('已删除'); ?></i>
<?php } else { ?>
<?php echo $val['answer_content']; ?>
<?php echo FORMAT::html($val['answer_content']); ?>
<?php } ?>
</div>
<?php } else { ?>
<div class="markitup-box">
<?php if (!$val['answer_content']) { ?>
<i class="text-color-999"><?php _e('已删除'); ?></i>
<?php } else { ?>
<?php echo $val['answer_content']; ?>
<?php echo FORMAT::html($val['answer_content']); ?>
<?php } ?>
</div>
<?php } ?>
Expand Down
4 changes: 2 additions & 2 deletions views/default/topic/index.tpl.htm
Expand Up @@ -183,7 +183,7 @@ <h2 class="pull-left"><?php echo $this->topic_info['topic_title']; ?> <?php if (

<div class="tab-pane" id="about">
<div class="aw-topic-detail-about text-color-666 markitup-box">
<?php echo $this->topic_info['topic_description']; ?>
<?php echo FORMAT::html($this->topic_info['topic_description']); ?>
</div>
</div>
</div>
Expand All @@ -201,7 +201,7 @@ <h3><?php _e('话题描述'); ?></h3>
</div>
<div class="mod-body">
<?php if ($this->topic_info['topic_description']) { ?>
<p><?php echo cjk_substr(strip_tags($this->topic_info['topic_description']), 0, 128, 'UTF-8', '... &nbsp; <a href="javascript:;" onclick="$(\'#i_about\').click()">查看全部</a>'); ?></p>
<p><?php echo cjk_substr(strip_ubb($this->topic_info['topic_description']), 0, 128, 'UTF-8', '... &nbsp; <a href="javascript:;" onclick="$(\'#i_about\').click()">查看全部</a>'); ?></p>
<?php } else if ($this->topic_info['topic_lock'] == 0 && $this->user_info['permission']['edit_topic']) { ?>
<a href="topic/edit/<?php echo $this->topic_info['topic_id']; ?>" class="icon-inverse" class=><i class="icon icon-edit"></i> <?php _e('添加描述'); ?></a>
<?php } ?>
Expand Down

0 comments on commit 02c3cec

Please sign in to comment.