Пример #1
0
 function draw()
 {
     global $display;
     $cat_newss = array();
     $display->add('is_admin', User::have_permit(ADMIN_NEWS));
     $display->add('url_home', WEB_DIR);
     $display->add('time_now', News::displayTime());
     $display->add('cat_name', $this->news_cat['name']);
     $display->add('cat_url', URL::build('news_list', array('news_catid' => $this->news_cat['id'], 'azname' => AZLib::safe_title($this->news_cat['name']))));
     $condition = ' status=1 ';
     $total = DB::count("news", $condition);
     $limit = '';
     //$pagging	= AZPagging::paging_list($limit,20,'page_no');
     $pagging = AZPagging::paging_list($limit, $total, 20);
     $re = DB::query('SELECT * FROM news WHERE ' . $condition . ' ORDER BY id DESC' . $limit);
     if ($re) {
         while ($news = mysql_fetch_assoc($re)) {
             $news['title'] = stripslashes($news['title']);
             $news['brief'] = stripslashes($news['brief']);
             $news['url'] = Url::build('news_detail', array('news_catid' => $news['news_catid'], 'news_id' => $news['id'], 'azname' => AZLib::safe_title($news['title'])));
             if ($news['image']) {
                 $news['image'] = AZLib::getImageThumb($news['image'], 150, 0, 0, $news['img_server']);
             }
             $news['news_h'] = date('H:i', $news['time_created']);
             $news['news_d'] = date('d-m-Y', $news['time_created']);
             $news['admin_link'] = News::admin_link($news);
             $cat_newss[$news['id']] = $news;
         }
     }
     $display->add('pagging', $pagging);
     $display->add('cat_newss', $cat_newss);
     $display->output("NewsPage");
 }
Пример #2
0
 function draw()
 {
     global $display;
     $news_ids = '';
     $hot_newss = array();
     $configs = @CGlobal::$configs['NewsHomeHot']['conf_val'];
     if ($configs) {
         $configs = unserialize(stripslashes($configs));
         $title_news = $configs['title'];
         $news_ids = $configs['news_ids'];
     } else {
         $title_news = "TIN HOT";
         $news_ids = '';
     }
     if ($news_ids != '') {
         $re = DB::query("SELECT id, title, news_catid FROM news WHERE id IN({$news_ids}) AND status = 1 ORDER BY find_in_set(id,'{$news_ids}')");
         if ($re) {
             while ($news = mysql_fetch_assoc($re)) {
                 $news['title'] = stripslashes($news['title']);
                 $news['url'] = Url::build('news_detail', array('news_catid' => $news['news_catid'], 'news_id' => $news['id'], 'azname' => AZLib::safe_title($news['title'])));
                 $hot_newss[$news['id']] = $news;
             }
         }
     }
     if (User::is_admin()) {
         $display->add("is_admin", 1);
         $display->add("msg", $this->showFormErrorMessages(1));
         $display->add('begin_form', $this->beginForm(true, 'post', false, false, 1));
         $display->add('end_form', $this->endForm(true));
     }
     $display->add('title_news', $title_news);
     $display->add('news_ids', $news_ids);
     $display->add('hot_newss', $hot_newss);
     $display->output("NewsHomeHot");
 }
Пример #3
0
 function draw()
 {
     global $display;
     $cats = array();
     $display->add('url_add', Url::build_current(array('cmd' => 'add')));
     /*
     $display->add('url_edit',Url::build_current(array('cmd'=>'edit','id'=>$category['id'])));
     $display->add('url_del',Url::build_current(array('cmd'=>'delete','id'=>$category['id'])));
     $display->add('url_sort_up',Url::build_current(array('cmd'=>'move_home','dir'=>'move_home','id'=>$category['id'])));
     $display->add('url_sort_low',Url::build_current(array('cmd'=>'move_home','dir'=>'move_end','id'=>$category['id'])));
     */
     $posMin = 1;
     $posMax = DB::count("news_categories");
     $re = DB::query('SELECT * FROM news_categories ORDER BY position, id');
     if ($re) {
         $index = 0;
         $column = 1;
         while ($row = mysql_fetch_assoc($re)) {
             $row['url'] = URL::build('news_list', array('news_catid' => $row['id'], 'azname' => AZLib::safe_title($row['name'])));
             $row['edit'] = Url::build_current(array('cmd' => 'edit', 'id' => $row['id']));
             $row['delete'] = Url::build_current(array('cmd' => 'delete', 'id' => $row['id']));
             $row['move_home'] = '<a title="Chuyển lên trên cùng" href="' . Url::build_current(array('cmd' => 'move_home', 'id' => $row['id'])) . '">Move HOME</a>';
             $row['move_end'] = '<a title="Chuyển xuống dưới cùng" href="' . Url::build_current(array('cmd' => 'move_end', 'id' => $row['id'])) . '">Move END</a>';
             if ($row['position'] > $posMin) {
                 $row['move_up'] = '<a title="Chuyển lên" href="' . Url::build_current(array('cmd' => 'move_up', 'id' => $row['id'])) . '"><img src="style/img/admin/move_up.gif"></a>';
             }
             if ($row['position'] < $posMax) {
                 $row['move_down'] = '<a title="Chuyển xuống" href="' . Url::build_current(array('cmd' => 'move_down', 'id' => $row['id'])) . '"><img src="style/img/admin/move_down.gif"></a>';
             }
             $cats[$row['id']] = $row;
         }
     }
     $display->add('cats', $cats);
     $display->output("NewsAdminCats");
 }
Пример #4
0
 function draw()
 {
     $this->beginForm();
     global $display;
     $user_id = intval(Url::get('user_id'));
     $user_info = DB::select('user', 'id="' . $user_id . '"');
     $display->add('created_time_from', Url::get('created_time_from'));
     $display->add('created_time_to', Url::get('created_time_to'));
     //search theo ngay thang nam
     $created_time_from = 0;
     $created_time_to = 0;
     if (Url::get('created_time_from')) {
         $date_arr = explode('-', Url::get('created_time_from'));
         if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) {
             $created_time_from = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]);
         }
     }
     if (Url::get('created_time_to')) {
         $date_arr = explode('-', Url::get('created_time_to'));
         if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) {
             $created_time_to = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]);
         }
     }
     $search_value = ' 1 ';
     if ($created_time_from) {
         $search_value .= ' AND created_time >= ' . $created_time_from;
     }
     if ($created_time_to) {
         $search_value .= ' AND created_time <= ' . $created_time_to;
     }
     $item_per_page = 50;
     $sql_count = 'SELECT COUNT(id) AS total_item FROM item WHERE user_id = "' . $user_id . '" AND ' . $search_value;
     $total = DB::fetch($sql_count, 'total_item', 0);
     $items = array();
     if ($total) {
         $limit = '';
         $paging = AZPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Sản phẩm', 'Trang');
         $sql = 'SELECT * FROM item WHERE user_id = "' . $user_id . '" AND ' . $search_value . ' ORDER BY modify_time  DESC ' . $limit;
         $result = DB::query($sql);
         if ($result) {
             while ($row = mysql_fetch_assoc($result)) {
                 $row['ebname'] = AZLib::safe_title($row['name']);
                 $row['modify_time'] = date('d/m/y H:i', $row['modify_time']);
                 $row['created_time'] = date('d/m/y H:i', $row['created_time']);
                 $row['del_link'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'cmd=delete&id=' . $row['id'] . '&user_id=' . $row['user_id']);
                 $items[$row['id']] = $row;
             }
         }
     } else {
         $paging = '';
     }
     $display->add('user_info', $user_info);
     $display->add('total_item', $total);
     $display->add('items', $items);
     $display->add('paging', $paging);
     $display->output('item_list');
     $this->endForm();
 }
Пример #5
0
 function draw()
 {
     global $display;
     $item_ids = '';
     $item_news = array();
     $configs = @CGlobal::$configs['ItemNew']['conf_val'];
     if ($configs) {
         $configs = unserialize(stripslashes($configs));
         $title_new = $configs['title'];
         $item_ids = $configs['item_ids'];
     } else {
         $title_new = "SẢN PHẨM MỚI";
         $item_ids = '';
     }
     if ($item_ids) {
         $re = DB::query("SELECT * FROM item WHERE id IN({$item_ids}) AND status = 1 ORDER BY find_in_set(id,'{$item_ids}')");
         if ($re) {
             while ($product = mysql_fetch_assoc($re)) {
                 if ($product['img_url']) {
                     $product['image'] = AZLib::getImageThumb($product['img_url'], 160, 150, 0, $product['img_server']);
                 } else {
                     $product['image'] = "";
                     //"style/images/no-images-35x35.gif";
                 }
                 if (isset(CGlobal::$allCategories[$product['category_id']])) {
                     $product['url'] = WEB_DIR . CGlobal::$allCategories[$product['category_id']]['nice_name'] . "/p{$product['id']}/" . AZLib::safe_title($product['name']) . ".html";
                 } else {
                     $product['url'] = WEB_DIR . "p{$product['id']}/" . AZLib::safe_title($product['name']) . ".html";
                 }
                 $product['name'] = stripslashes($product['name']);
                 if ($product['list_brief'] == '') {
                     $product['list_brief'] = $product['brief'];
                 }
                 $product['list_brief'] = AZLib::remove_4_js(AZLib::plainText(AZLib::parseBBCode(html_entity_decode($product['list_brief'], ENT_QUOTES, "UTF-8"))));
                 $product['list_brief'] = preg_replace("/\\[([\\s]*[0-9]{1,2}[\\s]*)\\]/eis", " ", $product['list_brief']);
                 $product['list_brief'] = str_replace(array("'", "\""), array("", " "), $product['list_brief']);
                 $product['list_brief'] = AZLib::word_limit($product['list_brief'], 50, '');
                 $product['list_brief'] = '<b>' . str_replace(array("'", "\""), array("", " "), $product['name']) . '</b><br />' . $product['list_brief'];
                 $product['price_num'] = $product['price'];
                 $product['price'] = AZLib::getPrice($product['price'], $product['currency_id']);
                 $item_news[$product['id']] = $product;
             }
         }
     }
     if (User::is_admin()) {
         $display->add("is_admin", 1);
         $display->add("msg", $this->showFormErrorMessages(1));
         $display->add('begin_form', $this->beginForm(true, 'post', false, false, 1));
         $display->add('end_form', $this->endForm(true));
     }
     $display->add('title_new', $title_new);
     $display->add('item_ids', $item_ids);
     $display->add('item_news', $item_news);
     $display->output("ItemNew");
 }
