Ejemplo n.º 1
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.º 2
0
 function mini_profile()
 {
     $user_ids = EClassApi::getParam('user_ids');
     if ($user_ids) {
         $page_num = EClassApi::getParam('page_num');
         $st = '({';
         $topTxt = '';
         $sql = 'SELECT account.id, user_name, full_name, blast, create_time, address, mobile_phone, yahoo_id, show_email, email, website
                 FROM account WHERE id IN (' . $user_ids . ')';
         $re = DB::query($sql);
         $i = 0;
         if ($re) {
             while ($user = mysql_fetch_assoc($re)) {
                 $user_id = $user['id'];
                 if ($i > 0) {
                     $st .= ',';
                 }
                 $i++;
                 $topTxt = '';
                 if ($user) {
                     $subDir = 'item_user/' . floor($user_id / 1000);
                     $cachefile = 'top_item_' . $user_id;
                     // start cache
                     if (StaticCache::notExistCache($cachefile, 600, true, $subDir)) {
                         StaticCache::startCache();
                         $top_items = EClassApi::getTopItem($user_id);
                         if ($top_items) {
                             $topItem = '<div class=\'miniTopList\'>Giao dịch mới nhất:</div><div class=\'listCheap\'>';
                             foreach ($top_items as $item) {
                                 $link = WEB_DIR . ECRewrite::formatUrl("?page=item_detail&id=" . $item['id'] . "&ebname=" . EClassApi::safe_title($item['name']));
                                 $topItem .= '<div><span class=\'miniNews\'><a href=\'' . $link . '\' target=\'_blank\'>' . EClassApi::subString(stripslashes($item['name']), 0, 40, true) . '</a></span></div>';
                             }
                             $topItem .= '</div>';
                             echo $topItem;
                         }
                         StaticCache::endCache();
                     }
                     $topTxt = StaticCache::$curentContent;
                     // end cache
                     $user['blast'] = EClassApi::remove_4_js(EnbacLib::BBCode(EClassApi::cleanHtml($user['blast'])));
                     if (trim($user['blast'])) {
                         $user['blast'] = ' ' . $user['blast'];
                         if (strpos($user['blast'], 'http://')) {
                             $user_blast = $user['blast'];
                             while (strpos($user_blast, 'http://')) {
                                 $tmp = substr($user_blast, strpos($user_blast, 'http://'));
                                 if (strpos($tmp, ' ')) {
                                     $blast_url = substr($tmp, 0, strpos($tmp, ' '));
                                 } else {
                                     $blast_url = $tmp;
                                 }
                                 $user_blast = str_replace($blast_url, '', $user_blast);
                             }
                             $new_blast_url = ' <a href=\'' . $blast_url . '\' target=\'_blank\'>Click here</a>';
                             $user['blast'] = substr($user_blast . $new_blast_url, 1);
                         }
                     }
                     if ($user['blast'] == '') {
                         $user['blast'] = '...';
                     }
                     if ($user['website'] == '') {
                         $user['website'] = '';
                     } else {
                         $user['website_url'] = $user['website'];
                         if (strrpos($user['website_url'], 'ttp://') != 1) {
                             $user['website_url'] = 'http://' . $user['website_url'];
                         }
                         if (strlen($user['website']) > 8) {
                             if (strpos($user['website'], '/', 8) > 0) {
                                 $user['website'] = substr($user['website'], 0, strpos($user['website'], '/', 8));
                             }
                         }
                         $user['website'] = '<a href=\'' . $user['website_url'] . '\' target=\'_blank\' class=\'lineHeight15\'><strong>' . $user['website'] . '</strong></a>';
                     }
                     $st .= '"' . $user_id . '" : {';
                     $st .= '"user_id": "' . $user_id . '",';
                     $st .= '"user_name": "' . $user['user_name'] . '",';
                     $st .= '"sender_link": "' . Url::build('shop', array('user_name' => $user['user_name'])) . '",';
                     $st .= '"blast": "' . $user['blast'] . '",';
                     $st .= '"total_score": "0",';
                     $st .= '"full_name": "' . stripslashes($user['full_name']) . '",';
                     $st .= '"create_time": "' . date('d-m-Y', $user['create_time']) . '",';
                     $st .= '"address": "' . stripslashes($user['address']) . '",';
                     $st .= '"mobile_phone": "' . stripslashes($user['mobile_phone']) . '",';
                     $st .= '"yahoo_id": "' . stripslashes($user['yahoo_id']) . '",';
                     $st .= '"email": "' . ($user['show_email'] == 1 ? stripslashes($user['email']) : '') . '",';
                     $st .= '"website": "' . ($user['website'] ? stripslashes($user['website']) : '') . '",';
                     $st .= '"top_item": "' . addslashes($topTxt) . '"';
                     $st .= '}';
                 }
             }
         }
         $st .= '})';
     } else {
         $st = '({})';
     }
     header("content-type: text/javascript");
     echo $st;
     System::halt();
 }