summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Util.pm
diff options
context:
space:
mode:
authorbbaetz%student.usyd.edu.au <>2002-10-26 10:56:55 +0200
committerbbaetz%student.usyd.edu.au <>2002-10-26 10:56:55 +0200
commit818ce46d9780c7a04ac04a3f116021f1edadd476 (patch)
tree37a73f7a26876a5690ca7f477c10ee3979689b07 /Bugzilla/Util.pm
parent37993682fd10962e944a1e5bf9633c7b08ad49e6 (diff)
downloadbugzilla-818ce46d9780c7a04ac04a3f116021f1edadd476.tar.gz
bugzilla-818ce46d9780c7a04ac04a3f116021f1edadd476.tar.xz
Bug 147833 - start using CGI.pm
r=gerv, justdave
Diffstat (limited to 'Bugzilla/Util.pm')
-rw-r--r--Bugzilla/Util.pm14
1 files changed, 13 insertions, 1 deletions
diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm
index 4d1fc3aa6..f87c6fbc6 100644
--- a/Bugzilla/Util.pm
+++ b/Bugzilla/Util.pm
@@ -27,7 +27,7 @@ package Bugzilla::Util;
use base qw(Exporter);
@Bugzilla::Util::EXPORT = qw(is_tainted trick_taint detaint_natural
- html_quote value_quote
+ html_quote url_quote value_quote
lsearch max min
trim);
@@ -64,6 +64,13 @@ sub html_quote {
return $var;
}
+# This orignally came from CGI.pm, by Lincoln D. Stein
+sub url_quote {
+ my ($toencode) = (@_);
+ $toencode =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
+ return $toencode;
+}
+
sub value_quote {
my ($var) = (@_);
$var =~ s/\&/\&amp;/g;
@@ -134,6 +141,7 @@ Bugzilla::Util - Generic utility functions for bugzilla
# Functions for quoting
html_quote($var);
+ url_quote($var);
value_quote($var);
# Functions for searching
@@ -200,6 +208,10 @@ be done in the template where possible.
Returns a value quoted for use in HTML, with &, E<lt>, E<gt>, and E<34> being
replaced with their appropriate HTML entities.
+=item C<url_quote($val)>
+
+Quotes characters so that they may be included as part of a url.
+
=item C<value_quote($val)>
As well as escaping html like C<html_quote>, this routine converts newlines