Ejemplo n.º 1
0
 function makeCriteriaSectionLogic($section_id)
 {
     require_once 'AMP/Content/Section.inc.php';
     $section = new Section(AMP_Registry::getDbcon(), $section_id);
     if (!$section->hasData()) {
         return 'TRUE';
     }
     $scope = $section->getDisplayCriteria();
     unset($scope['displayable']);
     $value = $this->makeCriteria($scope);
     if ($value) {
         return join(' AND ', $value);
     }
     return 'TRUE';
 }
Ejemplo n.º 2
0
 * Redirect to Search Page for invalid page types, i.e. no valid List or Article
 */
if (!($listType || $currentPage->isArticle())) {
    AMP_make_404();
}
/**
 * Redirect to Search Page for unpublished articles unless in preview mode
 */
if (!AMP_DISPLAYMODE_PREVIEW && ($currentArticle =& $currentPage->getArticle())) {
    if (!$currentArticle->isLive()) {
        AMP_make_404();
    }
    //check to make sure parent section is live
    require_once 'AMP/Content/Section.inc.php';
    $currentSection = new Section(AMP_Registry::getDbcon(), $currentArticle->getParent());
    if (!$currentSection->hasData() || !$currentSection->isLive()) {
        if ($currentSection->id != AMP_CONTENT_SECTION_ID_ROOT) {
            AMP_make_404();
        }
    }
    /**
     * Check if specified article is a section header and redirect to that section
     */
    if (AMP_CONTENT_REDIRECT_SECTIONHEADERS_TO_SECTIONS && $currentArticle->getClass() == AMP_CONTENT_CLASS_SECTIONHEADER) {
        if ($currentSection->hasData()) {
            ampredirect($currentSection->getURL());
        }
    }
}
/**
 * Check Section List pages for a redirect in the SectionHeader 
Ejemplo n.º 3
0
 /**
  * set the Section for use on the current page 
  * 
  * @param   integer   $section_id   The database id of the Section to use 
  * @access  public
  * @since   3.5.3
  * @return  void
  */
 function setSection($section_id)
 {
     require_once 'AMP/Content/Section.inc.php';
     $section = new Section(AMP_Registry::getDbcon(), $section_id);
     if (!$section->hasData()) {
         return false;
     }
     if ($target = $section->getRedirect()) {
         ampredirect($target);
     }
     if (!isset($this->template_id) && ($template = $section->getTemplate())) {
         $this->template_id = $template;
     }
     $this->section =& $section;
     $this->section_id = $section->id;
     $this->_globalizePageVars();
     $this->_globalizeSectionVars($section);
     return true;
 }