public function beforeAction($handlerAdapter) { parent::beforeAction($handlerAdapter); $spaceUid = (int) $this->getInput('uid', 'get'); if ($spaceUid < 1) { $userName = $this->getInput('username', 'get'); $user = Wekit::load('user.PwUser')->getUserByName($userName); $spaceUid = isset($user['uid']) ? $user['uid'] : 0; } if ($spaceUid < 1) { $this->forwardRedirect(WindUrlHelper::createUrl('u/login/run/')); } $this->space = new PwSpaceBo($spaceUid); if (!$this->space->space['uid']) { $user = Wekit::load('user.PwUser')->getUserByUid($spaceUid); if ($user) { Wekit::load('space.dm.PwSpaceDm'); $dm = new PwSpaceDm($spaceUid); $dm->setVisitCount(0); Wekit::load('space.PwSpace')->addInfo($dm); $this->space = new PwSpaceBo($spaceUid); } else { $this->forwardRedirect(WindUrlHelper::createUrl('u/login/run/')); } } $this->space->setTome($spaceUid, $this->loginUser->uid); $this->space->setVisitUid($this->loginUser->uid); $this->setTheme('space', null); if ($this->space->allowView('space')) { $this->forwardRedirect(WindUrlHelper::createUrl('space/index/run', array('uid' => $spaceUid))); } }
/** * (non-PHPdoc) * @see src/library/base/PwBaseController::beforeAction() */ public function beforeAction($handlerAdapter) { parent::beforeAction($handlerAdapter); $spaceUid = $this->getInput('uid', 'get'); if ($spaceUid === '0') { $this->showError('SPACE:space.guest'); } $spaceUid = intval($spaceUid); if ($spaceUid < 1) { if ($userName = $this->getInput('username', 'get')) { $user = Wekit::load('user.PwUser')->getUserByName($userName); $spaceUid = isset($user['uid']) ? $user['uid'] : 0; } elseif ($this->loginUser->uid > 0) { $spaceUid = $this->loginUser->uid; } else { $this->showError('SPACE:space.not.exist'); } } $this->space = new PwSpaceModel($spaceUid); if (!$this->space->space['uid']) { $user = Wekit::load('user.PwUser')->getUserByUid($spaceUid); if ($user) { Wekit::load('space.dm.PwSpaceDm'); $dm = new PwSpaceDm($spaceUid); $dm->setVisitCount(0); Wekit::load('space.PwSpace')->addInfo($dm); $this->space = new PwSpaceModel($spaceUid); } else { //$this->forwardRedirect(WindUrlHelper::createUrl('u/login/run/')); $this->showError('SPACE:space.not.exist'); } } $this->space->setTome($spaceUid, $this->loginUser->uid); $this->space->setVisitUid($this->loginUser->uid); if (!$this->space->allowView('space')) { $this->forwardRedirect(WindUrlHelper::createUrl('space/ban/run', array('uid' => $spaceUid))); } }