...
|
...
|
@@ -25,6 +25,12 @@ class AbstractAction extends Controller_Abstract |
|
|
* @var object
|
|
|
*/
|
|
|
protected $_request;
|
|
|
|
|
|
/**
|
|
|
* 用户相关信息
|
|
|
*/
|
|
|
protected $_uid;
|
|
|
protected $_uname;
|
|
|
|
|
|
/**
|
|
|
* 初始化
|
...
|
...
|
@@ -144,7 +150,7 @@ class AbstractAction extends Controller_Abstract |
|
|
* @param integer $path cookie可用的路径
|
|
|
* @param string $domain cookie可用域名
|
|
|
*/
|
|
|
protected function setCookie($name, $value, $expire = 0, $path = '/',$domain = 'yohobuy.com')
|
|
|
protected function setCookie($name, $value, $expire = 0, $path = '/', $domain = '.yohobuy.com')
|
|
|
{
|
|
|
setcookie($name, $value, $expire, $path, $domain);
|
|
|
}
|
...
|
...
|
@@ -158,7 +164,7 @@ class AbstractAction extends Controller_Abstract |
|
|
*/
|
|
|
protected function getCookie($name, $default = '')
|
|
|
{
|
|
|
return $this->request->getCookie($name, $default);
|
|
|
return $this->_request->getCookie($name, $default);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -198,7 +204,17 @@ class AbstractAction extends Controller_Abstract |
|
|
*/
|
|
|
protected function getUid()
|
|
|
{
|
|
|
return 0;
|
|
|
if (!$this->_uid) {
|
|
|
$cookie = $this->getCookie('_UID');
|
|
|
if (!empty($cookie)) {
|
|
|
$cookieList = explode('::', $cookie);
|
|
|
if (isset($cookieList[1]) && is_numeric($cookieList)) {
|
|
|
$this->_uid = $cookieList[1];
|
|
|
$this->_uname = $cookieList[0];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return $this->_uid;
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -215,6 +231,26 @@ class AbstractAction extends Controller_Abstract |
|
|
}
|
|
|
return $udid;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取当前登录的用户名字
|
|
|
*
|
|
|
* @return int
|
|
|
* @todo
|
|
|
*/
|
|
|
protected function getUname()
|
|
|
{
|
|
|
if (!$this->_uname) {
|
|
|
$cookie = $this->getCookie('_UID');
|
|
|
if (!empty($cookie)) {
|
|
|
$cookieList = explode('::', $cookie);
|
|
|
if (isset($cookieList[0])) {
|
|
|
$this->_uname = $cookieList[0];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return $this->_uname;
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 设置网站SEO的标题
|
...
|
...
|
@@ -284,17 +320,18 @@ class AbstractAction extends Controller_Abstract |
|
|
$footer = array();
|
|
|
|
|
|
// 已登录 @todo
|
|
|
if (false) {
|
|
|
$name = $this->getUname();
|
|
|
if (!empty($name)) {
|
|
|
$footer['user'] = array();
|
|
|
$footer['user']['name'] = 'goodboy'; // 昵称
|
|
|
$footer['user']['name'] = $name; // 昵称
|
|
|
$footer['user']['url'] = ''; // 个人中心链接
|
|
|
$footer['user']['signoutUrl'] = ''; // 登出链接
|
|
|
$footer['user']['signoutUrl'] = '/passport/login/out'; // 登出链接
|
|
|
}
|
|
|
// 未登录
|
|
|
else {
|
|
|
$footer = array();
|
|
|
$footer['loginUrl'] = '/signin.html'; // 登录链接
|
|
|
$footer['signupUrl'] = '/login.html'; // 注册链接
|
|
|
$footer['signupUrl'] = '/reg.html'; // 注册链接
|
|
|
}
|
|
|
|
|
|
$this->_view->assign('pageFooter', $footer);
|
...
|
...
|
|