_getDataObj()->setUserInfo($this->_getUserInfo()); return parent::_doInsert(); } protected function _getAdminOrUserIdentity() { $identity = null; if (($adminAuth = \App_Admin_Auth::getInstance()) && $adminAuth->hasIdentity()) { $identity = $adminAuth->getIdentity(); $identity['authorType'] = 'admin'; } else if (($userAuth = \App_User_Auth::getInstance()) && $userAuth->hasIdentity()) { $identity = $userAuth->getIdentity(); $identity['authorType'] = 'user'; } return $identity; } protected function _getUserInfo() { $data = array(); $identity = $this->_getAdminOrUserIdentity(); if (!empty($identity)) { $data['author'] = $identity['data']['firstName'] . ' ' . $identity['data']['lastName']; $data['email'] = $identity['data']['email']; $data['authorId'] = $identity['data']['id']; $data['authorType'] = $identity['authorType']; } $data['date'] = date('Y-m-d H:i:s'); $data['referer'] = \Qs_Array::get($_SERVER, 'HTTP_REFERER', ''); $data['userAgent'] = \Qs_Array::get($_SERVER, 'HTTP_USER_AGENT', ''); $data['ipAddress'] = \Qs_Array::get( $_SERVER, 'REMOTE_ADDR', \Qs_Array::get($_SERVER, 'HTTP_X_FORWARDED_FOR', '') ); return $data; } protected function _getViewAlias() { if (null == $this->_viewAlias) { $this->_viewAlias = \Qs_SiteMap::getAliasByItem('Blog\\'); } return $this->_viewAlias; } protected function _getSession() { if (null === $this->_session) { $this->_session = new \Qs_Session_Namespace(get_class($this), true); } return $this->_session; } }