<?php $Templates = new PerchContent_PageTemplates(); $Templates->find_and_add_new_templates(); $templates = $Templates->all();
<?php $Templates = new PerchContent_PageTemplates(); $Pages = new PerchContent_Pages(); $Form = new PerchForm('edit'); $message = false; // Check permissions if (!$CurrentUser->has_priv('content.templates.delete')) { PerchUtil::redirect(PERCH_LOGINPATH . '/core/apps/content/pages/templates/'); } if (isset($_GET['id']) && is_numeric($_GET['id'])) { $templateID = (int) $_GET['id']; $Template = $Templates->find($templateID); } else { PerchUtil::redirect(PERCH_LOGINPATH . '/core/apps/content/page/templates/'); } $Form = new PerchForm('rm'); if ($Form->posted() && $Form->validate()) { $Template->delete(); PerchUtil::redirect(PERCH_LOGINPATH . '/core/apps/content/page/templates/'); } $details = $Template->to_array();
/** * If there are no pages, set up the basic home page and error pages etc * @return [type] [description] */ public function create_defaults($CurrentUser) { $PageTemplates = new PerchContent_PageTemplates(); $PageTemplates->find_and_add_new_templates(); // Create home page $DefaultTemplate = $PageTemplates->get_one_by('templatePath', 'home.php'); if ($DefaultTemplate) { $data = array('pageTitle' => PerchLang::get('Home page'), 'pageNavText' => PerchLang::get('Home page'), 'file_name' => '', 'pageParentID' => '0', 'templateID' => $DefaultTemplate->id(), 'pageNew' => 1, 'pageCreatorID' => $CurrentUser->id(), 'pageModified' => date('Y-m-d H:i:s'), 'pageAttributes' => '', 'pageTemplate' => $DefaultTemplate->templatePath()); $this->create_without_file($data); } // Create error pages $ErrorTemplate = $PageTemplates->get_one_by('templatePath', 'errors/404.php'); if ($ErrorTemplate) { $data = array('pageTitle' => PerchLang::get('Errors'), 'pageNavText' => PerchLang::get('Errors'), 'file_name' => '/errors', 'pageParentID' => '0', 'templateID' => $ErrorTemplate->id(), 'pageNew' => 1, 'pageCreatorID' => $CurrentUser->id(), 'pageModified' => date('Y-m-d H:i:s'), 'pageAttributes' => '', 'pageTemplate' => $ErrorTemplate->templatePath(), 'pageHidden' => '1'); $ErrorsPage = $this->create_without_file($data); $data = array('pageTitle' => '404', 'pageNavText' => '404', 'file_name' => '/errors/404', 'pageParentID' => $ErrorsPage->id(), 'templateID' => $ErrorTemplate->id(), 'pageNew' => 1, 'pageCreatorID' => $CurrentUser->id(), 'pageModified' => date('Y-m-d H:i:s'), 'pageAttributes' => '', 'pageTemplate' => $ErrorTemplate->templatePath(), 'pageHidden' => '1'); $ErrorsPage = $this->create_without_file($data); } }
<?php $Pages = new PerchContent_Pages(); $Regions = new PerchContent_Regions(); $Page = false; $NavGroups = new PerchContent_NavGroups(); $PageTemplates = new PerchContent_PageTemplates(); if (PERCH_RUNWAY) { $PageRoutes = new PerchPageRoutes(); $Collections = new PerchContent_Collections(); } // Find the page if (isset($_GET['id']) && is_numeric($_GET['id'])) { $id = (int) $_GET['id']; $Page = $Pages->find($id); } // Check we have a page if (!$Page || !is_object($Page)) { PerchUtil::redirect(PERCH_LOGINPATH . '/core/apps/content/'); } // Check permissions if (!$CurrentUser->has_priv('content.pages.edit')) { PerchUtil::redirect(PERCH_LOGINPATH . '/core/apps/content/'); } $ParentPage = $Pages->find($Page->pageParentID()); $Form = new PerchForm('editpage'); $req = array(); $req['pagePath'] = "Required"; $Form->set_required($req); if ($Form->posted() && $Form->validate()) { $postvars = array('pagePath', 'pageSubpagePath', 'pageHidden', 'pageAccessTags', 'pageAttributeTemplate');
<?php $Pages = new PerchContent_Pages(); $PageTemplates = new PerchContent_PageTemplates(); $PageTemplates->find_and_add_new_templates(); $Page = false; $Templates = new PerchContent_PageTemplates(); // Find the page if (isset($_GET['pid']) && is_numeric($_GET['pid'])) { $parentID = (int) $_GET['pid']; $ParentPage = $Pages->find($parentID); } else { $parentID = false; $ParentPage = false; } // Check permissions if (!$CurrentUser->has_priv('content.pages.create')) { PerchUtil::redirect(PERCH_LOGINPATH . '/core/apps/content/'); } $Form = new PerchForm('addpage'); $req = array(); $req['pageTitle'] = "Required"; $req['file_name'] = "Required"; $req['pageParentID'] = "Required"; $Form->set_required($req); if ($Form->posted()) { if ($Form->validate()) { $postvars = array('pageTitle', 'pageNavText', 'file_name', 'pageParentID', 'templateID', 'create_folder'); $data = $Form->receive($postvars); $data['pageNew'] = 1; $data['pageCreatorID'] = $CurrentUser->id();