public function RunModule() { uEvents::AddCallback('ProcessDomDocument', array($this, 'ProcessDomDocument')); if (isset($_GET['news_id'])) { $rec = $this->LookupRecord($_GET['news_id']); if (!$rec) { utopia::PageNotFound(); } utopia::SetTitle($rec['heading']); utopia::SetDescription($rec['description']); $n = array(); if ($rec['noindex']) { $n[] = 'noindex'; } if ($rec['nofollow']) { $n[] = 'nofollow'; } if ($n) { utopia::AddMetaTag('robots', implode(',', $n)); } echo '{widget.' . modOpts::GetOption('news_widget_article') . '}'; return; } if (isset($_GET['tags'])) { utopia::SetTitle('Latest ' . ucwords($_GET['tags']) . ' News'); } echo '{widget.' . modOpts::GetOption('news_widget_archive') . '}'; }
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'])); }