/** * Returns if the page allows a mode. Access rights and user state * are taken into consideration. * * @see $supportedModes * * @param integer $mode The mode to check for. * * @return boolean True if the mode is allowed. */ public function allows($mode) { if ($mode == Wicked::MODE_EDIT) { $page = Wicked_Page::getPage($this->referrer()); if ($page->isLocked(Wicked::lockUser())) { return false; } } return parent::allows($mode); }
/** * Returns if the page allows a mode. Access rights and user state * are taken into consideration. * * @see $supportedModes * * @param integer $mode The mode to check for. * * @return boolean True if the mode is allowed. */ public function allows($mode) { switch ($mode) { case Wicked::MODE_EDIT: if ($this->isLocked()) { return Wicked::lockUser() == $this->_lock['lock_owner']; } break; case Wicked::MODE_LOCKING: if ($GLOBALS['browser']->isRobot()) { return false; } if ($GLOBALS['registry']->isAdmin()) { return true; } if (($this->getPermissions() & Horde_Perms::EDIT) == 0) { return false; } break; case Wicked::MODE_UNLOCKING: if ($GLOBALS['registry']->isAdmin()) { return true; } if ($this->_lock) { return Wicked::lockUser() == $this->_lock['lock_owner']; } return false; } return parent::allows($mode); }