Browse Source

added dir-listing.set-footer = <string> to set a footer under the

dirlisting (fixes #1277)


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1911 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.17
Jan Kneschke 14 years ago
parent
commit
bbd42c4e03
  1. 1
      NEWS
  2. 14
      src/mod_dirlisting.c

1
NEWS

@ -4,6 +4,7 @@ NEWS
====
- 1.4.17 -
* added dir-listing.set-footer in mod_dirlisting (#1277)
* fixed hardcoded font-sizes in mod_dirlisting (#1267)
* fixed different ETag length on 32/64 platforms (#1279)

14
src/mod_dirlisting.c

@ -59,6 +59,7 @@ typedef struct {
buffer *external_css;
buffer *encoding;
buffer *set_footer;
} plugin_config;
typedef struct {
@ -173,6 +174,7 @@ FREE_FUNC(mod_dirlisting_free) {
excludes_buffer_free(s->excludes);
buffer_free(s->external_css);
buffer_free(s->encoding);
buffer_free(s->set_footer);
free(s);
}
@ -240,6 +242,8 @@ static int parse_config_entry(server *srv, plugin_config *s, array *ca, const ch
#define CONFIG_SHOW_HEADER "dir-listing.show-header"
#define CONFIG_HIDE_HEADER_FILE "dir-listing.hide-header-file"
#define CONFIG_DIR_LISTING "server.dir-listing"
#define CONFIG_SET_FOOTER "dir-listing.set-footer"
SETDEFAULTS_FUNC(mod_dirlisting_set_defaults) {
plugin_data *p = p_d;
@ -256,6 +260,7 @@ SETDEFAULTS_FUNC(mod_dirlisting_set_defaults) {
{ CONFIG_SHOW_HEADER, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 7 */
{ CONFIG_HIDE_HEADER_FILE, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 8 */
{ CONFIG_DIR_LISTING, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 9 */
{ CONFIG_SET_FOOTER, NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 10 */
{ NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
};
@ -278,6 +283,7 @@ SETDEFAULTS_FUNC(mod_dirlisting_set_defaults) {
s->show_header = 0;
s->hide_header_file = 0;
s->encoding = buffer_init();
s->set_footer = buffer_init();
cv[0].destination = s->excludes;
cv[1].destination = &(s->dir_listing);
@ -289,6 +295,7 @@ SETDEFAULTS_FUNC(mod_dirlisting_set_defaults) {
cv[7].destination = &(s->show_header);
cv[8].destination = &(s->hide_header_file);
cv[9].destination = &(s->dir_listing); /* old name */
cv[10].destination = s->set_footer;
p->config_storage[i] = s;
ca = ((data_config *)srv->config_context->data[i])->value;
@ -318,6 +325,7 @@ static int mod_dirlisting_patch_connection(server *srv, connection *con, plugin_
PATCH(show_header);
PATCH(hide_header_file);
PATCH(excludes);
PATCH(set_footer);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
@ -348,6 +356,8 @@ static int mod_dirlisting_patch_connection(server *srv, connection *con, plugin_
PATCH(show_header);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_HIDE_HEADER_FILE))) {
PATCH(hide_header_file);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_SET_FOOTER))) {
PATCH(set_footer);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_EXCLUDE))) {
PATCH(excludes);
}
@ -567,7 +577,9 @@ static void http_list_directory_footer(server *srv, connection *con, plugin_data
"<div class=\"foot\">"
);
if (buffer_is_empty(con->conf.server_tag)) {
if (p->conf.set_footer->used > 1) {
buffer_append_string_buffer(out, p->conf.set_footer);
} else if (buffer_is_empty(con->conf.server_tag)) {
BUFFER_APPEND_STRING_CONST(out, PACKAGE_NAME "/" PACKAGE_VERSION);
} else {
buffer_append_string_buffer(out, con->conf.server_tag);

Loading…
Cancel
Save