public function setPermissionObject(Area $a) { $ax = $a; if ($a->isGlobalArea()) { $cx = Stack::getByName($a->getAreaHandle()); $a = Area::get($cx, STACKS_AREA_NAME); } $this->permissionObject = $a; // if the area overrides the collection permissions explicitly (with a one on the override column) we check if ($a->overrideCollectionPermissions()) { $this->permissionObjectToCheck = $a; } else { if ($a->getAreaCollectionInheritID() > 0) { // in theory we're supposed to be inheriting some permissions from an area with the same handle, // set on the collection id specified above (inheritid). however, if someone's come along and // reverted that area to the page's permissions, there won't be any permissions, and we // won't see anything. so we have to check $areac = Page::getByID($a->getAreaCollectionInheritID()); $inheritArea = Area::get($areac, $a->getAreaHandlE()); if (is_object($inheritArea) && $inheritArea->overrideCollectionPermissions()) { // okay, so that area is still around, still has set permissions on it. So we // pass our current area to our grouplist, userinfolist objects, knowing that they will // smartly inherit the correct items. $this->permissionObjectToCheck = $inheritArea; } } if (!$this->permissionObjectToCheck) { $this->permissionObjectToCheck = $a->getAreaCollectionObject(); } } }
/** * gets the form post action for the current block type given the area * @param Area $a * @return string */ public function getBlockTypeAliasAction(&$a) { $step = ($_REQUEST['step']) ? '&step=' . $_REQUEST['step'] : ''; $arHandle = urlencode($a->getAreaHandle()); $c = $a->getAreaCollectionObject(); $cID = $c->getCollectionID(); $str = DIR_REL . "/" . DISPATCHER_FILENAME . "?cID={$cID}&areaName={$arHandle}&mode=edit&btask=alias" . $step . '&' . $valt->getParameter(); return $str; }
/** * sets the permissions on the area?? * @todo Documnetation?? not sure what type $cp is or how this is used? * @param Area $area * @param unknown $cp */ function setAreaPermissions(&$area, &$cp) { $db = Loader::db(); if ($area->overrideCollectionPermissions()) { $setBlocksVia = "AREA"; } else { if ($area->getAreaCollectionInheritID() > 0) { // see if the area/page we're supposed to be getting these from actually has a record $arOverrideCollectionPermissions = $db->getOne("select arOverrideCollectionPermissions from Areas where cID = ? and arHandle = ?", array($area->getAreaCollectionInheritID(), $area->getAreaHandle())); if ($arOverrideCollectionPermissions) { $setBlocksVia = "AREA"; } } if (!isset($setBlocksVia)) { $setBlocksVia = "PAGE"; } } if ($setBlocksVia == "AREA") { $c = $area->getAreaCollectionObject(); $cpID = $area->getAreaCollectionInheritID() > 0 ? $area->getAreaCollectionInheritID() : $c->getCollectionID(); $v = array($cpID, $area->getAreaHandle(), $this->getBlockTypeID()); $q = "select uID, gID from AreaGroupBlockTypes where cID = ? and arHandle = ? and btID = ?"; $r = $db->query($q, $v); while ($row = $r->fetchRow()) { if ($row['uID'] != 0) { $this->addBTUArray[] = $row['uID']; } if ($row['gID'] != 0) { $this->addBTGArray[] = $row['gID']; } } } else { $cID = $area->getCollectionID(); // we grab all the uID/gID combos from PagePermissions that can edit the page // then we allow them to add all the blocks they want $cInheritCID = $db->getOne('select cInheritPermissionsFromCID from Pages where cID = ?', array($cID)); $v = array($cInheritCID); $q = "select uID, gID, cgPermissions from PagePermissions where cID = ?"; $r = $db->query($q, $v); while ($row = $r->fetchRow()) { if ($row['uID'] != 0 && strpos($row['cgPermissions'], 'wa') !== false) { $this->addBTUArray[] = $row['uID']; } if ($row['gID'] != 0 && strpos($row['cgPermissions'], 'wa') !== false) { $this->addBTGArray[] = $row['gID']; } } } }