public function create($ptID, $parentID = false) { $pagetype = PageType::getByID(Loader::helper('security')->sanitizeInt($ptID)); if ($parentID) { $parent = ConcretePage::getByID($parentID); } if (is_object($pagetype)) { $proceed = false; if (is_object($parent) && !$parent->isError()) { $pp = new Permissions($parent); $proceed = $pp->canAddSubCollection($pagetype); } else { $ptp = new Permissions($pagetype); $proceed = $ptp->canAddPageType(); if (isset($parent)) { unset($parent); } } if ($proceed) { $pt = $pagetype->getPageTypeDefaultPageTemplateObject(); $d = $pagetype->createDraft($pt); if (is_object($parent)) { $d->setPageDraftTargetParentPageID($parent->getCollectionID()); } return Redirect::url(BASE_URL . DIR_REL . '/' . DISPATCHER_FILENAME . '?cID=' . $d->getCollectionID() . '&ctask=check-out-first&' . Loader::helper('validation/token')->getParameter()); } } }
public function view() { if (Loader::helper('validation/token')->validate('editor')) { $obj = new stdClass(); $obj->snippets = array(); $u = new ConcreteUser(); if ($u->isRegistered()) { $snippets = \Concrete\Core\Editor\Snippet::getActiveList(); foreach ($snippets as $sns) { $menu = new stdClass(); $menu->scsHandle = $sns->getSystemContentEditorSnippetHandle(); $menu->scsName = $sns->getSystemContentEditorSnippetName(); $obj->snippets[] = $menu; } } $c = ConcretePage::getByID($_REQUEST['cID']); $obj->classes = array(); if (is_object($c) && !$c->isError()) { $cp = new Permissions($c); if ($cp->canViewPage()) { $pt = $c->getCollectionThemeObject(); if (is_object($pt)) { $obj->classes = $pt->getThemeEditorClasses(); } } } echo Loader::helper('json')->encode($obj); exit; } }
public function getJSON() { $h = \Core::make('helper/concrete/dashboard/sitemap'); if ($h->canRead()) { $c = ConcretePage::getByID(intval($_POST['cID'])); $cp = new Permissions($c); if ($cp->canViewPage()) { $r = new PageEditResponse(); $r->setPage($c); $r->outputJSON(); } } }
public function getJSON() { $h = \Core::make('helper/concrete/dashboard/sitemap'); if ($h->canRead()) { $c = ConcretePage::getByID(intval($_POST['cID'])); $cp = new Permissions($c); if ($cp->canViewPage()) { $r = new PageEditResponse(); $r->setPage($c); $r->outputJSON(); } else { Core::make('helper/ajax')->sendError(t('You are not allowed to access this page.')); } } else { Core::make('helper/ajax')->sendError(t('You do not have access to the sitemap.')); } }