X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=cgisimple.c;h=a7678ae2408ca176b5f9f3dc47d73a8ff53681c9;hp=34cc5819b3a56262c6f9cff578eb7e63c5c30642;hb=85f8f1f3c449c32ed68ae727b932e0c66940c3cc;hpb=80b8fdfab0b5828b0a3cbdf7093c710fbde0306e diff --git a/cgisimple.c b/cgisimple.c index 34cc5819..a7678ae2 100644 --- a/cgisimple.c +++ b/cgisimple.c @@ -1,4 +1,3 @@ -const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.139 2016/05/08 10:44:39 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/cgisimple.c,v $ @@ -6,7 +5,7 @@ const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.139 2016/05/08 10:44:39 fabia * Purpose : Simple CGIs to get information about Privoxy's * status. * - * Copyright : Written by and Copyright (C) 2001-2016 the + * Copyright : Written by and Copyright (C) 2001-2017 the * Privoxy team. http://www.privoxy.org/ * * Based on the Internet Junkbuster originally written @@ -64,9 +63,6 @@ const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.139 2016/05/08 10:44:39 fabia #include "client-tags.h" #endif -const char cgisimple_h_rcs[] = CGISIMPLE_H_VERSION; - -static char *show_rcs(void); static jb_err show_defines(struct map *exports); static jb_err cgi_show_file(struct client_state *csp, struct http_response *rsp, @@ -310,9 +306,9 @@ static void cgi_create_client_tag_form(char *form, size_t size, } snprintf(form, size, - "
", tag, toggle_state, !expires, button_name); @@ -343,12 +339,9 @@ jb_err cgi_show_client_tags(struct client_state *csp, struct map *exports; struct client_tag_spec *this_tag; jb_err err = JB_ERR_OK; - const char *toggled_tag; - const char *toggle_state; - const char *tag_expires; - time_t time_to_live; - char *client_tags; + char *client_tag_status; char buf[1000]; + time_t refresh_delay; assert(csp); assert(rsp); @@ -358,38 +351,16 @@ jb_err cgi_show_client_tags(struct client_state *csp, { return JB_ERR_MEMORY; } - - toggled_tag = lookup(parameters, "tag"); - if (*toggled_tag != '\0') - { - tag_expires = lookup(parameters, "expires"); - if (*tag_expires == '0') - { - time_to_live = 0; - } - else - { - time_to_live = csp->config->client_tag_lifetime; - } - toggle_state = lookup(parameters, "toggle-state"); - if (*toggle_state == '1') - { - enable_client_specific_tag(csp, toggled_tag, time_to_live); - } - else - { - disable_client_specific_tag(csp, toggled_tag); - } - } + assert(csp->client_address != NULL); this_tag = csp->config->client_tags; if (this_tag->name == NULL) { - client_tags = strdup_or_die("No tags available.
\n")); + client_tag_status = strdup_or_die("No tags available.
\n"); } else { - client_tags = strdup_or_die("Tag name | \n" "Current state | Change state | Description |
---|---|---|---|
"); - if (!err) err = string_append(&client_tags, this_tag->name); - if (!err) err = string_append(&client_tags, " | "); - if (!err) err = string_append(&client_tags, tag_state == 1 ? "Enabled" : "Disabled"); - if (!err) err = string_append(&client_tags, " | "); + if (!err) err = string_append(&client_tag_status, " | |
"); + if (!err) err = string_append(&client_tag_status, this_tag->name); + if (!err) err = string_append(&client_tag_status, " | "); + if (!err) err = string_append(&client_tag_status, tag_state == 1 ? "Enabled" : "Disabled"); + if (!err) err = string_append(&client_tag_status, " | "); cgi_create_client_tag_form(buf, sizeof(buf), this_tag->name, !tag_state, 1); - if (!err) err = string_append(&client_tags, buf); + if (!err) err = string_append(&client_tag_status, buf); if (tag_state == 0) { cgi_create_client_tag_form(buf, sizeof(buf), this_tag->name, !tag_state, 0); - if (!err) err = string_append(&client_tags, buf); + if (!err) err = string_append(&client_tag_status, buf); } - if (!err) err = string_append(&client_tags, " | "); - if (!err) err = string_append(&client_tags, this_tag->description); - if (!err) err = string_append(&client_tags, " | "); + if (!err) err = string_append(&client_tag_status, this_tag->description); + if (!err) err = string_append(&client_tag_status, " | \n"); if (err) { - free_map(exports); - return JB_ERR_MEMORY; + break; } this_tag = this_tag->next; } - if (!err) err = string_append(&client_tags, "