Пример #1
0
if (isset($_REQUEST['origCID']) && strpos($_REQUEST['origCID'], ',') > -1) {
    $ocs = explode(',', $_REQUEST['origCID']);
    foreach ($ocs as $ocID) {
        $originalPages[] = Page::getByID($ocID);
    }
}
foreach ($originalPages as $oc) {
    $ocp = new Permissions($oc);
    if (!$ocp->canRead()) {
        $canReadSource = false;
    }
    if (!$ocp->canMoveOrCopyPage()) {
        $canMoveCopyPages = false;
    }
    $ct = PageType::getByID($oc->getPageTypeID());
    if (!$dcp->canAddSubpage($ct)) {
        $canAddSubContent = false;
    }
    if (!$oc->canMoveCopyTo($dc)) {
        $canMoveCopyTo = false;
    }
    if (!$u->isSuperUser() || $oc->getCollectionPointerID() > 0) {
        $canCopyChildren = false;
    }
}
if (is_object($dc) && !$dc->isError() && $dc->isAlias()) {
    $canMoveCopyTo = false;
}
$valt = Loader::helper('validation/token');
$json = array();
$json['error'] = false;
Пример #2
0
    foreach ($pages as $cobj) {
        $cpobj = new Permissions($cobj);
        if (!isset($striped) || $striped == 'ccm-list-record-alt') {
            $striped = '';
        } else {
            if ($striped == '') {
                $striped = 'ccm-list-record-alt';
            }
        }
        $canEditPageProperties = $cpobj->canEditPageProperties();
        $canEditPageSpeedSettings = $cpobj->canEditPageSpeedSettings();
        $canEditPagePermissions = $cpobj->canEditPagePermissions();
        $canEditPageDesign = $cpobj->canEditPageTheme() || $cpobj->canEditPageType();
        $canViewPageVersions = $cpobj->canViewPageVersions();
        $canDeletePage = $cpobj->canDeletePage();
        $canAddSubpages = $cpobj->canAddSubpage();
        $canAddExternalLinks = $cpobj->canAddExternalLink();
        $permissionArray = array('canEditPageProperties' => $canEditPageProperties, 'canEditPageSpeedSettings' => $canEditPageSpeedSettings, 'canEditPagePermissions' => $canEditPagePermissions, 'canEditPageDesign' => $canEditPageDesign, 'canViewPageVersions' => $canViewPageVersions, 'canDeletePage' => $canDeletePage, 'canAddSubpages' => $canAddSubpages, 'canAddExternalLinks' => $canAddExternalLinks);
        $canCompose = false;
        $ct = CollectionType::getByID($cobj->getCollectionTypeID());
        if (is_object($ct)) {
            if ($ct->isCollectionTypeIncludedInComposer()) {
                if ($canEditPageProperties && $h->canAccessComposer()) {
                    $canCompose = 1;
                }
            }
        }
        ?>
			<tr class="ccm-list-record <?php 
        echo $striped;
        ?>
Пример #3
0
 function getNode($cItem, $level = 0, $autoOpenNodes = true)
 {
     if (!is_object($cItem)) {
         $cID = $cItem;
         $c = Page::getByID($cID, 'RECENT');
     } else {
         $cID = $cItem->getCollectionID();
         $c = $cItem;
     }
     $cp = new Permissions($c);
     $canEditPageProperties = $cp->canEditPageProperties();
     $canEditPageSpeedSettings = $cp->canEditPageSpeedSettings();
     $canEditPagePermissions = $cp->canEditPagePermissions();
     $canEditPageDesign = $cp->canEditPageTheme() || $cp->canEditPageType();
     $canViewPageVersions = $cp->canViewPageVersions();
     $canDeletePage = $cp->canDeletePage();
     $canAddSubpages = $cp->canAddSubpage();
     $canAddExternalLinks = $cp->canAddExternalLink();
     $nodeOpen = false;
     if (is_array($_SESSION['dsbSitemapNodes'])) {
         if (in_array($cID, $_SESSION['dsbSitemapNodes'])) {
             $nodeOpen = true;
         }
     }
     $status = '';
     $cls = $c->getNumChildren() > 0 ? "folder" : "file";
     $leaf = $c->getNumChildren() > 0 ? false : true;
     $numSubpages = $c->getNumChildren() > 0 ? $c->getNumChildren() : '';
     $cvName = $c->getCollectionName() ? $c->getCollectionName() : '(No Title)';
     $cvName = $c->isSystemPage() ? t($cvName) : $cvName;
     $selected = ConcreteDashboardSitemapHelper::isOneTimeActiveNode($cID) ? true : false;
     $ct = CollectionType::getByID($c->getCollectionTypeID());
     $isInTrash = $c->isInTrash();
     $canCompose = false;
     if (is_object($ct)) {
         if ($ct->isCollectionTypeIncludedInComposer()) {
             $h = Loader::helper('concrete/dashboard');
             if ($cp->canEditPageProperties() && $h->canAccessComposer()) {
                 $canCompose = true;
             }
         }
     }
     $isTrash = $c->getCollectionPath() == TRASH_PAGE_PATH;
     if ($isTrash || $isInTrash) {
         $pk = PermissionKey::getByHandle('empty_trash');
         if (!$pk->validate()) {
             return false;
         }
     }
     $cIcon = $c->getCollectionIcon();
     $cAlias = $c->isAlias();
     $cPointerID = $c->getCollectionPointerID();
     if ($cAlias) {
         if ($cPointerID > 0) {
             $cIcon = ASSETS_URL_IMAGES . '/icons/alias.png';
             $cAlias = 'POINTER';
             $cID = $c->getCollectionPointerOriginalID();
         } else {
             $cIcon = ASSETS_URL_IMAGES . '/icons/alias_external.png';
             $cAlias = 'LINK';
         }
     }
     $node = array('cvName' => $cvName, 'cIcon' => $cIcon, 'cAlias' => $cAlias, 'isInTrash' => $isInTrash, 'isTrash' => $isTrash, 'numSubpages' => $numSubpages, 'status' => $status, 'canEditPageProperties' => $canEditPageProperties, 'canEditPageSpeedSettings' => $canEditPageSpeedSettings, 'canEditPagePermissions' => $canEditPagePermissions, 'canEditPageDesign' => $canEditPageDesign, 'canViewPageVersions' => $canViewPageVersions, 'canDeletePage' => $canDeletePage, 'canAddSubpages' => $canAddSubpages, 'canAddExternalLinks' => $canAddExternalLinks, 'canCompose' => $canCompose, 'id' => $cID, 'selected' => $selected);
     if ($cID == 1 || $nodeOpen && $autoOpenNodes) {
         // We open another level
         $node['subnodes'] = $this->getSubNodes($cID, $level, false, $autoOpenNodes);
     }
     return $node;
 }
Пример #4
0
	
	}
