<?php
/**
 * api: freshcode
 * title: Freshcode.club config
 * description: initialization code
 * version: 0.8.2
 * plugin-register: include_once("$FN");
 * 
 *
 * Automatic and manual dependencies.
 * Base configuration.
 *
 */


// base
chdir(__DIR__);

// autoloader
include("./shared.phar");
#include("./lib/curl.php");
#error_reporting(E_ALL);
#ini_set("display_errors", 1);

// input filter
define("INPUT_QUIET", 1);
define("INPUT_DIRECT", "raw");
include_once("lib/input.php");
include_once("tags.php");
include_once("release.php");

// database
include_once("lib/db.php");
db(new PDO("sqlite:freshcode.db"));
db()->in_clause = 0;
db()->setAttribute(PDO::ATTR_TIMEOUT, "15");


// utility functions
include_once("aux.php");
define("FRESHCODE_USER_AGENT", "freshcode/0.7.9.3 (Linux x86-64; HHVM/3.6.x) projects-autoupdate/0.7.9 (img,news,regex,xpath) github-poll/0.7 launchpad-poll/0.3 +http://freshcode.club/");
curl::$defaults["useragent"] = FRESHCODE_USER_AGENT;
ini_set("user_agent", FRESHCODE_USER_AGENT);

// auth+session
define("LOGIN_REQUIRED", 0);
define("CAPTCHA_REQUIRED", 0);
define("HTTP_HOST", $_SERVER->id["HTTP_HOST"]);
include_once("lib/deferred_openid_session.php");


// Renamed projects
$renamed_proj = [
    "mlock" => "mikrolock",
    "myfonts" => "tkfonty",
    "arx" => "arx-libertatis",
];

// Alias page/action names
$page_alias = [
    "name" => "names",
    "project" => "projects",
    "p" => "projects",
];

// List of administrative OpenID handles
$moderator_ids = array();
include("config.local.php");   

// stats
define("IS_ADMIN", in_array($_SESSION["openid"], $moderator_ids));


?>