当前位置: 首页>>代码示例>>PHP>>正文


PHP _es函数代码示例

本文整理汇总了PHP中_es函数的典型用法代码示例。如果您正苦于以下问题:PHP _es函数的具体用法?PHP _es怎么用?PHP _es使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了_es函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _get_geo_data_from_db

 /**
  * Get geo info by IP from db
  */
 function _get_geo_data_from_db($cur_ip = "")
 {
     $cur_ip = trim(array_pop(explode(",", preg_replace("/[^0-9\\.,]/i", "", $cur_ip))));
     if (empty($cur_ip)) {
         return false;
     }
     if ($this->_is_ip_to_skip($cur_ip)) {
         return false;
     }
     $STORE_UNKNOWN_IPS = true;
     // Also check if IP is not recognized by our system and skip it
     if ($STORE_UNKNOWN_IPS && db()->query_num_rows("SELECT * FROM " . db('geo_skip_ip') . " WHERE ip = INET_ATON('" . _es($cur_ip) . "')")) {
         return false;
     }
     // Prepare query
     $sql = "SELECT * \n\t\t\tFROM " . db('geo_city_location') . " \n\t\t\tWHERE loc_id = ( \n\t\t\t\tSELECT loc_id FROM " . db('geo_city_blocks') . "\n\t\t\t\tWHERE start_ip <= INET_ATON('" . _es($cur_ip) . "') \n\t\t\t\t\tAND end_ip >= INET_ATON('" . _es($cur_ip) . "') \n\t\t\t\tLIMIT 1 \n\t\t\t)";
     $A = db()->query_fetch($sql);
     if (empty($A)) {
         if ($STORE_UNKNOWN_IPS) {
             db()->query("INSERT INTO " . db('geo_skip_ip') . " (\n\t\t\t\t\t\tip, hits\n\t\t\t\t\t) VALUES (\n\t\t\t\t\t\tINET_ATON('" . _es($cur_ip) . "'), 1\n\t\t\t\t\t) ON DUPLICATE KEY UPDATE hits = hits + 1");
         }
         return false;
     }
     $geo_data = ["country_code" => $A["country"], "country_name" => _country_name($A["country"]), "region_code" => $A["region"], "city_name" => $A["city"], "dma_code" => $A["dma_code"], "area_code" => $A["area_code"], "longitude" => $A["longitude"], "latitude" => $A["latitude"]];
     return $geo_data;
 }
开发者ID:yfix,项目名称:yf,代码行数:29,代码来源:yf_other_common.class.php

