当前位置: 首页>>代码示例>>PHP>>正文


PHP human_valid函数代码示例

本文整理汇总了PHP中human_valid函数的典型用法代码示例。如果您正苦于以下问题:PHP human_valid函数的具体用法?PHP human_valid怎么用?PHP human_valid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了human_valid函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save_comment_action

 public function save_comment_action()
 {
     if (!($article_info = $this->model('article')->get_article_info_by_id($_POST['article_id']))) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('指定文章不存在')));
     }
     if ($article_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('已经锁定的文章不能回复')));
     }
     $message = trim($_POST['message'], "\r\n\t");
     if (!$message) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('请输入回复内容')));
     }
     if (strlen($message) < 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($message)) {
         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('页面停留时间过长,或内容已提交,请刷新页面')));
     }
     if ($this->publish_approval_valid()) {
         $this->model('publish')->publish_approval('article_comment', array('article_id' => intval($_POST['article_id']), 'message' => $message, 'at_uid' => intval($_POST['at_uid'])), $this->user_id);
         H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/publish/wait_approval/article_id-' . intval($_POST['article_id']) . '__is_mobile-' . $_POST['_is_mobile'])), 1, null));
     } else {
         $comment_id = $this->model('publish')->publish_article_comment($_POST['article_id'], $message, $this->user_id, $_POST['at_uid']);
         $url = get_js_url('/article/' . intval($_POST['article_id']) . '?item_id=' . $comment_id);
         H::ajax_json_output(AWS_APP::RSM(array('url' => $url), 1, null));
     }
 }
开发者ID:chenruixuan,项目名称:wecenter,代码行数:34,代码来源:ajax.php

示例2: publish_action

 public function publish_action()
 {
     if (!$this->user_info['permission']['publish_ticket']) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('你没有权限发布工单')));
     }
     $_POST['title'] = trim($_POST['title']);
     if (!$_POST['title']) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请输入工单标题')));
     }
     if (human_valid('question_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 (!$this->model('publish')->insert_attach_is_self_upload($_POST['message'], $_POST['attach_ids'])) {
         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('页面停留时间过长,或内容已提交,请刷新页面')));
     }
     $ticket_id = $this->model('ticket')->save_ticket($_POST['title'], $_POST['message'], $this->user_id, $_POST['attach_access_key']);
     if (!$ticket_id) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('发布失败')));
     }
     $this->model('draft')->delete_draft(1, 'ticket', $this->user_id);
     H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/ticket/' . $ticket_id)), 1, null));
 }
开发者ID:elelianghh,项目名称:wecenter,代码行数:26,代码来源:ajax.php

示例3: modify_article_action

 public function modify_article_action()
 {
     if (!($article_info = $this->model('article')->get_article_info_by_id($_POST['article_id']))) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('文章不存在')));
     }
     if ($article_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('文章已锁定, 不能编辑')));
     }
     if (!$this->user_info['permission']['is_administortar'] and !$this->user_info['permission']['is_moderator'] and !$this->user_info['permission']['edit_article']) {
         if ($article_info['uid'] != $this->user_id) {
             H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你没有权限编辑这个文章')));
         }
     }
     if (!$_POST['title']) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请输入文章标题')));
     }
     if (get_setting('category_enable') == 'N') {
         $_POST['category_id'] = 1;
     }
     if (!$_POST['category_id']) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请选择文章分类')));
     }
     if (get_setting('question_title_limit') > 0 and cjk_strlen($_POST['title']) > get_setting('question_title_limit')) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('文章标题字数不得大于') . ' ' . get_setting('question_title_limit') . ' ' . AWS_APP::lang()->_t('字节')));
     }
     if (!$this->user_info['permission']['publish_url'] and FORMAT::outside_url_exists($_POST['message'])) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你所在的用户组不允许发布站外链接')));
     }
     if (human_valid('question_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 (!$this->model('publish')->insert_attach_is_self_upload($_POST['message'], $_POST['attach_ids'])) {
         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(1, 'article', $this->user_id);
     if ($_POST['do_delete'] and !$this->user_info['permission']['is_administortar'] and !$this->user_info['permission']['is_moderator']) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('对不起, 你没有删除文章的权限')));
     }
     if ($_POST['do_delete']) {
         if ($this->user_id != $article_info['uid']) {
             $this->model('account')->send_delete_message($article_info['uid'], $article_info['title'], $article_info['message']);
         }
         $this->model('article')->remove_article($article_info['id']);
         H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/home/explore/')), 1, null));
     }
     $this->model('article')->update_article($article_info['id'], $_POST['title'], $_POST['message'], $_POST['topics'], $_POST['category_id'], $this->user_info['permission']['create_topic']);
     if ($_POST['attach_access_key']) {
         $this->model('publish')->update_attach('article', $article_info['id'], $_POST['attach_access_key']);
     }
     H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/article/' . $article_info['id'])), 1, null));
 }
