Beispiel #1
0
 function execute($output = true)
 {
     $data = $this->get_actions();
     foreach ($this->get_actions() as $action) {
         //try running the action cached
         if ($this->_commit_cached($action)) {
             continue;
         }
         //run the action for real
         if ($this->_results[$action] = $this->commit($this->_model, $action, $this->get_arguments($action))) {
             $this->_action_committed = $action;
             continue;
         }
         $this->_commit_default();
     }
     if (!$output) {
         return;
     }
     if (defined('AMP_CONTENT_PAGE_REDIRECT')) {
         return;
     }
     $this->_init_location();
     $output = $this->_display->execute();
     AMP_cache_close();
     return $output;
 }
Beispiel #2
0
<?php

require_once 'AMP/BaseDB.php';
$request_key = isset($_GET['key']) && $_GET['key'] ? $_GET['key'] : false;
if (!$request_key) {
    trigger_error('cache page called without key ' . $_SERVER['REQUEST_URI']);
    exit;
}
if (!($cache =& AMP_get_cache())) {
    trigger_error('cache page failed to load cache');
    exit;
}
$authorized_key = $request_key;
if (defined('AMP_SYSTEM_USER_ID') && AMP_SYSTEM_USER_ID) {
    $authorized_key = $cache->identify($request_key, AMP_SYSTEM_USER_ID);
}
if ($content_type = $cache->header($request_key)) {
    //should send an appropriate header depending on the key type
    header($content_type);
}
$content = $cache->retrieve($authorized_key);
if (!$content) {
    trigger_error('item ' . $request_key . ' not found for user');
    exit;
}
print $content;
AMP_cache_close();