Project

General

Profile

Bug #1277 » set_footer_1.4.15.patch

thierry_78, 2007-07-29 21:06

View differences:

lighttpd-1.4.15-set-footer/src/mod_dirlisting.c 2007-07-15 15:33:44.000000000 +0200
59 59

  
60 60
	buffer *external_css;
61 61
	buffer *encoding;
62
	buffer *set_footer;
62 63
} plugin_config;
63 64

  
64 65
typedef struct {
......
173 174
			excludes_buffer_free(s->excludes);
174 175
			buffer_free(s->external_css);
175 176
			buffer_free(s->encoding);
177
			buffer_free(s->set_footer);
176 178

  
177 179
			free(s);
178 180
		}
......
240 242
#define CONFIG_SHOW_HEADER      "dir-listing.show-header"
241 243
#define CONFIG_HIDE_HEADER_FILE "dir-listing.hide-header-file"
242 244
#define CONFIG_DIR_LISTING      "server.dir-listing"
245
#define CONFIG_SET_FOOTER       "dir-listing.set-footer"
246

  
243 247

  
244 248
SETDEFAULTS_FUNC(mod_dirlisting_set_defaults) {
245 249
	plugin_data *p = p_d;
......
256 260
		{ CONFIG_SHOW_HEADER,      NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 7 */
257 261
		{ CONFIG_HIDE_HEADER_FILE, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 8 */
258 262
		{ CONFIG_DIR_LISTING,      NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 9 */
263
		{ CONFIG_SET_FOOTER,       NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 10 */
259 264

  
260 265
		{ NULL,                          NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
261 266
	};
......
278 283
		s->show_header = 0;
279 284
		s->hide_header_file = 0;
280 285
		s->encoding = buffer_init();
286
		s->set_footer = buffer_init();
281 287

  
282 288
		cv[0].destination = s->excludes;
283 289
		cv[1].destination = &(s->dir_listing);
......
289 295
		cv[7].destination = &(s->show_header);
290 296
		cv[8].destination = &(s->hide_header_file);
291 297
		cv[9].destination = &(s->dir_listing); /* old name */
298
		cv[10].destination = s->set_footer;
292 299

  
293 300
		p->config_storage[i] = s;
294 301
		ca = ((data_config *)srv->config_context->data[i])->value;
......
318 325
	PATCH(show_header);
319 326
	PATCH(hide_header_file);
320 327
	PATCH(excludes);
328
	PATCH(set_footer);
321 329

  
322 330
	/* skip the first, the global context */
323 331
	for (i = 1; i < srv->config_context->used; i++) {
......
348 356
				PATCH(show_header);
349 357
			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_HIDE_HEADER_FILE))) {
350 358
				PATCH(hide_header_file);
359
			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_SET_FOOTER))) {
360
				PATCH(set_footer);
351 361
			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_EXCLUDE))) {
352 362
				PATCH(excludes);
353 363
			}
......
569 579
		"<div class=\"foot\">"
570 580
	);
571 581

  
572
	if (buffer_is_empty(con->conf.server_tag)) {
582
	if (p->conf.set_footer->used > 1) {
583
		buffer_append_string_buffer(out, p->conf.set_footer);
584
	} else if (buffer_is_empty(con->conf.server_tag)) {
573 585
		BUFFER_APPEND_STRING_CONST(out, PACKAGE_NAME "/" PACKAGE_VERSION);
574 586
	} else {
575 587
		buffer_append_string_buffer(out, con->conf.server_tag);
(1-1/3)