Ejemplo n.º 1
0
 function on_submit()
 {
     $id = intval(Url::get('id'));
     $data['name'] = Url::get('name');
     $data['name_en'] = Url::get('name_en');
     if (empty($data['shortcut'])) {
         $data['shortcut'] = strtolower(EClassApi::safe_title($data['name']));
     } else {
         $data['shortcut'] = strtolower(EClassApi::safe_title(Url::get('shorcut')));
     }
     $data['description'] = Url::get('description');
     $data['description_en'] = Url::get('description_en');
     $data['keywords'] = Url::get('keywords');
     $data['is_active'] = Url::get('is_active');
     if (empty($data['name'])) {
         $this->setErrorMessage('news/category/error', 'Tên danh mục không được để trống');
         Url::redirect_current();
         return;
     }
     if (intval($id) == 0) {
         $id = DB::insert('news_category', $data);
         $this->setSuccessMessage('news/category/form', serialize($data));
         $this->setSuccessMessage('news/category/success', 'Lưu thông tin danh mục [' . $data['name'] . '] thành công');
     } else {
         DB::update('news_category', $data, 'id=' . $id);
         $this->setSuccessMessage('news/category/success', 'Cập nhật thông tin danh mục [' . $data['name'] . '] thành công');
     }
     Url::redirect_url('admin_news_category.html?cmd=edit&id=' . $id);
 }
Ejemplo n.º 2
0
 function draw()
 {
     $this->beginForm();
     global $display;
     $user_id = intval(Url::get('user_id'));
     $user_info = DB::select('account', 'id="' . $user_id . '"');
     $display->add('created_time_from', Url::get('created_time_from'));
     $display->add('created_time_to', Url::get('created_time_to'));
     //search theo ngay thang nam
     $created_time_from = 0;
     $created_time_to = 0;
     if (Url::get('created_time_from')) {
         $date_arr = explode('-', Url::get('created_time_from'));
         if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) {
             $created_time_from = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]);
         }
     }
     if (Url::get('created_time_to')) {
         $date_arr = explode('-', Url::get('created_time_to'));
         if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) {
             $created_time_to = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]);
         }
     }
     $search_value = ' 1 ';
     if ($created_time_from) {
         $search_value .= ' AND created_time >= ' . $created_time_from;
     }
     if ($created_time_to) {
         $search_value .= ' AND created_time <= ' . $created_time_to;
     }
     $item_per_page = 50;
     $sql_count = 'SELECT COUNT(id) AS total_item FROM item WHERE user_id = "' . $user_id . '" AND ' . $search_value;
     $total = DB::fetch($sql_count, 'total_item', 0);
     $items = array();
     if ($total) {
         $limit = '';
         require_once ROOT_PATH . 'core/ECPagging.php';
         $paging = ECPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Giao dịch', 'Trang');
         $sql = 'SELECT id,name,created_time,up_time,up_count,user_id,user_name,status FROM item WHERE user_id = "' . $user_id . '" AND ' . $search_value . ' ORDER BY up_time  DESC ' . $limit;
         $result = DB::query($sql);
         if ($result) {
             while ($row = mysql_fetch_assoc($result)) {
                 $row['ebname'] = EClassApi::safe_title($row['name']);
                 $row['up_time'] = date('d/m/y H:i', $row['up_time']);
                 $row['created_time'] = date('d/m/y H:i', $row['created_time']);
                 $row['del_link'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'cmd=delete&id=' . $row['id'] . '&user_id=' . $row['user_id']);
                 $items[$row['id']] = $row;
             }
         }
     } else {
         $paging = '';
     }
     $display->add('user_info', $user_info);
     $display->add('total_item', $total);
     $display->add('items', $items);
     $display->add('paging', $paging);
     $display->output('item_list');
     $this->endForm();
 }
Ejemplo n.º 3
0
 function on_submit()
 {
     $id = intval(Url::get('id'));
     $data['title'] = Url::get('title');
     $data['title_en'] = Url::get('title_en');
     $data['category_id'] = intval(trim(Url::get('category_id', 0)));
     $data['description'] = Url::get('description');
     $data['description_en'] = Url::get('description_en');
     $data['content'] = Url::get('content');
     $data['content_en'] = Url::get('content_en');
     $data['image'] = '';
     $data['keywords'] = Url::get('keywords');
     $data['post_day'] = trim(Url::get('post_day'));
     if (!empty($data['post_day'])) {
         $data['post_day'] = EClassApi::render_time($data['post_day']);
     } else {
         $data['post_day'] = time();
     }
     $data['is_active'] = Url::get('is_active', 0);
     $data['hot_article'] = Url::get('hot_article', 0);
     $data['top_home'] = Url::get('top_home', 0);
     if (empty($data['shortcut'])) {
         $data['shortcut'] = strtolower(EClassApi::safe_title($data['title']));
     } else {
         $data['shortcut'] = strtolower(EClassApi::safe_title(Url::get('shorcut')));
     }
     if (isset($_FILES["file"]) && $_FILES["file"]["size"] > 0) {
         $store_in = 'files/news/' . date('Y/m/d') . '/';
         if (!file_exists($store_in)) {
             mkdir($store_in, 0775, true);
         }
         move_uploaded_file($_FILES["file"]["tmp_name"], $store_in . $_FILES["file"]["name"]);
         $data['image'] = $store_in . $_FILES["file"]["name"];
     } else {
         unset($data['image']);
     }
     if (intval($id) == 0) {
         $data['uid'] = User::id();
         $id = DB::insert('news_item', $data);
         $this->setSuccessMessage('news/item/form', serialize($data));
         $this->setSuccessMessage('news/item/success', 'Lưu thông tin bài viết [' . $data['title'] . '] thành công');
     } else {
         DB::update('news_item', $data, 'id=' . $id);
         $this->setSuccessMessage('news/item/success', 'Cập nhật thông tin bài viết [' . $data['title'] . '] thành công');
     }
     Url::redirect_url('admin_news_item.html?cmd=edit&id=' . $id);
     eb_memcache::do_remove('news_item:' . $id);
 }
