Ejemplo n.º 1
0
                    </li>
                    <li><a dialog-width="640" dialog-height="340" class="dialog-launch" id="stackVersions" dialog-title="<?php 
        echo t('Version History');
        ?>
" href="<?php 
        echo URL::to('/ccm/system/panels/page/versions');
        ?>
?cID=<?php 
        echo $stackToEdit->getCollectionID();
        ?>
"><?php 
        echo t('Version History');
        ?>
</a></li>
                    <?php 
        if (!$isGlobalArea && $cpc->canEditPageProperties()) {
            ?>
                        <li><a href="<?php 
            echo $view->action('rename', $neutralStack->getCollectionID());
            ?>
"><?php 
            echo t('Rename');
            ?>
</a></li>
                    <?php 
        }
        ?>
                    <?php 
        if (!$isGlobalArea && $cpc->canEditPagePermissions() && Config::get('concrete.permissions.model') == 'advanced') {
            ?>
                        <li><a dialog-width="580" class="dialog-launch" dialog-append-buttons="true" dialog-height="420" dialog-title="<?php 
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
0
&arHandle=<?php 
    echo STACKS_AREA_NAME;
    ?>
&atask=paste&addOnly=0"><?php 
    echo t('Paste From Clipboard');
    ?>
</a></li>
			</ul>
		</div>
		
		<?php 
    $cpc = new Permissions($stack);
    ?>
		
		<?php 
    if ($cpc->canEditPageProperties()) {
        ?>
			<a class="btn small ccm-main-nav-edit-option"href="<?php 
        echo $this->action('rename', $stack->getCollectionID());
        ?>
"><?php 
        echo t('Rename');
        ?>
</a>
		<?php 
    }
    ?>
		
		<a class="btn small ccm-main-nav-edit-option" dialog-width="640" dialog-height="340" id="stackVersions" dialog-title="<?php 
    echo t('Version History');
    ?>
                                       dialog-modal="false" dialog-title="<?php 
            echo t('Composer');
            ?>
" href="<?php 
            echo URL::to('/ccm/system/panels/details/page/composer');
            ?>
?cID=<?php 
            echo $cID;
            ?>
"><?php 
            echo t('Composer');
            ?>
</a></li>
                            <?php 
        }
        if ($permissions->canEditPageProperties() || $permissions->canEditPageTheme() || $permissions->canEditPageTemplate() || $permissions->canDeletePage() || $permissions->canEditPagePermissions()) {
            ?>
                                <li><a class="dialog-launch" dialog-width="640" dialog-height="360"
                                       dialog-modal="false" dialog-title="<?php 
            echo t('SEO');
            ?>
" href="<?php 
            echo URL::to('/ccm/system/panels/details/page/seo');
            ?>
?cID=<?php 
            echo $cID;
            ?>
"><?php 
            echo t('SEO');
            ?>
</a></li>
Ejemplo n.º 5
0
        </li>

        <li><a dialog-width="640" dialog-height="340" class="dialog-launch" id="stackVersions" dialog-title="<?php 
echo t('Version History');
?>
" href="<?php 
echo URL::to('/ccm/system/panels/page/versions');
?>
?cID=<?php 
echo $stack->getCollectionID();
?>
"><?php 
echo t('Version History');
?>
</a></li>
        <? if ($cpc->canEditPageProperties() && $stack->getStackType() != \Concrete\Core\Page\Stack\Stack::ST_TYPE_GLOBAL_AREA) { ?>
            <li><a href="<?php 
echo $view->action('rename', $stack->getCollectionID());
?>
"><?php 
echo t('Rename');
?>
</a></li>
        <? } ?>
        <? if ($cpc->canEditPagePermissions() && Config::get('concrete.permissions.model') == 'advanced') { ?>
            <li><a dialog-width="580" class="dialog-launch" dialog-append-buttons="true" dialog-height="420" dialog-title="<?php 
echo t('Stack Permissions');
?>
" id="stackPermissions" href="<?php 
echo REL_DIR_FILES_TOOLS_REQUIRED;
?>
Ejemplo n.º 6
0
<?php

defined('C5_EXECUTE') or die("Access Denied.");
if (!Loader::helper('validation/numbers')->integer($_GET['cID'])) {
    die(t('Access Denied'));
}
$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->canEditPageProperties();
        break;
    case 'edit_speed_settings':
        $toolSection = "collection_speed_settings";
        $canViewPane = $cp->canEditPageSpeedSettings();
        break;
    case 'edit_permissions':
        if (PERMISSIONS_MODEL == 'simple') {
            $toolSection = 'collection_permissions_simple';
        } else {
            $toolSection = "permission/lists/collection";
        }
        $canViewPane = $cp->canEditPagePermissions();
        break;
    case 'set_advanced_permissions':
        $toolSection = "permission/details/collection";
        $canViewPane = $cp->canEditPagePermissions();
        break;
Ejemplo n.º 7
0
    ?>

		</tr>
	<?php 
    $h = Loader::helper('concrete/dashboard');
    $dsh = Loader::helper('concrete/dashboard/sitemap');
    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;
                }
        if ($cp->canEditPageProperties($ak)) {
            $ak->saveAttributeForm($c);
            $c->reindex();
        }
    }
    $val = $c->getAttributeValueObject($ak);
    print $val->getValue('display');
    exit;
}
if ($_POST['task'] == 'clear_extended_attribute') {
    $cakID = $_REQUEST['cakID'];
    $value = '';
    $ak = CollectionAttributeKey::get($cakID);
    foreach ($pages as $c) {
        $cp = new Permissions($c);
        if ($cp->canEditPageProperties($ak)) {
            $c->clearAttribute($ak);
            $c->reindex();
        }
    }
    print '<div class="ccm-attribute-field-none">' . t('None') . '</div>';
    exit;
}
function printAttributeRow($ak)
{
    global $pages, $form;
    $value = '';
    for ($i = 0; $i < count($pages); $i++) {
        $lastValue = $value;
        $c = $pages[$i];
        $vo = $c->getAttributeValueObject($ak);
Ejemplo n.º 9
0
     switch ($cp->getError()) {
         case COLLECTION_FORBIDDEN:
             $v = View::getInstance();
             $v->setCollectionObject($c);
             $v->render('/page_forbidden');
             break;
     }
 }
 if (!$c->isActive() && !$cp->canViewPageVersions()) {
     $v = View::getInstance();
     $v->render('/page_not_found');
 }
 ## If there's no error, then we build the collection, but first we load it with the appropriate
 ## version. We pass the function the collection object, as well as the collection permissions
 ## object, which the function will use to determine what version we get to see
 if ($cp->canEditPageContents() || $cp->canEditPageProperties() || $cp->canViewPageVersions()) {
     $cvID = $_REQUEST['cvID'] ? $_REQUEST['cvID'] : "RECENT";
     $c->loadVersionObject($cvID);
 }
 $vp = new Permissions($c->getVersionObject());
 if ($_REQUEST['ccm-disable-controls'] == true || intval($cvID) > 0) {
     $v = View::getInstance();
     $v->disableEditing();
     $v->disableLinks();
 }
 // returns the $vp object, which we then check
 if (is_object($vp) && $vp->isError()) {
     // if we've gotten an error getting information about this particular collection
     // than we load up the Content class, and get prepared to fire away
     switch ($vp->getError()) {
         case COLLECTION_NOT_FOUND:
Ejemplo n.º 10
0
             href="<?= DIR_REL ?>/<?= DISPATCHER_FILENAME ?>?cID=<?= $c->getCollectionID() ?>&ctask=check-out<?= $token ?>"><?php echo t(
                 'Edit this Page') ?></a></li>
 <? } ?>
 <li class="parent-ul"><i class="fa fa-cog mobile-leading-icon"></i><a href="#"><?php echo t(
             'Page Properties') ?><i class="fa fa-caret-down"></i></a>
     <ul class="list-unstyled">
         <?
         $pagetype = PageType::getByID($c->getPageTypeID());
         if (is_object($pagetype) && $cp->canEditPageContents()) { ?>
             <li><a class="dialog-launch" dialog-width="640" dialog-height="640"
                    dialog-modal="false" dialog-title="<?= t('Composer') ?>" href="<?= URL::to(
                     '/ccm/system/panels/details/page/composer') ?>?cID=<?= $cID ?>"><?= t(
                         'Composer') ?></a></li>
         <?
         }
         if ($permissions->canEditPageProperties() ||
             $permissions->canEditPageTheme() ||
             $permissions->canEditPageTemplate() ||
             $permissions->canDeletePage() ||
             $permissions->canEditPagePermissions()) { ?>
             <li><a class="dialog-launch" dialog-width="640" dialog-height="360"
                    dialog-modal="false" dialog-title="<?= t('SEO') ?>" href="<?= URL::to(
                     '/ccm/system/panels/details/page/seo') ?>?cID=<?= $cID ?>"><?= t(
                         'SEO') ?></a></li>
         <?
         }
         if ($permissions->canEditPageProperties()) {
             if ($cID > 1) {
                 ?>
                 <li><a class="dialog-launch" dialog-width="500" dialog-height="500"
                        dialog-modal="false" dialog-title="<?= t('Location') ?>"
Ejemplo n.º 11
0
defined('C5_EXECUTE') or die("Access Denied.");
use Concrete\Core\Attribute\Set as AttributeSet;
$cp = new Permissions($c);
$pk = PermissionKey::getByHandle('edit_page_properties');
$pk->setPermissionObject($c);
$asl = $pk->getMyAssignment();
$seoSet = AttributeSet::getByHandle('seo');
?>
<section>
    <header><?php 
echo t('Page Settings');
?>
</header>
    <?php 
if ($cp->canEditPageContents() || $cp->canEditPageTheme() || $cp->canEditPageProperties() || $cp->canEditPageTemplate()) {
    ?>

    <menu class="ccm-panel-page-basics">
        <?php 
    $pagetype = PageType::getByID($c->getPageTypeID());
    if (is_object($pagetype) && $cp->canEditPageContents()) {
        ?>
            <li>
                <a href="#" data-launch-panel-detail="page-composer"
                   data-panel-detail-url="<?php 
        echo URL::to('/ccm/system/panels/details/page/composer');
        ?>
"
                   data-panel-transition="fade">
                    <?php 
Ejemplo n.º 12
0
menuHTML += '<?php 
echo t('Page last edited on %s', $c->getCollectionDateLastModified(DATE_APP_GENERIC_MDYT));
?>
';


<? } ?>

menuHTML += '</div>';

<? if (!$cantCheckOut) { ?>

menuHTML += '<div id="ccm-edit-overlay-footer">';
menuHTML += '<div class="ccm-edit-overlay-inner">';
menuHTML += '<ul>';
<? if ($cp->canEditPageProperties()) { ?>
	menuHTML += '<li><a class="ccm-menu-icon ccm-icon-properties" <? if (!$c->isCheckedOut()) { ?> dialog-on-close="ccm_sitemapExitEditMode(<?php 
echo $c->getCollectionID();
?>
)" <? } ?> id="ccm-toolbar-nav-properties" dialog-width="640" dialog-height="<? if ($cp->canApprovePageVersions() && (!$c->isEditMode())) { ?>450<? } else { ?>390<? } ?>" dialog-append-buttons="true" dialog-modal="false" dialog-title="<?php 
echo t('Page Properties');
?>
" href="<?php 
echo REL_DIR_FILES_TOOLS_REQUIRED;
?>
/edit_collection_popup.php?<? if ($cp->canApprovePageVersions() && (!$c->isEditMode())) { ?>approveImmediately=1<? } ?>&cID=<?php 
echo $c->getCollectionID();
?>
&ctask=edit_metadata"><?php 
echo t('Properties');
?>
Ejemplo n.º 13
0
 public function rename($cID)
 {
     $s = Stack::getByID($cID);
     if (is_object($s)) {
         $this->set('stack', $s);
     } else {
         throw new Exception(t('Invalid stack'));
     }
     $sps = new Permissions($s);
     if (!$sps->canEditPageProperties()) {
         $this->redirect('/dashboard/blocks/stacks', 'view_details', $cID);
     }
     if ($this->isPost()) {
         if (Loader::helper('validation/token')->validate('rename_stack')) {
             if (Loader::helper('validation/strings')->notempty($stackName = trim($this->post('stackName')))) {
                 $txt = Loader::helper('text');
                 $v = $s->getVersionToModify();
                 $v->update(array('cName' => $stackName, 'cHandle' => str_replace('-', PAGE_PATH_SEPARATOR, $txt->urlify($stackName))));
                 $u = new User();
                 $pkr = new ApproveStackPageWorkflowRequest();
                 $pkr->setRequestedPage($s);
                 $pkr->setRequestedVersionID($v->getVersionID());
                 $pkr->setRequesterUserID($u->getUserID());
                 $response = $pkr->trigger();
                 if ($response instanceof WorkflowProgressResponse) {
                     // we only get this response if we have skipped workflows and jumped straight in to an approve() step.
                     $this->redirect('/dashboard/blocks/stacks', 'stack_renamed', $cID);
                 } else {
                     $this->redirect('/dashboard/blocks/stacks', 'view_details', $cID, 'rename_saved');
                 }
             } else {
                 $this->error->add(t("The stack name cannot be empty."));
             }
         } else {
             $this->error->add(Loader::helper('validation/token')->getErrorMessage());
         }
     }
 }
Ejemplo n.º 14
0
<?php

defined('C5_EXECUTE') or die("Access Denied.");
$c = Page::getByID($_REQUEST['cID']);
$cp = new Permissions($c);
if (!$cp->canEditPageProperties() && !$cp->canEditPageContents()) {
    die(t("Access Denied."));
}
$v = CollectionVersion::get($c, "RECENT", true);
if ($cp->canApprovePageVersions()) {
    $approveChecked = "";
    if (isset($_SESSION['checkInApprove'])) {
        if ($_SESSION['checkInApprove'] == true) {
            $approveChecked = " checked";
        }
    }
}
Loader::element('pane_header', array('c' => $c));
?>
<div class="ccm-pane-controls">
    <div id="ccm-edit-collection">
        <form method="post" id="ccm-check-in" action="<?php 
echo DIR_REL;
?>
/<?php 
echo DISPATCHER_FILENAME;
?>
?cID=<?php 
echo $c->getCollectionID();
?>
&ctask=check-in">
Ejemplo n.º 15
0
    ?>
"
                   data-launch-panel-detail="page-design"
                   data-panel-detail-url="<?php 
    echo URL::to('/ccm/system/panels/details/page/preview');
    ?>
"
                   data-panel-transition="fade">
                    <?php 
    echo t('Design');
    ?>
                </a>
            </li>
        <?php 
}
if ($cp->canEditPageProperties() && is_object($seoSet)) {
    ?>
            <li>
                <a href="#" data-launch-panel-detail="page-seo"
                   data-panel-detail-url="<?php 
    echo URL::to('/ccm/system/panels/details/page/seo');
    ?>
"
                   data-panel-transition="fade">
                    <?php 
    echo t('SEO');
    ?>
                </a>
            </li>
        <?php 
}
    /**
     * @param Page|View|Collection $page
     * @param User $user
     */
    public static function handleRequest($page)
    {
        if (!is_object($page)) {
            return;
        }
        if (is_a($page, 'View')) {
            $page = $page->getCollectionObject();
        }
        if (!is_object($page) || !is_a($page, 'Collection') || $page->isError()) {
            return;
        }
        $db = Loader::db();
        $ak = null;
        $config = null;
        $rs = $db->Query('select * from atHandleHttpsConfig where akEnabled = 1');
        while ($row = $rs->FetchRow()) {
            $ak = CollectionAttributeKey::getByID($row['akID']);
            if (is_object($ak)) {
                $config = $row;
                break;
            }
        }
        $rs->Close();
        if (!is_object($ak)) {
            return;
        }
        $akPage = $page;
        for (;;) {
            $handling = $akPage->getAttribute($ak);
            if (!(is_string($handling) && strlen($handling))) {
                $handling = $row['akDefaultRequirement'];
                if (!(is_string($handling) && strlen($handling))) {
                    return;
                }
            }
            if ($handling !== self::SSLHANDLING_INHERIT) {
                break;
            }
            $cID = $akPage->getCollectionID();
            if (empty($cID) || $cID == HOME_CID) {
                break;
            }
            if (!is_a($akPage, 'Page')) {
                // Need to load the Page object associated to the Collection object we received
                $akPage = Page::getByID($cID, 'ACTIVE');
                if (!is_object($akPage)) {
                    break;
                }
            }
            $parentCID = $akPage->getCollectionParentID();
            if (empty($parentCID)) {
                break;
            }
            $akPage = Page::getByID($parentCID, 'ACTIVE');
            if (!is_object($akPage) || $akPage->isError()) {
                break;
            }
        }
        $switchTo = '';
        switch ($handling) {
            case self::SSLHANDLING_REQUIRE_HTTP:
                if (self::isHTTPSRequest()) {
                    $switchTo = 'http';
                }
                break;
            case self::SSLHANDLING_REQUIRE_HTTPS:
                if (!self::isHTTPSRequest()) {
                    $switchTo = 'https';
                }
        }
        if (!strlen($switchTo)) {
            return;
        }
        if (!$config['akRedirectEditors']) {
            $user = User::isLoggedIn() ? new User() : null;
            if (is_object($user) && $user->getUserID()) {
                if (is_a($page, 'Collection')) {
                    $page = Page::getByID($page->getCollectionID());
                }
                $pp = new Permissions($page);
                if (!$pp->isError()) {
                    if ($pp->canEditPageContents() || $pp->canEditPageProperties()) {
                        return;
                    }
                }
            }
        }
        $finalURL = '';
        if ($config['akCustomDomains']) {
            switch ($switchTo) {
                case 'http':
                    $finalURL = $config['akHTTPDomain'];
                    break;
                case 'https':
                    $finalURL = $config['akHTTPSDomain'];
                    break;
            }
        }
        if (!strlen($finalURL)) {
            $finalURL = $switchTo . '://' . self::getRequestDomain();
        }
        $request = Request::get();
        $finalURL = rtrim($finalURL, '/') . trim(DIR_REL, '/') . '/' . @ltrim($request->getRequestPath(), '/');
        if (isset($_SERVER) && is_array($_SERVER) && array_key_exists('QUERY_STRING', $_SERVER) && is_string($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING'])) {
            $finalURL .= '?' . $_SERVER['QUERY_STRING'];
        }
        @ob_clean();
        if (!isset($_POST) || !is_array($_POST) || empty($_POST)) {
            header('Location: ' . $finalURL);
        } else {
            ?>
<!doctype html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=<?php 
            echo h(APP_CHARSET);
            ?>
">
        <meta charset="<?php 
            echo h(APP_CHARSET);
            ?>
">
        <script type="text/javascript">
        window.onload = function() {
            var F = document.all ? document.all('form') : document.getElementById('form');
            F.submit();
        };
        </script>
    </head>
    <body>
        <form id="form" method="POST" action="<?php 
            echo h($finalURL);
            ?>
"><?php 
            foreach ($_POST as $key => $value) {
                self::writeFormPost($key, $value);
            }
            ?>
</form>
    </body>
</html><?php 
        }
        die;
    }