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


PHP Cookie::salt方法代码示例

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


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

示例1: before

 public function before()
 {
     parent::before();
     I18n::lang('ru');
     Cookie::$salt = 'eqw67dakbs';
     Session::$default = 'cookie';
     //$this->cache = Cache::instance('file');
     $this->session = Session::instance();
     $this->auth = Auth::instance();
     $this->user = $this->auth->get_user();
     //  $captcha = Captcha::instance();
     // Подключаем стили и скрипты
     $this->template->styles = array();
     $this->template->scripts = array();
     //Вывод в шаблон
     $this->template->title = null;
     $this->template->site_name = null;
     $this->template->description = null;
     $this->template->page_title = null;
     //Подключаем главный шаблон
     $this->template->main = null;
     $this->template->userarea = null;
     $this->template->top_menu = View::factory('v_top_menu');
     $this->template->manufactures = null;
     $this->template->left_categories = null;
     $this->template->slider_banner = null;
     $this->template->block_left = array();
     $this->template->block_center = array();
     $this->template->block_right = array();
     $this->template->block_footer = null;
 }
开发者ID:raku,项目名称:mykohana,代码行数:31,代码来源:base.php

示例2: initialize

 /**
  * 
  * Initializes configs for the APP to run
  */
 public static function initialize()
 {
     /**
      * Load all the configs from DB
      */
     //Change the default cache system, based on your config /config/cache.php
     Cache::$default = Core::config('cache.default');
     //is not loaded yet in Kohana::$config
     Kohana::$config->attach(new ConfigDB(), FALSE);
     //overwrite default Kohana init configs.
     Kohana::$base_url = Core::config('general.base_url');
     //enables friendly url @todo from config
     Kohana::$index_file = FALSE;
     //cookie salt for the app
     Cookie::$salt = Core::config('auth.cookie_salt');
     /* if (empty(Cookie::$salt)) {
     			// @TODO missing cookie salt : add warning message
     		} */
     // -- i18n Configuration and initialization -----------------------------------------
     I18n::initialize(Core::config('i18n.locale'), Core::config('i18n.charset'));
     //Loading the OC Routes
     // if (($init_routes = Kohana::find_file('config','routes')))
     // 	require_once $init_routes[0];//returns array of files but we need only 1 file
     //faster loading
     require_once APPPATH . 'config/routes.php';
     //getting the selected theme, and loading options
     Theme::initialize();
 }
开发者ID:azorpax,项目名称:common,代码行数:32,代码来源:core.php

示例3: provider_get

 /**
  * Provides test data for test_get()
  *
  * @return array
  */
 public function provider_get()
 {
     // setUp is called after the provider so we need to specify a
     // salt here in order to use it in the provider
     Cookie::$salt = $this->_default_salt;
     return array(array('foo', Cookie::salt('foo', 'bar') . '~bar', 'bar'), array('bar', Cookie::salt('foo', 'bar') . '~bar', NULL), array(NULL, Cookie::salt('foo', 'bar') . '~bar', NULL));
 }
开发者ID:lz1988,项目名称:stourwebcms,代码行数:12,代码来源:CookieTest.php

示例4: init

 /**
  * Application initialization
  *     - Loads the plugins
  *     - Sets the cookie configuration
  */
 public static function init()
 {
     // Set defaule cache configuration
     Cache::$default = Kohana::$config->load('site')->get('default_cache');
     try {
         $cache = Cache::instance()->get('dummy' . rand(0, 99));
     } catch (Exception $e) {
         // Use the dummy driver
         Cache::$default = 'dummy';
     }
     // Load the plugins
     Swiftriver_Plugins::load();
     // Add the current default theme to the list of modules
     $theme = Swiftriver::get_setting('site_theme');
     if (isset($theme) and $theme != "default") {
         Kohana::modules(array_merge(array('themes/' . $theme->value => THEMEPATH . $theme->value), Kohana::modules()));
     }
     // Clean up
     unset($active_plugins, $theme);
     // Load the cookie configuration
     $cookie_config = Kohana::$config->load('cookie');
     Cookie::$httponly = TRUE;
     Cookie::$salt = $cookie_config->get('salt', Swiftriver::DEFAULT_COOKIE_SALT);
     Cookie::$domain = $cookie_config->get('domain') or '';
     Cookie::$secure = $cookie_config->get('secure') or FALSE;
     Cookie::$expiration = $cookie_config->get('expiration') or 0;
     // Set the default site locale
     I18n::$lang = Swiftriver::get_setting('site_locale');
 }
开发者ID:aliyubash23,项目名称:SwiftRiver,代码行数:34,代码来源:Swiftriver.php