开发者ID:leonardo0004,项目名称:wecenter-loudong,代码行数:55,代码来源:ajax.php

示例4: index_action


//.........这里部分代码省略.........
             $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));
     $question_topics = $this->model('topic')->get_topics_by_item_id($question_info['question_id'], 'question');
     if (sizeof($question_topics) == 0 and $this->user_id) {
         $related_topics = $this->model('question')->get_related_topics($question_info['question_content']);
         TPL::assign('related_topics', $related_topics);
     }
     TPL::assign('question_topics', $question_topics);
     TPL::assign('question_related_list', $this->model('question')->get_related_question_list($question_info['question_id'], $question_info['question_content']));
     TPL::assign('question_related_links', $this->model('related')->get_related_links('question', $question_info['question_id']));
     if ($this->user_id) {
         if ($question_topics) {
             foreach ($question_topics as $key => $val) {
                 $question_topic_ids[] = $val['topic_id'];
             }
         }
         if ($helpful_users = $this->model('topic')->get_helpful_users_by_topic_ids($question_topic_ids, 17)) {
             foreach ($helpful_users as $key => $val) {
                 if ($val['user_info']['uid'] == $this->user_id) {
                     unset($helpful_users[$key]);
                 } else {
                     $helpful_users[$key]['has_invite'] = $this->model('question')->has_question_invite($question_info['question_id'], $val['user_info']['uid'], $this->user_id);
                     $helpful_users[$key]['experience'] = end($helpful_users[$key]['experience']);
                 }
             }
             TPL::assign('helpful_users', $helpful_users);
         }
     }
     $this->crumb($question_info['question_content'], '/question/' . $question_info['question_id']);
     if ($_GET['column'] == 'log') {
         $this->crumb(AWS_APP::lang()->_t('日志'), '/question/id-' . $question_info['question_id'] . '__column-log');
     } else {
         TPL::assign('human_valid', human_valid('answer_valid_hour'));
         if ($this->user_id) {
             TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/question/id-' . $question_info['question_id'] . '__sort_key-' . $_GET['sort_key'] . '__sort-' . $_GET['sort'] . '__uid-' . $_GET['uid']), 'total_rows' => $answer_count, 'per_page' => 100))->create_links());
         }
     }
     TPL::set_meta('keywords', implode(',', $this->model('system')->analysis_keyword($question_info['question_content'])));
     TPL::set_meta('description', $question_info['question_content'] . ' - ' . cjk_substr(str_replace("\r\n", ' ', strip_tags($question_info['question_detail'])), 0, 128, 'UTF-8', '...'));
     if (get_setting('advanced_editor_enable') == 'Y') {
         import_editor_static_files();
     }
     if (get_setting('upload_enable') == 'Y') {
         // fileupload
         TPL::import_js('js/fileupload.js');
     }
     TPL::assign('attach_access_key', md5($this->user_id . time()));
     TPL::assign('redirect_message', $redirect_message);
     $recommend_posts = $this->model('posts')->get_recommend_posts_by_topic_ids($question_topic_ids);
     if ($recommend_posts) {
         foreach ($recommend_posts as $key => $value) {
             if ($value['question_id'] and $value['question_id'] == $question_info['question_id']) {
                 unset($recommend_posts[$key]);
                 break;
             }
         }
         TPL::assign('recommend_posts', $recommend_posts);
     }
     // 答题选项
     if (intval($question_info['quiz_id']) > 0) {
         $question_quiz = $this->model('quiz')->get_question_quiz_info_by_id($question_info['quiz_id']);
         TPL::import_js('js/quiz.js');
         TPL::import_css('css/quiz.css');
         TPL::import_js('js/app/question.js');
         TPL::assign('question_quiz', $question_quiz);
     }
     TPL::output('question/index');
 }
