public function format_js_question_output($data) { if ($data) { foreach ($data as $key => $val) { if ($val['title']) { $val['question_content'] = $val['title']; } $output .= '<div class="q_mainElem i_prl"><span class="q_reply"><em>' . $val['answer_count'] . '</em>回复</span>'; if ($val['answer_count'] > 0) { $output .= '<a class="q_user i_alpHover" href="' . get_js_url('/people/' . $val['answer_info']['user_info']['url_token']) . '"><img src="' . get_avatar_url($val['answer_info']['user_info']['uid'], 'mid') . '" class="user_msg" /></a>'; } else { $output .= '<a class="q_user i_alpHover" href="' . get_js_url('/people/' . $val['user_info']['url_token']) . '"><img src="' . get_avatar_url($val['user_info']['uid'], 'mid') . '" class="user_msg" /></a>'; } $output .= '<h4><a href="' . get_js_url('/question/' . $val['question_id']) . '">' . $val['question_content'] . '</a></h4><p class="q_elems">'; if ($val['category_info']['title']) { $output .= '<span class="q_banner i_line"><em class="q_ex i_line i_gray"><a href="' . get_js_url('home/explore/category-' . $val['category_info']['url_token']) . '">' . $val['category_info']['title'] . '</a></em></span> • '; } if ($val['answer_count'] > 0) { $output .= '<a class="user_msg" href="' . get_js_url('/people/' . $val['answer_info']['user_info']['url_token']) . '">' . $val['answer_info']['user_info']['user_name'] . '</a> 回复了问题'; } else { $output .= '<a class="user_msg" href="' . get_js_url('/people/' . $val['user_info']['url_token']) . '">' . $val['user_info']['user_name'] . '</a> 发起了问题'; } $output .= ' • ' . date_friendly($val['update_time']) . ' • ' . $val['focus_count'] . ' 人关注 • ' . $val['view_count'] . ' 次浏览</p></div>'; } } return "document.write('" . addcslashes($output, "'") . "');"; }
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 get_all_answer_by_uid($uid) { //if ($uids = $this->query_all('SELECT DISTINCT uid FROM ' . $this->get_table('question_focus') . ' WHERE question_id = ' . intval($question_id) . ' ORDER BY focus_id DESC', null)) $question_answer = $this->query_all("SELECT * FROM " . $this->get_table('answer') . " WHERE uid = " . intval($uid) . ' ORDER BY add_time DESC'); $user_info = $this->model('test')->get_user_info_by_uid(intval($uid), true); foreach ($question_answer as $key => $val) { $question_answer[$key]['question_info'] = $this->fetch_row('question', 'question_id = ' . $val['question_id']); $question_answer[$key]['add_time'] = date_friendly($val['add_time'], 604800, 'Y-m-d'); $question_answer[$key]['user_info'] = $user_info; } return $question_answer; }
?> <tr> <td><?php echo htmlspecialchars($row->code); ?> </td> <td><?php echo htmlspecialchars(date_friendly($row->dt_created)); ?> </td> <td> <?php if ($row->dt_accepted == NULL) { echo '<span style="color: red; font-weight: bold">Not yet</span>'; } else { echo '<span style="color: green; font-weight: bold">' . htmlspecialchars(date_friendly($row->dt_accepted)) . '</span>'; } ?> </td> </tr> <?php } ?> </table> <?php $r->close(); } ?> </p> <?php
/** * 获得通知列表 * read_status 0 - 未读, 1 - 已读, other - 所有 */ public function list_notification_2($recipient_uid, $read_status = 0, $limit = null) { if (!($notify_ids = $this->get_notification_list_2($recipient_uid, $read_status, $limit))) { return false; } if (!($notify_list = $this->get_notification_by_ids($notify_ids))) { return false; } foreach ($notify_list as $key => $val) { if ($val['data']['question_id']) { $question_ids[] = $val['data']['question_id']; } if ($val['data']['article_id']) { $article_ids[] = $val['data']['article_id']; } if ($val['data']['ticket_id']) { $ticket_ids[] = $val['data']['ticket_id']; } if ($val['data']['from_uid']) { $uids[] = intval($val['data']['from_uid']); } } if ($question_ids) { $question_list = $this->model('question')->get_question_info_by_ids($question_ids); } if ($article_ids) { $article_list = $this->model('article')->get_article_info_by_ids($article_ids); } if ($ticket_ids) { $ticket_list = $this->model('ticket')->get_tickets_list($ticket_ids); } if ($uids) { $user_infos = $this->model('account')->get_user_info_by_uids($uids); } foreach ($notify_list as $key => $notify) { if (!($data = $notify['data'])) { continue; } $tmp_data = array(); $tmp_data['notification_id'] = $notify['notification_id']; $tmp_data['model_type'] = $notify['model_type']; $tmp_data['action_type'] = $notify['action_type']; $tmp_data['read_flag'] = $notify['read_flag']; $tmp_data['add_time'] = $notify['add_time']; $tmp_data['add_time'] = date_friendly($tmp_data['add_time'], 604800, 'Y-m-d'); $tmp_data['anonymous'] = $data['anonymous']; if ($data['from_uid']) { $user_info = $user_infos[$data['from_uid']]; $tmp_data['p_user_name'] = $user_info['user_name']; $tmp_data['p_user_id'] = $user_info['uid']; $tmp_data['p_user_info'] = $user_info; } if ($data['question_id']) { $question_info = $question_list[$data['question_id']]; $tmp_data['question_id'] = $question_info['question_id']; $tmp_data['question_content'] = $question_info['question_content']; $tmp_data['question_info'] = $question_info; } if ($data['item_id']) { $tmp_data['answer_id'] = $data['item_id']; $answer_data = $this->fetch_row('answer', 'answer_id = ' . $tmp_data['answer_id']); if ($answer_data) { $tmp_data['answer_content'] = $answer_data['answer_content']; } } $token = 'notification_id=' . $notify['notification_id']; switch ($notify['model_type']) { case self::CATEGORY_ARTICLE: if ($notify['action_type'] == self::TYPE_ARTICLE_REFUSED) { $tmp_data['title'] = $data['title']; } else { if (!$article_list[$data['article_id']]) { continue; } $tmp_data['title'] = $article_list[$data['article_id']]['title']; } $querys = array(); $querys[] = $token; if ($data['item_id']) { $querys[] = 'item_id=' . $data['item_id']; } $tmp_data['key_url'] = get_js_url('/article/' . $data['article_id'] . '?' . implode('&', $querys)); break; case self::CATEGORY_QUESTION: switch ($notify['action_type']) { default: if ($notify['action_type'] == self::TYPE_QUESTION_REFUSED) { $tmp_data['title'] = $data['title']; } else { if (!$question_list[$data['question_id']]) { continue; } $tmp_data['title'] = $question_list[$data['question_id']]['question_content']; } $rf = false; $querys = array(); $querys[] = $token; if ($notify['extends']) { } else { switch ($notify['action_type']) { case self::TYPE_REDIRECT_QUESTION: case self::TYPE_QUESTION_REFUSED: break; case self::TYPE_MOD_QUESTION: $querys[] = 'column=log'; break; case self::TYPE_INVITE_QUESTION: $querys[] = 'source=' . base64_encode($data['from_uid']); break; case self::TYPE_QUESTION_COMMENT: case self::TYPE_COMMENT_AT_ME: $querys[] = 'comment_unfold=question'; break; default: $querys[] = 'rf=false'; break; } if ($data['item_id']) { $querys[] = 'item_id=' . $data['item_id'] . '&answer_id=' . $data['item_id'] . '&single=TRUE#!answer_' . $data['item_id']; } } $tmp_data['key_url'] = get_js_url('/question/' . $data['question_id'] . '?' . implode('&', $querys)); break; } break; case self::CATEGORY_PEOPLE: if (!$user_info) { unset($tmp_data); continue; } $tmp_data['key_url'] = $tmp_data['p_url'] . '?' . $token; break; case self::CATEGORY_CONTEXT: $tmp_data['content'] = $data['content']; break; case self::CATEGORY_TICKET: $querys[] = $token; $tmp_data['title'] = $ticket_list[$data['ticket_id']]['title']; if ($data['reply_id']) { $querys[] = 'reply_id=' . $data['reply_id']; } $tmp_data['key_url'] = get_js_url('/ticket/' . $data['ticket_id'] . '?' . implode('&', $querys)); break; } if ($tmp_data) { $list[] = $tmp_data; } else { $this->delete_notify('notification_id = ' . intval($notify['notification_id'])); } } return $this->format_notification_2($list); }
"><?php if ($ginfo["admin"] == 1) { echo "Manage"; } else { echo "Details"; } ?> </a>)</h3> <table class="nodes"> <tr> <th>Created</th> <th>Members</th> </tr> <tr> <td><?php echo date_friendly($ginfo["dt_created"]); ?> </td> <td> <?php if ($gid != 1) { $q = "SELECT group_admin, username FROM group_members LEFT JOIN users ON user_id=users.id WHERE group_id='" . $m->escape_string($gid) . "' ORDER BY username"; if (($r = $m->query($q)) !== FALSE) { if ($r->num_rows == 0) { echo 'This group has no members.</p>'; } $i = 0; while ($row = $r->fetch_object()) { if ($i++ != 0) { echo ", "; }
<th><i class="icon-time"></i> 备份时间</th> <th>文件大小</th> <th>操作</th> </tr> </thead> <tbody> <?php foreach ($files as $row) { ?> <tr> <td><?php echo $row['name']; ?> </td> <td><?php echo date_friendly($row['date']); ?> </td> <td><?php echo round($row['size'] / (1024 * 1024), 2) > 0 ? round($row['size'] / (1024 * 1024), 2) : '< 0.01'; ?> M</td> <td> <div class="action-buttons"> <a href="<?php echo ADMINURL; ?> db_backup/<?php echo $row['name']; ?> " target="_blank"><i class="icon-cloud-download bigger-130 green"></i></a>
<div class="dialogs"> <?php $postObj = simplexml_load_string($item['poststr'], 'SimpleXMLElement', LIBXML_NOCDATA); ?> <div class="itemdiv dialogdiv"> <div class="user"> <img src="<?php echo $item['headimgurl'] ? $item['headimgurl'] : 'images/default.png'; ?> " /> </div> <div class="body"> <div class="time"> <i class="icon-time"></i> <span class="green"><?php echo date_friendly($item['datetime']); ?> </span> </div> <div class="name"> <a><?php echo $item['nickname'] ? $item['nickname'] : $item['openid']; ?> </a> </div> <div class="text"><?php echo $postObj->Content; ?> </div> </div> </div>
<th>Status</th> <th>Created</th> <th>Total nodes</th> </tr> <tr> <td> <?php if (($_SESSION["u"]->user_flags & USER_FLAG_PREMIUM) == USER_FLAG_PREMIUM) { echo "Premium account"; } else { echo "Standard account, limits enforced"; } ?> </td> <td><?php echo htmlspecialchars(date_friendly($_SESSION["u"]->dt_created)); ?> </td> <td> <?php $q = "SELECT COUNT(*) AS num FROM nodes WHERE user_id='" . $m->escape_string($_SESSION["u"]->id) . "'"; if (($r = @$m->query($q)) !== FALSE && ($row = $r->fetch_object()) != NULL) { echo $row->num; } else { echo htmlspecialchars("<an error occured>"); } ?> </td> </tr> </table>
<td><?php echo htmlspecialchars($row->jobname); ?> </td> </tr> <tr> <th>Last seen</th> <td><?php echo htmlspecialchars(date_friendly($row->dt_lastactive)); ?> </td> </tr> <tr> <th>First seen</th> <td><?php echo htmlspecialchars(date_friendly($row->dt_created)); ?> </td> </tr> <!-- <tr> <th>Ciphers</th> <td><?php echo htmlspecialchars(str_replace(",", ", ", $row->ciphers)); ?> </td> </tr> --> <tr> <th>Time spent</th> <td><?php
<?php if ($row['reply']) { foreach ($row['reply'] as $v) { ?> <div class="itemdiv dialogdiv reply"> <div class="user"> <img src="images/admin.png" /> </div> <div class="body"> <!--<div class="time"> <i class="icon-time"></i> <span class="blue"></span> </div>--> <div class="name"> <a>客服</a> - <?php echo date_friendly($v['datetime']); ?> </div> <div class="text"><?php echo $v['message']; ?> </div> </div> </div> <?php } } } ?> </div>
} if ($row->jobname == NULL) { $row->jobname = "<nothing yet>"; } ?> <tr> <td><?php echo htmlspecialchars($row->nodename); ?> </td> <td><?php echo htmlspecialchars(cpu_short($row->cpuinfo)); ?> </td> <td><?php echo htmlspecialchars(date_friendly($row->completed)); ?> </td> <td><?php echo $row->num_packets; ?> </td> </tr> <?php } ?> </table> <?php } else { ?> <div class="note">
<th>Last worked on</th> <th>Groups</th> </tr> <tr> <td><?php echo htmlspecialchars($job->hashtype); ?> </td> <td><?php echo $job->summary_numhashes; ?> </td> <td><?php echo $job->summary_numcracked; ?> </td> <td><?php echo date_friendly($job->dt_lastactive); ?> </td> <td> <?php ?> </td> </tr> </table> <hr /> --> <?php }
public function user_actions_action() { if (isset($_GET['perpage']) and intval($_GET['perpage']) > 0) { $this->per_page = intval($_GET['perpage']); } //echo json_encode ( $array = array ("value" => $_GET['actions'] ) ); $data = $this->model('test')->get_user_actions($_GET['uid'], intval($_GET['page']) * $this->per_page . ", {$this->per_page}", $_GET['actions'], $_GET['current_uid']); foreach ($data as $key => $val) { $data[$key]['add_time'] = date_friendly($val['add_time'], 604800, 'Y-m-d'); $data[$key]['last_action_str'] = strip_tags($data[$key]['last_action_str']); // $data [$key] ['last_action_str'] = $data [$key] ['last_action_str'] . $data [$key] ['add_time']; // $data [$key] ['title'] = strip_tags($data [$key] ['title']); } echo json_encode($array = array("value" => $data)); /*TPL::assign('list', $data); if (is_mobile()) { $template_dir = 'm'; } else { $template_dir = 'people'; } if ($_GET['actions'] == '201') { //TPL::output($template_dir . '/ajax/user_actions_questions_201'); } else if ($_GET['actions'] == '101') { //TPL::output($template_dir . '/ajax/user_actions_questions_101'); } else { TPL::output($template_dir . '/ajax/user_actions'); }*/ }