Exemplo n.º 1
0
 static function delete_item_physical($id)
 {
     $item = Item::get_item($id);
     if ($item && (User::is_admin() || $item['user_id'] == User::id())) {
         // xoa comment
         DB::update('item_image', array("item_id" => 0), "item_id={$id} AND root_id=0");
         //Cập nhật các ảnh gốc
         DB::delete('item_image', "item_id={$id} AND root_id>0");
         //Xoá các ảnh ko fải ảnh gốc
         DB::delete('item', 'id=' . $id);
         //Loại item khỏi Memcache
         Item::get_item($id, 1);
     }
 }
Exemplo n.º 2
0
 function ItemRelate($row)
 {
     Module::Module($row);
     if (Item::$id == -1) {
         Item::$id = (int) Url::get('id', 0);
         Item::$item = Item::get_item(Item::$id);
     }
     AZLib::checkItem();
     if (Item::$item) {
         if (Item::$item['display']) {
             require_once 'forms/ItemRelate.php';
             $this->add_form(new ItemRelateForm());
         }
     }
 }
Exemplo n.º 3
0
 function ItemDetail($row)
 {
     Module::Module($row);
     require_once 'core/se.php';
     if (Item::$id == -1) {
         Item::$id = (int) Url::get('id', 0);
         Item::$item = Item::get_item(Item::$id);
     }
     AZLib::checkItem();
     if (Item::$item) {
         if (Item::$item['display']) {
             if (REWRITE_ON) {
                 //tuannk add 2010.07.28 fix redirect 301 với các url link sai
                 $nice_name1 = '';
                 if (Item::$item['category_id'] && isset(CGlobal::$allCategories[Item::$item['category_id']]) && CGlobal::$allCategories[Item::$item['category_id']]) {
                     $nice_name1 = CGlobal::$allCategories[Item::$item['category_id']]['nice_name'];
                 }
                 $url_detail = WEB_DIR . $nice_name1 . "/p" . Item::$item['id'] . "/" . AZLib::safe_title(Item::$item['name']) . ".html";
                 if ($nice_name1 != '' && strpos($_SERVER['REQUEST_URI'], $url_detail) !== 0) {
                     Url::redirect_url($url_detail, 301);
                 }
             }
             CGlobal::$website_title = Item::$item['name'];
             CGlobal::$website_title .= ' - ' . AZLib::titlePath(Item::$item['category_id']);
             if (Item::$item['status'] == 2) {
                 if (User::have_permit(ADMIN_ITEM)) {
                     CGlobal::$website_title = 'Tin đang ẩn';
                 } else {
                     Item::$item['display'] = 0;
                 }
             }
             Item::update_read_count();
         }
     }
     require_once 'forms/ItemDetail.php';
     $this->add_form(new ItemDetailForm());
 }
Exemplo n.º 4
0
 function draw()
 {
     global $display;
     AZLib::getCats();
     $this->beginForm();
     $item = Item::get_item($this->booking_vip['item_id']);
     if (!$item || $item && $item['status'] == -1) {
         $this->setFormError("item_id", "Tin không tồn tại!");
     } else {
         $display->add('item_name', stripslashes($item['name']));
         $display->add('item_link', Url::build('item_detail', array('id' => $item['id'], 'ebname' => AZLib::safe_title($item['name']))));
     }
     $top_catid = $item['level_1_catid'];
     $cat_id = $item['category_id'];
     $display->add('msg', $this->showFormErrorMessages(1));
     $display->add('item_id', $this->booking_vip['item_id']);
     if ($this->booking_vip['top_cat']) {
         $display->add('category', 1);
     } else {
         if ($this->booking_vip['cat_id']) {
             $display->add('category', 2);
         }
     }
     $display->add('num_contract', $this->booking_vip['num_contract']);
     $display->add('top_cat_name', CGlobal::$allCategories[$top_catid]['name']);
     $display->add('cat_name', CGlobal::$allCategories[$cat_id]['name']);
     $display->add('note', stripslashes(Url::get("note", $this->booking_vip['note'])));
     $display->add('time_start', Url::get("time_start", date('d-m-Y', $this->booking_vip['time_start'])));
     if ($this->booking_vip['time_end']) {
         $display->add('time_end', Url::get("time_end", date('d-m-Y', $this->booking_vip['time_end'])));
     } else {
         $display->add('time_end', Url::get("time_end", ''));
     }
     $display->output('EditBookingVip');
     $this->endForm();
 }
Exemplo n.º 5
0
 function ManageBookingVip($row)
 {
     Module::Module($row);
     if (User::have_permit(ADMIN_VIP_ITEM) || User::have_permit(ADMICRO_BOOKING_VIP)) {
         $cmd = Url::get('cmd');
         switch ($cmd) {
             case '':
                 require_once 'forms/ManageBookingVip.php';
                 $this->add_form(new ManageBookingVipForm());
                 break;
             case 'add':
                 require_once 'forms/AddBookingVip.php';
                 $this->add_form(new AddBookingVipForm());
                 break;
             case 'active':
                 if (User::have_permit(ADMIN_VIP_ITEM)) {
                     $id = (int) Url::get("id", 0);
                     if ($id) {
                         $booking_vip = DB::select("bookings_vip", "id={$id}");
                     }
                     $booking_vip['top_cat'] != 0 ? $cat_id = $booking_vip['top_cat'] : ($cat_id = $booking_vip['cat_id']);
                     $item_vip = DB::select_all('item_vip', "(catid = {$cat_id} OR level_1_catid = {$cat_id}) AND status = 1");
                     $i = 0;
                     $sa = $booking_vip['time_start'];
                     $ea = $booking_vip['time_end'];
                     foreach ($item_vip as $itemv) {
                         if ($sa > $itemv['time_start'] && $sa < $itemv['time_end']) {
                             $i++;
                         } elseif ($ea > $itemv['time_start'] && $ea < $itemv['time_end']) {
                             $i++;
                         } elseif ($sa < $itemv['time_start'] && $ea > $itemv['time_end']) {
                             $i++;
                         }
                     }
                     $priority = 1;
                     $arrItemVip = array('item_id' => $booking_vip['item_id'], 'note' => "Add từ bảng booking vip cho [{$booking_vip['user_add']}]", 'time_start' => $booking_vip['time_start'], 'time_end' => $booking_vip['time_end'], 'time_add' => TIME_NOW, 'user_add' => User::user_name(), 'time_modify' => TIME_NOW, 'user_modify' => User::user_name(), 'catid' => $booking_vip['cat_id'], 'level_1_catid' => $booking_vip['top_cat'], 'num_contract' => $booking_vip['num_contract'], 'priority' => $priority);
                     //insert
                     $idVip = DB::insert("item_vip", $arrItemVip);
                     if ($idVip) {
                         $item_id = $booking_vip['item_id'];
                         $item = Item::get_item($item_id);
                         if ($booking_vip['time_start'] >= TIME_NOW || $booking_vip['time_end'] <= TIME_NOW) {
                             $priority = 0;
                         }
                         DB::update("item", array("sticky" => $priority), "id={$item_id}");
                         if (MEMCACHE_ON) {
                             $item['sticky'] = $priority;
                             AZMemcache::do_put("item:{$item_id}", $item);
                             AZMemcache::do_remove("id_vip:{$item['category_id']}");
                             AZMemcache::do_remove("id_vip:{$item['level_1_catid']}");
                         }
                     }
                     //update status
                     DB::update('bookings_vip', array("status" => 1, "time_update_status" => TIME_NOW, "user_update_status" => User::user_name()), "id={$id}");
                 }
                 Url::redirect_current();
                 break;
             case 'update_status':
                 if (User::have_permit(ADMIN_VIP_ITEM)) {
                     $id = (int) Url::get("id", 0);
                     DB::update('bookings_vip', array("status" => 1, "time_update_status" => TIME_NOW, "user_update_status" => User::user_name()), "id={$id}");
                 }
                 Url::redirect_current();
                 break;
             case 'edit':
                 require_once 'forms/EditBookingVip.php';
                 $this->add_form(new EditBookingVipForm());
                 break;
             case 'delete':
                 $id = (int) Url::get("id", 0);
                 $booking_vip = array();
                 if ($id) {
                     $booking_vip = DB::select("bookings_vip", "id={$id}");
                 }
                 if ($booking_vip && $booking_vip['status'] != 1) {
                     if (User::user_name() == $booking_vip['user_add'] || User::have_permit(ADMIN_VIP_ITEM)) {
                         DB::update('bookings_vip', array("status" => -1, "time_del" => TIME_NOW, "user_del" => User::user_name()), "id={$id}");
                     }
                 }
                 Url::redirect_current();
                 break;
             default:
                 Url::redirect_current();
                 break;
         }
     } else {
         Url::access_denied();
     }
 }
