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


PHP Cookie::mylogout方法代码示例

本文整理汇总了PHP中Cookie::mylogout方法的典型用法代码示例。如果您正苦于以下问题:PHP Cookie::mylogout方法的具体用法?PHP Cookie::mylogout怎么用?PHP Cookie::mylogout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cookie的用法示例。


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

示例1: Cookie

$page_name = preg_match('/^[0-9]/', $page_name) ? 'page_' . $page_name : $page_name;
// Init Cookie
$cookie = new Cookie('ps');
// Switch language if needed and init cookie language
if ($iso = Tools::getValue('isolang') and Validate::isLanguageIsoCode($iso) and $id_lang = intval(Language::getIdByIso($iso))) {
    $_GET['id_lang'] = $id_lang;
}
Tools::switchLanguage();
Tools::setCookieLanguage();
/* attribute id_lang is often needed, so we create a constant for performance reasons */
define('_USER_ID_LANG_', intval($cookie->id_lang));
if (isset($_GET['logout']) or $cookie->logged and Customer::isBanned(intval($cookie->id_customer))) {
    $cookie->logout();
    Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);
} elseif (isset($_GET['mylogout'])) {
    $cookie->mylogout();
    Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);
}
$iso = strtolower(Language::getIsoById($cookie->id_lang ? intval($cookie->id_lang) : 1));
@(include _PS_TRANSLATIONS_DIR_ . $iso . '/fields.php');
@(include _PS_TRANSLATIONS_DIR_ . $iso . '/errors.php');
$_MODULES = array();
$currency = Tools::setCurrency();
if (is_numeric($cookie->id_cart)) {
    $cart = new Cart(intval($cookie->id_cart));
    $cart->id_lang = intval($cookie->id_lang);
    if ($cart->OrderExists()) {
        unset($cookie->id_cart, $cart);
    } else {
        if ($cookie->id_customer) {
            $cart->id_customer = intval($cookie->id_customer);
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:31,代码来源:init.php

示例2: init

 public function init()
 {
     global $useSSL, $cookie, $smarty, $cart, $iso, $defaultCountry, $protocol_link, $protocol_content, $link, $css_files, $js_files;
     if (self::$initialized) {
         return;
     }
     self::$initialized = true;
     // If current URL use SSL, set it true (used a lot for module redirect)
     if (Tools::usingSecureMode()) {
         $useSSL = $this->ssl = true;
     }
     $css_files = array();
     $js_files = array();
     if ($this->ssl && !Tools::usingSecureMode() && _PS_SSL_ENABLED_) {
         header('HTTP/1.1 301 Moved Permanently');
         header('Cache-Control: no-cache');
         header('Location: ' . Tools::getShopDomainSsl(true) . $_SERVER['REQUEST_URI']);
         exit;
     } elseif (_PS_SSL_ENABLED_ && Tools::usingSecureMode() && !$this->ssl) {
         header('HTTP/1.1 301 Moved Permanently');
         header('Cache-Control: no-cache');
         header('Location: ' . Tools::getShopDomain(true) . $_SERVER['REQUEST_URI']);
         exit;
     }
     ob_start();
     /* Loading default country */
     $defaultCountry = new Country((int) _PS_COUNTRY_DEFAULT_, (int) _PS_LANG_DEFAULT_);
     $cookie = new Cookie('ps', '', time() + ((int) Configuration::get('PS_COOKIE_LIFETIME_FO') > 0 ? (int) Configuration::get('PS_COOKIE_LIFETIME_FO') : 1) * 3600);
     $link = new Link();
     if ($this->auth && !$cookie->isLogged($this->guestAllowed)) {
         Tools::redirect('authentication.php' . ($this->authRedirection ? '?back=' . $this->authRedirection : ''));
     }
     /* Theme is missing or maintenance */
     if (!file_exists(_PS_THEME_DIR_)) {
         die(Tools::displayError('Current theme unavailable. Please check your theme directory name and permissions.'));
     } elseif (basename($_SERVER['PHP_SELF']) != 'disabled.php' && !(int) Configuration::get('PS_SHOP_ENABLE')) {
         $this->maintenance = true;
     } elseif (_PS_GEOLOCATION_ENABLED_) {
         $this->geolocationManagement();
     }
     // Switch language if needed and init cookie language
     $iso = Tools::getValue('isolang');
     if ($iso && Validate::isLanguageIsoCode($iso)) {
         $id_lang = (int) Language::getIdByIso($iso);
         if ($id_lang) {
             $_GET['id_lang'] = $id_lang;
         }
     }
     Tools::switchLanguage();
     Tools::setCookieLanguage();
     /* attribute id_lang is often needed, so we create a constant for performance reasons */
     if (!defined('_USER_ID_LANG_')) {
         define('_USER_ID_LANG_', (int) $cookie->id_lang);
     }
     if (isset($_GET['logout']) || $cookie->logged && Customer::isBanned((int) $cookie->id_customer)) {
         $cookie->logout();
         Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null);
     } elseif (isset($_GET['mylogout'])) {
         $cookie->mylogout();
         Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null);
     }
     global $currency;
     $currency = Tools::setCurrency();
     /* Cart already exists */
     if ((int) $cookie->id_cart) {
         $cart = new Cart((int) $cookie->id_cart);
         if ($cart->OrderExists()) {
             unset($cookie->id_cart, $cart, $cookie->checkedTOS);
         } elseif (_PS_GEOLOCATION_ENABLED_ && !in_array(strtoupper($cookie->iso_code_country), explode(';', Configuration::get('PS_ALLOWED_COUNTRIES'))) && $cart->nbProducts() && (int) Configuration::get('PS_GEOLOCATION_NA_BEHAVIOR') != -1 && !self::isInWhitelistForGeolocation()) {
             unset($cookie->id_cart, $cart);
         } elseif ($cookie->id_customer != $cart->id_customer || $cookie->id_lang != $cart->id_lang || $cookie->id_currency != $cart->id_currency) {
             if ($cookie->id_customer) {
                 $cart->id_customer = (int) $cookie->id_customer;
             }
             $cart->id_lang = (int) $cookie->id_lang;
             $cart->id_currency = (int) $cookie->id_currency;
             $cart->update();
         }
         /* Select an address if not set */
         if (isset($cart) && (!isset($cart->id_address_delivery) || $cart->id_address_delivery == 0 || !isset($cart->id_address_invoice) || $cart->id_address_invoice == 0) && $cookie->id_customer) {
             $to_update = false;
             if (!isset($cart->id_address_delivery) || $cart->id_address_delivery == 0) {
                 $to_update = true;
                 $cart->id_address_delivery = (int) Address::getFirstCustomerAddressId($cart->id_customer);
             }
             if (!isset($cart->id_address_invoice) || $cart->id_address_invoice == 0) {
                 $to_update = true;
                 $cart->id_address_invoice = (int) Address::getFirstCustomerAddressId($cart->id_customer);
             }
             if ($to_update) {
                 $cart->update();
             }
         }
     }
     if (!isset($cart) || !$cart->id) {
         $cart = new Cart();
         $cart->id_lang = (int) $cookie->id_lang;
         $cart->id_currency = (int) $cookie->id_currency;
         $cart->id_guest = (int) $cookie->id_guest;
         if ($cookie->id_customer) {
//.........这里部分代码省略.........
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:101,代码来源:FrontController.php

示例3: init

 public function init()
 {
     global $cookie, $smarty, $cart, $iso, $defaultCountry, $protocol_link, $protocol_content, $link, $css_files, $js_files;
     if (self::$initialized) {
         return;
     }
     self::$initialized = true;
     $css_files = array();
     $js_files = array();
     if ($this->ssl and (empty($_SERVER['HTTPS']) or strtolower($_SERVER['HTTPS']) == 'off') and Configuration::get('PS_SSL_ENABLED')) {
         header('HTTP/1.1 301 Moved Permanently');
         header('Location: ' . Tools::getShopDomainSsl(true) . $_SERVER['REQUEST_URI']);
         exit;
     }
     ob_start();
     /* Loading default country */
     $defaultCountry = new Country((int) Configuration::get('PS_COUNTRY_DEFAULT'), Configuration::get('PS_LANG_DEFAULT'));
     $cookie = new Cookie('ps');
     $link = new Link();
     if ($this->auth and !$cookie->isLogged($this->guestAllowed)) {
         Tools::redirect('authentication.php' . ($this->authRedirection ? '?back=' . $this->authRedirection : ''));
     }
     /* Theme is missing or maintenance */
     if (!is_dir(_PS_THEME_DIR_)) {
         die(Tools::displayError('Current theme unavailable. Please check your theme directory name and permissions.'));
     } elseif (basename($_SERVER['PHP_SELF']) != 'disabled.php' and !(int) Configuration::get('PS_SHOP_ENABLE')) {
         $this->maintenance = true;
     } elseif (Configuration::get('PS_GEOLOCATION_ENABLED')) {
         if (!isset($cookie->iso_code_country)) {
             if ($cookie->logged) {
                 $id_country = Customer::getCurrentCountry((int) $cookie->id_customer);
                 $cookie->iso_code_country = Country::getIsoById($id_country);
             } else {
                 $this->geolocationManagement();
             }
         }
         if (!isset($cookie->iso_code_country)) {
             $current_country_id = Customer::getCurrentCountry((int) $cookie->id_customer);
         } else {
             $current_country_id = Country::getByIso($cookie->iso_code_country);
         }
         $current_country = new Country($current_country_id, 1);
         $cookie->id_country = $current_country->id;
         $smarty->assign('current_country', $current_country->name);
         $smarty->assign('current_country_id', $current_country->id);
         if ($cookie->id_country == 110 && !isset($cookie->id_currency)) {
             $cookie->id_currency = 4;
         }
     }
     //set imagesize if not set
     if (!isset($cookie->image_size)) {
         $cookie->image_size = IMAGE_SIZE_LARGE;
         $cookie->write();
     }
     if (!isset($cookie->greetings) && !$cookie->logged) {
         $cookie->greetings = 1;
         $cookie->write();
         $smarty->assign('show_greetings', 1);
     }
     //echo $cookie->image_size;
     if ($image_size = Tools::getValue("is")) {
         if ($image_size == "s" && $cookie->image_size == IMAGE_SIZE_LARGE) {
             $cookie->image_size = IMAGE_SIZE_SMALL;
             $cookie->write();
         } else {
             if ($image_size == "l" && $cookie->image_size == IMAGE_SIZE_SMALL) {
                 $cookie->image_size = IMAGE_SIZE_LARGE;
                 $cookie->write();
             }
         }
     }
     // Switch language if needed and init cookie language
     if ($iso = Tools::getValue('isolang') and Validate::isLanguageIsoCode($iso) and $id_lang = (int) Language::getIdByIso($iso)) {
         $_GET['id_lang'] = $id_lang;
     }
     Tools::switchLanguage();
     Tools::setCookieLanguage();
     /* attribute id_lang is often needed, so we create a constant for performance reasons */
     if (!defined('_USER_ID_LANG_')) {
         define('_USER_ID_LANG_', (int) $cookie->id_lang);
     }
     if (isset($_GET['logout']) or $cookie->logged and Customer::isBanned((int) $cookie->id_customer)) {
         $cookie->logout();
         Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);
     } elseif (isset($_GET['mylogout'])) {
         $this->logoutFacebook();
         $cookie->mylogout();
         Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);
     }
     if ($source = Tools::getValue('utm_source')) {
         $cookie->last_source = $source;
         $cookie->write();
     }
     if ($ref_source = Tools::getValue('vbref')) {
         $cookie->last_ref_source = $ref_source;
         $cookie->write();
     }
     /*else 
     		{
     			if(!isset($cookie->last_ref_source))
//.........这里部分代码省略.........
开发者ID:priyankajsr19,项目名称:shalu,代码行数:101,代码来源:FrontController.php

示例4: init

 public function init()
 {
     global $cookie, $smarty, $iso, $defaultCountry, $protocol_link, $protocol_content, $css_files, $js_files;
     if (self::$initialized) {
         return;
     }
     self::$initialized = true;
     $css_files = array();
     $js_files = array();
     ob_start();
     /* Loading default country */
     $cookieLifetime = time() + ((int) Configuration::get('TAS_COOKIE_LIFETIME_FO') > 0 ? (int) Configuration::get('TAS_COOKIE_LIFETIME_FO') : 1) * 3600;
     $cookie = new Cookie('tas', '', $cookieLifetime);
     //var_dump($cookie);
     if ($this->php_self != "login.php") {
         // If calling url is not login.php then check user is logged
         if ($this->auth and !$cookie->isLogged(false)) {
             //echo "test";die;
             $this->authRedirection = urlencode($_SERVER['REQUEST_URI']);
             Tools::redirect('login.php' . ($this->authRedirection ? '?back=' . $this->authRedirection : ''));
         }
     }
     /* Theme is missing or maintenance */
     if (!is_dir(_TAS_THEME_DIR_)) {
         die(Tools::displayError('Current theme unavailable. Please check your theme directory name and permissions.'));
     }
     Tools::setCookieLanguage();
     /* attribute LanguageID is often needed, so we create a constant for performance reasons */
     if (!defined('_USER_ID_LANG_')) {
         define('_USER_ID_LANG_', (int) $cookie->LanguageID);
     }
     if (isset($_GET['logout']) or $cookie->logged and Member::isBanned((int) $cookie->UserID)) {
         $cookie->logout();
         Tools::redirect("index.php");
     } elseif (isset($_GET['mylogout'])) {
         $cookie->mylogout();
         Tools::redirect("index.php");
     }
     if (Validate::isLoadedObject($tas_language = new Language((int) $cookie->LanguageID))) {
         $smarty->tas_language = $tas_language;
     }
     $iso = $tas_language->LanguageShortName;
     /* get page name to display it in body id */
     $page_name = isset($this->php_self) ? preg_replace('/\\.php$/', '', $this->php_self) : '';
     $smarty->assign(Tools::getMetaTags($cookie->LanguageID, $page_name));
     $smarty->assign('request_uri', Tools::safeOutput(urldecode($_SERVER['REQUEST_URI'])));
     $protocol_link = 'http://';
     $protocol_content = 'http://';
     $smarty->assign(array('cookie' => $cookie, 'page_name' => $page_name, 'base_dir' => __TAS_BASE_URI__, 'tpl_dir' => _TAS_THEME_DIR_, 'lang_iso' => $iso, 'come_from' => Tools::getHttpHost(true, true) . Tools::htmlentitiesUTF8(str_replace('\'', '', urldecode($_SERVER['REQUEST_URI']))), 'languages' => Tools::getLanguages(), 'sl_lang' => $cookie->LanguageID, 'shop_name' => 'TAS'));
     // Deprecated
     $smarty->assign(array('logged' => $cookie->isLogged(), 'userName' => $cookie->logged ? $cookie->LoginUserName : false));
     // TODO for better performances (cache usage), remove these assign and use a smarty function to get the right media server in relation to the full ressource name
     $assignArray = array('img_dir' => _THEME_IMG_DIR_, 'css_dir' => _THEME_CSS_DIR_, 'js_dir' => _THEME_JS_DIR_);
     foreach ($assignArray as $assignKey => $assignValue) {
         $smarty->assign($assignKey, $assignValue);
     }
     // setting properties from global var
     self::$cookie = $cookie;
     self::$smarty = $smarty;
     $this->iso = $iso == "" ? "en" : $iso;
     $this->setMedia();
 }
开发者ID:khuyennd,项目名称:dev-tasagent,代码行数:62,代码来源:FrontController.php


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