public function bbcode_to_markdown_action() { switch ($_GET['type']) { default: if ($questions_list = $this->model('question')->fetch_page('question', null, 'question_id ASC', $_GET['page'], $_GET['per_page'])) { foreach ($questions_list as $key => $val) { $this->model('question')->update('question', array('question_detail' => FORMAT::bbcode_2_markdown($val['question_detail'])), 'question_id = ' . intval($val['question_id'])); } H::redirect_msg(AWS_APP::lang()->_t('正在转换主题内容 BBCode') . ', ' . AWS_APP::lang()->_t('批次: %s', $_GET['page']), '/admin/tools/bbcode_to_markdown/page-' . ($_GET['page'] + 1) . '__per_page-' . $_GET['per_page']); } else { H::redirect_msg(AWS_APP::lang()->_t('准备继续...'), '/admin/tools/bbcode_to_markdown/page-1__type-answer__per_page-' . $_GET['per_page']); } break; case 'answer': if ($answer_list = $this->model('question')->fetch_page('answer', null, 'answer_id ASC', $_GET['page'], $_GET['per_page'])) { foreach ($answer_list as $key => $val) { $this->model('answer')->update_answer_by_id($val['answer_id'], array('answer_content' => FORMAT::bbcode_2_markdown($val['answer_content']))); } H::redirect_msg(AWS_APP::lang()->_t('正在转换回复内容 BBCode') . ', ' . AWS_APP::lang()->_t('批次: %s', $_GET['page']), '/admin/tools/bbcode_to_markdown/page-' . ($_GET['page'] + 1) . '__type-answer__per_page-' . $_GET['per_page']); } else { H::redirect_msg(AWS_APP::lang()->_t('准备继续...'), '/admin/tools/bbcode_to_markdown/page-1__type-topic__per_page-' . $_GET['per_page']); } break; case 'topic': if ($topic_list = $this->model('topic')->get_topic_list(null, 'topic_id ASC', $_GET['per_page'], $_GET['page'])) { foreach ($topic_list as $key => $val) { $this->model('topic')->update('topic', array('topic_description' => FORMAT::bbcode_2_markdown($val['topic_description'])), 'topic_id = ' . intval($val['topic_id'])); } H::redirect_msg(AWS_APP::lang()->_t('正在转换话题内容 BBCode') . ', ' . AWS_APP::lang()->_t('批次: %s', $_GET['page']), '/admin/tools/bbcode_to_markdown/page-' . ($_GET['page'] + 1) . '__type-topic__per_page-' . $_GET['per_page']); } else { H::redirect_msg(AWS_APP::lang()->_t('BBCode 转换完成'), '/admin/tools/'); } break; } }
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_markdown($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_markdown($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); }
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)); } }
public function reply_action() { $_POST['message'] = trim($_POST['message']); if (!$_POST['message']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请输入回复内容'))); } if (!$_POST['id']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请选择要回复的工单'))); } $ticket_info = $this->model('ticket')->get_ticket_info_by_id($_POST['id']); if (!$ticket_info) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('工单不存在'))); } if ($ticket_info['status'] == 'closed') { 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_service'] and $ticket_info['uid'] != $this->user_id and !$this->model('ticket')->has_invited($this->user_id)) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('你没有权限回复该工单'))); } $reply_id = $this->model('ticket')->reply_ticket($ticket_info['id'], $_POST['message'], $this->user_id, $_POST['attach_access_key']); if (!$reply_id) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('回复失败'))); } $this->model('draft')->delete_draft(1, 'ticket_reply', $this->user_id); $reply_info = $this->model('ticket')->get_ticket_reply_by_id($reply_id); if ($ticket_info['uid'] != $this->user_id) { $this->model('notify')->send($reply_info['uid'], $ticket_info['uid'], notify_class::TYPE_TICKET_REPLIED, notify_class::CATEGORY_TICKET, 0, array('from_uid' => $reply_info['uid'], 'ticket_id' => $ticket_info['id'], 'reply_id' => $reply_info['id'])); } $reply_info['user_info'] = $this->user_info; $reply_info['message'] = nl2br(FORMAT::parse_markdown($reply_info['message'])); if ($reply_info['has_attach']) { $reply_info['attachs'] = $this->model('publish')->get_attach('ticket', $reply_info['id'], 'min'); $reply_info['insert_attach_ids'] = FORMAT::parse_attachs($reply_info['message'], true); $reply_info['message'] = FORMAT::parse_attachs($reply_info['message']); } if (!$ticket_info['service'] and $ticket_info['uid'] != $this->user_id and ($this->user_info['permission']['is_administortar'] or $this->user_info['permission']['is_service'])) { $this->model('ticket')->assign_service($ticket_info['id'], $this->user_id); } TPL::assign('reply_info', $reply_info); H::ajax_json_output(AWS_APP::RSM(array('ajax_html' => TPL::output('ticket/ajax/reply', false)), 1, null)); }
require "../../../frame/engine.php"; ENGINE::START(); $USER = USER::VERIFY(0, TRUE); if (empty($_GET['sSearch'])) { $S = $_GET['string']; } else { $S = $_GET['sSearch']; } $iDS = $_GET['iDisplayStart']; $iDL = $_GET['iDisplayLength']; $iSC = $_GET['iSortCol_0']; $iSD = $_GET['sSortDir_0']; switch ($iSC) { case 0: $SS = 'ORDER BY c_name ' . $iSD; break; case 1: $SS = 'ORDER BY c_phone ' . $iSD; break; case 2: $SS = ''; break; } $iTotal = MYSQL::QUERY('SELECT COUNT(c_id) AS `COUNT` FROM core_customers WHERE c_name LIKE ? OR c_phone LIKE ?', array('%' . $S . '%', '%' . $S . '%')); $iQuery = MYSQL::QUERY("SELECT * FROM core_customers WHERE c_name LIKE ? OR c_phone LIKE ? {$SS} LIMIT {$iDS},{$iDL}", array('%' . $S . '%', '%' . $S . '%'), FALSE, TRUE); $OUTPUT = array('sEcho' => $_GET['sEcho'], 'iTotalRecords' => $iTotal[0]['COUNT'], 'iTotalDisplayRecords' => $iTotal[0]['COUNT'], 'aaData'); foreach ($iQuery as $C) { $OUTPUT['aaData'][] = array($C['c_name'], FORMAT::PHONE($C['c_phone']), '<button onClick="LoadCustomer(' . "'" . $C['c_id'] . "'" . ')">LOAD</button>'); } echo JSON_ENCODE($OUTPUT);
function parse_link_callback($matches) { if (preg_match('/^(?!http).*/i', $matches[1])) { $url = 'http://' . $matches[1]; } else { $url = $matches[1]; } if (is_inside_url($url)) { return '<a href="' . $url . '">' . FORMAT::sub_url($matches[1], 50) . '</a>'; } else { return '<a href="' . $url . '" rel="nofollow" target="_blank">' . FORMAT::sub_url($matches[1], 50) . '</a>'; } }
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'); }
<?php require "../../../frame/engine.php"; ENGINE::START(); $user = USER::VERIFY(0, TRUE); $Fname = FORMAT::TEXT($_GET['Fname']); $Lname = FORMAT::TEXT($_GET['Lname']); $Phone = trim($_GET['phone']); $Sec = trim($_GET['secondarymethod']); $SecInfo = trim($_GET['secinfo']); $Zip = trim($_GET['zip']); $Market = trim($_GET['market']); $Market_Location = trim($_GET['market_location']); $Corporate_Account = trim($_GET['corpacc']); $params = array("{$Fname} {$Lname}", $Zip, $Corporate_Account, $Phone, $Sec, $SecInfo, Date("Y-m-d H:i:s")); $Main = MYSQL::QUERY('INSERT INTO core_customers (c_name,c_zip,c_acc,c_phone,c_contact_method,c_contact_info,c_join_date) VALUES (?,?,?,?,?,?,?)', $params); USER::LOG("Customer Added [{$Fname} {$Lname}][{$Phone}]"); TRACKING::ADVERT($Market_Location, $user); TRACKING::CUSTOMERS($user); echo '<option value="' . str_pad($Main, 10, "0", STR_PAD_LEFT) . '">' . $Fname . ' ' . $Lname . '</option>';
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': $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': $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_markdown($approval_item['content'])); } TPL::assign('approval_item', $approval_item); TPL::output('admin/approval/' . $_GET['action']); }
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; } }
public function read_action() { if (!($dialog = $this->model('message')->get_dialog_by_id($_GET['id']))) { H::redirect_msg(AWS_APP::lang()->_t('指定的站内信不存在'), '/inbox/'); } if ($dialog['recipient_uid'] != $this->user_id and $dialog['sender_uid'] != $this->user_id) { H::redirect_msg(AWS_APP::lang()->_t('指定的站内信不存在'), '/inbox/'); } $this->model('message')->set_message_read($_GET['id'], $this->user_id); if ($list = $this->model('message')->get_message_by_dialog_id($_GET['id'])) { if ($dialog['sender_uid'] != $this->user_id) { $recipient_user = $this->model('account')->get_user_info_by_uid($dialog['sender_uid']); } else { $recipient_user = $this->model('account')->get_user_info_by_uid($dialog['recipient_uid']); } foreach ($list as $key => $val) { if ($dialog['sender_uid'] == $this->user_id and $val['sender_remove']) { unset($list[$key]); } else { if ($dialog['sender_uid'] != $this->user_id and $val['recipient_remove']) { unset($list[$key]); } else { $list[$key]['message'] = FORMAT::parse_links($val['message']); $list[$key]['user_name'] = $recipient_user['user_name']; $list[$key]['url_token'] = $recipient_user['url_token']; } } } } $user_key = array('uid', 'user_name', 'name', 'avatar_file', 'namecard_pic', 'signature'); if (!empty($recipient_user)) { foreach ($recipient_user as $k => $v) { if (!in_array($k, $user_key)) { unset($recipient_user[$k]); } } } $recipient_user['avatar_file'] = get_avatar_url($recipient_user['uid'], 'max'); H::ajax_json_output(AWS_APP::RSM(array('recipient_user' => $recipient_user, 'rows' => $list), 1, null)); }
public function topic_action() { if (is_numeric($_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::ajax_json_output(AWS_APP::RSM(null, -1, 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'])) { $topic_info = $this->model('topic')->get_topic_by_id($_GET['merged_id']); $topic_info['merged_tip'] = "您查看的话题已被合并到当前话题"; } else { $this->model('topic')->remove_merge_topic($topic_info['topic_id'], $topic_info['merged_id']); } } //此话题的最佳回答者 //TPL::assign('best_answer_users', $this->model('topic')->get_best_answer_users_by_topic_id($topic_info['topic_id'], 5)); if ($this->user_id) { $topic_info['has_focus'] = $this->model('topic')->has_focus_topic($this->user_id, $topic_info['topic_id']); } $topic_info['topic_description'] = nl2br(FORMAT::parse_markdown($topic_info['topic_description'])); H::ajax_json_output(AWS_APP::RSM(array('topic_info' => $topic_info), 1, null)); }
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'] = $approval_item['data']['question_content']; $approval_item['content'] = $approval_item['data']['question_detail']; $approval_item['topics'] = implode(',', $approval_item['data']['topics']); break; case 'answer': $approval_item['content'] = $approval_item['data']['answer_content']; break; case 'article': $approval_item['title'] = $approval_item['data']['title']; $approval_item['content'] = $approval_item['data']['message']; break; case 'article_comment': $approval_item['content'] = $approval_item['data']['message']; break; case 'weibo_msg': $approval_item['content'] = $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'] = $approval_item['subject']; $approval_item['content'] = $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']); }
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)); }
$BUTTONS['B3_F'] = 'DISABLED'; $BUTTONS['B4'] = 'Re-Open Ticket'; $BUTTONS['B4_F'] = 'onClick="ReopenTicket(' . "'" . $CODE . "'" . ')"'; break; case 99: $BUTTONS['B3_F'] = 'DISABLED'; $BUTTONS['B4'] = 'Re-Open Ticket'; $BUTTONS['B4_F'] = 'onClick="ReopenTicket(' . "'" . $CODE . "'" . ')"'; break; } $PHY = $TICKET['INFO']['t_phy'] == 1 ? "Yes" : "No"; $LIQ = $TICKET['INFO']['t_liq'] == 1 ? "Yes" : "No"; $SOF = $TICKET['INFO']['t_sof'] == 1 ? "Yes" : "No"; $MANU = $TICKET['MANU']['m_name']; $MODEL = str_replace($MANU . " ", "", $TICKET['MODE']['m_name']); $PHONE = FORMAT::PHONE($TICKET['CUST']['c_phone']); $CD = date("M d, Y h:i A", strtotime($TICKET['INFO']['t_created'])); if (empty($TICKET['INFO']['t_estimate_created'])) { $ED = ""; } else { $ED = date("M d, Y h:i A", strtotime($TICKET['INFO']['t_estimate_created'])); } if (empty($TICKET['INFO']['t_repair_created'])) { $RD = ""; } else { $RD = date("M d, Y h:i A", strtotime($TICKET['INFO']['t_repair_created'])); } if (empty($TICKET['INFO']['t_checkout_created'])) { $CHD = ""; } else { $CHD = date("M d, Y h:i A", strtotime($TICKET['INFO']['t_checkout_created']));
protected function doParseLink($text) { return $this->hashPart(FORMAT::parse_links($text)); }
public function update_answer_action() { if (!($answer_info = $this->model('answer')->get_answer_by_id($_GET['answer_id']))) { H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('答案不存在'))); } if ($_POST['do_delete']) { if ($answer_info['uid'] != $this->user_id 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('你没有权限进行此操作'))); } $this->model('answer')->remove_answer_by_id($_GET['answer_id']); // 通知回复的作者 if ($this->user_id != $answer_info['uid']) { $this->model('notify')->send($this->user_id, $answer_info['uid'], notify_class::TYPE_REMOVE_ANSWER, notify_class::CATEGORY_QUESTION, $answer_info['question_id'], array('from_uid' => $this->user_id, 'question_id' => $answer_info['question_id'])); } $this->model('question')->save_last_answer($answer_info['question_id']); H::ajax_json_output(AWS_APP::RSM(null, 1, null)); } $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 (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 ($answer_info['uid'] != $this->user_id 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 ($answer_info['uid'] == $this->user_id and time() - $answer_info['add_time'] > get_setting('answer_edit_time') * 60 and get_setting('answer_edit_time') 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('已经超过允许编辑的时限'))); } $this->model('answer')->update_answer($_GET['answer_id'], $answer_info['question_id'], $answer_content, $_POST['attach_access_key']); H::ajax_json_output(AWS_APP::RSM(array('target_id' => $_GET['target_id'], 'display_id' => $_GET['display_id']), 1, null)); }
$USER = USER::VERIFY(0, TRUE); $CID = $_GET['cid']; $CUST = MYSQL::QUERY("SELECT * FROM core_customers WHERE c_id = ? LIMIT 1", array($CID)); $PHONE = FORMAT::PHONE($CUST['c_phone']); switch ($CUST['c_contact_method']) { case 0: $CONT = FORMAT::PHONE($CUST['c_contact_info']); break; case 1: $CONT = $CUST['c_contact_info']; break; case 2: $CONT = 'Customer Will Contact Us'; break; case 3: $CONT = FORMAT::PHONE($CUST['c_phone']); break; } $CORP = MYSQL::QUERY("SELECT * FROM core_corporate_accounts WHERE c_id = ? LIMIT 1", array($CUST['c_acc'])); echo <<<STR <div style="width:240px;height:95px;display:inline-block;float:left;border-right: 1px solid #ACB1B7;padding-right:5px;"> \t\t<div style="width:100%;"> \t\t\t<div class="aname">Name:</div> \t\t\t<div class="bname" style="padding-right:2px;">{$CUST['c_name']}</div> \t\t\t<br/> \t\t\t<div class="aname">Primary Phone:</div> \t\t\t<div class="bname" style="padding-right:2px;">{$PHONE}</div> \t\t\t<br/> \t\t\t<div class="aname">Contact:</div> \t\t\t<div class="bname" style="padding-right:2px;">{$CONT}</div> \t\t\t<br/>
$time = $_POST['checkouttime']; if ($pm2cost <= 0.0 || $pm2cost == '') { $pm2 = 'None'; } if (!$pm2 == 'None') { $paymentmethod = $pm1 . ' (' . $pm1cost . '), ' . $pm2 . ' (' . $pm2cost . ')'; } else { $paymentmethod = $pm1; } $items = $_POST['items']; $itemscut = explode("|", $items); $ses = FORMAT::SES(10); $T = ENGINE::TICKET($tid, 3); $return = MYSQL::QUERY("INSERT INTO core_checkout_sessions (customer, items, pm_1, pm_1_cost, pm_2, pm_2_cost, ses, s_id, d_date) VALUES (?,?,?,?,?,?,?,?,?)", array($T['t_customer'], $items, $pm1, $pm1cost, $pm2, $pm2cost, $ses, $user['store'], Date("Y-m-d H:i:s"))); echo "\n <style>\n .escca td{\n border-top: 0px;\n border-right: 0px;\n }\n </style>\n "; $content = "\n <center style='width:724px;'>\n <table border='1' cellspacing='0' id='Header-Table' class='escca' style='margin-top:10px;border: 1px solid black;width: 98% !important;border-left: 0px;border-bottom:0px none !important;'>\n\t <thead>\n\t\t <tr>\n\t\t\t <td style='width:150px;height:150px;border-right:0px none;'><img src='https://my-cpr.com/cprlogo.jpg' border='0'></td>\n\t\t\t\t <td style='border-left:0px none;border-right:0px none;text-align:center;'>\n\t\t\t\t <div style='font-size:28px;'>\n\t\t\t\t\t <label style='font-size:32px;'><b>" . $user['store_info']['s_header'] . "</b></label><br/>\n\t\t\t\t\t\t <label style='font-size:24px;'>Contact our " . $user['store_info']['s_name'] . " Location at</label><br/>\n\t\t\t\t\t\t <label>" . FORMAT::PHONE($user['store_info']['s_phone']) . "</label><br/>\n\t\t\t\t\t\t <label><b>" . $user['store_info']['s_website'] . "</b></label>\n\t\t\t\t\t </div>\n\t\t\t\t </td>\n\t\t\t </tr>\n\t\t </thead>\n\t </table>\n\t <table border='1' cellspacing='0' id='Customer-Table' class='escca' style='border: 1px solid black;width: 98% !important;border-left: 0px;border-bottom:0px none !important;border-top:0px none;'>\n\t <tbody>\n\t\t <tr>\n\t\t\t <td><b>Name</b></td>\n\t\t\t\t <td><b>Phone Number</b></td>\n\t\t\t\t <td><b>Date (M/D/Y)</b></td>\n\t\t\t\t <td><b>Time</b></td>\n\t\t\t </tr>\n\t\t\t <tr style='font-family:Courier, monospace;'>\n\t\t\t <td>" . $T['c_name'] . "</td>\n\t\t\t\t <td>" . FORMAT::PHONE($T['c_phone']) . "</td>\n\t\t\t\t <td>" . Date('m/d/y') . "</td>\n\t\t\t\t <td>" . Date('h:i A') . "</td>\n\t\t\t </tr>\n\t\t </tbody>\n\t </table>\n <table border='1' cellspacing='0' id='Device-Table' class='escca' style='border: 1px solid black;width: 98% !important;border-left: 0px;border-bottom:0px none !important;border-top:0px none;'>\n\t <thead>\n\t\t <tr>\n\t\t\t <td><b>Service/Item<b/></td>\n\t\t\t\t\t <td style='width:60px'><center><b>Physical</b></center></td>\n\t\t\t\t <td style='width:60px'><center><b>Software</b></center></td>\n\t\t\t\t\t\t<td><b>Cost</b></td>\n\t\t\t </tr>\n\t\t </thead>\n\t\t <tbody style='font-family:Courier, monospace;'>\n\t\t\t\t\t"; $nontaxable = ''; $taxable = ''; $itemscheckedout = 0; foreach ($itemscut as $item) { $itemscheckedout++; $split = explode("/", $item); $b = explode("-", $split[0]); if ($b[0] == "ti") { $NT = MYSQL::QUERY("SELECT t_phy, t_liq, t_sof FROM core_tickets_checkout WHERE t_id = ? LIMIT 1;", array($b[1])); if ($NT['t_liq'] == 1) { $warr = false; } else { $warr = true; } if ($NT['t_liq'] == 1) {
include '../../ajax/simple_html_dom.php'; $user = USER::VERIFY(0); $manu = $_GET['manu']; $model = $_GET['model']; $lp = $_GET['lp']; $up = $_GET['up']; $sp = str_replace(";", "&", $_GET['sp']); $iden = $_GET['iden']; $notes = $_GET['notes']; $ses = FORMAT::SES(10); $Model = MYSQL::QUERY("SELECT * FROM device_models WHERE m_id = ? LIMIT 1", array($model)); MYSQL::QUERY("INSERT INTO core_refurb_devices (d_manu_id, d_model_id, d_model, d_iden, d_locked_price, d_unlocked_price, d_service_provider, d_notes, d_by, d_store, d_ses, d_date) VALUES (?,?,?,?,?,?,?,?,?,?,?,?);", array($manu, $model, $Model['m_name'], $iden, $lp, $up, $sp, $notes, $user['user_id'], $user['store'], $ses, Date("Y-m-d H:i:s"))); $SELECT = MYSQL::QUERY("SELECT d_id, d_ses FROM core_refurb_devices WHERE d_ses = ? LIMIT 1", array($ses)); $infoset = ''; $url = "http://www.phonearena.com" . $Model['m_link']; $html = file_get_html($url); foreach ($html->find('div.rightspecscol') as $section) { foreach ($section->find('div.s_specs_box') as $info) { $info->onclick = null; $info->href = null; $infoset .= $info; } } echo "\n<style>\n#phone_specificatons a{display: none !important;font-family: Arial,Helvetica,sans-serif;}\n.s_box_4{border:5px\nsolid #d0e8f5}.s_box_4\nh2{margin:0px;padding:7px 10px 7px 10px;line-height:22px;font-size:18px;font-weight:normal;color:#0f6c9b;background-color:#d0e8f5;display:none;}.s_box_4_orange_1{border:5px\nsolid #ffc56b}.s_box_4_orange_1\nh2{color:#6f3700;background-color:#ffc56b}.s_box_4_gray_1{border:5px\nsolid #ddd}.s_box_4_gray_1\nh2{color:#666;background-color:#ddd}.s_box_4\n.s_listing{margin-right:-15px}.s_box_4\n.s_block_4{margin-right:10px;margin-bottom:10px;text-align:center}.s_block_1\n.s_wall_to_wall{display:inline-block;color:#aaa;font-size:18px;vertical-align:top}.s_block_1\n.s_show_hide{vertical-align:top;color:#999;font-size:14px}.s_block_1 a.s_show_hide:hover{color:#ff250f}.s_specs_box{margin-bottom:0px;font-size:12px;border:5px\nsolid #dff3fd;width:49%;float:left;display:inline-block;}.s_specs_box\nh3{padding-left:9px;background-color:#dff3fd}.s_specs_box li\nstrong.s_lv_1{display:block;float:left;width:100px;color:#226290}.s_specs_box li\nstrong.s_lv_1.s_bullet_advanced{width:85px}.s_specs_box li li\nstrong{font-weight:normal;color:#777}.s_specs_box\nli.s_lv_1{overflow:hidden;padding:5px\n5px 0px 5px;border-bottom:1px solid #eee}.s_specs_box>ul>li:nth-child(even),.s_specs_box>ul>li.s_even{}.s_specs_box>ul>li:hover{background:#FFFCE0}.s_specs_box>ul>li:last-child{}.s_specs_box\nul.s_lv_1{padding-left:110px}.s_specs_box ul.s_lv_1\nli{}.s_specs_box\nstrong.s_lv_2{position:relative;float:left;width:95px !important;margin-left:-96px;text-align:left;color:#4dafe1;color:#226290}.s_specs_box\nstrong.s_lv_2.s_bullet_advanced{width:80px !important;margin-left:-96px}.s_specs_box\nli.s_lv_3{~overflow: hidden;width:100%;~border: 1px solid #fff}.s_specs_box\nstrong.s_lv_3{position:relative;float:left;margin-left:-86px;width:85px !important;text-align:left;color:#1B93D0}.s_specs_box\nstrong.s_lv_3.s_bullet_advanced{width:70px !important;margin-left:-86px}.s_specs_box\nul.s_lv_3{~overflow: hidden;width:100%;position:relative;margin-bottom:4px}.s_specs_box>ul>li>ul>li>ul{margin-bottom:4px}.s_specs_box>ul>li>ul>li>ul:last-child{margin-bottom:0}.s_specs_box>ul>li>ul>li.clearfix{padding-top:4px}.s_specs_box.s_form > ul > li > ul\nli{padding-left:5px;padding-left:0px;text-align:left}.s_specs_box>ul>li>ul>li>ul>li{padding-left:0}.s_specs_box .s_text,\n.s_specs_box textarea,\n.s_specs_box\nselect{font-size:11px}.s_specs_box\nselect{width:100%}.s_specs_box .s_text,\n.s_specs_box\ntextarea{padding:2px\n!important}.s_specs_box label.s_radio,\n.s_specs_box\nlabel.s_checkbox{display:block !important;margin-bottom:2px}.s_specs_box{margin-bottom:0px;padding:1px;font-size:12px;border:none}.s_specs_box\nh3{padding:5px\n9px;font-size:16px;font-weight:bold;background:#fff;color:#505050;text-transform:uppercase;font-family:'Open Sans',Arial,Helvetica,sans-serif}.s_specs_box\nul{background:#f9f9f9;background:none;padding:0px;margin:0px;border:1px\nsolid #dadada;font-style:normal;font-size:13px;line-height:18px}.s_specs_box ul ul, .s_specs_box ul ul\nul{border:none;margin:0;padding:0}.s_specs_box ul\nli{display:block !important;margin:0px;padding:4px\n7px !important}.s_specs_box ul li + .s_specs_box ul\nli{border-top:1px solid #ccc !important}.s_specs_box ul li ul li, .s_specs_box ul li ul li ul\nli{border:none !important;margin:0;padding:0px\n!important}.s_specs_box li strong.s_lv_1, .s_specs_box\nstrong.s_lv_2{font-style:normal;color:#505050;font-size:12px;text-align:left}.s_specs_box > ul > li > ul > li\nstrong{margin-left:-100px !important}.s_specs_box>ul>li:last-child{border-bottom:none}.s_specs_box input.text,\n.s_specs_box\nlabel{text-align:left}.s_specs_box\ntable{margin-bottom:0;border:none}.s_filter_box th,\n.s_filter_box\ntd{border:none;border-top:1px solid #ddd}.s_filter_box\ntd{width:160px}.s_filter_box tr.s_level_2 td,\n.s_filter_box tr.s_level_2 th,\n.s_filter_box tr.s_level_3 th,\n.s_filter_box tr.s_level_3\ntd{padding-top:0;padding-bottom:7px;border:none !important;vertical-align:top;background:none !important}.s_filter_box tr:first-child th,\n.s_filter_box td:first-child\ntd{border:none !important}.s_filter_box\nlabel{white-space:normal !important}.s_specs_box table th,\n.s_specs_box table\nstrong.s_label{color:#226290;font-weight:bold}.s_specs_box table\nstrong.s_label{display:block;padding-bottom:5px}.s_specs_box table tr.s_level_2\nth{font-weight:normal;padding-left:13px}.s_specs_box table tr.s_level_3\nth{font-weight:normal;padding-left:18px;color:#52a1cc}.s_specs_box.s_1_col table tr.s_level_2\ntd{padding-left:13px}.s_specs_box.s_1_col table tr.s_level_2 td\nstrong.s_label{font-weight:normal}.s_specs_box.s_1_col table tr.s_level_3\ntd{padding-left:18px}.s_specs_box.s_1_col table tr.s_level_3 td\nstrong.s_label{font-weight:normal;color:#52a1cc}.s_specs_box table th:first-child{padding-left:8px}.s_specs_box table td:last-child{padding-right:8px}.s_specs_box table tr th:last-child,\n.s_specs_box table tr td:last-child{border-right:none}.s_specs_box table tr:last-child\nth{border-bottom:none}\n.s_tooltip_content{display:none;}\n.gray_9{display:none;}\n.floatright{display:none;}\n</style>\n<div style='height:450px;width:49%;overflow:hidden;display:inline-block;float:left;font-size:16px;position:relative;'>\n<center>\n <img src='https://my-cpr.com/barcode.php?encode=I25&height=20&scale=1&color=000000&bgcolor=FFFFFF&type=png&file=&bdata=" . $SELECT['d_id'] . "' border='0' /><br/>\n\tIdentifier<br/>" . $iden . "<br/>\n <img border='0' src='https://my-cpr.com/cprlogo.jpg' style='position:absolute;bottom:20px;left:0px;'>\n\t<div style='position:absolute;bottom:25px;right:5px;width:50%;'>\n\t <b>Device:</b> " . $Model['m_name'] . "<br/>\n\t <b>Carrier:</b> " . $sp . "<br/>\n\t <b>Price:</b> \$" . $lp . "<br/>\n\t "; if ($up > $lp) { echo "<b>UnLocked Price:</b> \$" . $up . "<br/><br/>"; } else { echo "<br/><br/>"; } echo "\n\t</div>\n</center>\n</div>\n<div style='height:500px;width:49%;overflow:hidden;display:inline-block;float:left;margin-left:2%;'><center>\n<font style='font-size:24px;'>" . $user['store_info']['s_header'] . "</font><br/>\n<font style='font-size:16px;'>Contact our " . $user['store_info']['s_name'] . " Location at</font><br/>\n<font style='font-size:20px;'>" . FORMAT::PHONE($user['store_info']['s_phone']) . "</font><br/>\n<font style='font-size:18px;'>" . $user['store_info']['s_website'] . "</font><br/><br/><br/>\n<font style='font-size:16px;'>Warranty:</font><br/>\n<font style='font-size:40px;'>6 Months</font><br/><br/>\n<b>Physical Warranty</b> - This warranty covers any device purchased. If the device proves to be defective in any way we will replace it at no extra charge.\n\t\t\t\t\t\t\tThis warranty is void if the device sustains any physical or liquid damage.\n\t\t\t\t\t\t\t<br/><br/>\n\t\t\t\t\t\t\t<b>Software Warranty</b> - This warranty guarantees any software service we provide for the device at sale (e.g. Unlocking). If for any reason the device is updated, modified (e.g. jailbreaking, unlocking, rooting) or sustains\n\t\t\t\t\t\t\tphysical or liquid damage the warranty becomes void.\n\t\t\t\t\t\t\t<br/><br/>\n\t\t\t\t\t\t\t<b>Liquid Damage</b> - If your device sustains liquid damage its warranty becomes null and void. No Exceptions.\n</center></div>\n<div style='height:450px;width:100%;overflow:hidden;'>\n" . $infoset . "\n</div>\n";
<?php require "../../frame/engine.php"; ENGINE::START("HASH"); $Hash = new PasswordHash(8, true); $USER = $_POST['usr']; $USER_CLEAN = STRTOLOWER($USER); $PASS = $_POST['pas']; if (empty($USER) && empty($PASS)) { die('e1437'); } else { $R = MYSQL::QUERY("SELECT * FROM core_users WHERE username_clean = ? LIMIT 1", array($USER_CLEAN)); if (empty($R)) { die('e1435'); } else { if (!$Hash->CheckPassword($PASS, $R['password'])) { die('e1436'); } else { $S = MYSQL::QUERY('SELECT * FROM core_stores WHERE s_id = ? LIMIT 1', array($R['store'])); DATE_DEFAULT_TIMEZONE_SET($S['s_timezone']); USER::LOG("Logged In", $R['user_id']); $SES_EXP = TIME() + 43200; $SES_GEN = FORMAT::SES(50); $params = array($SES_GEN, $R['user_id'], $SES_EXP, $SES_GEN, $SES_EXP); MYSQL::QUERY('INSERT INTO core_users_sessions (session_key,session_user,session_experation) VALUES (?,?,?) ON DUPLICATE KEY UPDATE session_key=?,session_experation=?', $params); setcookie("core_u", $params[1], $SES_EXP, '/'); setcookie("core_k", $params[0], $SES_EXP, '/'); echo 's1434'; } } }
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'); }
public function read_action() { if (!($dialog = $this->model('message')->get_dialog_by_id($_GET['id']))) { H::redirect_msg(AWS_APP::lang()->_t('指定的站内信不存在'), '/inbox/'); } if ($dialog['recipient_uid'] != $this->user_id and $dialog['sender_uid'] != $this->user_id) { H::redirect_msg(AWS_APP::lang()->_t('指定的站内信不存在'), '/inbox/'); } $this->model('message')->set_message_read($_GET['id'], $this->user_id); if ($list = $this->model('message')->get_message_by_dialog_id($_GET['id'])) { if ($dialog['sender_uid'] != $this->user_id) { $recipient_user = $this->model('account')->get_user_info_by_uid($dialog['sender_uid']); } else { $recipient_user = $this->model('account')->get_user_info_by_uid($dialog['recipient_uid']); } foreach ($list as $key => $val) { if ($dialog['sender_uid'] == $this->user_id and $val['sender_remove']) { unset($list[$key]); } else { if ($dialog['sender_uid'] != $this->user_id and $val['recipient_remove']) { unset($list[$key]); } else { $list[$key]['message'] = FORMAT::parse_links($val['message']); $list[$key]['user_name'] = $recipient_user['user_name']; $list[$key]['url_token'] = $recipient_user['url_token']; $list[$key]['profile_update_time'] = $recipient_user['profile_update_time']; } } } } $this->crumb(AWS_APP::lang()->_t('私信对话') . ': ' . $recipient_user['user_name'], '/inbox/read/' . intval($_GET['id'])); TPL::assign('list', $list); TPL::assign('recipient_user', $recipient_user); TPL::output('inbox/read'); }
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) { $comments[$key]['message'] = FORMAT::parse_links($this->model('question')->parse_at_user($comments[$key]['message'])); $comments[$key]['user_name'] = $user_infos[$val['uid']]['user_name']; $comments[$key]['url_token'] = $user_infos[$val['uid']]['url_token']; } $answer_comments[$answer['answer_id']] = $comments; } if (!$answers[0]) { unset($answers[0]); } if ($this->model('answer')->has_answer_by_uid($question_info['question_id'], $this->user_id)) { $user_answered = true; } else { $user_answered = false; } // 评论附件 TPL::assign('attach_access_key', md5($this->user_id . time())); TPL::assign('user_answered', $user_answered); TPL::assign('answers', $answers); TPL::assign('comments', $answer_comments); TPL::assign('answer_count', $answer_count); TPL::output('question/ajax/answer_list'); }
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/question/' . $_GET['id']); } if ($_GET['column'] == 'log' and !$this->user_id) { HTTP::redirect('/question/' . $_GET['id']); } if (!($question_info = $this->model('question')->get_question_info_by_id($_GET['id']))) { H::redirect_msg(AWS_APP::lang()->_t('问题不存在或已被删除'), '/question/'); } if (!$_GET['sort'] or $_GET['sort'] != 'ASC') { $_GET['sort'] = 'DESC'; } else { $_GET['sort'] = 'ASC'; } if (get_setting('unfold_question_comments') == 'Y') { $_GET['comment_unfold'] = 'all'; } $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('从问题 %s 跳转而来', '<a href="' . get_js_url('/question/' . $_GET['rf'] . '?rf=false') . '">' . $from_question['question_content'] . '</a>'); } } if ($question_info['redirect'] and !$_GET['rf']) { if ($target_question) { HTTP::redirect('/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('/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); } 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']); } $question_info['user_info'] = $this->model('account')->get_user_info_by_uid($question_info['published_uid'], true); if ($_GET['column'] != 'log') { $this->model('question')->calc_popular_value($question_info['question_id']); $this->model('question')->update_views($question_info['question_id']); 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'] == 'add_time') { $answer_order_by = $_GET['sort_key'] . " " . $_GET['sort']; } else { $answer_order_by = "agree_count " . $_GET['sort'] . ", against_count ASC, add_time ASC"; } } } 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; } } 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'); }
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); // } // } // // $contents_related_topic_ids = array_merge($related_topics_ids, explode(',', $contents_topic_id)); // // TPL::assign('contents_related_topic_ids', implode(',', $contents_related_topic_ids)); // // if ($posts_list = $this->model('posts')->get_posts_list(null, 1, get_setting('contents_per_page'), 'new', $contents_related_topic_ids)) // // { // // foreach ($posts_list AS $key => $val) // // { // // if ($val['answer_count']) // // { // // $posts_list[$key]['answer_users'] = $this->model('question')->get_answer_users_by_question_id($val['question_id'], 2, $val['published_uid']); // // } // // } // // } // // TPL::assign('posts_list', $posts_list); // // TPL::assign('all_list_bit', TPL::output('explore/ajax/list', false)); // // if ($posts_list = $this->model('posts')->get_posts_list(null, 1, get_setting('contents_per_page'), null, $contents_related_topic_ids, null, null, 30, true)) // // { // // foreach ($posts_list AS $key => $val) // // { // // if ($val['answer_count']) // // { // // $posts_list[$key]['answer_users'] = $this->model('question')->get_answer_users_by_question_id($val['question_id'], 2, $val['published_uid']); // // } // // } // // } // 问题列表 $question_list = $this->model('topic')->get_question_list_by_topic($topic_info['topic_id'], $_GET['page'], get_setting('contents_per_page')); if ($question_list) { foreach ($question_list as $key => $val) { $this->model('question')->load_list_question_info($question_list[$key], $val, $this->user_id); } } TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/topic/id-' . $topic_info['topic_id'] . '__page-', $_GET['page']), 'total_rows' => $this->model('topic')->get_question_list_total(), 'per_page' => get_setting('contents_per_page'), 'num_links' => 2))->create_links()); TPL::assign('question_list', $question_list); //边栏热门话题 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)); } // TPL::assign('topic_recommend_list', $posts_list); // TPL::assign('posts_list', $posts_list); // TPL::assign('recommend_list_bit', TPL::output('explore/ajax/list', false)); // TPL::assign('list', $this->model('topic')->get_topic_best_answer_action_list($contents_topic_id, $this->user_id, get_setting('contents_per_page'))); // TPL::assign('best_questions_list_bit', TPL::output('home/ajax/index_actions', false)); // TPL::assign('posts_list', $this->model('posts')->get_posts_list('question', 1, get_setting('contents_per_page'), 'new', explode(',', $contents_topic_id))); // TPL::assign('all_questions_list_bit', TPL::output('explore/ajax/list', false)); // TPL::assign('posts_list', $this->model('posts')->get_posts_list('article', 1, get_setting('contents_per_page'), 'new', explode(',', $contents_topic_id))); // TPL::assign('articles_list_bit', TPL::output('explore/ajax/list', false)); // TPL::assign('contents_topic_id', $contents_topic_id); // TPL::assign('contents_topic_title', $contents_topic_title); // TPL::assign('log_list', $log_list); // TPL::assign('redirect_message', $redirect_message); if ($topic_info['parent_id']) { TPL::assign('parent_topic_info', $this->model('topic')->get_topic_by_id($topic_info['parent_id'])); } TPL::output('topic/index'); break; } }
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)); }
public function insert_attach_is_self_upload($message, $attach_ids = null) { if (!$message) { return true; } if (!$attach_ids) { $attach_ids = array(); } if ($question_attachs_ids = FORMAT::parse_attachs($message, true)) { foreach ($question_attachs_ids as $attach_id) { if (!in_array($attach_id, $attach_ids)) { return false; } } } return true; }
public function add_questions_to_mpnews($question_ids) { $questions_info = $this->model('question')->get_question_info_by_ids($question_ids); if (!$questions_info) { return false; } foreach ($questions_info as $question_info) { $published_uids[] = $question_info['published_uid']; } $users_info = $this->model('account')->get_user_info_by_uids($published_uids); foreach ($questions_info as $question_info) { $user_info = $users_info[$question_info['published_uid']]; $img = get_setting('upload_dir') . '/avatar/' . $this->model('account')->get_avatar($user_info['uid'], 'max'); if (!is_file($img)) { $img = ROOT_PATH . 'static/common/avatar-max-img.jpg'; } $result = $this->model('openid_weixin_weixin')->upload_file($img, 'image'); if (!$result) { return AWS_APP::lang()->_t('远程服务器忙'); } if ($result['errmsg']) { return $result['errmsg']; } $this->mpnews['articles'][] = array('thumb_media_id' => $result['media_id'], 'author' => $user_info['user_name'], 'title' => $question_info['question_content'], 'content_source_url' => get_js_url('/m/question/' . $question_info['question_id']), 'content' => nl2br(FORMAT::parse_bbcode($question_info['question_detail'])), 'show_cover_pic' => '0'); $this->to_save_questions[$question_info['question_id']] = array('id' => $question_info['question_id'], 'title' => $question_info['question_content']); } }
public function index_action() { if (is_mobile()) { HTTP::redirect('/m/topic/' . $_GET['id']); } 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) { header('HTTP/1.1 404 Not Found'); 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'])); 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(); $page_keywords[] = $topic_info['topic_title']; 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']; $page_keywords[] = $val['topic_title']; } } TPL::set_meta('keywords', implode(',', $page_keywords)); TPL::set_meta('description', cjk_substr(str_replace("\r\n", ' ', strip_tags($topic_info['topic_description'])), 0, 128, 'UTF-8', '...')); 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); } } $contents_related_topic_ids = array_merge($related_topics_ids, explode(',', $contents_topic_id)); TPL::assign('contents_related_topic_ids', implode(',', $contents_related_topic_ids)); if ($posts_list = $this->model('posts')->get_posts_list(null, 1, get_setting('contents_per_page'), 'new', $contents_related_topic_ids)) { foreach ($posts_list as $key => $val) { if ($val['answer_count']) { $posts_list[$key]['answer_users'] = $this->model('question')->get_answer_users_by_question_id($val['question_id'], 2, $val['published_uid']); } } } TPL::assign('posts_list', $posts_list); TPL::assign('all_list_bit', TPL::output('explore/ajax/list', false)); if ($posts_list = $this->model('posts')->get_posts_list(null, 1, get_setting('contents_per_page'), null, $contents_related_topic_ids, null, null, 30, true)) { foreach ($posts_list as $key => $val) { if ($val['answer_count']) { $posts_list[$key]['answer_users'] = $this->model('question')->get_answer_users_by_question_id($val['question_id'], 2, $val['published_uid']); } } } TPL::assign('topic_recommend_list', $posts_list); TPL::assign('posts_list', $posts_list); TPL::assign('recommend_list_bit', TPL::output('explore/ajax/list', false)); TPL::assign('list', $this->model('topic')->get_topic_best_answer_action_list($contents_topic_id, $this->user_id, get_setting('contents_per_page'))); TPL::assign('best_questions_list_bit', TPL::output('home/ajax/index_actions', false)); TPL::assign('posts_list', $this->model('posts')->get_posts_list('question', 1, get_setting('contents_per_page'), 'new', explode(',', $contents_topic_id))); TPL::assign('all_questions_list_bit', TPL::output('explore/ajax/list', false)); TPL::assign('posts_list', $this->model('posts')->get_posts_list('article', 1, get_setting('contents_per_page'), 'new', explode(',', $contents_topic_id))); TPL::assign('articles_list_bit', TPL::output('explore/ajax/list', false)); TPL::assign('contents_topic_id', $contents_topic_id); TPL::assign('contents_topic_title', $contents_topic_title); TPL::assign('log_list', $log_list); TPL::assign('redirect_message', $redirect_message); if ($topic_info['parent_id']) { TPL::assign('parent_topic_info', $this->model('topic')->get_topic_by_id($topic_info['parent_id'])); } TPL::output('topic/index'); break; } }