Пример #6
0
 function draw()
 {
     if (Item::$item && isset(Item::$item['display']) && Item::$item['display']) {
         global $display;
         $re = DB::query("SELECT relate_id FROM item_relate WHERE item_id = " . Item::$item['id']);
         $relate_ids = '';
         $relate_arrs = array();
         if ($re) {
             while ($relate = mysql_fetch_assoc($re)) {
                 $relate_ids .= ($relate_ids != '' ? "," : "") . $relate['relate_id'];
             }
         }
         if ($relate_ids) {
             $re = DB::query("SELECT * FROM item WHERE id IN({$relate_ids}) AND status = 1 ORDER BY item_order");
             $relate_ids = '';
             if ($re) {
                 while ($product = mysql_fetch_assoc($re)) {
                     $relate_ids .= ($relate_ids != '' ? ',' : '') . $product['id'];
                     if ($product['img_url']) {
                         $product['image'] = AZLib::getImageThumb($product['img_url'], 180, 0, 0, $product['img_server']);
                     } else {
                         $product['image'] = "";
                         //"style/images/no-images-35x35.gif";
                     }
                     if (isset(CGlobal::$allCategories[$product['category_id']])) {
                         $product['url'] = WEB_DIR . CGlobal::$allCategories[$product['category_id']]['nice_name'] . "/p{$product['id']}/" . AZLib::safe_title($product['name']) . ".html";
                     } else {
                         $product['url'] = WEB_DIR . "p{$product['id']}/" . AZLib::safe_title($product['name']) . ".html";
                     }
                     $product['name'] = stripslashes($product['name']);
                     $product['price'] = AZLib::getPrice($product['price'], $product['currency_id']);
                     $relate_arrs[] = $product;
                 }
             }
         }
         $display->add('relate_ids', $relate_ids);
         $display->add('relate_arrs', $relate_arrs);
         $display->add('item_detail', Item::$item);
         $display->add("share_url", urlencode("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']));
         $display->add('WEB_NAME', WEB_NAME);
         if (User::have_permit(ADMIN_ITEM)) {
             $display->add('is_admin', 1);
             $display->add('begin_form', $this->beginForm(false, 'post', false, false, 1));
             $display->add('end_form', $this->endForm(true));
         }
         $display->output("ItemRelate");
     }
 }
Пример #7
0
 function draw()
 {
     global $display;
     $this->beginForm();
     $display->add('url_add', Url::build_current(array('cmd' => 'add')));
     $current_path = "<a href='" . URL::build('news_list', array('news_catid' => $this->row['id'], 'azname' => AZLib::safe_title($this->row['name']))) . "'>" . $this->row['name'] . "</a>";
     $display->add('current_cat', $current_path);
     $display->add('name', Url::get('name', $this->row['name']));
     $display->add('position_option', AZLib::getOptionNum(1, DB::count("news_categories"), Url::get('position', $this->row['position'])));
     $display->add('public', Url::get('public', $this->row['public'] ? 1 : 2));
     $display->add('keywords', Url::get('keywords', $this->row['keywords']));
     $display->add('description', Url::get('description', $this->row['description']));
     $display->add('msg', $this->showFormErrorMessages(1));
     $display->output("NewsAdminCatsEdit");
     $this->endForm();
 }
Пример #8
0
 function Document($row)
 {
     Module::Module($row);
     $cmd = Url::get('cmd');
     require_once "forms/DocumentList.php";
     switch ($cmd) {
         case 'delete':
             $this->add_form(new Deletedocument());
             break;
         case 'change':
             $this->add_form(new PublicdocumentForm());
             break;
         default:
             $id = (int) Url::get('id');
             $azname = trim(URL::get("azname", ''));
             if ($id || $azname != '') {
                 if ($id && $azname != '') {
                     $document = DB::select("document", "id={$id}");
                     if ($document && $azname == AZLib::safe_title($document['title']) && $document['file_path']) {
                         $file_src = DATA_PATH . "document/{$document['file_path']}";
                         if (file_exists(ROOT_PATH . $file_src)) {
                             $ext = AZLib::getExtension($file_src);
                             if ($ext && strlen($ext) <= 5) {
                                 $ext_app = substr($ext, 1);
                                 if ($document['status'] == 1 || User::haveAnyPermission(ADMIN_DOCUMENT)) {
                                     DB::query("UPDATE document SET down_num=down_num+1, time_last=" . TIME_NOW . " WHERE id={$id}");
                                     DB::close();
                                     header("Content-type: application/{$ext_app}");
                                     header("Content-Disposition: attachment; filename=" . date("Y.m.d-H\\hi", $document['time_m']) . "-{$id}-{$azname}{$ext}");
                                     readfile(ROOT_PATH . $file_src);
                                     exit;
                                 }
                             }
                         }
                     }
                 }
                 header("HTTP/1.0 404 Not Found");
                 echo "<h1>404 - Not Found!<br />Return to <a href='" . WEB_ROOT . "'>" . WEB_NAME . "</a></h1>";
                 exit;
             }
             $this->add_form(new ListdocumentForm());
             break;
     }
 }
Пример #9
0
 function draw()
 {
     global $display;
     $display->add('msg', $this->showFormErrorMessages(1));
     $display->add("customer_name", stripslashes(URL::get('customer_name', Cart::$cart['customer_name'])));
     $display->add("customer_email", stripslashes(URL::get('customer_email', Cart::$cart['customer_email'])));
     $display->add("customer_phone", stripslashes(URL::get('customer_phone', Cart::$cart['customer_phone'])));
     $display->add("customer_address", stripslashes(URL::get('customer_address', Cart::$cart['customer_address'])));
     $display->add("customer_note", stripslashes(URL::get('customer_note', Cart::$cart['customer_note'])));
     //$quantity_total	=0;
     $price_total = 0;
     $cart_items = array();
     if (Cart::$cart_items) {
         foreach (Cart::$cart_items as $cart_item_id => $cart_item) {
             $item = Cart::$items[$cart_item['item_id']];
             if (isset(CGlobal::$allCategories[$item['category_id']])) {
                 $cart_item['url'] = WEB_DIR . CGlobal::$allCategories[$item['category_id']]['nice_name'] . "/p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html";
             } else {
                 $cart_item['url'] = WEB_DIR . "p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html";
             }
             $cart_item['name'] = $item['name'];
             $cart_item['price_num'] = $item['price'];
             $cart_item['price'] = number_format($item['price'], 0, ',', '.');
             if ($item['img_url']) {
                 $cart_item['img_url'] = AZLib::getImageThumb($item['img_url'], 120, 120, 0, $item['img_server']);
             } else {
                 $item['img_url'] = '';
             }
             $cart_item['row_total'] = $cart_item['checked'] ? number_format($item['price'] * $cart_item['quantity'], null, null, '.') . ' VNĐ' : '';
             $price_total += $cart_item['checked'] ? $item['price'] * $cart_item['quantity'] : 0;
             //$quantity_total	+=	$cart_item['checked'] ? $cart_item['quantity'] : 0;
             $cart_items[$cart_item['id']] = $cart_item;
         }
     }
     //$display->add('quantity_total',number_format($quantity_total,null,null,'.'));
     $display->add('price_total', number_format($price_total, null, null, '.'));
     $display->add('url_finish', Url::build_current(array('cmd' => 'finish')));
     $display->add('cart_items', $cart_items);
     $display->add('cart_id', "Cart_" . Cart::$cart['id']);
     $this->beginForm();
     $display->output('CartFinish');
     $this->endForm();
 }
Пример #10
0
 function draw()
 {
     global $display;
     $cat_newss = array();
     $news_cat_id = Url::get('news_catid', 'id', 0);
     AZLib::getNewsCats();
     $display->add('news_cat_id', $news_cat_id);
     if (CGlobal::$allNewsCategories) {
         foreach (CGlobal::$allNewsCategories as $news_cat) {
             if ($news_cat['public']) {
                 $news_cat['url'] = URL::build('news_list', array('news_catid' => $news_cat['id'], 'azname' => AZLib::safe_title($news_cat['name'])));
                 $cat_newss[$news_cat['id']] = $news_cat;
             }
         }
     }
     $display->add('cat_newss', $cat_newss);
     $display->add('is_admin', User::have_permit(ADMIN_NEWS));
     $display->output("NewsMenu");
 }
Пример #11
0
 function draw()
 {
     global $display;
     if (User::is_admin()) {
         $display->add("is_admin", 1);
     }
     $display->add('url_home', WEB_DIR);
     $display->add('time_create', News::displayTime($this->news['time_created']));
     $display->add('title', stripslashes($this->news['title']));
     $display->add('brief', stripslashes($this->news['brief']));
     $display->add('content', stripslashes($this->news['content']));
     $display->add('pen_name', stripslashes($this->news['pen_name']));
     if ($this->news['source'] != '') {
         $display->add('source', " ( theo <i>" . stripslashes($this->news['source']) . "</i> )");
     } else {
         $display->add('source', "");
     }
     if (User::have_permit(ADMIN_NEWS)) {
         $display->add('admin_link', News::admin_link($this->news));
     }
     if ($this->news['image']) {
         $display->add('img_full_url', "http://" . CGlobal::$img_server[$this->news['img_server']] . $this->news['image']);
         $display->add('img_max_path', AZLib::getImageThumbMax($this->news['image'], '', 1, $this->news['img_server']));
         $display->add('image_title', stripslashes($this->news['image_title']));
         $display->add('image_url', AZLib::getImageThumb($this->news['image'], 180, 0, 0, $this->news['img_server']));
         //AZLib::safe_title($this->news['title']))
         $display->add('image_oringin', $this->news['image']);
     }
     $news_cart = CGlobal::$allNewsCategories[$this->news['news_catid']];
     $display->add('news_home_link', Url::build('news'));
     if ($news_cart) {
         $display->add('cat_link', Url::build('news', array('news_catid' => $news_cart['id'], 'azname' => AZLib::safe_title($news_cart['name']))));
         $display->add('cat_name', $news_cart['name']);
     }
     $display->add("share_title", urlencode(CGlobal::$website_title));
     $display->add("share_url", "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
     $display->add("share_des", urlencode(trim(CGlobal::$meta_desc)));
     $display->output("NewsDetail");
 }
Пример #12
0
 function draw()
 {
     global $display;
     $display->add('msg', $this->showFormErrorMessages(1));
     $quantity_total = 0;
     $price_total = 0;
     $cart_items = array();
     if (Cart::$cart_items) {
         foreach (Cart::$cart_items as $cart_item_id => $cart_item) {
             $item = Cart::$items[$cart_item['item_id']];
             if (isset(CGlobal::$allCategories[$item['category_id']])) {
                 $cart_item['url'] = WEB_DIR . CGlobal::$allCategories[$item['category_id']]['nice_name'] . "/p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html";
             } else {
                 $cart_item['url'] = WEB_DIR . "p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html";
             }
             $cart_item['name'] = $item['name'];
             $cart_item['price_num'] = $item['price'];
             $cart_item['price'] = number_format($item['price'], 0, ',', '.');
             if ($item['img_url']) {
                 $cart_item['img_url'] = AZLib::getImageThumb($item['img_url'], 120, 120, 0, $item['img_server']);
             } else {
                 $item['img_url'] = '';
             }
             $cart_item['row_total'] = $cart_item['checked'] ? number_format($item['price'] * $cart_item['quantity'], null, null, '.') . ' VNĐ' : '';
             $cart_item['delete'] = Url::build_current(array('cmd' => 'delete', 'id' => $cart_item['id']));
             $price_total += $cart_item['checked'] ? $item['price'] * $cart_item['quantity'] : 0;
             $quantity_total += $cart_item['checked'] ? $cart_item['quantity'] : 0;
             $cart_items[$cart_item['id']] = $cart_item;
         }
     }
     $display->add('quantity_total', number_format($quantity_total, null, null, '.'));
     $display->add('price_total', number_format($price_total, null, null, '.'));
     $display->add('url_finish', Url::build_current(array('cmd' => 'finish')));
     $display->add('cart_items', $cart_items);
     $display->add("print_link", Url::open_popup(Url::build('cart_print', array('id' => Cart::$cart['id'])), 1000, 800, false, false, false, false, false, 1, 1));
     $this->beginForm();
     $display->output('Cart');
     $this->endForm();
 }
Пример #13
0
 function draw()
 {
     global $display;
     $home_newss = array();
     $display->add('is_admin', User::have_permit(ADMIN_NEWS));
     $display->add('url_home', WEB_DIR);
     $display->add('time_now', News::displayTime());
     $one_cart = '';
     AZLib::getNewsCats();
     if (CGlobal::$allNewsCategories) {
         foreach (CGlobal::$allNewsCategories as $news_catid => $news_cat) {
             if ($news_cat['public']) {
                 $newss = array();
                 $re = DB::query("SELECT * FROM news WHERE status=1 AND news_catid={$news_catid} ORDER BY id DESC LIMIT 0,4");
                 if ($re) {
                     $i = 1;
                     while ($news = mysql_fetch_assoc($re)) {
                         if ($i == 1) {
                             if ($news['image']) {
                                 $news['image'] = AZLib::getImageThumb($news['image'], 150, 0, 0, $news['img_server']);
                             }
                             $i++;
                         }
                         $news['url'] = URL::build('news_detail', array('news_catid' => $news['news_catid'], 'news_id' => $news['id'], 'azname' => AZLib::safe_title($news['title'])));
                         $news['news_h'] = date('H:i', $news['time_created']);
                         $news['news_d'] = date('d-m-Y', $news['time_created']);
                         $newss[$news['id']] = $news;
                     }
                 }
                 if ($newss) {
                     $home_newss[$news_catid] = array('name' => $news_cat['name'], 'url' => URL::build('news_list', array('news_catid' => $news_catid, 'azname' => AZLib::safe_title($news_cat['name']))), 'newss' => $newss);
                 }
             }
         }
     }
     $display->add('home_newss', $home_newss);
     $display->output("NewsHome");
 }
Пример #14
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());
 }
Пример #15
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();
 }
