コード例 #1
0
<?php

require 'deployment.settings.php';
require_once 'lda.inc.php';
require 'setup.php';
require_once 'lda-cache.class.php';
require_once 'lda-request.class.php';
require_once 'lda-response.class.php';
require_once 'graphs/configgraph.class.php';
require_once 'responses/Response304.class.php';
Logger::configure("puelia.logging.properties");
LinkedDataApiRequest::eliminateDebugParams();
$HttpRequestFactory = new HttpRequestFactory();
if (function_exists('memcache_connect')) {
    $MemCacheObject = new LinkedDataApiCache();
    $HttpRequestFactory->set_cache($MemCacheObject);
}
$Request = new LinkedDataApiRequest();
header("Access-Control-Allow-Origin: *");
define("CONFIG_PATH", '/api-config');
define("CONFIG_URL", $Request->getBaseAndSubDir() . CONFIG_PATH);
logDebug("Request URI: " . $Request->getUri());
if (rtrim($Request->getPath(), '/') == $Request->getInstallSubDir()) {
    header("Location: " . CONFIG_URL, true, 303);
    exit;
}
if (defined("PUELIA_SERVE_FROM_CACHE") and PUELIA_SERVE_FROM_CACHE and !$Request->hasNoCacheHeader() and $cachedResponse = LinkedDataApiCache::hasCachedResponse($Request)) {
    logDebug("Found cached response");
    if (isset($Request->ifNoneMatch) && $cachedResponse->eTag == $Request->ifNoneMatch) {
        logDebug("ETag matched, returning 304");
        $Response = new Response304($cachedResponse);