_getDataObj()->setUserInfo($this->_getUserInfo()); return parent::_doInsert(); } protected function _getAdminOrUserIdentity() { $identity = null; if (($adminAuth = \App_Admin_Auth::getInstance()) && $adminAuth->hasIdentity()) { $identity = $adminAuth->getIdentity(); $identity['type'] = 'admin'; } else if (($userAuth = Auth::getInstance()) && $userAuth->hasIdentity()) { $identity = $userAuth->getIdentity(); $identity['type'] = 'user'; } return $identity; } protected function _getUserInfo() { $data = []; $identity = $this->_getAdminOrUserIdentity(); if (!empty($identity)) { $data['author'] = $identity['data']['firstName'] . ' ' . $identity['data']['lastName']; $data['email'] = $identity['data']['email']; $data['createdBy'] = $identity['type']; $data['createdById'] = $identity['data']['id']; } $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; } }