Пример #16
0
 function item_history()
 {
     $itemids = Url::get('itemids');
     $item_history = array();
     if ($itemids) {
         $re = DB::query("SELECT id, name, price, currency_id, img_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'] . "/" . AZLib::safe_title($fitem['name']) . ".html";
                     $item['item_title'] = ucfirst(AZLib::remove_4_js($fitem['name']));
                     // $item['price']  		= $fitem['price']?number_format($fitem['price'],0,',','.'):'Liên hệ';
                     $item['price'] = $fitem['price'] ? number_format(AZLib::convertCurrency($fitem['price'], $fitem['currency_id']), 0, ',', '.') : 'Liên hệ';
                     //$item['item_image']  	= ($fitem['img_url']) ? AZLib::getImageThumbIn($fitem['img_url'],150,120,$fitem['img_server']) : '';
                     $item['item_image'] = $fitem['img_url'] ? AZLib::getImageThumb($fitem['img_url'], 120, 105, 0, $fitem['img_server']) : '';
                     $item_history[] = $item;
                 }
             }
         }
     }
     echo json_encode($item_history);
 }
Пример #17
0
 function draw2()
 {
     $keywords = AZLib::getParam('keywords');
     $total_item = 0;
     $search_result = false;
     $items = array();
     $paging = '';
     $cmd = '';
     $cat_search_id = 0;
     $item_array = array();
     $listCat = array();
     if ($keywords) {
         //AZLib::getCats();
         require "./includes/sphinxapi.class.php";
         foreach (CGlobal::$allCategories as $value) {
             if ($value['parent_id'] == 0) {
                 $cat_list[$value['id']] = $value['brief_name'];
             }
         }
         $category = $this->getTotalPerCategory($keywords);
         foreach ($category as $row) {
             $row['brief_name'] = isset($cat_list[$row['level_1_catid']]) && $cat_list[$row['level_1_catid']] ? $cat_list[$row['level_1_catid']] : "Khác";
             $listCat[$row['level_1_catid']] = array("level_1_catid" => $row["level_1_catid"], "brief_name" => $row['brief_name'], "count_ad" => $row['@count']);
         }
         $total = 0;
         $catid = 0;
         $catActive = '';
         $total_cat = 0;
         if ($listCat) {
             $first_val = array_slice($listCat, 0, 1);
             $total = $first_val[0]['count_ad'];
             $catid = $first_val[0]['level_1_catid'];
             $catActive = $first_val[0]['brief_name'];
             $total_cat = count($listCat);
         }
         $i = 0;
         $allrecord = 0;
         $otherCat = '';
         $cat_content = "";
         foreach ($listCat as $cat) {
             if ($i < 3) {
                 $active = $i == 0 ? "class=\"active\"" : "";
                 $cat_content .= "<li id=\"tab_{$i}\" {$active} onclick=\"javascript:acive_tab_cat(this);\"><a href=\"javascript:void(0);\" onclick=\"javascript:search_cat({$cat['level_1_catid']},{$cat['count_ad']},1,0);\"><span id=\"kby_{$cat['level_1_catid']}\">" . $cat['brief_name'] . " <font style=\"color: #5a7e92;font-weight: normal;\">(" . $cat['count_ad'] . ")</font></span></a></li>";
             } else {
                 $otherCat .= "<div class=\"other\"><a href=\"javascript:void(0);\" onclick=\"javascript:search_cat({$cat['level_1_catid']},{$cat['count_ad']},1,0);acive_tab_cat(this);\" id=\"tab_{$i}\"><span id=\"kby_{$cat['level_1_catid']}\">" . $cat['brief_name'] . " <font style=\"color: #5a7e92;font-weight: normal;\">(" . $cat['count_ad'] . ")</font></span></a></div>";
             }
             $i++;
             $allrecord = $allrecord + $cat['count_ad'];
         }
         $display->add("cat_content", $cat_content);
         $display->add("CatActiveId", $catid);
         $display->add("catActive", $catActive);
         $display->add("listCat", $listCat);
         $display->add("allrecord", $allrecord);
         $display->add("otherCat", str_replace(array(chr(13), chr(10)), "", $otherCat));
         $display->add("total_cat", $total_cat);
         //Init for sphinx search paging
         $pager = new Pager();
         //config
         $limit = SEARCH_LIMIT;
         $pager->type = "search";
         $pager->catid = $catid;
         $pager->total = $total;
         $pager->limit = $limit;
         $pager->page_param = 'page';
         $pager->page = 1;
         $offset = $pager->get_offset();
         $limit_from = $pager->limit_from();
         $limit_to = $pager->limit_to();
         //Sphinx search by Nova
         $q = $keywords;
         $mode = SPH_MATCH_EXTENDED2;
         //Init config
         $host = SPHINX_SERVER;
         $port = SPHINX_PORT;
         //$index 		= SPHINX_INDEX;
         $index = "enbac delta";
         $filtervals = array();
         $ranker = SPH_RANK_WORDCOUNT;
         $cl = new SphinxClient();
         $cl->SetServer($host, $port);
         $cl->SetConnectTimeout(1);
         $cl->SetWeights(array(100, 1));
         $cl->SetMatchMode($mode);
         //filter
         if ($catid) {
             $cl->SetFilter('level_1_catid', array($catid));
         }
         $cl->SetFilter('status', array('1'));
         $cl->SetFieldWeights(array('user_name' => 10000, 'name' => 1000, 'description' => 1));
         //$cl->SetSortMode( SPH_SORT_EXTENDED, 'up_time DESC' );
         //$cl->SetSortMode( SPH_SORT_RELEVANCE);//Sort theo kq chính xác nhất
         //$cl->SetSortMode ( SPH_SORT_EXPR, "@weight + ( user_karma + ln(pageviews) )*0.1");
         $cl->SetSortMode(SPH_SORT_EXPR, "@weight");
         //Sort theo trọng số
         //SPH_RANK_WORDCOUNT
         //SPH_MATCH_EXTENDED2
         //end filter
         $cl->SetLimits($offset, $limit, 10000);
         $cl->SetRankingMode($ranker);
         $cl->SetArrayResult(true);
         $res = $cl->Query($q, $index);
         /*echo '<pre>';
         		print_r($res["matches"]);*/
         if ($res && isset($res["matches"])) {
             if (is_array($res["matches"])) {
                 foreach ($res["matches"] as $results) {
                     $list_item_id[] = $results['id'];
                 }
             }
             $comma_separated = join(",", $list_item_id);
         }
         if ($total) {
             if ($limit_to > $total) {
                 $limit_to = $total;
             }
             $comma_separated = join(",", $list_item_id);
             if ($comma_separated) {
                 //$sql = "SELECT id,name,up_time,price,user_id,user_name, level_1_catid,category_id,description,img_url, img_server FROM item WHERE id IN($comma_separated) AND status=1 ORDER BY up_time DESC";
                 //$sql = "SELECT id,name,up_time,price,user_id,user_name, level_1_catid,category_id,description,img_url, img_server FROM item WHERE id IN($comma_separated) AND status=1  AND state=0 ORDER BY find_in_set(id,'$comma_separated')";
                 $sql = "SELECT id,name,up_time,price,user_id,user_name, level_1_catid,category_id,description,img_url, img_server FROM item WHERE id IN({$comma_separated}) AND status=1 ORDER BY find_in_set(id,'{$comma_separated}')";
                 $search_result = DB::query($sql);
                 $pager->total = $total;
                 $paging = $pager->page_link();
             }
         }
     }
     $highlight = '';
     if ($keywords) {
         $highlight = $str_search = str_replace(array('+', '/', '|', '-', '*'), "", $keywords);
         $highlight = AZLib::trimSpace($highlight);
         $highlight = str_replace("'", '', $highlight);
         $highlight = str_replace("&#39;", '', $highlight);
         $highlight = str_replace("&quot;", '', $highlight);
     }
     $highlight1 = '';
     if ($highlight) {
         $arr = explode(' ', $highlight);
         if ($arr) {
             $highlight = "";
             foreach ($arr as $word) {
                 $highlight = ($highlight ? $highlight . ', ' : '') . "'{$word}'";
                 $highlight1 = ($highlight1 ? $highlight1 . ',' : '') . $word;
             }
         }
     }
     if ($keywords && $search_result) {
         while ($item = mysql_fetch_assoc($search_result)) {
             $item['profile_url'] = WEB_DIR . $item['user_name'];
             $item['name_hl'] = AZLib::HighLightKeyword(strip_tags(AZLib::filter_title($item['name'])), $highlight1);
             $item_time = TIME_NOW - $item['up_time'];
             //neu nho hon 1h thi tinh ra phut
             if ($item_time < 3600) {
                 $item['item_time'] = floor($item_time / 60) . " phút trước đây";
             } elseif ($item_time < 86400) {
                 $item['item_time'] = floor($item_time / 3600) . " giờ trước đây";
             } else {
                 $item['item_time'] = date('\\n\\gà\\y j \\t\\há\\n\\g n', $item['up_time']);
             }
             $item['description'] = AZLib::HighLightKeyword(AZLib::delDoubleSpace(AZLib::trimSpace(strip_tags(AZLib::post_db_parse_html(preg_replace('/\\[[0-9]{1,3}\\]/', '', $item['description']))))), $highlight1, 35, "background:yellow;font-size:14px;font-weight:bold;color:blue;");
             $ebname = AZLib::safe_title($item['name']);
             $ebname_tmp = substr(AZLib::safe_title($item['name']), 0, 20);
             if (isset(CGlobal::$allCategories[$item['category_id']])) {
                 $item['item_url'] = WEB_DIR . AZRewrite::formatUrl('?page=item_detail&id=' . $item['id'] . '&ebname=' . $ebname . '&nice_name=' . CGlobal::$allCategories[$item['category_id']]['nice_name']);
                 $item['item_url_tmp'] = WEB_ROOT . CGlobal::$allCategories[$item['category_id']]['nice_name'] . '/p' . $item['id'] . '/' . $ebname_tmp . '...';
             } else {
                 $item['item_url'] = WEB_DIR . AZRewrite::formatUrl('?page=item_detail&id=' . $item['id'] . '&ebname=' . $ebname);
                 $item['item_url_tmp'] = WEB_ROOT . 'p' . $item['id'] . '/' . $ebname_tmp . '...';
             }
             if ($item['img_url']) {
                 $item['img_url'] = AZLib::getImageThumb($item['img_url'], 110, 0, 1, $item['img_server']);
             }
             $item['price'] = number_format($item['price'], 0, ',', '.');
             $item_array[] = $item;
         }
     }
     global $start_rb;
     $mtime = microtime();
     $mtime = explode(" ", $mtime);
     $mtime = $mtime[1] + $mtime[0];
     $end_rb = $mtime;
     $search_time = round($end_rb - $start_rb, 3);
     $display->add('limit_from', $limit_from);
     $display->add('limit_to', $limit_to);
     $display->add('search_time', $search_time);
     $display->add('keywords', $keywords);
     $display->add('base_url', WEB_ROOT);
     $display->add('highlight', $highlight);
     $display->add('total_item_cat', $total);
     $display->add('name_item_cat', $catActive);
     $display->add('block_id', Module::$block_id);
     $display->add('paging', $paging);
     $display->add('items', $item_array);
     $display->output('sphinx_search');
 }
