This repository has been archived on 2020-05-24. You can view files and clone it, but cannot push or open issues or pull requests.
codesite/lib/bootstrap.php

48 lines
1.5 KiB
PHP
Raw Normal View History

2016-04-18 07:04:52 +00:00
<?php
ini_set('display_errors', 'On');
date_default_timezone_set('Etc/UTC');
error_reporting(E_ALL);
2016-04-18 07:19:01 +00:00
require __DIR__.'/util.php';
require __DIR__.'/template.php';
require __DIR__.'/CProject.php';
2016-04-18 07:04:52 +00:00
2016-04-18 07:12:11 +00:00
define('SHIELDS_CACHE_DIR', __DIR__.'/../shields_cache/');
/**
* Set up global defines for a given codesite project
* Should be called once we have the root path for a codesite project.
*
*/
function setup_vars(string $basedir="./"): array {
2016-04-18 07:04:52 +00:00
// Parse configuration
if (! is_file($basedir.'config.ini')) {
die("[FATAL] Non-file '${basedir}config.ini'!\n");
}
2016-04-18 07:04:52 +00:00
$config = @parse_ini_file(
$basedir . 'config.ini',
true,
INI_SCANNER_RAW
);
if ($config === false) {
die("[FATAL] Couldn't load '${basedir}config.ini'!\n");
2016-04-18 07:04:52 +00:00
}
define('BASEDIR', $basedir);
define('BASEURL', trim($config['codesite']['baseurl']));
2016-04-18 07:04:52 +00:00
define('SITE_TITLE', trim($config['codesite']['title']));
define('PAGE_THUMB_W', intval($config['codesite']['page_thumb_w']));
define('PAGE_THUMB_H', intval($config['codesite']['page_thumb_h']));
define('INDEX_THUMB_W', intval($config['codesite']['index_thumb_w']));
define('INDEX_THUMB_H', intval($config['codesite']['index_thumb_h']));
define('SHOW_BLURBS', !(isset($config['codesite']['blurbs']) && $config['codesite']['blurbs'] === 'off') );
define('ARTICLE_HEADER', (isset($config['codesite']['article_header']) ? $config['codesite']['article_header'] : 'ABOUT') );
define('SHIELDS_PREFIX', isset($config['codesite']['shields_prefix']));
return $config;
2016-04-18 07:04:52 +00:00
}