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 ""; }
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; }
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); }
$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;
/** *会员商品管理. * *@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) { if (isset($v) && sizeof($v) > 0) { foreach ($v as $kk => $vv) { if ($vv['ProductRank']['is_default_rank'] == 1) { $product_ranks[$k][$kk]['ProductRank']['discount'] = $user_rank_list[$vv['ProductRank']['rank_id']]['UserRank']['discount'] / 100; } } } } } foreach ($products as $k => $v) { if (isset($productI18ns_list[$v['Product']['id']])) { $products[$k]['ProductI18n'] = $productI18ns_list[$v['Product']['id']]['ProductI18n']; } else { $products[$k]['ProductI18n']['name'] = ''; } if (isset($this->configs['products_name_length']) && $this->configs['products_name_length'] > 0) { $products[$k]['ProductI18n']['sub_name'] = $this->Product->sub_str($products[$k]['ProductI18n']['name'], $this->configs['products_name_length']); } else { $products[$k]['ProductI18n']['sub_name'] = $products[$k]['ProductI18n']['name']; } if (isset($product_ranks[$v['Product']['id']]) && isset($_SESSION['User']['User']['rank']) && isset($product_ranks[$v['Product']['id']][$_SESSION['User']['User']['rank']])) { if (isset($product_ranks[$v['Product']['id']][$_SESSION['User']['User']['rank']]['ProductRank']['is_default_rank']) && $product_ranks[$v['Product']['id']][$_SESSION['User']['User']['rank']]['ProductRank']['is_default_rank'] == 0) { $product_ranks[$k]['Product']['user_price'] = $product_ranks[$v['Product']['id']][$_SESSION['User']['User']['rank']]['ProductRank']['product_price']; } elseif (isset($user_rank_list[$_SESSION['User']['User']['rank']])) { $product_ranks[$k]['Product']['user_price'] = $user_rank_list[$_SESSION['User']['User']['rank']]['UserRank']['discount'] / 100 * $v['Product']['shop_price']; } } if (isset($product_category_lists[$v['Product']['id']])) { $products[$k]['ProductsCategory'] = $product_category_lists[$v['Product']['id']]['ProductsCategory']; $v['ProductsCategory'] = $product_category_lists[$v['Product']['id']]['ProductsCategory']; } if (isset($this->configs['products_name_length']) && $this->configs['products_name_length'] > 0) { $products[$k]['ProductI18n']['name'] = $this->Product->sub_str($products[$k]['ProductI18n']['name'], $this->configs['products_name_length']); } // if(isset($this->configs['mlti_currency_module']) && $this->configs['mlti_currency_module'] == 1 && isset($v['ProductLocalePrice']['product_price'])){ // $products[$k]['Product']['shop_price'] = $v['ProductLocalePrice']['product_price']; // } if (isset($this->configs['mlti_currency_module']) && $this->configs['mlti_currency_module'] == 1 && isset($locale_price_list[$v['Product']['id']]['ProductLocalePrice']['product_price'])) { $products[$k]['Product']['shop_price'] = $locale_price_list[$v['Product']['id']]['ProductLocalePrice']['product_price']; } // $products[$k]['Product']['shop_price'] =$this->Product->locale_price($v['Product']['id'],$v['Product']['shop_price'],$this); if ($this->Product->is_promotion($v)) { $products[$k]['Product']['shop_price'] = $v['Product']['promotion_price']; } if ($this->configs['category_link_type'] == 1) { // $info = $this->CategoryProduct->findbyid($v['Product']['category_id']); if (isset($category_lists[$v['Product']['category_id']])) { $info = $category_lists[$v['Product']['category_id']]; } $products[$k]['use_sku'] = 1; if ($info['CategoryProduct']['parent_id'] > 0) { // $parent_info = $this->CategoryProduct->findbyid($info['CategoryProduct']['parent_id']); if (isset($category_lists[$info['CategoryProduct']['parent_id']])) { $parent_info = $category_lists[$info['CategoryProduct']['parent_id']]; } if (isset($parent_info['CategoryProduct'])) { $parent_info['CategoryProductI18n']['name'] = str_replace(' ', '_', $parent_info['CategoryProductI18n']['name']); $parent_info['CategoryProductI18n']['name'] = str_replace('/', '_', $parent_info['CategoryProductI18n']['name']); $products[$k]['parent'] = $parent_info['CategoryProductI18n']['name']; } } } } 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->ur_heres[] = array('name' => $this->ld['integral_shopping_mall'], 'url' => '/exchanges'); $this->set('ur_heres', $this->ur_heres); $this->data['pages_url_1'] = $this->server_host . $this->webroot . 'exchanges/'; $this->data['pages_url_2'] = '/' . $this->data['orderby'] . '/' . $this->data['rownum'] . '/' . $this->data['showtype']; //排序方式,显示方式,分页数量限制 $this->set('orderby', $orderby); $this->set('rownum', $rownum); $this->set('showtype', $showtype); $this->data['product_ranks'] = $product_ranks; $this->data['products'] = $products; $this->set('products', $products); $this->set('ur_heres', $this->ur_heres); }
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": case "302": case "303": case "307": if ($this->follow_redirect) { if (!isset($headers["location"]) || strlen($headers["location"]) == 0) { return $this->SetError("3 it was received a redirect without location URL"); } $location = $headers["location"]; //echo $location[0]."<br>"; if (strcmp($location[0], "/")) { $location_arguments = parse_url($location); if (!isset($location_arguments["scheme"])) { $location = dirname($this->request_uri) . "/" . $location; } } if (!strcmp($location[0], "/")) { //if(substr($location,0,1)!="/") // $location = $this->protocol . "://" . $this->host_name . ($this->host_port ? ":" . $this->host_port : "") . $location; } //echo $this->protocol."://".$this->host_name.($this->host_port ? ":".$this->host_port : "").$location; $error = $this->GetRequestArguments($location, $arguments); if (strlen($error)) { return $this->SetError("could not process redirect url: " . $error); } $arguments["RequestMethod"] = "GET"; if (strlen($error = $this->Close()) == 0 && strlen($error = $this->Open($arguments)) == 0 && strlen($error = $this->SendRequest($arguments)) == 0) { $this->redirection_level++; if ($this->redirection_level > $this->redirection_limit) { $error = "it was exceeded the limit of request redirections"; } else { $error = $this->ReadReplyHeaders($headers); } $this->redirection_level--; } $pri_cookies = $this->cookies; $_SESSION['cookies'][$this->host_name] = $pri_cookies; if (strlen($error)) { return $this->SetError($error); } } } return ""; }
/** *高级搜索. * *@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) { foreach ($keyword as $k => $v) { $conditions['AND']['OR'][0]['OR'][$k]['Product.code like'] = "%{$v}%"; $conditions['AND']['OR'][1]['OR'][$k]['ProductI18n.name like'] = "%{$v}%"; $conditions['AND']['OR'][2]['OR'][$k]['ProductI18n.meta_keywords like'] = "%{$v}%"; $brand_ids_array = $this->BrandI18n->find('all', array('fields' => array('BrandI18n.brand_id'), 'conditions' => array('BrandI18n.name like' => "%{$v}%"))); if (is_array($brand_ids_array) && isset($brand_ids_array) && !empty($brand_ids_array) && sizeof($brand_ids_array) > 0) { $brand_ids = array(); foreach ($brand_ids_array as $kk => $vv) { $brand_ids[$kk] = $vv['BrandI18n']['brand_id']; } $conditions['AND']['OR'][3]['OR'][$k]['Product.brand_id'] = $brand_ids; } $tag_conditions['and']['OR'][$k]['name like'] = "%{$v}%"; } $tag_in = $this->Tag->find('first'); $tag_conditions = array(); $keywords = array(); if (is_array($keyword)) { foreach ($keyword as $k => $v) { $tag_conditions['and']['or'][$k]['TagI18n.name like'] = "%{$v}%"; } } $tag_conditions['and']['type'] = 'P'; // $tag_conditions['and']['TagI18n.name like'] ="%$keyword%"; $tag_infos = $this->Tag->find('all', array('conditions' => $tag_conditions, 'fields' => 'Tag.type_id', 'group' => 'Tag.type_id')); if (!empty($tag_infos)) { $pids = array(); foreach ($tag_infos as $t) { $pids[] = $t['Tag']['type_id']; } $conditions['AND']['OR'][4]['OR']['Product.id'] = $pids; } } $this->set('keyword', $keyword); } elseif (isset($this->configs['product_search_type']) && $this->configs['product_search_type'] == '1') { //绝对搜索 if (is_array($keyword) && sizeof($keyword) > 0) { foreach ($keyword as $k => $v) { $conditions['AND']['OR'][0]['and'][$k]['Product.code like'] = "%{$v}%"; $conditions['AND']['OR'][1]['and'][$k]['ProductI18n.name like'] = "%{$v}%"; $conditions['AND']['OR'][2]['and'][$k]['ProductI18n.meta_keywords like'] = "%{$v}%"; $brand_ids_array = $this->BrandI18n->find('all', array('fields' => array('BrandI18n.brand_id'), 'conditions' => array('BrandI18n.name like' => "%{$v}%"))); if (is_array($brand_ids_array) && isset($brand_ids_array) && !empty($brand_ids_array) && sizeof($brand_ids_array) > 0) { $brand_ids = array(); foreach ($brand_ids_array as $kk => $vv) { $brand_ids[$kk] = $vv['BrandI18n']['brand_id']; } $conditions['AND']['OR'][3]['and'][$k]['Product.brand_id'] = $brand_ids; } $tag_conditions['and']['OR'][$k]['name'] = $v; } $tag_in = $this->Tag->find('first'); $tag_conditions = array(); $keywords = array(); if (is_array($keyword)) { foreach ($keyword as $k => $v) { $tag_conditions['and']['or'][$k]['TagI18n.name'] = $v; } } // $tag_conditions['and']['or']['type'] ='P'; // $tag_conditions['and']['TagI18n.name like'] ="%$keyword%"; $tag_infos = $this->Tag->find('all', array('conditions' => $tag_conditions, 'fields' => 'Tag.type_id', 'group' => 'Tag.type_id')); if (!empty($tag_infos)) { $pids = array(); foreach ($tag_infos as $t) { $pids[] = $t['Tag']['type_id']; } $conditions['AND']['OR'][4]['Product.id'] = $pids; } } $this->set('keyword', $keyword); } if ($strkeyword == 'All Product') { $this->set('keyword', ''); } else { $this->set('keyword', $strkeyword); } if (isset($keyword) && !empty($keyword)) { $tag_in = $this->Tag->find('first'); $tag_conditions = array(); $keywords = array(); if (is_array($keyword)) { foreach ($keyword as $k => $v) { $tag_conditions['and']['or'][$k]['TagI18n.name like'] = "%{$v}%"; } } $tag_conditions['and']['type'] = 'P'; // $tag_conditions['and']['TagI18n.name like'] ="%$keyword%"; $tag_infos = $this->Tag->find('all', array('conditions' => $tag_conditions, 'fields' => 'Tag.type_id', 'group' => 'Tag.type_id')); if (!empty($tag_infos)) { $pids = array(); foreach ($tag_infos as $t) { $pids[] = $t['Tag']['type_id']; } $conditions['AND']['OR'][4]['Product.id'] = $pids; } } $this->Attribute->set_locale(LOCALE); $public_attr_ids = $this->ProductTypeAttribute->getattrids(0); $attr_id_infos = $this->Attribute->find('list', array('conditions' => array('Attribute.id' => $public_attr_ids), 'fields' => array('Attribute.code', 'Attribute.id'))); $this->set('attr_id_infos', $attr_id_infos); $options = array(); $options['conditions'] = $conditions; $options2 = array(); $options2['conditions'] = $conditions2; //排序的判断 if (isset($this->configs['product_order']) && !empty($this->configs['product_order']) && $this->configs['product_order'] !== 'forsale' && $this->configs['product_order'] !== 'category') { $options['order'] = $this->configs['product_order']; } elseif (isset($this->configs['product_order']) && !empty($this->configs['product_order']) && $this->configs['product_order'] == 'category') { $options['order'] = 'category_id'; } else { $options['order'] = $order_field . ' ' . $order_type; } // $options['order'] =$this->configs['product_order']; $options['limit'] = $limit; $options['page'] = $page; $pro = $this->Product->find_all_products($options); //pr($options); $options['set'] = 'products'; $options2['set2'] = 'products2'; if ($min_price != 0 || $max_price != 0) { $conditions['AND']['Product.shop_price >='] = $min_price; $conditions['AND']['Product.shop_price <='] = $max_price; } //var_dump($pro); //品牌1 if ($brand_id != 0) { $conditions['AND']['Brand.id'] = $brand_id; $this->set('cat_eye', $brand_id); } $options['conditions'] = $conditions; //$options['conditions'] = $conditions; $this->Product->find_all_products($options); //$this->Product->find_all_products($options2); //分页start //get参数 $parameters['get'] = array(); //地址路由参数(和control,action的参数对应) $parameters['route'] = array('controller' => 'products', 'action' => 'advancedsearch', 'keyword' => $strkeyword, 'page' => $page, 'limit' => $limit, 'order_field' => $order_field, 'order_type' => $order_type, 'showtype' => $showtype, 'type' => $type, 'brand_id' => $brand_id, 'min_price' => $min_price, 'max_price' => $max_price); //分页参数 $page_options = array('page' => $page, 'show' => $limit, 'modelClass' => 'Product'); $page = $this->Pagination->init($conditions, $parameters, $page_options); // Added //分页end $this->set('pages_list', $page); //品牌 // foreach($pro as $k=>$v){ // $x=$this->Brand->findbyid($v['Product']['brand_id']); // $brand_array[$v['Product']['brand_id']]= array(); // $brand_array[$v['Product']['brand_id']]['name']=$x['BrandI18n']['name']; // $brand_array[$v['Product']['brand_id']]['cat']=$v['Product']['category_id']; // } //var_dump($brand_array); //$this->set("brand",$brand_array); //$this->set("pro",$pro); $this->set('price_eye', $max_price); //$this->Product->find_all_products($options); //model //$this->set('keyword',$keyword); if (!empty($pro)) { $brand_array = array(); $category_array = array(); $brand_ids = array(); $category_ids = array(); $brand_names = array(); $categories = array(); foreach ($pro as $k => $v) { if (!in_array($v['Product']['brand_id'], $brand_ids)) { $brand_ids[] = $v['Product']['brand_id']; } if (!in_array($v['Product']['category_id'], $category_ids)) { $category_ids[] = $v['Product']['category_id']; } } $brand_array = $this->Brand->find('all', array('fields' => 'Brand.id,BrandI18n.name')); foreach ($brand_array as $b) { $brand_names[$b['Brand']['id']] = $b['BrandI18n']['name']; } if (!empty($category_ids)) { $category_array = $this->CategoryProduct->find('all', array('conditions' => array('CategoryProduct.id' => $category_ids), 'fields' => 'CategoryProduct.id,CategoryProductI18n.name')); foreach ($category_array as $b) { $categories[$b['CategoryProduct']['id']] = $b['CategoryProductI18n']['name']; } } $this->set('brand_names', $brand_names); $this->set('categories', $categories); } $this->layout = 'default_search'; if (isset($_POST['flag']) && $_POST['flag'] == 1) { //执行导出(高级搜索) $limit1 = 99999; $options = array(); $options['conditions'] = $conditions; if ($this->configs['product_order'] == 'category') { $options['order'] = 'category_id'; } else { $options['order'] = $this->configs['product_order']; } $options['limit'] = $limit1; $options['page'] = 1; // $options['set'] = 'products'; $pro1 = $this->Product->find_all_products($options); //搜索结果 $this->Attribute->set_locale(LOCALE); $public_attr_ids = $this->ProductTypeAttribute->getattrids(0); $pubile_attr_info = $this->Attribute->find('all', array('conditions' => array('Attribute.id' => $public_attr_ids), 'fields' => 'Attribute.id,AttributeI18n.name')); $pat = array(); if (!empty($pubile_attr_info)) { foreach ($pubile_attr_info as $k => $p) { $pat[$p['Attribute']['id']] = $p['AttributeI18n']['name']; } } //TODO 改成后台可以定义 列值,属性应用需要判断 $allproduct = array(); Configure::write('debug', 0); $data = array(); $data[] = array('Description', 'Part No.', 'Mfg', 'Qty', 'D/C', 'USD', 'Delivery', 'Notes'); $allproduct = $data; $ii = 0; foreach ($pro1 as $k => $v) { ++$ii; $allproducts = array(); $pab = array(); foreach ($v['ProductAttribute'] as $pa) { if ($pa['attribute_id'] == $attr_id_infos['dc'] && !empty($pa['attribute_value'])) { $pab[$attr_id_infos['dc']] = $pa['attribute_value']; } if ($pa['attribute_id'] == $attr_id_infos['delivery'] && !empty($pa['attribute_value'])) { $pab[$attr_id_infos['delivery']] = $pa['attribute_value']; } if ($pa['attribute_id'] == $attr_id_infos['notes'] && !empty($pa['attribute_value'])) { $pab[$attr_id_infos['notes']] = $pa['attribute_value']; } } $product = $this->ProductI18n->find('first', array('conditions' => array('ProductI18n.product_id ' => $v['Product']['id']), 'recursive' => -1)); $allproducts[] = $product['ProductI18n']['name']; $allproducts[] = $v['Product']['code']; $allproducts[] = isset($brand_names[$v['Product']['brand_id']]) ? $brand_names[$v['Product']['brand_id']] : '-'; //mfg $allproducts[] = $v['Product']['quantity']; $allproducts[] = isset($pab[$attr_id_infos['dc']]) ? $pab[$attr_id_infos['dc']] : '-'; //dc $allproducts[] = isset($v['Product']['custom_price']) && $v['Product']['custom_price'] != '' ? $v['Product']['custom_price'] : $v['Product']['shop_price']; $allproducts[] = isset($pab[$attr_id_infos['delivery']]) ? $pab[$attr_id_infos['delivery']] : '-'; //delivery $allproducts[] = isset($pab[$attr_id_infos['notes']]) ? $pab[$attr_id_infos['notes']] : '-'; //notes $allproduct[] = $allproducts; } $this->Phpexcel->output('products_export_' . date('YmdHis') . '.xls', $allproduct); exit; die; } }
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; } }
<?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' => 'Сервис временно недоступен');
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); }
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); } } } }
<?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>
/** *标签. * *@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); }
/** *搜索. * *@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); }
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; }
/** *函数 user_product_comment 用于获取所购商品的分类信息. * *@param $rownum *@param $showtype *@param $orderby */ public function user_product_comment($rownum = '', $showtype = '', $orderby = '') { $orderby = UrlDecode($orderby); $rownum = UrlDecode($rownum); $showtype = UrlDecode($showtype); //未登录转登录页 if (!isset($_SESSION['User'])) { // echo "111111111111";exit; $this->redirect('/login/'); } $this->page_init(); //当前位置 $this->ur_heres[] = array('name' => __($this->ld['purchased'] . $this->ld['information'], true), 'url' => ''); $this->set('ur_heres', $this->ur_heres); $user_id = $_SESSION['User']['User']['id']; if (empty($rownum)) { $rownum = isset($this->configs['products_list_num']) ? $this->configs['products_list_num'] : (!empty($rownum) ? $rownum : 20); } if (empty($showtype)) { $showtype = isset($this->configs['products_list_showtype']) ? $this->configs['products_list_showtype'] : (!empty($showtype) ? $showtype : 'L'); } 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']); } //取得我的所有订单id $condition = ' user_id=' . $user_id; $my_orders = $this->Order->findAll($condition); $orders_id = array(); foreach ($my_orders as $k => $v) { $orders_id[$k] = $v['Order']['id']; } if (empty($orders_id)) { $orders_id[] = 0; } // pr($orders_id); //取得我购买的商品 $condition = array('OrderProduct.order_id' => $orders_id, " ProductI18n.locale='" . LOCALE . "' "); $total = $this->OrderProduct->find('count', array('conditions' => $condition)); $sortClass = 'OrderProduct'; $page = 1; $parameters = array($rownum, $page); $options = array(); $page = $this->Pagination->init($condition, '', $options, $total, $rownum, $sortClass); // $my_orders_products=$this->OrderProduct->findAll($condition,'',"","$rownum",$page); $my_orders_products = $this->OrderProduct->get_orders_products($condition, $orderby, $rownum, $page); // pr($my_orders_products); if (empty($my_orders_products)) { $my_orders_products = array(); } // pr($my_orders_products); //商品品牌分类 $res_c = $this->CategoryProduct->findassoc(LOCALE); $res_b = $this->Brand->findassoc(LOCALE); $products_ids_list = array(); $orders_ids_list = array(); $orders_ids_list[] = 0; $products_ids_list[] = 0; if (is_array($my_orders_products) && sizeof($my_orders_products) > 0) { foreach ($my_orders_products as $k => $v) { $products_ids_list[] = $v['OrderProduct']['product_id']; $orders_ids_list[] = $v['OrderProduct']['order_id']; } } //products_ids_list if (!empty($products_ids_list)) { $products_comment_conditions = array('Comment.type_id' => $products_ids_list, 'Comment.type' => 'P', 'Comment.user_id' => $_SESSION['User']['User']['id'], 'Comment.parent_id' => 0); $products_comment = $this->Comment->get_products_comment($products_comment_conditions); $my_comments_id[] = 0; if (isset($products_comment) && sizeof($products_comment) > 0) { foreach ($products_comment as $k => $v) { $my_comments_id[] = $v['Comment']['id']; } } $my_comments_replies = $this->Comment->find('all', array('conditions' => array('Comment.parent_id' => $my_comments_id))); $replies_list = array(); if (is_array($my_comments_replies) && sizeof($my_comments_replies) > 0) { foreach ($my_comments_replies as $kk => $vv) { $replies_list[$vv['Comment']['parent_id']][] = $vv; } } $products_comment_list = array(); if (isset($products_comment) && sizeof($products_comment) > 0) { foreach ($products_comment as $k => $v) { if (isset($replies_list[$v['Comment']['id']])) { $products_comment[$k]['Reply'] = $replies_list[$v['Comment']['id']]; } $products_comment_list[$v['Comment']['type_id']][] = $products_comment[$k]; } } } $this->set('products_comment_list', $products_comment_list); $order_ids_conditions = array('Order.id' => $orders_ids_list); $p_order_infos = $this->Order->get_order_infos($order_ids_conditions); $order_lists = array(); if (is_array($p_order_infos) && sizeof($p_order_infos) > 0) { foreach ($p_order_infos as $k => $v) { $order_lists[$v['Order']['id']] = $v; } } $product_category_conditions = array('ProductsCategory.product_id' => $products_ids_list); $product_category_infos = $this->ProductsCategory->get_product_category_infos($product_category_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; } } foreach ($my_orders_products as $k => $v) { //$order_info = $this->Order->findbyid($v['OrderProduct']['order_id']); if (isset($order_lists[$v['OrderProduct']['order_id']])) { $order_info = $order_lists[$v['OrderProduct']['order_id']]; } $my_orders_products[$k]['OrderProduct']['order_code'] = isset($order_info['Order']['id']) ? $order_info['Order']['id'] : ''; if (isset($product_category_lists[$v['Product']['id']])) { $product_category = $product_category_lists[$v['Product']['id']]; } if (isset($product_category) && isset($res_c[$product_category['ProductsCategory']['id']]['Category']['id'])) { $my_orders_products[$k]['Category'] = $res_c[$res_c[$product_category['ProductsCategory']['id']]['Category']['id']]['Category']; $my_orders_products[$k]['CategoryI18n'] = $res_c[$res_c[$product_category['ProductsCategory']['id']]['Category']['id']]['CategoryI18n']; } if (isset($res_b[$v['Product']['brand_id']]['Brand']['id'])) { $my_orders_products[$k]['Brand'] = $res_b[$v['Product']['brand_id']]['Brand']; $my_orders_products[$k]['BrandI18n'] = $res_b[$v['Product']['brand_id']]['BrandI18n']; } if ($v['Product']['id'] == '') { unset($my_orders_products[$k]); } } $this->pageTitle = $this->ld['purchased'] . $this->ld['information'] . ' - ' . $this->configs['shop_title']; //一步购买 if (!empty($this->configs['enable_one_step_buy']) && $this->configs['enable_one_step_buy'] == 1) { $js_languages = array('enable_one_step_buy' => '1', 'page_number_expand_max' => $this->ld['page_number'] . $this->ld['not_exist']); $this->set('js_languages', $js_languages); } else { $js_languages = array('enable_one_step_buy' => '0', 'page_number_expand_max' => $this->ld['page_number'] . $this->ld['not_exist']); $this->set('js_languages', $js_languages); } // pr($my_orders_products); $this->set('my_orders_products', $my_orders_products); $this->set('total', $total); $this->set('user_id', $user_id); //排序方式,显示方式,分页数量限制 $this->set('orderby', $orderby); $this->set('rownum', $rownum); $this->set('showtype', $showtype); }
function ReadReplyHeadersResponse(&$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 "ConnectedToProxy": return $this->SetError("2 connection from the remote server from the proxy was not yet established"); case "SendingRequestBody": return $this->SetError("4 request body data was not completely sent"); case "ConnectSent": $connect = 1; break; case "RequestSent": $connect = 0; 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 = $this->remaining_chunk = 0; $this->content_length_set = $this->chunked = $this->last_chunk_read = $chunked = 0; $this->connection_close = 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 (!preg_match($match = "#^http/[0-9]+\\.[0-9]+[ \t]+([0-9]+)[ \t]*(.*)\$#i", $line, $matches)) { return $this->SetError("3 it was received an unexpected HTTP response status"); } $this->response_status = $matches[1]; $this->response_message = $matches[2]; } if ($line == "") { if (strlen($this->response_status) == 0) { return $this->SetError("3 it was not received HTTP response status"); } $this->state = $connect ? "GotConnectHeaders" : "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; } if (!$connect) { switch ($header_name) { case "content-length": $this->content_length = intval($headers[$header_name]); $this->content_length_set = 1; break; case "transfer-encoding": $encoding = $this->Tokenize($header_value, "; \t"); if (!$this->use_curl && !strcmp($encoding, "chunked")) { $chunked = 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 = 0; while (($name = trim(UrlDecode($this->Tokenize("=")))) != "") { $value = UrlDecode($this->Tokenize(";")); switch ($name) { case "domain": $domain = $value; break; case "path": $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\$#", $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; } } try { $this->SetCookie($cookie_name, $cookie_value, $expires, $path, $domain, $secure, 1); } catch (http_exception $ex) { $this->error = ""; } } } break; case "connection": $this->connection_close = !strcmp(strtolower($header_value), "close"); break; } } } $this->chunked = $chunked; if ($this->content_length_set) { $this->connection_close = 0; } return ""; }
function CategoriesUpdate() { global $_POST, $LangID; $CatID = xtc_db_prepare_input($_POST['catid']); $ParentID = xtc_db_prepare_input($_POST['parentid']); if (isset($ParentID) && isset($CatID)) { // product laden $SQL = "select categories_id, parent_id, date_added, sort_order, categories_image " . "from " . TABLE_CATEGORIES . " where categories_id='" . $CatID . "'"; $count_query = xtc_db_query($SQL); if ($categorie = xtc_db_fetch_array($count_query)) { $exists = 1; $ParentID = $categorie['parent_id']; $Sort = $categorie['sort_order']; $Image = $categorie['categories_image']; } else { $exists = 0; } // Variablen nur ueberschreiben wenn als Parameter vorhanden !!! if (isset($_POST['parentid'])) { $ParentID = xtc_db_prepare_input($_POST['parentid']); } if (isset($_POST['sort'])) { $Sort = xtc_db_prepare_input($_POST['sort']); } if (isset($_POST['image'])) { $Image = xtc_db_prepare_input($_POST['image']); } $sql_data_array = array('categories_id' => $CatID, 'parent_id' => $ParentID, 'sort_order' => $Sort, 'categories_image' => $Image, 'last_modified' => 'now()'); if ($exists == 0) { $mode = 'APPEND'; // set groupaccees $permission_sql = 'show columns from ' . TABLE_CATEGORIES . ' like "group_permission_%"'; $permission_query = xtc_db_query($permission_sql); if (xtc_db_num_rows($permission_query)) { // ist XTC 3.0.4 $permission_array = array(); while ($permissions = xtc_db_fetch_array($permission_query)) { $permission_array = array_merge($permission_array, array($permissions['Field'] => '1')); } $insert_sql_data = array('date_added' => 'now()'); $insert_sql_data = array_merge($insert_sql_data, $permission_array); } else { // XTC bis 3.0.3 $customers_statuses_array = array(array()); $customers_statuses_query = xtc_db_query("select customers_status_id,\n customers_status_name\n from " . TABLE_CUSTOMERS_STATUS . "\n where language_id = '" . $LangID . "' order by\n customers_status_id"); $i = 1; // this is changed from 0 to 1 in cs v1.2 while ($customers_statuses = xtc_db_fetch_array($customers_statuses_query)) { $i = $customers_statuses['customers_status_id']; $customers_statuses_array[$i] = array('id' => $customers_statuses['customers_status_id'], 'text' => $customers_statuses['customers_status_name']); } $group_ids = 'c_all_group,'; for ($i = 0; $n = sizeof($customers_statuses_array), $i < $n; $i++) { $group_ids .= 'c_' . $customers_statuses_array[$i]['id'] . '_group,'; } $insert_sql_data = array('date_added' => 'now()', 'group_ids' => $group_ids); } $sql_data_array = array_merge($sql_data_array, $insert_sql_data); xtc_db_perform(TABLE_CATEGORIES, $sql_data_array); } elseif ($exists == 1) { $mode = 'UPDATE'; xtc_db_perform(TABLE_CATEGORIES, $sql_data_array, 'update', 'categories_id = \'' . xtc_db_input($CatID) . '\''); } //$languages = xtc_get_languages(); $languages_query = xtc_db_query("select languages_id, name, code, image, directory from " . TABLE_LANGUAGES . " order by sort_order"); while ($languages = xtc_db_fetch_array($languages_query)) { $languages_array[] = array('id' => $languages['languages_id'], 'name' => $languages['name'], 'code' => $languages['code'], 'image' => $languages['image'], 'directory' => $languages['directory']); } $languages = $languages_array; for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $language_id = $languages[$i]['id']; // Bestehende Daten laden $SQL = "select categories_id,language_id,categories_name,categories_description,categories_heading_title," . "categories_meta_title,categories_meta_description,categories_meta_keywords"; $desc_query = xtc_db_query($SQL . " from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id='" . $CatID . "' and language_id='" . $language_id . "'"); if ($desc = xtc_db_fetch_array($desc_query)) { $categories_name = $desc['categories_name']; $categories_description = $desc['$categories_description']; $categories_heading_title = $desc['categories_heading_title']; $categories_meta_title = $desc['categories_meta_title']; $categories_meta_description = $desc['categories_meta_description']; $categories_meta_keywords = $desc['categories_meta_keywords']; } // uebergebene Daten einsetzen if (isset($_POST['name'])) { $categories_name = xtc_db_prepare_input(UrlDecode($_POST['name'])); } if (isset($_POST['descr'])) { $categories_description = xtc_db_prepare_input(UrlDecode($_POST['descr'])); } if (isset($_POST['categories_heading_title'])) { $categories_heading_title = xtc_db_prepare_input(UrlDecode($_POST['categories_heading_title'])); } if (isset($_POST['categories_meta_title'])) { $categories_meta_title = xtc_db_prepare_input(UrlDecode($_POST['categories_meta_title'])); } if (isset($_POST['categories_meta_description'])) { $categories_meta_description = xtc_db_prepare_input(UrlDecode($_POST['categories_meta_description'])); } if (isset($_POST['categories_meta_keywords'])) { $categories_meta_keywords = xtc_db_prepare_input(UrlDecode($_POST['categories_meta_keywords'])); } $sql_data_array = array('categories_name' => $categories_name, 'categories_description' => $categories_description, 'categories_heading_title' => $categories_heading_title, 'categories_meta_title' => $categories_meta_title, 'categories_meta_description' => $categories_meta_description, 'categories_meta_keywords' => $categories_meta_keywords); if ($exists == 0) { $insert_sql_data = array('categories_id' => $CatID, 'language_id' => $language_id); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); xtc_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array); } elseif ($exists == 1 and $language_id == $LangID) { // Nur 1 Sprache aktualisieren xtc_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', 'categories_id = \'' . xtc_db_input($CatID) . '\' and language_id = \'' . $language_id . '\''); } } print_xml_status(0, $_POST['action'], 'OK', $mode, '', ''); } else { print_xml_status(99, $_POST['action'], 'PARAMETER ERROR', '', '', ''); } }
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, '='))); $value = trim($this->Tokenize(';')); if (!strcmp($value[0], '"') && !strcmp($value[strlen($value) - 1], '"')) { $value = substr($value, 1, strlen($value) - 2); } $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; } }
/** *函数 user_modifycat 修改分组名称. */ public function user_modifycat($cat_id = '', $new_name = '') { if ($new_name != '') { $is_ajax = 1; } else { $is_ajax = 0; } $no_error = 1; if (isset($_POST['cat_name'])) { $new_name = $_POST['cat_name']; } if (isset($_POST['cat_id'])) { $cat_id = $_POST['cat_id']; } $new_name = UrlDecode($new_name); $cat_info = array('id' => isset($cat_id) ? intval($cat_id) : 0, 'cat_name' => isset($new_name) ? trim($new_name) : ''); if (trim($new_name) == '') { $no_error = 0; $result['msg'] = $this->ld['group'] . $this->ld['apellation'] . $this->ld['can_not_empty']; } if ($no_error) { $this->UserFriendCat->save(array('UserFriendCat' => $cat_info)); $result['msg'] = '' . $this->ld['tips_edit_success'] . ''; } if ($is_ajax == 0) { $this->page_init(); $this->pageTitle = $result['msg']; $flash_url = $this->server_host . $this->user_webroot . 'friends'; $this->flash($result['msg'], $flash_url, 10); } $this->layout = 'ajax'; }