示例2: product_details

 function product_details()
 {
     if (!$_GET["id"]) {
         return is_redirect("./?object=shop");
     }
     // Get products from database
     if (is_numeric($_GET["id"])) {
         $add_sql = "id= '" . intval($_GET["id"]);
     } else {
         $add_sql = "url='" . _es($_GET['id']);
     }
     $sql = "SELECT * FROM " . db('shop_products') . " WHERE active='1' AND " . $add_sql . "'";
     $product_info = db()->query_fetch($sql);
     // Required for comments
     module("shop")->_comments_params["object_id"] = $product_info["id"];
     module("shop")->_comments_params["objects_ids"] = $product_info["id"];
     $N = module("shop")->_get_num_comments();
     $N = $N[$product_info["id"]];
     if ($N == "") {
         $N = 0;
     }
     $dirs = sprintf("%06s", $product_info["id"]);
     $dir2 = substr($dirs, -3, 3);
     $dir1 = substr($dirs, -6, 3);
     $mpath = $dir1 . "/" . $dir2 . "/";
     $group_prices = module("shop")->_get_group_prices($product_info["id"]);
     $product_info["_group_price"] = $group_prices[module("shop")->USER_GROUP];
     module("shop")->_product_info = $product_info;
     $atts = module("shop")->_products_get_attributes($product_info["id"]);
     $thumb_path = $product_info["url"] . "_" . $product_info["id"] . "_" . $product_info["image"] . module("shop")->THUMB_SUFFIX . ".jpg";
     $img_path = $product_info["url"] . "_" . $product_info["id"] . "_" . $product_info["image"] . module("shop")->FULL_IMG_SUFFIX . ".jpg";
     if ($product_info["image"] == 0) {
         $image = "";
     } else {
         $image_files = _class('dir')->scan_dir(module("shop")->products_img_dir . $mpath, true, "/" . $product_info["url"] . "_" . $product_info["id"] . ".+?_small\\.jpg" . "/");
         $reg = "/" . $product_info["url"] . "_" . $product_info["id"] . "_(?P<content>[\\d]+)_small\\.jpg/";
         foreach ((array) $image_files as $filepath) {
             preg_match($reg, $filepath, $rezult);
             $i = $rezult["content"];
             if ($i != $product_info["image"]) {
                 $thumb_temp = module("shop")->products_img_webdir . $mpath . $product_info["url"] . "_" . $product_info["id"] . "_" . $i . module("shop")->THUMB_SUFFIX . ".jpg";
                 $img_temp = module("shop")->products_img_webdir . $mpath . $product_info["url"] . "_" . $product_info["id"] . "_" . $i . module("shop")->FULL_IMG_SUFFIX . ".jpg";
                 $replace2 = ["thumb_path" => $thumb_temp, "img_path" => $img_temp, "name" => $product_info["url"]];
                 $image .= tpl()->parse("shop/image_items", $replace2);
             }
         }
     }
     $URL_PRODUCT_ID = module("shop")->_product_id_url($product_info);
     $sql_man = "SELECT * FROM " . db('shop_manufacturers') . " WHERE id = " . $product_info["manufacturer_id"];
     $manufacturer = db()->query_fetch($sql_man);
     if (module("shop")->SHOW_products_similar_by_price == true) {
         $products_similar_by_price = module("shop")->products_similar_by_price($product_info["price"], $product_info["id"]);
     }
     if (module("shop")->products_similar_by_basket == true) {
         $products_similar_by_basket = module("shop")->products_similar_by_basket($product_info["id"]);
     }
     $replace = ["name" => _prepare_html($product_info["name"]), "model" => _prepare_html($product_info["model"]), "desc" => $product_info["description"], "manufacturer" => _prepare_html(module("shop")->_manufacturer[$product_info["manufacturer_id"]]["name"]), "url_manufacturer" => process_url("./?object=shop&action=products_show&id=" . module("shop")->_manufacturer[$product_info["manufacturer_id"]]["url"]), "date" => _format_date($product_info["add_date"], "long"), "price" => module("shop")->_format_price(module("shop")->_product_get_price($product_info)), "currency" => _prepare_html(module("shop")->CURRENCY), "thumb_path" => file_exists(module("shop")->products_img_dir . $mpath . $img_path) ? module("shop")->products_img_webdir . $mpath . $img_path : "", "img_path" => file_exists(module("shop")->products_img_dir . $mpath . $img_path) ? module("shop")->products_img_webdir . $mpath . $img_path : "", "image" => $image, "basket_add_url" => $product_info["external_url"] ? $product_info["external_url"] : process_url("./?object=shop&action=basket_add&id=" . $URL_PRODUCT_ID), "external_url" => intval((bool) $product_info["external_url"]), "back_url" => process_url("./?object=shop"), "show_basket_url" => process_url("./?object=shop&action=basket"), "dynamic_atts" => module("shop")->_get_select_attributes($atts), "cats_block" => module("shop")->_categories_show(), "cat_name" => _prepare_html(module("shop")->_shop_cats[$product_info["cat_id"]]), "cat_url" => process_url("./?object=shop&action=product_details&id=" . module("shop")->_shop_cats_all[$product_info["cat_id"]]['url']), 'comments' => module("shop")->_view_comments(), "N" => $N, "products_similar_by_price" => $products_similar_by_price, "products_similar_by_basket" => $products_similar_by_basket, "product_related" => module("shop")->products_related($product_info["id"])];
     db()->query("UPDATE " . db('shop_products') . " SET viewed = viewed+1 , last_viewed_date = " . time() . "  WHERE " . $add_sql . "'");
     return tpl()->parse("shop/details", $replace);
 }
开发者ID:yfix,项目名称:yf,代码行数:60,代码来源:yf_shop_product_details.class.php

