static function getMenu() { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $menu = array('title' => 'Home', 'title2' => 'Manage General', 'des' => 'Home', 'des2' => 'System Management', 'url' => WEB_DIR, 'url2' => WEB_DIR . "admin.html", 'image' => WEB_DIR . 'images/menu/home3.png', 'show2' => 1); $sub_menu[] = array('title' => 'Admin Home', 'des' => 'Admin Home', 'url' => WEB_DIR . "admin.html", 'image' => WEB_DIR . 'images/menu/Monitor.png', 'not_show2' => 1); if (User::is_root()) { $sub_menu[] = array('title' => 'Manage Pages', 'des' => 'Manage Pages', 'url' => WEB_DIR . ECRewrite::formatUrl('?page=page'), 'image' => WEB_DIR . 'images/menu/page.png', 'not_show2' => 1); $sub_menu[] = array('title' => 'Manage Modules', 'des' => 'Manage Modules', 'url' => WEB_DIR . "module.html", 'image' => WEB_DIR . 'images/menu/module.png', 'not_show2' => 1); $sub_menu[] = array('title' => 'Manage Admin Role', 'des' => 'Manage Admin Role', 'url' => WEB_DIR . "admin_role.html", 'image' => WEB_DIR . 'images/menu/control.png', 'not_show2' => 1); } $sub_menu[] = array('title' => 'Manage Support', 'des' => 'Manage Support', 'url' => WEB_DIR . "manage_support.html", 'image' => WEB_DIR . 'images/menu/control.png', 'not_show2' => 1); $menu['sub_menu'] = $sub_menu; $header_menu[] = $menu; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (User::is_mod()) { $menu = array('title' => 'Manage Content', 'des' => 'Manage Content', 'url' => WEB_DIR . ECRewrite::formatUrl('?page=admin_banner'), 'image' => WEB_DIR . 'images/menu/city.png'); $sub_menu = array(); $sub_menu[] = array('title' => 'Manage Categories', 'des' => 'Manage Categories', 'url' => WEB_DIR . ECRewrite::formatUrl('?page=admin_news_category'), 'image' => WEB_DIR . 'images/menu/order.png'); $sub_menu[] = array('title' => 'Manage News', 'des' => 'Manage News', 'url' => WEB_DIR . ECRewrite::formatUrl('?page=admin_news_item'), 'image' => WEB_DIR . 'images/menu/order.png'); $sub_menu[] = array('title' => 'Manage Banners', 'des' => 'Manage Banners', 'url' => WEB_DIR . ECRewrite::formatUrl('?page=admin_banner'), 'image' => WEB_DIR . 'images/menu/city.png'); $menu['sub_menu'] = $sub_menu; $header_menu[] = $menu; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $menu = array('title' => 'Manage Account', 'des' => 'Manage Users, Teachers', 'url' => User::is_mod() ? WEB_DIR . 'admin.html' : '', 'image' => WEB_DIR . 'images/menu/user.png'); $sub_menu = array(); if (User::is_root()) { $sub_menu[] = array('title' => 'Manage Users', 'des' => 'Manage Users', 'url' => WEB_DIR . 'user.html', 'image' => WEB_DIR . 'images/menu/user.png'); } if ($sub_menu) { $menu['sub_menu'] = $sub_menu; $header_menu[] = $menu; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (User::is_root()) { $menu = array('title' => 'System Management', 'des' => 'System Management', 'url' => WEB_DIR . "admin.html", 'image' => WEB_DIR . 'images/menu/Monitor.png', 'not_show1' => 1); $sub_menu = array(); $sub_menu[] = array('title' => 'Manage Pages', 'des' => 'Manage Pages', 'url' => WEB_DIR . ECRewrite::formatUrl('?page=page'), 'image' => WEB_DIR . 'images/menu/page.png', 'not_show1' => 1); $sub_menu[] = array('title' => 'Manage Modules', 'des' => 'Manage Modules', 'url' => WEB_DIR . "module.html", 'image' => WEB_DIR . 'images/menu/module.png', 'not_show1' => 1); $sub_menu[] = array('title' => 'Manage Admin Role', 'des' => 'Manage Admin Role', 'url' => WEB_DIR . "admin_role.html", 'image' => WEB_DIR . 'images/menu/control.png', 'not_show1' => 1); $menu['sub_menu'] = $sub_menu; $header_menu[] = $menu; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// return $header_menu; }
function getItemVipCat() { EClassApi::getCities(); EClassApi::getCats(); //get ID VIP CAT if (MEMCACHE_ON) { $category_id = CGlobal::$curCategory; $id_vip_cat = eb_memcache::do_get("id_vip_cat:{$category_id}"); if (!$id_vip_cat || $id_vip_cat['ex_time'] < TIME_NOW) { $id_vip_cat = $this->getIdVipCat(); eb_memcache::do_put("id_vip_cat:{$category_id}", $id_vip_cat); } } else { $id_vip_cat = $this->getIdVipCat(); } $str_item_id = ''; if (isset($id_vip_cat['id'])) { foreach ($id_vip_cat['id'] as $val) { $str_item_id .= $str_item_id != '' ? ",{$val}" : "{$val}"; } } $items = array(); if ($str_item_id != '') { $sql = 'SELECT id, name, up_time, created_time, user_id, user_name, description, city_id, category_id, currency_id, price, original_image_url, img_server FROM item WHERE'; $where = ''; $where .= ($where != '' ? " AND " : "") . " id IN({$str_item_id})"; $where .= ($where != '' ? " AND " : "") . " (status=1 OR status = 2)"; $sql .= "{$where} ORDER BY up_time DESC"; $items = array(); $re = DB::query($sql); if ($re) { while ($value = mysql_fetch_assoc($re)) { $value['price'] = EClassApi::convertCurrency($value['price'], $value['currency_id']); $value['currency_id'] = 1; if (isset(CGlobal::$allCategories[$value['category_id']])) { $value['href'] = WEB_DIR . ECRewrite::formatUrl('?page=item_detail&id=' . $value['id'] . '&ebname=' . EClassApi::safe_title($value['name']) . '&nice_name=' . CGlobal::$allCategories[$value['category_id']]['nice_name']); } else { $value['href'] = WEB_DIR . ECRewrite::formatUrl('?page=item_detail&id=' . $value['id'] . '&ebname=' . EClassApi::safe_title($value['name'])); } $value['item_time'] = date('h:i | d.m', $value['created_time']); $value['price_name'] = 'Giá bán'; $value['item_type'] = 'Giao dịch bán'; $value['name'] = strip_tags(EClassApi::filter_title($value['name'])); if ($value['price'] && $value['price'] > 0) { $value['price'] = number_format($value['price'], 0, ',', '.'); $value['currency_id'] = CGlobal::$currency[$value['currency_id']]; } else { $value['price'] = 'Liên hệ'; $value['currency_id'] = ''; } if ($value['original_image_url']) { $value['original_image_url'] = EClassApi::getImageThumb($value['original_image_url'], 80, 80, 0, $value['img_server']); } else { $value['original_image_url'] = 'style/images/no-images-69x53.jpg'; } $value['profile_url'] = WEB_DIR . $value['user_name']; $value['user_name_title'] = $value['user_name']; $value['user_name'] = strlen($value['user_name']) > 10 ? substr($value['user_name'], 0, 10) . '...' : $value['user_name']; if (isset(CGlobal::$cities[$value['city_id']])) { $value['city'] = CGlobal::$cities[$value['city_id']]['name']; } else { $value['city'] = "Toàn quốc"; } $value['vip_cat_img'] = "style/images/item-list/item_vip.gif"; $value['can_buy'] = 0; $items[$value['id']] = $value; } } } // $items['str_item_id'] = $str_item_id; return $items; }
function get_more_comment() { $parent_id = EClassApi::getParam('comment_id'); $item_user_name = EClassApi::getParam('item_user_name'); $item_id = EClassApi::getParam('item_id'); $cat_id = EClassApi::getParam('cat_id'); $guest_email = EClassApi::getParam('guest_email'); $guest_name = EClassApi::getParam('guest_name'); //$cur_id = EClassApi::getParam('cur_id',0); $cur_id = User::id(); $item_user_id = EClassApi::getParam('user_id'); $show_guest_email = User::have_cat_permit($cat_id) || User::id() == $item_user_id; $sql = 'SELECT `comment`.`id`, `time`, `content`, `item_id`, `sender_email`, `sender_user_name`, account.img_server, `receiver_user_name`,`sender_user_id`, `receiver_user_id`, `parent_id`, `have_child`, account.avatar_url, account.id as user_id, account.gids, account.block_time FROM `comment` LEFT JOIN `account` ON account.id=comment.sender_user_id WHERE `comment`.`parent_id` =' . $parent_id . ' AND `comment`.`display`=0 ORDER BY time DESC LIMIT 0,100'; $re = DB::query($sql); $i = 0; $result = ''; $str_user_id = ''; while ($item = mysql_fetch_assoc($re)) { $item['index'] = $i; $i++; if ($item['block_time'] > TIME_NOW) { $item['is_block'] = 1; } else { $item['is_block'] = 0; } $str_user_id .= ($str_user_id != '' ? ',' : '') . $item['sender_user_id']; //set quyen quan tri if ($item['gids']) { $is_admin_mod = CGlobal::$group[User::check_admin($item['gids'])]; } else { $is_admin_mod = array(); } $item['is_admin_mod'] = $is_admin_mod; if (TIME_NOW - $item['time'] < 24 * 3600) { $time_left = TIME_NOW - $item['time']; $hour = floor($time_left / 3600); $day = ''; $minute = floor($time_left % 3600 / 60) . ' phút'; $time_left = ($hour ? $hour . ' giờ ' : '') . $minute; if ($time_left == 0) { $time_left = 'Vài giây'; } $item['created_time'] = $time_left . ' trước'; } elseif (date('Y') != date('Y', $item['time'])) { $item['created_time'] = date('H:i | d.m.Y', $item['time']); } else { $item['created_time'] = date('H:i | d.m', $item['time']); } $item['content'] = EClassApi::parseBBCode($item['content']); if ($item['sender_user_id']) { $item['sender_link'] = Url::build('shop', array('user_name' => $item['sender_user_name'])); } else { $item['sender_link'] = ''; } $item['URL_badcontent'] = Url::build('item_detail', array('id' => Url::get('id'), 'ctype' => 'comment', 'id_comment' => $item['id'])); $result .= '<tr id="' . $item['id'] . '"'; $result .= ' onmouseover="show_hide_menu(' . $item['id'] . ')" onmouseout="show_hide_menu(' . $item['id'] . ')" '; $result .= '><td width="28" align="right" valign="top"><div style="height:5px"><span></span></div>'; if ($item['sender_user_id'] == 0) { /* if($item['id']%3 == 0){ $item['sender_avatar_url'] = 'style/avatar/1.png';//'style/images/eb_small.gif'; } elseif($item['id']%3 == 1){ $item['sender_avatar_url'] = 'style/avatar/2.png'; } else{ $item['sender_avatar_url'] = 'style/avatar/3.png'; }*/ $item['sender_avatar_url'] = WEB_DIR . '_cache/eb_avatar/' . md5($item['sender_user_name']) . '.gif'; $html_content = ''; $result .= '<div class="feedbackAvatarSub" id="avatar_content_' . $item['user_id'] . '"><img src="' . $item['sender_avatar_url'] . '" width="40" height="40" /></div>'; } else { if ($item['avatar_url']) { $item['sender_avatar_url'] = EClassApi::getImageThumb($item['avatar_url'], 60, 0, 1, $item['img_server']); if ($item['parent_id'] > 0) { $html_content = '<a href="' . $item['sender_link'] . '"><img src="' . $item['sender_avatar_url'] . '" width="40"/></a>'; } else { $html_content = '<a href="' . $item['sender_link'] . '"><img src="' . $item['sender_avatar_url'] . '" width="40"/></a>'; } } else { $item['sender_avatar_url'] = WEB_DIR . '_cache/eb_avatar/' . md5($item['sender_user_name']) . '.gif'; /*if ($item['parent_id'] > 0){ $html_content = '<a href="'.$item['sender_link'].'"><img src="style/avatar/2.png" width="40" height="40" /></a>'; }else{ $html_content = '<a href="'.$item['sender_link'].'"><img src="style/avatar/1.png" width="40" height="40" /></a>'; }*/ } $result .= '<div class="profile_load" id="c' . $item['id'] . '" lang="' . $item['user_id'] . '"><div class="feedbackAvatarSub" '; $result .= ' id="avatar_content_' . $item['user_id'] . '"><div class="bubbleInfo" id="info_' . $item['id'] . '" lang="' . $item['user_id'] . '"><div class="commentAva trigger">' . $html_content . '</div><!-- BEGIN POPUP MENU --><div class="popup" style="text-align: left;"><div id="show_mini_profile_c' . $item['id'] . '" style="display:none;"></div><div id="hide_mini_profile_c' . $item['id'] . '"><div class="contentPop" style="background-color:#fff"><div style="margin:4px;"><div class="blastTopLeft"><div class="blastTopRight"><div class="blastTopbg"><span></span></div></div></div><div class="blast"><img src="style/images/ajax-loader4.gif" width="62" height="13" /></div><div class="blastBottomLeft"><div class="blastBottomRight"><div class="blastBottombg"><span></span></div></div></div></div></div></div></div><!--END POPUP MENU --></div></div></div>'; } $result .= '</td><td valign="top"><div class="contentFeedback" align="left"><div '; if (isset($item['is_admin_mod']['id']) && ($item['is_admin_mod']['id'] == 9 || $item['is_admin_mod']['id'] == 1)) { $result .= ' class="topFeedback_admin" '; } elseif (isset($item['is_admin_mod']['id']) && ($item['is_admin_mod']['id'] == 2 || $item['is_admin_mod']['id'] == 3)) { $result .= ' class="topFeedback_mod" '; } elseif ($item['sender_user_name'] == $item_user_name) { $result .= ' class="topFeedbackSelf" '; } else { $result .= ' class="topFeedback"'; } $result .= ' >'; if ($item['sender_user_id'] == 0) { $result .= ' <span class="guest_name">' . $item['sender_user_name']; /*$result .= ($show_guest_email)?'<a href="mailto:'.$item['sender_email'].'" title="Gửi e-mail cho người dùng này!"><img src="style/images/comment_email/email.gif" border="0" width="15" height="11"/></a>':'';*/ $result .= $show_guest_email ? '' : ''; $result .= '</span>'; } else { $result .= ' <a '; $result .= $item['is_block'] == 1 ? ' title="Đang bị khóa nick" ' : ' '; $result .= $item['is_admin_mod'] ? ' title="' . $item['is_admin_mod']['des'] . '" ' : ' '; $result .= ' href="' . WEB_DIR . $item['sender_user_name'] . '">'; $result .= $item['is_block'] == 1 ? ' <s><i> ' : ' '; $result .= $item['sender_user_name']; $result .= $item['is_block'] == 1 ? ' </i></s> ' : ' '; $result .= '</a>'; } $result .= ' <span class="fb_time">' . $item['created_time'] . '</span> '; $result .= '<div class="floatRight" style="margin-top:-12px; height:16px"><div id="show_menu_' . $item['id'] . '" style="display:none">'; if ($item['user_id'] != $cur_id && $item['sender_user_id'] != 0) { $result .= ' <span class="send_pm_fb" onclick="fn_send_pm_fb(' . $item['user_id'] . ',\'' . $item['sender_user_name'] . '\');" id="' . $item['user_id'] . '-' . $item['sender_user_name'] . '" style="margin-left:5px"><a href="javascript: void(0)">gửi tin nhắn </a></span>|<span class="send_fb"><a href="' . WEB_DIR . ECRewrite::formatUrl('?page=shop&user_name=' . $item['sender_user_name'] . '&mode=comment') . '">viết lưu bút</a></span> '; if ($item && $item['sender_user_id'] == 0 && $cur_id == $item['receiver_user_id'] || User::have_permit(ADMIN_ITEM)) { $result .= ' | '; } } if ($item && $item['sender_user_id'] == 0 && $cur_id == $item['receiver_user_id'] || User::have_permit(ADMIN_ITEM)) { $result .= '<span onclick="fn_click_del_comment_aj(' . $item['id'] . ',' . $item_id . ')" id="' . $item['id'] . '|' . $item_id . '"><a href="javascript:void()"><img src="style/images/icon_delete.gif" width="9" height="9" /></a></span>'; } $result .= '</div></div><div style="clear:both"><span></span></div>'; $result .= ' </div> <div align="center" id="mess_success_' . $item['id'] . '" style="display:none" class="mess_success"></div> <div class="detailFeedback" align="left" style="width:92%; overflow:hidden">' . $item['content'] . '</div> '; if ($item['user_id'] != $cur_id) { $result .= '<div id="reply_' . $item['id'] . '" ><div class="btn_fast_reply" onmouseout="if(this.className==\'btn_fast_reply_hover\')this.className=\'btn_fast_reply\'" onmouseover="if(this.className==\'btn_fast_reply\')this.className=\'btn_fast_reply_hover\'" style="float:right" onclick="show_box_reply(' . $item['id'] . ',' . $item['parent_id'] . ',\'' . $guest_name . '\',\'' . $guest_email . '\',\'' . $item['sender_user_name'] . '\',' . $item['sender_user_id'] . '); return true;">trả lời</div></div>'; $result .= ' <div style="clear:right" id="box_reply_' . $item['id'] . '"></div>'; } $result .= '</div></td></tr><tr id="space_' . $item['id'] . '"><td height="1" colspan="2"><div style="height:1px; margin:5px 0; background-color:#fff"><span></span></div></td></tr>'; $result .= '</tr>'; } echo $result; System::halt(); }
function formatUrl($url = '', $options = array()) { return ECRewrite::formatUrl($url, $options); }
public static function rulePage($page = ""){ if( $page ){ if(!self::$page_patten){ self::$page_patten = array( 'list' => array ( 'url_in' => array ( "/\?page=list&district=([a-zA-Z0-9_-]*)&ftype=([0-9]+)&page_no=([0-9]+)/", "/\?page=list&district=([a-zA-Z0-9_-]*)&ftype=([0-9]+)/", ), 'url_out' => array ( "nha-hang/\$1/\$2/p\$3.html", "nha-hang/\$1/\$2.html", ), ), 'list_detail_electric' => array ( 'url_in' => array ( "/\?page=list_detail_electric&city=([a-zA-Z0-9_-]*)&category_id=([0-9]+)&ebname=([a-zA-Z0-9_\-]*)&page_no=([0-9]+)/", "/\?page=list_detail_electric&city=([a-zA-Z0-9_-]*)&category_id=([0-9]+)&ebname=([a-zA-Z0-9_\-]*)/" ), 'url_out' => array ( "\$1/e\$2/\$3/page-\$4", "\$1/e\$2/\$3", ), ), 'cat_electric' => array ( 'url_in' => array ( "/\?page=cat_electric&city_id=([a-zA-Z0-9_-]*)&cid=([0-9]+)&ebname=([a-zA-Z0-9_\-]*)&page_no=([0-9]+)/", "/\?page=cat_electric&city_id=([a-zA-Z0-9_-]*)&cid=([0-9]+)&ebname=([a-zA-Z0-9_\-]*)/" , "/\?page=cat_electric&cid=([0-9]+)&ebname=([a-zA-Z0-9_\-]*)&page_no=([0-9]+)/", "/\?page=cat_electric&cid=([0-9]+)&ebname=([a-zA-Z0-9_\-]*)/", ), 'url_out' => array ( "\$1/e\$2/\$3/page-\$4", "\$1/e\$2/\$3", "e\$1/\$2/page-\$3", "e\$1/\$2", ), ), 'detail_electric' => array ( 'url_in' => array ( "/\?page=detail_electric&city_id=([a-zA-Z0-9_-]*)&nice_name=([a-zA-Z0-9_\-]*)&id=([0-9]+)&ebname=([a-zA-Z0-9_\-]*)/" , "/\?page=detail_electric&nice_name=([a-zA-Z0-9_\-]*)&id=([0-9]+)&ebname=([a-zA-Z0-9_\-]*)/" , "/\?page=detail_electric&id=([0-9]+)&ebname=([a-zA-Z0-9_\-]*)/", "/\?page=detail_electric&id=([0-9]+)/", ), 'url_out' => array ( "\$1/\$2/sp-\$3/\$4.html", "\$1/sp-\$2/\$3.html", "sp-\$1/\$2.html", "sp-\$1.html", ), ), 'item_detail' => array ( 'url_in' => array ( "/\?page=item_detail&city=([a-zA-Z0-9_-]*)&id=([0-9]+)&ebname=([a-zA-Z0-9_\-]*)&nice_name=([a-zA-Z0-9_\-]+)/", "/\?page=item_detail&city=([a-zA-Z0-9_-]*)&id=([0-9]+)&ebname=([a-zA-Z0-9_\-]*)/", "/\?page=item_detail&city=([a-zA-Z0-9_-]*)&id=([0-9]+)/", ), 'url_out' => array ( "\$1/\$4/p\$2/\$3.html", "$1/p\$2.html", "$1/p\$2.html", ), ), 'photo' => array ( 'url_in' => array ( "/\?page=photo&city=([a-zA-Z0-9_-]*)&id=([0-9]+)&ebname=([a-zA-Z0-9_\-]*)&nice_name=([a-zA-Z0-9_\-]+)/", "/\?page=photo&city=([a-zA-Z0-9_-]*)&id=([0-9]+)&ebname=([a-zA-Z0-9_\-]*)/", "/\?page=photo&city=([a-zA-Z0-9_-]*)&id=([0-9]+)/", ), 'url_out' => array ( "\$1/\$4/p\$2/\$3.html", "$1/p\$2.html", "$1/p\$2.html", ), ), 'AllFeedback' => array ( 'url_in' => array ( "/\?page=AllFeedback&id=([0-9]+)&category_id=([0-9]+)&ebname=([a-zA-Z0-9_\-]*)/", "/\?page=AllFeedback&id=([0-9]+)&ebname=([a-zA-Z0-9_\-]*)/", ), 'url_out' => array ( "c\$2/fb\$1/\$3.html", "fb\$1/\$2.html", ), ), 'user_entry' => array ( 'url_in' => array ( "/\?page=user_entry&user_name=([a-zA-Z0-9_\-]*)&cmd_entry=view&entry_id=([0-9]+)&ebname=([a-zA-Z0-9_\-]*)/", "/\?page=user_entry&user_name=([a-zA-Z0-9_\-]*)/", "/\?page=user_entry&user_id=([0-9]+)&user_name=([a-zA-Z0-9_\-]*)/", ), 'url_out' => array ( "Bai-viet/\$1/e\$2/\$3", "Bai-viet/\$1", "Bai-viet/\$2", ), ), 'shop' => array ( 'url_in' => array ( "/\?page=shop&user_id=([0-9]+)&user_name=([a-zA-Z0-9_\-]+)&label_id=([0-9]+)&ebname=([a-zA-Z0-9_\-]*)/", "/\?page=shop&user_name=([a-zA-Z0-9_\-]+)&label_id=([0-9]+)&mode=shop&ebname=([a-zA-Z0-9_\-]*)/", "/\?page=shop&user_name=([a-zA-Z0-9_\-]+)&label_id=([0-9]+)&ebname=([a-zA-Z0-9_\-]*)/", "/\?page=shop&user_id=([0-9]+)&user_name=([a-zA-Z0-9_\-]+)/", "/\?page=shop&user_name=([a-zA-Z0-9_\-]+)&mode=shop/", "/\?page=shop&user_name=([a-zA-Z0-9_\-]+)&mode=comment/", "/\?page=shop&user_name=([a-zA-Z0-9_\-]+)&mode=setting/", "/\?page=shop&user_name=([a-zA-Z0-9_]+)/", ), 'url_out' => array ( "Shop/\$1/L\$3/\$4", "Shop/\$1/L\$2/\$3", "Shop/\$1/L\$2/\$3", "Shop\$1/\$2", "Shop/\$1/San-pham", "Shop/\$1/Luu-but", "Shop/\$1/Cai-dat", "\$1", ), ), 'sph_search' => array ( 'url_in' => array ( "/\?page=sph_search/", ), 'url_out' => array ( "search", ) ), ); } return isset(self::$page_patten[$page])?self::$page_patten[$page]:''; } return; }
function draw() { global $display; $this->beginForm(); $join_field = ''; $join = ''; $where_join = ''; $where = ''; $order_by = Url::get('order_by', 1); $time = "sms_user_active.c_time"; if ($order_by == 1) { $order = ' ORDER BY sms_user_active.id DESC'; } elseif ($order_by == 2) { $order = ' ORDER BY sms_user_active.a_time,sms_user_active.id'; $time = "sms_user_active.a_time"; } elseif ($order_by == 3) { $order = ' ORDER BY sms_user_active.c_time,sms_user_active.id'; } elseif ($order_by == 4) { $order = ' ORDER BY sms_user_active.l_time,sms_user_active.id'; $time = "sms_user_active.l_time"; } elseif ($order_by == 5) { $order = ' ORDER BY sms_user_active.sms_total DESC,sms_user_active.id'; $time = "sms_user_active.l_time"; } elseif ($order_by == 6) { $order = ' ORDER BY sms_user_active.sms_total,sms_user_active.id'; $time = "sms_user_active.l_time"; } $page = Url::get('page', 1); $a_id = Url::get('a_id', 0); $m_user_name = Url::get('m_user_name', ''); $user_name = Url::get('user_name'); $status = Url::get('status', 0); if ($user_name) { $user = User::getByUserName($user_name); if ($user) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " sms_user_active.user_id = '{$user['id']}'"; } else { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " 0 "; } } if ($m_user_name) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " sms_user_active.m_user_name = '{$m_user_name}'"; } if ($a_id) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " sms_user_active.id = {$a_id}"; } if ($status == 3) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " sms_user_active.status = 0"; } elseif ($status == 4) { $join_field = ", account.level"; $join = " LEFT JOIN account ON account.id = sms_user_active.user_id"; $where_join = ($where != '' ? ' AND ' : 'WHERE ') . " sms_user_active.status = 1 AND (account.level < 1 OR account.level IS NULL)"; //$where.=($where!=''?' AND ':'WHERE ')." (status = 1 AND user_id IN (SELECT id FROM account WHERE level < 1))"; } elseif ($status) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " sms_user_active.status = {$status}"; } $date_start = Url::get('date_start'); $date_end = Url::get('date_end'); if ($date_start) { $arr = explode('-', $date_start); $where .= ($where != '' ? ' AND ' : 'WHERE ') . " {$time}>=" . mktime(0, 0, 0, $arr[1], $arr[0], $arr[2]); } if ($date_end) { $arr = explode('-', $date_end); $where .= ($where != '' ? ' AND ' : 'WHERE ') . " {$time}<=" . mktime(23, 59, 59, $arr[1], $arr[0], $arr[2]); } $display->add('a_id', $a_id); $display->add('date_start', $date_start); $display->add('date_end', $date_end); $display->add('m_user_name', $m_user_name); $display->add('order_by', $order_by); $display->add('user_name', $user_name); $display->add('status', $status); $total = DB::fetch("SELECT COUNT(*) AS total_row FROM sms_user_active {$join} {$where} {$where_join}", 'total_row', 0); $display->add('total', $total); $pagging = ''; $items = array(); $sms_rows = array(); $item_ids = ''; if ($total) { //----- Pagging --------------- $limit = ''; require_once ROOT_PATH . 'core/ECPagging.php'; $pagging = ECPagging::pagingSE($limit, $total, 50, 10, 'page_no', true, ' Thành viên'); //----- Pagging --------------- // Lấy danh sách user_id để kiểm tra xem user đã thực sự được active trong bảng account hay chưa $lstIDs = ''; $sql = "SELECT user_id FROM sms_user_active {$where} {$order} {$limit}"; $reIDs = DB::query($sql); if ($reIDs) { $lstECSActive = ''; while ($row = mysql_fetch_assoc($reIDs)) { $lstECSActive .= $lstECSActive ? ',' : ''; $lstECSActive .= $row['user_id']; } if ($reIDs) { $sql = "SELECT id FROM account WHERE level > 0 AND id IN(" . $lstECSActive . ")"; $reActiveIDs = DB::query($sql); if ($reActiveIDs) { while ($row = mysql_fetch_assoc($reActiveIDs)) { $lstIDs .= $lstIDs ? ',' : ''; $lstIDs .= $row['id']; } } } } $sql = "SELECT sms_user_active.id,sms_user_active.user_id, sms_user_active.user_name, sms_user_active.sms_total, sms_user_active.c_time, \n\t\t\t\t\tsms_user_active.l_time, sms_user_active.a_time, sms_user_active.status, sms_user_active.m_time, sms_user_active.m_user_name, \n\t\t\t\t\tsms_user_active.note {$join_field} FROM sms_user_active {$join} {$where} {$where_join} {$order} {$limit}"; $re = DB::query($sql); if ($re) { while ($sms_row = mysql_fetch_assoc($re)) { if ($lstIDs) { if (strpos(',' . $lstIDs . ',', ',' . $sms_row['user_id'] . ',') === false && $sms_row['status']) { if ($sms_row['level'] != '') { // Nếu thành viên thực sự được kích hoạt ảo $sms_row['activeStyle'] = ' style="color:#C02C00;"'; } else { // Nếu thành viên đã được kích hoạt, nhưng đã bị xóa khỏi db $sms_row['activeStyle'] = ' style="color:#666666; text-decoration: line-through"'; } } } $sms_row['c_time'] = date('H\\hi d.m.Y', $sms_row['c_time']); if ($sms_row['l_time']) { $sms_row['l_time'] = date('H\\hi d.m.Y', $sms_row['l_time']); } else { $sms_row['l_time'] = ''; } if ($sms_row['m_time']) { $sms_row['m_user_name'] = "<b>Sửa:</b> {$sms_row['m_user_name']}<br /><b>Lúc:</b> " . date('H\\hi d.m.Y', $sms_row['m_time']); } else { $sms_row['m_user_name'] = ''; $sms_row['m_time'] = ''; } if ($sms_row['a_time']) { $sms_row['a_time'] = date('H\\hi d.m.Y', $sms_row['a_time']); } else { $sms_row['a_time'] = ''; } if ($sms_row['status'] != 1) { $sms_row['start_link'] = WEB_DIR . ECRewrite::formatUrl("?page=user_active&cmd=active&id={$sms_row['id']}"); } if ($sms_row['status'] == 1) { $sms_row['stop_link'] = WEB_DIR . ECRewrite::formatUrl("?page=user_active&cmd=deactive&id={$sms_row['id']}"); } $sms_row['del_link'] = WEB_DIR . ECRewrite::formatUrl("?page=user_active&cmd=del&id={$sms_row['id']}"); if ($sms_row['status'] == 0) { $sms_row['status'] = '<font color="orange">Chưa KH</font>'; } elseif ($sms_row['status'] == 1) { $sms_row['status'] = '<font color="green">Đã KH</font>'; } elseif ($sms_row['status'] == 2) { $sms_row['status'] = '<font color="brown">Vi phạm, không được KH</font>'; } $sms_row['edit_link'] = "?page=user_active&cmd=edit&id={$sms_row['id']}"; $sms_rows[$sms_row['id']] = $sms_row; } } } $display->add('is_root', User::is_root()); $display->add('items', $sms_rows); $display->add('pagging', $pagging); $display->output('UserActive'); $this->endForm(); }
static function paging_list_new(&$limit = false, $itemperpage, $page_name = 'page_no', $url_path = '') { $currentpage = (int) Url::get($page_name); if ($currentpage <= 0) { $currentpage = 1; } elseif ($currentpage > 200) { $currentpage = 200; } if ($currentpage <= 6) { $totalpage = 11; } else { $totalpage = $currentpage + 4 < 200 ? $currentpage + 4 : 200; } $limit = ' LIMIT ' . ($currentpage - 1) * $itemperpage . ',' . $itemperpage; if ($currentpage > 3) { $startpage = $currentpage - 3; if ($totalpage - $startpage < 7) { $startpage = $totalpage - 7 + 1; } } else { $startpage = 1; } if ($startpage < 1) { $startpage = 1; } if ($url_path == '') { $url_path = Url::build_all(array($page_name)); } //Link den trang truoc if ($currentpage > 1) { $paging_str = '<div class="paging_bg floatLeft" onmouseout="this.className=\'paging_bg floatLeft\'" onmouseover="this.className=\'paging_bg_hover floatLeft\'"> <div class="paging_pre"> <a href=\'' . $url_path . ($currentpage > 2 ? '?' . $page_name . '=' . ($currentpage - 1) : '') . '\'>« Trước</a> </div> </div>'; } else { $paging_str = '<div class="paging_bg_dis floatLeft "> <div class="paging_pre_dis"> « Trước </div> </div>'; } //Danh sach cac trang $i = 1; while ($i <= 4) { if ($startpage > $i) { if ($i < 4) { $paging_str .= '<div class="floatLeft paging_bg" onmouseover="javascript:this.className=\'floatLeft paging_bg_hover\'" onmouseout="javascript:this.className=\'floatLeft paging_bg\'"> <div class="paging_node"> <a href="' . $url_path . ($i > 1 ? '?' . $page_name . '=' . $i : '') . '">' . $i . '</a> </div> </div>'; } else { $paging_str .= '<div class="floatLeft paging_bg"> <div class="paging_node_dot"> ... </div> </div>'; } } $i++; } for ($i = $startpage; $i <= $startpage + 6 && $i <= $totalpage; $i++) { if ($i == $currentpage) { $paging_str .= '<div class="floatLeft paging_bg_hover paging_bg_current"> <div class="paging_node"> <a href="' . $url_path . ($i > 1 ? '?' . $page_name . '=' . $i : '') . '">' . $i . '</a> </div> </div>'; } else { $paging_str .= '<div class="floatLeft paging_bg" onmouseover="javascript:this.className=\'floatLeft paging_bg_hover\'" onmouseout="javascript:this.className=\'floatLeft paging_bg\'"> <div class="paging_node"> <a href="' . $url_path . ($i > 1 ? '?' . $page_name . '=' . $i : '') . '">' . $i . '</a> </div> </div>'; } } $j = 8; while ($j <= 10) { if ($i <= $j && $i <= 10) { $paging_str .= '<div class="floatLeft paging_bg" onmouseover="javascript:this.className=\'floatLeft paging_bg_hover\'" onmouseout="javascript:this.className=\'floatLeft paging_bg\'"> <div class="paging_node"> <a href="' . $url_path . '?' . $page_name . '=' . $j . '">' . $j . '</a> </div> </div>'; if ($i < 10) { $i++; } } $j++; } if ($i > 201) { $paging_str .= '<div class="floatLeft paging_bg" onmouseover="javascript:this.className=\'floatLeft paging_bg_hover\'" onmouseout="javascript:this.className=\'floatLeft paging_bg\'"> <div class="paging_node"> <a href="' . $url_path . '?' . $page_name . '=200">200</a> </div> </div>'; } elseif ($i < 201) { $paging_str .= '<div class="floatLeft paging_bg"> <div class="paging_node_dot"> ... </div> </div>'; } //Trang sau if ($currentpage < 200) { $paging_str .= '<div class="paging_bg floatLeft " onmouseout="this.className=\'paging_bg floatLeft \'" onmouseover="this.className=\'paging_bg_hover floatLeft \'"> <div class="paging_next"> <a href=\'' . $url_path . '?' . $page_name . '=' . ($currentpage + 1) . '\'>Sau »</a> </div> </div>'; } else { $paging_str .= '<div class="paging_bg_dis floatLeft "> <div class="paging_next_dis"> Sau » </div> </div>'; } $paging_str = ECRewrite::formatUrl($paging_str); return $paging_str; }
function paramListToURL($param_arr,$prefix_url='') { $url = ""; $url_filter = ""; foreach ($param_arr as $key=> $val) { if (!empty($val)) { if ($url != "") $url .= "&$key="; else $url .= "$key="; $url_filter = ""; foreach ($val as $k=> $v) { if ($url_filter != "") $url_filter .= ','; $url_filter .= $v; } $url .= $url_filter; } } $url=$prefix_url.$url;//ngannv=>Theo dõi thêm dấu ? $url=ECRewrite::formatUrl($url); return $url; }
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 user_comment_reply() { $c_user_id = (int) Url::get('c_user_id', 0); $content = trim(EClassApi::getParam('content')); $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) { $comment_user = DB::select('comment_user', "id={$c_user_id}"); if ($comment_user && $comment_user['receiver_user_id'] == User::id() && $comment_user['sender_user_id'] != User::id()) { if ($content) { $json = '({"msg":"success"'; if (EClassApi::checkBadWord($content)) { $json = '({"msg":"bad_word"})'; echo $json; exit; } $user = User::getUser($comment_user['sender_user_id']); if ($user) { $id = DB::insert('comment_user', array('content' => $content, 'time' => TIME_NOW, 'post_ip' => EClassApi::ip(), 'sender_user_id' => User::id(), 'sender_user_name' => User::user_name(), 'receiver_user_id' => $user['id'], 'receiver_user_name' => $user['user_name'], 'is_read' => 0, 'status' => 0)); if ($id) { DB::query('UPDATE account set total_comment_user=total_comment_user+1 WHERE id=' . $user['id']); // so luu but User::getUser($user['id'], 0, 1); if ($user['email'] && $user['email_alert'] && $user['id'] != User::id()) { $link = WEB_ROOT . '?page=shop&user_name=' . $user['user_name'] . '&mode=comment'; $link = ECRewrite::formatUrl($link); EClassApi::addCronJob('user_comment', EClassApi::parseBBCode($content, true), $user['id'], User::user_name(), '', 0, '', $link); } } } if ($comment_user['status'] == 0) { DB::query("UPDATE comment_user SET status=1, is_read=1 WHERE id={$c_user_id}"); //Cập nhật đã đọc - trả lời cho feed DB::query("UPDATE feed SET status = 1 WHERE ref_id = {$c_user_id} AND type=1"); } $json .= "})"; echo $json; exit; } elseif (Url::get('act') == 'reply' && $content == '') { $json = '({"msg":"short_content"})'; echo $json; exit; } } } $json = "({'msg':'no_perm'})"; echo $json; exit; }