Ejemplo n.º 4
0
 function on_submit()
 {
     $type = intval(trim(Url::get('type')));
     $data = Url::get('data');
     if (empty($data['is_active'])) {
         $data['is_active'] = 0;
     }
     if (empty($data['id'])) {
         if (!empty($data['name']) && About::is_exists('name', $data['name'])) {
             $this->setErrorMessage('admin/about/error', 'Exists about with name: ' . $data['name']);
             Url::redirect_url('admin_about.html?cmd=edit_about');
             exit;
         }
         if (empty($data['name'])) {
             $this->setErrorMessage('admin/about/error', 'About name is null ');
             Url::redirect_url('admin_about.html?cmd=edit_about');
             exit;
         }
         $data['created'] = TIME_NOW;
         $path = About::upload_file(EClassApi::safe_title($data['name']));
         if ($path) {
             $data['path'] = $path;
         }
         $id = About::add_about($data);
     } else {
         $path = About::upload_file(EClassApi::safe_title($data['name']));
         if ($path) {
             $data['path'] = $path;
         }
         About::update_about($data['id'], $data);
         $id = $data['id'];
     }
     About::remove_cache($id);
     $add_new = intval(trim(Url::get('add_new', 0)));
     if (empty($add_new)) {
         Url::redirect_url('admin_about.html?cmd=edit_about&id=' . $id);
     } else {
         Url::redirect_url('admin_about.html?cmd=edit_about');
     }
     exit;
 }
Ejemplo n.º 5
0
 function on_submit()
 {
     $type = intval(trim(Url::get('type')));
     $data = Url::get('data');
     if (empty($data['is_active'])) {
         $data['is_active'] = 0;
     }
     if (empty($data['id'])) {
         // if (!empty($data['name']) && Banner::is_exists('name', $data['name'])) {
         //     $this->setErrorMessage('admin/banner/error', 'Exists banner with name: ' . $data['name']);
         //     Url::redirect_url('admin_banner.html?cmd=edit_banner');
         //     exit();
         // }
         // if (empty($data['name'])) {
         //     $this->setErrorMessage('admin/banner/error', 'Banner name is null ');
         //     Url::redirect_url('admin_banner.html?cmd=edit_banner');
         //     exit();
         // }
         $data['created'] = TIME_NOW;
         $path = Banner::upload_file(EClassApi::safe_title($data['name']));
         if ($path) {
             $data['path'] = $path;
         }
         $id = Banner::add_banner($data);
     } else {
         $path = Banner::upload_file(EClassApi::safe_title($data['name']));
         if ($path) {
             $data['path'] = $path;
         }
         Banner::update_banner($data['id'], $data);
         $id = $data['id'];
     }
     Banner::remove_cache($id);
     $add_new = intval(trim(Url::get('add_new', 0)));
     if (empty($add_new)) {
         Url::redirect_url('admin_banner.html?cmd=edit_banner&id=' . $id);
     } else {
         Url::redirect_url('admin_banner.html?cmd=edit_banner');
     }
     exit;
 }
Ejemplo n.º 6
0
 /**
  * Make link fix news
  * 
  * @author MinhNV
  * Date 2010/07/07
  */
 private function makeLinkNews()
 {
     $news_id = Url::get('news_id');
     $news_title = Url::get('news_title');
     $page = 'news_detail';
     $aryParams = array('news_id' => $news_id, 'title' => EClassApi::safe_title($news_title));
     $url_serialize = '';
     $arySerialize = array('page' => $page, 'params' => $aryParams);
     if (is_array($arySerialize) && count($arySerialize) > 0) {
         $url_serialize = serialize($arySerialize);
     }
     $link_url = Url::build($page, $aryParams);
     $aryData = array();
     $aryData['link_news_fix'] = $link_url;
     $aryData['url_serialize'] = $url_serialize;
     $aryData['intIsOK'] = 1;
     echo json_encode($aryData);
     exit;
 }