开发者ID:egogg,项目名称:naokr-website,代码行数:101,代码来源:main.php

示例5: article_action

 public function article_action()
 {
     if ($_GET['notification_id']) {
         $this->model('notify')->read_notification($_GET['notification_id'], $this->user_id);
     }
     if (!($article_info = $this->model('article')->get_article_info_by_id($_GET['id']))) {
         H::redirect_msg(AWS_APP::lang()->_t('文章不存在或已被删除'), '/home/explore/');
     }
     $this->crumb($article_info['title'], '/article/' . $article_info['id']);
     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_markdown($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'], null, 10);
     TPL::assign('article_info', $article_info);
     TPL::assign('article_topics', $this->model('topic')->get_topics_by_item_id($article_info['id'], 'article'));
     if ($_GET['item_id']) {
         $comments[] = $this->model('article')->get_comment_by_id($_GET['item_id']);
     } else {
         $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);
         }
     }
     $this->model('article')->update_views($article_info['id']);
     TPL::assign('comments', $comments);
     TPL::assign('comments_count', $article_info['comments']);
     TPL::assign('human_valid', human_valid('answer_valid_hour'));
     TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/m/article/id-' . $article_info['id']), 'total_rows' => $article_info['comments'], 'per_page' => 100))->create_links());
     TPL::output('m/article');
 }
开发者ID:Vizards,项目名称:HeavenSpree,代码行数:38,代码来源:main.php

示例6: 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));
         }
     }
 }
开发者ID:tenstone,项目名称:wecenter,代码行数:66,代码来源:ajax.php

示例7: index_action

 public function index_action()
 {
     if ($_GET['notification_id']) {
         $this->model('notify')->read_notification($_GET['notification_id'], $this->user_id);
     }
     if (is_mobile()) {
         HTTP::redirect('/m/article/' . $_GET['id']);
     }
     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_markdown($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);
     TPL::assign('article_info', $article_info);
     $article_topics = $this->model('topic')->get_topics_by_item_id($article_info['id'], 'article');
     if ($article_topics) {
         TPL::assign('article_topics', $article_topics);
         foreach ($article_topics as $topic_info) {
             $article_topic_ids[] = $topic_info['topic_id'];
         }
     }
     TPL::assign('reputation_topics', $this->model('people')->get_user_reputation_topic($article_info['user_info']['uid'], $user['reputation'], 5));
     $this->crumb($article_info['title'], '/article/' . $article_info['id']);
     TPL::assign('human_valid', human_valid('answer_valid_hour'));
     if ($_GET['item_id']) {
         $comments[] = $this->model('article')->get_comment_by_id($_GET['item_id']);
     } else {
         $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);
         }
     }
     if ($this->user_id) {
         TPL::assign('user_follow_check', $this->model('follow')->user_follow_check($this->user_id, $article_info['uid']));
     }
     TPL::assign('question_related_list', $this->model('question')->get_related_question_list(null, $article_info['title']));
     $this->model('article')->update_views($article_info['id']);
     TPL::assign('comments', $comments);
     TPL::assign('comments_count', $article_info['comments']);
     TPL::assign('human_valid', human_valid('answer_valid_hour'));
     TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/article/id-' . $article_info['id']), 'total_rows' => $article_info['comments'], 'per_page' => 100))->create_links());
     TPL::set_meta('keywords', implode(',', $this->model('system')->analysis_keyword($article_info['title'])));
     TPL::set_meta('description', $article_info['title'] . ' - ' . cjk_substr(str_replace("\r\n", ' ', strip_tags($article_info['message'])), 0, 128, 'UTF-8', '...'));
     TPL::assign('attach_access_key', md5($this->user_id . time()));
     $recommend_posts = $this->model('posts')->get_recommend_posts_by_topic_ids($article_topic_ids);
     if ($recommend_posts) {
         foreach ($recommend_posts as $key => $value) {
             if ($value['id'] and $value['id'] == $article_info['id']) {
                 unset($recommend_posts[$key]);
                 break;
             }
         }
         TPL::assign('recommend_posts', $recommend_posts);
     }
     if (get_setting('advanced_editor_enable') == 'Y') {
         TPL::import_js('js/editor/prettify.js');
     }
     TPL::output('article/index');
 }