示例5: initialize

 /**
  * 
  * Initializes configs for the APP to run
  */
 public static function initialize()
 {
     //enables friendly url
     Kohana::$index_file = FALSE;
     //temporary cookie salt in case of exception
     Cookie::$salt = 'cookie_oc_temp';
     //Change the default cache system, based on your config /config/cache.php
     Cache::$default = Core::config('cache.default');
     //loading configs from table config
     //is not loaded yet in Kohana::$config
     Kohana::$config->attach(new ConfigDB(), FALSE);
     //overwrite default Kohana init configs.
     Kohana::$base_url = Core::config('general.base_url');
     //cookie salt for the app
     Cookie::$salt = Core::config('auth.cookie_salt');
     // i18n Configuration and initialization
     I18n::initialize(Core::config('i18n.locale'), Core::config('i18n.charset'));
     //Loading the OC Routes
     require_once APPPATH . 'config/routes.php';
     //getting the selected theme, and loading options
     Theme::initialize();
     //run crontab
     if (core::config('general.cron') == TRUE) {
         Cron::run();
     }
 }
开发者ID:ThomWensink,项目名称:common,代码行数:30,代码来源:core.php

示例6: provider_get

	/**
	 * Provides test data for test_get()
	 *
	 * @return array
	 */
	public function provider_get()
	{
		return array(
			array('foo', Cookie::salt('foo', 'bar').'~bar', 'bar'),
			array('bar', Cookie::salt('foo', 'bar').'~bar', NULL),
			array(NULL, Cookie::salt('foo', 'bar').'~bar', NULL),
		);
	}
开发者ID:nevermlnd,项目名称:cv,代码行数:13,代码来源:CookieTest.php

示例7: set

 public static function set($name, $value, $lifetime = NULL)
 {
     if ($lifetime === NULL) {
         $lifetime = Cookie::$expiration;
     }
     if ($lifetime !== 0) {
         $lifetime += static::_time();
     }
     $value = Cookie::salt($name, $value) . "~" . $value;
     return static::_setcookie($name, $value, $lifetime, Cookie::$path, Cookie::$domain, Cookie::$secure, Cookie::$httponly);
 }
开发者ID:benshez,项目名称:DreamWeddingCeremomies,代码行数:11,代码来源:Cookie.php

示例8: set

 public static function set($name, $value, $expiration = null)
 {
     if ($expiration === null) {
         $expiration = Cookie::$expiration;
     }
     if ($expiration !== 0) {
         $expiration += time();
     }
     $value = Cookie::salt($name, $value) . '~' . $value;
     return setcookie($name, $value, $expiration, Cookie::$path, Cookie::$domain, Cookie::$secure, Cookie::$httponly);
 }
开发者ID:qinyuguang,项目名称:libyaf,代码行数:11,代码来源:Cookie.php

示例9: set

 /**
  * Sets a signed cookie. Note that all cookie values must be strings and no
  * automatic serialization will be performed!
  *
  * @param   string   name of cookie
  * @param   string   value of cookie
  * @param   integer  lifetime in seconds
  * @return  boolean
  */
 public static function set($name, $value, $expiration = NULL)
 {
     if ($expiration === NULL) {
         // Use the default expiration
         $expiration = Cookie::$expiration;
     }
     if ($expiration !== 0) {
         // The expiration is expected to be a UNIX timestamp
         $expiration += time();
     }
     // Add the salt to the cookie value
     $value = Cookie::salt($name, $value) . '~' . $value;
     return setcookie($name, $value, $expiration, Cookie::$path, Cookie::$domain, Cookie::$secure, Cookie::$httponly);
 }
开发者ID:kizz66,项目名称:meat,代码行数:23,代码来源:Cookie.php

示例10: set

 public static function set($name, $value, $lifetime = null, $domain = null)
 {
     if ($lifetime === null) {
         $lifetime = Cookie::$expiration;
     }
     if ($lifetime !== 0) {
         $lifetime += time();
     }
     if ($domain !== null) {
         Cookie::$domain = $domain;
     }
     $value = Cookie::salt($name, $value) . '~' . $value;
     return setcookie($name, $value, $lifetime, Cookie::$path, Cookie::$domain, Cookie::$secure, Cookie::$httponly);
 }
开发者ID:noikiy,项目名称:kohana,代码行数:14,代码来源:Cookie.php

示例11: _create_nginx_cache

 /**
  * Prepares the Kohana_Reponse object for
  * caching to nginx. This requires the object
  * to be flattened to a standard HTTP response
  * including full headers.
  * 
  *     // Creates a full HTTP valid response
  *     $this->_create_nginx_cache($response);
  *
  * @param   Kohana_Response  response 
  * @return  string
  */
 protected function _create_nginx_cache(Kohana_Response $response)
 {
     // Create empty cache buffer
     $cache = '';
     // Generate HTTP header
     foreach ($response->headers as $key => $value) {
         $cache .= "{$key}: {$value}\n";
     }
     // Check for HTTPS and secure cookie setting
     if (empty($_SERVER['HTTPS']) and !Cookie::$secure) {
         // Get the response cookies
         $cookies = $response->get_cookies();
         // Generate cookies
         foreach ($cookies as $name => $value) {
             $cache .= 'Set-Cookie: ' . $name . '=' . Cookie::salt($name, $value['value']) . '~' . $value['value'] . '; expires: ' . gmdate('D, d M Y H:i:s T', $value['expiration']) . '; path: ' . Cookie::$path . '; domain: ' . Cookie::$domain . (Cookie::$httponly ? '; httpOnly' : '') . "\n";
         }
     }
     // Create HTTP body
     $cache .= "\n" . $response->body;
     return $cache;
 }