Пример #18
0
 function draw()
 {
     global $display;
     $display->add('msg', $this->showFormErrorMessages(1));
     if ($this->cart['user_id']) {
         $display->add("user_name", $this->cart['user_name']);
     }
     $display->add("user_id", $this->cart['user_id']);
     $display->add("customer_name", stripslashes(URL::get('customer_name', $this->cart['customer_name'])));
     $display->add("customer_email", stripslashes(URL::get('customer_email', $this->cart['customer_email'])));
     $display->add("customer_phone", stripslashes(URL::get('customer_phone', $this->cart['customer_phone'])));
     $display->add("customer_address", stripslashes(URL::get('customer_address', $this->cart['customer_address'])));
     $display->add("customer_note", stripslashes(URL::get('customer_note', $this->cart['customer_note'])));
     $display->add("note", stripslashes(URL::get('note', $this->cart['note'])));
     //$quantity_total	=0;
     $price_total = 0;
     $cart_items = array();
     if ($this->cart_items) {
         foreach ($this->cart_items as $cart_item_id => $cart_item) {
             $item = $this->items[$cart_item['item_id']];
             if (isset(CGlobal::$allCategories[$item['category_id']])) {
                 $cart_item['url'] = WEB_DIR . CGlobal::$allCategories[$item['category_id']]['nice_name'] . "/p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html";
             } else {
                 $cart_item['url'] = WEB_DIR . "p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html";
             }
             $cart_item['name'] = $item['name'];
             $cart_item['price_num'] = $item['price'];
             $cart_item['price'] = number_format($item['price'], 0, ',', '.');
             if ($item['img_url']) {
                 $cart_item['img_url'] = AZLib::getImageThumb($item['img_url'], 120, 120, 0, $item['img_server']);
             } else {
                 $item['img_url'] = '';
             }
             $cart_item["delete"] = Url::build_current(array('cmd', 'id', 'act' => 'del_item', 'ci_id' => $cart_item['id']));
             $cart_item['row_total'] = $cart_item['checked'] ? number_format($item['price'] * $cart_item['quantity'], null, null, '.') . ' VNĐ' : '';
             $price_total += $cart_item['checked'] ? $item['price'] * $cart_item['quantity'] : 0;
             //$quantity_total	+=	$cart_item['checked'] ? $cart_item['quantity'] : 0;
             $cart_items[$cart_item['id']] = $cart_item;
         }
     }
     $display->add('price_total', number_format($price_total, null, null, '.'));
     $display->add('url_finish', Url::build_current(array('cmd' => 'finish')));
     $display->add('cart_items', $cart_items);
     //1:Chưa cập nhật; 2: Đã gửi đơn hàng ; 3: Đã TT; 4: Hủy đơn hàng; 5: Đã duyệt
     $status_arr = array(6 => "--Tất cả--", 2 => "Đã gửi đơn hàng", 1 => "Chưa cập nhật", 3 => "Đã Thanh toán", 5 => "Đã duyệt", 4 => "Đã hủy");
     $display->add("status_option", AZLib::getOption($status_arr, $this->cart['status']));
     $display->add('cart_id', "Cart_" . $this->cart['id']);
     $display->add("time_create", date('d/m/Y H:i:s', $this->cart['time_create']));
     $display->add("time_change", date('d/m/Y H:i:s', $this->cart['time_change']));
     if ($this->cart['time_finish']) {
         $display->add("time_finish", date('d/m/Y H:i:s', $this->cart['time_finish']));
     } else {
         $display->add("time_finish", "Chưa hoàn thành!");
     }
     $this->beginForm();
     $display->output('CartEdit');
     $this->endForm();
 }
Пример #19
0
 function draw()
 {
     $this->beginForm();
     global $display;
     $search_value = '';
     $display->add('up_checked', 'checked="checked"');
     if (Url::get('root_img')) {
         $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' root_id=0 ';
         $display->add('root_img_checked', 'checked="checked"');
     } else {
         //$search_value.=($search_value!=''?' AND ':' WHERE').' img.root_id>0 ';
         $display->add('root_img_checked', '');
     }
     if (Url::get('no_item_img')) {
         $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' item_id=0 ';
         $display->add('no_item_img_checked', 'checked="checked"');
     } else {
         //$search_value.=($search_value!=''?' AND ':' WHERE').' root_id>0 ';
         $display->add('no_item_img_checked', '');
     }
     // search ô textbox
     if (Url::get('user_name') != '') {
         $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' user_name LIKE "%' . Url::get('user_name') . '%" ';
     }
     //search theo ngay thang nam
     $created_time_from = 0;
     $created_time_to = 0;
     $current_time_from = null;
     $current_time_to = null;
     if (Url::get('created_time_from')) {
         $current_time_from = Url::get('created_time_from');
         $date_arr = explode('-', $current_time_from);
         if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) {
             $created_time_from = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]);
         }
     }
     if (Url::get('created_time_to')) {
         $current_time_to = Url::get('created_time_to');
         $date_arr = explode('-', $current_time_to);
         if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) {
             $created_time_to = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]);
         }
     }
     if ($created_time_from) {
         $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' time >= ' . $created_time_from;
     }
     if ($created_time_to) {
         $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' time <= ' . $created_time_to;
     }
     if ($search_value == '') {
         //create current date
         $date = Date('d-m-Y');
         $current_time_from = $date;
         $date_arr = explode('-', $current_time_from);
         if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) {
             $created_time_from = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]);
         }
         $current_time_to = $date;
         $date_arr = explode('-', $current_time_to);
         if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) {
             $created_time_to = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]);
         }
         if ($created_time_from) {
             $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' time >= ' . $created_time_from;
         }
         if ($created_time_to) {
             $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' time <= ' . $created_time_to;
         }
     }
     $display->add('created_time_from', $current_time_from);
     $display->add('created_time_to', $current_time_to);
     $item_per_page = 120;
     $sql_count = 'SELECT count(*) AS total_img FROM item_image ' . $search_value;
     $total = DB::fetch($sql_count, 'total_img', 0);
     $items = array();
     if ($total) {
         $limit = '';
         $paging = AZPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true);
         $sql = 'SELECT id,img_server, img_url,item_id, title, des, time, user_name, user_id, img_server FROM `item_image`';
         $sql .= $search_value . ' ORDER BY id ASC ' . $limit;
         $item_ids = '';
         $re = DB::query($sql);
         if ($re) {
             while ($row = mysql_fetch_assoc($re)) {
                 $row['link_gallery'] = WEB_DIR . AZRewrite::formatUrl('?page=gallery&user_id=' . $row['user_id'] . '&year=' . date('Y', $row['time']) . '&month=' . (int) date('m', $row['time']) . '&day=' . (int) date('d', $row['time']));
                 if (date('d.m.y', $row['time']) == date('d.m.y', TIME_NOW)) {
                     $row['time'] = date('H:i', $row['time']);
                 } elseif (date('y', $row['time']) == date('y', TIME_NOW)) {
                     $row['time'] = date('d/m H:i', $row['time']);
                 } else {
                     $row['time'] = date('d/m/y H:i', $row['time']);
                 }
                 //if(!eregi('/',$row['img_url'])){
                 //	$row['link_img']='http://'.CGlobal::$img_server[$row['img_server']].'uploaded/items/'.$row['img_url'];
                 //}
                 //else{
                 $row['link_img'] = 'http://' . CGlobal::$img_server[$row['img_server']] . $row['img_url'];
                 //}
                 if ($row['item_id']) {
                     $item_ids .= ($item_ids ? ',' : '') . $row['item_id'];
                     if (isset($row['name'])) {
                         $row['item_link'] = WEB_DIR . AZRewrite::formatUrl("?page=item_detail&id={$row['item_id']}&ebname=" . AZLib::safe_title($row['name']));
                         if (date('d.m.y', $row['created_time']) == date('d.m.y', TIME_NOW)) {
                             $row['created_time'] = date('H:i', $row['created_time']);
                         } elseif (date('y', $row['created_time']) == date('y', TIME_NOW)) {
                             $row['created_time'] = date('d/m H:i', $row['created_time']);
                         } else {
                             $row['created_time'] = date('d/m/y H:i', $row['created_time']);
                         }
                     } else {
                         $row['item_link'] = WEB_DIR . AZRewrite::formatUrl("?page=item_detail&id={$row['item_id']}");
                         $row['created_time'] = '';
                     }
                     $row['title'] = stripslashes($row['title']);
                 } else {
                     $row['title'] = stripslashes($row['des']);
                     $row['created_time'] = '';
                     $row['item_link'] = '';
                 }
                 $row['image_thumb'] = AZLib::getImageThumb($row['img_url'], 110, 0, 1, $row["img_server"]);
                 $row['image_max'] = AZLib::getImageThumbMax($row['img_url'], $row['title'], 1, $row["img_server"]);
                 $row['images_url_root'] = 'http://' . CGlobal::$img_server[$row['img_server']];
                 $row['del_link'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id'), 'cmd=delete&id=' . $row['id']);
                 $items[$row['id']] = $row;
             }
             if ($item_ids) {
                 $all_items = array();
                 $sql = "SELECT id, name, created_time FROM item WHERE id IN({$item_ids})";
                 $re = DB::query($sql);
                 if ($re) {
                     while ($item = mysql_fetch_assoc($re)) {
                         $all_items[$item['id']] = $item;
                     }
                 }
                 foreach ($items as &$item_img) {
                     if ($item_img['item_id'] && isset($all_items[$item_img['item_id']])) {
                         $item_img['item_link'] = WEB_DIR . AZRewrite::formatUrl("?page=item_detail&id={$item_img['item_id']}&ebname=" . AZLib::safe_title($all_items[$item_img['item_id']]['name']));
                         if (date('d.m.y', $all_items[$item_img['item_id']]['created_time']) == date('d.m.y', TIME_NOW)) {
                             $item_img['created_time'] = date('H:i', $all_items[$item_img['item_id']]['created_time']);
                         } elseif (date('y', $all_items[$item_img['item_id']]['created_time']) == date('y', TIME_NOW)) {
                             $item_img['created_time'] = date('d/m H:i', $all_items[$item_img['item_id']]['created_time']);
                         } else {
                             $item_img['created_time'] = date('d/m/y H:i', $all_items[$item_img['item_id']]['created_time']);
                         }
                     } else {
                         $item_img['item_link'] = '';
                         $item_img['created_time'] = '';
                     }
                 }
             }
         }
     } else {
         $paging = '';
     }
     AZLib::my_setcookie("page_img_id", Url::get("page_no") != "" ? intval(Url::get("page_no")) : 1, 60 * 60 * 24 * 365 + TIME_NOW);
     $display->add("uri", CGlobal::$request_uri);
     $display->add("images_url_root", 'http://' . CGlobal::$img_server[IMAGE_SERVER_NO]);
     $display->add('user_name', Url::get('user_name'));
     $display->add('item_title', Url::get('item_title'));
     $display->add('items', $items);
     $display->add('paging', $paging);
     $display->output('ManageImage');
     $this->endForm();
 }
