Collection of themes/skins for the Fossil SCM

⌈⌋ ⎇ branch:  Fossil Skins Extra


Check-in [9adf5f84b6]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:extroot version of file dump handler; here just doing a redirect though
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9adf5f84b66fc0cd4076a603e843e9258761166d
User & Date: mario 2021-10-12 10:00:17
Context
2021-10-12
10:01
add config props check-in: 006b1be81a user: mario tags: trunk
10:00
extroot version of file dump handler; here just doing a redirect though check-in: 9adf5f84b6 user: mario tags: trunk
09:59
file links non-functional, because $current_page doesn't resemble request_uri; needs a TH1 handler for mapping check-in: 7c70ebd476 user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added extroot/cat.







































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: config
# category: admin
# title: Cat file
# description: Look up filename and redirect to /raw/UUID
# version: 0.1
# state: beta
# depends: php:sqlite
# config: -
#
# 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
$fn = ltrim($_SERVER["PATH_INFO"], "/");
#print_r($_SERVER);

#-- database (== fossil repo)
function db($sql="", $params=[]) {
    global $db;
    if (empty($db)) {
        $db = new PDO("sqlite::memory:");
        $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
        $db->query("ATTACH DATABASE '$_SERVER[FOSSIL_REPOSITORY]' AS 'repo'");
    }
    if ($params) {
        $stmt = $db->prepare($sql);
        $stmt->execute($params);
        return $stmt->fetchAll(PDO::FETCH_ASSOC);
    }
    else {
        return $db->query($sql);
    }
}


#-- 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");
}