File: layout.c

package info (click to toggle)
libapache-mod-layout 3.2.1-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 328 kB
  • ctags: 224
  • sloc: ansic: 1,448; makefile: 122; sh: 43
file content (50 lines) | stat: -rw-r--r-- 1,406 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* 
**  footer.c -- Apache layout module
**  $Revision: 1.2 $
*/

#include "mod_layout.h"

LAYOUT_EXPORT(void) layout_print(request_rec *r, layout_conf *cfg, layout_request *info, int x) {
	int status = OK;
	layout_string **layouts;
	int assbackwards = 0;

	layouts = (layout_string **) cfg->layouts->elts;

#ifdef DEBUG
	if (layouts[x]->kind == FOOTER)
		printf("Calling Footer %s\n", layouts[x]->comment);
	else if (layouts[x]->kind == LAYOUT)
		printf("Calling Layout %s\n", layouts[x]->comment);
	else if (layouts[x]->kind == HEADER)
		printf("Calling Header %s\n", layouts[x]->comment);
#endif

	if (layouts[x]->kind == HEADER) {
		if(isOn(cfg->comment)){
			unless((x == 0 && (info->http == HEADER)))
				ap_rprintf(r, "\n\n<!-- Beginning of: %s -->\n\n", layouts[x]->comment);
		}
	} else {
		if (isOn(cfg->comment)) 
			ap_rprintf(r, "\n\n<!-- Beginning of: %s -->\n\n", layouts[x]->comment);
	}

	if (layouts[x]->type > 0){ 
		ap_rputs(layouts[x]->string, r);
	} else {
		if(x == 0 && (info->http == HEADER)) {
			assbackwards = 0;
		} else {
			assbackwards = 1;
		}

		if ((status = call_container(r, layouts[x]->string, cfg, info, assbackwards)) != OK) { 
			ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, r, "The following error occured while processing the Layout : %d", status);
		}
	}

	if (isOn(cfg->comment)) 
		ap_rprintf(r, "\n\n<!-- End of: %s -->\n\n", layouts[x]->comment );
}