Exemplo n.º 6
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' => AZLib::safe_title($item['name']))));
                     $display->add('log_ups', $log_ups);
                     $display->output('UpTinLog', false, 'Personal');
                     System::halt();
                 }
             }
         }
     }
     echo 'no_log';
     exit;
 }
Exemplo n.º 7
0
 function mark_label()
 {
     $user_id = (int) Url::get('user_id');
     $item_id = (int) Url::get('item_id');
     $check_ids = Url::get('check_ids');
     $uncheck_ids = Url::get('uncheck_ids');
     if (!User::is_login() || !$user_id) {
         echo "not_login";
         exit;
     }
     if (!$item_id || !$user_id || !User::is_admin() && (User::is_block() || User::id() != $user_id)) {
         echo "not_permit";
         exit;
     }
     $user = User::getUser($user_id);
     $item = Item::get_item($item_id);
     if (!$user || !$item || $item && $item['user_id'] != $user_id) {
         echo "not_permit";
         exit;
     }
     if ($uncheck_ids != '') {
         DB::delete("label_item", "user_id={$user_id} AND label_id IN({$uncheck_ids}) AND item_id = {$item_id}");
     }
     if ($check_ids != '') {
         $label_id_arr = explode(',', $check_ids);
         $label_id_arr = $label_id_arr ? array_unique($label_id_arr) : $label_id_arr;
         if ($label_id_arr) {
             $insert_sql = '';
             foreach ($label_id_arr as $label_id) {
                 $insert_sql .= ($insert_sql != '' ? ',' : '') . "({$label_id},{$item_id},{$user_id},'{$user['user_name']}')";
             }
             if ($insert_sql != '') {
                 $insert_sql = "REPLACE INTO label_item (label_id, item_id, user_id, user_name) VALUES {$insert_sql}";
                 DB::query($insert_sql);
             }
         }
     }
     echo "success";
     exit;
 }
Exemplo n.º 8
0
 function rate_item()
 {
     if (User::is_login()) {
         $item_id = Url::get('id', 0);
         $num_stars = Url::get('num_stars', 0);
         $type = Url::get('type', 0);
         $user_id = User::id();
         if ($type != 0 && $type != 1 && $type != 2) {
             $type = 0;
         }
         if ($item_id && $user_id) {
             $item = Item::get_item($item_id);
             if ($item && $item['status'] == 1 && (User::have_permit(ADMIN_ITEM) || !DB::select("item_rating", "type=" + $type + " AND user_id=" . $user_id . " AND item_id=" . $item_id))) {
                 $rank = ($item['rank'] * $item['rate_num'] + $num_stars) / ($item['rate_num'] + 1);
                 if ($type == 0) {
                     $f_rank = ($item['f_rank'] * $item['f_rate_num'] + $num_stars) / ($item['f_rate_num'] + 1);
                     $update_sql = "f_rank= {$f_rank}, f_rate_num=f_rate_num+1";
                 } elseif ($type == 1) {
                     $d_rank = ($item['d_rank'] * $item['d_rate_num'] + $num_stars) / ($item['d_rate_num'] + 1);
                     $update_sql = "d_rank= '{$d_rank}', d_rate_num=d_rate_num+1";
                 } else {
                     $u_rank = ($item['u_rank'] * $item['u_rate_num'] + $num_stars) / ($item['u_rate_num'] + 1);
                     $update_sql = "u_rank= '{$u_rank}', u_rate_num=u_rate_num+1";
                 }
                 if (!User::have_permit(ADMIN_ITEM)) {
                     DB::insert("item_rating", array('user_id' => $user_id, 'item_id' => $item_id, 'rank' => $num_stars, 'type' => $type, 'time' => TIME_NOW));
                 }
                 DB::query("UPDATE item SET `rank`= '" . $rank . "', `rate_num`=rate_num+1, " . $update_sql . " WHERE id=" . $item_id);
                 Item::get_item($item_id, 1);
             }
             exit;
         }
     } else {
         echo 'not_login';
         exit;
     }
     echo 'no_perm';
     exit;
 }
Exemplo n.º 9
0
 function ManageItem($row)
 {
     if (User::have_permit(array(ADMIN_ITEM, ADMIN_DEL_ITEM))) {
         Module::Module($row);
         $cmd = Url::get('cmd');
         switch ($cmd) {
             case 'delete':
                 $id = (int) Url::get('id', 0);
                 if ($id) {
                     $item = Item::get_item($id);
                     Item::delete_item($id);
                 }
                 Url::redirect_url(Url::build_all(array('selected_ids', 'cmd', 'id', 'product_item')));
                 break;
             case 'del_cache':
                 $id = (int) Url::get('id', 0);
                 if ($id) {
                     Item::get_item($id, 1);
                 }
                 Url::redirect_url(Url::build_all(array('selected_ids', 'cmd', 'id', 'product_item')));
                 break;
             case 'del_forever':
                 if (User::have_permit(ADMIN_DEL_ITEM)) {
                     $id = (int) Url::get('id', 0);
                     if ($id) {
                         Item::delete_item_physical($id);
                     }
                 }
                 Url::redirect_url(Url::build_all(array('selected_ids', 'cmd', 'id', 'product_item')));
                 break;
             case 'show':
             case 're_post':
                 $id = (int) Url::get('id', 0);
                 if ($id) {
                     if (MEMCACHE_ON) {
                         $item_memcache = Item::get_item($id);
                         $item_memcache['status'] = 1;
                         $item_memcache['modify_user_name'] = User::user_name();
                         $item_memcache['modify_time'] = TIME_NOW;
                         AZMemcache::do_put("item:{$id}", $item_memcache);
                     }
                     DB::update('item', array('status' => 1, 'modify_user_name' => User::user_name(), 'modify_time' => TIME_NOW), 'id=' . $id);
                 }
                 Url::redirect_url(Url::build_all(array('selected_ids', 'cmd', 'id', 'product_item')));
                 break;
             case 'hide':
                 $id = (int) Url::get('id', 0);
                 if ($id) {
                     if (MEMCACHE_ON) {
                         $item_memcache = Item::get_item($id);
                         $item_memcache['status'] = 2;
                         $item_memcache['modify_user_name'] = User::user_name();
                         $item_memcache['modify_time'] = TIME_NOW;
                         AZMemcache::do_put("item:{$id}", $item_memcache);
                     }
                     DB::update('item', array('status' => 2, 'modify_user_name' => User::user_name(), 'modify_time' => TIME_NOW), 'id=' . $id);
                 }
                 Url::redirect_url(Url::build_all(array('selected_ids', 'cmd', 'id', 'product_item')));
                 break;
             default:
                 require_once 'forms/ManageItem.php';
                 $this->add_form(new ManageItemForm());
                 break;
         }
     } else {
         Url::redirect('sign_in');
     }
 }