Ejemplo n.º 7
0
 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;
 }
Ejemplo n.º 8
0
 function getCommentSubItem()
 {
     global $display;
     $winner = array();
     global $user_id_arr, $stt, $item_per_page;
     $stt = 0;
     $is_admin_mod = array();
     $user_arr = array();
     $user_id_arr = array();
     $items = array();
     $limit = '';
     $subItemId = Url::get('subItemId');
     $divID = 'comment_list';
     $cmd = 'pagging_comment';
     $url_path = WEB_DIR . "ajax.php?act=comment&code=getCommentSubItem&show_all=1&id={$subItemId}&cmd=" . $cmd;
     $item_per_page = 100;
     $display->add('show_all', true);
     $pagging = ECPagging::fb_pagging($limit, $item_per_page, true, 'fb_page', $url_path, $divID);
     $sql = "SELECT id, time, content, item_id, sender_email, sender_user_name, sender_user_id, have_child,receiver_user_id,sub_item_id FROM comment WHERE sub_item_id=" . $subItemId . "  AND parent_id = 0 ORDER BY order_time DESC {$limit}";
     /*Đếm tổng số comment cho SubItem*/
     $select_comment_count = "SELECT comment_count FROM item_sub WHERE id={$subItemId} LIMIT 1";
     $subItemResult = DB::fetch($select_comment_count);
     $comment_count = 0;
     if (isset($subItemResult['comment_count']) && $subItemResult['comment_count'] > 0) {
         $comment_count = $subItemResult['comment_count'];
     }
     $display->add('comment_count', $comment_count);
     /*End comment count*/
     $allItems = $this->get_comment_thoitrang($sql);
     if ($allItems) {
         $items = $allItems['item'];
         if ($allItems['id_parent']) {
             $sql_sub = "SELECT id, time, content, item_id, sender_email, sender_user_name, sender_user_id,parent_id,receiver_user_id,sub_item_id FROM comment WHERE parent_id IN({$allItems['id_parent']})  ORDER BY order_time DESC";
             $subComment_all = $this->get_comment_thoitrang($sql_sub, 1);
             if ($subComment_all) {
                 $sub_comments = $subComment_all['item'];
                 foreach ($sub_comments as $id => $subs) {
                     if (isset($items[$id])) {
                         $items[$id]['sub_comment'] = $subs;
                     }
                 }
             }
         }
         unset($allItems);
     }
     if ($stt <= $item_per_page) {
         $pagging = ECPagging::fb_pagging($limit, $item_per_page, false, 'fb_page', $url_path, $divID);
         $display->add('show_fb_page', false);
     } else {
         $display->add('show_fb_page', true);
     }
     if ($user_id_arr) {
         $uid = implode(',', $user_id_arr);
         if ($uid != '') {
             $re = DB::query("SELECT id, avatar_url, gids, block_time, img_server FROM account WHERE id IN({$uid})");
             if ($re) {
                 while ($user = mysql_fetch_assoc($re)) {
                     $user_arr[$user['id']] = $user;
                 }
             }
         }
     }
     if ($items && $user_arr) {
         foreach ($items as &$item) {
             $item['content'] = $this->process_description($item['content']);
             if (isset($item['sub_comment']) && $item['sub_comment']) {
                 foreach ($item['sub_comment'] as &$sub_item) {
                     if ($sub_item['sender_user_id']) {
                         if (isset($user_arr[$sub_item['sender_user_id']])) {
                             $sub_item['avatar_url'] = $user_arr[$sub_item['sender_user_id']]['avatar_url'];
                             $sub_item['block_time'] = $user_arr[$sub_item['sender_user_id']]['block_time'];
                             $sub_item['gids'] = $user_arr[$sub_item['sender_user_id']]['gids'];
                             $sub_item['img_server'] = $user_arr[$sub_item['sender_user_id']]['img_server'];
                         }
                         if ($sub_item['avatar_url']) {
                             $sub_item['sender_avatar_url'] = EClassApi::getImageThumb($sub_item['avatar_url'], 60, 0, 1, $sub_item['img_server']);
                             if ($sub_item['parent_id'] > 0) {
                                 $html_content = '<a href="' . $sub_item['sender_link'] . '"><img src="' . $sub_item['sender_avatar_url'] . '" width="40" class="lazyload"/></a>';
                             } else {
                                 $html_content = '<a href="' . $sub_item['sender_link'] . '"><img src="' . $sub_item['sender_avatar_url'] . '" width="40" class="lazyload"/></a>';
                             }
                         } else {
                             $sub_item['sender_avatar_url'] = 'style/avatar/1.png';
                             $html_content = '<a href="' . $sub_item['sender_link'] . '"><img src="style/avatar/1.png" width="40" height="40" class="lazyload"/></a>';
                         }
                         if ($sub_item['block_time'] > TIME_NOW) {
                             $sub_item['is_block'] = 1;
                         } else {
                             $sub_item['is_block'] = 0;
                         }
                         $sub_item['htmlContent'] = $html_content;
                         //set quyen quan tri
                         if ($sub_item['gids']) {
                             $is_admin_mod = CGlobal::$group[User::check_admin($sub_item['gids'])];
                         } else {
                             $is_admin_mod = array();
                         }
                         $sub_item['is_admin_mod'] = $is_admin_mod;
                     }
                 }
             }
             if ($item['sender_user_id']) {
                 if (isset($user_arr[$item['sender_user_id']])) {
                     $item['avatar_url'] = $user_arr[$item['sender_user_id']]['avatar_url'];
                     $item['block_time'] = $user_arr[$item['sender_user_id']]['block_time'];
                     $item['gids'] = $user_arr[$item['sender_user_id']]['gids'];
                     $item['img_server'] = $user_arr[$item['sender_user_id']]['img_server'];
                 }
                 if ($item['avatar_url']) {
                     $item['sender_avatar_url'] = EClassApi::getImageThumb($item['avatar_url'], 60, 0, 1, $item['img_server']);
                     $html_content = '<a href="' . $item['sender_link'] . '"><img src="' . $item['sender_avatar_url'] . '" width="40"/></a>';
                 } else {
                     $item['sender_avatar_url'] = 'style/avatar/1.png';
                     $html_content = '<a href="' . $item['sender_link'] . '"><img src="style/avatar/1.png" width="40" height="40" /></a>';
                 }
                 $item['htmlContent'] = $html_content;
                 if ($item['block_time'] > TIME_NOW) {
                     $item['is_block'] = 1;
                 } else {
                     $item['is_block'] = 0;
                 }
                 //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;
             }
         }
     }
     $account = null;
     if (User::is_login() && Item::$item['user_id'] == User::id()) {
         $account = User::$current->data;
     } else {
         if (isset(Item::$item['user_id'])) {
             $account = User::getUser(Item::$item['user_id']);
         }
         if (!$account) {
             $account = array('id' => 0, 'user_name' => '', 'create_time' => '', 'blast' => '', 'email' => '', 'show_email' => '', 'skype_id' => '', 'yahoo_id' => '');
         }
     }
     if (User::is_login()) {
         if (User::$current->data['mobile_phone'] != '') {
             $display->add('user_phone', true);
             $user_phone = User::$current->data['mobile_phone'];
         } elseif (User::$current->data['home_phone'] != '') {
             $display->add('user_phone', true);
             $user_phone = User::$current->data['home_phone'];
         } else {
             $display->add('user_phone', false);
             $user_phone = '';
         }
         $display->add('cur_user_name', User::$current->data['user_name']);
         $display->add('cur_created_time', User::$current->data['create_time']);
         $cur_user_name = User::$current->data['user_name'];
         $cur_created_time = User::$current->data['create_time'];
         if (User::$current->data['avatar_url'] == '') {
             $cur_avatar_url = 'style/avatar/1.png';
         } else {
             $cur_avatar_url = EClassApi::getImageThumb(User::$current->data['avatar_url'], 60, 0, 1, User::$current->data['img_server']);
         }
     } else {
         $cur_user_name = '';
         $cur_created_time = '';
         $user_phone = '';
         $cur_avatar_url = 'style/avatar/1.png';
         $display->add('cur_user_name', '');
         $display->add('cur_created_time', '');
         $display->add('check_user_name', '');
         $display->add('user_phone', false);
     }
     $guest_name = 'Số điện thoại';
     $guest_email = 'Email';
     if (isset($_COOKIE['guest_name'])) {
         if ($_COOKIE['guest_name'] == 'undefined' || $_COOKIE['guest_email'] == 'undefined') {
             $guest_name = 'Số điện thoại';
             $guest_email = 'Email';
         } else {
             $guest_name = $_COOKIE['guest_name'];
             $guest_email = $_COOKIE['guest_email'];
         }
     }
     $display->add('cur_user_name', $cur_user_name);
     $display->add('guest_name', $guest_name);
     $display->add('guest_email', $guest_email);
     $display->add('check_user_name', $account['user_name']);
     $display->add('cur_id', (int) User::id());
     $display->add('pagging', $pagging);
     $display->add('item_comments', $items);
     $display->add('item_id', Item::$item['id']);
     $display->add('category_id', Item::$item['category_id']);
     $display->add('item_name', Item::$item['name']);
     //rewrite URL
     $display->add('name_url', EClassApi::safe_title(Item::$item['name']));
     //End rewrite URL
     if (strtolower(Url::get('page')) == 'allfeedback' || Url::get('cmd') == $cmd) {
         echo '<div id="totalReplyCount" style="display:none;">' . @Item::$item['reply_count'] . '</div>';
     }
     $display->output('AllFeedbackList', false, 'AllFeedback');
 }
