Collection of themes/skins for the Fossil SCM

⌈⌋ branch:  Fossil Skins Extra


Artifact [e6bf384ff3]

Artifact e6bf384ff3ee6e029dd5e88b690be582cfec9cd1:

  • Executable file extroot/cat — part of check-in [0e67fdb36b] at 2021-10-20 05:59:00 on branch trunk — support for #access: flag (user: mario size: 1005)

#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: output
# category: access
# title: Cat file
# description: Look up filename and redirect to /raw/UUID
# version: 0.1
# state: beta
# depends: php:sqlite
# config: -
# access: public
#
# Does an indirect lookup by filename,
# then redirects to the /raw/UUID download.
#
# e.g.
#    http://fossil/ext/raw/README.md
#
# Will always lookup the trunk/tip uuid.
#


#-- init
include("./fossil_common.php");
$fn = ltrim($_SERVER["PATH_INFO"], "/");
#print_r($_SERVER);


#-- find uuid
if (empty($fn)) {
    die("Access as /ext/cat/fn.txt");
}
$r = db(
    "SELECT uuid
     FROM blob LEFT JOIN mlink ON blob.rid=mlink.fid
               LEFT JOIN filename ON mlink.fnid=filename.fnid
     WHERE name = ?
     ORDER BY rid DESC LIMIT 1",
    [$fn]
);
if ($r and $uuid = $r[0]["uuid"]) {
    $fn = basename($fn);
    header("Location: $_SERVER[FOSSIL_URI]/raw/$uuid?at=$fn");
}
else {
    header("Status: 404 Not found");
}