Пример #20
0
 function draw()
 {
     global $display;
     $item_cat_ids = '';
     $offer_cats = array();
     $item_cats = array();
     $item_cat_offer = array();
     $configs = @CGlobal::$configs['ItemOffer']['conf_val'];
     if ($configs) {
         $configs = unserialize(stripslashes($configs));
     } else {
         $configs = array('title' => "SẢN PHẨM KHUYẾN MẠI", 'item_cat_offer' => array());
     }
     foreach (CGlobal::$subCategories as $top_id => $sub_cats) {
         if (isset(CGlobal::$allCategories[$top_id]) && CGlobal::$allCategories[$top_id]['parent_id'] == 0) {
             $topcat = CGlobal::$allCategories[$top_id];
             if ($topcat['status'] == "HOME") {
                 $item_ids = isset($configs['item_cat_offer'][$top_id]) ? $configs['item_cat_offer'][$top_id] : '';
                 if ($item_ids) {
                     $item_cat_ids .= ($item_cat_ids != '' ? ',' : '') . $item_ids;
                 }
                 $arr = array('id' => $top_id, 'name' => "<a href='" . WEB_DIR . "c{$topcat['id']}/{$topcat['ebname']}'>{$topcat['name']}</a>", 'item_ids' => $item_ids, 'sub' => array(), 'sub_display' => 0);
                 foreach ($sub_cats as $sid => $subcat) {
                     $item_ids = isset($configs['item_cat_offer'][$sid]) ? $configs['item_cat_offer'][$sid] : '';
                     if ($item_ids) {
                         $arr['sub_display'] = 1;
                         $item_cat_ids .= ($item_cat_ids != '' ? ',' : '') . $item_ids;
                     }
                     $arr['sub'][$sid] = array('id' => $sid, 'name' => "<a href='" . WEB_DIR . "c{$subcat['id']}/{$topcat['ebname']}-{$subcat['ebname']}'>{$subcat['name']}</a>", 'item_ids' => $item_ids);
                 }
                 $item_cat_offer[$top_id] = $arr;
             }
         }
     }
     if ($item_cat_ids) {
         $re = DB::query("SELECT * FROM item WHERE id IN({$item_cat_ids}) AND status = 1 ORDER BY find_in_set(id,'{$item_cat_ids}')");
         if ($re) {
             while ($product = mysql_fetch_assoc($re)) {
                 if ($product['img_url']) {
                     $product['image'] = AZLib::getImageThumb($product['img_url'], 235, 150, 0, $product['img_server']);
                 } else {
                     $product['image'] = "";
                     //"style/images/no-images-35x35.gif";
                 }
                 if (isset(CGlobal::$allCategories[$product['category_id']])) {
                     $product['url'] = WEB_DIR . CGlobal::$allCategories[$product['category_id']]['nice_name'] . "/p{$product['id']}/" . AZLib::safe_title($product['name']) . ".html";
                 } else {
                     $product['url'] = WEB_DIR . "p{$product['id']}/" . AZLib::safe_title($product['name']) . ".html";
                 }
                 $product['name'] = stripslashes($product['name']);
                 $product['price_num'] = $product['price'];
                 $product['price'] = AZLib::getPrice($product['price'], $product['currency_id']);
                 if ($product['price_out']) {
                     if ($product['price_num'] < $product['price_out']) {
                         $product['sale_off'] = floor(100 * ($product['price_out'] - $product['price_num']) / $product['price_out']);
                     }
                     $product['price_out'] = AZLib::getPrice($product['price_out'], $product['currency_id']);
                 }
                 //level_1_catid
                 //$topcat_id =
                 if (isset($configs['item_cat_offer'][$product['level_1_catid']]) && in_array($product['id'], explode(',', $configs['item_cat_offer'][$product['level_1_catid']]))) {
                     $offer_cats[$product['level_1_catid']] = CGlobal::$allCategories[$product['level_1_catid']];
                     $item_cats[$product['level_1_catid']][$product['id']] = $product;
                 }
                 if (isset($configs['item_cat_offer'][$product['category_id']]) && in_array($product['id'], explode(',', $configs['item_cat_offer'][$product['category_id']]))) {
                     $offer_cats[$product['category_id']] = CGlobal::$allCategories[$product['category_id']];
                     $item_cats[$product['category_id']][$product['id']] = $product;
                 }
             }
         }
     }
     if (User::is_admin()) {
         $display->add("is_admin", 1);
         $display->add("msg", $this->showFormErrorMessages(1));
         $display->add('begin_form', $this->beginForm(true, 'post', false, false, 1));
         $display->add('end_form', $this->endForm(true));
     }
     $display->add('title_offer', $configs['title']);
     $display->add('item_cat_offer', $item_cat_offer);
     $display->add('item_cats', $item_cats);
     $display->add('offer_cats', $offer_cats);
     ################################################################################################################
     #ADV config
     $config = @CGlobal::$configs['AdvItemOffer']['conf_val'];
     $status = 0;
     $url_detail = '';
     $type_display = 1;
     if ($config != '') {
         $config_arr = explode("\n", $config);
         $status = (int) $config_arr[0];
         $url_detail = $config_arr[1];
         $type_display = (int) $config_arr[2];
     }
     if ($status) {
         //Bật
         if ($type_display == 1) {
             $display->add('adv_banner', DATA_PATH . 'adv/AdvItemOffer.gif');
         } else {
             $display->add('adv_banner', DATA_PATH . 'adv/AdvItemOffer.swf');
         }
         $display->add('type_display', $type_display);
         $display->add('url_detail', $url_detail);
     } else {
         //tắt
         $display->add('adv_banner', '');
     }
     $display->add('adv_status', $status);
     if (User::is_admin()) {
         $status_arr = array(0 => 'Tắt', 1 => 'Bật');
         $display->add('status_option', AZLib::getOption($status_arr, $status));
         $display->add('url', $url_detail);
         $type_arr = array(1 => 'Ảnh', 2 => 'Flash');
         $type = URL::get('type', 'int', $type_display);
         $display->add('type_option', AZLib::getOption($type_arr, $type));
     } else {
         $display->add('adv_config', '');
         $display->add('is_admin', 0);
     }
     $display->add('adv_width', 200);
     $display->add('adv_height', 560);
     #ADV config
     ################################################################################################################
     /*System::debug($item_cats);
      */
     $display->output("ItemOffer");
 }
Пример #21
0
 function draw()
 {
     global $display;
     AZLib::get_config();
     /*if (CGlobal::$curZone) {
           $zone_id = CGlobal::$curZone['id'];
       } else {
           $zone_id = 0;
       }*/
     $zid = (int) Url::get("zone_id", 0);
     $display->add('cur_page', AZNet::$page['name']);
     $display->add('ADMIN_LOGO', User::have_permit(ADMIN_LOGO));
     $in_detail_page = AZNet::$page['name'] == 'item_detail';
     $topcats = array();
     $pcats = array();
     $stt = 0;
     $stt2 = 0;
     foreach (CGlobal::$subCategories as $top_id => $sub_cats) {
         if (isset(CGlobal::$allCategories[$top_id]) && CGlobal::$allCategories[$top_id]['parent_id'] == 0) {
             $topcat = CGlobal::$allCategories[$top_id];
             if ($topcat['status'] == "HOME") {
                 $topcat['name'] = $topcat['brief_name'];
                 if (count($sub_cats) > 7) {
                     $stt2++;
                 }
                 $topcat['left'] = "-" . (($stt2 - 1) * 30 + 10) . "px";
                 $topcat['url'] = WEB_DIR . "c{$topcat['id']}/{$topcat['ebname']}";
                 $topcat['selected'] = (int) (CGlobal::$curMainCat && CGlobal::$curMainCat['id'] == $topcat['id']);
                 $topcat['selected2'] = 0;
                 if ($topcat['selected']) {
                     if ($sub_cats) {
                         $topcat['class'] = "hm_item_list_sub";
                     } else {
                         $topcat['class'] = "hm_item_seleted";
                     }
                 } else {
                     $topcat['class'] = "hm_item";
                 }
                 if ($sub_cats) {
                     $topcat['subs'] = array();
                     $num_sub = 0;
                     foreach ($sub_cats as $sid => $subcat) {
                         if ($subcat['status'] != "HIDE") {
                             $subcat['url'] = WEB_DIR . "c{$subcat['id']}/{$topcat['ebname']}-{$subcat['ebname']}";
                             //$subcat['name'] 		= $subcat['brief_name'];
                             if (CGlobal::$curLevel2Cat && CGlobal::$curLevel2Cat['id'] == $subcat['id']) {
                                 $topcat['selected2'] = 1;
                                 $topcat['class'] = "hm_item_seleted";
                                 $subcat['class'] = "class='sub_seleted'";
                             }
                             $topcat['subs'][$sid] = $subcat;
                             $num_sub++;
                         }
                     }
                     if ($topcat['selected'] && !$topcat['selected2']) {
                         $max_per_col = ceil($num_sub / 5);
                         if ($max_per_col <= 0) {
                             $max_per_col = 1;
                         }
                         $display->add('max_per_col', $max_per_col);
                         $display->add('subcat_items', $topcat['subs']);
                     }
                 }
                 $topcats[$top_id] = $topcat;
                 // if($stt++ >= 6)
                 //break;
             }
         }
     }
     $display->add('topcats', $topcats);
     $display->add('web_dir', WEB_DIR);
     $display->add('DATA_PATH', DATA_PATH);
     //Load Logo
     //$test_time = mktime(0,0,0,11,26,2010);
     AZLib::getWebsiteLogo();
     if (CGlobal::$websiteLogo !== FALSE && isset(CGlobal::$websiteLogo['current']['expired']) && CGlobal::$websiteLogo['current']['expired'] && CGlobal::$websiteLogo['current']['expired'] < TIME_NOW) {
         //  Nếu Logo đang sử dụng đã hết hạn, lấy Logo còn hạn hoặc lấy Logo mặc định
         AZLib::getWebsiteLogo(1);
     }
     $display->add('logo', CGlobal::$websiteLogo['current']);
     $display->add('logos', CGlobal::$websiteLogo['logos']);
     //Top menu
     if (!isset($_SESSION['is_load_page_first'])) {
         $_SESSION['is_load_page_first'] = 0;
     }
     $display->add('url_root', WEB_ROOT);
     if (!User::is_login()) {
         $num_mess = 0;
     } else {
         $num_mess = User::$current->data['total_pm'] > 0 ? User::$current->data['total_pm'] : 0;
     }
     if (User::id()) {
         $display->add('user_id', User::id());
         $user_name = User::$current->data['user_name'];
         $display->add('user_name', $user_name);
     }
     $referer_login_url = '';
     $yahoo_open_id_href = '';
     $google_open_id_href = '';
     if (isset($_SESSION['openid_url']) && $_SESSION['user_id'] != 0) {
         $display->add('show_openid', FALSE);
     } elseif (!User::is_az_team()) {
         AZLib::check_uri();
         $referer_login_url = base64_encode(CGlobal::$query_string);
         $yahoo_open_id_href = OID_URL . 'index.html?openid_identifier=http://me.yahoo.com/&long_redirect=' . base64_encode(CGlobal::$query_string);
         $google_open_id_href = OID_URL . 'index.html?openid_identifier=https://www.google.com/users/o8/id&long_redirect=' . base64_encode(CGlobal::$query_string);
         $display->add('show_openid', TRUE);
     }
     $display->add('OID_URL', $yahoo_open_id_href);
     $display->add('OID_URL_GOG', $google_open_id_href);
     $display->add('referer_login_url', $referer_login_url);
     $display->add('google_open_id_href', $google_open_id_href);
     $display->add('yahoo_open_id_href', $yahoo_open_id_href);
     $display->add('openid_on', OPENID_ON);
     $display->add('num_mess', $num_mess);
     $display->add('is_login', (int) User::is_login());
     $display->add('is_admin', (int) User::is_az_team());
     $display->add('is_admin_item', (int) User::have_permit(ADMIN_ITEM));
     $display->add('is_root', User::is_root());
     //End Top menu
     $display->add('category_id', CGlobal::$curCategory);
     $display->add('keywords', AZLib::cleanHtml(Url::get('keywords', '')));
     $display->add('not_error_page', (int) (AZNet::$page['name'] != 'error'));
     $display->add('is_load_page_first', $_SESSION['is_load_page_first']);
     // Tỷ giá
     AZLib::get_config();
     //$exchange = CGlobal::$configs['exchange']['conf_val'];
     //$display->add('exchange', number_format($exchange, 0, ',', '.'));
     // End Tỷ giá
     if ($_SESSION['is_load_page_first'] == 1) {
         $_SESSION['is_load_page_first'] = 0;
     }
     //End of top menu
     $curMainCat = CGlobal::$curMainCat;
     $curLevel2Cat = CGlobal::$curLevel2Cat;
     //Cat menu
     $sub_menu = FALSE;
     $sub_menu = $curMainCat && isset(CGlobal::$allCategories[$curMainCat['id']]) && isset(CGlobal::$subCategories[$curMainCat['id']]);
     $display->add('CURENT_TOP_CATID', (int) @$curMainCat['id']);
     $display->add('CURENT_LEVEL2_CATID', (int) @$curLevel2Cat['id']);
     $display->add('CURENT_CITY_ID', CGlobal::$curCity);
     $display->add('cur_page', Url::get('page'));
     $display->add('sub_menu', $sub_menu);
     $display->add('block_id', Module::$block_id);
     // System::debug($display->get_template_vars());
     //End Cat menu
     if (User::is_root()) {
         $display->add("DEBUG", DEBUG);
         $display->add("show_bug_url", AZRewrite::formatUrl(Url::build_all(array(), "ebug=" . (int) (!DEBUG))));
     }
     ################################################################################################################
     #Event config
     $event_on = @CGlobal::$configs['event_on']['conf_val'];
     $submit = Url::get('submit', '');
     if (User::is_admin()) {
         if ($submit == 'Cập nhật') {
             $display->add('msg', $this->showFormErrorMessages(1));
         }
         $status_arr = array(0 => 'Tắt', 1 => 'Bật');
         $display->add('status_option', AZLib::getOption($status_arr, $event_on));
     }
     $display->add('event', $event_on);
     $display->add("data_path", DATA_PATH);
     #Event config
     ################################################################################################################
     ################################################################################################################
     #Search
     $search_catid = (int) Url::get('search_catid');
     $search_cat_arr = array(-1 => '--Tất cả danh mục--');
     foreach (CGlobal::$subCategories as $top_id => $sub_cats) {
         if (isset(CGlobal::$allCategories[$top_id]) && CGlobal::$allCategories[$top_id]['parent_id'] == 0) {
             $topcat = CGlobal::$allCategories[$top_id];
             if ($topcat['status'] != "HIDE") {
                 $search_cat_arr[$top_id] = $topcat['name'];
                 if ($sub_cats) {
                     foreach ($sub_cats as $sid => $subcat) {
                         if ($subcat['status'] != "HIDE") {
                             $search_cat_arr[$sid] = "-----" . $subcat['name'];
                         }
                     }
                 }
             }
         }
     }
     $display->add('search_cat_option', AZLib::getOption($search_cat_arr, $search_catid));
     #Search
     ################################################################################################################
     /*   System::debug($topcats);*/
     $cat_newss = array();
     $news_cat_id = Url::get('news_catid', 'id', 0);
     AZLib::getNewsCats();
     $display->add('news_cat_id', $news_cat_id);
     if (CGlobal::$allNewsCategories) {
         foreach (CGlobal::$allNewsCategories as $news_cat) {
             if ($news_cat['public']) {
                 $news_cat['url'] = URL::build('news_list', array('news_catid' => $news_cat['id'], 'azname' => AZLib::safe_title($news_cat['name'])));
                 $cat_newss[$news_cat['id']] = $news_cat;
             }
         }
     }
     $display->add('cat_newss', $cat_newss);
     $display->output("Header");
     // $display->output("header_old");
 }
