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"); }
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"); }
public function test3() { $URL = new URL("http://abc.com/目录1/目录2/index.php?cat=科技&rate= 非常好"); $URL->encode(); $newUrl = $URL->build(); echo $newUrl; //http://abc.com/%E7_%AE%E5%BD_1/%E7_%AE%E5%BD_2/index.php?cat=%E7%A7_%E6__&rate=+%E9__%E5%B8%B8%E5%A5%BD }
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(); }
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"); }
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"); }
public static function append($query) { $URL = new URL(); $URL->setQuery($query); return $URL->build(); }
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"); }
private static function _normalize_links_attrs(array $m) { $attr = strtolower($m[2]); #проверяем соответствие атрибутов и тэгов if (strpos(self::$url_tags[self::$_normalize_links['tag']], $attr) === false) { return $m[0]; } if ($m[1] === '') { $m[1] = ' '; } #теоретически в названии файла могут использоваться юникод-символы, но нам в первую очередь нужно это: #htmlspecialchars_decode() + декодируем DEC и HEX сущности $value = trim(isset($m[4]) ? $m[3] : substr($m[3], 1, -1), ".. "); $value = self::entity_decode($value, $is_htmlspecialchars = true); if ($attr === 'rel' || $attr === 'target') { if (!self::$_normalize_links['is_add_extra']) { return $m[1] . $m[2] . '="' . htmlspecialchars($value) . '"'; } self::$_normalize_links['attr.' . $attr] = $value; return ''; } if (($attr === 'title' || $attr === 'alt') && !array_key_exists('attr.title', self::$_normalize_links)) { self::$_normalize_links['attr.title'] = $value; } else { #исправляем частые ошибки в протоколе (с пропуском двойного слэша и буквы) $url = $value; $url = preg_replace('~^[a-z][-a-z\\d_]{2,19}+(?<![-_]):/(?!/)~siSX', '$0/', $url); $url = preg_replace('~^htt?+p:?+//~siSX', 'http://', $url); $url = @parse_url($url); $url_parsed = self::_normalize_links_parse($url, $is_fragment_only); if (is_array($url_parsed)) { $url_parsed = URL::build($url_parsed); } if (is_string($url_parsed)) { $value = $url_parsed; if (!$is_fragment_only) { #отрезаем якорь if (array_key_exists('fragment', $url)) { $url_parsed = substr($url_parsed, 0, -1 * strlen('#' . $url['fragment'])); } self::$_normalize_links['attr.link'] = $url_parsed; } } else { if (!array_key_exists($value, self::$_normalize_links['broken_links'])) { self::$_normalize_links['broken_links'][$value] = 1; } else { self::$_normalize_links['broken_links'][$value]++; } } } /* TODO if ( $attr == 'style' && strpos(str_replace('\\', '/', $value), self::$_normalize_links['path_search']) !== false && #оптимизация скорости (strpos($value, 'url(') !== false || strpos($value, 'src=') !== false) #оптимизация скорости ) { #поддержка разного синтаксиса: $patterns = array( #url(filename) '/(?<![a-zA-Z\d])((?i:url)\()' . self::$_normalize_links_re_uri_prefix . '([^)]*\))/sxSX', #url('filename') ~ background-image:url('/project/www/img/sunflower_alpha_border.png'); '/(?<![a-zA-Z\d])((?i:url)\(\')' . self::$_normalize_links_re_uri_prefix . '([^\']*\'\))/sxSX', #src='filename' ~ filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/project/www/img/sunflower_alpha_border.png',sizingMethod='crop'); '/(?<![a-zA-Z\d])((?i:src)=\')' . self::$_normalize_links_re_uri_prefix . '([^\']*\')/sxSX', ); $value = preg_replace($patterns, '$1' . self::$_normalize_links['path_replace'] . '$2', $value); } */ return $m[1] . $m[2] . '="' . htmlspecialchars($value) . '"'; }