-rw-r--r-- | ui-shared.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ui-shared.c b/ui-shared.c index 6211056..c7fbc5e 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -47,49 +47,52 @@ char *cgit_rooturl() | |||
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 | if (query) | 64 | if (query) |
65 | return fmt("%s/%s/%s/?%s", cgit_virtual_root, reponame, | 65 | return fmt("%s/%s/%s/?%s", cgit_virtual_root, reponame, |
66 | pagename, query); | 66 | pagename, query); |
67 | else | 67 | else |
68 | return fmt("%s/%s/%s/", cgit_virtual_root, reponame, | 68 | return fmt("%s/%s/%s/", cgit_virtual_root, reponame, |
69 | pagename); | 69 | pagename); |
70 | } else { | 70 | } else { |
71 | return fmt("?r=%s&p=%s&%s", reponame, pagename, query); | 71 | if (query) |
72 | return fmt("?r=%s&p=%s&%s", reponame, pagename, query); | ||
73 | else | ||
74 | return fmt("?r=%s&p=%s", reponame, pagename); | ||
72 | } | 75 | } |
73 | } | 76 | } |
74 | 77 | ||
75 | char *cgit_currurl() | 78 | char *cgit_currurl() |
76 | { | 79 | { |
77 | if (!cgit_virtual_root) | 80 | if (!cgit_virtual_root) |
78 | return cgit_script_name; | 81 | return cgit_script_name; |
79 | else if (cgit_query_page) | 82 | else if (cgit_query_page) |
80 | return fmt("%s/%s/%s/", cgit_virtual_root, cgit_query_repo, cgit_query_page); | 83 | return fmt("%s/%s/%s/", cgit_virtual_root, cgit_query_repo, cgit_query_page); |
81 | else if (cgit_query_repo) | 84 | else if (cgit_query_repo) |
82 | return fmt("%s/%s/", cgit_virtual_root, cgit_query_repo); | 85 | return fmt("%s/%s/", cgit_virtual_root, cgit_query_repo); |
83 | else | 86 | else |
84 | return fmt("%s/", cgit_virtual_root); | 87 | return fmt("%s/", cgit_virtual_root); |
85 | } | 88 | } |
86 | 89 | ||
87 | 90 | ||
88 | void cgit_print_date(unsigned long secs) | 91 | void cgit_print_date(unsigned long secs) |
89 | { | 92 | { |
90 | char buf[32]; | 93 | char buf[32]; |
91 | struct tm *time; | 94 | struct tm *time; |
92 | 95 | ||
93 | time = gmtime(&secs); | 96 | time = gmtime(&secs); |
94 | strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", time); | 97 | strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", time); |
95 | html_txt(buf); | 98 | html_txt(buf); |