function show_all_notify() { global $display; EClassApi::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, original_image_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' => EClassApi::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' => EClassApi::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 . ECRewrite::formatUrl('?page=user_entry&user_name=' . $entry['user_name'] . '&cmd_entry=view&entry_id=' . $entry['id'] . '&ebname=' . EClassApi::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 account 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'] = EClassApi::parseBBCode(stripslashes($comment['content'])); $comment['s_content'] = EClassApi::plainText($comment['content']); if (strlen($comment['s_content']) > 20) { $comment['s_content'] = EClassApi::word_limit($comment['s_content'], 10, '..'); } $comment['time'] = EClassApi::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'] = EClassApi::parseBBCode(stripslashes($comment['content'])); $comment['s_content'] = EClassApi::plainText($comment['content']); if (strlen($comment['s_content']) > 20) { $comment['s_content'] = EClassApi::word_limit($comment['s_content'], 10, '..'); } $comment['time'] = EClassApi::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'] = EClassApi::parseBBCode(stripslashes($comment['content'])); $comment['s_content'] = EClassApi::plainText($comment['content']); if (strlen($comment['s_content']) > 20) { $comment['s_content'] = EClassApi::word_limit($comment['s_content'], 10, '..'); } $comment['time'] = EClassApi::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'] = EClassApi::parseBBCode(stripslashes($comment['content'])); $comment['s_content'] = EClassApi::plainText($comment['content']); if (strlen($comment['s_content']) > 20) { $comment['s_content'] = EClassApi::word_limit($comment['s_content'], 10, '..'); } $comment['time'] = EClassApi::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?tab=gt#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', EClass::$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 . ECRewrite::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 = EClassApi::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 . ECRewrite::formatUrl('?page=user_entry&user_name=' . $user_name . '&cmd_entry=view&entry_id=' . $feed['item_id'] . '&ebname=' . EClassApi::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 get_feed_notify_bar() { EClassApi::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'] = EClassApi::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_category_id 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"] = EClassApi::word_limit($item["name"], 7, '...'); $ebname = EClassApi::safe_title($item['name']); if (isset(CGlobal::$allCategories[$item['level_1_category_id']])) { $cat_name = CGlobal::$allCategories[$item['level_1_category_id']]['name']; $item_comment_arr[$item["id"]]["url_link"] = WEB_DIR . EClassApi::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'] = EClassApi::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'] = EClassApi::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'] = EClassApi::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"] = EClassApi::word_limit($entry["title"], 7, '...'); $ebname = EClassApi::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; }