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


PHP js_redirect函数代码示例

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


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

示例1: 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

示例2: get_user_info

 /**
  */
 function get_user_info()
 {
     $access_token = $this->_storage_get('access_token');
     if (!$access_token) {
         $access_token = $this->get_access_token();
         if (!$access_token) {
             $this->_storage_clean();
             js_redirect($this->redirect_uri, $url_rewrite = false);
             return false;
         }
     }
     if (!$this->_storage_get('user')) {
         $access_token_request = $this->_storage_get('access_token_request');
         $user_id = $access_token_request['result']['user_id'];
         $url = $this->url_user . '?' . http_build_query($this->url_params + ['access_token' => $access_token, 'user_id' => $user_id]);
         $result = common()->get_remote_page($url, $cache = false, $opts, $response);
         $result = $this->_decode_result($result, $response);
         if (isset($result['error']) || substr($response['http_code'], 0, 1) == '4') {
             $this->_storage_clean();
             js_redirect($this->redirect_uri, $url_rewrite = false);
             return false;
         } else {
             $this->_storage_set('user_info_request', ['result' => $result, 'response' => $response]);
             $this->_storage_set('user', $result);
         }
     }
     return $this->_storage_get('user');
 }
开发者ID:yfix,项目名称:yf,代码行数:30,代码来源:yf_oauth_driver_vk.class.php

示例3: find

 public function find($email)
 {
     $data = array('EMAIL' => rawurldecode($email));
     $return_content = http_post_data("http://itandroidbalance.miyigame.com/getbaseurl2.php", json_encode(array('email' => $email, 'platform' => 'xiaomi')));
     $return = json_decode($return_content, true);
     $baseurl = $return["baseurl"];
     $db_group_var = "db1";
     if ($baseurl == "itofdp4.miyigame.com:40002") {
         $db_group_var = "db1";
     } elseif ($baseurl == "itofdp5.miyigame.com:40003") {
         $db_group_var = "db2";
     } elseif ($baseurl == "itofdp6.miyigame.com:40004") {
         $db_group_var = "db3";
     }
     $this->session->set_tempdata('db_group', $db_group_var, 600);
     $this->load->model(array('User_data', 'Character_data', 'Skill_data', 'Treasure_data', 'Game_data', 'Item_data', 'Shop_data', 'Message_data'));
     $userRows = $this->User_data->selectUser($data);
     if (count($userRows) == 0) {
         js_alert_back('Empty no data.');
     } else {
         if (count($userRows) == 1) {
             js_redirect(site_url(array('user', 'view', $userRows[0]['USER_ID'])));
         } else {
             $data['USER_ROWS'] = $userRows;
             $this->viewer->all('user/find', $data);
         }
     }
 }
开发者ID:letmefly,项目名称:tools_script,代码行数:28,代码来源:user.php

