示例#1
0
 function cleanPermissions(&$contentSource)
 {
     if (AMP_Authenticate('content')) {
         return;
     }
     if (method_exists($contentSource, 'addCriteriaPublic')) {
         $contentSource->addCriteriaPublic();
     }
 }
示例#2
0
 function show()
 {
     $this->_before('show');
     $section = $this->current_object =& new Section(AMP_dbcon(), $this->params['id']);
     if (!($section && $section->hasData() && ($section->isDisplayable() || AMP_Authenticate('admin')))) {
         return AMP_make_404();
     }
     $display =& $section->getDisplay();
     $this->_render_section_header($display);
     $this->render($display);
 }
示例#3
0
 function show()
 {
     $this->_before('show');
     $article = $this->current_object =& new Article(AMP_dbcon(), $this->params['id']);
     //section headers redirect to sections
     if ($article && $article->hasData() && $article->getData('class') == AMP_CONTENT_CLASS_SECTIONHEADER) {
         return ampredirect(AMP_route_for('section', $article->getParent()));
     }
     if (!($article && $article->hasData() && ($article->isDisplayable() || AMP_Authenticate('admin')))) {
         return AMP_make_404();
     }
     $this->render($article->getDisplay());
 }
示例#4
0
 function read_request()
 {
     if (!(isset($_REQUEST['filename']) && ($image_file = $_REQUEST['filename']))) {
         return;
     }
     $image_class = isset($_REQUEST['image_class']) && $_REQUEST['image_class'] ? $_REQUEST['image_class'] : AMP_IMAGE_CLASS_ORIGINAL;
     $image_path = AMP_image_path($image_file, $image_class);
     if (!file_exists($image_path)) {
         return;
     }
     $this->set_file($image_path);
     $action = isset($_REQUEST['action']) && $_REQUEST['action'] ? $_REQUEST['action'] : $this->_default_action;
     $this->_keep_proportions = isset($_REQUEST['keep_proportions']) && $_REQUEST['keep_proportions'];
     //validate request
     if (!(AMP_local_request() || AMP_Authenticate('admin'))) {
         $action = $this->_default_action;
     }
     $display =& $this->get_display();
     $display->set_action($action);
     $this->read_request_sizes($action);
 }
示例#5
0
 function allow_cache()
 {
     return !AMP_Authenticate('content');
 }
示例#6
0
 function makeCriteriaPublicToUser()
 {
     if (AMP_Authenticate('content')) {
         return false;
     }
     return $this->makeCriteriaPublic();
 }
示例#7
0
 function allowed($section_id)
 {
     if ($this->_permission_level == 'none') {
         return true;
     }
     if ($this->readAncestors($section_id, 'secure') && !(AMP_Authenticate('admin') || AMP_Authenticate('content'))) {
         return false;
     }
     if ($this->_permission_level == 'default') {
         return true;
     }
     return AMP_allow('access', 'section', $section_id);
 }
示例#8
0
 /**
  * Sets the default section if no other location applies, checks whether user login is required to view page 
  * 
  * @access public
  * @since   3.5.4
  * @return void
  */
 function initLocation()
 {
     if (!isset($this->section) && $this->section) {
         $this->setSection($this->getSectionId());
     }
     if ($this->requiresLogin()) {
         AMP_Authenticate('content', true);
     }
 }
 function is_preview_mode()
 {
     return AMP_params('preview') && AMP_Authenticate('admin');
 }
示例#10
0
function AMP_block_frequent_requesters()
{
    if (!(defined('AMP_BLOCK_FREQUENT_REQUESTERS') && AMP_BLOCK_FREQUENT_REQUESTERS)) {
        return;
    }
    $key = 'REQUESTED_BY_' . $_SERVER['REMOTE_ADDR'];
    if (!($value = AMP_cache_get($key))) {
        $value = 0;
    }
    ++$value;
    AMP_cache_set($key, $value);
    if ($value > 200 && !AMP_Authenticate('admin')) {
        trigger_error('Blocking further requests from ' . $_SERVER['REMOTE_ADDR']);
        exit;
    }
}