Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

flt_owncss.c

Go to the documentation of this file.
00001 
00008 /* {{{ Initial comments */
00009 /*
00010  * $LastChangedDate: 2004-04-01 18:34:17 +0200 (Thu, 01 Apr 2004) $
00011  * $LastChangedRevision: 50 $
00012  * $LastChangedBy: ckruse $
00013  *
00014  */
00015 /* }}} */
00016 
00017 /* {{{ Includes */
00018 #include "config.h"
00019 #include "defines.h"
00020 
00021 #include <stdio.h>
00022 #include <stdlib.h>
00023 #include <string.h>
00024 #include <time.h>
00025 #include <sys/types.h>
00026 
00027 #include "readline.h"
00028 #include "hashlib.h"
00029 #include "utils.h"
00030 #include "configparser.h"
00031 #include "cfcgi.h"
00032 #include "template.h"
00033 #include "clientlib.h"
00034 /* }}} */
00035 
00036 static u_char *CSSUri = NULL;
00037 static int    CSS_Overwrite = 0;
00038 
00039 int exec_owncss_list(t_cf_hash *head,t_configuration *dc,t_configuration *vc,t_cf_template *begin,t_cf_template *end) {
00040   if(CSSUri) {
00041     tpl_cf_setvar(begin,"owncss",CSSUri,strlen(CSSUri),1);
00042 
00043     if(CSS_Overwrite) {
00044       tpl_cf_setvar(begin,"cssoverwrite","1",1,0);
00045     }
00046 
00047     return FLT_OK;
00048   }
00049 
00050   return FLT_DECLINE;
00051 }
00052 
00053 int flt_owncss_post(t_cf_hash *head,t_configuration *dc,t_configuration *vc,t_cl_thread *thread,t_cf_template *tpl) {
00054   if(CSSUri) {
00055     tpl_cf_setvar(tpl,"owncss",CSSUri,strlen(CSSUri),1);
00056 
00057     if(CSS_Overwrite) {
00058       tpl_cf_setvar(tpl,"cssoverwrite","1",1,0);
00059     }
00060 
00061     return FLT_OK;
00062   }
00063 
00064   return FLT_DECLINE;
00065 }
00066 
00067 int flt_owncss_handle(t_configfile *cf,t_conf_opt *opt,u_char **args,int argnum) {
00068   if(cf_strcmp(opt->name,"OwnCSSFile") == 0) {
00069     if(CSSUri) free(CSSUri);
00070     CSSUri = strdup(args[0]);
00071   }
00072   else {
00073     CSS_Overwrite = cf_strcmp(args[0],"yes") == 0;
00074   }
00075 
00076   return 0;
00077 }
00078 
00079 void flt_owncss_finish(void) {
00080   if(CSSUri) free(CSSUri);
00081 }
00082 
00083 t_conf_opt config[] = {
00084   { "OwnCSSFile",           flt_owncss_handle, NULL },
00085   { "OverwriteStandardCSS", flt_owncss_handle, NULL },
00086   { NULL, NULL, NULL }
00087 };
00088 
00089 t_handler_config handlers[] = {
00090   { VIEW_INIT_HANDLER, exec_owncss_list },
00091   { POSTING_HANDLER,   flt_owncss_post },
00092   { 0, NULL }
00093 };
00094 
00095 t_module_config flt_owncss = {
00096   config,
00097   handlers,
00098   NULL,
00099   NULL,
00100   NULL,
00101   flt_owncss_finish
00102 };
00103 
00104 /* eof */

Generated on Sun Apr 25 16:37:39 2004 for Classic Forum by doxygen 1.3.5