Exemple #1
0
     */
    if (file_exists(GITPHP_CONFIGDIR . 'projects.conf.php')) {
        GitPHP_ProjectList::Instantiate(GITPHP_CONFIGDIR . 'projects.conf.php', false);
    } else {
        GitPHP_ProjectList::Instantiate(GITPHP_CONFIGDIR . 'gitphp.conf.php', true);
    }
    $controller = GitPHP_Controller::GetController(isset($_GET['a']) ? $_GET['a'] : null);
    if ($controller) {
        $controller->RenderHeaders();
        $controller->Render();
    }
} catch (Exception $e) {
    if (GitPHP_Config::GetInstance()->GetValue('debug', false)) {
        throw $e;
    }
    if (!GitPHP_Resource::Instantiated()) {
        /*
         * In case an error was thrown before instantiating
         * the resource manager
         */
        GitPHP_Resource::Instantiate('en_US');
    }
    require_once GITPHP_CONTROLLERDIR . 'Controller_Message.class.php';
    $controller = new GitPHP_Controller_Message();
    $controller->SetParam('message', $e->getMessage());
    if ($e instanceof GitPHP_MessageException) {
        $controller->SetParam('error', $e->Error);
        $controller->SetParam('statuscode', $e->StatusCode);
    } else {
        $controller->SetParam('error', true);
    }
/**
 * Gettext wrapper function for readability, plural form
 *
 * @param string $singular singular form of string
 * @param string $plural plural form of string
 * @param int $count number of items
 * @return string translated string
 */
function __n($singular, $plural, $count)
{
    if (GitPHP_Resource::Instantiated()) {
        return GitPHP_Resource::GetInstance()->ngettext($singular, $plural, $count);
    }
    if ($count > 1) {
        return $plural;
    }
    return $singular;
}