Beispiel #1
0
 public static function assertContent()
 {
     $o = utopia::GetInstance(__CLASS__);
     if (self::$asserted) {
         return;
     }
     self::$asserted = true;
     $rec = self::findPage();
     if (!$rec) {
         if (utopia::GetCurrentModule() == __CLASS__) {
             utopia::PageNotFound();
         }
         return;
     }
     $canEdit = uEvents::TriggerEvent('CanAccessModule', 'uCMS_Edit') !== FALSE;
     if (!$canEdit && !$rec['is_published']) {
         utopia::PageNotFound();
     }
     if (!isset($_GET['preview']) && !isset($_GET['edit']) && !$rec['is_published']) {
         utopia::PageNotFound();
     }
     echo '<div class="cms-' . $rec['cms_id'] . '">{content}</div>';
     utopia::SetVar('cms_id', $rec['cms_id']);
     utopia::SetVar('cms_parent_id', $rec['parent']);
     $path = $o->GetCmsParents($rec['cms_id']);
     utopia::SetVar('cms_parents', $path);
     utopia::SetVar('cms_root_id', reset($path));
     utopia::SetDescription($rec['description']);
     if (!utopia::UsingTemplate() || utopia::UsingTemplate(TEMPLATE_BLANK)) {
         return;
     }
     utopia::UseTemplate(self::GetTemplate($rec['cms_id']));
 }