Ejemplo n.º 1
0
 public function on_start()
 {
     parent::on_start();
     $request = $this->request;
     if (!Loader::helper('validation/numbers')->integer($_REQUEST['btID'])) {
         throw new Exception(t('Access Denied'));
     }
     $this->blockType = BlockType::getByID($_REQUEST['btID']);
     $this->area = Area::get($this->page, $_REQUEST['arHandle']);
     $this->pageToModify = $this->page;
     $this->areaToModify = $this->area;
     if ($this->area->isGlobalArea()) {
         $this->pageToModify = Stack::getByName($_REQUEST['arHandle']);
         $this->areaToModify = Area::get($this->pageToModify, STACKS_AREA_NAME);
     }
     $this->areaPermissions = new Permissions($this->areaToModify);
     $cnt = $this->blockType->getController();
     if (!is_a($cnt, '\\Concrete\\Core\\Block\\BlockController')) {
         throw new Exception(t('Unable to load the controller for this block type. Perhaps it has been moved or removed.'));
     }
     $this->blockTypeController = $cnt;
     if (isset($_REQUEST['arCustomTemplates']) && is_array($_REQUEST['arCustomTemplates'])) {
         foreach ($_REQUEST['arCustomTemplates'] as $btHandle => $template) {
             $this->area->setCustomTemplate($btHandle, $template);
         }
     }
 }
Ejemplo n.º 2
0
 public function on_start()
 {
     parent::on_start();
     $pk = PermissionKey::getByHandle('edit_page_properties');
     $pk->setPermissionObject($this->page);
     $this->asl = $pk->getMyAssignment();
 }
Ejemplo n.º 3
0
 public function on_start()
 {
     parent::on_start();
     $this->area = \Area::getOrCreate($this->page, $_REQUEST['arHandle']);
     $this->permissions = new \Permissions($this->area);
     $this->set('a', $this->area);
 }
Ejemplo n.º 4
0
 public function __construct()
 {
     parent::__construct();
     $request = $this->request;
     $arHandle = $request->query->get('arHandle');
     $bID = $request->query->get('bID');
     $a = \Area::get($this->page, $arHandle);
     if (!is_object($a)) {
         throw new \Exception('Invalid Area');
     }
     $this->area = $a;
     if (!$a->isGlobalArea()) {
         $b = \Block::getByID($bID, $this->page, $a);
         $this->set('isGlobalArea', false);
     } else {
         $stack = \Stack::getByName($arHandle);
         $sc = ConcretePage::getByID($stack->getCollectionID(), 'RECENT');
         $b = \Block::getByID($bID, $sc, STACKS_AREA_NAME);
         $b->setBlockAreaObject($a);
         // set the original area object
         $this->set('isGlobalArea', true);
     }
     $this->block = $b;
     $this->permissions = new \Permissions($b);
     $this->set('bp', $this->permissions);
     $this->set('b', $b);
 }
Ejemplo n.º 5
0
 public function __construct()
 {
     parent::__construct();
     $request = $this->request;
     $cID = $request->query->get('cID');
     if ($cID) {
         $page = ConcretePage::getByID($cID);
         $this->setPageObject($page);
         $request->setCurrentPage($this->page);
     }
 }
Ejemplo n.º 6
0
 public function on_start()
 {
     $request = $this->request;
     $cID = $request->query->get('cID');
     if ($cID) {
         $page = ConcretePage::getByID($cID);
     }
     if (is_object($page) && !$page->isError()) {
         $this->setPageObject($page);
         $request->setCurrentPage($this->page);
     } else {
         throw new \Exception(t('Access Denied'));
     }
 }
Ejemplo n.º 7
0
 protected function validateAction()
 {
     if (parent::validateAction()) {
         if ($this->permissions->canEditPageContents() || $this->permissions->canEditPageProperties() || $this->permissions->canApprovePageVersions()) {
             return true;
         }
     }
 }