Added gallery site section and automatic directory scanning. Fixed some memory errors, removed obsolete logs

This commit is contained in:
Dm1tr1y147
2020-07-28 06:06:00 +05:00
parent fd6007b22b
commit 21f5a392fa
19 changed files with 388 additions and 33 deletions

View File

@ -28,5 +28,6 @@ typedef struct
int list_articles(article_info **articles);
long get_article_contents(article_info *article);
void free_article_info_arr(article_info **articles, int length);
#endif

View File

@ -0,0 +1,31 @@
#ifndef _LIST_GAL_H
#define _LIST_GAL_H
#include <stdlib.h>
#include <stdio.h>
typedef struct {
char *description;
char *path;
char **tags;
time_t date_taken;
short int rating;
} img_t;
typedef struct album_s
{
char *title;
img_t *images;
int img_am;
struct album_s *next;
} gallery_t;
gallery_t *get_album_list();
gallery_t *new_album_item(char *title);
img_t new_img_item(char *path);
int get_album_imgs(img_t **images_arr, int *size, char *title);
char *gen_gallery_html();
#define GALLERY_ROOT "static/gallery/albums/"
#endif

View File

@ -5,6 +5,7 @@
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <dirent.h>
void err_msg(char *msg);
char *concat_to_front(char **str1, char *str2);
@ -12,5 +13,6 @@ char *get_status_message(int status_code);
char *to_lower(char *str);
char *trim(char *str);
char *repair_spaces(char *str);
ssize_t get_dir_list(char ***dir_list, char *path);
#endif