示例3: _is_online

 function _is_online($user_ids, $user_type = null)
 {
     if (is_array($user_ids)) {
     } else {
         $user_ids = (int) $user_ids;
         if ($user_ids < 1) {
             return null;
         }
         $user_ids = (array) $user_ids;
     }
     if (empty($this->_type[$user_type])) {
         $user_type = 'user_id';
     }
     $time = db()->table('users_online')->select('user_id', 'time')->where('user_type', _es($user_type))->where_in($user_id, 'user_ids')->get_deep_array(1);
     $result = [];
     foreach ($user_ids as $user_id) {
         $user_id = (int) $user_id;
         $result[$user_id] = false;
         if (!empty($time[$user_id])) {
             $result[$user_id] = time() - $this->_ONLINE_TTL < $time[$user_id];
         }
     }
     if (count($user_ids) == 1) {
         $result = reset($result);
     }
     return $result;
 }
开发者ID:yfix,项目名称:yf,代码行数:27,代码来源:yf_online_users.class.php

示例4: basket_add

 function basket_add()
 {
     $product = db()->query_fetch("SELECT id FROM " . db('shop_products') . " WHERE active = '1' AND " . (is_numeric($_GET["id"]) ? "id=" . intval($_GET["id"]) : "url='" . _es($_GET['id']) . "'"));
     if (!empty($product)) {
         $_GET['id'] = $product['id'];
     }
     $atts = module('shop')->_products_get_attributes($product["id"]);
     if ($_GET["id"]) {
         $_GET["id"] = intval($_GET["id"]);
         $_POST["quantity"][$_GET["id"]] = 1;
     }
     if (!empty($atts) && empty($_POST["atts"])) {
         module('shop')->_basket_is_processed = true;
         return js_redirect("./?object=shop&action=product_details&id=" . $_GET["id"]);
     }
     if (!empty($_POST["quantity"]) && !module('shop')->_basket_is_processed) {
         foreach ((array) $_POST["quantity"] as $_product_id => $_quantity) {
             $_product_id = intval($_product_id);
             $_old_quantity = (int) module('shop')->_basket_api()->get($_product_id, 'quantity');
             $_quantity = intval($_quantity) + intval($_old_quantity);
             if ($_product_id && $_quantity) {
                 module('shop')->_basket_api()->set($_product_id, ["product_id" => $_product_id, "quantity" => $_quantity, "atts" => $_POST["atts"][$_product_id]]);
             }
         }
         // Prevent double processing
         module('shop')->_basket_is_processed = true;
     }
     return js_redirect("./?object=shop");
 }
开发者ID:yfix,项目名称:yf,代码行数:29,代码来源:yf_shop_basket_add.class.php

示例5: cleanup_vars

 /**
  * Cleanup variables (Delete not translated or missed vars)
  */
 function cleanup_vars()
 {
     // TODO: move out into submodule
     // Find empty translations
     db()->query("DELETE FROM " . db('locale_translate') . " WHERE value=''");
     // Delete non-changed translations
     $Q = db()->query("SELECT * FROM " . db('locale_vars') . " AS v\n\t\t\t\t, " . db('locale_translate') . " AS t \n\t\t\tWHERE t.var_id=v.id \n\t\t\t\tAND (t.value=v.value OR t.value = '')");
     while ($A = db()->fetch_assoc($Q)) {
         // Do delete found records
         db()->query("DELETE FROM " . db('locale_translate') . " \n\t\t\t\tWHERE var_id=" . intval($A["id"]) . " \n\t\t\t\t\tAND locale='" . _es($A["locale"]) . "'");
     }
     // Special for the ignore case case
     if ($this->VARS_IGNORE_CASE) {
         // Delete non-changed translations
         $Q = db()->query("SELECT * FROM " . db('locale_vars') . " AS v\n\t\t\t\t\t, " . db('locale_translate') . " AS t \n\t\t\t\tWHERE t.var_id=v.id \n\t\t\t\t\tAND LOWER(REPLACE(CONVERT(t.value USING utf8), ' ', '_')) \n\t\t\t\t\t\t= LOWER(REPLACE(CONVERT(v.value USING utf8), ' ', '_'))");
         // Delete non-changed translations
         while ($A = db()->fetch_assoc($Q)) {
             db()->query("DELETE FROM " . db('locale_translate') . " \n\t\t\t\t\tWHERE var_id=" . intval($A["id"]) . " \n\t\t\t\t\t\tAND locale='" . _es($A["locale"]) . "'");
         }
         // Delete duplicated records
         $Q = db()->query("SELECT id FROM " . db('locale_vars') . "\n\t\t\t\tGROUP BY LOWER(REPLACE(CONVERT(value USING utf8), ' ', '_')) \n\t\t\t\tHAVING COUNT(*) > 1");
         while ($A = db()->fetch_assoc($Q)) {
             db()->query("DELETE FROM " . db('locale_vars') . " WHERE id=" . intval($A["id"]));
         }
     }
     // Delete translations without parents
     db()->query("DELETE FROM " . db('locale_translate') . " \n\t\t\tWHERE var_id NOT IN( \n\t\t\t\tSELECT id FROM " . db('locale_vars') . " \n\t\t\t)");
     // Delete parents without translations
     db()->query("DELETE FROM " . db('locale_vars') . " \n\t\t\tWHERE id NOT IN( \n\t\t\t\tSELECT var_id FROM " . db('locale_translate') . " \n\t\t\t)");
     // Return user back
     return js_redirect("./?object=" . $_GET["object"] . "&action=show_vars");
 }
