Ejemplo n.º 1
0
 function draw()
 {
     global $display;
     $this->beginForm(false, 'post', false, "?" . htmlentities($_SERVER['QUERY_STRING']));
     $user = $this->user;
     if ($user['email_alert'] == 0) {
         $user['email_alert'] = '';
     } else {
         $user['email_alert'] = '(Newsletter registered)';
     }
     if ($user['avatar_url'] != "") {
         $user['avatar_url'] = '<img src="' . EClassApi::getImageThumb($user['avatar_url'], 100, 100, 0, $user['img_server']) . '" />';
     } else {
         $user['avatar_url'] = '<img src="style/images/no_avatar_item.gif" width="94" height="94" />';
     }
     $user['create_time'] = date('d/m/y H:i', $user['create_time']);
     if ($user['block_time'] > TIME_NOW || $user['block_time'] == -1) {
         if ($user['block_time'] != -1) {
             $user['status'] = "<font color=red><b>" . date('H:i d/m/y', $user['block_time']) . '</b></font>';
         } else {
             $user['status'] = '<font color=red><b>Locked</b></font>';
         }
     } elseif ($user['invalid_time']) {
         $user['status'] = "<font color=red><b>Censored</b></font>";
     } else {
         $user['status'] = "Active";
     }
     $display->add('msg', $this->showFormErrorMessages(1));
     $display->add('user', $user);
     $display->add('user', $user);
     $display->add('root', User::is_root());
     $display->add('is_root', User::have_permit('user_note') || User::is_root());
     $coin_note = trim(Url::get('coin_note'));
     $error_message = $this->getErrorMessage('admin/user/error');
     $display->add('error_message', $error_message);
     $display->add('coin_note', $coin_note);
     $display->add('can_edit_uname', User::is_root() || User::have_permit('change_user_name'));
     $display->output('UserDetail');
     $this->endForm();
 }
Ejemplo n.º 2
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.º 3
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.º 4
0
    function get_gallery_entry() {
        if (User::is_login()) {
            global $display;
            if ((User::have_permit(ADMIN_ITEM) || User::is_mod_cat()) && (int) Url::get('user_id', 0) && (int) Url::get('user_id', 0) != User::id()) {
                $user_id = (int) Url::get('user_id', 0);
                $display->add('user_id', $user_id);
            }
            else
                $user_id=User::id();

            $search_value = ' user_id=' . $user_id . ' AND root_id=0 ';

            //search theo ngay thang nam
            //$year=(int)Url::get('year',date('Y'));
            $year = (int) Url::get('year', -1);
            //$mon= (int)Url::get('month',(int)date('m'));
            $mon = (int) Url::get('month', -1);
            $day = (int) Url::get('day', -1);

            if ($year == 0

                )$year = -1;
            if ($mon == 0

                )$mon = -1;
            if ($day == 0

                )$day = -1;

            $created_time_from = 0;
            $created_time_to = 0;

            if ($year != -1) {
                if ($mon != -1) {
                    if ($day != -1) {
                        $created_time_from = mktime(0, 0, 0, $mon, $day, $year);
                        $created_time_to = mktime(23, 59, 59, $mon, $day, $year);
                    } else {
                        $max_day = 31;
                        if (in_array($mon, array(4, 6, 9, 11))
                        
                            )$max_day = 30;
                        elseif ($mon == 2)
                            ($year % 4) ? $max_day = 28 : $max_day = 29;

                        $created_time_from = mktime(0, 0, 0, $mon, 1, $year);
                        $created_time_to = mktime(23, 59, 59, $mon, $max_day, $year);
                    }
                }
                else {
                    $created_time_from = mktime(0, 0, 0, 1, 1, $year);
                    $created_time_to = mktime(23, 59, 59, 12, 31, $year);
                }
            }

            $y_arr = array(-1 => '-Lọc theo Năm-');
            for ($i = 2008; $i <= date('Y'); $i++) {
                $y_arr[$i] = "---Năm $i-";
            }
            $m_arr = array(-1 => '-Lọc theo Tháng-');
            for ($i = 1; $i <= 12; $i++) {
                $m_arr[$i] = "---Tháng $i-";
            }
            $d_arr = array(0 => '-Lọc theo Ngày-');
            for ($i = 1; $i <= 31; $i++) {
                $d_arr[$i] = "---Ngày $i-";
            }

            $display->add('option_year', EClassApi::getOption($y_arr, $year));
            $display->add('option_month', EClassApi::getOption($m_arr, $mon));
            $display->add('option_day', EClassApi::getOption($d_arr, $day));

            if ($created_time_from) {
                $search_value .= ' AND time >= ' . $created_time_from;
            }
            if ($created_time_to) {
                $search_value .= ' AND time <= ' . $created_time_to;
            }

            $keywords = EClassApi::trimSpace(EClassApi::getParam('keywords'));
            $display->add('keywords', $keywords);

            if ($keywords) {
                $search_value .= ' AND des LIKE "%' . $keywords . '%" ';
            }

            $item_per_page = 20;

            $sql_count = 'SELECT count(*) AS total_img FROM item_image WHERE ' . $search_value;
            $total = DB::fetch($sql_count, 'total_img', 0);

            $paging = '';
            $items = array();

            $gallery_url = WEB_DIR . 'ajax.php' . Url::build_all(array('page_no'));

            if ($total) {
                $limit = '';
                $paging = AjaxGalleryPaging($limit, $total, $item_per_page, 5, $gallery_url, 'gallery_content');
                $sql = 'SELECT id, des, item_id, title, img_server, original_image_url, time FROM `item_image` WHERE ' . $search_value . ' ORDER BY id DESC ' . $limit;
                $re = DB::query($sql);

                if ($re) {
                    while ($row = mysql_fetch_assoc($re)) {
                        $row['image_url'] = $row['original_image_url'];
                        $row['original_image_url'] = EClassApi::getImageThumb($row['original_image_url'], 100, 100, 0, $row['img_server']);
                        $items[$row['id']] = $row;
                    }
                }
            }

            $display->add('items', $items);
            $display->add('total', $total);
            $display->add('paging', $paging);
            $display->output('gallery_ajax_entry', false, 'Personal');
            System::halt();
        } else {
            echo "Bạn chưa đăng nhập hoặc đã thoát khỏi hệ thống - Hãy đăng nhập lại!";
        }
    }