Exemplo n.º 10
0
 function Build($row)
 {
     Module::Module($row);
     ##################################################################################################
     $build_catids = @CGlobal::$configs['BuildCatIDs']['conf_val'];
     if ($build_catids != '') {
         $arr = explode(',', $build_catids);
         $build_catids = '';
         $last = 0;
         if ($arr) {
             foreach ($arr as $catid) {
                 if (isset(CGlobal::$allCategories[$catid]) && CGlobal::$allCategories[$catid]['status'] != 'HIDE') {
                     $build_catids .= ($build_catids != '' ? ',' : '') . $catid;
                     Build::$cats[$catid] = array('id' => $catid, 'name' => CGlobal::$allCategories[$catid]['name'], 'recomend' => str_replace(chr(13) . chr(10), "<br />", CGlobal::$allCategories[$catid]['recomend']), 'img' => AZLib::getImageThumb("category/{$catid}.gif", 40, 40, 0, 0), 'item_id' => 0, 'item_name' => '', 'item_url' => '', 'item_price' => '', 'item_warranty' => '', 'list_brief' => '');
                     if ($last) {
                         Build::$cats[$last]['next_id'] = $catid;
                     }
                     $last = $catid;
                 }
             }
         }
     }
     self::$bcatid = (int) Url::get('bcatid');
     if (self::$bcatid) {
         if (isset(Build::$cats[self::$bcatid])) {
             self::$bcat = Build::$cats[self::$bcatid];
         } else {
             Url::redirect_current(array('mode'));
         }
     } else {
         self::$bcat = reset(Build::$cats);
         if (self::$bcat) {
             self::$bcatid = (int) self::$bcat['id'];
         }
     }
     ##################################################################################################
     $item_ids = '';
     $build_ids = isset($_SESSION['build_ids']) ? $_SESSION['build_ids'] : '';
     $build_price = 0;
     if ($build_ids != '') {
         $items = array();
         $re = DB::query("SELECT * FROM item WHERE id IN(" . $build_ids . ") AND status=1 AND price>0 AND quantity>0 ORDER BY find_in_set(category_id,'" . $build_catids . "')");
         if ($re) {
             while ($item = mysql_fetch_assoc($re)) {
                 if (isset(Build::$cats[$item['category_id']]) && Build::$cats[$item['category_id']]['item_id'] == 0) {
                     Build::$price += $item['price'];
                     $item_ids .= ($item_ids != '' ? ',' : '') . $item['id'];
                     if (isset(CGlobal::$allCategories[$item['category_id']])) {
                         $item_url = WEB_DIR . CGlobal::$allCategories[$item['category_id']]['nice_name'] . "/p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html";
                     } else {
                         $item_url = WEB_DIR . "p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html";
                     }
                     if ($item['list_brief'] == '') {
                         $item['list_brief'] = $item['brief'];
                     }
                     $item['list_brief'] = preg_replace("/\\[([\\s]*[0-9]{1,2}[\\s]*)\\]/eis", " ", $item['list_brief']);
                     $item['list_brief'] = str_replace(array("'", "\""), array("", " "), $item['list_brief']);
                     $item['list_brief'] = AZLib::word_limit($item['list_brief'], 50, '');
                     Build::$items[$item['id']] = $item;
                     Build::$cats[$item['category_id']]['item_id'] = $item['id'];
                     Build::$cats[$item['category_id']]['item_name'] = $item['name'];
                     Build::$cats[$item['category_id']]['item_url'] = $item_url;
                     Build::$cats[$item['category_id']]['item_price'] = number_format($item['price'], 0, ',', '.') . " VNĐ";
                     Build::$cats[$item['category_id']]['item_warranty'] = $item['warranty'];
                     Build::$cats[$item['category_id']]['list_brief'] = $item['list_brief'];
                 }
             }
         }
     }
     $item_id = (int) Url::get('item_id');
     $bcatid = (int) Url::get('bcatid');
     if ($item_id && $bcatid) {
         $item = Item::get_item($item_id);
         if ($item && $item['status'] == 1 && $item['price'] > 0 && $item['quantity'] > 0 && isset(Build::$cats[$item['category_id']])) {
             if (!isset(Build::$items[$item['id']])) {
                 if (Build::$cats[$item['category_id']]['item_id'] > 0) {
                     unset(Build::$items[Build::$cats[$item['category_id']]['item_id']]);
                 }
                 Build::$items[$item['id']] = $item;
                 //$item_ids	.=	($item_ids!='' ? ',' : '')	.	$item['id'];
                 $item_ids = implode(',', array_keys(Build::$items));
                 $_SESSION['build_ids'] = "{$item_ids}";
                 $last = 0;
                 foreach (array_keys(Build::$cats) as $catid) {
                     if ($last == self::$bcatid) {
                         Url::redirect_current(array('mode', 'bcatid' => $catid), '#select_item');
                     }
                     $last = $catid;
                 }
             }
         }
         Url::redirect_current(array('mode', 'bcatid'));
     }
     $_SESSION['build_ids'] = "{$item_ids}";
     $cmd = Url::get('cmd');
     switch ($cmd) {
         case 'success':
             require_once 'forms/BuildSuccess.php';
             $this->add_form(new BuildSuccessForm());
             break;
         case 'reset':
             $_SESSION['build_ids'] = "";
             Url::redirect_current();
             break;
         case 'order':
             if ($item_ids != '') {
                 $cart_item_ids = isset($_COOKIE['cart_items']) ? $_COOKIE['cart_items'] : '';
                 if ($cart_item_ids != '') {
                     $buil_item_arr = explode(',', $item_ids);
                     $item_ids = $cart_item_ids;
                     $cat_item_arr = explode(',', $cart_item_ids);
                     foreach ($buil_item_arr as $item_id) {
                         if (!in_array($item_id, $cat_item_arr)) {
                             $item_ids .= ($item_ids != '' ? ',' : '') . $item_id;
                         }
                     }
                 }
                 if ($item_ids != $cart_item_ids) {
                     AZLib::my_setcookie('cart_items', $item_ids, time() + 3600 * 24 * 365);
                 }
                 $_SESSION['build_ids'] = "";
                 Url::redirect('cart');
             }
             Url::redirect_current();
             break;
         case '':
         default:
             require_once 'forms/Build.php';
             $this->add_form(new BuildForm());
             break;
     }
 }
Exemplo n.º 11
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;
    }
Exemplo n.º 12
0
 function on_submit()
 {
     $item_id = (int) Url::get("item_id", 0);
     $category = (int) Url::get("category", 0);
     $num_contract = Url::get("num_contract", '');
     $time_s = Url::get("time_start", '');
     $time_e = Url::get("time_end", '');
     if ($item_id <= 0) {
         $this->setFormError('item_id', 'Bạn chưa nhập vào ID tin!');
         return;
     }
     $item = Item::get_item($item_id);
     if (!$item || $item && $item['status'] == -1) {
         $this->setFormError('item_id', 'Tin bạn nhập vào không tồn tại!');
         return;
     }
     if (!$this->errNum) {
         $time_start = 0;
         if ($time_s != '') {
             $arr = explode('-', $time_s);
             if (count($arr) == 3) {
                 $time_start = mktime(0, 0, 0, $arr[1], $arr[0], $arr[2]);
             }
         }
         if (!$time_start) {
             $time_start = mktime(0, 0, 0, date('m', TIME_NOW), date('d', TIME_NOW), date('Y', TIME_NOW));
         }
         $time_end = 0;
         if ($time_e != '') {
             $arr = explode('-', $time_e);
             if (count($arr) == 3) {
                 $time_end = mktime(23, 59, 59, $arr[1], $arr[0], $arr[2]);
             }
         }
         if (!$time_end) {
             $this->setFormError('time_end', 'Bạn chưa nhập vào thời gian kết thúc!');
             return;
         }
         if ($time_end < $time_start) {
             $this->setFormError('time_end', 'Thời gian kết thúc phải lớn hơn thời gian bắt đầu!');
             return;
         }
         // xac dinh xem co hien thi o danh muc cha khong
         $top_cat = 0;
         $cat_id = 0;
         if ($category == 1) {
             $top_cat = $item['level_1_catid'];
         } else {
             if ($category == 2) {
                 $cat_id = $item['category_id'];
             }
         }
         $id = DB::insert("bookings_vip", array('item_id' => $item_id, 'cat_id' => $cat_id, 'top_cat' => $top_cat, 'note' => AZLib::getParam('note'), 'time_start' => $time_start, 'time_end' => $time_end, 'time_add' => TIME_NOW, 'user_add' => User::user_name(), 'time_edit' => TIME_NOW, 'user_edit' => User::user_name(), 'num_contract' => $num_contract));
         if ($id) {
             $content_email = "Có tin vip mới, id={$id}";
             $email_managa_vip = '*****@*****.**';
             if (System::sendEBEmail($email_managa_vip, 'Có booking vip mới', $content_email)) {
                 //                    DB::update('bookings_vip', array('note' => 'Gửi mail thành công'), "id=$id");
             }
         }
         Url::redirect_current();
     }
 }
Exemplo n.º 13
0
 function display_feedback()
 {
     global $display;
     $show_all = Url::get('show_all', 0);
     Item::$id = (int) Url::get('id', 0);
     Item::$item = Item::get_item(Item::$id);
     if (Item::$item) {
         if (!isset(Item::$item['display'])) {
             Item::$item['display'] = 1;
             if (isset(Item::$item['id'])) {
                 //Check trạng thái tin và quyền thao tác:
                 if (Item::$item['status'] != 1) {
                     //Tin không được kiểm duyệt
                     //Nếu tin chưa được kiểm duyệt ,chỉ admin hoặc chủ tin được xem!
                     if (Item::$item['status'] == 2) {
                         if (User::id() != Item::$item['user_id'] && !User::have_permit(ADMIN_ITEM) && !User::have_cat_permit(Item::$item['category_id'])) {
                             Item::$item['display'] = 0;
                         }
                     } else {
                         //Nếu tin ở trạng thái xóa
                         if (Item::$item['status'] == -1) {
                             if (!User::have_permit(ADMIN_ITEM)) {
                                 Item::$item['display'] = 0;
                                 //Url::access_denied();
                             }
                         }
                     }
                     //Nếu tin bị ẩn ,chỉ admin được xem!
                     if (Item::$item['status'] == 0) {
                         if (!User::is_admin()) {
                             Item::$item['display'] = 0;
                             //Url::access_denied();
                         }
                     }
                 }
             }
         }
         if (Item::$item['display']) {
             if ($show_all) {
                 $this->get_all_comment();
             } else {
                 if (StaticCache::notExistCache('fb_' . Item::$id, 0)) {
                     StaticCache::startCache();
                     $this->get_all_comment();
                     StaticCache::endCache();
                 }
             }
         }
     }
 }