开发者ID:chenruixuan,项目名称:wecenter,代码行数:69,代码来源:main.php

示例8: article_action

 public function article_action()
 {
     if ($_GET['id']) {
         if (!($article_info = $this->model('article')->get_article_info_by_id($_GET['id']))) {
             H::redirect_msg(AWS_APP::lang()->_t('指定文章不存在'));
         }
         if (!$this->user_info['permission']['is_administortar'] and !$this->user_info['permission']['is_moderator'] and !$this->user_info['permission']['edit_article'] and $article_info['uid'] != $this->user_id) {
             H::redirect_msg(AWS_APP::lang()->_t('你没有权限编辑这个文章'), '/article/' . $article_info['id']);
         }
         TPL::assign('article_topics', $this->model('topic')->get_topics_by_item_id($article_info['id'], 'article'));
     } else {
         if (!$this->user_info['permission']['publish_article']) {
             H::redirect_msg(AWS_APP::lang()->_t('你所在用户组没有权限发布文章'));
         } else {
             if ($this->is_post() and $_POST['message']) {
                 $article_info = array('title' => htmlspecialchars($_POST['title']), 'message' => htmlspecialchars($_POST['message']), 'category_id' => intval($_POST['category_id']));
             } else {
                 $draft_content = $this->model('draft')->get_data(1, 'article', $this->user_id);
                 $article_info = array('title' => htmlspecialchars($_POST['title']), 'message' => htmlspecialchars($draft_content['message']));
             }
         }
     }
     if ($this->user_info['permission']['is_administortar'] or $this->user_info['permission']['is_moderator'] or $article_info['uid'] == $this->user_id and $_GET['id'] or !$_GET['id']) {
         TPL::assign('attach_access_key', md5($this->user_id . time()));
     }
     if (!$article_info['category_id']) {
         $article_info['category_id'] = $_GET['category_id'] ? intval($_GET['category_id']) : 0;
     }
     if (get_setting('category_enable') == 'Y') {
         TPL::assign('article_category_list', $this->model('system')->build_category_html('question', 0, $article_info['category_id']));
     }
     TPL::assign('human_valid', human_valid('question_valid_hour'));
     TPL::import_js('js/app/publish.js');
     if (get_setting('advanced_editor_enable') == 'Y') {
         import_editor_static_files();
     }
     if (get_setting('upload_enable') == 'Y') {
         // fileupload
         TPL::import_js('js/fileupload.js');
     }
     TPL::assign('recent_topics', @unserialize($this->user_info['recent_topics']));
     TPL::assign('article_info', $article_info);
     TPL::output('publish/article');
 }
开发者ID:egogg,项目名称:naokr-website,代码行数:44,代码来源:main.php