Ejemplo n.º 5
0
 function getNoteItem()
 {
     if (!User::is_login()) {
         $json['msg'] = 'no_login';
         die(json_encode($json));
     }
     $userId = User::id();
     $select = 'SELECT id,img_id,item_name,img_server,item_url,img_url,user_id,item_price FROM img_save';
     $where = ' WHERE user_id = ' . $userId;
     $order_by = ' ORDER BY id DESC';
     $limit = ' LIMIT 6 ';
     $sql = $select . $where . $order_by . $limit;
     $items = array();
     $re = DB::query($sql);
     if ($re) {
         $noteItem = array();
         while ($item = mysql_fetch_assoc($re)) {
             $item['price'] = $item['item_price'];
             $item['title'] = EClassApi::subString(EClassApi::filter_title($item['item_name']), 0, 40, true);
             $item['des'] = EClassApi::subString(EClassApi::filter_title($item['item_name']), 0, 42, true);
             /*$item['name'] 				= EClassApi::word_limit($item['name'],12,'');*/
             $item['img56'] = $item['img_url'] ? EClassApi::getImageThumb($item['img_url'], 56, 56, 0, $item['img_server']) : 'style/images/no-images-69x53.jpg';
             $item['href'] = $item['item_url'];
             $noteItem[] = $item;
         }
         $json['msg'] = 'success';
         $json['data'] = $noteItem;
         die(json_encode($json));
     }
 }
Ejemplo n.º 6
0
 public function getItemAdvertiseById($id)
 {
     $item = '';
     if (MEMCACHE_ON) {
         $item = eb_memcache::do_get('item_advertise_widget_' . $id);
     }
     if (!$item) {
         $result = DB::query("SELECT * FROM advertise WHERE status = 1 AND id = {$id}");
         $item = array();
         if ($result) {
             while ($row = mysql_fetch_assoc($result)) {
                 $row['image'] = EClassApi::getImageThumb($row['images'], 130, 110, 0, IMAGE_SERVER_NO);
                 $row['price'] = EClassApi::numberFormat($row['price']);
                 $item = $row;
             }
             eb_memcache::do_put('item_advertise_widget_' . $id, $item);
         }
     }
     return $item;
 }
Ejemplo n.º 7
0
 function get_trans_notify_bar()
 {
     EClassApi::getCats();
     $json = "";
     if (!User::is_login()) {
         $json = '({"msg":"no_login"})';
         echo $json;
         exit;
     }
     if (User::is_login()) {
         EClassApi::getCats();
         //Notify bar
         // danh sach giao dich
         $select = 'SELECT id, name, category_id, level_1_category_id, original_image_url, read_count, up_time, img_server FROM item WHERE status = 1 AND user_id=' . User::id() . ' ORDER BY shop_order, up_time DESC LIMIT 0,50';
         $re = DB::query($select);
         $items = array();
         if ($re) {
             $json = '';
             while ($item = mysql_fetch_assoc($re)) {
                 $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['href'] = WEB_DIR . EClassApi::safe_title($cat_name) . "/p{$item['id']}/{$ebname}.html";
                 } else {
                     $item['href'] = WEB_DIR . "/p{$item['id']}/{$ebname}.html";
                 }
                 if ($item['original_image_url']) {
                     $item['original_image_url'] = EClassApi::getImageThumb($item['original_image_url'], 60, 0, 1, $item['img_server']);
                 } else {
                     $item['original_image_url'] = 'style/images/no-images-69x53.jpg';
                 }
                 $item['up_time'] = date('H:i | d-m-Y', $item['up_time']);
                 $json .= '{"id":"' . $item['id'] . '","read_count":"' . $item['read_count'] . '","time":"' . $item['up_time'] . '","name":"' . $item['name'] . '","link":"' . $item['href'] . '","images":"' . $item['original_image_url'] . '"},';
             }
             if ($json) {
                 $json = '[' . substr($json, 0, -1) . ']';
             } else {
                 $json = '({"msg":"no_trans"})';
             }
         }
         echo $json;
         exit;
     }
 }