Exemplo n.º 14
0
 function fn_del_item_reason()
 {
     if (!User::is_login()) {
         echo "not_login";
         exit;
     }
     if (!User::have_permit(ADMIN_ITEM) && !User::is_mod()) {
         echo "no_perm";
         exit;
     }
     $id = (int) Url::get('id', 0);
     if ($id) {
         $item = Item::get_item($id);
         $item_memcache = $item;
     } else {
         $item = array();
     }
     if ($item && (User::have_permit(ADMIN_ITEM) || User::have_cat_permit($item['category_id']))) {
         Item::delete_item($id);
         AZLib::del_reason_mod($id);
         echo $id;
         exit;
     } else {
         echo "no_perm";
         exit;
     }
     echo "unsuccess";
     exit;
 }
Exemplo n.º 15
0
 function finish_edit_item_id()
 {
     $json = array('error' => '');
     if (!User::is_login()) {
         $json['error'] = "not_login";
         echo json_encode($json);
         exit;
     }
     if (User::is_block()) {
         $json['error'] = "no_permission";
         echo json_encode($json);
         exit;
     }
     $user = User::$current->data;
     $item_id = Url::get('item_id', 0);
     $bidding_id = Url::get('bidding_id', 0);
     if ($item_id) {
         $item = Item::get_item($item_id);
     }
     if ($item) {
         //Check trạng thái tin và quyền thao tác:
         if ($item['status'] != 1) {
             if (in_array($item['status'], array(0, 2, 3, 5))) {
                 $data['error'] = 'item_invalid';
                 echo json_encode($data);
                 exit;
             } elseif ($item['status'] == -1 && !User::have_permit(ADMIN_ITEM)) {
                 //Nếu tin ở trạng thái xóa
                 $json['error'] = "item_not_exist";
                 echo json_encode($json);
                 exit;
             }
         } else {
             $bidding_info = DB::select('bidding', "id={$bidding_id}");
             if ($user['id'] != $bidding_info['user_id']) {
                 $json['error'] = "wrong_user";
                 echo json_encode($json);
                 exit;
             }
             if ($item['category_id'] != $bidding_info['cat_id']) {
                 $json['error'] = "wrong_item_id";
                 echo json_encode($json);
                 exit;
             }
         }
         if (DB::query("UPDATE bidding SET item_id = {$item_id} WHERE id={$bidding_id}")) {
             $json['error'] = "success";
             echo json_encode($json);
             exit;
         } else {
             $json['error'] = "error_update";
             echo json_encode($json);
             exit;
         }
     } else {
         $json['error'] = "item_not_exist";
         echo json_encode($json);
         exit;
     }
 }
Exemplo n.º 16
0
 function action_reply_item_comment()
 {
     $act_ = Url::get('act_');
     $comment_id = (int) Url::get('re_c_item_id', 0);
     $content = '';
     $json = "";
     if (!User::is_login()) {
         $json = '({"msg":"no_login"})';
         echo $json;
         exit;
     }
     if (User::is_block() || !$comment_id || $act_ != 'skip' && $act_ != 'reply') {
         $json = '({"msg":"no_perm"})';
         echo $json;
         exit;
     }
     $comment_row = DB::select('comment', "id={$comment_id}");
     if (!$comment_row || $comment_row && $comment_row['replied_user_id'] != User::id()) {
         $json = '({"msg":"no_perm"})';
         echo $json;
         exit;
     }
     //if($comment_row['receiver_user_id'] == User::id() || $comment_row['sender_user_id'] == User::id() ||  ($act_=='reply' && $comment_row['replied_status']==1)){//Không được trả lời cho chính mình! hoặc trả lời phản hồi đã đc trả lời rồi!
     if ($comment_row['receiver_user_id'] == User::id() || $comment_row['sender_user_id'] == User::id()) {
         //Không được trả lời cho chính mình!
         $json = '({"msg":"success"})';
         echo $json;
         exit;
     }
     $item_id = $comment_row['item_id'];
     $item = Item::get_item($item_id);
     $item_memcache = $item;
     if (!$item || $item && $item == -1) {
         $json = '({"msg":"no_perm"})';
         echo $json;
         exit;
     }
     if ($item["state"] == 1 && !User::have_permit(ADMIN_ITEM)) {
         $json = '({"msg":"no_perm"})';
         echo $json;
         exit;
     }
     $json = '({"msg":"success"';
     if ($act_ == 'reply') {
         $content = trim(AZLib::getParam('content'));
         if (!$content) {
             $json = '({"msg":"short_content"})';
             echo $json;
             exit;
         }
         if (AZLib::checkBadWord($content)) {
             $json = '({"msg":"bad_word"})';
             echo $json;
             exit;
         }
         $content = preg_replace("/\n/", "<br />", $content);
         $content = str_replace('<br /><br />', '&nbsp;', $content);
         if ($comment_row['parent_id']) {
             $parent_id = $comment_row['parent_id'];
             if ($comment_row['sender_user_id']) {
                 $content = '@<a href="' . WEB_DIR . $comment_row['sender_user_name'] . '" class="fast_reply_link" title="' . $comment_row['sender_user_name'] . '">' . $comment_row['sender_user_name'] . '</a>: ' . $content;
             } else {
                 $content = '<font color="#999">@<span style="text-decoration:underline">' . $comment_row['sender_user_name'] . '</span> </font>: ' . $content;
             }
         } else {
             $parent_id = $comment_row['id'];
         }
         $comment = array('content' => $content, 'item_id' => $item['id'], 'time' => time(), 'order_time' => time(), 'post_ip' => AZLib::ip(), 'parent_id' => $parent_id, 'receiver_user_id' => $item['user_id'], 'receiver_user_name' => $item['user_name'], 'display' => 1, 'status' => 0);
         $comment['sender_user_id'] = User::id();
         $comment['sender_user_name'] = User::user_name();
         if ($comment_row['sender_user_id']) {
             $comment['replied_user_id'] = $comment_row['sender_user_id'];
             $comment['replied_user_name'] = $comment_row['sender_user_name'];
         }
         if ($comment_row['sender_user_id'] == $item['user_id']) {
             $comment['replied_status'] = 1;
         }
         $id = DB::insert('comment', $comment);
         if ($id) {
             $re = DB::query("SELECT id FROM comment WHERE parent_id = {$parent_id} AND display = 1 ORDER BY id DESC LIMIT 3,1");
             if ($re) {
                 if ($row = mysql_fetch_assoc($re)) {
                     if ($row) {
                         DB::query("UPDATE comment SET display = 0 WHERE parent_id = {$parent_id} AND display = 1 AND id<={$row['id']}");
                     }
                 }
             }
             if ($comment_id == $parent_id) {
                 DB::query("UPDATE comment SET replied_status = 1,have_child = have_child + 1, order_time = " . time() . " WHERE id = {$comment_id}");
             } else {
                 DB::query("UPDATE comment SET have_child = have_child + 1, order_time = " . time() . " WHERE id = {$parent_id}");
                 DB::query("UPDATE comment SET replied_status = 1 WHERE id = {$comment_id}");
             }
             //Cập nhật đã đọc - trả lời cho feed
             DB::query("UPDATE feed SET status=1 WHERE ref_id = {$comment_id} AND type=2");
             DB::query('UPDATE user SET total_new_comment = total_new_comment + 1 WHERE id=' . $item['user_id']);
             User::getUser($item['user_id'], 0, 1);
             if ($comment_row['sender_user_id'] && $comment_row['sender_user_id'] != $item['user_id']) {
                 DB::query('UPDATE user SET total_new_comment = total_new_comment + 1 WHERE id=' . $comment_row['sender_user_id']);
                 User::getUser($comment_row['sender_user_id'], 0, 1);
             }
         }
         $total_feedback = DB::count('comment', 'item_id="' . $item['id'] . '"');
         DB::update_id('item', array('reply_count' => $total_feedback), $item['id']);
         if (MEMCACHE_ON) {
             $item_memcache['reply_count'] = $total_feedback;
             AZMemcache::do_put("item:{$item['id']}", $item_memcache);
         }
         $receiver_user = User::getUser($item['user_id'], 1);
         //Cập nhật cron job
         if ($receiver_user && $receiver_user['email'] && $receiver_user['email_alert']) {
             $link = WEB_ROOT . AZRewrite::formatUrl('?page=item_detail&id=' . $item['id'] . '&ebname=' . AZLib::safe_title($item['name']));
             $link = AZRewrite::formatUrl($link);
             $title = "<a href='{$link}' target='_blank' style='text-decoration:none;color:#003399;'><font color='#003399'>{$item['name']}</font></a>";
             AZLib::addCronJob('item_comment', AZLib::parseBBCode($content, true), $receiver_user['id'], User::user_name(), '', $item['id'], $title, $link);
         }
     } else {
         if ($comment_row['replied_status'] == 0) {
             DB::query("UPDATE comment SET replied_status = 1 WHERE id = {$comment_id}");
         }
         //Cập nhật đã đọc - trả lời cho feed
         DB::query("UPDATE feed set status=1 WHERE ref_id = {$comment_id} AND type=2");
     }
     DB::query('UPDATE user SET total_new_comment = total_new_comment - 1 WHERE id=' . User::id() . ' AND total_new_comment>0');
     User::getUser(User::id(), 0, 1);
     $json .= "})";
     echo $json;
     exit;
 }
