本文整理汇总了PHP中Permissions::canRead方法的典型用法代码示例。如果您正苦于以下问题:PHP Permissions::canRead方法的具体用法?PHP Permissions::canRead怎么用?PHP Permissions::canRead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Permissions
的用法示例。
在下文中一共展示了Permissions::canRead方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
public function view() {
$categories = array();
$c = Page::getCurrentPage();
$children = $c->getCollectionChildrenArray(true);
foreach($children as $cID) {
$nc = Page::getByID($cID, 'ACTIVE');
$ncp = new Permissions($nc);
if ($ncp->canRead() && (!$nc->getAttribute('exclude_nav'))) {
$categories[] = $nc;
}
}
$this->set('categories', $categories);
}
示例2: isValidStack
protected static function isValidStack($stack) {
$parent = Page::getByPath(STACKS_PAGE_PATH);
if ($stack->getCollectionParentID() != $parent->getCollectionID()) {
return false;
}
$as = Area::get($stack, STACKS_AREA_NAME);
$asp = new Permissions($as);
if (!$asp->canRead()) {
return false;
}
return true;
}
示例3: view_inline
public function view_inline($fID)
{
$file = File::getByID($fID);
$fp = new Permissions($file);
if (!$fp->canRead()) {
return false;
}
$mimeType = $file->getMimeType();
$fc = Loader::helper('file');
$contents = $fc->getContents($file->getPath());
header("Content-type: {$mimeType}");
print $contents;
exit;
}
示例4: loadFileSet
function loadFileSet(){
if (intval($this->fsID) < 1) {
return false;
}
Loader::helper('concrete/file');
Loader::model('file_attributes');
Loader::library('file/types');
Loader::model('file_list');
Loader::model('file_set');
$ak = FileAttributeKey::getByHandle('height');
$fs = FileSet::getByID($this->fsID);
$fileList = new FileList();
$fileList->filterBySet($fs);
$fileList->filterByType(FileType::T_IMAGE);
$fileList->sortByFileSetDisplayOrder();
$files = $fileList->get(1000,0);
$image = array();
$image['duration'] = $this->duration;
$image['fadeDuration'] = $this->fadeDuration;
$image['groupSet'] = 0;
$image['url'] = '';
$images = array();
$maxHeight = 0;
foreach ($files as $f) {
$fp = new Permissions($f);
if(!$fp->canRead()) { continue; }
$image['fID'] = $f->getFileID();
$image['fileName'] = $f->getFileName();
$image['fullFilePath'] = $f->getPath();
$image['url'] = $f->getRelativePath();
// find the max height of all the images so slideshow doesn't bounce around while rotating
$vo = $f->getAttributeValueObject($ak);
if (is_object($vo)) {
$image['imgHeight'] = $vo->getValue('height');
}
if ($maxHeight == 0 || $image['imgHeight'] > $maxHeight) {
$maxHeight = $image['imgHeight'];
}
$images[] = $image;
}
$this->images = $images;
}
示例5: view
public function view()
{
$this->enableNativeMobile();
$categories = array();
$c = Page::getCurrentPage();
$children = $c->getCollectionChildrenArray(true);
foreach ($children as $cID) {
$nc = Page::getByID($cID, 'ACTIVE');
$ncp = new Permissions($nc);
if ($ncp->canRead()) {
$categories[] = $nc;
}
}
$this->set('categories', $categories);
}
示例6: getUnsortedPermittedFilesetImages
public static function getUnsortedPermittedFilesetImages($fsID)
{
Loader::model('file_set');
Loader::model('file_list');
$fsHasDisplayOrder = version_compare(APP_VERSION, '5.4.1', '>=');
$fs = FileSet::getByID($fsID);
$fl = new FileList();
$fl->filterBySet($fs);
$fl->filterByType(FileType::T_IMAGE);
if ($fsHasDisplayOrder) {
$fl->sortByFileSetDisplayOrder();
}
$all_files = $fl->get();
$permitted_files = array();
foreach ($all_files as $f) {
$fp = new Permissions($f);
if ($fp->canRead()) {
$permitted_files[] = $f;
}
}
return $permitted_files;
}
示例7: on_page_view
public function on_page_view() {
$stack = Stack::getByID($this->stID);
$p = new Permissions($stack);
if ($p->canRead()) {
$blocks = $stack->getBlocks();
foreach($blocks as $b) {
$bp = new Permissions($b);
if ($bp->canRead()) {
$btc = $b->getInstance();
if('Controller' != get_class($btc)){
$btc->outputAutoHeaderItems();
}
$csr = $b->getBlockCustomStyleRule();
if (is_object($csr)) {
$styleHeader = '#'.$csr->getCustomStyleRuleCSSID(1).' {'. $csr->getCustomStyleRuleText(). "} \r\n";
$btc->addHeaderItem("<style type=\"text/css\"> \r\n".$styleHeader.'</style>', 'VIEW');
}
$btc->runTask('on_page_view', array($view));
}
}
}
}
示例8: on_start
public function on_start() {
$c = Page::getByPath('/dashboard/blocks/stacks');
$cp = new Permissions($c);
if ($cp->canRead()) {
$c = Page::getCurrentPage();
$pcp = new Permissions($c);
if ((!$pcp->canReadVersions()) || ($_GET['vtask'] != 'view_versions' && $_GET['vtask'] != 'compare')) {
$cID = $c->getCollectionID();
$this->redirect('/dashboard/blocks/stacks','view_details', $cID);
} else {
$this->theme = 'dashboard';
}
} else {
global $c; // ugh
$v = View::getInstance();
$c = new Page();
$c->loadError(COLLECTION_NOT_FOUND);
$v->setCollectionObject($c);
$this->c = $c;
$cont = Loader::controller("/page_not_found");
$v->setController($cont);
$v->render('/page_not_found');
}
}
示例9: Permissions
$obj->arHandle = $a->getAreaHandle();
$obj->error = false;
print Loader::helper('json')->encode($obj);
exit;
//header('Location: ' . BASE_URL . DIR_REL . '/' . DISPATCHER_FILENAME . '?cID=' . $redirectCID . '&mode=edit' . $step);
//exit;
}
break;
case 'passthru':
if (isset($_GET['bID']) && isset($_GET['arHandle'])) {
$a = Area::get($c, $_GET['arHandle']);
$b = Block::getByID($_GET['bID'], $c, $a);
// basically, we hand off the current request to the block
// which handles permissions and everything
$p = new Permissions($b);
if ($p->canRead()) {
$action = $b->passThruBlock($_REQUEST['method']);
}
}
break;
}
}
if ($_GET['atask'] && $valt->validate()) {
switch ($_GET['atask']) {
case 'update':
if ($cp->canAdminPage()) {
$area = Area::get($c, $_GET['arHandle']);
if (is_object($area)) {
if ($_POST['aRevertToPagePermissions']) {
$area->revertToPagePermissions();
} else {
示例10: die
defined('C5_EXECUTE') or die("Access Denied.");
$u = new User();
$form = Loader::helper('form');
$respw = array();
$fileIDs = array();
$files = array();
if (is_array($_REQUEST['fID'])) {
$fileIDs = $_REQUEST['fID'];
} else {
$fileIDs[] = $_REQUEST['fID'];
}
foreach ($fileIDs as $fID) {
$f = File::getByID($fID);
$fp = new Permissions($f);
if ($fp->canRead()) {
$files[] = $f;
}
}
if (count($files) == 0) {
die(t("Access Denied."));
}
$i = 0;
foreach ($files as $f) {
$ats = $f->getAttributeList();
$resp[$i]['error'] = false;
$resp[$i]['filePathDirect'] = $f->getRelativePath();
$resp[$i]['filePathInline'] = View::url('/download_file', 'view_inline', $f->getFileID());
$resp[$i]['filePath'] = View::url('/download_file', 'view', $f->getFileID());
$resp[$i]['title'] = $f->getTitle();
$resp[$i]['fileName'] = $f->getFilename();
示例11: foreach
?>
</form>
</div>
</div>
<?php
if (count($stacks) > 0) {
?>
<ul id="ccm-stack-list" class="item-select-list item-select-list-groups">
<?php
foreach ($stacks as $s) {
$as = Area::get($s, STACKS_AREA_NAME);
$asp = new Permissions($as);
if ($asp->canRead() && $ap->canAddStackToArea($s)) {
?>
<li class="ccm-stack-available">
<a onclick="ccmStackSearchResetKeys()" dialog-on-destroy="ccmStackSearchMapKeys()" class="dialog-launch ccm-block-type-inner" dialog-on-close="ccm_blockWindowAfterClose()" dialog-append-buttons="true" dialog-modal="false" dialog-width="620" dialog-height="400" dialog-title="<?php
echo $s->getCollectionName();
?>
<?php
echo t('Contents');
?>
" href="<?php
echo REL_DIR_FILES_TOOLS_REQUIRED;
?>
/edit_area_popup.php?atask=add_stack_contents&cID=<?php
echo $c->getCollectionID();
?>
示例12: Permissions
switch ($_GET['atask']) {
case 'add':
$toolSection = "block_area_add_new";
$canViewPane = $ap->canAddBlocks();
break;
case 'add_from_stack':
$toolSection = "block_area_add_stack";
$canViewPane = $ap->canAddStacks();
break;
case 'add_stack_contents':
$toolSection = "block_area_add_stack_contents";
$stack = Stack::getByID($_REQUEST['stackID']);
$canViewPane = false;
if (is_object($stack)) {
$stp = new Permissions($stack);
$canViewPane = $stp->canRead() && $ap->canAddStacks();
}
break;
case 'paste':
$toolSection = "block_area_add_scrapbook";
$canViewPane = $ap->canAddBlocks();
break;
case 'layout':
$originalLayoutId = intval($_REQUEST['originalLayoutID']) ? intval($_REQUEST['originalLayoutID']) : intval($_REQUEST['layoutID']);
$args['refreshAction'] = REL_DIR_FILES_TOOLS_REQUIRED . '/edit_area_popup?atask=layout&cID=' . $c->getCollectionID() . '&arHandle=' . $a->getAreaHandle() . '&refresh=1&originalLayoutID=' . $originalLayoutId . '&cvalID=' . $_REQUEST['cvalID'] . '&areaNameNumber=' . intval($_REQUEST['areaNameNumber']);
$toolSection = "block_area_layout";
$canViewPane = $ap->canAddLayoutToArea();
$args['action'] = $a->getAreaUpdateAction('layout') . '&originalLayoutID=' . $originalLayoutId . '&cvalID=' . intval($_REQUEST['cvalID']) . '&areaNameNumber=' . intval($_REQUEST['areaNameNumber']);
break;
case 'design':
$toolSection = 'custom_style';
示例13: die
<?
defined('C5_EXECUTE') or die("Access Denied.");
$u = new User();
$form = Loader::helper('form');
$f = File::getByID($_REQUEST['fID']);
if (isset($_REQUEST['fvID'])) {
$fv = $f->getVersion($_REQUEST['fvID']);
} else {
$fv = $f->getApprovedVersion();
}
$fp = new Permissions($f);
if (!$fp->canRead()) {
die(t("Access Denied."));
}
?>
<div style="text-align: center">
<?
$to = $fv->getTypeObject();
if ($to->getPackageHandle() != '') {
Loader::packageElement('files/view/' . $to->getView(), $to->getPackageHandle(), array('fv' => $fv));
} else {
Loader::element('files/view/' . $to->getView(), array('fv' => $fv));
}
?>
</div>
<div class="dialog-buttons">
<form method="post" action="<?php
示例14: array
?>
</a>
<small><?php
echo $cat->getCollectionDescription();
?>
</small>
</h3>
</div>
<?php
$show = array();
$subcats = $cat->getCollectionChildrenArray(true);
foreach ($subcats as $catID) {
$subcat = Page::getByID($catID, 'ACTIVE');
$catp = new Permissions($subcat);
if ($catp->canRead() && $subcat->getAttribute('exclude_nav') != 1) {
$show[] = $subcat;
}
}
if (count($show) > 0) {
?>
<div class="clearfix">
<?php
foreach ($show as $subcat) {
?>
<div class="span4">
<a href="<?php
echo Loader::helper('navigation')->getLinkToCollection($cat);
示例15: finishLogin
//.........这里部分代码省略.........
}
}
}
if ($this->post('completePartialProfile')) {
foreach ($unfilledAttributes as $uak) {
$e1 = $uak->validateAttributeForm();
if ($e1 == false) {
$this->error->add(t('The field "%s" is required', $uak->getAttributeKeyName()));
} else {
if ($e1 instanceof ValidationErrorHelper) {
$this->error->add($e1);
}
}
}
if (!$this->error->has()) {
// the user has needed to complete a partial profile, and they have done so,
// and they have no errors. So we save our profile data against the account.
foreach ($unfilledAttributes as $uak) {
$uak->saveAttributeForm($ui);
$unfilledAttributes = array();
}
}
}
if (count($unfilledAttributes) > 0) {
$u->logout();
$this->set('invalidRegistrationFields', true);
$this->set('unfilledAttributes', $unfilledAttributes);
}
$txt = Loader::helper('text');
$rcID = $this->post('rcID');
$nh = Loader::helper('validation/numbers');
//set redirect url
if ($nh->integer($rcID)) {
$nh = Loader::helper('navigation');
$rc = Page::getByID($rcID);
$url = $nh->getLinkToCollection($rc, true);
$loginData['redirectURL'] = $url;
} elseif (strlen($rcID)) {
$rcID = trim($rcID, '/');
$nc2 = Page::getByPath('/' . $rcID);
if (is_object($nc2) && !$nc2->isError()) {
$loginData['redirectURL'] = BASE_URL . DIR_REL . '/' . DISPATCHER_FILENAME . '/' . $rcID;
}
}
/*
//full page login redirect (non-ajax login)
if( strlen($loginData['redirectURL']) && $_REQUEST['format']!='JSON' ){
header('Location: ' . $loginData['redirectURL']);
exit;
}
*/
$dash = Page::getByPath("/dashboard", "RECENT");
$dbp = new Permissions($dash);
Events::fire('on_user_login', $this);
//End JSON Login
if ($_REQUEST['format'] == 'JSON') {
return $loginData;
}
//should administrator be redirected to dashboard? defaults to yes if not set.
$adminToDash = intval(Config::get('LOGIN_ADMIN_TO_DASHBOARD'));
//Full page login, standard redirection
$u = new User();
// added for the required registration attribute change above. We recalc the user and make sure they're still logged in
if ($u->isRegistered()) {
if ($u->config('NEWSFLOW_LAST_VIEWED') == 'FIRSTRUN') {
$u->saveConfig('NEWSFLOW_LAST_VIEWED', 0);
}
if ($loginData['redirectURL']) {
//make double secretly sure there's no caching going on
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");
header('Expires: Fri, 30 Oct 1998 14:19:41 GMT');
//in the past
$this->externalRedirect($loginData['redirectURL']);
} else {
if ($dbp->canRead() && $adminToDash) {
$this->redirect('/dashboard');
} else {
//options set in dashboard/users/registration
$login_redirect_cid = intval(Config::get('LOGIN_REDIRECT_CID'));
$login_redirect_mode = Config::get('LOGIN_REDIRECT');
//redirect to user profile
if ($login_redirect_mode == 'PROFILE' && ENABLE_USER_PROFILES) {
$this->redirect('/profile/', $u->uID);
//redirect to custom page
} elseif ($login_redirect_mode == 'CUSTOM' && $login_redirect_cid > 0) {
$redirectTarget = Page::getByID($login_redirect_cid);
if (intval($redirectTarget->cID) > 0) {
$this->redirect($redirectTarget->getCollectionPath());
} else {
$this->redirect('/');
}
//redirect home
} else {
$this->redirect('/');
}
}
}
}
}