/** * Check if user is owner of content, or has administrator role else redirect to forbidden. * * @param CMContent $content to display. * @return CInterceptionFilter to allow chaining. */ public function OwnerAdminOrForbidden($content) { if ($this->user->IsAdmin() || $content->CurrentUserIsOwner()) { return $this; } $msg = t('You do not have privileges to access this content.'); return $this->bbb->ShowErrorPage(403, $msg); }
/** * Init the content database. */ public function Init() { $content = new CMContent(); $content->Init(); $this->RedirectToController(); }
/** * Filter data according to a filter. Uses CMContent::Filter() * * @param $data string the data-string to filter. * @param $filter string the filter to use. * @returns string the filtered string. */ function filter_data($data, $filter) { return CMContent::Filter($data, $filter); }
/** * The blog. */ public function Blog() { $content = new CMContent(); $this->views->SetTitle('My blog')->AddInclude(__DIR__ . '/blog.tpl.php', array('contents' => $content->ListAll(array('type' => 'post', 'order-by' => 'title', 'order-order' => 'DESC')))); }
/** * Check if the url is associated with some content. * * @param string $url the url to check. * @return boolean true if url is associated with content, otherwise false. */ public static function UrlHasContent($url) { $c = new CMContent(); return $c->ContentHasUrl($url); }