开发者ID:yfix,项目名称:yf,代码行数:35,代码来源:yf_locale_editor_cleanup.class.php

示例6: edit

 /**
  */
 function edit()
 {
     $a = db()->get('SELECT * FROM ' . db('blocks') . ' WHERE id=' . intval($_GET['id']) . ' OR name="' . _es($_GET['id']) . '"');
     $_GET['id'] = $a['id'];
     $a['redirect_link'] = url('/@object');
     return form($a)->validate(['name' => 'trim|required|alpha_dash'])->db_update_if_ok('blocks', ['name', 'desc', 'stpl_name', 'method_name', 'active'], 'id=' . $_GET['id'])->on_after_update(function () {
         common()->admin_wall_add(['block updated: ' . $_POST['name'] . '', $id]);
         module('blocks')->_cache_purge();
     })->text('name', 'Block name')->text('desc', 'Block Description')->text('stpl_name', 'Custom template')->text('method_name', 'Custom class method')->active_box()->save_and_back();
 }
开发者ID:yfix,项目名称:yf,代码行数:12,代码来源:yf_blocks.class.php

示例7: _check

 /**
  * Do check if user is banned for some reason
  * 
  * @access	public
  * @param	array	Array of fields to check
  * @param	array	User info (optional)
  * @return
  */
 function _check($input = [], $user_info = [])
 {
     // Default banned status
     $BANNED_STATUS = false;
     // Nothing to check
     if (empty($input) || empty($input["user_id"])) {
         return $BANNED_STATUS;
     }
     // Default user ban fields
     $ban_fields = ["ban_ads" => 0, "ban_reviews" => 0, "ban_images" => 0, "ban_email" => 0, "ban_forum" => 0, "ban_comments" => 0, "ban_blog" => 0, "ban_bad_contact" => 0, "ban_reput" => 0];
     // Start process ban checks
     foreach ((array) $this->BAN_CHECKS as $CUR_CHECKS) {
         // Process input fields
         foreach ((array) $input as $input_name => $input_value) {
             // Switch between active checks
             $WHAT_FOUND = $this->_try_to_find($input_name, $CUR_CHECKS, $input_value);
             if (!$WHAT_FOUND) {
                 continue;
             }
             // Process ban status if found one
             $BANNED_STATUS = true;
             // Try to find ban reasons
             foreach ((array) $ban_fields as $ban_name => $ban_value) {
                 // User already banned for this type
                 if ($ban_value == 1 || empty($CUR_CHECKS[$ban_name])) {
                     continue;
                 }
                 // Else - do ban current type
                 $ban_fields[$ban_name] = 1;
                 $ban_reasons[$input_name] = $WHAT_FOUND;
             }
         }
     }
     // Create SQL query for the user table
     $sql3 = [];
     foreach ((array) $ban_fields as $ban_name => $new_ban_value) {
         // No need to change ban status
         if ($new_ban_value == 0) {
             continue;
         }
         // Check if this ban type is already banned for the current user
         if (!empty($user_info) && $user_info[$ban_name] == $new_ban_value) {
             continue;
         }
         // Do add SQL for the update query
         $sql3[] = " " . _es($ban_name) . "='1' ";
     }
     // Do update user's table (if needed)
     if (!empty($sql3)) {
         $NEW_ADMIN_COMMENTS = "\r\n==============\r\nAuto-banned on " . _format_date(time()) . " (action: " . $_GET["object"] . "->" . $_GET["action"] . "; " . implode(",", $ban_reasons) . ")";
         $sql4 = "UPDATE " . db('user') . " SET \n\t\t\t\t\t" . implode(",", $sql3) . ", \n\t\t\t\t\tadmin_comments = CONCAT(admin_comments, '" . _es($NEW_ADMIN_COMMENTS) . "')\n\t\t\t\tWHERE id=" . intval($input["user_id"]);
         db()->query($sql4);
     }
     return $BANNED_STATUS;
 }