示例9: publish_action

 public function publish_action()
 {
     if (!$this->user_info['permission']['publish_ticket']) {
         H::redirect_msg(AWS_APP::lang()->_t('你所在用户组没有权限发布工单'));
     }
     $this->crumb(AWS_APP::lang()->_t('发布工单'), '/ticket/publish/');
     TPL::assign('draft_content', $this->model('draft')->get_data(1, 'ticket', $this->user_id));
     TPL::assign('attach_access_key', md5($this->user_id . time()));
     TPL::assign('human_valid', human_valid('question_valid_hour'));
     TPL::import_js('js/app/publish.js');
     if (get_setting('advanced_editor_enable') == 'Y') {
         import_editor_static_files();
     }
     if (get_setting('upload_enable') == 'Y') {
         // fileupload
         TPL::import_js('js/fileupload.js');
     }
     TPL::output('ticket/publish');
 }
开发者ID:elelianghh,项目名称:wecenter,代码行数:19,代码来源:main.php

示例10: index_action

 public function index_action()
 {
     if ($_GET['notification_id']) {
         $this->model('notify')->read_notification($_GET['notification_id'], $this->user_id);
     }
     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_info['is_recommend_homepage'] = $this->model('recommend')->recommend_homepage_check('article', $article_info['id']);
     TPL::assign('article_info', $article_info);
     $article_topics = $this->model('topic')->get_topics_by_item_id($article_info['id'], 'article');
     if ($article_topics) {
         TPL::assign('article_topics', $article_topics);
         foreach ($article_topics as $topic_info) {
             $article_topic_ids[] = $topic_info['topic_id'];
         }
     }
     TPL::assign('reputation_topics', $this->model('people')->get_user_reputation_topic($article_info['user_info']['uid'], $user['reputation'], 5));
     $this->crumb($article_info['title'], '/article/' . $article_info['id']);
     TPL::assign('human_valid', human_valid('answer_valid_hour'));
     if ($_GET['item_id']) {
         $comments[] = $this->model('article')->get_comment_by_id($_GET['item_id']);
     } else {
         $comments = $this->model('article')->get_comments($article_info['id'], $_GET['page'], 50);
     }
     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']);
         }
     }
     if ($this->user_id) {
         TPL::assign('user_follow_check', $this->model('follow')->user_follow_check($this->user_id, $article_info['uid']));
     }
     TPL::assign('question_related_list', $this->model('question')->get_related_question_list(null, $article_info['title']));
     // 最新推荐文章
     $hot_articles = $this->model('article')->get_articles_list(null, 1, 5, 'votes DESC', null);
     foreach ($hot_articles as $key => $val) {
         $article_ids[] = $val['id'];
     }
     $article_attachs = $this->model('publish')->get_attachs('article', $article_ids, 'min');
     foreach ($hot_articles as $key => $val) {
         $hot_articles[$key]['attachs'] = $article_attachs[$val['id']];
     }
     TPL::assign('hot_articles', $hot_articles);
     // 推荐专题
     if (TPL::is_output('block/sidebar_hot_topics.tpl.htm', 'question/square')) {
         TPL::assign('sidebar_hot_topics', $this->model('module')->sidebar_hot_topics($_GET['category'], 4));
     }
     $this->model('article')->update_views($article_info['id']);
     TPL::assign('comments', $comments);
     TPL::assign('comments_count', $article_info['comments']);
     TPL::assign('human_valid', human_valid('answer_valid_hour'));
     TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/article/id-' . $article_info['id']), 'total_rows' => $article_info['comments'], 'per_page' => 50))->create_links());
     TPL::set_meta('keywords', implode(',', $this->model('system')->analysis_keyword($article_info['title'])));
     TPL::set_meta('description', $article_info['title'] . ' - ' . cjk_substr(str_replace("\r\n", ' ', strip_tags($article_info['message'])), 0, 128, 'UTF-8', '...'));
     TPL::assign('attach_access_key', md5($this->user_id . time()));
     $recommend_posts = $this->model('posts')->get_recommend_posts_by_topic_ids($article_topic_ids);
     if ($recommend_posts) {
         foreach ($recommend_posts as $key => $value) {
             if ($value['id'] and $value['id'] == $article_info['id']) {
                 unset($recommend_posts[$key]);
                 break;
             }
         }
         TPL::assign('recommend_posts', $recommend_posts);
     }
     // 收藏数量
     $bookmark_count = $this->model('favorite')->get_favorite_counts('article', $article_info['id']);
     TPL::assign('bookmark_count', $bookmark_count);
     TPL::import_js('js/sweetalert.min.js');
     TPL::import_css('css/sweetalert.css');
     TPL::import_js('js/jquery-qrcode.min.js');
     TPL::import_js('js/share.js');
     TPL::output('article/index');
 }