Exemplo n.º 17
0
 function payment_vip_finish()
 {
     if (!User::is_login()) {
         echo "not_login";
         exit;
     }
     if (User::is_block()) {
         echo "no_permission";
         exit;
     }
     $user = User::$current->data;
     $item_id = (int) Url::get('item_id', 0);
     $vip_day = Url::get('vip_day', '');
     $cat_id = (int) Url::get('cat_id', 0);
     $full_name = Url::get('full_name');
     $mobile = Url::get('mobile');
     $item = false;
     //get item info
     if ($item_id) {
         $item = Item::get_item($item_id);
     }
     if ($item) {
         //Check trạng thái tin và quyền thao tác:
         if ($item['status'] != 1) {
             if (in_array($item['status'], array(0, 2, 3, 5))) {
                 echo "item_invalid";
                 exit;
             } elseif ($item['status'] == -1 && !User::have_permit(ADMIN_ITEM)) {
                 //Nếu tin ở trạng thái xóa
                 echo "item_not_exist";
                 exit;
             }
         }
     } else {
         echo "item_not_exist";
         exit;
     }
     if (!$cat_id) {
         echo "catid_not_exist";
         exit;
     }
     if (!$full_name || !$mobile) {
         //Phải nhập tên và số điện thoại liên hệ
         echo "error_info";
         exit;
     }
     $countItemVip = DB::count('item_vip', "item_id={$item_id} AND status=1 AND time_end > " . TIME_NOW);
     if ($countItemVip) {
         echo "vip_exist";
         exit;
     }
     foreach (SohaPay::$vip as $key => $val) {
         if (strpos(',' . $val['ids'] . ',', ',' . $cat_id . ',') !== false) {
             $price = $val['price'];
             $type = $val['type'];
             $service_code = $key;
         }
     }
     $return_url = WEB_ROOT . "payment_vip_complete.html?item_id={$item_id}&cat_id={$cat_id}&mobile={$mobile}&vip_day={$vip_day}";
     $transaction_info = "{$full_name} [ {$user['user_name']} ] Thanh toán Dịch vụ mua tin vip trị giá " . number_format($price, 0, '', '.') . " VNĐ) vào ngày {$vip_day} cho tin có ID {$item_id} của {$item['user_name']}, số ĐT liên hệ: {$mobile}";
     $order_email = $user['email'];
     $payment_ebp = array("item_id" => $item_id, "log_id" => 0, "vip_config" => $cat_id . "," . $vip_day, "user_id" => $user['id'], "user_name" => $user['user_name'], "service_type" => $type, "service_code" => $service_code, "payment_info" => $transaction_info, "order_code" => '', "price" => $price, "time" => TIME_NOW, "payment_time" => 0, "error_text" => '', "payment_status" => 0, "sent_mail" => 0, "mobile" => $this->check_mobile($mobile));
     $payid = DB::insert("payment_ebp", $payment_ebp);
     if ($payid) {
         $order_code = "{$service_code}_{$payid}";
         if (DB::update("payment_ebp", array("order_code" => $order_code), "id={$payid}")) {
             //Tạo link thanh toán đến Soha Payment
             $url = SohaPay::buildCheckoutUrl($return_url, $transaction_info, $order_code, $price, $order_email, VIP_MERCHANT_SITE_CODE, VIP_SECURE_CODE);
             echo $url;
             exit;
         }
     }
 }
