Exemple #1
0
function ldCacheRequest($AR_PATH_INFO = null)
{
    ob_start();
    global $ARCurrent;
    $ARCurrent->refreshCacheOnShutdown = true;
    ldProcessRequest($AR_PATH_INFO);
    ob_end_clean();
}
Exemple #2
0
        $AR_PATH_INFO = $path_info;
    } else {
        // we have a partial path request
        $scriptname = $_SERVER['PHP_SELF'];
        $sitepath = $_SERVER['ARSITEPATH'];
        $matches = array();
        $pathMatchRe = "|(/-[^/]{4}-(?=/))?(/[a-z]{2}(?=/))?/(.*)|";
        if (preg_match($pathMatchRe, $scriptname, $matches)) {
            $session = $matches[1];
            $nls = $matches[2];
            $path = $matches[3];
        } else {
            $session = '';
            $nls = '';
            $path = substr($path, 1);
        }
        $AR_PATH_INFO = $session . $nls . arc\path::collapse($sitepath) . $path;
    }
}
if (!$AR_PATH_INFO) {
    ldRedirect($_SERVER["PHP_SELF"] . "/");
} else {
    if (Headers_sent()) {
        error("The loader has detected that PHP has already sent the HTTP Headers. This error is usually caused by trailing white space or newlines in the configuration files. See the following error message for the exact file that is causing this:");
        Header("Misc: this is a test header");
    }
    @ob_end_clean();
    // just in case the output buffering is set on in php.ini, disable it here, as Ariadne's cache system gets confused otherwise.
    ldProcessCacheControl();
    ldProcessRequest($AR_PATH_INFO);
}
Exemple #3
0
 function esiFetch($url)
 {
     $scriptName = $_SERVER["SCRIPT_NAME"] ? basename($_SERVER["SCRIPT_NAME"]) : basename($_SERVER["SCRIPT_FILENAME"]);
     if ($scriptName) {
         $scriptName = "/" . $scriptName;
     }
     $scriptName = "/loader.php";
     // FIXME: Bij een request buiten Ariadne om kan het een andere scriptname zijn waardoor de include niet werkt.
     $url = ESI::esiExpression($url);
     if (strstr($url, $scriptName)) {
         // Looks like an Ariadne request, handle it!
         $urlArr = parse_url($url);
         parse_str($urlArr['query'], $_GET);
         // $pathInfo = str_replace($scriptName, '', $urlArr['path']);
         $pathInfo = substr($urlArr['path'], strpos($urlArr['path'], $scriptName) + strlen($scriptName), strlen($urlArr['path']));
         $pathInfo = str_replace("//", "/", $pathInfo);
         ob_start();
         ldProcessRequest($pathInfo);
         $replacement = ob_get_contents();
         ob_end_clean();
         // FIXME: Check of the request went ok or not;
     } else {
         // FIXME: Is it a good idea to do http requests from the server this way?
         $client = ar('http')->client();
         $scheme = parse_url($url, PHP_URL_SCHEME);
         if (!$scheme) {
             $url = 'http:' . $url;
         }
         $replacement = $client->get($url);
         if ($client->statusCode != "200") {
             return false;
         }
     }
     return $replacement;
 }