-const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.18 2002/03/16 14:57:44 jongfoster Exp $";
+const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.29 2002/04/08 16:59:08 oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgiedit.c,v $
* Stick to the short names in this file for consistency.
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * IJBSWA team. http://ijbswa.sourceforge.net
+ * Privoxy team. http://www.privoxy.org/
*
* Based on the Internet Junkbuster originally written
* by and Copyright (C) 1997 Anonymous Coders and
*
* Revisions :
* $Log: cgiedit.c,v $
+ * Revision 1.29 2002/04/08 16:59:08 oes
+ * Fixed comment
+ *
+ * Revision 1.28 2002/03/27 12:30:29 oes
+ * Deleted unsused variable
+ *
+ * Revision 1.27 2002/03/26 23:06:04 jongfoster
+ * Removing duplicate @ifs on the toggle page
+ *
+ * Revision 1.26 2002/03/26 22:59:17 jongfoster
+ * Fixing /toggle to display status consistently.
+ *
+ * Revision 1.25 2002/03/26 22:29:54 swa
+ * we have a new homepage!
+ *
+ * Revision 1.24 2002/03/24 15:23:33 jongfoster
+ * Name changes
+ *
+ * Revision 1.23 2002/03/24 13:32:41 swa
+ * name change related issues
+ *
+ * Revision 1.22 2002/03/24 13:25:43 swa
+ * name change related issues
+ *
+ * Revision 1.21 2002/03/22 18:02:48 jongfoster
+ * Fixing remote toggle
+ *
+ * Revision 1.20 2002/03/16 20:28:34 oes
+ * Added descriptions to the filters so users will know what they select in the cgi editor
+ *
+ * Revision 1.19 2002/03/16 18:38:14 jongfoster
+ * Stopping stupid or malicious users from breaking the actions
+ * file using the web-based editor.
+ *
* Revision 1.18 2002/03/16 14:57:44 jongfoster
* Full support for enabling/disabling modular filters.
*
struct editable_file
{
struct file_line * lines;
- const char * filename; /* Full pathname - e.g. "/etc/junkbuster/wibble.action" */
+ const char * filename; /* Full pathname - e.g. "/etc/privoxy/wibble.action" */
const char * identifier; /* Filename stub - e.g. "wibble". Use for CGI param. */
/* Pre-encoded with url_encode() for ease of use. */
const char * version_str; /* Last modification time, as a string. For CGI param */
/*********************************************************************
*
- * Function : cgi_error_bad_param
+ * Function : cgi_error_disabled
*
- * Description : CGI function that is called if the parameters
- * (query string) for a CGI were wrong.
+ * Description : CGI function that is called if the actions editor
+ * is called although it's disabled in config
*
* Parameters :
* 1 : csp = Current client state (buffers, headers, etc...)
}
/* FIXME: Incomplete */
- rsp->status = strdup("302 Local Redirect from Junkbuster");
+ rsp->status = strdup("302 Local Redirect from Privoxy");
if (rsp->status == NULL)
{
return JB_ERR_MEMORY;
}
if (enlist_unique_header(rsp->headers, "Location",
- CGI_PREFIX "edit-actions-list?f=ijb"))
+ CGI_PREFIX "edit-actions-list?f=default"))
{
free(rsp->status);
rsp->status = NULL;
/* Should do all global exports above this point */
- err = template_load(csp, §ion_template, "edit-actions-list-section");
+ err = template_load(csp, §ion_template, "edit-actions-list-section", 0);
if (err)
{
edit_free_file(file);
return err;
}
- err = template_load(csp, &url_template, "edit-actions-list-url");
+ err = template_load(csp, &url_template, "edit-actions-list-url", 0);
if (err)
{
free(section_template);
int index = 0;
char * filter_template;
- err = template_load(csp, &filter_template, "edit-actions-for-url-filter");
+ err = template_load(csp, &filter_template, "edit-actions-for-url-filter", 0);
if (err)
{
edit_free_file(file);
filter_name = cur_line->data.action->multi_add[ACTION_MULTI_FILTER]->first;
while ((filter_name != NULL)
- && (0 != strcmp(filter_group->filtername, filter_name->str)))
+ && (0 != strcmp(filter_group->name, filter_name->str)))
{
filter_name = filter_name->next;
}
{
filter_name = cur_line->data.action->multi_remove[ACTION_MULTI_FILTER]->first;
while ((filter_name != NULL)
- && (0 != strcmp(filter_group->filtername, filter_name->str)))
+ && (0 != strcmp(filter_group->name, filter_name->str)))
{
filter_name = filter_name->next;
}
else
{
if (!err) err = map(line_exports, "index", 1, number, 1);
- if (!err) err = map(line_exports, "name", 1, filter_group->filtername, 1);
+ if (!err) err = map(line_exports, "name", 1, filter_group->name, 1);
+ if (!err) err = map(line_exports, "description", 1, filter_group->description, 1);
if (!err) err = map_radio(line_exports, "this-filter", "ynx", current_mode);
this_line = NULL;
return JB_ERR_MEMORY;
}
- rsp->status = strdup("302 Local Redirect from Junkbuster");
+ rsp->status = strdup("302 Local Redirect from Privoxy");
if (rsp->status == NULL)
{
free(target);
return JB_ERR_MEMORY;
}
- rsp->status = strdup("302 Local Redirect from Junkbuster");
+ rsp->status = strdup("302 Local Redirect from Privoxy");
if (rsp->status == NULL)
{
free(target);
return JB_ERR_MEMORY;
}
- rsp->status = strdup("302 Local Redirect from Junkbuster");
+ rsp->status = strdup("302 Local Redirect from Privoxy");
if (rsp->status == NULL)
{
free(target);
return JB_ERR_MEMORY;
}
- rsp->status = strdup("302 Local Redirect from Junkbuster");
+ rsp->status = strdup("302 Local Redirect from Privoxy");
if (rsp->status == NULL)
{
free(target);
return JB_ERR_MEMORY;
}
- rsp->status = strdup("302 Local Redirect from Junkbuster");
+ rsp->status = strdup("302 Local Redirect from Privoxy");
if (rsp->status == NULL)
{
free(target);
return JB_ERR_MEMORY;
}
- rsp->status = strdup("302 Local Redirect from Junkbuster");
+ rsp->status = strdup("302 Local Redirect from Privoxy");
if (rsp->status == NULL)
{
free(target);
return JB_ERR_MEMORY;
}
- rsp->status = strdup("302 Local Redirect from Junkbuster");
+ rsp->status = strdup("302 Local Redirect from Privoxy");
if (rsp->status == NULL)
{
free(target);
struct map *exports;
char mode;
const char *template_name;
- jb_err err;
assert(csp);
assert(rsp);
return cgi_error_disabled(csp, rsp);
}
- if (NULL == (exports = default_exports(csp, "toggle")))
- {
- return JB_ERR_MEMORY;
- }
-
mode = get_char_param(parameters, "set");
- if (mode == 'e')
+ if (mode == 'E')
{
/* Enable */
g_bToggleIJB = 1;
}
- else if (mode == 'd')
+ else if (mode == 'D')
{
/* Disable */
g_bToggleIJB = 0;
}
- else if (mode == 't')
+ else if (mode == 'T')
{
/* Toggle */
g_bToggleIJB = !g_bToggleIJB;
}
- err = map_conditional(exports, "enabled", g_bToggleIJB);
- if (err)
+ if (NULL == (exports = default_exports(csp, "toggle")))
{
- free_map(exports);
- return err;
+ return JB_ERR_MEMORY;
}
template_name = (get_char_param(parameters, "mini")