Exemplo n.º 18
0
 function on_submit()
 {
     $start_row = 6;
     //$start_row = 4;
     if (isset($_FILES['file_excel']) && $_FILES['file_excel']['error'] == 0) {
         $file_ext = AZLib::getExtension($_FILES['file_excel']['name']);
         if ($file_ext == '.xls') {
             require_once 'includes/excel/PHPExcel_1.7.6/PHPExcel/IOFactory.php';
             try {
                 $objPHPExcel = PHPExcel_IOFactory::load($_FILES['file_excel']['tmp_name']);
             } catch (Exception $e) {
                 $this->setFormError('', 'File bạn nhập không đúng định dạng');
             }
         } else {
             $this->setFormError('', 'File bạn nhập không đúng định dạng');
         }
     } else {
         $this->setFormError('', "Bạn chưa chọn file Excel!");
     }
     $sku_arr = array();
     //B Col 1
     $category_id_arr = array();
     //C Col 2
     $brand_arr = array();
     //D Col 3
     $name_arr = array();
     //E Col 4
     $quantity_arr = array();
     //F Col 5 - Số lượng
     $made_in_arr = array();
     //G Col 6
     $warranty_arr = array();
     //H Col 7
     $price_arr = array();
     //I Col 8
     $price_out_arr = array();
     //J Col 9
     $currency_id_arr = array();
     //Q Col 16
     $offer_arr = array();
     //R Col 17
     $status_arr = array();
     //S Col 18
     $list_brief_arr = array();
     //T Col 19
     $description_arr = array();
     //U Col 20
     $brief_arr = array();
     //V Col 21
     ##########################################################################################################
     #Check lỗi:
     $error = '';
     $worksheet = $objPHPExcel->getSheetByName('Sản phẩm');
     if (!$worksheet) {
         $this->setFormError('', 'Tên sheet gốc đã bị thay đổi, hãy đổi lại tên sheet thành "Sản phẩm"');
     }
     $brand_name_ars = array();
     $not_allow_update = array();
     $not_allow_insert = array();
     if (!$this->errNum) {
         if ($worksheet->getCell("Z1")->getValue() != 2) {
             $this->setFormError('', 'File excel không đúng phiên bản, đề nghị <a href="import_excel.html?cmd=download" style="color:#0000FF"><b>Tải về file Excel mẫu</b></a> mới nhất và cập nhật lại!');
             return;
         }
         $max_rows = $worksheet->getHighestRow();
         for ($i = $start_row; $i <= $max_rows; $i++) {
             $sku = trim(str_replace(array("'", "\""), '', $worksheet->getCell("B{$i}")->getValue()));
             if ($sku == '') {
                 //$error	.=	"<b>SKU</b> tại Cell <font color='#f00'>B$i</font> không được để trống<br/>";
                 $not_allow_update[$i] = $i;
                 //Không cho  update
                 $not_allow_insert[$i] = $i;
                 //Không cho insert
             } else {
                 $sku_arr[$i] = $sku;
                 $catid = trim($worksheet->getCell("C{$i}")->getValue());
                 if ($catid) {
                     if (!isset(CGlobal::$allCategories[$catid])) {
                         //$error	.=	"<b>ID Danh mục</b> tại Cell <font color='#f00'>C$i</font> không tồn tại<br/>";
                         $not_allow_update[$i] = $i;
                         //Không cho  update
                         $not_allow_insert[$i] = $i;
                         //Không cho insert
                     }
                 }
                 $category_id_arr[$i] = $catid;
                 $brand_arr[$i] = trim($worksheet->getCell("D{$i}")->getValue());
                 if ($brand_arr[$i] != '') {
                     $brand_name_ars[strtolower($brand_arr[$i])] = str_replace(array("'", "\""), '', $brand_arr[$i]);
                 }
                 $name_arr[$i] = trim($worksheet->getCell("E{$i}")->getValue());
                 if ($name_arr[$i] == '') {
                     //$error	.=	"<b>Tên sản phẩm</b> tại Cell <font color='#f00'>C$i</font> không được để trống<br/>";
                     $not_allow_insert[$i] = $i;
                     //Không cho insert
                 } elseif (strlen($name_arr[$i]) < 2) {
                     //$error	.=	"<b>Tên sản phẩm</b> tại Cell <font color='#f00'>C$i</font> không được để trống<br/>";
                     $not_allow_update[$i] = $i;
                     //Không cho  update
                     $not_allow_insert[$i] = $i;
                     //Không cho insert
                 }
                 $quantity_arr[$i] = abs($worksheet->getCell("F{$i}")->getValue());
                 $made_in_arr[$i] = $worksheet->getCell("G{$i}")->getValue();
                 $warranty_arr[$i] = $worksheet->getCell("H{$i}")->getValue();
                 $price_arr[$i] = abs($worksheet->getCell("I{$i}")->getValue());
                 $price_out_arr[$i] = abs($worksheet->getCell("J{$i}")->getValue());
                 if ($price_out_arr[$i] && $price_out_arr[$i] < $price_arr[$i]) {
                     //$error	.=	"<b>Giá thị trường</b> tại Cell <font color='#f00'>J$i</font> phải lớn hơn hoặc bằng <b>Giá niêm yết</b> tại Cell <font color='#f00'>I$i</font><br/>";
                     $not_allow_update[$i] = $i;
                     //Không cho  update
                     $not_allow_insert[$i] = $i;
                     //Không cho insert
                 }
                 $currency_id_arr[$i] = strtolower($worksheet->getCell("Q{$i}")->getValue()) == 'usd' ? 2 : 1;
                 $offer_arr[$i] = $worksheet->getCell("R{$i}")->getValue();
                 /*$list_brief_arr[$i] 	= str_replace("/","<br />",$worksheet->getCell("S$i")->getValue());
                 		$brief_arr[$i] 			= str_replace("/","<br />",$worksheet->getCell("T$i")->getValue());
                 		$description_arr[$i] 	= str_replace("/","<br />",$worksheet->getCell("U$i")->getValue());
                 		*/
                 $list_brief_arr[$i] = trim($worksheet->getCell("T{$i}")->getValue());
                 $description_arr[$i] = trim($worksheet->getCell("U{$i}")->getValue());
                 $brief_arr[$i] = trim($worksheet->getCell("V{$i}")->getValue());
                 if ($list_brief_arr[$i] == '') {
                     //$error	.=	"<b>Thông số tóm tắt</b> tại Cell <font color='#f00'>S$i</font> không được để trống!<br/>";
                     $not_allow_insert[$i] = $i;
                     //Không cho insert
                 } elseif (strlen($list_brief_arr[$i]) < 2) {
                     $not_allow_update[$i] = $i;
                     //Không cho  update
                     $not_allow_insert[$i] = $i;
                     //Không cho insert
                 }
                 if ($description_arr[$i] == '') {
                     //$error	.=	"<b>Thông số tóm tắt</b> tại Cell <font color='#f00'>S$i</font> không được để trống!<br/>";
                     $not_allow_insert[$i] = $i;
                     //Không cho insert
                 } elseif (strlen($description_arr[$i]) < 2) {
                     $not_allow_update[$i] = $i;
                     //Không cho  update
                     $not_allow_insert[$i] = $i;
                     //Không cho insert
                 }
                 if ($brief_arr[$i] == '') {
                     //$error	.=	"<b>Thông số tóm tắt</b> tại Cell <font color='#f00'>S$i</font> không được để trống!<br/>";
                     $not_allow_insert[$i] = $i;
                     //Không cho insert
                 } elseif (strlen($brief_arr[$i]) < 2) {
                     $not_allow_update[$i] = $i;
                     //Không cho  update
                     $not_allow_insert[$i] = $i;
                     //Không cho insert
                 }
                 /*
                 if($brief_arr[$i] == '')
                 {
                 	$brief_arr[$i] = $list_brief_arr[$i];
                 }
                 
                 if($description_arr[$i] == '')
                 {
                 	$description_arr[$i] = $brief_arr[$i];
                 }
                 */
                 $status_arr[$i] = trim($worksheet->getCell("S{$i}")->getValue());
                 if ($status_arr[$i] != '') {
                     if (in_array($status_arr[$i], array(-1, 1, 2))) {
                         $status_arr[$i] = 1;
                     }
                 }
             }
         }
         #Check lỗi
         ##########################################################################################################
         $success = '';
         if (!$name_arr) {
             $this->setFormError('', "Bạn chưa nhập thông tin sản phẩm nào!");
             return;
         }
         $all_sku_items = array();
         $sku_str = "'" . implode("','", $sku_arr) . "'";
         $re = DB::query("SELECT id, sku FROM item WHERE sku IN({$sku_str})");
         if ($re) {
             while ($item = mysql_fetch_assoc($re)) {
                 $all_sku_items[$item['sku']] = $item['id'];
             }
         }
         $all_rands = array();
         if ($brand_name_ars) {
             $brand_str = "'" . implode("','", $brand_name_ars) . "'";
             $re = DB::query("SELECT * FROM brand WHERE name IN({$brand_str})");
             if ($re) {
                 while ($brand = mysql_fetch_assoc($re)) {
                     $all_rands[strtolower(trim($brand['name']))] = $brand['id'];
                 }
             }
         }
         $total_update = 0;
         $total_add = 0;
         $total_skip = 0;
         foreach ($name_arr as $key => $nam) {
             if (!isset($not_allow_update[$key], $not_allow_insert[$key])) {
                 if (isset($all_sku_items[$sku_arr[$key]])) {
                     if (!isset($not_allow_update[$key])) {
                         $item_update_row = array('status' => 1, 'modify_time' => TIME_NOW, 'modify_user_name' => User::user_name());
                         if ($category_id_arr[$key] != '') {
                             $catid = $category_id_arr[$key];
                             $cattopid = $catid;
                             $catl2id = $catid;
                             $cat = CGlobal::$allCategories[$catid];
                             if ($cat) {
                                 if ($cat['parent_id'] && isset(CGlobal::$allCategories[$cat['parent_id']])) {
                                     $pcat = CGlobal::$allCategories[$cat['parent_id']];
                                     if ($pcat['parent_id'] && isset(CGlobal::$allCategories[$pcat['parent_id']])) {
                                         $cattopid = $pcat['parent_id'];
                                         $catl2id = $pcat['id'];
                                     } else {
                                         //Cấp 2
                                         $cattopid = $cat['parent_id'];
                                         $catl2id = $cat['id'];
                                     }
                                 } else {
                                     $cattopid = $catid;
                                     $catl2id = 0;
                                 }
                             }
                             $item_update_row['level_1_catid'] = $cattopid;
                             $item_update_row['level_2_catid'] = $catl2id;
                             $item_update_row['category_id'] = $catid;
                         }
                         if ($brand_arr[$key] != '') {
                             $brand_id = 0;
                             if (isset($all_rands[strtolower($brand_arr[$key])])) {
                                 $brand_id = $all_rands[strtolower($brand_arr[$key])];
                             } elseif ($brand_arr[$key] != '-') {
                                 $brand_id = DB::insert('brand', array('name' => $brand_arr[$key]));
                                 $all_rands[strtolower($brand_arr[$key])] = $brand_id;
                             }
                             $item_update_row['brand_id'] = $brand_id;
                         }
                         if ($name_arr[$key] != '') {
                             $item_update_row['name'] = $name_arr[$key];
                         }
                         if ($list_brief_arr[$key] != '') {
                             $item_update_row['list_brief'] = $list_brief_arr[$key];
                         }
                         if ($brief_arr[$key] != '') {
                             $item_update_row['brief'] = $brief_arr[$key];
                         }
                         if ($description_arr[$key] != '') {
                             $item_update_row['description'] = $description_arr[$key];
                         }
                         if ($quantity_arr[$key] != '') {
                             $item_update_row['quantity'] = (int) $quantity_arr[$key];
                         }
                         if ($made_in_arr[$key] != '') {
                             if ($made_in_arr[$key] == '-') {
                                 $item_update_row['made_in'] = '';
                             } else {
                                 $item_update_row['made_in'] = (int) $made_in_arr[$key];
                             }
                         }
                         if ($warranty_arr[$key] != '') {
                             if ($warranty_arr[$key] == '-') {
                                 $item_update_row['warranty'] = '';
                             } else {
                                 $item_update_row['warranty'] = (int) $warranty_arr[$key];
                             }
                         }
                         if ($price_arr[$key] != '') {
                             if ($price_arr[$key] == '-') {
                                 $item_update_row['price'] = 0;
                             } else {
                                 $item_update_row['price'] = (int) $price_arr[$key];
                             }
                         }
                         if ($price_out_arr[$key] != '') {
                             if ($price_out_arr[$key] == '-') {
                                 $item_update_row['price_out'] = 0;
                             } else {
                                 $item_update_row['price_out'] = (int) $price_out_arr[$key];
                             }
                         }
                         if ($currency_id_arr[$key] != '') {
                             if ($currency_id_arr[$key] == '-') {
                                 $item_update_row['currency_id'] = 1;
                             } else {
                                 $item_update_row['currency_id'] = (int) $currency_id_arr[$key];
                             }
                         }
                         if ($offer_arr[$key] != '') {
                             if ($offer_arr[$key] == '-') {
                                 $item_update_row['offer'] = '';
                             } else {
                                 $item_update_row['offer'] = $offer_arr[$key];
                             }
                         }
                         if ($status_arr[$key] != '') {
                             if ($status_arr[$key] == '-') {
                                 $item_update_row['status'] = 1;
                             } else {
                                 $item_update_row['status'] = (int) $status_arr[$key];
                             }
                         }
                         $id = $all_sku_items[$sku_arr[$key]];
                         DB::update('item', $item_update_row, "id={$id}");
                         Item::get_item($id, 1);
                         $total_update++;
                         $success .= "<a href='p{$id}.html' target='_blank'>[ ID: {$id} ]</a> Cập nhật thành công sp ở dòng thứ {$key}<br />";
                     } else {
                         $total_skip++;
                     }
                 } else {
                     if (!isset($not_allow_insert[$key])) {
                         $catid = $category_id_arr[$key];
                         $cattopid = $catid;
                         $catl2id = $catid;
                         $cat = CGlobal::$allCategories[$catid];
                         if ($cat) {
                             if ($cat['parent_id'] && isset(CGlobal::$allCategories[$cat['parent_id']])) {
                                 $pcat = CGlobal::$allCategories[$cat['parent_id']];
                                 if ($pcat['parent_id'] && isset(CGlobal::$allCategories[$pcat['parent_id']])) {
                                     $cattopid = $pcat['parent_id'];
                                     $catl2id = $pcat['id'];
                                 } else {
                                     //Cấp 2
                                     $cattopid = $cat['parent_id'];
                                     $catl2id = $cat['id'];
                                 }
                             } else {
                                 $cattopid = $catid;
                                 $catl2id = 0;
                             }
                         }
                         $brand_id = 0;
                         if ($brand_arr[$key] != '') {
                             if (isset($all_rands[strtolower($brand_arr[$key])])) {
                                 $brand_id = $all_rands[strtolower($brand_arr[$key])];
                             } elseif ($brand_arr[$key] != '-') {
                                 $brand_id = DB::insert('brand', array('name' => $brand_arr[$key]));
                                 $all_rands[strtolower($brand_arr[$key])] = $brand_id;
                             }
                         }
                         if ($status_arr[$key] == '') {
                             $status_arr[$key] = 1;
                         }
                         $item_insert_row = array('sku' => $sku_arr[$key], 'category_id' => $catid, 'level_1_catid' => $cattopid, 'level_2_catid' => $catl2id, 'brand_id' => $brand_id, 'name' => $name_arr[$key], 'list_brief' => $list_brief_arr[$key], 'brief' => $brief_arr[$key], 'description' => $description_arr[$key], 'quantity' => $quantity_arr[$key], 'made_in' => $made_in_arr[$key], 'warranty' => $warranty_arr[$key], 'price' => $price_arr[$key], 'price_out' => $price_out_arr[$key], 'currency_id' => $currency_id_arr[$key], 'offer' => $offer_arr[$key], 'offer' => $offer_arr[$key], 'status' => $status_arr[$key], 'created_time' => TIME_NOW, 'user_id' => ser::id(), 'user_name' => ser::user_name(), 'modify_time' => TIME_NOW, 'modify_user_name' => User::user_name());
                         $id = DB::insert('item', $item_insert_row);
                         $total_add++;
                         $success .= "<a href='p{$id}.html' target='_blank'><font color=red>[ ID: {$id} ]</font></a> Thêm mới thành công sp ở dòng thứ {$key}<br />";
                     } else {
                         $total_skip++;
                     }
                 }
             } else {
                 $total_skip++;
             }
         }
         if ($success != '') {
             $success = "Tạo mới: {$total_add}, Cập nhật: {$total_update}, Bỏ qua: {$total_skip}.<br /><br />" . $success;
             $this->setFormSucces('', $success);
         }
     }
 }