开发者ID:samsoir,项目名称:vitesse,代码行数:33,代码来源:nginx.php

示例12: before

 public function before()
 {
     parent::before();
     I18n::lang('ru');
     Cookie::$salt = 'eqw67dakbs';
     Session::$default = 'cookie';
     //	$this->cache = Cache::instance('file');
     $this->session = Session::instance();
     $this->auth = Auth::instance();
     $this->user = $this->auth->get_user();
     //Вывод в шаблон
     $this->template->title = '';
     $this->template->page_title = '';
     // Подключаем стили и скрипты
     $this->template->styles = array();
     $this->template->scripts = array();
     //Подключаем блоки
     $this->template->admin_menu = null;
     $this->template->admin_info = null;
     $this->template->block_left = null;
     $this->template->block_center = null;
     $this->template->block_right = null;
 }
开发者ID:raku,项目名称:mykohana,代码行数:23,代码来源:base.php

示例13: set

 /**
  * 设置Cookie
  *
  * @param string $name Cookie名称
  * @param string $value Cookie值
  * @param integer $expiration 过期时间(单位:秒)
  * @return boolean
  * @uses Cookie::salt
  */
 public static function set($key, $value, $expiration = NULL, $path = '/', $domain = null)
 {
     if (headers_sent()) {
         return false;
     }
     if (!self::$config) {
         self::$config = C('cookie');
     }
     if ($value == '') {
         $expiration = TIME - 86400;
     } else {
         if ($expiration === NULL) {
             $expiration = self::$config['expiration'];
         } elseif ($expiration !== 0) {
             $expiration += TIME;
         }
     }
     $_COOKIE[$key] = $value;
     $secure = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 1 : 0;
     // Value加盐
     $value = Cookie::salt($key, $value) . '~' . $value;
     return setcookie(self::$config['prefix'] . $key, base64_encode($value), $expiration, $path, $domain, $secure);
 }
开发者ID:hubs,项目名称:yuncms,代码行数:32,代码来源:Cookie.php

示例14: array

 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 * - boolean  expose      set the X-Powered-By header                        FALSE
 */
if (in_array(@$_SERVER['SERVER_NAME'], array('127.0.0.1', 'fe80::1', '::1', 'localhost', '192.168.2.164', '192.168.0.123'))) {
    $init = array('base_url' => "/tizzy", 'index_file' => "index.php", 'errors' => TRUE, 'profile' => Kohana::$environment === Kohana::DEVELOPMENT);
    Kohana::$environment = Kohana::DEVELOPMENT;
} else {
    $init = array('base_url' => "/", 'index_file' => FALSE, 'errors' => TRUE, 'profile' => Kohana::$environment === Kohana::PRODUCTION);
    Kohana::$environment = Kohana::PRODUCTION;
}
Kohana::init($init);
/**
 * Setting Cookie::$salt
 */
Cookie::$salt = '29961408e9a1bbbf0456dd913a12d31fffa587cc';
/**
 * Attach the file write to logging. Multiple writers are supported.
 */
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Config_File());
/**
 * Enable modules. Modules are referenced by a relative or absolute path.
 */
Kohana::modules(array('auth' => MODPATH . 'auth', 'database' => MODPATH . 'database', 'orm' => MODPATH . 'orm'));
if (Kohana::$environment === Kohana::DEVELOPMENT) {
    Database::$default = 'dev';
} else {
开发者ID:korejwo,项目名称:tizzy,代码行数:31,代码来源:bootstrap.php

示例15: array

 */
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Config_File());
/**
 * Enable modules. Modules are referenced by a relative or absolute path.
 */
Kohana::modules(array('cache' => MODPATH . 'cache', 'database' => MODPATH . 'database', 'image' => MODPATH . 'image', 'orm' => MODPATH . 'orm', 'paypal' => MODPATH . 'paypal', 'kandler' => MODPATH . 'kandler', 'email' => MODPATH . 'email', 'pagination' => MODPATH . 'pagination', 'sitemap' => MODPATH . 'sitemap', 'amazon' => MODPATH . 'amazon'));
/**
 * Cache
 */
Kohana::$caching = TRUE;
Cache::$default = 'apc';
/**
 * Set the routes. Each route must have a minimum of a name, a URI and a set of
 * defaults for the URI.
 */
// Default route
Route::set('default', '(<controller>(/<action>(/<id>)))')->defaults(array('controller' => 'ads', 'action' => 'home'));
// Error route
Route::set('error', 'error/<action>(/<message>)', array('action' => '[0-9]++', 'message' => '.+'))->defaults(array('controller' => 'error_handler'));
/**
 * Cookie configuration settings
 */
Cookie::$salt = 'ASJ12094X:F?!*!*AD';
Cookie::$expiration = Date::MONTH;
Cookie::$httponly = TRUE;
Cookie::$secure = isset($_SERVER["HTTPS"]);
Cookie::$domain = '.gowork.at';
开发者ID:hbarroso,项目名称:Goworkat,代码行数:31,代码来源:bootstrap.php


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