function draw() { global $display; $this->beginForm(); $display->add('url_admin', Url::build_current()); $display->add('msg', $this->showFormErrorMessages(1)); if ($this->contact['name']) { $email = stripslashes($this->contact['name']) . " "; } if ($this->contact['address']) { $email .= "( " . stripslashes($this->contact['address']) . ") "; } $email .= '<a href="mailto:' . $this->contact['email'] . '"><font color=blue>' . $this->contact['email'] . "</font></a>"; $display->add('email', $email); $display->add('date', date('H:i:s d/m/Y', $this->contact['time'])); $display->add('date2', AZLib::duration_time($this->contact['time'])); $display->add('content', stripslashes($this->contact['content'])); $display->add('reply_content', stripslashes(Url::get('reply_content'))); $display->add('subject', stripslashes(Url::get('subject'))); if ($this->contact['reply_content']) { $display->add('replied_content', stripslashes($this->contact['reply_content'])); } else { $display->add('replied_content', "Chưa có"); } $display->output('FeedbackReply'); $this->endForm(); }
function draw() { global $display; $keyword = Url::get('keyword'); $display->add('keyword', $keyword); $display->add('export_link', Url::build_current(array('cmd' => 'export'))); $where = '1'; if ($keyword != '') { $where .= ' AND email LIKE "%' . $keyword . '%"'; } $total_item = DB::count('news_letter_email', $where); $limit = ''; $item_per_page = 40; $page_no = (int) Url::get('page_no'); $pagging = AZPagging::paging_list($limit, $total_item, $item_per_page, 10); $re = DB::query('SELECT * FROM news_letter_email WHERE ' . $where . ' ORDER BY id ' . $limit); $news_letter_emails = array(); $i = 0; if ($page_no <= 0) { $page_no = 1; } if ($re) { while ($item = mysql_fetch_assoc($re)) { $item['time_add'] = date('H:i', $item['time_add']) . ' ngày ' . date('d/m/Y', $item['time_add']) . '<br />Cách đây ' . AZLib::duration_time($item['time_add']); $item['delete'] = AZLib::buttonDel(Url::build_current(array('cmd' => 'delete', 'id' => $item['id'])), 'style/images/admin/delete.gif', 'Loại bỏ Email này khỏi danh sách!'); $i++; $item['i'] = $i + ($page_no - 1) * $item_per_page; $news_letter_emails[$item['id']] = $item; } } $display->add('pagging', $pagging); $display->add('news_letter_emails', $news_letter_emails); $display->add('count', $total_item); $this->beginForm(); $display->output("NewsLetterAdmin"); $this->endForm(); }
function get_feed_notify_bar() { AZLib::getCats(); $json = ""; if (!User::is_login()) { $json = '({"msg":"no_login"})'; echo $json; exit; } $item_comment_ids = ""; //Id các phản hồi giao dịch $user_comment_ids = ""; //Id các lưu bút $entry_comment_ids = ""; //Id các bài viết /*$follow_ids = "";//Id các theo đuôi*/ $blast_user_ids = ""; // Id các balst $arr_data = array(); $user = User::getUser(User::id()); if ($user["total_pm"]) { // neu co PM moi $arr_data = array("new_pm" => $user["total_pm"]); } $where = "WHERE user_id = " . User::id(); $limit = " LIMIT 20"; $sql = "SELECT * FROM feed {$where} ORDER BY time DESC {$limit}"; $re = DB::query($sql); if ($re) { while ($feed = mysql_fetch_assoc($re)) { if ($feed['type'] == 1 || $feed['type'] == 2) { // phan hoi $item_comment_ids .= ($item_comment_ids != '' ? ',' : '') . $feed['ref_id']; } elseif ($feed['type'] == 3) { // luu but $user_comment_ids .= ($user_comment_ids != '' ? ',' : '') . $feed['ref_id']; } elseif ($feed['type'] == 5 || $feed['type'] == 6) { // bai viet $entry_comment_ids .= ($entry_comment_ids != '' ? ',' : '') . $feed['ref_id']; } /*elseif($feed['type']==7){// theo duoi $follow_ids.=($follow_ids!=''?',':'').$feed['ref_id']; }*/ } } //Phản hồi giao dịch $item_comment_arr = array(); if ($item_comment_ids != '') { $item_ids = ""; $re = DB::query("SELECT time, item_id, parent_id, COUNT(item_id) AS total_comment FROM comment WHERE id IN({$item_comment_ids}) GROUP BY item_id"); if ($re) { while ($comment = mysql_fetch_assoc($re)) { $item_ids .= ($item_ids != '' ? ',' : '') . $comment['item_id']; $comment['time'] = AZLib::duration_time($comment['time']); $item_comment_arr[$comment['item_id']] = $comment; } if ($item_comment_arr && $item_ids) { // Query de lay ID va Tieu de tin $re = DB::query("SELECT id, name, level_1_catid FROM item WHERE id IN({$item_ids})"); while ($item = mysql_fetch_assoc($re)) { if ($item["id"] == $item_comment_arr[$item["id"]]["item_id"]) { $item_comment_arr[$item["id"]]["item_name"] = AZLib::word_limit($item["name"], 7, '...'); $ebname = AZLib::safe_title($item['name']); if (isset(CGlobal::$allCategories[$item['level_1_catid']])) { $cat_name = CGlobal::$allCategories[$item['level_1_catid']]['name']; $item_comment_arr[$item["id"]]["url_link"] = WEB_DIR . AZLib::safe_title($cat_name) . "/p{$item['id']}/{$ebname}.html"; } else { $item_comment_arr[$item["id"]]["url_link"] = WEB_DIR . "/p{$item['id']}/{$ebname}.html"; } } } } } if ($item_comment_arr) { $item_comment_arrs["comment"] = $item_comment_arr; $arr_data += $item_comment_arrs; } } // End Phan hoi giao dich //Luu but $total_comment_arr = array(); if ($user_comment_ids != '') { $re = DB::query("SELECT time, COUNT(id) AS total_comment_user FROM comment_user WHERE id IN({$user_comment_ids}) GROUP BY receiver_user_id ORDER BY time DESC"); if ($re) { $comment_user = mysql_fetch_assoc($re); $total_comment_arr["total"] = $comment_user["total_comment_user"]; $total_comment_arr['time'] = AZLib::duration_time($comment_user['time']); $total_comment_arr["url_link"] = WEB_DIR . 'Shop/' . User::user_name() . '/Luu-but'; } if ($total_comment_arr) { $total_comment_arrs["comment_user"] = $total_comment_arr; $arr_data += $total_comment_arrs; } } //End Luu but // Theo duoi /*$follow_arr = array(); if($follow_ids!=''){ $re = DB::query("SELECT id, follower_name, time FROM follow WHERE id IN($follow_ids) ORDER BY time DESC"); if($re){ while ($follow = mysql_fetch_assoc($re)){ $follow['time'] = AZLib::duration_time($follow['time']); $follow["url_link"] = WEB_DIR.$follow['follower_name']; $follow_arr[$follow['id']] = $follow; } } if($follow_arr){ $follow_arrs["follow"] = $follow_arr; $arr_data += $follow_arrs; } }*/ // end Theo duoi // Phản hồi bài viết $entry_comment_arr = array(); if ($entry_comment_ids != '') { $entry_ids = ""; $re = DB::query("SELECT time, entry_id, parent_id FROM user_entry_comment WHERE id IN({$entry_comment_ids})"); if ($re) { while ($comment_entry = mysql_fetch_assoc($re)) { $entry_ids .= ($entry_ids != '' ? ',' : '') . $comment_entry['entry_id']; $comment_entry['time'] = AZLib::duration_time($comment_entry['time']); $comment_entry['total_comment_entry'] = count(explode(',', $entry_comment_ids)); $entry_comment_arr[$comment_entry['entry_id']] = $comment_entry; } if ($entry_comment_arr && $entry_ids) { // Query de lay ID va Tieu de bai viet $re = DB::query("SELECT id, title FROM user_entry WHERE id IN({$entry_ids})"); while ($entry = mysql_fetch_assoc($re)) { if ($entry["id"] == $entry_comment_arr[$entry["id"]]["entry_id"]) { $entry_comment_arr[$entry["id"]]["title"] = AZLib::word_limit($entry["title"], 7, '...'); $ebname = AZLib::safe_title($entry['title']); $entry_comment_arr[$entry["id"]]["url_link"] = WEB_DIR . "Bai-viet/" . User::user_name() . "/e{$entry['id']}/{$ebname}"; } } } } if ($entry_comment_arr) { $item_comment_arrs["entry"] = $entry_comment_arr; $arr_data += $item_comment_arrs; } } // End Phan hoi bài viết $json = json_encode($arr_data); echo $json; exit; }
function show_user_comment_line() { $c_user_id = (int) Url::get('c_user_id'); $c_u_id = (int) Url::get('u_id'); $group_id = (int) Url::get('group_id'); $json = ""; if (!User::is_login()) { $json = '({"msg":"no_login"})'; echo $json; exit; } if (User::is_block()) { $json = '({"msg":"no_perm"})'; echo $json; exit; } if ($c_user_id && $c_u_id) { $json = '({"msg":"success"'; $all_user_comments = array(); $all_users = array(); $user = User::getUser($c_u_id); if ($user) { $re = DB::query("SELECT * FROM (\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT id, time, content, sender_user_id, sender_user_name FROM comment_user WHERE sender_user_id=" . User::id() . " AND receiver_user_id={$c_u_id} AND id<{$c_user_id} ORDER BY id DESC LIMIT 20)\r\n\t\t\t\t\t\t\t\t\t\t\t\tUNION \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT id, time, content, sender_user_id, sender_user_name FROM comment_user WHERE sender_user_id={$c_u_id} AND receiver_user_id=" . User::id() . " AND id<{$c_user_id} ORDER BY id DESC LIMIT 20)\r\n\t\t\t\t\t\t\t\t\t\t\t\t) AS u_comment\r\n\t\t\t\t\t\t\t\t\t\t\t\tORDER BY id ASC LIMIT 20"); $uids = ''; if ($re) { while ($u_comment = mysql_fetch_assoc($re)) { $u_comment['time'] = AZLib::duration_time($u_comment['time']); $uids .= ($uids ? ',' : '') . $u_comment['sender_user_id']; $all_user_comments[] = $u_comment; } } if ($uids != '') { $re = DB::query("SELECT id, avatar_url, img_server FROM user WHERE id IN({$uids})"); if ($re) { while ($u_user = mysql_fetch_assoc($re)) { //$all_users[$u_user['id']]=$u_user['avatar_url']; $all_users[$u_user['id']] = $u_user; } } } if ($all_user_comments) { $json .= ',"c_user_line":"' . addslashes('<div style="padding:8px 6px;background-color:#ECEFF6;margin-bottom:2px;border-bottom:1px solid #ccc;font-size:11px">mạnh lưu bút với <a href="' . $user['user_name'] . '" target="_blank"><font color="#3C5899"><b>' . $user['user_name'] . '</b></font></a> - <span onclick="c_user_back(' . $group_id . ');" class="o_action">thu gọn</span></div>'); foreach ($all_user_comments as $u_comment) { if (isset($all_users[$u_comment['sender_user_id']]['avatar_url']) && $all_users[$u_comment['sender_user_id']] && $all_users[$u_comment['sender_user_id']]['avatar_url']) { $u_comment['avatar_url'] = 'http://' . CGlobal::$img_server[$all_users[$u_comment['sender_user_id']]['img_server']] . 'thumb_wl/50/' . $all_users[$u_comment['sender_user_id']]['avatar_url']; } else { $u_comment['avatar_url'] = 'style/images/54x54.gif'; } $json .= addslashes(str_replace(array(chr(13), chr(10)), ' ', ' <div class="o_sub_item"> <div class="o_f_content"> <img src="' . $u_comment['avatar_url'] . '" width="25" height="25" border="0" align="left" style="margin:0 6px 6px 0"/> <a href="' . WEB_DIR . $u_comment['sender_user_name'] . '" target="_blank"> ' . $u_comment['sender_user_name'] . ' </a> viết <span class="o_time">' . $u_comment['time'] . '</span><br /> ' . AZLib::parseBBCode($u_comment['content']) . ' </div> <div style="clear:left"><span></span></div> </div>')); } $json .= '"})'; } else { $json .= ',"c_user_line":""})'; } echo $json; exit; } } $json = "({'msg':'no_perm'})"; echo $json; exit; }
function show_all_notify() { global $display; AZLib::getCats(); $feed_follows = array(); //hoạt động của các thành viên mà mình theo đuôi $follow_ids = ''; //hoạt động của các thành viên mà mình theo đuôi $action = Url::get('action'); $num_per_page = 20; $ajax_mod = (int) (Url::get('act') == 'shop_giaodich'); $page_no = 1; $cur_group = 0; $all_feeds = array(); //Lưu mảng tất cả các cập nhật $all_feed_ars = array(); //mảng các cập nhật đã đc sắp xếp, xử lý $user_arr = array(); //Mảng các user $item_arr = array(); //Mảng các Giao dịch $entry_arr = array(); //Mảng các Bài viết $item_ids_ar = array(); //Mảng id các Giao dịch $user_ids_ar = array(); //Mảng id các user $entry_ids_ar = array(); //Mảng id các Bài viết $item_comment_ids = ""; //Id các phản hồi giao dịch $item_comment_arr = array(); //các phản hồi giao dịch $user_comment_ids = ""; //Id các lưu bút $user_comment_arr = array(); //các lưu bút $pm_ids = ""; //Id các tin nhắn $pm_arr = array(); //các tin nhắn $entry_comment_ids = ""; //Id các bài viết $entry_comment_arr = array(); //các bài viết $this->show_more = false; //các bài viết $where = "WHERE user_id = " . User::id(); $limit = " LIMIT " . $num_per_page * ($page_no - 1) . "," . ($num_per_page + 1); $where .= " AND type IN(1,2,3,4,5,6)"; $total_unread = 0; $sql = "SELECT * FROM feed {$where} ORDER BY time DESC {$limit}"; $re = DB::query($sql); $stt = 0; if ($re) { while ($feed = mysql_fetch_assoc($re)) { if ($stt < $num_per_page) { if ($feed['type'] == 1 || $feed['type'] == 2) { $item_comment_ids .= ($item_comment_ids != '' ? ',' : '') . $feed['ref_id']; if (!in_array($feed['item_id'], $item_ids_ar)) { $item_ids_ar[$feed['item_id']] = $feed['item_id']; } } elseif ($feed['type'] == 3) { $user_comment_ids .= ($user_comment_ids != '' ? ',' : '') . $feed['ref_id']; } elseif ($feed['type'] == 4) { $pm_ids .= ($pm_ids != '' ? ',' : '') . $feed['ref_id']; } elseif ($feed['type'] == 5 || $feed['type'] == 6) { $entry_comment_ids .= ($entry_comment_ids != '' ? ',' : '') . $feed['ref_id']; if ($feed['item_id']) { $entry_ids_ar[$feed['item_id']] = $feed['item_id']; } } if ($feed['act_user_id'] && !in_array($feed['act_user_id'], $user_ids_ar)) { $user_ids_ar[$feed['act_user_id']] = $feed['act_user_id']; } $all_feeds[$feed['id']] = $feed; $stt++; } else { $this->show_more = true; } } } if ($item_ids_ar) { $item_ids = implode(',', $item_ids_ar); if ($item_ids != '') { $re = DB::query("SELECT id, name ,up_time, status, state, currency_id, category_id, img_server, img_url AS image_url FROM item WHERE id IN({$item_ids})"); if ($re) { while ($item = mysql_fetch_assoc($re)) { if (isset(CGlobal::$allCategories[$item['category_id']])) { $item['link_view'] = Url::build('item_detail', array('id' => $item['id'], 'ebname' => AZLib::safe_title($item['name']), 'nice_name' => CGlobal::$allCategories[$item['category_id']]['nice_name'])); } else { $item['link_view'] = Url::build('item_detail', array('id' => $item['id'], 'ebname' => AZLib::safe_title($item['name']))); } if (!$item['status']) { $total_unread++; } $item_arr[$item['id']] = $item; } } } } if (!empty($entry_ids_ar)) { $entry_ids = implode(',', $entry_ids_ar); if ($entry_ids != '') { $re = DB::query("SELECT id, title, status, user_name, time_modify, image_url FROM user_entry WHERE id IN({$entry_ids})"); if ($re) { while ($entry = mysql_fetch_assoc($re)) { $entry['link_view'] = WEB_DIR . AZRewrite::formatUrl('?page=user_entry&user_name=' . $entry['user_name'] . '&cmd_entry=view&entry_id=' . $entry['id'] . '&ebname=' . AZLib::safe_title($entry['title'])); if (!$entry['status']) { $total_unread++; } $entry_arr[$entry['id']] = $entry; } } } } if ($user_ids_ar) { $user_ids = implode(',', $user_ids_ar); if ($user_ids != '') { $re = DB::query("SELECT id, user_name, blast, avatar_url,img_server FROM user WHERE id IN({$user_ids})"); if ($re) { while ($user = mysql_fetch_assoc($re)) { if ($user['avatar_url']) { $user['avatar_url'] = 'http://' . CGlobal::$img_server[$user['img_server']] . 'thumb/50_50/' . $user['avatar_url']; } else { $user['avatar_url'] = 'style/images/54x54.gif'; } $user_arr[$user['id']] = $user; } } } } //Phản hồi giao dịch if ($item_comment_ids != '') { $re = DB::query("SELECT * FROM comment WHERE id IN({$item_comment_ids})"); if ($re) { while ($comment = mysql_fetch_assoc($re)) { $comment['content'] = AZLib::parseBBCode(stripslashes($comment['content'])); $comment['s_content'] = AZLib::plainText($comment['content']); if (strlen($comment['s_content']) > 20) { $comment['s_content'] = AZLib::word_limit($comment['s_content'], 10, '..'); } $comment['time'] = AZLib::duration_time($comment['time']); if (!$comment['status']) { $total_unread++; } $item_comment_arr[$comment['id']] = $comment; } } } //Lưu bút if ($user_comment_ids != '') { $re = DB::query("SELECT * FROM comment_user WHERE id IN({$user_comment_ids})"); if ($re) { while ($comment = mysql_fetch_assoc($re)) { $comment['content'] = AZLib::parseBBCode(stripslashes($comment['content'])); $comment['s_content'] = AZLib::plainText($comment['content']); if (strlen($comment['s_content']) > 20) { $comment['s_content'] = AZLib::word_limit($comment['s_content'], 10, '..'); } $comment['time'] = AZLib::duration_time($comment['time']); if (!$comment['status']) { $total_unread++; } $user_comment_arr[$comment['id']] = $comment; } } } if ($pm_ids != '' && $pm_ids != 0) { //Tin nhắn $re = DB::query("SELECT mt.*, msg.msg_post as content FROM (SELECT mt_id AS id, mt_msg_id, mt_title, mt_ref_id , mt_from_id AS sender_user_id, mt_date AS time, mt_read AS status FROM message_topics WHERE mt_id IN({$pm_ids})) AS mt LEFT JOIN message_text AS msg ON mt.mt_msg_id = msg.msg_id"); if ($re) { while ($comment = mysql_fetch_assoc($re)) { $comment['content'] = AZLib::parseBBCode(stripslashes($comment['content'])); $comment['s_content'] = AZLib::plainText($comment['content']); if (strlen($comment['s_content']) > 20) { $comment['s_content'] = AZLib::word_limit($comment['s_content'], 10, '..'); } $comment['time'] = AZLib::duration_time($comment['time']); if (!$comment['status']) { $total_unread++; } $pm_arr[$comment['id']] = $comment; } } } if ($entry_comment_ids != '') { //Phản hồi bài viết $re = DB::query("SELECT id, entry_id, content, time, sender_user_id, sender_user_name, sender_email, status FROM user_entry_comment WHERE id IN({$entry_comment_ids})"); if ($re) { while ($comment = mysql_fetch_assoc($re)) { $comment['content'] = AZLib::parseBBCode(stripslashes($comment['content'])); $comment['s_content'] = AZLib::plainText($comment['content']); if (strlen($comment['s_content']) > 20) { $comment['s_content'] = AZLib::word_limit($comment['s_content'], 10, '..'); } $comment['time'] = AZLib::duration_time($comment['time']); if (!$comment['status']) { $total_unread++; } $entry_comment_arr[$comment['id']] = $comment; } } } $item_ids_ar = array(); //Mảng item_id cập nhật bỏ qua cho các feed chủ thể tương ứng khi giao dịch bị xoá hoặc khoá! $item_ids_ar2 = array(); //Mảng item_id cập nhật bỏ qua cho các feed khách thể tương ứng khi giao dịch bị xoá hoặc khoá! $entry_ids_ar = array(); $entry_ids_ar2 = array(); $c_user_ids_ar = array(); $pm_ids_ar = array(); $unread_feed_ids = ''; $del_feed_ids = ''; if ($all_feeds) { foreach ($all_feeds as $feed) { if ($feed['type'] == 4) { //Tin nhắn if (isset($user_arr[$feed['act_user_id']])) { $feed['sender_user_name'] = $user_arr[$feed['act_user_id']]['user_name']; } else { $feed['sender_user_name'] = ''; } } if ($feed['type'] == 1 || $feed['type'] == 2) { //Phản hồi giao dịch hoặc Trả lời phản hồi giao dịch if (isset($item_comment_arr[$feed['ref_id']])) { $feed['item_id'] = $item_comment_arr[$feed['ref_id']]['item_id']; $feed['content'] = $item_comment_arr[$feed['ref_id']]['content']; $feed['s_content'] = $item_comment_arr[$feed['ref_id']]['s_content']; $feed['time'] = $item_comment_arr[$feed['ref_id']]['time']; $feed['sender_user_id'] = $item_comment_arr[$feed['ref_id']]['sender_user_id']; $feed['sender_user_name'] = $item_comment_arr[$feed['ref_id']]['sender_user_name']; $feed['sender_email'] = $item_comment_arr[$feed['ref_id']]['sender_email']; $status = $feed['status']; if ($feed['type'] == 1) { $feed['status'] = $item_comment_arr[$feed['ref_id']]['status']; } else { $feed['status'] = $item_comment_arr[$feed['ref_id']]['replied_status']; } if ($feed['status'] == 0 || $status == 0) { $unread_feed_ids .= ($unread_feed_ids != '' ? ',' : '') . $feed['id']; if ($feed['type'] == 1 && $feed['status'] == 0) { //Mảng item_id cập nhật bỏ qua cho các feed chủ thể tương ứng khi giao dịch bị xoá hoặc khoá! $item_ids_ar[$feed['item_id']] = $feed['item_id']; } elseif ($feed['type'] == 2 && $feed['status'] == 0) { //Mảng item_id cập nhật bỏ qua cho các feed khách thể tương ứng khi giao dịch bị xoá hoặc khoá! $item_ids_ar2[$feed['item_id']] = $feed['item_id']; } } if (isset($item_arr[$feed['item_id']]) && $item_arr[$feed['item_id']]['state'] == 0 && $item_arr[$feed['item_id']]['status'] != -1) { $feed['item'] = $item_arr[$feed['item_id']]; $all_feed_ars[$feed['id']] = $feed; } else { $del_feed_ids .= ($del_feed_ids != '' ? ',' : '') . $feed['id']; } } else { $del_feed_ids .= ($del_feed_ids != '' ? ',' : '') . $feed['id']; } } elseif ($feed['type'] == 3) { //Lưu bút if (isset($user_comment_arr[$feed['ref_id']])) { $feed['content'] = $user_comment_arr[$feed['ref_id']]['content']; $feed['s_content'] = $user_comment_arr[$feed['ref_id']]['s_content']; $feed['time'] = $user_comment_arr[$feed['ref_id']]['time']; $feed['sender_user_id'] = $user_comment_arr[$feed['ref_id']]['sender_user_id']; $feed['sender_user_name'] = $user_comment_arr[$feed['ref_id']]['sender_user_name']; $status = $feed['status']; $feed['status'] = $user_comment_arr[$feed['ref_id']]['status']; if ($feed['status'] == 0 || $status == 0) { $unread_feed_ids .= ($unread_feed_ids != '' ? ',' : '') . $feed['id']; if ($feed['status'] == 0) { // $c_user_ids_ar[$feed['ref_id']] = $feed['ref_id']; } } $all_feed_ars[$feed['id']] = $feed; } else { $del_feed_ids .= ($del_feed_ids != '' ? ',' : '') . $feed['id']; } } elseif ($feed['type'] == 4) { //Tin nhắn if (isset($pm_arr[$feed['ref_id']])) { $feed['content'] = $pm_arr[$feed['ref_id']]['content']; $feed['s_content'] = $pm_arr[$feed['ref_id']]['s_content']; $feed['time'] = $pm_arr[$feed['ref_id']]['time']; $feed['sender_user_id'] = $pm_arr[$feed['ref_id']]['sender_user_id']; $feed['mt_title'] = $pm_arr[$feed['ref_id']]['mt_title']; $id = $pm_arr[$feed['ref_id']]['mt_ref_id'] ? $pm_arr[$feed['ref_id']]['mt_ref_id'] : $pm_arr[$feed['ref_id']]['id']; $feed['mt_title_link'] = "message.html#inbox/{$id}"; $status = $feed['status']; $feed['status'] = $pm_arr[$feed['ref_id']]['status']; if ($feed['status'] == 0 || $status == 0) { $unread_feed_ids .= ($unread_feed_ids != '' ? ',' : '') . $feed['id']; if ($feed['status'] == 0) { // $pm_ids_ar[$feed['ref_id']] = $feed['ref_id']; } } $all_feed_ars[$feed['id']] = $feed; } else { $del_feed_ids .= ($del_feed_ids != '' ? ',' : '') . $feed['id']; } } elseif ($feed['type'] == 5 || $feed['type'] == 6) { //Phản hồi Bài viết if (isset($entry_comment_arr[$feed['ref_id']])) { $feed['entry_id'] = $entry_comment_arr[$feed['ref_id']]['entry_id']; $feed['content'] = $entry_comment_arr[$feed['ref_id']]['content']; $feed['s_content'] = $entry_comment_arr[$feed['ref_id']]['s_content']; $feed['time'] = $entry_comment_arr[$feed['ref_id']]['time']; $feed['sender_user_id'] = $entry_comment_arr[$feed['ref_id']]['sender_user_id']; $feed['sender_user_name'] = $entry_comment_arr[$feed['ref_id']]['sender_user_name']; $feed['sender_email'] = $entry_comment_arr[$feed['ref_id']]['sender_email']; $status = $feed['status']; if ($feed['type'] == 5) { $feed['status'] = $entry_comment_arr[$feed['ref_id']]['status']; } else { $feed['status'] = $entry_comment_arr[$feed['ref_id']]['replied_status']; } if ($feed['status'] == 0 || $status == 0) { $unread_feed_ids .= ($unread_feed_ids != '' ? ',' : '') . $feed['id']; if ($feed['type'] == 5 && $feed['status'] == 0) { //Mảng entrry_id cập nhật bỏ qua cho các feed chủ thể tương ứng khi giao dịch bị xoá hoặc khoá! $entry_ids_ar[$feed['entry_id']] = $feed['entry_id']; } if ($feed['type'] == 6 && $feed['status'] == 0) { //Mảng entrry_id cập nhật bỏ qua cho các feed khách thể tương ứng khi giao dịch bị xoá hoặc khoá! $entry_ids_ar2[$feed['entry_id']] = $feed['entry_id']; } } if (isset($entry_arr[$feed['entry_id']])) { $feed['entry'] = $entry_arr[$feed['entry_id']]; $all_feed_ars[$feed['id']] = $feed; } else { $del_feed_ids .= ($del_feed_ids != '' ? ',' : '') . $feed['id']; } } else { $del_feed_ids .= ($del_feed_ids != '' ? ',' : '') . $feed['id']; } } } } $display->add('all_feed_ars', $all_feed_ars); $display->add('image_path', 'http://' . IMAGE_PATH); $display->add('get_page', AZNet::$page['name']); $display->add('get_cmd', Url::get('cmd', 'office')); $display->add('get_act', $action); $display->add('user_name', User::user_name()); $this->total_group = count($all_feed_ars); $display->add('total_group', $this->total_group); $display->add('cur_group', $cur_group); $display->add('show_more', $this->show_more); $display->add('cur_user_name', User::user_name()); $display->add('more_notify', WEB_DIR . AZRewrite::formatUrl('?page=personal')); $transact_office = $display->output('tbl_notify_ajax', true, 'Personal'); $display->add('transact_office', $transact_office); $display->add('total_comment_user', User::$current->data['total_comment_user']); $display->add('total_new_comment', User::$current->data['total_new_comment']); $display->add('total_pm', User::$current->data['total_pm']); $display->add('can_edit_blast', User::is_admin() || !User::is_block()); $blast = User::$current->data['blast']; $avatar_link = ''; $avatar_url = 'style/images/no_avatar_item.gif'; if (User::$current->data['avatar_url'] != '') { $avatar_link = "http://" . CGlobal::$img_server[User::$current->data['img_server']] . User::$current->data['avatar_url']; $avatar_url = AZLib::getImageThumb(User::$current->data['avatar_url'], 80, 80, 0, User::$current->data['img_server']); } if ($blast == '') { $blast = '...'; } else { $blast = ' ' . $blast; if (strpos($blast, 'http://')) { $user_blast = $blast; while (strpos($user_blast, 'http://')) { $tmp = substr($user_blast, strpos($user_blast, 'http://')); if (strpos($tmp, ' ') || strpos($tmp, '<')) { if (strpos($tmp, ' ') && strpos($tmp, '<') && strpos($tmp, ' ') > strpos($tmp, '<')) { $blast_url = substr($tmp, 0, strpos($tmp, '<')); } else { $blast_url = substr($tmp, 0, strpos($tmp, ' ')); } } else { $blast_url = $tmp; } $user_blast = str_replace($blast_url, '', $user_blast); } $new_blast_url = ' <a rel="nofollow" href="' . $blast_url . '" target="_blank">Click here</a>'; $blast = substr($user_blast . $new_blast_url, 1); } } $display->add('avatar_link', $avatar_link); $display->add('avatar_url', $avatar_url); $display->add('blast', $blast); $display->add('user_id', User::id()); //Cập nhật sách theo đuôi if (isset($user_arr[$feed['act_user_id']]) && $user_arr[$feed['act_user_id']]['avatar_url']) { $feed['avatar_url'] = $user_arr[$feed['act_user_id']]['avatar_url']; } else { $feed['avatar_url'] = 'style/images/54x54.gif'; } if ($feed_follows) { $tmp_feed_follows = $feed_follows; $feed_follows = array(); foreach ($tmp_feed_follows as $feed) { if (isset($user_arr[$feed['user_id']])) { if ($user_arr[$feed['user_id']]['avatar_url']) { $avatar_url = $user_arr[$feed['user_id']]['avatar_url']; } else { $avatar_url = 'style/images/54x54.gif'; } $user_name = $user_arr[$feed['user_id']]['user_name']; if ($feed['type'] == 7) { //entry if (isset($entry_arr[$feed['item_id']])) { $feed_follows[$feed['user_id']]['user_name'] = $user_name; $feed_follows[$feed['user_id']]['avatar_url'] = $avatar_url; $feed['entry_name'] = $entry_arr[$feed['item_id']]['title']; $feed['entry_link'] = WEB_DIR . AZRewrite::formatUrl('?page=user_entry&user_name=' . $user_name . '&cmd_entry=view&entry_id=' . $feed['item_id'] . '&ebname=' . AZLib::safe_title($feed['entry_name'])); $feed['time'] = date('H:i d/m/Y', $feed['time']); $feed_follows[$feed['user_id']]['feeds'][$feed['id']] = $feed; } } else { $feed_follows[$feed['user_id']]['user_name'] = $user_name; $feed_follows[$feed['user_id']]['avatar_url'] = $avatar_url; $feed['blast'] = $user_arr[$feed['user_id']]['blast']; $feed['time'] = date('H:i d/m/Y', $feed['time']); $feed_follows[$feed['user_id']]['feeds'][$feed['id']] = $feed; } } } } $json = array(); $active_notify = array(); $active_notify['item_ids_ar'] = $item_ids_ar; $active_notify['item_ids_ar2'] = $item_ids_ar2; $active_notify['c_user_ids_ar'] = $c_user_ids_ar; $active_notify['pm_ids_ar'] = $pm_ids_ar; $json['active_notify'] = $active_notify; $json['total_unread'] = $total_unread; $json['total_notify'] = User::$current->data['total_comment_user'] + User::$current->data['total_new_comment'] + User::$current->data['total_pm']; $json['content'] = $display->output('tb_notify', true, 'Personal'); echo json_encode($json); exit; }
function draw() { global $display; $status_arr = array('0' => 'Chưa trả lời / phản hồi', '1' => 'Đã phản hồi / phản hồi', '2' => 'Tất cả'); $status = (int) Url::get('status', 0); $display->add('url_admin', Url::build_current()); $display->add('status_option', AZLib::getOption($status_arr, $status)); $item_per_page_arr = array('20' => '20', '50' => '50', '100' => '100', '150' => '150', '200' => '200', '300' => '300', '500' => '500'); $item_per_page = (int) Url::get('row_per_page', 20); $display->add('row_per_page_option', AZLib::getOption($item_per_page_arr, $item_per_page)); $from_date_arr[-1] = '--Từ ngày--'; for ($i = 30; $i >= 0; $i--) { $time_from = mktime(0, 0, 0, date('m', TIME_NOW), date('d', TIME_NOW), date('Y', TIME_NOW)) - $i * 24 * 3600; $from_date_arr[$time_from] = date('d/m/Y', $time_from); } $to_date_arr[-1] = '--Đến ngày--'; for ($i = 0; $i <= 30; $i++) { $time_to = mktime(23, 59, 59, date('m', TIME_NOW), date('d', TIME_NOW), date('Y', TIME_NOW)) - $i * 24 * 3600; $to_date_arr[$time_to] = date('d/m/Y', $time_to); } $from_date = Url::get('from_date', -1); $to_date = Url::get('to_date', -1); $display->add('from_date_option', AZLib::getOption($from_date_arr, $from_date)); $display->add('to_date_option', AZLib::getOption($to_date_arr, $to_date)); $sql = ' 1 '; if ($from_date > -1) { $sql .= " AND time>=" . $from_date; } if ($to_date > -1) { $sql .= " AND time<=" . $to_date; } $txt_ykien = Url::get('txt_ykien', ''); if ($txt_ykien != '') { $sql .= " AND content like '%{$txt_ykien}%'"; } $display->add('txt_ykien', $txt_ykien); if ($status != 2) { $sql .= ' AND status=' . $status; } $num_of_row = DB::count('feedback', $sql); $limit = ''; $display->add('pagging', AZPagging::paging_list($limit, $num_of_row, $item_per_page, 10, 'page_no', '', true, 'Liên hệ')); $page_no = (int) Url::get('page_no', 1); if ($page_no <= 0) { $page_no = 1; } $i = 0; $all_feedbacks = array(); $sql = "SELECT * FROM feedback WHERE {$sql} ORDER BY id DESC {$limit}"; $re = DB::query($sql); if ($re) { while ($row = mysql_fetch_assoc($re)) { $email = ''; if ($row['name']) { $email = stripslashes($row['name']) . " "; } if ($row['address']) { $email .= "( " . stripslashes($row['address']) . ") "; } $email .= '<a href="mailto:' . $row['email'] . '"><font color=blue>' . $row['email'] . "</font></a>"; $row['email'] = $email; $row['date'] = date("d/m/Y H:i:s", $row['time']); $row['date2'] = AZLib::duration_time($row['time']); $row['url_del'] = AZLib::buttonDel(Url::build_current(array('id' => $row['id'], 'cmd' => 'delete')), 'style/images/delete.gif', 'Xóa ý kiến'); $row['url_reply'] = Url::build_current(array('id' => $row['id'], 'cmd' => 'reply')); if ($row['reply_content']) { $row['reply_content'] = stripslashes($row['reply_content']); } else { $row['reply_content'] = "Chưa có"; } if (!$row['status']) { $row['exam'] = AZLib::button(Url::build_current(array('id' => $row['id'], 'cmd' => 'exam')), 'style/images/exam.gif', 'Duyệt liên hệ'); } else { $row['exam'] = AZLib::button(Url::build_current(array('id' => $row['id'], 'cmd' => 'unexam')), 'style/images/unexam.gif', 'Bỏ duyệt liên hệ'); } if ($i % 2 == 0) { $row['bgcolor'] = '#FFFFFF'; } else { $row['bgcolor'] = '#CCFF99'; } $i++; $row['i'] = ($page_no - 1) * $item_per_page + $i; $all_feedbacks[$row['id']] = $row; } } $display->add('all_feedbacks', $all_feedbacks); $this->beginForm(); $display->output("FeedbackAdmin"); $this->endForm(); }