Пример #22
0
            if ($item['price']) {
                if ($item['currency_id'] == 2) {
                    $item['price'] = $item['price'] * CGlobal::$exchange;
                }
                $item['price'] = Url::currency_format($item['price']);
            } else {
                $item['price'] = "Liên hệ";
            }
            if ($item['img_url']) {
                $item['img_url'] = $url . AZLib::getImageThumb($item['img_url'], 80, 80, 0, $item['img_server']);
            } else {
                $item['img_url'] = '';
            }
            $item['name'] = stripslashes($item['name']);
            $item['list_brief'] = stripslashes($item['list_brief']);
            $item['url'] = WEB_ROOT . CGlobal::$allCategories[$seccid]['nice_name'] . "/p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html";
            unset($all_check_items[$topcid]['subs'][$seccid]);
            $all_items[$topcid]['subs'][$seccid]['items'][$item['id']] = $item;
        }
    }
}
if ($all_check_items) {
    foreach ($all_check_items as $topid => $topcat) {
        if ($topcat['subs']) {
            foreach ($topcat['subs'] as $sid => $scat) {
                if ($all_check_items[$topid]['subs'][$sid]) {
                    unset($all_check_items[$topid]['subs'][$sid]);
                }
            }
            if ($all_items[$topid]['subs']) {
                unset($all_items[$topid]);
Пример #23
0
 function get_feed_notify_bar()
 {
     AZLib::getCats();
     $json = "";
     if (!User::is_login()) {
         $json = '({"msg":"no_login"})';
         echo $json;
         exit;
     }
     $item_comment_ids = "";
     //Id các phản hồi giao dịch
     $user_comment_ids = "";
     //Id các lưu bút
     $entry_comment_ids = "";
     //Id các bài viết
     /*$follow_ids			= "";//Id các theo đuôi*/
     $blast_user_ids = "";
     // Id các balst
     $arr_data = array();
     $user = User::getUser(User::id());
     if ($user["total_pm"]) {
         // neu co PM moi
         $arr_data = array("new_pm" => $user["total_pm"]);
     }
     $where = "WHERE user_id = " . User::id();
     $limit = " LIMIT 20";
     $sql = "SELECT * FROM feed {$where} ORDER BY time DESC {$limit}";
     $re = DB::query($sql);
     if ($re) {
         while ($feed = mysql_fetch_assoc($re)) {
             if ($feed['type'] == 1 || $feed['type'] == 2) {
                 // phan hoi
                 $item_comment_ids .= ($item_comment_ids != '' ? ',' : '') . $feed['ref_id'];
             } elseif ($feed['type'] == 3) {
                 // luu but
                 $user_comment_ids .= ($user_comment_ids != '' ? ',' : '') . $feed['ref_id'];
             } elseif ($feed['type'] == 5 || $feed['type'] == 6) {
                 // bai viet
                 $entry_comment_ids .= ($entry_comment_ids != '' ? ',' : '') . $feed['ref_id'];
             }
             /*elseif($feed['type']==7){// theo duoi						
             			$follow_ids.=($follow_ids!=''?',':'').$feed['ref_id'];
             		}*/
         }
     }
     //Phản hồi giao dịch
     $item_comment_arr = array();
     if ($item_comment_ids != '') {
         $item_ids = "";
         $re = DB::query("SELECT time, item_id, parent_id, COUNT(item_id) AS total_comment FROM comment WHERE id IN({$item_comment_ids}) GROUP BY item_id");
         if ($re) {
             while ($comment = mysql_fetch_assoc($re)) {
                 $item_ids .= ($item_ids != '' ? ',' : '') . $comment['item_id'];
                 $comment['time'] = AZLib::duration_time($comment['time']);
                 $item_comment_arr[$comment['item_id']] = $comment;
             }
             if ($item_comment_arr && $item_ids) {
                 // Query de lay ID va Tieu de tin
                 $re = DB::query("SELECT id, name, level_1_catid FROM item WHERE id IN({$item_ids})");
                 while ($item = mysql_fetch_assoc($re)) {
                     if ($item["id"] == $item_comment_arr[$item["id"]]["item_id"]) {
                         $item_comment_arr[$item["id"]]["item_name"] = AZLib::word_limit($item["name"], 7, '...');
                         $ebname = AZLib::safe_title($item['name']);
                         if (isset(CGlobal::$allCategories[$item['level_1_catid']])) {
                             $cat_name = CGlobal::$allCategories[$item['level_1_catid']]['name'];
                             $item_comment_arr[$item["id"]]["url_link"] = WEB_DIR . AZLib::safe_title($cat_name) . "/p{$item['id']}/{$ebname}.html";
                         } else {
                             $item_comment_arr[$item["id"]]["url_link"] = WEB_DIR . "/p{$item['id']}/{$ebname}.html";
                         }
                     }
                 }
             }
         }
         if ($item_comment_arr) {
             $item_comment_arrs["comment"] = $item_comment_arr;
             $arr_data += $item_comment_arrs;
         }
     }
     // End Phan hoi giao dich
     //Luu but
     $total_comment_arr = array();
     if ($user_comment_ids != '') {
         $re = DB::query("SELECT time, COUNT(id) AS total_comment_user FROM comment_user WHERE id IN({$user_comment_ids}) GROUP BY receiver_user_id ORDER BY time DESC");
         if ($re) {
             $comment_user = mysql_fetch_assoc($re);
             $total_comment_arr["total"] = $comment_user["total_comment_user"];
             $total_comment_arr['time'] = AZLib::duration_time($comment_user['time']);
             $total_comment_arr["url_link"] = WEB_DIR . 'Shop/' . User::user_name() . '/Luu-but';
         }
         if ($total_comment_arr) {
             $total_comment_arrs["comment_user"] = $total_comment_arr;
             $arr_data += $total_comment_arrs;
         }
     }
     //End Luu but
     // Theo duoi
     /*$follow_arr = array();
     		if($follow_ids!=''){
     			$re = DB::query("SELECT id, follower_name, time FROM follow WHERE id IN($follow_ids) ORDER BY time DESC");			
     			if($re){				
     				while ($follow = mysql_fetch_assoc($re)){										
     					$follow['time'] = AZLib::duration_time($follow['time']);
     					$follow["url_link"] = WEB_DIR.$follow['follower_name'];
     					$follow_arr[$follow['id']] = $follow;
     				}														
     			}							
     			if($follow_arr){
     				$follow_arrs["follow"] = $follow_arr;
     				$arr_data += $follow_arrs;
     			}
     		}*/
     // end Theo duoi
     // Phản hồi bài viết
     $entry_comment_arr = array();
     if ($entry_comment_ids != '') {
         $entry_ids = "";
         $re = DB::query("SELECT time, entry_id, parent_id FROM user_entry_comment WHERE id IN({$entry_comment_ids})");
         if ($re) {
             while ($comment_entry = mysql_fetch_assoc($re)) {
                 $entry_ids .= ($entry_ids != '' ? ',' : '') . $comment_entry['entry_id'];
                 $comment_entry['time'] = AZLib::duration_time($comment_entry['time']);
                 $comment_entry['total_comment_entry'] = count(explode(',', $entry_comment_ids));
                 $entry_comment_arr[$comment_entry['entry_id']] = $comment_entry;
             }
             if ($entry_comment_arr && $entry_ids) {
                 // Query de lay ID va Tieu de bai viet
                 $re = DB::query("SELECT id, title FROM user_entry WHERE id IN({$entry_ids})");
                 while ($entry = mysql_fetch_assoc($re)) {
                     if ($entry["id"] == $entry_comment_arr[$entry["id"]]["entry_id"]) {
                         $entry_comment_arr[$entry["id"]]["title"] = AZLib::word_limit($entry["title"], 7, '...');
                         $ebname = AZLib::safe_title($entry['title']);
                         $entry_comment_arr[$entry["id"]]["url_link"] = WEB_DIR . "Bai-viet/" . User::user_name() . "/e{$entry['id']}/{$ebname}";
                     }
                 }
             }
         }
         if ($entry_comment_arr) {
             $item_comment_arrs["entry"] = $entry_comment_arr;
             $arr_data += $item_comment_arrs;
         }
     }
     // End Phan hoi bài viết
     $json = json_encode($arr_data);
     echo $json;
     exit;
 }
Пример #24
0
 function draw()
 {
     $this->beginForm();
     global $display;
     $display->add('created_time_from', Url::get('created_time_from'));
     $display->add('created_time_to', Url::get('created_time_to'));
     $display->add('sender_user_name', Url::get('sender_user_name'));
     $display->add('processed', Url::get('processed'));
     //search theo ngay thang nam
     $created_time_from = 0;
     $created_time_to = 0;
     if (Url::get('created_time_from')) {
         $date_arr = explode('-', Url::get('created_time_from'));
         if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) {
             $created_time_from = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]);
         }
     }
     if (Url::get('created_time_to')) {
         $date_arr = explode('-', Url::get('created_time_to'));
         if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) {
             $created_time_to = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]);
         }
     }
     $search_value = ' 1 ';
     if ($created_time_from) {
         $search_value .= ' AND time_post >= ' . $created_time_from;
     }
     if ($created_time_to) {
         $search_value .= ' AND time_post <= ' . $created_time_to;
     }
     // search ô textbox
     if (Url::get('sender_user_name') != '') {
         $search_value .= ' AND b.user_name like "%' . Url::get('sender_user_name') . '%" ';
     }
     if (Url::get('processed') == 1) {
         $search_value .= ' AND b.status = 0';
     }
     $item_per_page = 50;
     $sql_count = 'SELECT COUNT(*) AS total_item FROM `bad_content` AS b WHERE b.type = 1 AND ' . $search_value;
     $total = DB::fetch($sql_count, 'total_item', 0);
     $items = array();
     if ($total) {
         $limit = '';
         $paging = AZPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Phản hồi', 'Trang');
         $sql = 'SELECT i.name,i.transaction_type,i.category_id, b.id, b.admin_name, b.status, b.type,b.id_item, b.reason,b.user_id,b.user_name, b.note, b.time_post FROM `bad_content` b LEFT JOIN item i ON i.id = b.id_item WHERE b.type = 1 AND ' . $search_value . ' ORDER BY b.status, b.time_post DESC, b.type ASC ' . $limit;
         $result = DB::query($sql);
         if ($result) {
             while ($row = mysql_fetch_assoc($result)) {
                 $row['content'] = $row['name'];
                 $row['time_post'] = date('d/m/y H:i', $row['time_post']);
                 $row['content_tooltip'] = AZLib::remove_4_js(AZLib::filter_title($row['content']));
                 $row['content'] = AZLib::word_limit($row['content'], 12, '...');
                 $row['reason_tooltip'] = AZLib::remove_4_js(AZLib::filter_title($row['reason']));
                 $row['reason'] = AZLib::word_limit($row['reason'], 12, '...');
                 $row['note_tooltip'] = AZLib::remove_4_js(AZLib::filter_title($row['note']));
                 $row['note'] = AZLib::word_limit($row['note'], 12, '...');
                 $row['href'] = WEB_DIR . AZRewrite::formatUrl('?page=item_detail&id=' . $row['id_item'] . '&ebname=' . AZLib::safe_title($row['name']));
                 $row['del_link'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id'), 'cmd=delete&id=' . $row['id']);
                 $items[$row['id']] = $row;
             }
         }
     } else {
         $paging = '';
     }
     $display->add('items', $items);
     $display->add('paging', $paging);
     $display->output('list');
     $this->endForm();
 }
