예제 #1
0
 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());
         }
     }
 }
예제 #2
0
 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;
     }
 }
예제 #3
0
파일: page.php 프로젝트: JeRoNZ/concrete5-1
	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();
            }
        }
	}
예제 #4
0
파일: page.php 프로젝트: ceko/concrete5-1
 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.'));
     }
 }