=cut
sub rooturl {
- # better to start with the client-provided URL
- my $cgi = &FS::UID::cgi;
- my $url_string = $cgi->isa('Apache') ? $cgi->uri : $cgi->url;
+ my $url_string;
+ if ( scalar(@_) ) {
+ $url_string = shift;
+ } else {
+ # better to start with the client-provided URL
+ my $cgi = &FS::UID::cgi;
+ $url_string = $cgi->isa('Apache') ? $cgi->uri : $cgi->url;
+ }
+
$url_string =~ s/\?.*//;
#even though this is kludgy
$url_string =~
s{
/
- (browse|config|docs|edit|graph|misc|search|view|pref|rt|elements)
- /
- (process/)?
- ([\w\-\.\/]+)
+ (browse|config|docs|edit|graph|misc|search|view|pref|rt|torrus)
+ (/process)?
+ ([\w\-\.\/]*)
$
}
{}x;
- #elements because of progress-popup.html...
- #XXX remove anything from elements that is called directly & prevent
- #those pages from being served up
-
$url_string .= '/' unless $url_string =~ /\/$/;
$url_string;