RFE 716714: Added "Rewrite urls" option.

This commit is contained in:
Len Kranendonk 2003-06-19 11:46:17 +00:00
parent b3ab114672
commit 26f0dfc077
3 changed files with 14 additions and 3 deletions

View file

@ -54,6 +54,9 @@ sub new {
followExternal=>{
defaultValue=>1
},
rewriteUrls=>{
defaultValue=>1
},
followRedirect=>{
defaultValue=>0
}
@ -90,6 +93,11 @@ sub www_edit {
-label=>WebGUI::International::get(8,$_[0]->get("namespace")),
-value=>$_[0]->getValue("followRedirect")
);
$properties->yesNo(
-name=>"rewriteUrls",
-label=>WebGUI::International::get(12,$_[0]->get("namespace")),
-value=>$_[0]->getValue("rewriteUrls")
);
$layout->yesNo(
-name=>"removeStyle",
-label=>WebGUI::International::get(6,$_[0]->get("namespace")),
@ -226,7 +234,7 @@ sub www_view {
if($response->content_type eq "text/html" ||
($response->content_type eq "" && $content=~/<html/gis)) {
my $p = WebGUI::Wobject::HttpProxy::Parse->new($proxiedUrl, $content, $_[0]->get("wobjectId"));
my $p = WebGUI::Wobject::HttpProxy::Parse->new($proxiedUrl, $content, $_[0]->get("wobjectId"),$_[0]->get("rewriteUrls"));
$content = $p->filter; # Rewrite content. (let forms/links return to us).
$p->DESTROY;

View file

@ -51,6 +51,7 @@ sub new {
$self->{Url} = shift;
$self->{Content} = shift;
$self->{wid} = shift;
$self->{rewriteUrls} = shift;
$self->{Filtered} ="";
$self->{FormAction} = "";
$self->{FormActionIsDefined} = 0;
@ -120,7 +121,7 @@ sub start {
$val = URI::URL::url($val)->abs($self->{Url},1); # make absolute
}
if ($val->scheme eq "http") {
if (lc($tag) ne "img" && lc($tag) ne "script" && lc($tag) ne "iframe") { # no rewrite for some
if (lc($tag) ne "img" && lc($tag) ne "script" && lc($tag) ne "iframe" && $self->{rewriteUrls}) { # no rewrite for some
if (lc($tag) eq "form" && lc($_) eq "action") { # Found FORM ACTION
$self->{FormActionIsDefined}=1;
$self->{FormAction} = $val; # set FormAction to include hidden field later