public function getAllowedFileExtensions() { $u = new User(); $extensions = array(); if ($u->isSuperUser()) { $extensions = Loader::helper('concrete/file')->getAllowedFileExtensions(); return $extensions; } $pae = $this->getPermissionAccessObject(); if (!is_object($pae)) { return array(); } $accessEntities = $u->getUserAccessEntityObjects(); $accessEntities = $pae->validateAndFilterAccessEntities($accessEntities); $list = $this->getAccessListItems(FileSetPermissionKey::ACCESS_TYPE_ALL, $accessEntities); $list = PermissionDuration::filterByActive($list); foreach ($list as $l) { if ($l->getFileTypesAllowedPermission() == 'N') { $extensions = array(); } if ($l->getFileTypesAllowedPermission() == 'C') { $extensions = array_unique(array_merge($extensions, $l->getFileTypesAllowedArray())); } if ($l->getFileTypesAllowedPermission() == 'A') { $extensions = Loader::helper('concrete/file')->getAllowedFileExtensions(); } } return $extensions; }
public function validate() { $u = new User(); if ($u->isSuperUser()) { return true; } $pae = $this->getPermissionAccessObject(); if (!is_object($pae)) { return false; } $accessEntities = $u->getUserAccessEntityObjects(); $accessEntities = $pae->validateAndFilterAccessEntities($accessEntities); $valid = false; $list = $this->getAccessListItems(PermissionKey::ACCESS_TYPE_ALL, $accessEntities); $list = PermissionDuration::filterByActive($list); foreach ($list as $l) { if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_INCLUDE) { $valid = true; } if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_EXCLUDE) { $valid = false; } } return $valid; }
public function getMyAssignment() { $u = new User(); $asl = new ViewUserAttributesUserPermissionAssignment(); if ($u->isSuperUser()) { $asl->setAttributesAllowedPermission('A'); return $asl; } $pae = $this->getPermissionAccessObject(); if (!is_object($pae)) { return $asl; } $accessEntities = $u->getUserAccessEntityObjects(); $accessEntities = $pae->validateAndFilterAccessEntities($accessEntities); $list = $this->getAccessListItems(UserPermissionKey::ACCESS_TYPE_ALL, $accessEntities); $list = PermissionDuration::filterByActive($list); foreach ($list as $l) { if ($l->getAttributesAllowedPermission() == 'N') { $asl->setAttributesAllowedPermission('N'); } if ($l->getAttributesAllowedPermission() == 'C') { $asl->setAttributesAllowedPermission('C'); } if ($l->getAttributesAllowedPermission() == 'A') { $asl->setAttributesAllowedPermission('A'); } } $asl->setAttributesAllowedArray($this->getAllowedAttributeKeyIDs($list)); return $asl; }
protected function getAllowedPageTypeIDs() { $u = new User(); $pae = $this->getPermissionAccessObject(); if (!is_object($pae)) { return array(); } $accessEntities = $u->getUserAccessEntityObjects(); $accessEntities = $pae->validateAndFilterAccessEntities($accessEntities); $list = $this->getAccessListItems(PagePermissionKey::ACCESS_TYPE_ALL, $accessEntities); $list = PermissionDuration::filterByActive($list); $db = Loader::db(); $allCTIDs = $db->GetCol('select ctID from PageTypes where ctIsInternal = 0'); $ctIDs = array(); foreach ($list as $l) { if ($l->getPageTypesAllowedPermission() == 'N') { $ctIDs = array(); } if ($l->getPageTypesAllowedPermission() == 'C') { if ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_EXCLUDE) { $ctIDs = array_values(array_diff($ctIDs, $l->getPageTypesAllowedArray())); } else { $ctIDs = array_unique(array_merge($ctIDs, $l->getPageTypesAllowedArray())); } } if ($l->getPageTypesAllowedPermission() == 'A') { $ctIDs = $allCTIDs; } } return $ctIDs; }
public function validate() { $u = new User(); if ($u->isSuperUser()) { return true; } $accessEntities = $u->getUserAccessEntityObjects(); return $this->validateAccessEntities($accessEntities); }
public function onAfterDispatch($context, &$storage) { $cms = \Core::make('app'); $statistics = $cms['zray/statistics']; $c = \Page::getCurrentPage(); $storage['general'][] = array('Version' => array('Core Version' => \Config::get('concrete.version'), 'Version Installed' => \Config::get('concrete.version_installed'), 'Database Version' => \Config::get('concrete.version_db')), 'Caching' => array('Block Cache' => \Config::get('concrete.cache.blocks') ? 'On' : 'Off', 'Asset Cache' => \Config::get('concrete.cache.assets') ? 'On' : 'Off', 'Theme CSS Cache' => \Config::get('concrete.cache.theme_css') ? 'On' : 'Off', 'Theme CSS Compressed' => \Config::get('concrete.theme.compress_preprocessor_output') ? 'On' : 'Off', 'Overrides Cache' => \Config::get('concrete.cache.overrides') ? 'On' : 'Off', 'Full Page Caching' => \Config::get('concrete.cache.pages') ? 'On' : 'Off')); foreach ($statistics->getRequestedPages() as $page) { $storage['pageRequests'][] = array('ID' => $page->getCollectionID(), 'Path' => $page->getCollectionPath(), 'Name' => $page->getCollectionName(), 'Total' => $page->getCount()); } foreach ($statistics->getRequestedConfigs() as $config) { $storage['configRequests'][] = array('Key' => $config->getKey(), 'Value' => $config->getValue(), 'Total' => $config->getCount()); } $u = new \User(); foreach ($u->getUserAccessEntityObjects() as $entity) { $storage['yourAccessEntities'][] = array('ID' => $entity->getAccessEntityID(), 'Type' => $entity->getAccessEntityTypeHandle(), 'Detail' => $entity->getAccessEntityLabel()); } $cms = \Core::make('app'); $statistics = $cms['zray/statistics']; $allBlocks = $statistics->getBlocksRetrievedForPage(); // all blocks, not just those rendered $renderedBlocks = array(); foreach ($statistics->getBlocks() as $block) { $usedCache = 'Unknown'; if (version_compare(\Config::get('concrete.version'), '5.7.5a1', '>=')) { $usedCache = $block->getUsedCache(); } $renderedBlocks[] = $block->getID(); $storage['blockRender'][] = array('bID' => $block->getID(), 'type' => $block->getType(), 'area' => $block->getAreaHandle(), 'cache' => $usedCache, 'content' => $block->getContent(), 'time' => $block->getDisplayRenderTime(), 'rendered' => true); } foreach ($allBlocks as $row) { if (!in_array($row['bID'], $renderedBlocks)) { $b = \Block::getByID($row['bID'], $c, $row['arHandle']); if (is_object($b)) { $storage['blockRender'][] = array('bID' => $b->getBlockID(), 'type' => $b->getBlockTypeHandle(), 'area' => $b->getAreaHandle(), 'rendered' => false); } } } if (version_compare(\Config::get('concrete.version'), '5.7.5a1', '>=')) { if (is_object($c)) { $cp = new \Permissions($c); $assignments = $cp->getAllAssignmentsForPage(); foreach ($assignments as $assignment) { $pk = $assignment->getPermissionKeyObject(); $obj = $pk->getPermissionObject(); if ($obj && (!isset($lastobj) || $lastobj != $obj)) { $storage['customPagePermissions'][] = array('Type' => $obj->getPermissionObjectKeyCategoryHandle(), 'Object' => $obj->getPermissionObjectIdentifier()); } $lastobj = $obj; } } } }
protected function getAllowedBlockTypeIDs() { $u = new User(); $pae = $this->getPermissionAccessObject(); if (!is_object($pae)) { return array(); } $accessEntities = $u->getUserAccessEntityObjects(); $accessEntities = $pae->validateAndFilterAccessEntities($accessEntities); $list = $this->getAccessListItems(AreaPermissionKey::ACCESS_TYPE_ALL, $accessEntities); $list = PermissionDuration::filterByActive($list); $db = Loader::db(); $btIDs = array(); if (count($list) > 0) { $dsh = Loader::helper('concrete/dashboard'); if ($dsh->inDashboard()) { $allBTIDs = $db->GetCol('select btID from BlockTypes'); } else { $allBTIDs = $db->GetCol('select btID from BlockTypes where btIsInternal = 0'); } foreach ($list as $l) { if ($l->getBlockTypesAllowedPermission() == 'N') { $btIDs = array(); } if ($l->getBlockTypesAllowedPermission() == 'C') { if ($l->getAccessType() == AreaPermissionKey::ACCESS_TYPE_EXCLUDE) { $btIDs = array_values(array_diff($btIDs, $l->getBlockTypesAllowedArray())); } else { $btIDs = array_unique(array_merge($btIDs, $l->getBlockTypesAllowedArray())); } } if ($l->getBlockTypesAllowedPermission() == 'A') { $btIDs = $allBTIDs; } } } return $btIDs; }
public function getMyAssignment() { $u = new User(); $asl = new EditUserPropertiesUserPermissionAccessListItem(); $db = Loader::db(); $allAKIDs = $db->GetCol('select akID from UserAttributeKeys order by akID asc'); if ($u->isSuperUser()) { $asl->setAllowEditUserName(1); $asl->setAllowEditEmail(1); $asl->setAllowEditPassword(1); $asl->setAllowEditAvatar(1); $asl->setAllowEditTimezone(1); $asl->setAllowEditDefaultLanguage(1); $asl->setAttributesAllowedArray($allAKIDs); $asl->setAttributesAllowedPermission('A'); return $asl; } $pae = $this->getPermissionAccessObject(); if (!is_object($pae)) { return $asl; } $accessEntities = $u->getUserAccessEntityObjects(); $accessEntities = $pae->validateAndFilterAccessEntities($accessEntities); $list = $this->getAccessListItems(UserPermissionKey::ACCESS_TYPE_ALL, $accessEntities); $list = PermissionDuration::filterByActive($list); $properties = array(); $excluded = array(); $akIDs = array(); $u = new User(); foreach ($list as $l) { if ($l->allowEditUserName() && !in_array('uName', $excluded)) { $asl->setAllowEditUserName(1); } if ($l->allowEditEmail() && !in_array('uEmail', $excluded)) { $asl->setAllowEditEmail(1); } if ($l->allowEditPassword() && !in_array('uPassword', $excluded)) { $asl->setAllowEditPassword(1); } if ($l->allowEditAvatar() && !in_array('uAvatar', $excluded)) { $asl->setAllowEditAvatar(1); } if ($l->allowEditTimezone() && !in_array('uTimezone', $excluded)) { $asl->allowEditTimezone(1); } if ($l->allowEditDefaultLanguage() && !in_array('uDefaultLanguage', $excluded)) { $asl->setAllowEditDefaultLanguage(1); } if ($l->getAccessType() == UserPermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditUserName()) { $asl->setAllowEditUserName(0); $excluded[] = 'uName'; } if ($l->getAccessType() == UserPermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditEmail()) { $asl->setAllowEditEmail(0); $excluded[] = 'uEmail'; } if ($l->getAccessType() == UserPermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditPassword()) { $asl->setAllowEditPassword(0); $excluded[] = 'uPassword'; } if ($l->getAccessType() == UserPermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditAvatar()) { $asl->setAllowEditAvatar(0); $excluded[] = 'uAvatar'; } if ($l->getAccessType() == UserPermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditTimezone()) { $asl->setAllowEditTimezone(0); $excluded[] = 'uTimezone'; } if ($l->getAccessType() == UserPermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditDefaultLanguage()) { $asl->setAllowEditDefaultLanguage(0); $excluded[] = 'uDefaultLanguage'; } if ($l->getAttributesAllowedPermission() == 'N') { $akIDs = array(); $asl->setAttributesAllowedPermission('N'); } if ($l->getAttributesAllowedPermission() == 'C') { $asl->setAttributesAllowedPermission('C'); if ($l->getAccessType() == UserPermissionKey::ACCESS_TYPE_EXCLUDE) { $akIDs = array_values(array_diff($akIDs, $l->getAttributesAllowedArray())); } else { $akIDs = array_unique(array_merge($akIDs, $l->getAttributesAllowedArray())); } } if ($l->getAttributesAllowedPermission() == 'A') { $akIDs = $allAKIDs; $asl->setAttributesAllowedPermission('A'); } } $asl->setAttributesAllowedArray($akIDs); return $asl; }
protected function setupFilePermissions() { $u = new User(); if ($this->permissionLevel == false || $u->isSuperUser()) { return false; } $accessEntities = $u->getUserAccessEntityObjects(); foreach ($accessEntities as $pae) { $peIDs[] = $pae->getAccessEntityID(); } $db = Loader::db(); // figure out which sets can read files in, not read files in, and read only my files in. $fsIDs = $db->GetCol('select fsID from FileSets where fsOverrideGlobalPermissions = 1'); $viewableSets = array(-1); $nonviewableSets = array(-1); $myviewableSets = array(-1); $owpae = FileUploaderPermissionAccessEntity::getOrCreate(); if (count($fsIDs) > 0) { $pk = PermissionKey::getByHandle($this->permissionLevel); foreach ($fsIDs as $fsID) { $fs = FileSet::getByID($fsID); $pk->setPermissionObject($fs); $list = $pk->getAccessListItems(PermissionKey::ACCESS_TYPE_ALL, $accessEntities); $list = PermissionDuration::filterByActive($list); if (count($list) > 0) { foreach ($list as $l) { $pae = $l->getAccessEntityObject(); if ($pae->getAccessEntityID() == $owpae->getAccessEntityID()) { $myviewableSets[] = $fs->getFileSetID(); } else { if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_INCLUDE) { $viewableSets[] = $fs->getFileSetID(); } if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_EXCLUDE) { $nonviewableSets[] = $fs->getFileSetID(); } } } } else { $nonviewableSets[] = $fs->getFileSetID(); } } } $fs = FileSet::getGlobal(); $fk = PermissionKey::getByHandle('search_file_set'); $fk->setPermissionObject($fs); $accessEntities[] = $owpae; $list = $fk->getAccessListItems(PermissionKey::ACCESS_TYPE_ALL, $accessEntities); $list = PermissionDuration::filterByActive($list); foreach ($list as $l) { $pae = $l->getAccessEntityObject(); if ($pae->getAccessEntityID() == $owpae->getAccessEntityID()) { $valid = 'mine'; } else { if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_INCLUDE) { $valid = PermissionKey::ACCESS_TYPE_INCLUDE; } if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_EXCLUDE) { $valid = PermissionKey::ACCESS_TYPE_EXCLUDE; } } } $uID = $u->isRegistered() ? $u->getUserID() : 0; // This excludes all files found in sets where I may only read mine, and I did not upload the file $this->filter(false, '(f.uID = ' . $uID . ' or (select count(fID) from FileSetFiles where FileSetFiles.fID = f.fID and fsID in (' . implode(',', $myviewableSets) . ')) = 0)'); if ($valid == 'mine') { // this means that we're only allowed to read files we've uploaded (unless, of course, those files are in previously covered sets) $this->filter(false, '(f.uID = ' . $uID . ' or (select count(fID) from FileSetFiles where FileSetFiles.fID = f.fID and fsID in (' . implode(',', $viewableSets) . ')) > 0)'); } // this excludes all file that are found in sets that I can't find $this->filter(false, '((select count(fID) from FileSetFiles where FileSetFiles.fID = f.fID and fsID in (' . implode(',', $nonviewableSets) . ')) = 0)'); $uID = $u->isRegistered() ? $u->getUserID() : 0; // This excludes all files found in sets where I may only read mine, and I did not upload the file $this->filter(false, '(f.uID = ' . $uID . ' or (select count(fID) from FileSetFiles where FileSetFiles.fID = f.fID and fsID in (' . implode(',', $myviewableSets) . ')) = 0)'); $db = Loader::db(); $vpvPKID = $db->GetOne('select pkID from PermissionKeys where pkHandle = \'view_file\''); if ($this->permissionLevel == 'search_file_set') { $vpPKID = $db->GetOne('select pkID from PermissionKeys where pkHandle = \'view_file_in_file_manager\''); } else { $vpPKID = $vpvPKID; } $pdIDs = $db->GetCol("select distinct pdID from FilePermissionAssignments fpa inner join PermissionAccessList pal on fpa.paID = pal.paID where pkID in (?, ?) and pdID > 0", array($vpPKID, $vpvPKID)); $activePDIDs = array(); if (count($pdIDs) > 0) { // then we iterate through all of them and find any that are active RIGHT NOW foreach ($pdIDs as $pdID) { $pd = PermissionDuration::getByID($pdID); if ($pd->isActive()) { $activePDIDs[] = $pd->getPermissionDurationID(); } } } $activePDIDs[] = 0; // exclude files where its overridden but I don't have the ability to read $this->filter(false, "(f.fOverrideSetPermissions = 0 or (select count(fID) from FilePermissionAssignments fpa inner join PermissionAccessList fpal on fpa.paID = fpal.paID where fpa.fID = f.fID and fpal.accessType = " . PermissionKey::ACCESS_TYPE_INCLUDE . " and fpal.pdID in (" . implode(',', $activePDIDs) . ") and fpal.peID in (" . implode(',', $peIDs) . ") and (if(fpal.peID = " . $owpae->getAccessEntityID() . " and f.uID <> " . $uID . ", false, true)) and (fpa.pkID = " . $vpPKID . ")) > 0)"); // exclude detail files where read is excluded $this->filter(false, "f.fID not in (select ff.fID from Files ff inner join FilePermissionAssignments fpaExclude on ff.fID = fpaExclude.fID inner join PermissionAccessList palExclude on fpaExclude.paID = palExclude.paID where fOverrideSetPermissions = 1 and palExclude.accessType = " . PermissionKey::ACCESS_TYPE_EXCLUDE . " and palExclude.pdID in (" . implode(',', $activePDIDs) . ")\n\t\t\tand palExclude.peID in (" . implode(',', $peIDs) . ") and fpaExclude.pkID in (" . $vpPKID . "," . $vpvPKID . "))"); }
public function getMyAssignment() { $u = new User(); $asl = new EditPagePropertiesPagePermissionAccessListItem(); if ($u->isSuperUser()) { $asl->setAllowEditName(1); $asl->setAllowEditDateTime(1); $asl->setAllowEditUserID(1); $asl->setAllowEditDescription(1); $asl->setAllowEditPaths(1); $asl->setAttributesAllowedArray($this->getAllAttributeKeyIDs()); $asl->setAttributesAllowedPermission('A'); return $asl; } $pae = $this->getPermissionAccessObject(); if (!is_object($pae)) { return $asl; } $accessEntities = $u->getUserAccessEntityObjects(); $accessEntities = $pae->validateAndFilterAccessEntities($accessEntities); $list = $pae->getAccessListItems(PagePermissionKey::ACCESS_TYPE_ALL, $accessEntities); $list = PermissionDuration::filterByActive($list); $properties = array(); $excluded = array(); $akIDs = array(); $u = new User(); if (count($list) > 0) { $allAKIDs = $this->getAllAttributeKeyIDs(); } foreach ($list as $l) { if ($l->allowEditName() && !in_array('name', $excluded)) { $asl->setAllowEditName(1); } if ($l->allowEditDateTime() && !in_array('date', $excluded)) { $asl->setAllowEditDateTime(1); } if ($l->allowEditUserID() && !in_array('uID', $excluded)) { $asl->setAllowEditUserID(1); } if ($l->allowEditDescription() && !in_array('description', $excluded)) { $asl->setAllowEditDescription(1); } if ($l->allowEditPaths() && !in_array('paths', $excluded)) { $asl->setAllowEditPaths(1); } if ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditName()) { $asl->setAllowEditName(0); $excluded[] = 'name'; } if ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditDateTime()) { $asl->setAllowEditDateTime(0); $excluded[] = 'date'; } if ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditUserID()) { $asl->setAllowEditUserID(0); $excluded[] = 'uID'; } if ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditDescription()) { $asl->setAllowEditDescription(0); $excluded[] = 'description'; } if ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditPaths()) { $asl->setAllowEditPaths(0); $excluded[] = 'paths'; } if ($l->getAttributesAllowedPermission() == 'N') { $akIDs = array(); $asl->setAttributesAllowedPermission('N'); } if ($l->getAttributesAllowedPermission() == 'C') { $asl->setAttributesAllowedPermission('C'); if ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_EXCLUDE) { $akIDs = array_values(array_diff($akIDs, $l->getAttributesAllowedArray())); } else { $akIDs = array_unique(array_merge($akIDs, $l->getAttributesAllowedArray())); } } if ($l->getAttributesAllowedPermission() == 'A') { $akIDs = $allAKIDs; $asl->setAttributesAllowedPermission('A'); } } $asl->setAttributesAllowedArray($akIDs); return $asl; }
/** * Sets up a list to only return items the proper user can access */ public function setupPermissions() { $u = new User(); if ($u->isSuperUser() || $this->ignorePermissions) { return; // super user always sees everything. no need to limit } $accessEntities = $u->getUserAccessEntityObjects(); foreach ($accessEntities as $pae) { $peIDs[] = $pae->getAccessEntityID(); } $owpae = PageOwnerPermissionAccessEntity::getOrCreate(); // now we retrieve a list of permission duration object IDs that are attached view_page or view_page_version // against any of these access entity objects. We just get'em all. $db = Loader::db(); $activePDIDs = array(); $vpPKID = $db->GetOne('select pkID from PermissionKeys where pkHandle = \'view_page\''); $vpvPKID = $db->GetOne('select pkID from PermissionKeys where pkHandle = \'view_page_versions\''); $pdIDs = $db->GetCol("select distinct pdID from PagePermissionAssignments ppa inner join PermissionAccessList pa on ppa.paID = pa.paID where pkID in (?, ?) and pdID > 0", array($vpPKID, $vpvPKID)); if (count($pdIDs) > 0) { // then we iterate through all of them and find any that are active RIGHT NOW foreach ($pdIDs as $pdID) { $pd = PermissionDuration::getByID($pdID); if ($pd->isActive()) { $activePDIDs[] = $pd->getPermissionDurationID(); } } } $activePDIDs[] = 0; if ($this->includeAliases) { $cInheritPermissionsFromCID = 'if(p2.cID is null, p1.cInheritPermissionsFromCID, p2.cInheritPermissionsFromCID)'; } else { $cInheritPermissionsFromCID = 'p1.cInheritPermissionsFromCID'; } if ($this->displayOnlyApprovedPages) { $cvIsApproved = ' and cv.cvIsApproved = 1'; } $uID = 0; if ($u->isRegistered()) { $uID = $u->getUserID(); } $this->filter(false, "((select count(cID) from PagePermissionAssignments ppa1 inner join PermissionAccessList pa1 on ppa1.paID = pa1.paID where ppa1.cID = {$cInheritPermissionsFromCID} and pa1.accessType = " . PermissionKey::ACCESS_TYPE_INCLUDE . " and pa1.pdID in (" . implode(',', $activePDIDs) . ")\n\t\t\tand pa1.peID in (" . implode(',', $peIDs) . ") and (if(pa1.peID = " . $owpae->getAccessEntityID() . " and p1.uID <>" . $uID . ", false, true)) and (ppa1.pkID = " . $vpPKID . $cvIsApproved . " or ppa1.pkID = " . $vpvPKID . ")) > 0\n\t\t\tor (p1.cPointerExternalLink !='' AND p1.cPointerExternalLink IS NOT NULL))"); $this->filter(false, "((select count(cID) from PagePermissionAssignments ppaExclude inner join PermissionAccessList paExclude on ppaExclude.paID = paExclude.paID where ppaExclude.cID = {$cInheritPermissionsFromCID} and accessType = " . PermissionKey::ACCESS_TYPE_EXCLUDE . " and pdID in (" . implode(',', $activePDIDs) . ")\n\t\t\tand paExclude.peID in (" . implode(',', $peIDs) . ") and (if(paExclude.peID = " . $owpae->getAccessEntityID() . " and p1.uID <>" . $uID . ", false, true)) and (ppaExclude.pkID = " . $vpPKID . $cvIsApproved . " or ppaExclude.pkID = " . $vpvPKID . ")) = 0)"); }
public static function add($filename, $prefix, $data = array()) { $db = Loader::db(); $dh = Loader::helper('date'); $date = $dh->getSystemDateTime(); $uID = 0; $u = new User(); if (isset($data['uID'])) { $uID = $data['uID']; } else if ($u->isRegistered()) { $uID = $u->getUserID(); } $db->Execute('insert into Files (fDateAdded, uID) values (?, ?)', array($date, $uID)); $fID = $db->Insert_ID(); $f = File::getByID($fID); $fv = $f->addVersion($filename, $prefix, $data); Events::fire('on_file_add', $f, $fv); $entities = $u->getUserAccessEntityObjects(); $hasUploader = false; foreach($entities as $obj) { if ($obj instanceof FileUploaderPermissionAccessEntity) { $hasUploader = true; } } if (!$hasUploader) { $u->refreshUserGroups(); } return $fv; }