Exemplo n.º 19
0
 function display_feedback_thoitrang()
 {
     global $display;
     $show_all = Url::get('show_all', 1);
     Item::$id = (int) Url::get('id', 0);
     Item::$item = Item::get_item(Item::$id);
     /* if($show_all)
        {*/
     $this->get_all_comment_thoitrang();
     /* }
        else{
            if(StaticCache::notExistCache('fb_'.Item::$id,0)){
                StaticCache::startCache();
                $this->get_all_comment_thoitrang();
                StaticCache::endCache();
            }
        }*/
 }
Exemplo n.º 20
0
 function __construct($row)
 {
     Module::Module($row);
     require_once 'forms/header.php';
     if (AZNet::$page['name'] == 'zone') {
         $zone_id = (int) Url::get("zone_id");
         if (!$zone_id || $zone_id && !isset(CGlobal::$allZones[$zone_id])) {
             //Url::access_denied();
             Url::redirect('home');
         }
     }
     if (AZNet::$page['name'] == 'item_detail') {
         $item_id = (int) Url::get('id', 0);
         if (Item::$id == -1) {
             Item::$id = $item_id;
             Item::$item = Item::get_item($item_id);
             AZLib::checkItem();
             if (Item::$item && Item::$item['display']) {
                 CGlobal::$curCategory = Item::$item['category_id'];
             }
         }
     }
     $curCategory = false;
     if (CGlobal::$curCategory && isset(CGlobal::$allCategories[CGlobal::$curCategory])) {
         $curCategory = CGlobal::$allCategories[CGlobal::$curCategory];
     }
     $str_keywords = '';
     $str_catSub = '';
     $meta_desc = '';
     if ($curCategory) {
         if ($curCategory['parent_id'] && isset(CGlobal::$allCategories[$curCategory['parent_id']])) {
             $parent_cat = CGlobal::$allCategories[$curCategory['parent_id']];
             CGlobal::$curMainCat = CGlobal::$allCategories[$curCategory['parent_id']];
             CGlobal::$curLevel2Cat = $curCategory;
         } else {
             CGlobal::$curMainCat = $curCategory;
         }
     }
     if (CGlobal::$curMainCat && isset(CGlobal::$curMainCat['zones'])) {
         foreach (CGlobal::$curMainCat['zones'] as $zid) {
             if ($zid && isset(CGlobal::$allZones[$zid])) {
                 CGlobal::$curZone = CGlobal::$allZones[$zid];
                 if (CGlobal::$curMainCat['id'] != 100) {
                     break;
                 }
             }
         }
     }
     if (!CGlobal::$curZone) {
         $zid = (int) Url::get("zone_id", 0);
         if ($zid && isset(CGlobal::$allZones[$zid])) {
             CGlobal::$curZone = CGlobal::$allZones[$zid];
         }
     }
     if (AZNet::$page['name'] == 'zone') {
         if (REWRITE_ON) {
             //tuannk add 2010.07.28 fix redirect 301 với các url link sai
             $ebname = CGlobal::$curZone['ebname'];
             $eburl = WEB_DIR . "z" . CGlobal::$curZone['id'] . "/{$ebname}.html";
             if ($ebname != '' && strpos($_SERVER['REQUEST_URI'], $eburl) !== 0) {
                 Url::redirect_url($eburl, 301);
             }
         }
         ##########################################
         #For SEO
         if (isset(CGlobal::$curZone['cats'])) {
             foreach (CGlobal::$curZone['cats'] as $catid) {
                 if (isset(CGlobal::$allCategories[$catid])) {
                     $str_catSub .= ($str_catSub ? ', ' : '') . CGlobal::$allCategories[$catid]['name'];
                     if (CGlobal::$allCategories[$catid]['keywords']) {
                         $str_keywords .= ($str_keywords ? ', ' : '') . CGlobal::$allCategories[$catid]['keywords'];
                     }
                     if (CGlobal::$allCategories[$catid]['description']) {
                         $meta_desc .= ($meta_desc ? ', ' : '') . CGlobal::$allCategories[$catid]['description'];
                     }
                 }
             }
         }
         if (!$str_keywords) {
             if ($str_catSub) {
                 $str_keywords = $str_catSub;
             } else {
                 $str_keywords = CGlobal::$curZone['name'];
             }
         }
         if (!$meta_desc) {
             if ($str_catSub) {
                 $meta_desc = $str_catSub;
             } else {
                 $meta_desc = CGlobal::$curZone['name'];
             }
         }
         CGlobal::$keywords = $str_keywords;
         CGlobal::$meta_desc = $meta_desc;
         CGlobal::$website_title = CGlobal::$curZone['name'];
         #For SEO
         ##########################################
     } else {
         $catid = CGlobal::$curCategory;
         if (isset(CGlobal::$allCategories[$catid]) && CGlobal::$allCategories[$catid]['ref_id']) {
             //redirected
             $ref_id = CGlobal::$allCategories[$catid]['ref_id'];
             $ebname = '';
             if (isset(CGlobal::$allCategories[$ref_id])) {
                 $ebname = CGlobal::$allCategories[$ref_id]['ebname'];
                 if (CGlobal::$allCategories[$ref_id]['parent_id']) {
                     //DM cấp 2 hoặc 3
                     $pid = CGlobal::$allCategories[$ref_id]['parent_id'];
                     if (isset(CGlobal::$allCategories[$pid])) {
                         $pcat = CGlobal::$allCategories[$pid];
                         $ebname = "{$pcat['ebname']}-" . CGlobal::$allCategories[$ref_id]['ebname'];
                         if (CGlobal::$allCategories[$pid]['parent_id']) {
                             //DM cấp 3
                             $ppid = CGlobal::$allCategories[$pid]['parent_id'];
                             if (isset(CGlobal::$allCategories[$ppid])) {
                                 $ppcat = CGlobal::$allCategories[$ppid];
                                 $ebname = "{$ppcat['ebname']}-{$pcat['ebname']}-" . CGlobal::$allCategories[$ref_id]['ebname'];
                             }
                         }
                     }
                 }
                 Url::redirect_url(WEB_DIR . "c{$ref_id}/{$ebname}", 301);
             }
         }
         if (AZNet::$page['name'] == 'list_detail' && REWRITE_ON) {
             //tuannk add 2010.07.28 fix redirect 301 với các url link sai
             $ebname_req = Url::get("ebname");
             $page_no = (int) Url::get("page_no", 1);
             if ($page_no <= 1) {
                 $page_no = 0;
             }
             $ebname = '';
             $eburl = '';
             if (CGlobal::$curMainCat) {
                 $ebname = CGlobal::$curMainCat['ebname'];
                 if (CGlobal::$curLevel2Cat) {
                     $ebname .= "-" . CGlobal::$curLevel2Cat['ebname'];
                     $eburl = WEB_DIR . "c" . CGlobal::$curLevel2Cat['id'] . "/" . $ebname;
                 } else {
                     $eburl = WEB_DIR . "c" . CGlobal::$curMainCat['id'] . "/" . $ebname;
                 }
             }
             if ($ebname != '') {
                 if ($page_no) {
                     $eburl .= "/page-{$page_no}";
                 }
                 if (strpos($_SERVER['REQUEST_URI'], $eburl) !== 0 || $ebname_req != $ebname || isset($_GET['page_no']) && $page_no <= 1) {
                     Url::redirect_url($eburl, 301);
                 }
             }
         }
         if (CGlobal::$curLevel2Cat) {
             //Nếu có cả 2 cấp
             $str_catSub = CGlobal::$curLevel2Cat['name'] . ', ' . CGlobal::$curMainCat['name'];
             //Cho subcat
             if (CGlobal::$curLevel2Cat['keywords']) {
                 CGlobal::$keywords = CGlobal::$curLevel2Cat['keywords'];
             }
             if (CGlobal::$curLevel2Cat['description']) {
                 $meta_desc = CGlobal::$curLevel2Cat['description'];
             }
             //End Cho subcat
             if (CGlobal::$curMainCat['description']) {
                 $meta_desc .= ($meta_desc ? ', ' : '') . CGlobal::$curMainCat['description'];
             }
             //End Cho maincat
         } elseif (CGlobal::$curMainCat) {
             //Nếu chỉ có 1 cấp
             if (isset(CGlobal::$allCategories[CGlobal::$curMainCat['id']]) && isset(CGlobal::$subCategories[CGlobal::$curMainCat['id']])) {
                 $subCats = CGlobal::$subCategories[CGlobal::$curMainCat['id']];
                 foreach ($subCats as $catSub) {
                     if ($catSub['name']) {
                         $str_catSub .= ($str_catSub ? ', ' : '') . $catSub['name'];
                     }
                     if ($catSub['description']) {
                         $meta_desc .= ($meta_desc ? ', ' : '') . $catSub['description'];
                     }
                 }
             }
             $str_catSub .= ($str_catSub ? ', ' : '') . CGlobal::$curMainCat['name'];
             if (CGlobal::$curMainCat['keywords']) {
                 CGlobal::$keywords = CGlobal::$curMainCat['keywords'];
             }
             if (CGlobal::$curMainCat['description']) {
                 $meta_desc .= ($meta_desc ? ', ' : '') . CGlobal::$curMainCat['description'];
             }
         }
         //CGlobal::$curCategory
         if (AZNet::$page['name'] == 'item_detail') {
             if (Item::$item && Item::$item['status'] == 1) {
                 CGlobal::$meta_desc = AZLib::word_limit(AZLib::descriptionText(Item::$item['brief'] . ' ' . Item::$item['description']), 30, '');
             } elseif ($meta_desc) {
                 CGlobal::$meta_desc = $meta_desc;
             }
         } elseif ($meta_desc) {
             CGlobal::$meta_desc = $meta_desc;
         }
     }
     //limit character description and keyword
     CGlobal::$keywords = AZLib::word_limit(CGlobal::$keywords, 20, '');
     CGlobal::$meta_desc = AZLib::word_limit(CGlobal::$meta_desc, 250, '');
     //Gán title cho các trang trong!
     $page_title_arr = array();
     $page_title_arr['post_item'] = "Đăng sản phẩm";
     $page_title_arr['sign_in'] = "Đăng nhập - Đăng ký thành viên";
     if (isset($page_title_arr[AZNet::$page['name']])) {
         CGlobal::$website_title = $page_title_arr[AZNet::$page['name']] . ' | ' . CGlobal::$website_title;
     }
     $this->add_form(new HeaderForm());
 }
