Example #1
0
 function isAllowed($action, $model_id = false)
 {
     if ($model_id) {
         require_once 'AMP/Content/Article.inc.php';
         $article = new Article(AMP_Registry::getDbcon(), $model_id);
         if (!$article->hasData()) {
             return false;
         }
         $section_id = $article->getParent();
         $allowed_sections = AMP_lookup('sectionMap');
         if ($section_id == AMP_CONTENT_MAP_ROOT_SECTION) {
             return true;
         }
         if (!$allowed_sections) {
             return false;
         }
         if (!isset($allowed_sections[$section_id])) {
             return false;
         }
     }
     return parent::isAllowed($action, $model_id);
 }
Example #2
0
 function &getArticleRef()
 {
     $false = false;
     $article_id = $this->getArticle();
     if (!$article_id) {
         return $false;
     }
     $article = new Article($this->dbcon, $article_id);
     if (!$article->hasData()) {
         return $false;
     }
     return $article;
 }
Example #3
0
 /**
  * set the Article for use on the current page 
  * 
  * @param   integer   $article_id   The database id of the Article to use 
  * @access  public
  * @since   3.5.3
  * @return  void
  */
 function setArticle($article_id)
 {
     require_once 'AMP/Content/Article.inc.php';
     $article = new Article($this->dbcon, $article_id);
     if (!$article->hasData()) {
         AMP_make_404();
         return false;
     }
     //ampredirect( AMP_CONTENT_URL_SEARCH );
     if ($target = $article->getRedirect()) {
         ampredirect($target);
     }
     $this->section_id = $article->getParent();
     $this->_globalizeArticleVars($article);
     $this->_globalizePageVars();
     $this->article =& $article;
 }
Example #4
0
 function setArticle($article_id)
 {
     require_once 'AMP/Content/Article.inc.php';
     $article = new Article($this->dbcon, $article_id);
     if (!$article->hasData()) {
         return false;
     }
     return $this->mergeData(array('articleid' => $article_id));
 }