本文整理汇总了PHP中Permissions::canAdminPage方法的典型用法代码示例。如果您正苦于以下问题:PHP Permissions::canAdminPage方法的具体用法?PHP Permissions::canAdminPage怎么用?PHP Permissions::canAdminPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Permissions
的用法示例。
在下文中一共展示了Permissions::canAdminPage方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkSSL
public function checkSSL()
{
if ($this->requireSSL == 1) {
global $c;
$cp = new Permissions($c);
if (isset($cp)) {
if (!$cp->canWrite() && !$cp->canAddSubContent() && !$cp->canAdminPage() && !$cp->canApproveCollection()) {
if ($_SERVER['HTTPS'] != "on") {
$redirect = "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
header("Location:{$redirect}");
}
}
}
}
}
示例2: t
} else {
$error = false;
}
}
if (!$error) {
if ($_REQUEST['ctask']) {
if ($valt->validate()) {
switch($_REQUEST['ctask']) {
case "ALIAS":
$ncID = $oc->addCollectionAlias($dc);
$successMessage = '"' . $oc->getCollectionName() . '" '.t('was successfully aliased beneath').' "' . $dc->getCollectionName() . '"';
$newCID = $ncID;
break;
case "COPY":
if ($_REQUEST['copyAll'] && $dcp->canAdminPage()) {
$nc2 = $oc->duplicateAll($dc); // new collection is passed back
if (is_object($nc2)) {
$successMessage = '"' . $oc->getCollectionName() . '" '.t('and all its children were successfully copied beneath').' "' . $dc->getCollectionName() . '"';
}
} else {
$nc2 = $oc->duplicate($dc);
if (is_object($nc2)) {
$successMessage = '"' . $oc->getCollectionName() . '" '.t('was successfully copied beneath').' "' . $dc->getCollectionName() . '"';
}
}
if (!is_object($nc2)) {
$error = t("An error occurred while attempting the copy operation.");
} else {
$newCID = $nc2->getCollectionID();
}
示例3: die
<?
defined('C5_EXECUTE') or die("Access Denied.");
Loader::model('collection_types');
$stringHelper=Loader::helper('text');
$tArray = PageTheme::getGlobalList();
$tArray2 = PageTheme::getLocalList();
$tArray = array_merge($tArray, $tArray2);
$ctArray = CollectionType::getList($c->getAllowedSubCollections());
$cp = new Permissions($c);
if ($c->getCollectionID() > 1) {
$parent = Page::getByID($c->getCollectionParentID());
$parentCP = new Permissions($parent);
}
if (!$cp->canAdminPage()) {
die(t('Access Denied'));
}
$cnt = 0;
for ($i = 0; $i < count($ctArray); $i++) {
$ct = $ctArray[$i];
if ($c->getCollectionID() == 1 || $parentCP->canAddSubCollection($ct)) {
$cnt++;
}
}
$plID = $c->getCollectionThemeID();
$ctID = $c->getCollectionTypeID();
if ($plID == 0) {
$pl = PageTheme::getSiteTheme();
示例4: t
$pendingAction = $c->getPendingAction();
if ($pendingAction == 'MOVE') {
$statusMessage .= $statusMessage ? " | " : "";
$statusMessage .= t("This page is being moved.");
if ($cp->canApproveCollection() && (!$c->isCheckedOut() || $c->isCheckedOut() && $c->isEditMode())) {
$statusMessage .= "<br/><a href='" . DIR_REL . "/" . DISPATCHER_FILENAME . "?cID=" . $c->getCollectionID() . "&ctask=approve_pending_action'>" . t('Approve Move') . "</a> | <a href='" . DIR_REL . "/" . DISPATCHER_FILENAME . "?cID=" . $c->getCollectionID() . "&ctask=clear_pending_action" . $token . "'>" . t('Cancel') . "</a>";
}
} else {
if ($pendingAction == 'DELETE') {
$statusMessage .= $statusMessage ? "<br/>" : "";
$statusMessage .= t("This page is marked for removal.");
$children = $c->getNumChildren();
if ($children > 0) {
$pages = $children + 1;
$statusMessage .= " " . t('This will remove %s pages.', $pages);
if ($cp->canAdminPage()) {
$statusMessage .= " <a href='" . DIR_REL . "/" . DISPATCHER_FILENAME . "?cID=" . $c->getCollectionID() . "&ctask=approve_pending_action" . $token . "'>" . t('Approve Delete') . "</a> | <a href='" . DIR_REL . "/" . DISPATCHER_FILENAME . "?cID=" . $c->getCollectionID() . "&ctask=clear_pending_action" . $token . "'>" . t('Cancel') . "</a>";
} else {
$statusMessage .= " " . t('Only administrators can approve a multi-page delete operation.');
}
} else {
if ($children == 0 && $cp->canApproveCollection() && (!$c->isCheckedOut() || $c->isCheckedOut() && $c->isEditMode())) {
$statusMessage .= " <a href='" . DIR_REL . "/" . DISPATCHER_FILENAME . "?cID=" . $c->getCollectionID() . "&ctask=approve_pending_action" . $token . "'>" . t('Approve Delete') . "</a> | <a href='" . DIR_REL . "/" . DISPATCHER_FILENAME . "?cID=" . $c->getCollectionID() . "&ctask=clear_pending_action" . $token . "'>" . t('Cancel') . "</a>";
}
}
}
}
}
if ($c->isMasterCollection()) {
$statusMessage .= $statusMessage ? "<br/>" : "";
$statusMessage .= t('Page Defaults for') . ' "' . $c->getCollectionTypeName() . '" ' . t("page type");
示例5: Permissions
$c = Page::getByID($_GET['cID'], 'RECENT');
$cp = new Permissions($c);
$canViewPane = false;
$additionalArgs = array();
switch ($_GET['ctask']) {
case 'edit_metadata':
$toolSection = "collection_metadata";
$canViewPane = $cp->canWrite();
break;
case 'edit_permissions':
if (PERMISSIONS_MODEL == 'simple') {
$toolSection = 'collection_permissions_simple';
} else {
$toolSection = "collection_permissions";
}
$canViewPane = $cp->canAdminPage();
break;
case 'edit_permissions_composer':
$toolSection = "collection_permissions";
$canViewPane = $cp->canAdminPage();
$additionalArgs['isComposer'] = true;
break;
case 'mcd':
$toolSection = "collection_mcd";
$canViewPane = $cp->canWrite();
$divID = "ccm-collection-mcd";
break;
case 'set_theme':
$toolSection = "collection_theme";
$divID = 'ccm-edit-collection-design';
$canViewPane = $cp->canWrite();
示例6: render
//.........这里部分代码省略.........
if ($view instanceof Page) {
$_pageBlocks = $view->getBlocks();
$_pageBlocksGlobal = $view->getGlobalBlocks();
$_pageBlocks = array_merge($_pageBlocks, $_pageBlocksGlobal);
if ($view->supportsPageCache($_pageBlocks, $this->controller)) {
$pageContent = $view->getFromPageCache();
if ($pageContent != false) {
Events::fire('on_before_render', $this);
if (defined('APP_CHARSET')) {
header("Content-Type: text/html; charset=" . APP_CHARSET);
}
print($pageContent);
Events::fire('on_render_complete', $this);
if (ob_get_level() == OB_INITIAL_LEVEL) {
require(DIR_BASE_CORE . '/startup/shutdown.php');
exit;
}
return;
}
}
foreach($_pageBlocks as $b1) {
$btc = $b1->getInstance();
// now we inject any custom template CSS and JavaScript into the header
if('Controller' != get_class($btc)){
$btc->outputAutoHeaderItems();
}
$btc->runTask('on_page_view', array($view));
}
// do we have any custom menu plugins?
$cp = new Permissions($view);
if ($cp->canWrite() || $cp->canAddSubContent() || $cp->canAdminPage() || $cp->canApproveCollection()) {
$ih = Loader::helper('concrete/interface/menu');
$_interfaceItems = $ih->getPageHeaderMenuItems();
foreach($_interfaceItems as $_im) {
$_controller = $_im->getController();
$_controller->outputAutoHeaderItems();
}
unset($_interfaceItems);
unset($_im);
unset($_controller);
}
unset($_interfaceItems);
unset($_im);
unset($_controller);
// now, we output all the custom style records for the design tab in blocks/areas on the page
$c = $this->getCollectionObject();
$view->outputCustomStyleHeaderItems();
}
// finally, we include the theme (which was set by setTheme and will automatically include innerContent)
// disconnect from our db and exit
$this->controller->on_before_render();
extract($this->controller->getSets());
extract($this->controller->getHelperObjects());
if ($content != false) {
include($content);
}
$innerContent = ob_get_contents();
示例7: canAdminBlock
function canAdminBlock()
{
$oObj = $this->getOriginalObject();
$c = is_a($oObj, 'Area') ? $oObj->getAreaCollectionObject() : $oObj->getBlockCollectionObject();
$c->loadVersionObject('RECENT');
$cp = new Permissions($c);
return $cp->canAdminPage();
}
示例8: copy_tree
public function copy_tree()
{
set_time_limit(0);
if (Loader::helper('validation/token')->validate('copy_tree')) {
if ($this->post('copyTreeFrom') && $this->post('copyTreeTo') && $this->post('copyTreeFrom') != $this->post('copyTreeTo')) {
$dc = Page::getByID($this->post('copyTreeTo'));
$oc = Page::getByID($this->post('copyTreeFrom'));
$dcp = new Permissions($dc);
$ocp = new Permissions($oc);
if (!$dcp->canAdminPage()) {
$this->error->add(t('You must have admin privileges on the destination page to perform this action.'));
}
if (!$ocp->canRead()) {
$this->error->add(t('You cannot read the original page.'));
}
if (!$this->error->has()) {
// duplicate all into the new node
$ms = MultilingualSection::getByID($this->post('copyTreeTo'));
$this->populateCopyArray($oc);
$aliases = array();
$created = array();
foreach ($this->pagesToCopy as $cc) {
$trcID = $ms->getTranslatedPageID($cc);
if (!$trcID) {
// this page doesn't exist in the new tree. So we need to duplicate it over there
// find where this page is going
$ccp = Page::getByID($cc->getCollectionParentID(), 'RECENT');
$trpcID = $ms->getTranslatedPageID($ccp);
$dest = Page::getByID($trpcID);
if ($cc->isAlias()) {
$aliases[] = array($cc->getCollectionID(), $dest->getCollectionID());
} else {
$newPage = $cc->duplicate($dest);
$ceated[$cc->getCollectionID()] = $newPage->getCollectionID();
}
} else {
if ($cc->isAlias()) {
$aliases[] = array($cc->getCollectionID(), false);
} else {
$created[$cc->getCollectionID()] = $trcID;
}
}
}
foreach ($aliases as $data) {
list($cID, $dest) = $data;
$cc = Page::getByID($cID);
if ($dest === false) {
$ccp = Page::getByID($cc->getCollectionParentID(), 'RECENT');
$dest = $ms->getTranslatedPageID($ccp);
}
if (isset($created[$cID])) {
$dest = $created[$cID];
}
$aliasID = $cc->addCollectionAlias(Page::getByID($dest));
}
$this->redirect('/dashboard/multilingual/setup', 'tree_copied');
}
} else {
$this->error->add(t('You must choose two separate, valid language sections.'));
}
} else {
$this->error->add(Loader::helper('validation/token')->getErrorMessage());
}
$this->view();
}
示例9: die
<?php
defined('C5_EXECUTE') or die("Access Denied.");
?>
</div>
<?php
Loader::element('footer_required');
?>
<!-- Show hide the concrete5 toolbar -->
<?php
$cp = new Permissions($c);
if ($cp->canWrite() || $cp->canAddSubContent() || $cp->canAdminPage()) {
?>
<script>
var isBarVisible = false;
$(document).ready(function() {
$("#ccm-page-controls-wrapper").stop(true, true).hide();
$("body").append("<div style='padding:5px;text-align:center;background-color:#335B8A; position:fixed;top:82px;right:50px;color:white; border-bottom-left-radius: 4px; border-top-left-radius: 4px; border-bottom-right-radius: 4px; border-top-right-radius: 4px; z-index: 900; '><a style='padding:0;margin:0;line-height:100%;' href='javascript:;' id='c5showhidebarr'><span class='fa fa-pencil' style='color:white;' id='c5showhidebarrtxt'>Show edit bar</span></a>");
$("#c5showhidebarr").click(function() {
if(isBarVisible){
$("#ccm-page-controls-wrapper").stop(true, true).hide(200);
$("#c5showhidebarrtxt").text("Show edit bar");
}
else{
$("#ccm-page-controls-wrapper").stop(true, true).show(200);
$("#c5showhidebarrtxt").text("Hide edit bar");
}
isBarVisible = !isBarVisible;
示例10: t
<div>
<strong class="important"><?php echo t('DELETION')?></strong>
<?php echo t('(Marked by: <strong>%s</strong> on <strong>%s</strong>)',$ud->getUserName(), date(DATE_APP_PAGE_VERSIONS, strtotime($c->getPendingActionDateTime())))?>
</div>
<?php if ($cp->canApproveCollection()) { ?>
<?php if ($children == 0) { ?>
<div class="ccm-buttons">
<a href="<?php echo REL_DIR_FILES_TOOLS_REQUIRED?>/versions.php?cID=<?php echo $cID?>&ctask=approve_pending_action<?php echo $token?>" class="ccm-button-right accept" onclick="return ccm_runAction(this)"><span><?php echo t('Approve')?></span></a>
<a href="<?php echo REL_DIR_FILES_TOOLS_REQUIRED?>/versions.php?cID=<?php echo $cID?>&ctask=clear_pending_action<?php echo $token?>" class="ccm-button-left cancel" onclick="return ccm_runAction(this)"><span><em class="ccm-button-close"><?php echo t('Deny')?></em></span></a>
</div>
<?php } else if ($children > 0) { ?>
<?php echo t('This will remove %s pages.',$pages)?>
<?php if (!$cp->canAdminPage()) { ?>
<?php echo t('Only the super user may remove multiple pages.')?><br>
<div class="ccm-buttons">
<a href="<?php echo REL_DIR_FILES_TOOLS_REQUIRED?>/versions.php?cID=<?php echo $cID?>&ctask=clear_pending_action<?php echo $token?>" class="ccm-button-left cancel" onclick="return ccm_runAction(this)"><span><em class="ccm-button-close"><?php echo t('Deny')?></em></span></a>
</div>
<?php } else { ?>
<div class="ccm-buttons">
<a href="<?php echo REL_DIR_FILES_TOOLS_REQUIRED?>/versions.php?cID=<?php echo $cID?>&ctask=approve_pending_action<?php echo $token?>" class="ccm-button-right accept" onclick="return ccm_runAction(this)"><span><?php echo t('Approve')?></span></a>
<a href="<?php echo REL_DIR_FILES_TOOLS_REQUIRED?>/versions.php?cID=<?php echo $cID?>&ctask=clear_pending_action<?php echo $token?>" class="ccm-button-left cancel" onclick="return ccm_runAction(this)"><span><em class="ccm-button-close"><?php echo t('Deny')?></em></span></a>
</div>
<?php } ?>
<?php } ?>
<?php } ?>
示例11: t
echo t('Version History');
?>
" href="<?php
echo REL_DIR_FILES_TOOLS_REQUIRED;
?>
/versions.php?rel=SITEMAP&cID=<?php
echo $stack->getCollectionID();
?>
"><?php
echo t('Version History');
?>
</a>
<? $cpc = new Permissions($stack); ?>
<? if ($cpc->canAdminPage() && PERMISSIONS_MODEL == 'advanced') { ?>
<a class="btn small ccm-main-nav-edit-option" dialog-width="580" dialog-append-buttons="true" dialog-height="420" dialog-title="<?php
echo t('Stack Permissions');
?>
" id="stackPermissions" href="<?php
echo REL_DIR_FILES_TOOLS_REQUIRED;
?>
/edit_area_popup.php?cID=<?php
echo $stack->getCollectionID();
?>
&arHandle=Main&atask=groups"><?php
echo t('Permissions');
?>
</a>
<? } ?>
示例12: User
$u = new User();
$form = Loader::helper('form');
$sh = Loader::helper('concrete/dashboard/sitemap');
if (!$sh->canRead()) {
die(t('Access Denied'));
}
if ($_POST['task'] == 'delete_pages') {
$json['error'] = false;
if (is_array($_POST['cID'])) {
foreach($_POST['cID'] as $cID) {
$c = Page::getByID($cID);
$cp = new Permissions($c);
$children = $c->getNumChildren();
if ($children == 0 || $cp->canAdminPage()) {
$c->markPendingAction('DELETE');
if ($cp->canApproveCollection()) {
$c->delete();
}
} else {
$json['error'] = t('Unable to delete one or more pages.');
}
}
}
$js = Loader::helper('json');
print $js->encode($json);
exit;
}