示例4: editSubmit

 function editSubmit($p)
 {
     $f = UserDataField::get($p['id']);
     $f->name = $p['name'];
     $f->label = $p['label'];
     $f->type = $p['type'];
     $f->id = $f->store();
     switch ($f->type) {
         case UserDataField::RADIO:
             for ($i = 1; $i < 6; $i++) {
                 if (!empty($p['opt_' . $i])) {
                     UserDataFieldOption::set($f->id, 'opt_' . $i, $p['opt_' . $i]);
                 }
             }
             break;
         case UserDataField::AVATAR:
             for ($i = 1; $i < 6; $i++) {
                 if (!empty($p['avatar_' . $i])) {
                     if ($p['avatar_' . $i]['error'] == UPLOAD_ERR_NO_FILE) {
                         continue;
                     }
                     $fileId = File::importImage(SITE, $p['avatar_' . $i]);
                     UserDataFieldOption::set($f->id, 'avatar_' . $i, $fileId);
                 }
             }
             break;
     }
     js_redirect('a/userdata/list');
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:29,代码来源:userdata.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: get_user_info

 /**
  */
 function get_user_info()
 {
     $access_token = $this->_storage_get('access_token');
     if (!$access_token) {
         $access_token = $this->get_access_token();
         if (!$access_token) {
             $this->_storage_clean();
             js_redirect($this->redirect_uri, $url_rewrite = false);
             return false;
         }
     }
     if (!$this->_storage_get('user')) {
         $url = $this->url_user . '?' . http_build_query(['oauth2_access_token' => $access_token]);
         $opts['custom_header'][] = 'x-li-format: json';
         $result = common()->get_remote_page($url, $cache = false, $opts, $response);
         $result = $this->_decode_result($result, $response, __FUNCTION__);
         if (isset($result['error']) || substr($response['http_code'], 0, 1) == '4') {
             $this->_storage_clean();
             js_redirect($this->redirect_uri, $url_rewrite = false);
             return false;
         } else {
             $this->_storage_set('user_info_request', ['result' => $result, 'response' => $response]);
             $this->_storage_set('user', $result);
         }
     }
     return $this->_storage_get('user');
 }
开发者ID:yfix,项目名称:yf,代码行数:29,代码来源:yf_oauth_driver_linkedin.class.php

示例7: createHandler

 function createHandler($p)
 {
     $o = new ChatRoom();
     $o->name = trim($p['name']);
     $o->id = $o->store();
     js_redirect('a/chatroom/list');
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:7,代码来源:chatroom.php

示例8: _order_step_do_payment

 /**
  * Order step
  */
 function _order_step_do_payment($FORCE_DISPLAY_FORM = false)
 {
     $basket_contents = module('shop')->_basket_api()->get_all();
     if (module('shop')->FORCE_PAY_METHOD) {
         $_POST["pay_type"] = module('shop')->FORCE_PAY_METHOD;
     }
     // Show previous form if needed
     if (common()->_error_exists() || empty($_POST)) {
         return module('shop')->_order_step_select_payment();
     }
     $ORDER_ID = intval($_POST["order_id"] ? $_POST["order_id"] : module('shop')->_CUR_ORDER_ID);
     if (empty($ORDER_ID)) {
         _re("Missing order ID");
     }
     // Get order info
     $order_info = db()->query_fetch("SELECT * FROM " . db('shop_orders') . " WHERE id=" . intval($ORDER_ID) . " AND user_id=" . intval(main()->USER_ID) . " AND status='pending'");
     if (empty($order_info["id"])) {
         _re("Missing order record");
     }
     // Payment by courier, skip next step
     if (!common()->_error_exists() && $_POST["pay_type"] == 1 or $_POST["pay_type"] == 3 or $_POST["pay_type"] == 4) {
         module('shop')->_basket_api()->clean();
         return js_redirect("./?object=shop&action=" . $_GET["action"] . "&id=finish&page=" . intval($ORDER_ID));
     }
     // Authorize.net payment type
     if ($_POST["pay_type"] == 2) {
         module('shop')->_basket_api()->clean();
         return module('shop')->_order_pay_authorize_net($order_info);
     }
 }
开发者ID:yfix,项目名称:yf,代码行数:33,代码来源:yf_shop__order_step_do_payment.class.php

示例9: get_user_info

 /**
  */
 function get_user_info()
 {
     $access_token = $this->_storage_get('access_token');
     if (!$access_token) {
         $access_token = $this->get_access_token();
         if (!$access_token) {
             $this->_storage_clean();
             js_redirect($this->redirect_uri, $url_rewrite = false);
             return false;
         }
     }
     if (!$this->_storage_get('user')) {
         $method = 'users.getInfo';
         $sign = md5('app_id=' . $this->client_id . 'method=' . $method . 'secure=1' . 'session_key=' . $access_token . $this->client_public);
         $url = $this->url_user . '?' . http_build_query(['session_key' => $access_token, 'secure' => 1, 'app_id' => $this->client_id, 'method' => $method, 'sig' => $sign]);
         $result = common()->get_remote_page($url, $cache = false, $opts, $response);
         $result = $this->_decode_result($result, $response, __FUNCTION__);
         if (isset($result['error']) || substr($response['http_code'], 0, 1) == '4') {
             $this->_storage_clean();
             js_redirect($this->redirect_uri, $url_rewrite = false);
             return false;
         } else {
             $this->_storage_set('user_info_request', ['result' => $result, 'response' => $response]);
             $this->_storage_set('user', $result);
         }
     }
     return $this->_storage_get('user');
 }
开发者ID:yfix,项目名称:yf,代码行数:30,代码来源:yf_oauth_driver_mailru.class.php

示例10: get_user_info

 /**
  */
 function get_user_info()
 {
     $access_token = $this->_storage_get('access_token');
     if (!$access_token) {
         $access_token = $this->get_access_token();
         if (!$access_token) {
             $this->_storage_clean();
             js_redirect($this->redirect_uri, $url_rewrite = false);
             return false;
         }
     }
     if (!$this->_storage_get('user')) {
         $url = $this->url_user . '?' . http_build_query(['access_token' => $access_token]);
         $result = common()->get_remote_page($url, $cache = false, $opts, $response);
         $result = $this->_decode_result($result, $response, __FUNCTION__);
         if (isset($result['error']) || substr($response['http_code'], 0, 1) == '4') {
             $this->_storage_clean();
             js_redirect($this->redirect_uri, $url_rewrite = false);
             return false;
         } else {
             $this->_storage_set('user_info_request', ['result' => $result, 'response' => $response]);
             $user = $result;
             // Emails
             $url_emails = $this->url_user_emails . '?' . http_build_query(['access_token' => $access_token]);
             $result = common()->get_remote_page($url_emails, $cache = false, $opts = [], $response);
             $result = $this->_decode_result($result, $response, __FUNCTION__);
             $user['emails'] = $result;
             $this->_storage_set('user', $user);
         }
     }
     return $this->_storage_get('user');
 }
开发者ID:yfix,项目名称:yf,代码行数:34,代码来源:yf_oauth_driver_github.class.php

示例11: category_mapping_delete

 /**
  */
 function category_mapping_delete()
 {
     $SUPPLIER_ID = module('manage_shop')->SUPPLIER_ID;
     $a = db()->get('SELECT * FROM ' . db('shop_suppliers_cat_aliases') . ' WHERE supplier_id=' . (int) $SUPPLIER_ID . ' AND cat_id=' . (int) $_GET['id']);
     if (!$a) {
         return _e('No such record');
     }
     db()->query('DELETE FROM ' . db('shop_suppliers_cat_aliases') . ' WHERE supplier_id=' . (int) $SUPPLIER_ID . ' AND cat_id=' . (int) $_GET['id'] . ' LIMIT 1');
     return js_redirect('./?object=' . main()->_get('object') . '&action=category_mapping');
 }
开发者ID:yfix,项目名称:yf,代码行数:12,代码来源:yf_manage_shop_category_mapping.class.php

示例12: checkLevelRedirect

 public function checkLevelRedirect($level)
 {
     if (!$this->CI->session->userdata('LEVEL')) {
         js_redirect(site_url(array('manager', 'login')));
     } else {
         if ($this->CI->session->userdata('LEVEL') < $level) {
             js_alert_back('Permission error!');
         }
     }
 }
开发者ID:letmefly,项目名称:tools_script,代码行数:10,代码来源:Auth.php

示例13: editHandler

 function editHandler($p)
 {
     $session = SessionHandler::getInstance();
     $o = FaqItem::get($p['id']);
     $o->question = $p['q'];
     $o->answer = $p['a'];
     $o->creator = $session->id;
     $o->time_created = sql_datetime(time());
     $o->store();
     js_redirect('a/faq');
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:11,代码来源:faq.php

示例14: add

 /**
  */
 function add()
 {
     $a = [];
     $a['back_link'] = url('/@object');
     !$a['locale'] && ($a['locale'] = conf('language'));
     $_this = $this;
     return form((array) $_POST + (array) $a)->validate(['__before__' => 'trim', 'name' => 'required', 'text' => 'required', 'locale' => 'required'])->insert_if_ok(self::table, ['name', 'text', 'active', 'locale'])->on_after_update(function () use($_this) {
         $id = db()->insert_id();
         module_safe('manage_revisions')->add($_this::table, $id, 'add');
         js_redirect(url('/@object/edit/' . $id));
     })->text('name')->textarea('text', ['id' => 'text', 'cols' => 200, 'rows' => 10, 'ckeditor' => ['config' => _class('admin_methods')->_get_cke_config()]])->locale_box('locale')->active_box()->save_and_back();
 }
开发者ID:yfix,项目名称:yf,代码行数:14,代码来源:yf_manage_tips.class.php

示例15: createHandler

 function createHandler($p)
 {
     $session = SessionHandler::getInstance();
     $o = new BlogEntry();
     $o->owner = $session->id;
     $o->subject = trim($p['subject']);
     $o->body = trim($p['body']);
     $o->time_created = sql_datetime(time());
     $o->time_published = sql_datetime(time());
     $o->id = $o->store();
     js_redirect('a/blogs/overview');
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:12,代码来源:blogs.php


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