X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FCGI.pm;h=f33a718fa68711b8dda79cd4a1f70c1716776d33;hb=624b2d44625f69d71175c3348cae635d580c890b;hp=96047f667faf46143a8c48b75b9221fa853f5ed3;hpb=3800ef16a8afab08bcec3f2f3c9ad7dc6657069d;p=freeside.git diff --git a/FS/FS/CGI.pm b/FS/FS/CGI.pm index 96047f667..f33a718fa 100644 --- a/FS/FS/CGI.pm +++ b/FS/FS/CGI.pm @@ -194,16 +194,24 @@ sub myexit { } } -=item popurl LEVEL +=item popurl LEVEL [URL] -Returns current URL with LEVEL levels of path removed from the end (default 0). +Returns current (or, optionally, passed) URL with LEVEL levels of path removed +from the end (default 0). =cut sub popurl { - my($up)=@_; - my $cgi = &FS::UID::cgi; - my $url_string = $cgi->isa('Apache') ? $cgi->uri : $cgi->url; + my $up = shift; + + my $url_string; + if ( scalar(@_) ) { + $url_string = shift; + } else { + my $cgi = &FS::UID::cgi; + $url_string = $cgi->isa('Apache') ? $cgi->uri : $cgi->url; + } + $url_string =~ s/\?.*//; my $url = new URI::URL ( $url_string ); my(@path)=$url->path_components; @@ -233,7 +241,7 @@ sub rooturl { (browse|config|docs|edit|graph|misc|search|view|pref|rt|elements) / (process/)? - ([\w\-\.\/]+) + ([\w\-\.\/]*) $ } {}x;