fix HttpProxy turns ampersands into semicolons

This commit is contained in:
JT Smith 2006-06-10 16:34:59 +00:00
parent 47e6e65dd1
commit 0d1d2a4675
5 changed files with 62 additions and 1 deletions

View file

@ -21,6 +21,8 @@
- fix: op=saveSettings broken
- fix: EMS Discount Pass Not Applied
- fix: Commerce checkout confirmation very confusing
- fix: HttpProxy turns ampersands into semicolons
6.99.3
- Someone removed the status from the submission templates. That has been

View file

@ -24,9 +24,26 @@ my $session = start(); # this line required
fixSurvey($session);
fixEditWorkflow($session);
fixOrphans();
updateHttpProxy();
finish($session); # this line required
#-------------------------------------------------
sub updateHttpProxy {
print "\tAllowing HTTP Proxy to use ampersands in addition to semicolons in URLs.\n" unless ($quiet);
$session->db->write("alter table HttpProxy add column useAmpersand int not null default 0");
}
#-------------------------------------------------
sub fixOrphans {
print "\tFixing orphans created by 7fixup.\n" unless ($quiet);
my $db = $session->db;
$db->write("delete from template where assetId='9tBSOV44a9JPS8CcerOvYw'");
$db->write("delete from template where assetId='B1bNjWVtzSjsvGZh9lPz_A'");
}
#-------------------------------------------------
sub fixSurvey{
my $session = shift;

View file

@ -24,6 +24,20 @@ use WebGUI::Cache;
our @ISA = qw(WebGUI::Asset::Wobject);
#-------------------------------------------------------------------
sub appendToUrl {
my $self = shift;
my $url = shift;
my $paramSet = shift;
my $seperator = ($self->get("useAmpersand")) ? "&" : ";";
if ($url =~ /\?/) {
$url .= $seperator.$paramSet;
} else {
$url .= '?'.$paramSet;
}
return $url;
}
#-------------------------------------------------------------------
sub definition {
@ -46,6 +60,10 @@ sub definition {
fieldType=>"url",
defaultValue=>'http://'
},
useAmpersand=>{
fieldType=>"yesNo",
defaultValue=>0
},
timeout=>{
fieldType=>"selectBox",
defaultValue=>30
@ -179,6 +197,12 @@ sub getEditForm {
-hoverHelp=>$i18n->get('14 description'),
-value=>$self->getValue("stopAt")
);
$tabform->getTab("properties")->yesNo(
name=>"useAmpersand",
value=>$self->getValue("useAmpersand"),
label=>$i18n->get("use ampersand"),
hoverHelp=>$i18n->get("use ampersand help")
);
return $tabform;
}
@ -276,7 +300,7 @@ sub view {
foreach my $input_name ($self->session->form->param) {
next if ($input_name !~ /^HttpProxy_/); # Skip non proxied form var's
$input_name =~ s/^HttpProxy_//;
$proxiedUrl=$self->session->url->append($proxiedUrl,"$input_name=".$self->session->form->process('HttpProxy_'.$input_name));
$proxiedUrl=$self->appendToUrl($proxiedUrl,"$input_name=".$self->session->form->process('HttpProxy_'.$input_name));
}
}
$request = HTTP::Request->new(GET => $proxiedUrl, $header) || return "wrong url"; # Create GET request
@ -385,6 +409,7 @@ sub view {
sub www_view {
my $self = shift;
return $self->session->privilege->noAccess() unless $self->canView;
$self->prepareView;
my $output = $self->view;
# this is s a stop gap. we need to do something here that deals with the real www_view and caching, etc.
if ($self->session->http->getMimeType() ne "text/html") {

View file

@ -35,6 +35,11 @@ our $HELP = {
description => 'cache timeout description',
namespace => 'Asset_HttpProxy',
},
{
title => 'use ampersand',
description => 'use ampersand help',
namespace => 'Asset_HttpProxy',
},
{
title => '6',
description => '6 description',

View file

@ -1,6 +1,18 @@
package WebGUI::i18n::English::Asset_HttpProxy;
our $I18N = {
'use ampersand help' => {
message => q|By default we use semicolons to seperate parameters in a URL. However, some older applications require the use of ampersands.|,
context => q|asset property hover help|,
lastUpdated => 0
},
'use ampersand' => {
message => q|Use ampersand as seperator?|,
context => q|asset property|,
lastUpdated => 0
},
'cache timeout description' => {
message => q|How long should the proxy cache a page, so that if it's requested again, it won't have to refetch it?|,
lastUpdated => 1047837230