本文整理汇总了PHP中UrlDecode函数的典型用法代码示例。如果您正苦于以下问题:PHP UrlDecode函数的具体用法?PHP UrlDecode怎么用?PHP UrlDecode使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UrlDecode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MetabaseParseConnectionArguments
function MetabaseParseConnectionArguments($connection, &$arguments)
{
$parameters = parse_url($connection);
if (!isset($parameters["scheme"])) {
return "it was not specified the connection type argument";
}
$arguments["Type"] = $parameters["scheme"];
if (isset($parameters["host"])) {
$arguments["Host"] = UrlDecode($parameters["host"]);
}
if (isset($parameters["user"])) {
$arguments["User"] = UrlDecode($parameters["user"]);
}
if (isset($parameters["pass"])) {
$arguments["Password"] = UrlDecode($parameters["pass"]);
}
if (isset($parameters["port"])) {
$arguments["Options"]["Port"] = $parameters["port"];
}
if (isset($parameters["path"])) {
$arguments["Database"] = UrlDecode(substr($parameters["path"], 1));
}
if (isset($parameters["query"])) {
$options = explode("&", $parameters["query"]);
for ($option = 0; $option < count($options); $option++) {
if (GetType($equal = strpos($options[$option], "=")) != "integer") {
return $options[$option] . " connection option argument does not specify a value";
}
$argument = UrlDecode(substr($options[$option], 0, $equal));
$value = UrlDecode(substr($options[$option], $equal + 1));
if (GetType($slash = strpos($argument, "/")) == "integer") {
if (substr($argument, 0, $slash) != "Options") {
return "it was not specified a valid conection option argument";
}
$arguments["Options"][substr($argument, $slash + 1)] = $value;
} else {
$arguments[$argument] = $value;
}
}
}
return "";
}
示例2: stream_open
function stream_open($path, $mode, $options, &$opened_path)
{
$this->report_errors = ($options & STREAM_REPORT_ERRORS) != 0;
if (strcmp($mode, "r")) {
return $this->SetError("the message can only be opened for reading");
}
$url = parse_url($path);
$host = $url['host'];
$pop3 =& pop3_class::SetConnection(0, $host, $this->pop3);
if (isset($pop3)) {
$this->pop3 =& $pop3;
$this->previous_connection = 1;
} else {
$this->pop3 = new pop3_class();
}
if (!$this->ParsePath($path, $url)) {
return FALSE;
}
$message = substr($url["path"], 1);
if (strcmp(intval($message), $message) || $message <= 0) {
return $this->SetError("it was not specified a valid message to retrieve");
}
if (!$this->previous_connection) {
if (strlen($error = $this->pop3->Open())) {
return $this->SetError($error);
}
$this->opened = 1;
$apop = isset($url["query"]["apop"]) ? intval($url["query"]["apop"]) : 0;
if (strlen($error = $this->pop3->Login(UrlDecode($url["user"]), UrlDecode($url["pass"]), $apop))) {
$this->stream_close();
return $this->SetError($error);
}
}
if (strlen($error = $this->pop3->OpenMessage($message, -1))) {
$this->stream_close();
return $this->SetError($error);
}
$this->end_of_message = FALSE;
if ($options & STREAM_USE_PATH) {
$opened_path = $path;
}
$this->read = 0;
$this->buffer = "";
return TRUE;
}
示例3: view
public function view($id = '', $page = 1, $orderby = 0, $rownum = 0, $showtype = 0)
{
$orderby = UrlDecode($orderby);
$rownum = UrlDecode($rownum);
$showtype = UrlDecode($showtype);
$flag = 1;
$this->data['to_page_id'] = $id;
if (!isset($_GET['page'])) {
$_GET['page'] = $page;
}
$this->data['get_page'] = $_GET['page'];
// Configure::write('debug', 0);
if (!is_numeric($id) || $id < 1) {
$this->pageTitle = $this->ld['parameter_error'] . ' - ' . $this->configs['shop_title'];
$this->flash($this->ld['parameter_error'], '/', 5);
$flag = 0;
}
//取得该品牌信息
$brand_info = $this->Brand->find('first', array('conditions' => array('Brand.id' => $id), 'fields' => 'Brand.id,Brand.status,BrandI18n.name,BrandI18n.meta_keywords,BrandI18n.meta_description,BrandI18n.description'));
$this->set('meta_description', $brand_info['BrandI18n']['meta_description']);
$this->set('meta_keywords', $brand_info['BrandI18n']['meta_keywords']);
$this->params['id'] = $id;
if (empty($brand_info)) {
$this->pageTitle = $this->ld['brand'] . $this->ld['not_exist'] . ' - ' . $this->configs['shop_title'];
$this->flash($this->ld['brand'] . $this->ld['not_exist'], '/', 5);
$flag = 0;
} elseif ($brand_info['Brand']['status'] == 0) {
$this->pageTitle = $this->ld['brand'] . $this->ld['not_exist'] . ' - ' . $this->configs['shop_title'];
$this->flash($this->ld['brand'] . $this->ld['not_exist'], '/', 5);
$flag = 0;
}
if ($flag == 1) {
$this->pageTitle = $brand_info['BrandI18n']['name'] . ' - ' . $this->configs['shop_title'];
//当前位置
$navigations = $brand_info;
$this->ur_heres[] = array('name' => $navigations['BrandI18n']['name'], 'url' => '/brands/' . $navigations['Brand']['id']);
$this->set('ur_heres', $this->ur_heres);
if (empty($rownum) && $rownum == 0) {
$rownum = isset($this->configs['products_list_num']) ? $this->configs['products_list_num'] : (!empty($rownum) ? $rownum : 20);
}
if (empty($showtype) && $showtype == 0) {
$showtype = isset($this->configs['products_list_showtype']) ? $this->configs['products_list_showtype'] : (!empty($showtype) ? $showtype : 'L');
}
//取商店设置商品排序
if (empty($orderby) && $orderby == 0) {
$orderby = isset($this->configs['products_category_page_orderby_type']) ? $this->configs['products_category_page_orderby_type'] . ' ' . $this->configs['products_category_page_orderby_method'] : (!empty($orderby) ? $orderby : 'created ' . $this->configs['products_category_page_orderby_method']);
}
if ($rownum == 'all') {
$rownum_sql = 99999;
} else {
$rownum_sql = $rownum;
}
$this->data['orderby'] = $orderby;
$this->data['rownum'] = $rownum;
$this->data['showtype'] = $showtype;
}
if (isset($this->configs['enable_one_step_buy']) && $this->configs['enable_one_step_buy'] == 1) {
$js_languages = array('enable_one_step_buy' => '1', 'enter_positive_integer' => $this->ld['be_integer']);
$this->set('js_languages', $js_languages);
} else {
$js_languages = array('enable_one_step_buy' => '0', 'enter_positive_integer' => $this->ld['be_integer']);
$this->set('js_languages', $js_languages);
}
$this->set('description', $brand_info['BrandI18n']['description']);
$this->page_init($this->params);
}
示例4: number_format
$bk_KEY = $kiv['skey'];
$bk_IV = $kiv['iv'];
if (!$bk_KEY || !$bk_IV) {
$title = "AllPay信用卡幕後授權-取店家專用的key失敗";
$msg = "Client : " . $client . " 取店家專用的key失敗 error_HashKey_IV <br>";
$msg .= "skey = " . $bk_KEY . "<br>";
$msg .= "iv = " . $bk_IV . "<br>";
$msg .= "使用者IP = " . $uip . "<br>";
$msg .= "<hr size=1>於 pay-web 執行的 g_ssl.php 執行時間 " . number_format(microtime(true) - $t1, 3) . " 秒<br>" . date("Y/m/d H:i:s");
@exec_mail(2, $title, $msg, 'g_ssl.php');
@setlog("A", $_GET['client'], "error_HashKey_IV", $uip, $t1);
echo 'error_HashKey_IV';
exit;
}
}
$dt = UrlDecode(fnDecrypt($dt, $bk_KEY, $bk_IV));
//開始取值new
$lx = explode("*", $dt);
$NEW_ssl = 1;
//需驗證檢核碼
$client = $lx[1];
//取出商代
$card_no = $lx[2];
//取出卡號
$exp = $lx[3];
//YYMM
$bgm = $lx[4];
//背3碼
$amount = $lx[5] + 1 - 1;
//取出金額
$stage = $lx[6] + 1 - 1;
示例5: index
/**
*会员商品管理.
*
*@param $page
*@param $orderby
*@param $rownum
*@param showtype
*/
public function index($page = 1, $orderby = '', $rownum = '', $showtype = '')
{
$this->pageTitle = $this->ld['integral_shopping_mall'] . ' - ' . $this->configs['shop_title'];
$this->ur_heres[] = array('name' => $this->ld['integral_shopping_mall'], 'url' => '/exchange/');
$this->page_init();
$orderby = UrlDecode($orderby);
$rownum = UrlDecode($rownum);
$showtype = UrlDecode($showtype);
if (empty($rownum) && $rownum == 0) {
$rownum = isset($this->configs['products_list_num']) ? $this->configs['products_list_num'] : (!empty($rownum) ? $rownum : 20);
}
if (empty($showtype) && $showtype == 0) {
$showtype = isset($this->configs['products_list_showtype']) ? $this->configs['products_list_showtype'] : (!empty($showtype) ? $showtype : 'L');
}
if (empty($orderby) && $orderby == 0) {
$orderby = isset($this->configs['products_category_page_orderby_type']) ? $this->configs['products_category_page_orderby_type'] . ' ' . $this->configs['products_category_page_orderby_method'] : (!empty($orderby) ? $orderby : 'created ' . $this->configs['products_category_page_orderby_method']);
}
if (!isset($_GET['page'])) {
$_GET['page'] = $page;
} else {
$page = $_GET['page'];
}
if ($rownum == 'all') {
$rownum_sql = 99999;
} else {
$rownum_sql = $rownum;
}
$this->data['get_page'] = $page;
$this->data['orderby'] = $orderby;
$this->data['rownum'] = $rownum;
$this->data['showtype'] = $showtype;
// 查找可用积分购买的商品
$sortClass = 'Product';
$page = 1;
$parameters = array($orderby, $rownum_sql, $page);
$options = array();
$condition = "Product.point_fee > '0' and Product.status = '1' and Product.forsale = '1'";
$locale = LOCALE;
$total = $this->Product->get_cache_total($condition, $locale);
$options = array('page' => $page, 'show' => $rownum, 'modelClass' => 'Product');
$this->data['page_total'] = $total;
list($page) = $this->Pagination->init($condition, $parameters, $options);
// Added
// $products=$this->Product->findAll($condition,'',"Product.$orderby","$rownum",$page);
$products = $this->Product->find_products_list($orderby, $condition, $rownum_sql, $page);
$products_ids_list = array();
if (is_array($products) && sizeof($products) > 0) {
foreach ($products as $k => $v) {
$products_ids_list[] = $v['Product']['id'];
}
}
// 商品多语言
$productI18ns_list = array();
$product_conditions = array('ProductI18n.product_id' => $products_ids_list, 'ProductI18n.locale' => LOCALE);
$productI18ns = $this->ProductI18n->get_productI18ns($product_conditions);
if (isset($productI18ns) && sizeof($productI18ns) > 0) {
foreach ($productI18ns as $k => $v) {
$productI18ns_list[$v['ProductI18n']['product_id']] = $v;
}
}
// 商品地区价格
if (isset($this->configs['mlti_currency_module']) && $this->configs['mlti_currency_module'] == 1) {
$locale_price_list = array();
$locale_price_conditions = array('ProductLocalePrice.product_id' => $products_ids_list, 'ProductLocalePrice.locale' => LOCALE, 'ProductLocalePrice.status' => 1);
$locale_price = $this->ProductLocalePrice->get_locale_price($locale_price_conditions);
if (isset($locale_price) && sizeof($locale_price) > 0) {
foreach ($locale_price as $k => $v) {
$locale_price_list[$v['ProductLocalePrice']['product_id']] = $v;
}
}
}
// $total = count($products);
$products_ids_list = array();
if (is_array($products) && sizeof($products) > 0) {
foreach ($products as $k => $v) {
$products_ids_list[] = $v['Product']['id'];
}
}
$category_lists = $this->CategoryProduct->find_all(LOCALE);
$this->set('categories', $category_lists);
$product_id_conditions = array('ProductsCategory.product_id' => $products_ids_list);
$product_category_infos = $this->ProductsCategory->get_product_category_infos($product_id_conditions);
$product_category_lists = array();
if (is_array($product_category_infos) && sizeof($product_category_infos) > 0) {
foreach ($product_category_infos as $k => $v) {
$product_category_lists[$v['ProductsCategory']['product_id']] = $v;
}
}
$product_ranks = $this->ProductRank->find_rank_by_product_ids($products_ids_list);
$user_rank_list = $this->UserRank->findrank();
if (isset($product_ranks) && sizeof($product_ranks) > 0) {
foreach ($product_ranks as $k => $v) {
//.........这里部分代码省略.........
示例6: ReadReplyHeaders
function ReadReplyHeaders(&$headers)
{
$headers = array();
if (strlen($this->error)) {
return $this->error;
}
switch ($this->state) {
case "Disconnected":
return $this->SetError("1 connection was not yet established");
case "Connected":
return $this->SetError("2 request was not sent");
case "RequestSent":
break;
default:
return $this->SetError("3 can not get request headers in the current connection state");
}
$this->content_length = $this->read_length = $this->read_response = 0;
$this->content_length_set = 0;
for ($this->response_status = "";;) {
$line = $this->GetLine();
if (GetType($line) != "string") {
return $this->SetError("4 could not read request reply: " . $this->error);
}
if (strlen($this->response_status) == 0) {
if (!eregi($match = "^http/[0-9]+\\.[0-9]+[ \t]+([0-9]+)", $line, $matches)) {
return $this->SetError("3 it was received an unexpected HTTP response status");
}
$this->response_status = $matches[1];
}
if ($line == "") {
if (strlen($this->response_status) == 0) {
return $this->SetError("3 it was not received HTTP response status");
}
$this->state = "GotReplyHeaders";
break;
}
$header_name = strtolower($this->Tokenize($line, ":"));
$header_value = Trim(Chop($this->Tokenize("\r\n")));
if (isset($headers[$header_name])) {
if (GetType($headers[$header_name]) == "string") {
$headers[$header_name] = array($headers[$header_name]);
}
$headers[$header_name][] = $header_value;
} else {
$headers[$header_name] = $header_value;
}
switch ($header_name) {
case "content-length":
$this->content_length = intval($headers[$header_name]);
$this->content_length_set = 1;
break;
case "set-cookie":
if ($this->support_cookies) {
if (GetType($headers[$header_name]) == "array") {
$cookie_headers = $headers[$header_name];
} else {
$cookie_headers = array($headers[$header_name]);
}
for ($cookie = 0; $cookie < count($cookie_headers); $cookie++) {
$cookie_name = trim($this->Tokenize($cookie_headers[$cookie], "="));
$cookie_value = $this->Tokenize(";");
$domain = $this->request_host;
$path = "/";
$expires = "";
$secure = strtolower($this->protocol) == "https";
while (($name = strtolower(trim($this->Tokenize("=")))) != "") {
$value = UrlDecode($this->Tokenize(";"));
switch ($name) {
case "domain":
if ($value == "" || !strpos($value, ".", $value[0] == ".")) {
break;
}
$domain = strtolower($value);
break;
case "path":
if ($value != "" && $value[0] == "/") {
$path = $value;
}
break;
case "expires":
if (ereg("^((Mon|Monday|Tue|Tuesday|Wed|Wednesday|Thu|Thursday|Fri|Friday|Sat|Saturday|Sun|Sunday), )?([0-9]{2})\\-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\-([0-9]{2,4}) ([0-9]{2})\\:([0-9]{2})\\:([0-9]{2}) GMT\$", $value, $matches)) {
$year = intval($matches[5]);
if ($year < 1900) {
$year += $year < 70 ? 2000 : 1900;
}
$expires = "{$year}-" . $this->months[$matches[4]] . "-" . $matches[3] . " " . $matches[6] . ":" . $matches[7] . ":" . $matches[8];
}
break;
case "secure":
$secure = 1;
break;
}
}
$this->cookies[$secure][$domain][$path][$cookie_name] = array("name" => $cookie_name, "value" => $cookie_value, "domain" => $domain, "path" => $path, "expires" => $expires, "secure" => $secure);
}
}
}
}
switch ($this->response_status) {
case "301":
//.........这里部分代码省略.........
示例7: advancedsearch
/**
*高级搜索.
*
*@param $type
*@param $keywords
*@param $category_id
*@param $brand_id
*@param $min_price
*@param $max_price
*@param $page
*@param $orderby
*@param $rownum
*@param $showtype
*/
public function advancedsearch($keyword = '', $page = 1, $limit = 12, $order_field = 0, $order_type = 0, $showtype = 0, $type = 0, $brand_id = 0, $min_price = 0, $max_price = 0, $flag = 0)
{
$this->set('search_type', 'p');
//Todo 改成后台可以控制
if (isset($_SESSION['template_use']) && $_SESSION['template_use'] == 'arcotek') {
$limit = 50;
}
$this->page_init();
$order_field = UrlDecode($order_field);
$order_type = UrlDecode($order_type);
$limit = UrlDecode($limit);
$showtype = 'L';
//$keyword = trim($keyword, " ");
// $keyword = UrlDecode($keyword);
//带冒号的关键字,对GET过来的参数做替代处理
if (isset($_GET['keyword']) && $_GET['keyword'] != '') {
$keyword = $_GET['keyword'];
}
if ($keyword == 'All') {
$keyword = '';
}
$strkeyword = $keyword;
if ($strkeyword == '') {
$strkeyword = 'All Product';
}
$this->product_order_field = $order_field;
if (trim($keyword) != '') {
$keyword = preg_split('#\\s+#', $keyword);
}
//pr($keyword);
//面包屑
$this->ur_heres[] = array('name' => $this->ld['search'] . ':' . $strkeyword, 'url' => '');
//搜索轮播
$flash_condition['flash_type'] = 'AS';
$flash_list = $this->Flash->get_module_infos($flash_condition);
$this->set('flash_list', $flash_list);
$this->set('meta_description', $strkeyword);
$this->set('meta_keywords', $strkeyword);
if ($order_field == 'Product.created') {
$this->pageTitle = '新品上架 - ' . sprintf($this->ld['page'], $page) . ' - ' . $this->configs['shop_title'];
} elseif ($order_field == 'Product.sale_stat') {
$this->pageTitle = '火爆团购- ' . sprintf($this->ld['page'], $page) . ' - ' . $this->configs['shop_title'];
} else {
$this->pageTitle = $strkeyword . ' - ' . sprintf($this->ld['page'], $page) . ' - ' . $this->configs['shop_title'];
}
if (empty($limit)) {
$limit = isset($this->configs['products_category_page_size']) ? $this->configs['products_category_page_size'] : (!empty($limit) ? $limit : 20);
}
if (empty($showtype)) {
$showtype = isset($this->configs['products_list_showtype']) ? $this->configs['products_list_showtype'] : (!empty($showtype) ? $showtype : 'L');
}
$order_fields = array('Product.created', 'Product.sale_stat', 'Product.shop_price');
if (!empty($order_field) && in_array($order_field, $order_fields)) {
} else {
$order_field = 'Product.sale_stat';
$order_type = 'desc';
}
if ($limit == 'all') {
$limit = 99999;
}
$this->set('search_eye', 1);
$conditions['AND']['Product.status'] = 1;
$conditions['AND']['Product.forsale'] = 1;
$conditions['AND']['Product.bestbefore'] = 0;
$conditions2['OR']['AND']['Product.status'] = 1;
$conditions2['OR']['AND']['Product.forsale'] = 1;
$conditions2['OR']['AND']['Product.bestbefore'] = 0;
$conditions2['OR']['OR']['Product.recommand_flag'] = 1;
$conditions2['OR']['OR']['Product.promotion_status'] = 1;
if ($type == 'promotion') {
//促销商品
} elseif ($type == 'new_arrival') {
//新品
$order = 'Product.created desc';
} elseif ($type == 'recommend') {
//推荐
$conditions['AND']['Product.recommand_flag'] = 1;
} else {
//type不合法时跳转报错
//$this->render('/errors/');
}
// $bran_sel=array();
// $bran_sel=$this->Brand->find('list',array('fields'=>array('Brand.id','BrandI18n.name'));
//模糊搜索
if (isset($this->configs['product_search_type']) && $this->configs['product_search_type'] == '0') {
if (is_array($keyword) && sizeof($keyword) > 0) {
//.........这里部分代码省略.........
示例8: ParseStructuredHeader
function ParseStructuredHeader($value, &$type, &$parameters, &$character_sets, &$languages)
{
$type = strtolower(trim($this->Tokenize($value, ';')));
$p = trim($this->Tokenize(''));
$parameters = $character_sets = $languages = array();
while (strlen($p)) {
$parameter = trim(strtolower($this->Tokenize($p, '=')));
$remaining = trim($this->Tokenize(''));
if (!strcmp($remaining[0], '"') && GetType($quote = strpos($remaining, '"', 1)) == 'integer') {
$value = substr($remaining, 1, $quote - 1);
$p = trim(substr($remaining, $quote + 1));
if (strlen($p) > 0 && !strcmp($p[0], ';')) {
$p = substr($p, 1);
}
} else {
$value = trim($this->Tokenize($remaining, ';'));
$p = trim($this->Tokenize(''));
}
if (($l = strlen($parameter)) && !strcmp($parameter[$l - 1], '*')) {
$parameter = $this->Tokenize($parameter, '*');
if (isset($parameters[$parameter]) && isset($character_sets[$parameter])) {
$value = $parameters[$parameter] . UrlDecode($value);
} else {
$character_sets[$parameter] = strtolower($this->Tokenize($value, '\''));
$languages[$parameter] = $this->Tokenize('\'');
$value = UrlDecode($this->Tokenize(''));
}
}
$parameters[$parameter] = $value;
}
}
示例9: microtime
<?php
$start = microtime(true);
require_once 'config/config.php';
require_once 'controller/Currency.php';
require_once 'controller/Logs.php';
$oRoute = explode('/', trim(UrlDecode($_SERVER['REQUEST_URI']), '/'));
if (count($oRoute) > 0) {
try {
$connection = new MongoClient();
switch ($oRoute[0]) {
case 'currency':
$app = new Currency($connection->Currency, $defaultCurrency, $oRoute[1], $oRoute[2]);
if ($app->Valid()) {
$result = $app->Calc();
$finish = microtime(true);
$app->Logger(array('request_date' => date('Y-m-d H:i:s'), 'request_time' => $finish - $start, 'request_price' => $app->cost, 'request_currency' => $app->fCurrency, 'request_ip' => $_SERVER['REMOTE_ADDR'], 'request_ua' => $_SERVER['HTTP_USER_AGENT']));
} else {
$result = array('error' => 1, 'mesage' => 'Запрос некорректен');
}
break;
case 'logs':
$app = new Logs($connection->Currency);
$result = $app->GetPeriod($oRoute[1], $oRoute[2]);
break;
default:
$result = array('error' => 1, 'mesage' => 'Запрос некорректен');
}
$connection->close();
} catch (MongoConnectionException $e) {
$result = array('error' => 1, 'mesage' => 'Сервис временно недоступен');
示例10: hotel_fav
public function hotel_fav($page = 1, $rownum = '', $orderby = '')
{
//登录验证
$this->checkSessionUser();
$this->layout = 'usercenter';
//引入模版
$this->page_init();
//页面初始化
//当前位置
$this->ur_heres[] = array('name' => $this->ld['user_center'], 'url' => '/users');
$this->ur_heres[] = array('name' => '酒店收藏', 'url' => '');
$this->set('ur_heres', $this->ur_heres);
$this->pageTitle = '酒店收藏' . ' - ' . $this->ld['page'] . ' ' . $page . ' - ' . $this->configs['shop_title'];
$orderby = UrlDecode($orderby);
$rownum = UrlDecode($rownum);
if (empty($rownum)) {
//默认显示5条
$rownum = isset($this->configs['products_list_num']) ? $this->configs['products_list_num'] : (!empty($rownum) ? $rownum : 5);
}
if (empty($orderby)) {
//默认根据时间来排序
$orderby = isset($this->configs['products_category_page_orderby_type']) ? $this->configs['products_category_page_orderby_type'] . ' ' . $this->configs['products_category_page_orderby_method'] : (!empty($orderby) ? $orderby : 'created ' . $this->configs['products_category_page_orderby_method']);
}
//根据输入来显示每页条数
if ($rownum == 'all') {
$rownum = 99999;
} else {
$rownum = $rownum;
}
$this->loadModel('TravelHotel');
$user_id = $_SESSION['User']['User']['id'];
$condition = " type = 'h' and user_id={$user_id} ";
$user_fav_infos = $this->UserFavorite->find('all', array('conditions' => $condition));
//获取自己的收藏
$hotel_ids = array();
$fav_type_id = array();
if (!empty($user_fav_infos)) {
foreach ($user_fav_infos as $k => $v) {
$hotel_ids[$k] = $v['UserFavorite']['type_id'];
$fav_type_id[$v['UserFavorite']['type_id']] = $v['UserFavorite']['id'];
}
}
$condition = '';
$condition = array('TravelHotel.id' => $hotel_ids, " TravelHotel.status ='1'");
$limit = $rownum;
$parameters['get'] = array();
$parameters['route'] = array('controller' => 'favorites', 'action' => 'index?type=h', 'page' => $page, 'limit' => $limit);
//分页参数
$options = array('page' => $page, 'show' => $limit, 'modelClass' => 'TravelHotel');
$page = $this->Pagination->init($condition, $parameters, $options);
// Added
//分页end
$hotel_infos = $this->TravelHotel->find('all', array('conditions' => $condition, 'order' => 'TravelHotel.created', 'limit' => $limit, 'page' => $page));
foreach ($hotel_infos as $k => $v) {
$hotel_infos[$k]['UserFavoriteId'] = isset($fav_type_id[$v['TravelHotel']['id']]) ? $fav_type_id[$v['TravelHotel']['id']] : '';
}
$this->set('hotel_infos', $hotel_infos);
$user_id = $_SESSION['User']['User']['id'];
$this->set('user_id', $user_id);
}
示例11: ReadReplyHeaders
function ReadReplyHeaders(&$headers)
{
switch ($this->state) {
case 'Disconnected':
return '1 connection was not yet established';
case 'Connected':
return '2 request was not sent';
case 'RequestSent':
break;
default:
return '3 can not get request headers in the current connection state';
}
$headers = array();
$this->content_length = $this->read_length = 0;
$this->content_length_set = 0;
for (;;) {
$line = $this->GetLine();
if (GetType($line) != 'string') {
return '4 could not read request reply';
}
if ($line == '') {
$this->state = 'GotReplyHeaders';
return '';
}
$header_name = strtolower(strtok($line, ':'));
$header_value = Trim(Chop(strtok("\r\n")));
if (isset($headers[$header_name])) {
if (GetType($headers[$header_name]) == 'string') {
$headers[$header_name] = array($headers[$header_name]);
}
$headers[$header_name][] = $header_value;
} else {
$headers[$header_name] = $header_value;
}
switch ($header_name) {
case 'content-length':
$this->content_length = intval($headers[$header_name]);
$this->content_length_set = 1;
break;
case 'set-cookie':
if ($this->support_cookies) {
$cookie_name = trim(strtok($headers[$header_name], '='));
$cookie_value = strtok(';');
$domain = $this->request_host;
$path = '/';
$expires = '';
$secure = 0;
while (($name = strtolower(trim(strtok('=')))) != '') {
$value = UrlDecode(strtok(';'));
switch ($name) {
case 'domain':
if ($value == '' || !strpos($value, '.', $value[0] == '.')) {
break;
}
$domain = strtolower($value);
break;
case 'path':
if ($value != '' && $value[0] == '/') {
$path = $value;
}
break;
case 'expires':
if (preg_match("/^((Mon|Monday|Tue|Tuesday|Wed|Wednesday|Thu|Thursday|Fri|Friday|Sat|Saturday|Sun|Sunday), )?([0-9]{2})\\-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\-([0-9]{2,4}) ([0-9]{2})\\:([0-9]{2})\\:([0-9]{2}) GMT\$/i", $value, $matches)) {
$year = intval($matches[5]);
if ($year < 1900) {
$year += $year < 70 ? 2000 : 1900;
}
$expires = "{$year}-" . $this->months[$matches[4]] . '-' . $matches[3] . ' ' . $matches[6] . ':' . $matches[7] . ':' . $matches[8];
}
break;
case 'secure':
$secure = 1;
break;
}
}
$this->cookies[$secure][$domain][$path][$cookie_name] = array('name' => $cookie_name, 'value' => $cookie_value, 'domain' => $domain, 'path' => $path, 'expires' => $expires, 'secure' => $secure);
}
}
}
}
示例12: setcookie
<?php
include 'allpay_com.php';
include 'allpay_fn.php';
$CookieTOO_Sys = 'allpay.com.tw';
//==========================================================
if ($_GET['d'] == 'c') {
setcookie("gw_allpay_t", '', "0", "/", $CookieTOO_Sys);
echo 'Cookie已清除';
exit;
}
//==========================================================
//$sValue = "Field=EWpS7g178XZos9C63HeHg9nk1hohAmtslhyhWUzVddNGMfdwHzPZcSR7v8w65JHFguoilkqJYotb/SAgp4RNXA==";
//$sValue.= "&Data=+0BJXQ3pD9fvKQEm+/kgGTV2OXI+ZZCCGlWSCHbGSX+qjcSdEBndlH+aJxzo5LAAUMOnA/UPluAqL69cDG/STE7U/8Znv1ZhALA7xLXtfaoLyAlhQ/gT0I1+BAmHBcQ9X97eORX07YBkXW+DkMSOddDO7oYhjJ6yGJCqNpPTmi+X1szbJ99LYWmRBn1UNwbQUwY/uVYfwIKvJOxJrcuhjw==";
//setcookie("gw_allpay_t",$sValue,"0","/",$CookieTOO_Sys);
//echo $_COOKIE['gw_allpay_t']."<br>\n";
//echo '<br>';
parse_str($_COOKIE['gw_allpay_p']);
//$aaa = '1ZiNtaMLJC9ofyQLn+VoSD2lKieIhrxkJdZLzLiYfWSw/ALDN/yK7v384x5n4BtciqbqJQAKVp0G6/HB6T+kDMlJnpuu4L2lvCiBz6HJKFbcZlVBJp7AsT7VOoSkDbqH';
$Field = str_replace(' ', '+', $Field);
$Data = str_replace(' ', '+', $Data);
echo $Field . "<br>\n";
echo fnDecrypt($Field, $ck_KEY, $ck_IV) . "<br>\n";
echo '<br>';
echo $Data . "<br>\n";
echo UrlDecode(fnDecrypt($Data, $ck_KEY, $ck_IV)) . "<br>\n";
?>
<a href="000_allpay_cookie.php?d=c">清除cookie</a>
示例13: tag
/**
*标签.
*
*@param $tag
*@param $orderby
*@param $rownum
*/
public function tag($tag, $orderby = 'orderby', $rownum = '')
{
$tag = UrlDecode($tag);
$this->page_init();
if (isset($this->configs['article_category_page_list_number'])) {
$rownum = $this->configs['article_category_page_list_number'];
} elseif (!empty($rownum)) {
$rownum = $rownum;
} else {
$rownum = 5;
}
if (isset($this->configs['articles_list_orderby'])) {
$orderby = $this->configs['articles_list_orderby'];
} elseif (!empty($orderby)) {
$orderby = $orderby;
} else {
$orderby = 'created';
}
$now = date('Y-m-d H:i:s');
$yestoday = date('Y-m-d H:i:s', strtotime('-1 day'));
$filter = '1=1';
$filter .= " and Article.status = '1' and Article.created <= '" . $now . "' and Article.created >='" . $yestoday . "'";
$today = $this->Article->findall($filter);
$this->set('today', count($today));
$article_id = array();
if (isset($this->configs['use_tag']) && $this->configs['use_tag'] == 1) {
$tags = $this->Tag->findall(" TagI18n.name = '" . $tag . "' and TagI18n.locale = '" . LOCALE . "' and Tag.status ='1'");
if (is_array($tags) && sizeof($tags) > 0) {
foreach ($tags as $k => $v) {
$article_id[] = $v['Tag']['type_id'];
}
}
}
$conditions = array('Article.id' => $article_id, 'Article.status' => '1');
$total = $this->Article->findCount($conditions, 0);
$sortClass = 'Article';
$page = 1;
$parameters = array($orderby, $rownum, $page);
$options = array();
$options = array('page' => $page, 'show' => $rownum, 'modelClass' => 'Article');
$page = $this->Pagination->init($conditions, $parameters, $options);
// Added
if ($article_id != '') {
$article_list = $this->Article->findall($conditions, '', "Article.{$orderby}", "{$rownum}", $page);
foreach ($article_list as $key => $val) {
$article_list[$key]['Article']['created'] = substr($val['Article']['created'], 0, 10);
$article_list[$key]['Article']['modified'] = substr($val['Article']['modified'], 0, 10);
if (isset($this->configs['products_name_length']) && $this->configs['products_name_length'] > 0) {
$article_list[$key]['ArticleI18n']['sub_title'] = $this->Article->sub_str($val['ArticleI18n']['title'], $this->configs['article_title_length']);
}
}
$this->set('article_list', $article_list);
}
$ur_heres = array();
$ur_heres[] = array('name' => $this->ld['home'], 'url' => '/');
$ur_heres[] = array('name' => $tag, 'url' => '/articles/index/hot');
$this->set('ur_heres', $ur_heres);
//排序方式,显示方式,分页数量限制
$this->set('orderby', $orderby);
$this->set('rownum', $rownum);
$this->set('total', $total);
$this->pageTitle = $tag . ' - ' . $this->configs['shop_title'];
//set js 语言
$js_languages = array('page_number_expand_max' => $this->ld['page_number'] . $this->ld['not_exist']);
$this->set('js_languages', $js_languages);
$this->set('meta_description', $tag);
$this->set('meta_keywords', $tag);
}
示例14: search
/**
*搜索.
*
*@param $tag 输入标签
*@param $page 输入页
*@param $orderby 输入类型
*@param $rownum 输入行数
*/
public function search($keyword = '', $page = 1, $limit = 0, $order_field = 0, $order_type = 0, $showtype = 0, $type = 0)
{
$this->set('search_type', 'a');
$this->page_init();
$order_field = UrlDecode($order_field);
$order_type = UrlDecode($order_type);
$limit = UrlDecode($limit);
$showtype = UrlDecode($showtype);
//带冒号的关键字,对GET过来的参数做替代处理
if (isset($_GET['keyword']) && $_GET['keyword'] != '') {
$keyword = $_GET['keyword'];
}
$keyword = UrlDecode($keyword);
$keyword = addslashes($keyword);
//面包屑
$this->ur_heres[] = array('name' => $this->ld['search'], 'url' => '');
$this->ur_heres[] = array('name' => $this->ld['article'], 'url' => '/articles');
$this->ur_heres[] = array('name' => $keyword, 'url' => '');
//seo
$this->set('meta_description', $keyword);
$this->set('meta_keywords', $keyword);
$this->pageTitle = $keyword . ' - ' . $this->configs['shop_title'];
if (empty($limit)) {
$limit = isset($this->configs['products_category_page_size']) ? $this->configs['products_category_page_size'] : (!empty($limit) ? $limit : 20);
}
if (empty($showtype)) {
$showtype = isset($this->configs['products_list_showtype']) ? $this->configs['products_list_showtype'] : (!empty($showtype) ? $showtype : 'L');
}
$order_fields = array('Article.created');
if (!empty($order_field) && in_array($order_field, $order_fields)) {
} else {
$order_field = 'Article.created';
$order_type = 'desc';
}
if ($limit == 'all') {
$limit = 99999;
}
$conditions['AND']['Article.status'] = 1;
if ($type == 'recommend') {
//推荐
}
if ($keyword != '') {
$conditions['OR']['ArticleI18n.title like'] = "%{$keyword}%";
$conditions['OR']['ArticleI18n.meta_description like'] = "%{$keyword}%";
}
if (is_array($keyword) && sizeof($keyword) > 0) {
foreach ($keyword as $k => $v) {
$tag_conditions['and']['or'][]['name like'] = "%{$v}%";
}
}
$tag_conditions['and']['type'] = 'A';
$tag_infos = $this->Tag->find('all', array('conditions' => $tag_conditions, 'fields' => 'Tag.type_id', 'group' => 'Tag.type_id'));
if (!empty($tag_infos)) {
$aids = array();
foreach ($tag_infos as $t) {
$aids[] = $t['Tag']['type_id'];
}
$conditions['OR']['Article.id'] = $aids;
}
$nullcat = array();
$nullcat['CategoryArticleI18n']['name'] = '';
$nullcat['CategoryArticle']['id'] = 0;
$this->set('CategoryArticle', $nullcat);
$this->set('article_categories_direct_subids', $this->CategoryArticle->allinfo['A']['direct_subids']);
//分页start
//get参数
$parameters['get'] = array();
//地址路由参数(和control,action的参数对应)
$parameters['route'] = array('controller' => 'articles', 'action' => 'search', 'page' => $page, 'limit' => $limit, 'order_field' => $order_field, 'order_type' => $order_type, 'showtype' => $showtype, 'type' => $type, 'keyword' => $keyword);
//分页参数
$options = array('page' => $page, 'show' => $limit, 'modelClass' => 'Article');
$page = $this->Pagination->init($conditions, $parameters, $options);
// Added
//分页end
$options = array();
$options['conditions'] = $conditions;
$options['order'] = $order_field . ' ' . $order_type;
$options['limit'] = $limit;
$options['page'] = $page;
$articles = $this->Article->find('all', $options);
//model
$this->set('keyword', $keyword);
// pr($articles);
$this->set('articles', $articles);
}
示例15: request
public function request($url = null, $method = 'POST', $post = array(), $send_cookies = array(), $E = E_USER_WARNING)
{
$fa = func_get_args();
$protocoll = $this->protocoll;
$host = $this->host;
$verb = $this->verb;
$interface = $this->interface;
$endpoint = $this->endpoint;
$post = $this->post;
$send_cookies = $this->send_cookies;
$auth_user = $this->auth_user;
$auth_pass = $this->auth_pass;
$resource = $this->resource;
$format = $this->format;
$func = $this->func;
$args = $this->args;
$get = $this->get;
$version = $this->version;
$E = $this->E;
$method = $verb;
$authentication = strlen($auth_user) ? UrlEncode($auth_user) . ":" . UrlEncode($auth_pass) . "@" : "";
$url = $protocoll . '://' . $host;
$url .= '/';
$url .= 'v' . $version . '/';
$url .= $interface . '/';
$url .= $endpoint . '/';
$url .= $resource . '/';
foreach ($args as $k => $arg) {
$url .= $arg . '/';
}
$url .= $func . '.' . $format;
if (count($get) > 0) {
$url .= '?';
}
$url .= http_build_query($get);
if (count($fa) > 0) {
trigger_error('Use of any arguments when calling ' . __METHOD__ . ' is deprecated. Fallback calling parents method!', E_USER_DEPRECATED);
return parent::request($url, $method, $post, $send_cookies, $E);
}
if (null === $this->http) {
return $this->fallback_auth($url, $method, $post, $auth_user, $auth_pass);
}
$error = $this->http->GetRequestArguments($url, $arguments);
$arguments['RequestMethod'] = $method;
if (count($post) > 0) {
$arguments['PostValues'] = array();
foreach ($post as $key => $value) {
$arguments['PostValues'][$key] = $value;
}
}
$arguments["AuthUser"] = UrlDecode($auth_user);
$arguments["AuthPassword"] = UrlEncode($auth_pass);
$errorstr = '';
$errorstr .= $error == '' ? '' : $error . trigger_error($error . ' in ' . __CLASS__ . ' line ' . __LINE__, $this->E);
$this->http->RestoreCookies($send_cookies, 1);
$error = $this->http->Open($arguments);
$errorstr .= $error == '' ? '' : $error . trigger_error($error . ' in ' . __CLASS__ . ' line ' . __LINE__, $this->E);
$error = $this->http->SendRequest($arguments);
$errorstr .= $error == '' ? '' : $error . trigger_error($error . ' in ' . __CLASS__ . ' line ' . __LINE__, $this->E);
$headers = array();
$error = $this->http->ReadReplyHeaders($headers);
$errorstr .= $error == '' ? '' : $error . trigger_error($error . ' in ' . __CLASS__ . ' line ' . __LINE__, $this->E);
$error = $this->http->ReadWholeReplyBody($responsebody);
$errorstr .= $error == '' ? '' : $error . trigger_error($error . ' in ' . __CLASS__ . ' line ' . __LINE__, $this->E);
if (strlen($error) == 0) {
$this->http->SaveCookies($site_cookies);
if (strlen($error = $this->http->RestoreCookies($site_cookies, 1)) == 0) {
$this->http->SaveCookies($saved_cookies);
if (strcmp(serialize($saved_cookies), serialize($site_cookies))) {
} else {
}
}
}
$this->http->Close();
if ($error != '') {
return $errorstr;
}
$r = array();
$r['status'] = intval($this->http->response_status);
$r['headers'] = $headers;
$r['body'] = $responsebody;
$r['saved_cookies'] = $saved_cookies;
$r['errorstr'] = $errorstr;
$this->response = $r;
return $r;
}