Upload files to "/"

This commit is contained in:
8nl 2024-11-10 09:57:10 +00:00
parent ae4e18faad
commit 5a9e890f57

16
img.c
View File

@ -242,9 +242,9 @@ struct DB_STR *build_html(FILE *fp, const char *file, const struct UNIQ_TAGS ut,
fprintf(fp, "<html>\n<head>\n<link rel='stylesheet' href='%s'>\n<title>%s</title>\n</head>\n<body>", CSS, TITLE);
/* Tags */
fputs("\n<p class='alltags'>\n<a href='index.html'>all </a>", fp);
fputs("\n<p class='alltags'>\n<a href='index.html'> [all] </a>", fp);
for (size_t i = 0; i < ut.size; i++)
fprintf(fp, "<a href='%s.html'>%s </a>", ut.tags[i], ut.tags[i]);
fprintf(fp, "<a href='%s.html'> [%s] </a>", ut.tags[i], ut.tags[i]);
fputs("</p><br>\n<div class='bar'></div>\n", fp);
/* Images */
@ -276,7 +276,7 @@ struct DB_STR *build_html(FILE *fp, const char *file, const struct UNIQ_TAGS ut,
break;
}
for (size_t i = 0; i < pages; i++) {
for (size_t i = 0; i <= pages; i++) {
if (i == 0) {
if (i == page)
fprintf(fp, "<a href='%s.html'>(0) </a> ", file);
@ -314,6 +314,11 @@ void build(const char *file, const struct UNIQ_TAGS ut, struct DB_STR *db) {
while (p != NULL) {
struct DB_STR *i = p->next;
if (count == POST_PER_PAGE) {
count = 0;
pages++;
}
if (!strcmp(file, "index"))
count++;
@ -323,11 +328,6 @@ void build(const char *file, const struct UNIQ_TAGS ut, struct DB_STR *db) {
count++;
}
if (count >= POST_PER_PAGE) {
count = 0;
pages++;
}
p = i;
}