-rw-r--r-- | ui-shared.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ui-shared.c b/ui-shared.c index b0cff7d..6211056 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -40,50 +40,54 @@ void cgit_print_error(char *msg) | |||
40 | html("</div>\n"); | 40 | html("</div>\n"); |
41 | } | 41 | } |
42 | 42 | ||
43 | char *cgit_rooturl() | 43 | char *cgit_rooturl() |
44 | { | 44 | { |
45 | if (cgit_virtual_root) | 45 | if (cgit_virtual_root) |
46 | return fmt("%s/", cgit_virtual_root); | 46 | return fmt("%s/", cgit_virtual_root); |
47 | else | 47 | else |
48 | return cgit_script_name; | 48 | return cgit_script_name; |
49 | } | 49 | } |
50 | 50 | ||
51 | char *cgit_repourl(const char *reponame) | 51 | char *cgit_repourl(const char *reponame) |
52 | { | 52 | { |
53 | if (cgit_virtual_root) { | 53 | if (cgit_virtual_root) { |
54 | return fmt("%s/%s/", cgit_virtual_root, reponame); | 54 | return fmt("%s/%s/", cgit_virtual_root, reponame); |
55 | } else { | 55 | } else { |
56 | return fmt("?r=%s", reponame); | 56 | return fmt("?r=%s", reponame); |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | char *cgit_pageurl(const char *reponame, const char *pagename, | 60 | char *cgit_pageurl(const char *reponame, const char *pagename, |
61 | const char *query) | 61 | const char *query) |
62 | { | 62 | { |
63 | if (cgit_virtual_root) { | 63 | if (cgit_virtual_root) { |
64 | return fmt("%s/%s/%s/?%s", cgit_virtual_root, reponame, | 64 | if (query) |
65 | pagename, query); | 65 | return fmt("%s/%s/%s/?%s", cgit_virtual_root, reponame, |
66 | pagename, query); | ||
67 | else | ||
68 | return fmt("%s/%s/%s/", cgit_virtual_root, reponame, | ||
69 | pagename); | ||
66 | } else { | 70 | } else { |
67 | return fmt("?r=%s&p=%s&%s", reponame, pagename, query); | 71 | return fmt("?r=%s&p=%s&%s", reponame, pagename, query); |
68 | } | 72 | } |
69 | } | 73 | } |
70 | 74 | ||
71 | char *cgit_currurl() | 75 | char *cgit_currurl() |
72 | { | 76 | { |
73 | if (!cgit_virtual_root) | 77 | if (!cgit_virtual_root) |
74 | return cgit_script_name; | 78 | return cgit_script_name; |
75 | else if (cgit_query_page) | 79 | else if (cgit_query_page) |
76 | return fmt("%s/%s/%s/", cgit_virtual_root, cgit_query_repo, cgit_query_page); | 80 | return fmt("%s/%s/%s/", cgit_virtual_root, cgit_query_repo, cgit_query_page); |
77 | else if (cgit_query_repo) | 81 | else if (cgit_query_repo) |
78 | return fmt("%s/%s/", cgit_virtual_root, cgit_query_repo); | 82 | return fmt("%s/%s/", cgit_virtual_root, cgit_query_repo); |
79 | else | 83 | else |
80 | return fmt("%s/", cgit_virtual_root); | 84 | return fmt("%s/", cgit_virtual_root); |
81 | } | 85 | } |
82 | 86 | ||
83 | 87 | ||
84 | void cgit_print_date(unsigned long secs) | 88 | void cgit_print_date(unsigned long secs) |
85 | { | 89 | { |
86 | char buf[32]; | 90 | char buf[32]; |
87 | struct tm *time; | 91 | struct tm *time; |
88 | 92 | ||
89 | time = gmtime(&secs); | 93 | time = gmtime(&secs); |