Ejemplo n.º 9
0
 function build_rss_cat($cat_id = '0', $cat_name = 'home', $limit = 100, $user_id = false)
 {
     $rss2 = '';
     // content of rss2 file
     // start:begin rss2
     $rss2 = '<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel>';
     $rss2 .= '<title>' . $cat_name . ' - Enbac.com</title>';
     $rss2 .= '<description>' . $cat_name . ' - Enbac.com</description>';
     //$rss2.= '<link>'.trim(XMLLib::_xml_encode_attribute(WEB_ROOT.'?page=list_detail&category_id='.$cat_id)).'</link>';
     //$cat_id ? $rss2.= '<link>'.WEB_ROOT.'?page=list_detail&category_id='.$cat_id.'</link>' : $rss2.='<link>'.WEB_ROOT.'?page=list_detail</link>';
     $rss2 .= '<link>' . WEB_ROOT . '</link>';
     //$rss2.= '<link>'.WEB_ROOT.'?page=list_detail&category_id='.$cat_id.'</link>';
     $rss2 .= '<copyright>Enbac.com: http://chonmon.vn , Powered  by Enbac Team: enbac@vccorp.vn</copyright>';
     $rss2 .= '<docs>http://backend.userland.com/rss</docs>';
     $rss2 .= '<generator>Enbac.com:http://chonmon.vn/rss.html</generator>';
     $rss2 .= '<image><title>ChọnMón.vn</title><url>' . WEB_ROOT . 'style/images/logo.gif</url><link>http://chonmon.vn</link><width>290</width><height>65</height></image>';
     //Tối ưu
     if ($user_id) {
         $sql = "SELECT item.id, category_id, item.name, up_time, item.description, item.transaction_type, item.created_time\n\t\t\t\t\t\tFROM item WHERE user_id=" . $user_id . " AND status=1 ORDER BY created_time DESC LIMIT 0,25";
     } else {
         $sqlCate = "SELECT id FROM category WHERE parent_id = {$cat_id}";
         $re = DB::query($sqlCate);
         $strId = "{$cat_id}";
         if ($re) {
             while ($aryId = mysql_fetch_assoc($re)) {
                 $strId .= "," . $aryId['id'];
             }
         }
         $sql = "SELECT id, category_id, name, up_time, description, transaction_type, created_time FROM item WHERE category_id IN({$strId}) AND status=1 ORDER BY created_time DESC LIMIT 0,{$limit}";
     }
     /*$user_id ? $sql = "SELECT item.id, category_id, item.name, up_time, item.description, item.transaction_type, item.created_time
     				FROM item WHERE user_id=".$user_id." AND status=1  
     				ORDER BY created_time DESC LIMIT 0,25"
     		: $sql = "SELECT item.id, category_id, item.name, up_time, item.description, item.transaction_type, item.created_time 
     				FROM item, category 
     				WHERE category.id = item.category_id AND item.status=1 
     				AND (category_id='".$cat_id."' OR category.parent_id='".$cat_id."') 
     				ORDER BY created_time DESC LIMIT 0,".$limit;*/
     $re = DB::query($sql);
     if ($re) {
         while ($item = mysql_fetch_assoc($re)) {
             $page = 'item_detail';
             $item['name'] = trim(XMLLib::_xml_encode_attribute(strip_tags(html_entity_decode($item['name']))));
             $item['description'] = trim(XMLLib::_xml_encode_attribute(strip_tags(html_entity_decode(EClassApi::word_limit($item['description'], 150), ENT_QUOTES, "UTF-8"))));
             //$item['url'] = trim(XMLLib::_xml_encode_attribute(WEB_ROOT."?page=".$page."&id=".$item['id']."&category_id=".$item['category_id']."&ebname=".EClassApi::safe_title($item['name'])));
             $item['url'] = WEB_ROOT . "p" . $item['id'] . "/" . EClassApi::safe_title($item['name']) . ".html";
             //$item['url'] = EClassApi::remove_4_js($item['url']);
             //rss2
             $rss2 .= "<item>";
             $rss2 .= "<title>" . $item['name'] . " - Enbac.com</title>";
             $rss2 .= "<description>(Enbac) - " . $item['description'] . "</description>";
             $rss2 .= "<link>" . $item['url'] . "</link>";
             $rss2 .= '<guid isPermaLink="True">' . $item['url'] . '</guid>';
             $rss2 .= "<pubDate>" . date("D, d M Y H:i:s", $item['created_time']) . " GMT</pubDate>";
             $rss2 .= "</item>";
         }
     }
     //content:end
     // end:begin
     $rss2 .= '</channel></rss>';
     // end:end
     return $rss2;
 }
