예제 #1
0
 /**
  * Set virtual
  * Callback may only be used for virtual instances
  *
  * @param boolean $virtual
  */
 public function setVirtual($virtual)
 {
     //While setting instance as non-virtual, check the instance have callback if so throw exception
     if ($this->callback && !$virtual) {
         throw new PermissionException('Permission::setVirtual() failed: Could not set instance as non-virtual since instance contains callback.');
     }
     parent::setVirtual($virtual);
 }
예제 #2
0
 /**
  * @prePersist
  * @onFlush
  */
 public function validate()
 {
     // Slug must be unique per language and level of a branch (of the node tree)
     $slugs = array();
     foreach ($this->getNode()->getParent()->getChildren() as $child) {
         $page = $child->getPage($this->getLang());
         if ($page && $page !== $this) {
             $slugs[] = $page->getSlug();
         }
     }
     while ($this->getSlug() == '' || in_array($this->getSlug(), $slugs)) {
         $this->nextSlug();
     }
     // Alias slugs must not be equal to an existing file or folder
     if ($this->getType() == self::TYPE_ALIAS) {
         $invalidAliasNames = array('admin', 'cache', 'cadmin', 'config', 'core', 'core_modules', 'customizing', 'feed', 'images', 'installer', 'lang', 'lib', 'media', 'model', 'modules', 'themes', 'tmp', 'update', 'webcam', 'favicon.ico');
         foreach (\FWLanguage::getActiveFrontendLanguages() as $id => $lang) {
             $invalidAliasNames[] = $lang['lang'];
         }
         if (in_array($this->getSlug(), $invalidAliasNames)) {
             $lang = \Env::get('lang');
             throw new PageException('Cannot use name of existing files, folders or languages as alias.', $lang['TXT_CORE_CANNOT_USE_AS_ALIAS']);
         }
     }
     //workaround, this method is regenerated each time
     parent::validate();
 }
예제 #3
0
 /**
  * @prePersist
  */
 public function validate()
 {
     //workaround, this method is regenerated each time
     parent::validate();
 }