开发者ID:yfix,项目名称:yf,代码行数:63,代码来源:yf_user_ban.class.php

示例8: edit

 /**
  */
 function edit()
 {
     $_GET['id'] = preg_replace('~[^a-z0-9_-]+~ims', '', $_GET['id']);
     $a = db()->query_fetch('SELECT * FROM ' . db('currencies') . ' WHERE id="' . _es($_GET['id']) . '"');
     if (!$a['id']) {
         return _e('No id!');
     }
     $a = $_POST ? $a + $_POST : $a;
     return form($a)->validate(['name' => 'trim|required|alpha-dash'])->db_update_if_ok('currencies', ['name', 'sign', 'active'], 'id="' . _es($a['id']) . '"')->on_after_update(function () {
         cache_del(['currencies']);
         common()->admin_wall_add(['icon updated: ' . $_POST['name'] . '', $a['id']]);
     })->text('name')->text('sign')->active_box()->save_and_back();
 }
开发者ID:yfix,项目名称:yf,代码行数:15,代码来源:yf_manage_currencies.class.php

示例9: edit

 /**
  */
 function edit()
 {
     $_GET['id'] = preg_replace('~[^a-z0-9_-]+~ims', '', $_GET['id']);
     $a = db()->query_fetch('SELECT * FROM ' . db('countries') . ' WHERE code="' . _es($_GET['id']) . '"');
     if (!$a) {
         return _e('Wrong record!');
     }
     $a['id'] = $a['code'];
     $a = $_POST ? $a + $_POST : $a;
     return form($a)->validate(['name' => 'trim|required'])->db_update_if_ok('countries', ['name', 'active'], 'code="' . _es($a['code']) . '"')->on_after_update(function () {
         cache_del(['countries']);
         common()->admin_wall_add(['country updated: ' . $_POST['name'] . '', $a['code']]);
     })->info('code')->text('name')->active_box()->save_and_back();
 }
开发者ID:yfix,项目名称:yf,代码行数:16,代码来源:yf_manage_countries.class.php

示例10: basket_clean

 /**
  * Clean basket contents
  */
 function basket_clean()
 {
     $add_sql = "url='" . _es($_GET['id']);
     $sql = "SELECT * FROM " . db('shop_products') . " WHERE active='1' AND " . $add_sql . "'";
     $product_info = db()->query_fetch($sql);
     $_GET["id"] = $product_info["id"];
     if ($_GET["id"] && isset($basket[$_GET["id"]])) {
         module('shop')->_basket_api()->del($_GET["id"]);
     }
     if (!$_GET["id"] && isset($basket)) {
         module('shop')->_basket_api()->clean();
     }
     return js_redirect($_SERVER["HTTP_REFERER"], false);
 }
开发者ID:yfix,项目名称:yf,代码行数:17,代码来源:yf_shop_basket_clean.class.php