开发者ID:egogg,项目名称:wecenter-dev,代码行数:87,代码来源:main.php

示例11: publish_action

 public function publish_action()
 {
     if ($_GET['id']) {
         if (!($question_info = $this->model('question')->get_question_info_by_id($_GET['id']))) {
             H::redirect_msg(AWS_APP::lang()->_t('指定问题不存在'));
         }
         if (!$this->user_info['permission']['is_administortar'] and !$this->user_info['permission']['is_moderator'] and !$this->user_info['permission']['edit_question']) {
             if ($question_info['published_uid'] != $this->user_id) {
                 H::redirect_msg(AWS_APP::lang()->_t('你没有权限编辑这个问题'), '/m/question/' . $_GET['id']);
             }
         }
         TPL::assign('question_info', $question_info);
     } else {
         if (!$this->user_info['permission']['publish_question']) {
             H::redirect_msg(AWS_APP::lang()->_t('你所在用户组没有权限发布问题'));
         } else {
             if ($this->is_post() and $_POST['question_detail']) {
                 $question_info = array('question_content' => htmlspecialchars($_POST['question_content']), 'question_detail' => htmlspecialchars($_POST['question_detail']), 'category_id' => intval($_POST['category_id']));
             } else {
                 if ($_GET['weixin_media_id']) {
                     $weixin_pic_url = AWS_APP::cache()->get('weixin_pic_url_' . md5(base64_decode($_GET['weixin_media_id'])));
                     if (!$weixin_pic_url) {
                         H::redirect_msg(AWS_APP::lang()->_t('图片已过期或 media_id 无效'));
                     }
                     TPL::assign('weixin_media_id', $_GET['weixin_media_id']);
                     TPL::assign('weixin_pic_url', $weixin_pic_url);
                 } else {
                     $draft_content = $this->model('draft')->get_data(1, 'question', $this->user_id);
                     $question_info = array('question_content' => htmlspecialchars($_POST['question_content']), 'question_detail' => htmlspecialchars($draft_content['message']));
                 }
             }
         }
     }
     if ($this->user_info['integral'] < 0 and get_setting('integral_system_enabled') == 'Y' and !$_GET['id']) {
         H::redirect_msg(AWS_APP::lang()->_t('你的剩余积分已经不足以进行此操作'));
     }
     if ($this->user_info['permission']['is_administortar'] or $this->user_info['permission']['is_moderator'] or $question_info['published_uid'] == $this->user_id and $_GET['id'] or !$_GET['id']) {
         TPL::assign('attach_access_key', md5($this->user_id . time()));
     }
     if (!$question_info['category_id']) {
         $question_info['category_id'] = $_GET['category_id'] ? intval($_GET['category_id']) : 0;
     }
     if (get_setting('category_enable') == 'Y') {
         TPL::assign('question_category_list', $this->model('system')->build_category_html('question', 0, $question_info['category_id']));
     }
     TPL::import_js(array('js/fileupload.js'));
     TPL::assign('question_info', $question_info);
     TPL::assign('body_class', 'active');
     TPL::assign('human_valid', human_valid('question_valid_hour'));
     TPL::output('m/publish');
 }
开发者ID:lincoln2015,项目名称:18duchengxuyuan_server,代码行数:51,代码来源:main.php


注:本文中的human_valid函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。