コード例 #1
0
ファイル: site.php プロジェクト: Atomox/benhelmerphotography
Koken::$fallback_path = $root_path . $ds . 'app' . $ds . 'site' . $ds . 'themes';
if (isset($cache_path)) {
    Koken::$cache_path = $cache_path;
}
list($site_api, $categories) = Koken::api(array('/site' . ($draft ? $preview ? '/preview:' . $preview : '/draft:true' : ''), '/categories'));
# Do this separately to be sure KOKEN_ENCRYPTION_KEY has been created by the above API call
$koken_key = Shutter::get_encryption_key();
$video = Koken::api('/content/types:video/limit:1/visibility:any/token:' . $koken_key);
Koken::$has_video = count($video['content']) > 0;
if (!is_array($site_api)) {
    die(file_get_contents(Koken::$fallback_path . $ds . 'error' . $ds . 'api.html'));
}
if (isset($site_api['error'])) {
    die(str_replace('<!-- ERROR -->', $site_api['error'], file_get_contents(Koken::$fallback_path . $ds . 'error' . $ds . 'json.html')));
}
Koken::$site = $site_api;
Koken::$profile = Koken::$site['profile'];
Koken::$location['theme_path'] = $real_base_folder . '/storage/themes/' . $site_api['theme']['path'];
foreach ($categories['categories'] as $c) {
    Koken::$categories[strtolower($c['title'])] = $c['id'];
}
if (isset($_GET['default_link'])) {
    $location = Koken::$site['default_links'][$_GET['default_link']];
    unset($_GET['default_link']);
    foreach ($_GET as $key => $val) {
        $location = str_replace(":{$key}", $val, $location);
    }
    header("Location: {$base_folder}{$location}");
}
date_default_timezone_set(Koken::$site['timezone']);
// Setup path to current theme