示例11: _update_user_geo_location

 function _update_user_geo_location($user_id = 0, $FORCE_IP = "")
 {
     if (!main()->USE_GEO_IP) {
         return false;
     }
     if (empty($user_id)) {
         return false;
     }
     $user_info = user($user_id);
     if (!empty($user_info)) {
         $user_info["lon"] = floatval($user_info["lon"]);
         $user_info["lat"] = floatval($user_info["lat"]);
     }
     // Do not update if user has already found lon and lat
     if (!empty($user_info["lon"]) && !empty($user_info["lat"])) {
         return false;
     }
     // Get user's last IP he logged in
     $cur_ip = $FORCE_IP;
     if (empty($cur_ip)) {
         list($cur_ip) = db()->query_fetch("SELECT ip AS `0` \n\t\t\t\tFROM " . db('log_auth') . " \n\t\t\t\tWHERE user_id=" . intval($user_id) . " \n\t\t\t\tORDER BY date DESC \n\t\t\t\tLIMIT 1");
     }
     // Get user's register IP
     if (empty($cur_ip)) {
         $cur_ip = $user_info["ip"];
     }
     // Try to get lon, lat and zip_code by IP
     if (!empty($cur_ip)) {
         $geo_data = common()->_get_geo_data_from_db($cur_ip);
         $lon = floatval($geo_data["latitude"]);
         $lat = floatval($geo_data["longitude"]);
         $radius = 3;
         $zip_data = db()->query_fetch("SELECT * FROM " . db('zip_data') . " WHERE (POW((69.1 * (lon - " . floatval($lon) . ") * cos(" . floatval($lat) . " / 57.3)), '2') + POW((69.1 * (lat - " . floatval($lat) . ")), '2')) < (" . floatval($radius) . " * " . floatval($radius) . ") LIMIT 1");
         if (!empty($zip_data)) {
             $zip_code = $zip_data["id"];
         }
         // Try to get lon, lat by zip_code
     } elseif (!empty($user_info["zip_code"])) {
         $zip_data = db()->query_fetch("SELECT * FROM " . db('zip_data') . " WHERE id='" . _es($user_info["zip_code"]) . "'");
         $lon = floatval($zip_data["lon"]);
         $lat = floatval($zip_data["lat"]);
     }
     // Do update user's info
     if (!empty($lon) && !empty($lat)) {
         db()->UPDATE("user", ["lon" => floatval($lon), "lat" => floatval($lat), "zip_code" => _es(empty($user_info["zip_code"]) ? $zip_code : "")], "id=" . intval($user_id));
     }
     // Sync ads lon,lat with users
     db()->query("UPDATE " . db('ads') . " AS a\n\t\t\t\t, " . db('user') . " AS u\n\t\t\tSET a.lon = u.lon\n\t\t\t\t, a.lat = u.lat\n\t\t\tWHERE a.user_id = u.id\n\t\t\t\tAND u.id = " . intval($user_id));
 }
开发者ID:yfix,项目名称:yf,代码行数:49,代码来源:yf_geo_ip.class.php

示例12: autotranslate

 /**
  * Automatic translator via Google translate
  */
 function autotranslate()
 {
     if ($_POST['translate'] && $_POST['locale']) {
         set_time_limit(1800);
         $LOCALE_RES = $_POST['locale'];
         $base_url = 'http://ajax.googleapis.com/ajax/services/language/translate' . '?v=1.0';
         $vars = db()->query_fetch_all("SELECT id,value FROM " . db('locale_vars') . " WHERE id NOT IN( \n\t\t\t\t\tSELECT var_id FROM " . db('locale_translate') . " \n\t\t\t\t\tWHERE locale = '" . $LOCALE_RES . "' AND value != '' \n\t\t\t\t)");
         $_info = [];
         $max_threads = 4;
         $buffer = [];
         $translated = [];
         _debug_log("LOCALE_NUM_VARS: " . count($vars));
         foreach ((array) $vars as $A) {
             $translated = [];
             $url = $base_url . "&q=" . urlencode(str_replace("_", " ", $A["value"])) . "&langpair=en%7C" . $LOCALE_RES;
             $_temp[$url] = $A["id"];
             if (count($buffer) < $max_threads) {
                 $buffer[$url] = $url;
                 continue;
             }
             foreach ((array) common()->multi_request($buffer) as $url => $response) {
                 $response_array = json_decode($response);
                 $response_text = trim($response_array->responseData->translatedText);
                 $ID = $_temp[$url];
                 $source = str_replace("_", " ", $vars[$ID]["value"]);
                 _debug_log("LOCALE: " . ++$j . " ## " . $ID . " ## " . $source . " ## " . $response_text . " ## " . $url);
                 if (_strlen($response_text) && $response_text != $source) {
                     $translated[$ID] = $response_text;
                 }
             }
             if ($translated) {
                 $Q = db()->query("DELETE FROM " . db('locale_translate') . " \n\t\t\t\t\t\tWHERE locale = '" . _es($LOCALE_RES) . "' \n\t\t\t\t\t\t\tAND var_id IN(" . implode(",", array_keys($translated)) . ")");
             }
             foreach ((array) $translated as $_id => $_value) {
                 db()->REPLACE('locale_translate', ['var_id' => intval($_id), 'value' => _es($_value), 'locale' => _es($LOCALE_RES)]);
             }
             $buffer = [];
             $_temp = [];
         }
         cache_del('locale_translate_' . $LOCALE_RES);
         return js_redirect('./?object=' . $_GET['object']);
     }
     $Q = db()->query('SELECT * FROM ' . db('locale_langs') . ' ORDER BY name');
     while ($A = db()->fetch_assoc($Q)) {
         $locales[$A['locale']] = $A['name'];
     }
     $replace = ['locale_box' => common()->select_box('locale', $locales), 'locale_editor_url' => './?object=locale_editor', 'form_action' => './?object=' . $_GET['object'] . '&action=' . $_GET['action']];
     return tpl()->parse($_GET['object'] . '/autotranslate', $replace);
 }
