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 51 52 53 54 55 56 57 58 59 60
|
/*
** footer.c -- Apache layout module
** $Revision: 1.2 $
**
** Copyright 2007 Brian Aker brian@tangent.org
**
** Please see "LICENSE" file that was included in the distribution.
**
*/
#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))
{
if ((x == 0 && (info->http == HEADER)) == 0)
ap_fprintf(info->f, info->b, "\n\n<!-- Beginning of: %s -->\n\n", layouts[x]->comment);
}
}
else
{
if (isOn(cfg->comment))
ap_fprintf(info->f, info->b, "\n\n<!-- Beginning of: %s -->\n\n", layouts[x]->comment);
}
if (layouts[x]->type > 0)
ap_fputs(info->f, info->b, layouts[x]->string);
else
{
if (x == 0 && (info->http == HEADER))
assbackwards = 0;
else
assbackwards = 1;
ap_fflush(info->f, info->b);
if ((status = call_container(r, layouts[x]->string, cfg, info, assbackwards)) != OK)
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, r, "The following error occured while processing the Layout : %d", status);
}
if (isOn(cfg->comment))
ap_fprintf(info->f, info->b, "\n\n<!-- End of: %s -->\n\n", layouts[x]->comment );
}
|