Ejemplo n.º 10
0
Archivo: seo.php Proyecto: hqd276/bigs
	
	foreach (array_keys(CGlobal::$subCategories) as $top_id){
		if(isset(CGlobal::$allCategories[$top_id]) && CGlobal::$allCategories[$top_id]){
			$ebname = EClassApi::safe_title(CGlobal::$allCategories[$top_id]['name']);
			
			$sitemap.="\n".'<url><loc>'.$web_root.'c'.$top_id.'/'.$ebname.'.html</loc><changefreq>Daily</changefreq><priority>1.0</priority></url>';		
			$sitemap.="\n".'<url><loc>'.$web_root.'c'.$top_id.'/'.$ebname.'/page-2.html</loc><changefreq>Daily</changefreq><priority>1.0</priority></url>';
			
			
			//UrlList:
			$urllist.="\n".$web_root."c".$top_id."/".$ebname.".html";
			$urllist.="\n".$web_root."c".$top_id."/".$ebname."/page-2.html";
			
			if(CGlobal::$subCategories[$top_id])
			foreach (CGlobal::$subCategories[$top_id] as $cat_levl_2){
				$ebname_sub ="-".EClassApi::safe_title($cat_levl_2['name']);
				$ebname_all = $ebname.$ebname_sub;	
				
				$sitemap.="\n".'<url><loc>'.$web_root.'c'.$cat_levl_2['id'].'/'.$ebname_all.'.html</loc><changefreq>Daily</changefreq><priority>1.0</priority></url>';
				$sitemap.="\n".'<url><loc>'.$web_root.'c'.$cat_levl_2['id'].'/'.$ebname_all.'/page-2.html</loc><changefreq>Daily</changefreq><priority>1.0</priority></url>';
				
				//UrlList:
				$urllist.="\n".$web_root."c".$cat_levl_2['id']."/".$ebname_all.".html";
				$urllist.="\n".$web_root."c".$cat_levl_2['id']."/".$ebname_all."/page-2.html";
			}
		}
	}
	
	$sitemap.="\n".'</urlset>';
	file_put_contents("sitemap.xml",$sitemap);
	file_put_contents("urllist.txt",$urllist);