开发者ID:yfix,项目名称:yf,代码行数:52,代码来源:yf_locale_editor_autotranslate.class.php

示例13: _order_view

 /**
  * view orders
  */
 function _order_view()
 {
     if ($_POST["order_id"]) {
         $_GET["id"] = intval($_POST["order_id"]);
     } else {
         $_GET["id"] = intval($_GET["id"]);
     }
     if ($_GET["id"]) {
         $order_info = db()->query_fetch("SELECT * FROM " . db('shop_orders') . " WHERE id=" . intval($_GET["id"]));
     }
     if (empty($order_info)) {
         return _e("No such order");
     }
     if (!empty($_POST["status"])) {
         db()->UPDATE(db('shop_orders'), ["status" => _es($_POST["status"])], "id=" . intval($_GET["id"]));
         return js_redirect("./?object=shop&action=orders");
     }
     $products_ids = [];
     $Q = db()->query("SELECT * FROM " . db('shop_order_items') . " WHERE `order_id`=" . intval($order_info["id"]));
     while ($_info = db()->fetch_assoc($Q)) {
         if ($_info["product_id"]) {
             $products_ids[$_info["product_id"]] = $_info["product_id"];
         }
         $order_items[$_info["product_id"]] = $_info;
     }
     if (!empty($products_ids)) {
         $products_infos = db()->query_fetch_all("SELECT * FROM " . db('shop_products') . " WHERE id IN(" . implode(",", $products_ids) . ") AND active='1'");
         $products_atts = module('shop')->_products_get_attributes($products_ids);
     }
     foreach ((array) $order_items as $_info) {
         $_product = $products_infos[$_info["product_id"]];
         $dynamic_atts = [];
         if (strlen($_info["attributes"]) > 3) {
             foreach ((array) unserialize($_info["attributes"]) as $_attr_id) {
                 $_attr_info = $products_atts[$_info["product_id"]][$_attr_id];
                 $dynamic_atts[$_attr_id] = "- " . $_attr_info["name"] . " " . $_attr_info["value"];
                 $price += $_attr_info["price"];
             }
         }
         $products[$_info["product_id"]] = ["name" => _prepare_html($_product["name"]), "price" => module('shop')->_format_price($_info["sum"]), "currency" => _prepare_html(module('shop')->CURRENCY), "quantity" => intval($_info["quantity"]), "details_link" => process_url("./?object=shop&action=view&id=" . $_product["id"]), "dynamic_atts" => !empty($dynamic_atts) ? implode("\n<br />", $dynamic_atts) : ""];
         $total_price += $_info["price"] * $quantity;
     }
     $total_price = $order_info["total_sum"];
     $replace = my_array_merge($replace, _prepare_html($order_info));
     $replace = my_array_merge($replace, ["form_action" => "./?object=shop&action=" . $_GET["action"] . "&id=" . $_GET["id"], "order_id" => $order_info["id"], "total_sum" => module('shop')->_format_price($order_info["total_sum"]), "user_link" => _profile_link($order_info["user_id"]), "user_name" => _display_name(user($order_info["user_id"])), "error_message" => _e(), "products" => (array) $products, "total_price" => module('shop')->_format_price($total_price), "ship_type" => module('shop')->_ship_type[$order_info["ship_type"]], "pay_type" => module('shop')->_pay_types[$order_info["pay_type"]], "date" => _format_date($order_info["date"], "long"), "status_box" => module('shop')->_statuses[$order_info["status"]], "back_url" => "./?object=shop&action=orders"]);
     return tpl()->parse("shop/order_view", $replace);
 }
