public function __construct() { parent::__construct(); $this->user = false; if (isset($_SESSION['username'])) { $this->user = $_SESSION['username']; } }
public function onDispatch(MvcEvent $e) { $action = $this->getEvent()->getRouteMatch()->getParam('action'); if ($action != 'login') { if ($this->userAuth()->hasIdentity()) { $this->user = $this->userAuth()->getIdentity(); } else { return $this->redirect()->toRoute('App/admin', ['action' => 'login']); } } parent::onDispatch($e); }
public function _initialize() { $this->weiboApi = new WeiboApi(); $this->api = new Model\ApiModel(); parent::_initialize(); }
public function __construct() { parent::__construct(); }