Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/treetrek.git
<?php
class Config {
  const SITE_TITLE = "Dave Jarvis' Repositories";

  /**
   * Determine the home directory for repository discovery.
   */
  private static function getHomeDirectory() {
    if (!empty($_SERVER['HOME'])) {
      return $_SERVER['HOME'];
    }
    if (!empty(getenv('HOME'))) {
      return getenv('HOME');
    }
    if (function_exists('posix_getpwuid') && function_exists('posix_getuid')) {
      $userInfo = posix_getpwuid(posix_getuid());
      if (!empty($userInfo['dir'])) {
        return $userInfo['dir'];
      }
    }
    return '';
  }

  /**
   * Returns the full path where repositories are stored.
   */
  public static function getReposPath() {
    return self::getHomeDirectory() . '/repos';
  }

  /**
   * Initialize runtime settings (error logging, etc).
   */
  public static function init() {
    ini_set('display_errors', 0);
    ini_set('log_errors', 1);
    ini_set('error_log', __DIR__ . '/error.log');
  }
}