Ejemplo n.º 11
0
 static function get_by_ids($ids)
 {
     $res = DB::query('SELECT id, name, shortcut FROM news_category WHERE id IN (' . $ids . ') AND is_active = 1 ORDER BY id DESC');
     $list = array();
     while ($row = mysql_fetch_assoc($res)) {
         if (empty($row['shortcut'])) {
             $row['shortcut'] = strtolower(EClassApi::safe_title($row['name']));
         }
         if (empty($row['name_en'])) {
             $row['name_en'] = $row['name'];
         }
         $list[] = $row;
     }
     mysql_free_result($res);
     return $list;
 }
Ejemplo n.º 12
0
    function invalid_item()
    {
        if (!User::is_login()) {
            echo "not_login";
            exit;
        } else {
            $item_id = (int) Url::get('id');
            $item_type = (int) Url::get('type', 2);
            if ($item_id) {
                $item = Item::get_item($item_id);
                $item_memcache = $item;
            } else {
                $item = array();
            }
            if ($item && (User::have_permit(ADMIN_ITEM) || User::have_cat_permit($item['category_id']))) {
                $type = 2;
            } elseif (!User::have_permit(ADMIN_ITEM) && User::is_low_mod()) {
                $type = 3;
            }
            if (!User::have_permit(ADMIN_ITEM) && User::is_low_mod() && DB::count('bad_content', 'id_item =' . $item_id . ' AND type = 3 AND user_id = ' . User::id())) {
                echo "dup_invalid";
                exit;
            }
            $reason = EClassApi::getParam('reason');
            if (User::is_low_mod() && !$reason) {
                echo "empty";
                exit;
            }
            $reason = $reason ? $reason : "Tin đang bị kiểm duyệt";
            $arr_data = array('type' => $type, 'id_item' => $item_id, 'user_id' => User::id(), 'user_name' => User::user_name(), 'reason' => $reason, 'time_post' => TIME_NOW);
            if (!User::have_permit(ADMIN_ITEM) && User::is_low_mod() && DB::insert('bad_content', $arr_data)) {
                echo "success_invalid";
                exit;
            }
            if ($item && (User::have_permit(ADMIN_ITEM) || User::have_cat_permit($item['category_id'])) && DB::insert('bad_content', $arr_data)) {
                EClassApi::getCats();
                $link_help = 'http://help.chonmon.vn/index.php/Trang_%C4%91%E1%BA%A7u';
                /*if (CGlobal::$allCategories[$item['category_id']]['link_help']){
                			$link_help = CGlobal::$allCategories[$item['category_id']]['link_help'];
                		}
                		elseif (isset(CGlobal::$allCategories[$item['category_id']]['parent_id']) && CGlobal::$allCategories[CGlobal::$allCategories[$item['category_id']]['parent_id']]['link_help'])
                		{
                			$link_help = CGlobal::$allCategories[CGlobal::$allCategories[$item['category_id']]['parent_id']]['link_help'];
                		}*/
                switch ($item['level_1_category_id']) {
                    case "30":
                    case "1":
                    case "31":
                    case "107":
                    case "78":
                    case "51":
                        //$link_help = 'http://help.chonmon.vn/index.php/Quy_%C4%91%E1%BB%8Bnh_ki%E1%BB%83m_duy%E1%BB%87t_tin_m%E1%BB%A5c_Th%E1%BB%9Di_trang_Nam/_N%E1%BB%AF%2C_Teen%2C_M%E1%BA%B9_v%C3%A0_b%C3%A9%2C_Gi%C3%A0y_d%C3%A9p_n%E1%BB%AF%2C_M%E1%BB%B9_ph%E1%BA%A9m_trang_s%E1%BB%A9c';
                        $link_help = 'http://blog.chonmon.vn/2010/12/07/quy-dinh-kiem-duyet-tin-muc-thoi-trang-nam-nu-teen-do-made-in-vnme-va-be-giay-dep-nu-my-pham-trang-suc.html';
                        break;
                    case "451":
                    case "105":
                    case "592":
                    case "447":
                    case "100":
                        //$link_help = 'http://help.chonmon.vn/index.php/Quy_%C4%91%E1%BB%8Bnh_ki%E1%BB%83m_duy%E1%BB%87t_tin_m%E1%BB%A5c_N%E1%BB%99i_th%E1%BA%A5t_gia_%C4%91%C3%ACnh/_V%C4%83n_ph%C3%B2ng%2C_%C4%90%E1%BB%93_d%C3%B9ng_b%E1%BA%BFp%2C_V%E1%BA%ADt_li%E1%BB%87u_x%C3%A2y_d%E1%BB%B1ng%2C_Ph%C3%B2ng_t%E1%BA%AFm_v%C3%A0_v%E1%BB%87_sinh';
                        $link_help = 'http://blog.chonmon.vn/2010/12/07/quy-dinh-kiem-duyet-tin-muc-noi-that-gia-dinhvan-phong-do-dung-bep-vat-lieu-xay-dung-phong-tam-ve-sinh.html';
                        break;
                    case "83":
                    case "541":
                        //$link_help = 'http://help.chonmon.vn/index.php/Quy_%C4%91%E1%BB%8Bnh_ki%E1%BB%83m_duy%E1%BB%87t_tin_m%E1%BB%A5c_%C4%90i%E1%BB%87n_tho%E1%BA%A1i%2C_Ch%E1%BB%A3_sim';
                        $link_help = 'http://blog.chonmon.vn/2010/10/07/quy-dinh-kiem-duyet-tin-muc-dien-thoai-cho-sim.html';
                        break;
                    case "104":
                        //$link_help = 'http://help.chonmon.vn/index.php/Quy_%C4%91%E1%BB%8Bnh_ki%E1%BB%83m_duy%E1%BB%87t_tin_m%E1%BB%A5c_H%C3%A0ng_hi%E1%BB%87u';
                        $link_help = 'http://blog.chonmon.vn/2010/12/07/quy-dinh-kiem-duyet-tin-muc-hang-hieu.html';
                        break;
                    case "331":
                    case "332":
                    case "335":
                    case "337":
                        //$link_help = 'http://help.chonmon.vn/index.php/Quy_%C4%91%E1%BB%8Bnh_ki%E1%BB%83m_duy%E1%BB%87t_tin_m%E1%BB%A5c_%C3%94_t%C3%B4';
                        $link_help = 'http://blog.chonmon.vn/2010/12/07/quy-dinh-kiem-duyet-muc-o-to.html';
                        break;
                    case "79":
                        //$link_help = 'http://help.chonmon.vn/index.php/Quy_%C4%91%E1%BB%8Bnh_ki%E1%BB%83m_duy%E1%BB%87t_tin_m%E1%BB%A5c_%C4%90i%E1%BB%87n_m%C3%A1y';
                        $link_help = 'http://blog.chonmon.vn/2010/06/07/quy-dinh-kiem-duyet-tin-muc-dien-may-dien-tu-am-thanh-dien-thoai-cho-sim-laptop-va-may-tinh-ky-thuat-so-thiet-bi-vp-va-may-cong-nghiep.html';
                        break;
                    case "103":
                    case "579":
                    case "571":
                        $link_help = 'http://blog.chonmon.vn/2010/06/07/quy-dinh-kiem-duyet-muc-nha-dat.html';
                        break;
                    case "514":
                    case "521":
                        $link_help = 'http://blog.chonmon.vn/2010/12/07/quy-dinh-kiem-duyet-tin-muc-dich-vu-dv-lam-dep-dv-dien-may.html';
                        break;
                    case "109":
                    case "101":
                        $link_help = 'http://blog.chonmon.vn/2010/12/07/quy-dinh-kiem-duyet-tin-muc-tong-hop-di-cho-online.html';
                        break;
                }
                DB::query("DELETE FROM bad_content WHERE type = 3 AND id_item = " . $item_id);
                DB::query("UPDATE item SET status = " . $item_type . " , valid_time=" . TIME_NOW . ', valid_user="******" WHERE id = ' . $item_id);
                if (SORL_FILTER_ON) {
                    $solr = new Solr_Search();
                    $solr->doUpdateItem($item_id);
                }
                if (MEMCACHE_ON) {
                    $item_memcache['status'] = $item_type;
                    $item_memcache['valid_time'] = TIME_NOW;
                    $item_memcache['valid_user'] = User::user_name();
                    eb_memcache::do_put("item:{$item_id}", $item_memcache);
                }
                $receiver_user_id = (int) Url::get('receiver_user_id');
                $receiver_user = DB::select('account', 'id = ' . $receiver_user_id);
                $title_pm = 'Thông báo từ EClass';
                /**Hoặc  [url=http://blog.chonmon.vn/?p=28][b] vào đây [/b][/url] để xem hướng dẫn đăng tin*/
                /*WEB_ROOT.ECRewrite::formatUrl('?page=item_detail&id='.$item_id.'&ebname='.EClassApi::safe_title($item['name'])).']'.$item['name']*/
                $urlItem = Url::build('item_detail', array('id' => $item_id, 'ebname' => EClassApi::safe_title($item['name'])));
                $content_pm = 'Tin [url=' . $urlItem . '][b] ' . $item['name'] . ' [b][/url] của bạn đã bị kiểm duyệt với lý do: ' . $reason . '
				Bạn click [url=' . $link_help . '][b]vào đây[/b][/url] để xem quy định đăng tin!
				Đề nghị bạn hãy sửa lại tin này cho hợp lệ.
				
				Xin cảm ơn bạn.
				
				Vui lòng không trả lời tin nhắn này!';
                if (User::$current->data['signature']) {
                    $content_pm .= '<br /><hr /><br />Mọi thắc mắc vui lòng liên hệ theo số ĐT: 04.39743410 - Số máy lẻ: ' . User::$current->data['signature'];
                }
                $id_mess = EClassApi::Send_pm(User::id(), User::user_name(), $receiver_user, $title_pm, $content_pm, TRUE);
                $from = EClassApi::getParam('from');
                if ($from == 'admin') {
                    echo EClassApi::getParam('receiver_user_id') . '_' . $item_id;
                } else {
                    echo $item_id;
                }
            } else {
                echo "fail";
            }
        }
        exit;
    }
