function on_submit() { $og_name = Url::get('og_name'); $u_name = Url::get('u_name'); $u_yahoo = Url::get('u_yahoo'); $u_skype = Url::get('u_skype'); $OnlineSupport = array(); if ($og_name) { foreach ($og_name as $gid => $g_name) { if ($g_name != '' && isset($u_name[$gid], $u_yahoo[$gid], $u_skype[$gid])) { $garray = array('name' => $g_name, 'users' => array()); foreach ($u_name[$gid] as $uid => $name) { if ($name != '' && isset($u_yahoo[$gid][$uid], $u_skype[$gid][$uid]) && ($u_yahoo[$gid][$uid] != '' || $u_skype[$gid][$uid] != '')) { $garray['users'][$uid] = array('name' => $name, 'yahoo' => $u_yahoo[$gid][$uid], 'skype' => $u_skype[$gid][$uid]); } } if ($garray['users']) { $OnlineSupport[$gid] = $garray; } } } } if (isset(CGlobal::$configs['OnlineSupport'])) { DB::update('configs', array("conf_val" => addslashes(serialize($OnlineSupport))), "conf_key='OnlineSupport'", __FILE__ . " Dòng:" . __LINE__); } else { DB::insert('configs', array("conf_key" => 'OnlineSupport', "conf_val" => addslashes(serialize($OnlineSupport))), __FILE__ . " Dòng:" . __LINE__); } AZLib::get_config(0, 1); AZLib::refreshParent(); }
function on_submit() { if (User::is_admin()) { $submit = Url::get('submit'); if ($submit == "Cập nhật") { $title_news = Url::get('title_news'); $news_ids = Url::get('news_ids'); $config_update = array('title' => $title_news, 'news_ids' => implode(',', explode(',', $news_ids))); ########################### if (isset(CGlobal::$configs['NewsHomeHot'])) { DB::update('configs', array("conf_val" => addslashes(serialize($config_update))), "conf_key='NewsHomeHot'", __FILE__ . " Dòng:" . __LINE__); } else { DB::insert('configs', array("conf_key" => 'NewsHomeHot', "conf_val" => addslashes(serialize($config_update))), __FILE__ . " Dòng:" . __LINE__); } AZLib::get_config(0, 1); } if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']) { $referer = $_SERVER['HTTP_REFERER']; } else { $referer = $_SERVER['REQUEST_URI']; } Url::redirect_url($referer); } Url::redirect_url($_SERVER['REQUEST_URI']); }
function on_submit() { if (User::have_permit(ADMIN_ADV)) { $status = (int) Url::get('status', 0); $url_detail = Url::get('url'); $type = (int) Url::get('type', 0); $config_arr = array('status' => (int) $status, 'url_detail' => $url_detail, 'type' => (int) $type); if (isset($_FILES['banner']) && $_FILES['banner']['error'] == 0) { $banner_file = ROOT_PATH . 'promotion/popup'; //$file_ext=strtolower(substr($_FILES['banner']['name'],strlen($_FILES['banner']['name'])-4,4)); $file_ext = AZLib::getExtension($_FILES['banner']['name']); if ($type == 0) { if (in_array($file_ext, array('.jpg', '.gif'))) { if (getimagesize($_FILES['banner']['tmp_name'])) { if (!move_uploaded_file($_FILES['banner']['tmp_name'], $banner_file . '.gif')) { $this->setFormError('banner', 'Không up load được Banner!'); return; } } else { $this->setFormError('banner', 'Sai định dạng ảnh!'); return; } } else { $this->setFormError('banner', 'Chỉ chấp nhận các định dạng file .jpg , .gif !'); return; } } else { if (in_array($file_ext, array('.swf'))) { if (!move_uploaded_file($_FILES['banner']['tmp_name'], $banner_file . $file_ext)) { $this->setFormError('banner', 'Không up load được Banner!'); return; } } else { $this->setFormError('banner', 'Flash đại diện chỉ chấp nhận các định dạng file .swf'); return; } } } $_SESSION['adv_cover_top'] = 0; if (isset(CGlobal::$configs['AdvCover'])) { DB::update('configs', array("conf_val" => addslashes(serialize($config_arr))), "conf_key='AdvCover'"); } else { DB::insert('configs', array("conf_key" => 'AdvCover', "conf_val" => addslashes(serialize($config_arr)))); } AZLib::get_config(0, 1); } if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']) { $referer = $_SERVER['HTTP_REFERER']; } else { $referer = $_SERVER['REQUEST_URI']; } Url::redirect_url($referer); }
function PublicSurveyForm() { Form::Form('PublicSurveyForm'); if (Url::get('cmd') == 'add_poll_to_block' && (int) Url::get('block_id') == Module::$block_id) { $id_survey = (int) Url::get('poll_id'); if ($id_survey) { $survey = DB::select("public_survey", "id={$id_survey}"); if ($survey) { $survey_config = @CGlobal::$configs['survey_config']['conf_val']; if ($survey_config != '') { $survey_config = unserialize(stripslashes($survey_config)); } else { $survey_config = array(); } $survey_config[Module::$block_id] = $id_survey; if (isset(CGlobal::$configs['survey_config'])) { DB::update('configs', array("conf_val" => addslashes(serialize($survey_config))), "conf_key='survey_config'"); } else { DB::insert('configs', array("conf_key" => 'survey_config', "conf_val" => addslashes(serialize($survey_config)))); } AZLib::get_config(0, 1); } Url::redirect_current(); } } if (Url::get('cmd') == 'remove_survey' && (int) Url::get('block_id') == Module::$block_id) { $survey_config = @CGlobal::$configs['survey_config']['conf_val']; if ($survey_config != '') { $survey_config = unserialize(stripslashes($survey_config)); } else { $survey_config = array(); } if (isset($survey_config[Module::$block_id])) { unset($survey_config[Module::$block_id]); } if (isset(CGlobal::$configs['survey_config'])) { DB::update('configs', array("conf_val" => addslashes(serialize($survey_config))), "conf_key='survey_config'"); } else { DB::insert('configs', array("conf_key" => 'survey_config', "conf_val" => addslashes(serialize($survey_config)))); } AZLib::get_config(0, 1); Url::redirect_current(); /*if(isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']){ $referer = $_SERVER['HTTP_REFERER']; } else{ $referer = $_SERVER['REQUEST_URI']; } Url::redirect_url($referer);*/ } }
function on_submit() { if (User::is_admin()) { $map_content = Url::get("map_content"); if (isset(CGlobal::$configs['map_content'])) { DB::update('configs', array("conf_val" => $map_content), "conf_key='map_content'"); } else { DB::insert('configs', array("conf_key" => "map_content", "conf_val" => $map_content)); } AZLib::get_config(0, 1); Url::redirect_current(); } }
function on_submit() { $url_detail = URL::get('url'); $status = URL::get('status', 'int', 0); $type = URL::get('type', 'int', 1); $contentConfig = $status . "\n" . $url_detail . "\n" . $type; $banner_file = DATA_PATH . 'adv/AdvHomeBottom'; if (isset($_FILES['banner']) && $_FILES['banner']['error'] == 0) { $file_ext = strtolower(substr($_FILES['banner']['name'], strlen($_FILES['banner']['name']) - 4, 4)); if ($type == 1) { //Ảnh if (in_array($file_ext, array('.jpg', '.gif'))) { if (getimagesize($_FILES['banner']['tmp_name'])) { if (!move_uploaded_file($_FILES['banner']['tmp_name'], $banner_file . '.gif')) { $this->setFormError('banner', 'Không up load được Banner!'); return; } } else { $this->setFormError('banner', 'Sai định dạng ảnh!'); return; } } else { $this->setFormError('banner', 'Chỉ chấp nhận các định dạng file .jpg , .gif !'); return; } } else { if (in_array($file_ext, array('.swf'))) { if (!move_uploaded_file($_FILES['banner']['tmp_name'], $banner_file . '.swf')) { $this->setFormError('banner', 'Không up load được Banner!'); return; } } else { $this->setFormError('banner', 'Flash đại diện chỉ chấp nhận các định dạng file .swf'); return; } } } if (isset(CGlobal::$configs['AdvHomeBottom'])) { DB::update('configs', array("conf_val" => $contentConfig), "conf_key='AdvHomeBottom'"); } else { DB::insert('configs', array("conf_key" => 'AdvHomeBottom', "conf_val" => $contentConfig)); } AZLib::get_config(0, 1); Url::redirect_current(); //CGlobal::$configs['AdvHomeBottom']['conf_val'] = $contentConfig; }
function on_submit() { $exchange = Url::get('exchange'); if ($exchange == '') { $this->setFormError('exchange', 'Bạn chưa nhập vào tỷ giá!'); return; } $exchange = Url::cdouble(Url::get('exchange')); if ($exchange <= 0) { $this->setFormError('exchange', 'Tỷ giá phải là 1 số nguyên > 0!'); return; } if (isset(CGlobal::$configs['exchange'])) { DB::update('configs', array("conf_val" => $exchange), "conf_key='exchange'", __FILE__ . " Dòng:" . __LINE__); } else { DB::insert('configs', array("conf_key" => 'exchange', "conf_val" => $exchange), __FILE__ . " Dòng:" . __LINE__); } AZLib::get_config(0, 1); Url::redirect_current(); }
function on_submit() { $footerContent = Url::get('content'); if (get_magic_quotes_gpc()) { $footerContent = stripslashes($footerContent); } require_once ROOT_PATH . 'includes/htmLawed.php'; $config = array('safe' => 1, 'elements' => '*', 'deny_attribute' => 'class, id'); $spec = 'a = title, href;'; // The 'a' element can have only these attributes $footerContent = htmLawed($footerContent, $config, $spec); $footerContent = AZLib::clean_value($footerContent); $this->checkFormInput('Nội dung', 'content', $footerContent, 'str', true); if (!$this->errNum) { if (isset(CGlobal::$configs['footer_content'])) { DB::update('configs', array("conf_val" => $footerContent), "conf_key='footer_content'"); } else { DB::insert('configs', array("conf_key" => 'footer_content', "conf_val" => $footerContent)); } AZLib::get_config(0, 1); AZLib::refreshParent(); } }
function on_submit() { DB::query('UPDATE configs SET conf_val = "' . Url::get('conf_val') . '" WHERE conf_key="badwords"'); AZLib::get_config(1); Url::redirect_current(); }
function on_submit() { if (User::is_admin()) { $submit = Url::get('submit'); if ($submit == "Cập nhật" || $submit == "Xóa tất cả") { $title_offer = Url::get('title_offer'); $item_cats = Url::get('item_cats'); $config_update = array('title' => $title_offer, 'item_cat_offer' => array()); if ($submit == "Cập nhật") { if ($item_cats) { foreach ($item_cats as $catid => $item_ids) { if (isset(CGlobal::$allCategories[$catid]) && $item_ids != '') { $config_update['item_cat_offer'][$catid] = implode(',', explode(',', $item_ids)); } } } } else { $configs = @CGlobal::$configs['ItemOffer']['conf_val']; $config_update['title'] = $configs['title']; } ########################### if (isset(CGlobal::$configs['ItemOffer'])) { DB::update('configs', array("conf_val" => addslashes(serialize($config_update))), "conf_key='ItemOffer'", __FILE__ . " Dòng:" . __LINE__); } else { DB::insert('configs', array("conf_key" => 'ItemOffer', "conf_val" => addslashes(serialize($config_update))), __FILE__ . " Dòng:" . __LINE__); } AZLib::get_config(0, 1); } if ($submit == "Cập nhật Quảng cáo") { $url_detail = URL::get('url'); $status = URL::get('status', 'int', 0); $type = URL::get('type', 'int', 1); $contentConfig = $status . "\n" . $url_detail . "\n" . $type; $banner_file = DATA_PATH . 'adv/AdvItemOffer'; if (isset($_FILES['banner']) && $_FILES['banner']['error'] == 0) { $file_ext = strtolower(substr($_FILES['banner']['name'], strlen($_FILES['banner']['name']) - 4, 4)); if ($type == 1) { //Ảnh if (in_array($file_ext, array('.jpg', '.gif'))) { if (getimagesize($_FILES['banner']['tmp_name'])) { if (!move_uploaded_file($_FILES['banner']['tmp_name'], $banner_file . '.gif')) { $this->setFormError('banner', 'Không up load được Banner!'); return; } } else { $this->setFormError('banner', 'Sai định dạng ảnh!'); return; } } else { $this->setFormError('banner', 'Chỉ chấp nhận các định dạng file .jpg , .gif !'); return; } } else { if (in_array($file_ext, array('.swf'))) { if (!move_uploaded_file($_FILES['banner']['tmp_name'], $banner_file . '.swf')) { $this->setFormError('banner', 'Không up load được Banner!'); return; } } else { $this->setFormError('banner', 'Flash đại diện chỉ chấp nhận các định dạng file .swf'); return; } } } if (isset(CGlobal::$configs['AdvItemOffer'])) { DB::update('configs', array("conf_val" => $contentConfig), "conf_key='AdvItemOffer'"); } else { DB::insert('configs', array("conf_key" => 'AdvItemOffer', "conf_val" => $contentConfig)); } AZLib::get_config(0, 1); } if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']) { $referer = $_SERVER['HTTP_REFERER']; } else { $referer = $_SERVER['REQUEST_URI']; } Url::redirect_url($referer); } Url::redirect_url($_SERVER['REQUEST_URI']); }
function on_submit() { $submit = Url::get('submit'); $submitLogo = Url::get('submitLogo'); if ($submit == 'Cập nhật') { if (User::is_admin()) { $status = (int) Url::get('status', 0); $b_background_file = DATA_PATH . "b_background.gif"; if (isset($_FILES['b_background']) && $_FILES['b_background']['error'] == 0) { $file_ext = strtolower(AZLib::getExtension($_FILES['b_background']['name'])); if (in_array($file_ext, array('.jpg', '.jpeg', '.png', '.gif'))) { if (getimagesize($_FILES['b_background']['tmp_name'])) { if (!move_uploaded_file($_FILES['b_background']['tmp_name'], $b_background_file)) { $this->setFormError('b_background', 'Không up load được Body Background!'); return; } } else { $this->setFormError('b_background', 'Sai định dạng Body Background!'); return; } } else { $this->setFormError('b_background', 'Body Background chỉ chấp nhận các định dạng file .jpg, .jpeg, .gif, .png!'); return; } } if (isset(CGlobal::$configs['event_on'])) { DB::update('configs', array("conf_val" => $status), "conf_key='event_on'"); } else { DB::insert('configs', array("conf_key" => 'event_on', "conf_val" => $status)); } AZLib::get_config(0, 1); } if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']) { $referer = $_SERVER['HTTP_REFERER']; } else { $referer = $_SERVER['REQUEST_URI']; } Url::redirect_url($referer); } if (User::have_permit(ADMIN_LOGO) && $submitLogo) { $id = (int) Url::get('logoID', 0); $cmd = Url::get('logoCmd'); if ($cmd == 'delete') { if ($id) { $record = DB::select('website_logo', 'id=' . $id); } AZLib::ftp_image_delete_file($record['image'], $record['img_server']); $sql = 'delete FROM website_logo WHERE id = ' . $id; DB::query($sql); AZLib::getWebsiteLogo(1); } else { $logo = array(); $start_date = Url::get('logoStartDate', 0); $end_date = Url::get('logoEndDate', 0); if ($id) { $logo = DB::fetch("SELECT * FROM website_logo WHERE id = {$id}"); } $logo['title'] = Url::get('logoTitle'); if (!isset($logo['img_server'])) { $logo['img_server'] = IMAGE_SERVER_NO; } if (!$cmd) { $logo['username'] = User::$current->data['user_name']; } if ($start_date) { $date_arr = explode("-", $start_date); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $logo['start_date'] = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } else { $logo['start_date'] = 0; } if ($end_date) { $date_arr = explode("-", $end_date); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $logo['end_date'] = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } else { $logo['end_date'] = 0; } if (Url::get('logoActive', 0)) { DB::query("UPDATE website_logo SET status = 0"); $logo['status'] = 1; } else { $logo['status'] = 0; } //Gen image unique name $img = $_FILES['uploadLogo']['name']; $img = explode('.', $img); $img = array_pop($img); $mini = microtime(TRUE); $img = $mini . '.' . $img; if ($_FILES['uploadLogo']['tmp_name']) { if ($cmd == 'edit') { //sửa AZLib::ftp_image_delete_file('logo/' . $img, $logo['img_server']); } if (AZLib::ftp_check_dir('logo/', TRUE, IMAGE_SERVER_NO)) { $file_name = 'logo/' . $img; $sourceName = $_FILES['uploadLogo']['tmp_name']; AZLib::ftp_image_put_file($file_name, $sourceName, IMAGE_SERVER_NO); $logo['image'] = $file_name; } } if (!$this->errNum && isset($logo['image']) && $logo['image']) { if ($cmd == 'edit') { DB::update('website_logo', $logo, 'id=' . $id); } else { $id = DB::insert('website_logo', $logo); } AZLib::getWebsiteLogo(1); } } } }
function on_submit() { if (User::is_admin()) { $replace_file = FALSE; $hb_update = Url::get('hb_update', 0); if (isset($_FILES['banner']) && $_FILES['banner']['error'] == 0) { $b_ext = strtolower(AZLib::getExtension($_FILES['banner']['name'])); if (in_array($b_ext, array('.swf', '.gif', '.jpg', '.jpeg', '.png'))) { $replace_file = TRUE; } else { $this->setFormError('banner', "Sai định dạng file! Chỉ chấp nhận định dạng .swf, .gif, .jpg, .jpeg, .png"); } } elseif ($hb_update == 0) { $this->setFormError('banner', "Không up được hoặc bạn chưa chọn up banner!"); } if (!$this->errNum) { if ($hb_update == 0 && $replace_file == TRUE || $hb_update > 0) { //Up mới hoặc cập nhật thông số $url = Url::get('url'); $sec = Url::get('sec', 0); if ($sec <= 0) { $sec = 15; } $up_pos = 0; $max_name = 0; $banners = array(); $dir = scandir(DATA_PATH . "home_banner/"); $configs = @CGlobal::$configs['home_banner']['conf_val']; if ($configs) { $configs = unserialize(stripslashes($configs)); } else { $configs = array(); } $config_update = array(); foreach ($dir as $fd) { if (is_file(DATA_PATH . "home_banner/{$fd}")) { $ext = strtolower(AZLib::getExtension($fd)); $arr = array(); if (in_array($ext, array('.swf', '.gif', '.jpg', '.jpeg', '.png'))) { $name = (int) basename($fd, $ext); if (isset($configs[$name])) { $config_update[$name] = array('time' => $configs[$name]['time'], 'url' => $configs[$name]['url']); } else { $config_update[$name] = array('time' => 15, 'url' => ''); } if ($max_name < $name) { $max_name = $name; } $banners[$name] = $name; } } } if ($hb_update > 0) { if ($hb_update > $max_name) { $up_pos = $max_name + 1; } else { $up_pos = $hb_update; } } else { for ($i = 1; $i <= $max_name + 1; $i++) { if (!isset($banners[$i])) { $up_pos = $i; break; } } } $config_update[$up_pos] = array('time' => $sec, 'url' => urlencode($url)); if ($replace_file) { if (file_exists(DATA_PATH . "home_banner/{$up_pos}.swf")) { @unlink(DATA_PATH . "home_banner/{$up_pos}.swf"); } if (file_exists(DATA_PATH . "home_banner/{$up_pos}.gif")) { @unlink(DATA_PATH . "home_banner/{$up_pos}.gif"); } if (file_exists(DATA_PATH . "home_banner/{$up_pos}.jpg")) { @unlink(DATA_PATH . "home_banner/{$up_pos}.jpg"); } if (file_exists(DATA_PATH . "home_banner/{$up_pos}.jpeg")) { @unlink(DATA_PATH . "home_banner/{$up_pos}.jpeg"); } if (file_exists(DATA_PATH . "home_banner/{$up_pos}.png")) { @unlink(DATA_PATH . "home_banner/{$up_pos}.png"); } $banner_file = DATA_PATH . "home_banner/{$up_pos}{$b_ext}"; if (!move_uploaded_file($_FILES['banner']['tmp_name'], $banner_file)) { $this->setFormError('banner', "Không Upload được Banner!"); return; } else { @chmod($banner_file, 0777); } } if (isset(CGlobal::$configs['home_banner'])) { DB::update('configs', array("conf_val" => addslashes(serialize($config_update))), "conf_key='home_banner'", __FILE__ . " Dòng:" . __LINE__); } else { DB::insert('configs', array("conf_key" => 'home_banner', "conf_val" => addslashes(serialize($config_update))), __FILE__ . " Dòng:" . __LINE__); } AZLib::get_config(0, 1); if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']) { $referer = $_SERVER['HTTP_REFERER']; } else { $referer = $_SERVER['REQUEST_URI']; } Url::redirect_url($referer); } } } Url::redirect_url($_SERVER['REQUEST_URI']); }
function produc_hot() { if (!User::is_login()) { echo 'no_login'; exit; } if (!User::have_permit(ADMIN_CATEGORY)) { echo 'no_perm'; exit; } $cat_id = AZLib::getParam('cat_id', '0'); $item_ids = AZLib::getParam('item_ids'); $vip_item_ids = AZLib::getParam('vip_item_ids'); if ($item_ids == '' && $vip_item_ids == '') { //$file = DIR_CACHE."html/product_hot/data_".$cat_id.".js"; //if(@file_exists($file)){ // StaticCache::delCache("product_hot/data_".$cat_id,"js"); //} $sql = "update configs set conf_val = '' where conf_key = 'product_hot_" . $cat_id . "'"; $sql_vip = "delete from item_vip where product_hot_cat_id =" . $cat_id; DB::query($sql); DB::query($sql_vip); AZLib::get_item_vip(0, true); AZLib::get_config(0, true); exit; } // item thuong $item_array = explode(',', $item_ids); $items = array(); foreach ($item_array as $item) { if ($item) { $items[] = intval($item); } } $id_items_after = ''; $item_ids = join(',', $items); $sql = "delete from configs where conf_key = 'product_hot_" . $cat_id . "'"; DB::query($sql); AZLib::get_config(0, true); if ($item_ids != '') { $sql = "SELECT id, name, brief, price, currency_id, img_url\r\n\t\t\t\t\t FROM item \r\n\t\t\t\t\t WHERE status = 1 AND id IN({$item_ids})"; $result = DB::query($sql); $i = 0; while ($item = mysql_fetch_array($result)) { if (isset($item['id'])) { $id_items[$i] = $item['id']; $i++; } } $id_items_after = ''; for ($i = 0; $i < count($item_array); $i++) { for ($j = 0; $j < count($id_items); $j++) { if ($item_array[$i] == $id_items[$j]) { $id_items_after .= $id_items[$j] . ","; } } } if ($id_items_after != '') { $id_items_after = substr($id_items_after, 0, -1); } $sql_check = "SELECT id FROM configs WHERE conf_key = 'product_hot_" . $cat_id . "'"; DB::query($sql_check); $row = DB::fetch_row(); if ($row['id'] != '') { $sql = "UPDATE configs SET conf_val = '" . $id_items_after . "' WHERE conf_key = 'product_hot_" . $cat_id . "'"; DB::query($sql); AZLib::get_config(0, true); // xoa cache config } else { $sql = "INSERT INTO configs (`conf_key`,`conf_val`) values ('product_hot_" . $cat_id . "','" . $id_items_after . "')"; DB::query($sql); AZLib::get_config(0, true); // xoa cache config } } //item vip $vip_item_array = explode(',', $vip_item_ids); $vip_items = array(); foreach ($vip_item_array as $vip_item) { if ($vip_item) { $vip_items[] = intval($vip_item); } } $vip_id_items_after = ''; $vip_item_ids = join(',', $vip_items); $sql_vip = "delete from item_vip where product_hot_cat_id =" . $cat_id; DB::query($sql_vip); AZLib::get_item_vip(0, true); if ($vip_item_ids != '') { $sql = "SELECT id, name, brief, price, currency_id, img_url\r\n\t\t\t\t\t FROM item \r\n\t\t\t\t\t WHERE status > 0 AND id IN({$vip_item_ids})"; $result = DB::query($sql); while ($item = mysql_fetch_array($result)) { if (isset($item['id'])) { $vip_id_items_after .= $item['id'] . ","; $sql_check = "select count(*) AS total from item_vip where item_id = " . $item['id'] . " And product_hot_cat_id=" . $cat_id; DB::query($sql_check); $row = DB::fetch_row(); if ($row['total'] == 0) { $sql = "insert into item_vip (`item_id`,`product_hot_cat_id`) values (" . $item['id'] . "," . $cat_id . ")"; DB::query($sql); AZLib::get_item_vip(0, true); } } } if ($vip_id_items_after != '') { $vip_id_items_after = substr($vip_id_items_after, 0, -1); } } $id_items_after .= '|' . $vip_id_items_after; // check file //if(@file_exists(DIR_CACHE."html/product_hot/data_".$cat_id.".js")){ //StaticCache::delCache("product_hot/data_".$cat_id,"js"); //} AZArrCache::del_cache('arrProductHotCache'); echo $id_items_after; exit; }
public static function processOnline() { AZLib::get_config(); $configs = @CGlobal::$configs['site_hit']['conf_val']; if ($configs != '') { $configs = unserialize(stripslashes($configs)); } else { $configs = array('site_hit' => 1, 'site_hit_month' => 1, 'site_hit_day' => 1, 'time' => TIME_NOW); } $update = FALSE; $update_month = FALSE; $update_day = FALSE; $site_hit = $configs['site_hit']; $site_hit_month = $configs['site_hit_month']; $site_hit_day = $configs['site_hit_day']; $check_time = $configs['time']; //Site hit count in Month $time_start_month = mktime(0, 0, 0, date('m', TIME_NOW), 1, date('Y', TIME_NOW)); if ($check_time <= $time_start_month) { $site_hit_month = 1; $update = 1; $update_month = 1; } //Site hit count in Day $time_start_day = mktime(0, 0, 0, date('m', TIME_NOW), date('d', TIME_NOW), date('Y', TIME_NOW)); if ($check_time <= $time_start_day) { $site_hit_day = 1; $update = 1; $update_day = 1; } //Site hit if (!isset($_SESSION['site_hit'])) { $site_hit++; if (!$update_month) { $site_hit_month++; } if (!$update_day) { $site_hit_day++; } $_SESSION['site_hit'] = 1; $update = 1; } if ($update) { $configs = array('site_hit' => $site_hit, 'site_hit_month' => $site_hit_month, 'site_hit_day' => $site_hit_day, 'time' => TIME_NOW); if (isset(CGlobal::$configs['site_hit'])) { DB::update('configs', array("conf_val" => addslashes(serialize($configs))), "conf_key='site_hit'"); } else { DB::insert('configs', array("conf_key" => 'site_hit', "conf_val" => addslashes(serialize($configs)))); } AZLib::get_config(0, 1); } User::$site_hit = $site_hit; User::$site_hit_month = $site_hit_month; User::$site_hit_day = $site_hit_day; }
CGlobal::$curItemType = (int) $_GET['type']; } // Disable ALL magic_quote set_magic_quotes_runtime(0); if (get_magic_quotes_gpc()) { function stripslashes_deep($value) { $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); return $value; } $_REQUEST = array_map('stripslashes_deep', $_REQUEST); $_COOKIE = array_map('stripslashes_deep', $_COOKIE); } if (!ERROR_PAGE) { //get all config AZLib::get_config(); CGlobal::$exchange = (int) @CGlobal::$configs['exchange']['conf_val']; //Get all Categories AZLib::getCats(); //if((isset($_GET['category_id']) && $_GET['category_id']) || (isset($_GET['zone_id']) && $_GET['zone_id']) || (Url::get("page","home") == 'home')){ if (isset($_GET['category_id']) && $_GET['category_id']) { //AZLib::getCats(); if (isset($_GET['category_id']) && isset(CGlobal::$allCategories[(int) $_GET['category_id']]) && CGlobal::$allCategories[(int) $_GET['category_id']]) { CGlobal::$curCategory = (int) $_GET['category_id']; } } if (isset($_GET['province_id'])) { AZLib::getProvinces(); //Get all Provinces $province_id = (int) $_GET['province_id']; if (isset(CGlobal::$provinces[$province_id]) && CGlobal::$provinces[$province_id]) {
function on_submit() { if (User::is_admin()) { $build_catids = Url::get('build_catids'); if ($build_catids != '') { $arr = array_unique(explode(',', $build_catids)); $build_catids = ''; $arr2 = array(); if ($arr) { foreach ($arr as $catid) { if (is_numeric($catid) && $catid) { $arr2[$catid] = $catid; } } } if ($arr2) { $build_catids = implode(',', $arr2); } } if (isset(CGlobal::$configs['BuildCatIDs'])) { DB::update('configs', array("conf_val" => $build_catids), "conf_key='BuildCatIDs'", __FILE__ . " Dòng:" . __LINE__); } else { DB::insert('configs', array("conf_key" => 'BuildCatIDs', "conf_val" => $build_catids), __FILE__ . " Dòng:" . __LINE__); } AZLib::get_config(0, 1); if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']) { $referer = $_SERVER['HTTP_REFERER']; } else { $referer = $_SERVER['REQUEST_URI']; } Url::redirect_url($referer); } Url::redirect_url($_SERVER['REQUEST_URI']); }