Skip to content

Instantly share code, notes, and snippets.

@zenwerk
Last active December 12, 2015 10:48
Show Gist options
  • Save zenwerk/4761423 to your computer and use it in GitHub Desktop.
Save zenwerk/4761423 to your computer and use it in GitHub Desktop.
<?php
/**
* read a cookie
*
* @access private
* @return void
*/
protected function _get_cookie()
{
// was the cookie posted?
$cookie = \Input::post($this->config['post_cookie_name'], false);
// if not found, fetch the regular cookie
if ($cookie === false)
{
$cookie = \Cookie::get($this->config['cookie_name'], false);
}
// Auth::checkが動かなかったのでコメントアウト
// if ($cookie !== false)
// {
// // fetch the payload
// $this->config['encrypt_cookie'] and $cookie = \Crypt::decode($cookie);
// $cookie = $this->_unserialize($cookie);
//
// // validate the cookie format
// if ( ! is_array($cookie) or empty($cookie[0]) or ! is_string($cookie[0]))
// {
// $cookie = false;
// }
// }
//
// // and the result
// return $cookie;
// 以前oil create したものからコピー
if ($cookie !== false)
{
// fetch the payload
$this->config['encrypt_cookie'] and $cookie = \Crypt::decode($cookie);
$cookie = $this->_unserialize($cookie);
// and return it
return $cookie;
}
// no payload
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment