Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/treetrek.git

Extracts configuration

Author Dave Jarvis <email>
Date 2026-02-08 17:02:41 GMT-0800
Commit 48e200a2a9148fd93cdb0fef76b6e6debcd18d78
Parent 360ce85
new/index.php
<?php
require_once 'Git.php';
-
-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 '';
-}
-
-define('REPOS_PATH', getHomeDirectory() . '/repos');
-define('SITE_TITLE', "Dave Jarvis' Repositories");
+require_once 'Config.php';
-ini_set('display_errors', 0);
-ini_set('log_errors', 1);
-ini_set('error_log', __DIR__ . '/error.log');
+// Initialize runtime settings
+Config::init();
function getRepositories() {
$repos = [];
- if (!is_dir(REPOS_PATH)) {
+ $reposPath = Config::getReposPath();
+
+ if (!is_dir($reposPath)) {
return $repos;
}
- foreach (glob(REPOS_PATH . '/*.git') as $path) {
+ foreach (glob($reposPath . '/*.git') as $path) {
if (is_dir($path)) {
$name = basename($path, '.git');
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title><?php echo SITE_TITLE; ?><?php echo $currentRepo ? ' - ' . htmlspecialchars($currentRepo['name']) : ''; ?></title>
+ <title><?php echo Config::SITE_TITLE; ?><?php echo $currentRepo ? ' - ' . htmlspecialchars($currentRepo['name']) : ''; ?></title>
<link rel="stylesheet" href="kimi-style.css">
<style>
<div class="container">
<header>
- <h1><?php echo SITE_TITLE; ?></h1>
+ <h1><?php echo Config::SITE_TITLE; ?></h1>
<nav class="nav">
<a href="?">Home</a>
if (empty($repositories)) {
- echo '<div class="empty-state">No repositories found in ' . htmlspecialchars(REPOS_PATH) . '</div>';
+ echo '<div class="empty-state">No repositories found in ' . htmlspecialchars(Config::getReposPath()) . '</div>';
} else {
echo '<div class="repo-grid">';
Delta 10 lines added, 27 lines removed, 17-line decrease