Пример #25
0
 function action_reply_entry_comment()
 {
     $act_ = Url::get('act_');
     $comment_id = (int) Url::get('re_c_entry_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('user_entry_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['parent_id'] == 0 || $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!
         $json = '({"msg":"success"})';
         echo $json;
         exit;
     }
     $entry_id = $comment_row['entry_id'];
     $entry = DB::select('user_entry', "id={$entry_id}");
     if (!$entry || $entry && $entry['status'] == 0) {
         $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);
         $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;
         }
         $comment = array('time' => time(), 'post_ip' => AZLib::ip(), 'content' => $content, 'entry_id' => $entry['id'], 'order_time' => time(), 'parent_id' => $parent_id, 'receiver_user_id' => $entry['user_id'], 'receiver_user_name' => $entry['user_name'], 'display' => 1, 'status' => 1);
         $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'];
         }
         $id = DB::insert('user_entry_comment', $comment);
         if ($id) {
             $re = DB::query("SELECT id FROM user_entry_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 user_entry_comment SET display = 0 WHERE parent_id = {$parent_id} AND display = 1 AND id<={$row['id']}");
                     }
                 }
             }
             if ($comment_id == $parent_id) {
                 DB::query("UPDATE user_entry_comment SET replied_status = 1,have_child = have_child + 1, order_time = " . time() . " WHERE id = {$comment_id}");
             } else {
                 DB::query("UPDATE user_entry_comment SET have_child = have_child + 1, order_time = " . time() . " WHERE id = {$parent_id}");
                 DB::query("UPDATE user_entry_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=6");
         }
         //Cập nhật cron job
         $user_item = User::getUser($entry['user_id']);
         if ($user_item['email'] && $user_item['email_alert'] && $user_item['id'] != User::id()) {
             $link = WEB_ROOT . '?page=user_entry&user_name=' . $entry['user_name'] . '&cmd_entry=view&entry_id=' . $entry['id'] . '&ebname=' . AZLib::safe_title($entry['title']);
             $link = AZRewrite::formatUrl($link);
             $title = "<a href='{$link}' target='_blank' style='text-decoration:none;color:#003399;'><font color='#003399'>{$entry['title']}</font></a>";
             AZLib::addCronJob('entry_comment', AZLib::parseBBCode($content, true), $user_item['id'], User::user_name(), '', $entry['id'], $title, $link);
         }
     } else {
         if ($comment_row['replied_status'] == 0) {
             DB::query("UPDATE user_entry_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=6");
     }
     $json .= "})";
     echo $json;
     exit;
 }
Пример #26
0
 function on_submit()
 {
     $title = Url::get('title');
     $url = Url::get('url');
     $des = Url::get('des');
     if ($des == '<br>') {
         $des = $title;
     }
     $this->checkFormInput("Tên tài liệu", "title", $title, "str", true, '', 1);
     if (!$this->errNum) {
         $uploadPath = AZLib::uploadDocPath();
         //Insert to document
         $doc_id = DB::insert('document', array('title' => addslashes($title), 'des' => addslashes($des), 'status' => 1, 'time_c' => TIME_NOW, 'user_c' => User::user_name(), 'time_m' => TIME_NOW, 'user_m' => User::user_name(), 'file_path' => ''));
         if ($doc_id) {
             if ($url != '') {
                 DB::update('document', array('file_path' => '', 'url' => $url), "id={$doc_id}");
             } elseif (isset($_FILES['file_path']) && $_FILES['file_path']['error'] == 0) {
                 $ext = strtolower(AZLib::getExtension($_FILES['file_path']['name']));
                 $file_name = AZLib::safe_title(basename(strtolower($_FILES['file_path']['name']), $ext)) . $ext;
                 $up_file = $uploadPath . date('Y.m.d_H\\hi.s') . "-{$doc_id}-{$file_name}";
                 $file_path = str_replace(DATA_PATH . "document/", '', $up_file);
                 chmod($uploadPath, 0777);
                 if (!move_uploaded_file($_FILES['file_path']['tmp_name'], $up_file)) {
                     DB::delete('document', "id={$doc_id}");
                     $this->setFormError('file_path', "Không upload được file!");
                     return;
                 } else {
                     DB::update('document', array('file_path' => $file_path), "id={$doc_id}");
                 }
             }
             Url::redirect_current();
             //Url::redirect_current(array('cmd'=>'add'));
         } else {
             $this->setFormError('name', "Không thêm được tài liệu, hãy thử lại sau!");
         }
     }
 }
Пример #27
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;
 }
