-const char cgi_rcs[] = "$Id: cgi.c,v 1.80 2006/12/08 14:45:32 fabiankeil Exp $";
+const char cgi_rcs[] = "$Id: cgi.c,v 1.81 2006/12/09 13:49:16 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgi.c,v $
*
* Revisions :
* $Log: cgi.c,v $
+ * Revision 1.81 2006/12/09 13:49:16 fabiankeil
+ * Fix configure option --disable-toggle.
+ * Thanks to Peter Thoenen for reporting this.
+ *
* Revision 1.80 2006/12/08 14:45:32 fabiankeil
* Don't lose the FORCE_PREFIX in case of
* connection problems. Fixes #612235.
if (!err) err = map(exports, "my-hostname", 1, html_encode(csp->my_hostname ? csp->my_hostname : "unknown"), 0);
if (!err) err = map(exports, "homepage", 1, html_encode(HOME_PAGE_URL), 0);
if (!err) err = map(exports, "default-cgi", 1, html_encode(CGI_PREFIX), 0);
- if (!err) err = map(exports, "menu", 1, make_menu(caller), 0);
+ if (!err) err = map(exports, "menu", 1, make_menu(caller, csp->config->feature_flags), 0);
if (!err) err = map(exports, "code-status", 1, CODE_STATUS, 1);
if (!strncmpic(csp->config->usermanual, "file://", 7) ||
!strncmpic(csp->config->usermanual, "http", 4))
*
* Description : Returns an HTML-formatted menu of the available
* unhidden CGIs, excluding the one given in <self>
+ * and the toggle CGI if toggling is disabled.
*
- * Parameters : self = name of CGI to leave out, can be NULL for
+ * Parameters :
+ * 1 : self = name of CGI to leave out, can be NULL for
* complete listing.
+ * 2 : feature_flags = feature bitmap from csp->config
+ *
*
* Returns : menu string, or NULL on out-of-memory error.
*
*********************************************************************/
-char *make_menu(const char *self)
+char *make_menu(const char *self, const unsigned feature_flags)
{
const struct cgi_dispatcher *d;
char *result = strdup("");
/* List available unhidden CGI's and export as "other-cgis" */
for (d = cgi_dispatchers; d->name; d++)
{
+
+#ifdef FEATURE_TOGGLE
+ if (!(feature_flags & RUNTIME_FEATURE_CGI_TOGGLE) && !strcmp(d->name, "toggle"))
+ {
+ /*
+ * Suppress the toggle link if remote toggling is disabled.
+ */
+ continue;
+ }
+#endif /* def FEATURE_TOGGLE */
+
if (d->description && strcmp(d->name, self))
{
string_append(&result, "<li><a href=\"" CGI_PREFIX);
#ifndef CGI_H_INCLUDED
#define CGI_H_INCLUDED
-#define CGI_H_VERSION "$Id: cgi.h,v 1.29.2.2 2004/02/17 13:30:23 oes Exp $"
+#define CGI_H_VERSION "$Id: cgi.h,v 1.31 2006/07/18 14:48:45 david__schmidt Exp $"
/*********************************************************************
*
- * File : $Source: /cvsroot/ijbswa/current/Attic/cgi.h,v $
+ * File : $Source: /cvsroot/ijbswa/current/cgi.h,v $
*
* Purpose : Declares functions to intercept request, generate
* html or gif answers, and to compose HTTP resonses.
*
* Revisions :
* $Log: cgi.h,v $
+ * Revision 1.31 2006/07/18 14:48:45 david__schmidt
+ * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
+ * with what was really the latest development (the v_3_0_branch branch)
+ *
* Revision 1.29.2.2 2004/02/17 13:30:23 oes
* Moved cgi_error_disabled() from cgiedit.c to
* cgi.c to re-enable build with --disable-editor.
*/
extern void get_http_time(int time_offset, char * buf);
extern char *add_help_link(const char *item, struct configuration_spec *config);
-extern char *make_menu(const char *self);
+extern char *make_menu(const char *self, const unsigned feature_flags);
extern char *dump_map(const struct map *the_map);
/*