开发者ID:yfix,项目名称:yf,代码行数:50,代码来源:yf_shop_order_view.class.php

示例14: save

 /**
  */
 function save()
 {
     $_GET['id'] = intval($_GET['id']);
     $update = ['ad' => _es($_POST['ad']), 'customer' => _es($_POST['customer']), 'date_start' => strtotime($_POST['date_start']['month'] . '/' . $_POST['date_start']['day'] . '/' . $_POST['date_start']['year']), 'date_end' => strtotime($_POST['date_end']['month'] . '/' . $_POST['date_end']['day'] . '/' . $_POST['date_end']['year']), 'html' => !empty($_POST['html']) ? _es($_POST['html']) : '', 'edit_user_id' => $_SESSION['admin_id'], 'edit_date' => time(), 'active' => intval($_POST['active'])];
     //Write update data into DB
     if ($_GET['id']) {
         db()->UPDATE('advertising', $update, 'id=' . intval($_GET['id']));
     } else {
         $update['add_date'] = time();
         db()->INSERT('advertising', $update);
         $max_id = db()->query_fetch_row('SELECT MAX(id) FROM ' . db('advertising'));
     }
     $log = ['ads_id' => $_GET['id'] ? $_GET['id'] : $max_id[0], 'author_id' => $_SESSION['admin_id'], 'date' => time(), 'action' => $_GET['id'] ? 'edit' : 'add'];
     db()->INSERT('log_ads_changes', $log);
     common()->admin_wall_add(['advertising updated: ' . $_GET['id'], $_GET['id']]);
     // Return user back
     return js_redirect('./?object=' . $_GET['object'] . '&action=listing&ad=' . $_POST['ad']);
 }
开发者ID:yfix,项目名称:yf,代码行数:20,代码来源:yf_manage_advertising.class.php

示例15: show

 function show()
 {
     conf('_login_form_displayed', true);
     if (!empty($_POST)) {
         if (empty($_POST['login']) && empty($_POST['email'])) {
             _re('Login or Email required');
         }
         // Check if user with such login exists
         if (!empty($_POST['login'])) {
             $A = db()->query_fetch('SELECT id,name,login,password,email,nick FROM ' . db('user') . ' WHERE login="' . _es($_POST['login']) . '"');
             if (empty($A['id'])) {
                 _re('Login was not found', 'login');
             }
             if (!common()->_error_exists()) {
                 $result = $this->_send_info_to_user($A);
                 if (!$result) {
                     _re('Server mail error');
                 }
             }
             // Check if user with such email exists
         } elseif (!empty($_POST['email'])) {
             $Q = db()->query('SELECT id,name,login,password,email,nick FROM ' . db('user') . ' WHERE email="' . _es($_POST['email']) . '"');
             if (!db()->num_rows($Q)) {
                 _re('Email was not found', 'email');
             }
             // Check if errors exists and send all found accounts
             if (!common()->_error_exists()) {
                 while ($A = db()->fetch_assoc($Q)) {
                     $result = $this->_send_info_to_user($A);
                     if (!$result) {
                         _re('Server mail error');
                     }
                 }
             }
         }
         if (!common()->_error_exists()) {
             $success_msg = t('Password has been sent to your email address. It should arrive in a couple of minutes.');
         }
     }
     $replace = ['form_action' => './?object=' . $_GET['object']];
     $login_form = form($replace, ['legend' => 'Enter your login', 'class' => 'form-vertical'])->validate(['login' => 'trim|required'])->text('login', 'Enter your login')->submit('', 'Get Password', ['class' => 'btn btn-small']);
     $email_form = form($replace, ['legend' => 'Enter your email', 'class' => 'form-vertical'])->validate(['email' => 'trim|required'])->email('email', 'Enter your email')->submit('', 'Get Password', ['class' => 'btn btn-small']);
     return tpl()->parse(__CLASS__ . '/main', ['error' => _e(), 'success' => !empty($success_msg) ? $success_msg : '', 'login_form' => $login_form, 'email_form' => $email_form]);
 }
开发者ID:yfix,项目名称:yf,代码行数:44,代码来源:yf_get_pswd.class.php


注:本文中的_es函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。