2016-04-18 07:04:52 +00:00
|
|
|
#!/usr/bin/php
|
|
|
|
<?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/');
|
|
|
|
|
2016-04-18 07:04:52 +00:00
|
|
|
function main($args) {
|
|
|
|
$basedir = './';
|
|
|
|
$total = $args[0];
|
|
|
|
$pos = $args[1];
|
|
|
|
|
|
|
|
// Parse configuration
|
|
|
|
|
|
|
|
$config = @parse_ini_file(
|
|
|
|
$basedir . 'config.ini',
|
|
|
|
true,
|
|
|
|
INI_SCANNER_RAW
|
|
|
|
);
|
|
|
|
|
|
|
|
if ($config === false) {
|
|
|
|
die("[FATAL] Couldn't load '${basedir}/config.ini'!\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
define('BASEDIR', $basedir);
|
2016-07-17 04:13:59 +00:00
|
|
|
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']));
|
|
|
|
|
|
|
|
// Perform build tasks
|
|
|
|
|
|
|
|
if ($pos == 0) {
|
|
|
|
buildcommon();
|
|
|
|
if (array_key_exists('redirect', $config)) {
|
|
|
|
buildredirects( $config['redirect'] );
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
buildprojects($pos, array_decimate(listprojects(), $total, $pos));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
main(array_slice($_SERVER['argv'], 1));
|