Ejemplo n.º 13
0
 function show_log_up_item()
 {
     $item_id = (int) Url::get('item_id', 0);
     if ($item_id > 0 && User::is_login() && !User::is_block()) {
         $log_ups = array();
         $item = Item::get_item($item_id);
         if ($item) {
             if (User::id() == $item['user_id']) {
                 global $display;
                 $re = DB::query("SELECT * FROM up_item_log WHERE item_id={$item_id} ORDER BY id DESC LIMIT 200");
                 if ($re) {
                     $stt = 1;
                     while ($log_up = mysql_fetch_assoc($re)) {
                         $log_up['stt'] = $stt++;
                         $log_up['up_time'] = date('d.m.Y H\\hi:s', $log_up['up_time']);
                         if ($log_up['up_id']) {
                             $log_up['type'] = '<font color=green><b>Up tự động</b></font>';
                         } else {
                             $log_up['type'] = 'Thành viên up';
                         }
                         $arr = explode(' ', $log_up['run_order']);
                         $log_up['run_order'] = $arr[0];
                         if ($log_up['status'] == 0) {
                             $log_up['status'] = '<font color="orange">Chưa kích hoạt</font>';
                         } elseif ($log_up['status'] == 1) {
                             $log_up['status'] = '<font color="green">Hoạt động</font>';
                         } elseif ($log_up['status'] == 2) {
                             $log_up['status'] = '<font color="brown">Hết lượt up</font>';
                         } elseif ($log_up['status'] == 3) {
                             $log_up['status'] = '<span title="Tạm ngừng do tin bị xoá hoặc kiểm duyệt"><font color="red">Tạm ngừng</font></span>';
                         }
                         $log_up['del_link'] = Url::build_current(array('cmd' => 'del_log', 'log_id' => $log_up['id']));
                         $log_up['href'] = '?page=item_detail&id=' . $log_up['item_id'];
                         $log_up['item_c_time'] = '';
                         $log_up['item_up_time'] = '';
                         $log_ups[] = $log_up;
                     }
                 }
                 if ($log_ups) {
                     $display->add('item_id', $item['id']);
                     $display->add('item_name', $item['name']);
                     $display->add('post_time', date('H\\hi d.m.Y', $item['created_time']));
                     $display->add('up_time', date('H\\hi d.m.Y', $item['up_time']));
                     $display->add('item_url', Url::build('item_detail', array('id' => $item['id'], 'ebname' => EClassApi::safe_title($item['name']))));
                     $display->add('log_ups', $log_ups);
                     $display->output('UpTinLog', false, 'Personal');
                     System::halt();
                 }
             }
         }
     }
     echo 'no_log';
     exit;
 }
Ejemplo n.º 14
0
    static function auto_gencode() {
        $code = strtoupper(EClassApi::safe_title(User::$current->data['full_name'])).time();

        return $code;
    }
Ejemplo n.º 15
0
 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;
 }