<?php
/**
* api: php
* type: main
* title: Freshcode.club
* description: FLOSS software release tracking website
* version: 0.8.3
* author: mario
* license: AGPL
*
* Implements a freshmeat/freecode-like directory for open source
* release publishing / tracking.
*
*/
#-- init
include("config.php");
#-- dispatch
$page = $_GET->id["page"];
switch (isset($page_alias[$page]) ? $page_alias[$page] : $page) {
case "names":
case "index":
case "projects":
case "feed":
case "links":
case "tags":
case "search":
case "rc":
case "drchangelog":
case "githubreleases":
case "launchpadreleases":
case "login":
case "redir":
include("page_$page.php");
break;
case "forum":
case "meta":
include("page_forum.php");
break;
case "flag":
case "submit":
if ((LOGIN_REQUIRED or $page === "flag") and empty($_SESSION["openid"])) {
exit(include("page_login.php"));
}
include("page_$page.php");
break;
case "api":
$api = new FreeCode_API();
$api->dispatch();
break;
case "ssl":
if (HTTP_HOST === "test.freshcode.club") {
include("page_test_ssl.php");
}
break;
case "admin":
if (!in_array($_SESSION["openid"], $moderator_ids)) {
exit(include("page_login.php"));
}
include("page_admin.php");
break;
default:
include("page_error.php");
}
?>