Пример #28
0
 function draw()
 {
     global $display;
     AZLib::getCats();
     $this->beginForm(false, 'post', false, Url::build_current());
     $created_time_from = 0;
     $created_time_to = 0;
     $time_from = "";
     $time_to = "";
     $phrase_checked = "";
     $free_cat_checked = "";
     $up_checked = "";
     $pagging = "";
     $limit = "";
     $lock_checked = '';
     $select_subcat_checked = '';
     $items = array();
     $id_search = (int) Url::get("id_search");
     $censor = Url::get("censor", 1);
     $user_name = AZLib::getParam("user_name");
     $zone_id = Url::get("zone_id");
     $searchByCat = Url::get("searchByCat");
     $searchByCatType = Url::get("searchByCatType", 0);
     $searchBySubCat = Url::get("searchBySubCat");
     $searchBySubCatType = Url::get("searchBySubCatType", 0);
     $sort_type = Url::get("sort_type", 1);
     $keywords = Url::get("keywords");
     $have_img = Url::get("have_img", 0);
     $lock_item = Url::get("lock");
     $phrase_selected = Url::get("phrase");
     $free_cat_selected = Url::get("free_cat");
     $up = Url::get("up");
     $select_subcat = Url::get("select_subcat", "");
     $opt_have_img = AZLib::getOption(array(0 => "-Tìm theo ảnh-", 1 => "-Có ảnh-", 2 => "-Không ảnh-"), $have_img);
     if (isset($_REQUEST["created_time"]) && $_REQUEST["created_time"]) {
         $time_from = Url::get("created_time");
     }
     if (isset($_REQUEST["created_time_to"]) && $_REQUEST["created_time_to"]) {
         $time_to = Url::get("created_time_to");
     }
     if ($time_from) {
         $date_arr = explode("-", $time_from);
         if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) {
             $created_time_from = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]);
         }
     }
     if ($time_to) {
         $date_arr = explode("-", $time_to);
         if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) {
             $created_time_to = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]);
         }
     }
     $search_value = "";
     $where = "";
     //$order_by   	= "ORDER BY del_time DESC";
     $order_by = "";
     $total_item = 0;
     if ($keywords) {
         $search_value = ($search_value == "" ? " WHERE " : " AND ") . "id IN (0)";
     }
     if ($sort_type == 1) {
         $order_by = "ORDER BY id DESC";
     } elseif ($sort_type == 2) {
         $order_by = "ORDER BY modify_time DESC";
     } elseif ($sort_type == 3) {
         $order_by = "ORDER BY item_order ASC";
     }
     if ($free_cat_selected) {
         $free_cat_checked = "checked";
         $catids = implode(",", array_keys(CGlobal::$allCategories));
         $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "category_id NOT IN({$catids})";
         $order_by = $order_by != "" ? $order_by : "ORDER BY id DESC";
     } else {
         if ($searchBySubCat) {
             if ($searchBySubCatType) {
                 // Nếu chỉ tìm trong danh mục con của danh mục cấp 2
                 $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "level_2_catid = " . $searchBySubCat;
                 // Lọc những item có trường level_2_catid là danh mục cấp 2
             } else {
                 $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "category_id = " . $searchBySubCat;
                 // Ngược lại, lấy các bản ghi thuộc chính danh mục cấp 2
             }
         } elseif ($searchByCat) {
             // Nếu chỉ tìm trong danh mục con của danh mục cấp 1
             if ($searchByCatType) {
                 // Lọc những item có trường level_1_catid là danh mục cấp 1
                 $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "level_1_catid = " . $searchByCat;
             } else {
                 // Ngược lại, lấy các bản ghi thuộc chính danh mục cấp 1
                 $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "category_id = " . $searchByCat;
             }
         }
     }
     if ($censor != 9) {
         $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "status=" . $censor;
     }
     if ($user_name != "") {
         $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "user_name ='{$user_name}'";
     }
     if ($select_subcat) {
         $select_subcat_checked = "checked";
     }
     if ($up) {
         if ($created_time_from) {
             $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "created_time >= " . $created_time_from;
         }
         if ($created_time_to) {
             $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "created_time <= " . $created_time_to;
         }
         $up_checked = "checked";
     } else {
         if ($created_time_from) {
             $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "modify_time >= " . $created_time_from;
         }
         if ($created_time_to) {
             $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "modify_time <= " . $created_time_to;
         }
     }
     if ($have_img == 1) {
         //có ảnh
         $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "have_image=1";
     } elseif ($have_img == 2) {
         //ko có ảnh
         $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "have_image=0";
     }
     if ($id_search) {
         //ID sản phẩm
         $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "id={$id_search}";
     }
     if (Url::get("up")) {
         $order_by = $order_by != "" ? $order_by : "ORDER BY created_time DESC";
     } else {
         $order_by = $order_by != "" ? $order_by : "ORDER BY modify_time DESC";
     }
     $sql = "SELECT * FROM item {$search_value} {$order_by}";
     $sql_count = "SELECT count(*) AS total_row FROM item {$search_value}";
     $total_item = (int) DB::fetch($sql_count, "total_row");
     if ($total_item) {
         $pagging = AZPagging::pagingSE($limit, $total_item, 50, 10, 'page_no', true, 'Sản phẩm', 'Trang');
         $sql .= $limit;
     }
     $re = DB::query($sql);
     if ($re) {
         $index_temp = 0;
         while ($item = mysql_fetch_assoc($re)) {
             //trạng thái sản phẩm:
             if ($item['status'] == -1) {
                 $item['bgcolor'] = "bgcolor=\"#FF6633\"";
             } elseif ($index_temp) {
                 $item['bgcolor'] = "bgcolor=\"#EFEFEF\"";
             } else {
                 $item['bgcolor'] = "";
             }
             $index_temp = 1 - $index_temp;
             $item['created_time'] = 'Đăng: <b>' . date("d/m/Y H:i", $item['created_time']) . '</b>';
             if ($item['del_time'] && $item['del_user'] && $item['status'] == -1) {
                 $item['del_time'] = '<br /><font color=red>Xoá: <b>' . date("d/m/Y H:i", $item['del_time']) . '</font></b> ( <a target="_blank" href="' . WEB_DIR . $item['del_user'] . '"><strong>' . $item['del_user'] . '</strong></a>)';
             } else {
                 $item['del_time'] = '';
             }
             if ($item['modify_user_name'] && $item['status'] != -1) {
                 $item['is_modify'] = '<br><font color=gray>Sửa: <b>' . date("d/m/Y H:i", $item['modify_time']) . '</font></b>';
                 $item['is_modify'] .= ' ( <a target="_blank" href="' . WEB_DIR . $item['modify_user_name'] . '"><strong>' . $item['modify_user_name'] . '</strong></a>)';
             } else {
                 $item['is_modify'] = '';
             }
             $item['name'] = AZLib::filter_title($item['name']);
             $item['description'] = AZLib::remove_4_js(AZLib::plainText($item['description']));
             $item['price'] = number_format($item['price'], 0, ',', '.');
             $item['price_out'] = number_format($item['price_out'], 0, ',', '.');
             $item['currency_option'] = AZLib::getOption(array(1 => "VNĐ", 2 => "\$"), $item['currency_id']);
             //$item['price']	=  "Giá bán: ".AZLib::priceFomart($item['price'],$item['currency_id']);
             //$item['price_out']	=  "<br /><font color='#999999'>Giá TT: ".AZLib::priceFomart($item['price_out'],$item['currency_id']).'</font>';
             if ($item['level_1_catid'] > 0) {
                 if (isset(CGlobal::$allCategories[$item['level_1_catid']])) {
                     $item['cat_name'] = '<b>' . CGlobal::$allCategories[$item['level_1_catid']]['name'] . ' (' . $item['level_1_catid'] . ')</b>';
                 } else {
                     $item['cat_name'] = '<b><font color=red>(' . $item['level_1_catid'] . ')</font></b>';
                 }
                 if ($item['category_id'] > 0 && $item['category_id'] != $item['level_1_catid'] || $item['cat_name'] == '') {
                     if (isset(CGlobal::$allCategories[$item['category_id']])) {
                         $item['cat_name'] .= ' - <i>' . CGlobal::$allCategories[$item['category_id']]['name'] . ' (' . $item['category_id'] . ')</i>';
                     } else {
                         $item['cat_name'] .= ' - <i><b><font color=red>(' . $item['category_id'] . ')</font></b></i>';
                     }
                 }
             }
             if ($item['img_url']) {
                 $item['image_src'] = 'http://' . CGlobal::$img_server[$item['img_server']] . $item['img_url'];
                 $item['image'] = AZLib::getImageThumb($item['img_url'], 110, 0, 1, $item["img_server"]);
             } else {
                 $item['image_src'] = '';
                 $item['image'] = '';
             }
             $item['href'] = WEB_DIR . AZRewrite::formatUrl('?page=item_detail&id=' . $item['id'] . '&ebname=' . AZLib::safe_title($item['name']));
             $item['edit'] = Url::build('post_item', array('cmd' => 'edit', 'id' => $item['id']));
             if ($item['status'] == -1) {
                 $item['del_link'] = Url::build_all(array('cmd', 'id'), 'cmd=del_forever&id=' . $item['id']);
                 $item['re_post'] = Url::build_all(array('cmd', 'id'), 'cmd=re_post&id=' . $item['id']);
             } elseif ($item['status'] == 2) {
                 $item['del_link'] = Url::build_all(array('cmd', 'id'), 'cmd=delete&id=' . $item['id']);
                 $item['show_link'] = Url::build_all(array('cmd', 'id'), 'cmd=show&id=' . $item['id']);
             } else {
                 $item['del_link'] = Url::build_all(array('cmd', 'id'), 'cmd=delete&id=' . $item['id']);
                 $item['hide_link'] = Url::build_all(array('cmd', 'id'), 'cmd=hide&id=' . $item['id']);
             }
             $item['del_cache'] = Url::build_all(array('cmd', 'id'), 'cmd=del_cache&id=' . $item['id']);
             $items[$item['id']] = $item;
         }
     }
     $display->add('items', $items);
     $type_arr = array(1 => "-Sản phẩm không ẩn-", 2 => "-Sản phẩm ẩn-");
     if (User::have_permit(ADMIN_DEL_ITEM)) {
         $type_arr[-1] = "-Sản phẩm đã xoá-";
         $type_arr[9] = "-Tất cả các sản phẩm (Cả sản phẩm xóa)-";
     }
     $option_censor = AZLib::getOption($type_arr, Url::get('censor', 1));
     $display->add('censor', $censor);
     $display->add('option_censor', $option_censor);
     $display->add('have_img_option', $opt_have_img);
     $display->add('lock_checked', $lock_checked);
     $display->add('user_name', $user_name);
     $display->add('created_time', $time_from);
     $display->add('created_time_to', $time_to);
     $display->add('phrase_checked', $phrase_checked);
     $display->add('free_cat_checked', $free_cat_checked);
     $display->add('up_checked', $up_checked);
     $display->add('select_subcat_checked', $select_subcat_checked);
     $display->add('id_search', $id_search);
     $item_cat_search = $this->GetCatTree();
     $display->add('list_top_cat_js', AZLib::getOption(AZLib::getTopCats(), 999999999));
     $display->add('IS_ADMIN', User::is_admin());
     $display->add('page_no', Url::get('page_no'));
     $display->add('paging', $pagging);
     $display->add('total_item', $total_item);
     $display->add('item_cat', AZLib::getOption($this->getOtionCats(), Url::get('id_cats')));
     $display->add('category_tree', json_encode($item_cat_search));
     $display->add('catSelected', Url::get('searchByCat', 0));
     $display->add('catSelectedType', Url::get('searchByCatType', 0));
     $display->add('subCatSelected', Url::get('searchBySubCat', 0));
     $display->add('subCatSelectedType', Url::get('searchBySubCatType', 0));
     $display->add('keywords', $keywords);
     $display->add('sort_type', $sort_type);
     $display->output('ManageItem');
     $this->endForm();
 }
Пример #29
0
 static function getProvinces($update_cache = 0, $delcache = false)
 {
     if (!CGlobal::$provinces || $delcache || $update_cache) {
         if (AZArrCache::is_not_cached('provinces_arr', 0, '', $delcache)) {
             if (!$delcache) {
                 $re = DB::query('SELECT id, name, brief_name, status, area FROM province ORDER BY position', __LINE__ . __FILE__);
                 $topProvinces = array();
                 $ortherProvinces = array();
                 if ($re) {
                     while ($province = mysql_fetch_assoc($re)) {
                         $province['ebname'] = AZLib::safe_title($province['name']);
                         if ($province['status'] == "HOME") {
                             $topProvinces[$province['id']] = $province;
                         } else {
                             $ortherProvinces[$province['id']] = $province;
                         }
                     }
                 }
                 $topProvinces[0] = array('id' => 0, 'name' => 'Toàn quốc', 'brief_name' => 'Toàn quốc', 'status' => 'SHOW', 'area' => '1', 'ebname' => 'Toan-Quoc');
                 CGlobal::$provinces = $topProvinces + $ortherProvinces;
                 AZArrCache::set(CGlobal::$provinces);
             } else {
                 foreach (CGlobal::$my_server as $server) {
                     //Tạo lại file js cho city
                     @fopen("http://{$server}/citygen.php", "r");
                 }
                 $js_ver = rand(1, 1000);
                 AZMemcache::do_put("city_ver:", $js_ver);
             }
         } else {
             CGlobal::$provinces = AZArrCache::$arr_cache;
             AZArrCache::$arr_cache = array();
         }
     }
 }
Пример #30
0
     $ebname = $zone['ebname'];
     //cats
     $sitemap .= "\n" . '<url><loc>' . $web_root . 'z' . $zid . '/' . $ebname . '.html</loc><changefreq>Daily</changefreq><priority>1.0</priority></url>';
     $urllist .= "\n" . $web_root . "z" . $zid . "/" . $ebname . ".html";
 }
 foreach (array_keys(CGlobal::$subCategories) as $top_id) {
     if (isset(CGlobal::$allCategories[$top_id]) && CGlobal::$allCategories[$top_id]) {
         $ebname = AZLib::safe_title(CGlobal::$allCategories[$top_id]['name']);
         $sitemap .= "\n" . '<url><loc>' . $web_root . 'c' . $top_id . '/' . $ebname . '.html</loc><changefreq>Daily</changefreq><priority>1.0</priority></url>';
         $sitemap .= "\n" . '<url><loc>' . $web_root . 'c' . $top_id . '/' . $ebname . '/page-2.html</loc><changefreq>Daily</changefreq><priority>1.0</priority></url>';
         //UrlList:
         $urllist .= "\n" . $web_root . "c" . $top_id . "/" . $ebname . ".html";
         $urllist .= "\n" . $web_root . "c" . $top_id . "/" . $ebname . "/page-2.html";
         if (CGlobal::$subCategories[$top_id]) {
             foreach (CGlobal::$subCategories[$top_id] as $cat_levl_2) {
                 $ebname_sub = "-" . AZLib::safe_title($cat_levl_2['name']);
                 $ebname_all = $ebname . $ebname_sub;
                 $sitemap .= "\n" . '<url><loc>' . $web_root . 'c' . $cat_levl_2['id'] . '/' . $ebname_all . '.html</loc><changefreq>Daily</changefreq><priority>1.0</priority></url>';
                 $sitemap .= "\n" . '<url><loc>' . $web_root . 'c' . $cat_levl_2['id'] . '/' . $ebname_all . '/page-2.html</loc><changefreq>Daily</changefreq><priority>1.0</priority></url>';
                 //UrlList:
                 $urllist .= "\n" . $web_root . "c" . $cat_levl_2['id'] . "/" . $ebname_all . ".html";
                 $urllist .= "\n" . $web_root . "c" . $cat_levl_2['id'] . "/" . $ebname_all . "/page-2.html";
             }
         }
     }
 }
 $sitemap .= "\n" . '</urlset>';
 file_put_contents("sitemap.xml", $sitemap);
 file_put_contents("urllist.txt", $urllist);
 echo $urllist, "<br /><br /><br /><br />";
 echo $sitemap, "<br /><br /><br /><br />";