Exemplo n.º 21
0
 function item_history()
 {
     $itemids = Url::get('itemids');
     $item_history = array();
     if ($itemids) {
         $itemids = explode(',', $itemids);
         if (is_array($itemids)) {
             foreach ($itemids as $key) {
                 $item = Item::get_item($key);
                 if ($item) {
                     unset($item['description'], $item['post_ip'], $item['created_time']);
                     $item_['item_id'] = $item['id'];
                     $item_['item_url'] = "p" . $item['id'] . "/" . EClassApi::safe_title($item['name']) . ".html";
                     $item_['item_title'] = ucfirst(EnbacLib::remove_4_js($item['name']));
                     $item_['price'] = $item['price'] ? number_format(EClassApi::convertCurrency($item['price'], $item['currency_id']), 0, ',', '.') : 'Liên hệ';
                     $item_['item_image'] = $item['original_image_url'] ? EClassApi::getImageThumb($item['original_image_url'], 120, 105, 0, $item['img_server']) : '';
                     $item_history[] = $item_;
                     unset($item);
                 }
             }
         }
         /*  $re = DB::query("SELECT id, name, price, currency_id, original_image_url, img_server, status, state  FROM item WHERE id IN($itemids) ORDER BY find_in_set(id, '$itemids')");
         
                     if ($re) {
                         while ($fitem = mysql_fetch_assoc($re)) {
                             if ($fitem['status'] == 1 && $fitem['state'] == 0) {
                                 $item['item_id'] = $fitem['id'];
                                 $item['item_url'] = "p" . $fitem['id'] . "/" . EClassApi::safe_title($fitem['name']) . ".html";
                                 $item['item_title'] = ucfirst(EnbacLib::remove_4_js($fitem['name']));
         
                                 // $item['price']  		= $fitem['price']?number_format($fitem['price'],0,',','.'):'Liên hệ';
                                 $item['price'] = $fitem['price'] ? number_format(EClassApi::convertCurrency($fitem['price'], $fitem['currency_id']), 0, ',', '.') : 'Liên hệ';
         
                                 //$item['item_image']  	= ($fitem['original_image_url']) ? EClassApi::getImageThumbIn($fitem['original_image_url'],150,120,$fitem['img_server']) : '';
                                 $item['item_image'] = ($fitem['original_image_url']) ? EClassApi::getImageThumb($fitem['original_image_url'], 120, 105, 0, $fitem['img_server']) : '';
         
                                 $item_history[] = $item;
                             }
                         }
                     }*/
     }
     echo json_encode($item_history);
 }
Exemplo n.º 22
0
 function insert_sub_image_payment_new()
 {
     $img_id = Url::get('item_id');
     $code_emb = Url::get('code_emb');
     $main_item_id = Url::get('main_item_id');
     if (empty($code_emb) || $code_emb == "undefined") {
         $code_emb = "";
         DB::query("UPDATE `item_sub` SET script_pay = '' WHERE id={$img_id}");
     } else {
         if (strlen(strstr($code_emb, '<a href="https://sohapay.com')) > 0 && strlen(strstr($code_emb, '<img')) > 0) {
             $str_start = strpos($code_emb, '<a href="https://sohapay.com');
             $main_str = substr($code_emb, $str_start);
             $sub_str = split("</a>", $main_str);
             $code_emb = $sub_str[0] . "</a>";
             $patt = '<a href="https://sohapay.com';
             $res = DB::select('item_sub', "id={$img_id}");
             $str = split($patt, $res['script_pay']);
             $des_new = $str[0] . $code_emb;
             DB::query("UPDATE `item_sub` SET script_pay = '{$des_new}' WHERE id={$img_id}");
         } else {
             DB::query("UPDATE `item_sub` SET script_pay = '' WHERE id={$img_id}");
         }
     }
     Item::get_item($main_item_id, 1);
 }