/**
  * 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);
 }
Exemplo n.º 2
0
 /**
 * Init the content database.
 */
 public function Init()
 {
     $content = new CMContent();
     $content->Init();
     $this->RedirectToController();
 }
Exemplo n.º 3
0
/**
* 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);
}
Exemplo n.º 4
0
 /**
 * 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'))));
 }
Exemplo n.º 5
0
 /**
  * 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);
 }