</script>



<? } else {


$ctArray = CollectionType::getList();
$cp = new Permissions($c);

$cnt = 0;
for ($i = 0; $i < count($ctArray); $i++) {
	$ct = $ctArray[$i];
	if ($cp->canAddSubpage($ct)) { 
		$cnt++;
	}
}

?>
		<div id="ccm-choose-pg-type">
			<h4 id="ccm-choose-pg-type-title"><?php 
echo t('Choose a Page Type');
?>
</h4>
			<ul id="ccm-select-page-type">
				<? 
				foreach($ctArray as $ct) { 
					if ($cp->canAddSubpage($ct)) { 
					$requiredKeys=array();
Пример #5
0
     $canViewPane = $cp->canMoveOrCopyPage();
     $divID = "ccm-collection-mcd";
     break;
 case 'delete':
     $toolSection = "collection_delete";
     $canViewPane = $cp->canDeletePage();
     break;
 case 'set_theme':
     $toolSection = "collection_theme";
     $divID = 'ccm-edit-collection-design';
     $canViewPane = $cp->canEditPageTheme() || $cp->canEditPageType();
     break;
 case 'add':
     $toolSection = "collection_add";
     $divID = 'ccm-edit-collection-design';
     $canViewPane = $cp->canAddSubpage();
     if ($_REQUEST['ctID']) {
         $ct = CollectionType::getByID($_REQUEST['ctID']);
         if (!is_object($ct)) {
             $canViewPane = false;
         } else {
             $canViewPane = $cp->canAddSubCollection($ct);
         }
     }
     break;
 case 'add_external':
     $toolSection = "collection_add_external";
     $divID = 'ccm-edit-collection-external';
     $canViewPane = $cp->canAddExternalLink();
     break;
 case 'delete_external':
Пример #6
0
?>
?cID=<?php 
echo $c->getCollectionID();
?>
&ctask=check-out<?php 
echo $token;
?>
<? } else { ?>javascript:void(0);<? } ?>" class="btn primary <? if ($cantCheckOut) { ?> disabled <? } ?> launch-tooltip" <? if ($cantCheckOut) { ?>title="<?php 
echo t('Someone has already checked this page out for editing.');
?>
"<? } ?>><?php 
echo t('Edit this Page');
?>
</a>';
<? } ?>
<? if ($cp->canAddSubpage()) { ?>
	menuHTML += '<a id="ccm-toolbar-add-subpage" dialog-width="645" dialog-modal="false" dialog-append-buttons="true" dialog-height="345" dialog-title="<?php 
echo t('Add a Sub-Page');
?>
" href="<?php 
echo REL_DIR_FILES_TOOLS_REQUIRED;
?>
/edit_collection_popup.php?cID=<?php 
echo $cID;
?>
&ctask=add"class="btn"><?php 
echo t('Add a Sub-Page');
?>
</a>';
<? } ?>
menuHTML += '</div>';
Пример #7
0
 protected function validate()
 {
     $vt = Loader::helper('validation/strings');
     $vn = Loader::Helper('validation/numbers');
     $dt = Loader::helper("form/date_time");
     if (!$vn->integer($this->post('cParentID'))) {
         $this->error->add(t('You must choose a parent page for this blog entry.'));
     }
     if (!$vt->notempty($this->post('blogTitle'))) {
         $this->error->add(t('Title is required'));
     }
     if (!$this->get('sections')) {
         $this->error->add(t('You must have at least one page in your website designated as a "blog section".'));
     }
     Loader::model("attribute/categories/collection");
     $akct = CollectionAttributeKey::getByHandle('blog_category');
     $ctKey = $akct->getAttributeKeyID();
     foreach ($this->post(akID) as $key => $value) {
         if ($key == $ctKey) {
             foreach ($value as $type => $values) {
                 if ($type == 'atSelectNewOption') {
                     foreach ($values as $cat => $valued) {
                         if ($valued == '') {
                             $this->error->add(t('Categories must have a value'));
                         }
                     }
                 }
             }
         }
     }
     if (!$this->error->has()) {
         $parent = Page::getByID($this->post('cParentID'));
         $cmp = new \Permissions($parent);
         $parentPermissions = $cmp->canAddSubpage();
         if (!$parentPermissions) {
             $this->error->add(t('You do not have permission to add a page of that type to that area of the site.'));
         }
     }
 }
Пример #8
0
 public function validate($error)
 {
     $vt = Loader::helper('validation/strings');
     $vn = Loader::Helper('validation/numbers');
     $dt = Loader::helper("form/date_time");
     //$er = Loader::helper('validation/error');
     if (!$vn->integer($_REQUEST['cParentID'])) {
         $error->add(t('You must choose a parent page for this blog entry.'));
     }
     if (!$vt->notempty($_REQUEST['blogTitle'])) {
         $error->add(t('Title is required'));
     }
     Loader::model("attribute/categories/collection");
     $akct = CollectionAttributeKey::getByHandle('blog_category');
     $ctKey = $akct->getAttributeKeyID();
     foreach ($_REQUEST['akID'] as $key => $value) {
         if ($key == $ctKey) {
             foreach ($value as $type => $values) {
                 if ($type == 'atSelectNewOption') {
                     foreach ($values as $cat => $valued) {
                         if ($valued == '') {
                             $error->add(t('Categories must have a value'));
                         }
                     }
                 }
             }
         }
     }
     if (!$error->has()) {
         $parent = Page::getByID($_REQUEST['cParentID']);
         $cmp = new \Permissions($parent);
         $parentPermissions = $cmp->canAddSubpage();
         if (!$parentPermissions) {
             $error->add(t('You do not have permission to add a page of that type to that area of the site.'));
         }
     }
     return $error;
 }