summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortravis%sedsystems.ca <>2005-02-04 02:37:07 +0100
committertravis%sedsystems.ca <>2005-02-04 02:37:07 +0100
commit9f4501f4c4cd015355dac29532dcd43a7d54abf5 (patch)
tree0fd106a68519db0ee7e005f4e70db26c4a6586fd
parent5a017c4d6d75553d8128b626c3d9acc8e00adbe7 (diff)
downloadbugzilla-9f4501f4c4cd015355dac29532dcd43a7d54abf5.tar.gz
bugzilla-9f4501f4c4cd015355dac29532dcd43a7d54abf5.tar.xz
Bug 277623 : Move PerformSubsts() out of globals.pl
Patch by Max Kanat-Alexander <mkanat@kerio.com> r=vladd a=justdave
-rw-r--r--Bugzilla/BugMail.pm26
-rw-r--r--globals.pl7
-rwxr-xr-xshowdependencygraph.cgi1
3 files changed, 27 insertions, 7 deletions
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm
index 7de3e63cb..f81c1615d 100644
--- a/Bugzilla/BugMail.pm
+++ b/Bugzilla/BugMail.pm
@@ -30,6 +30,11 @@ use strict;
package Bugzilla::BugMail;
+use base qw(Exporter);
+@Bugzilla::BugMail::EXPORT = qw(
+ PerformSubsts
+);
+
use Bugzilla::RelationSet;
use Bugzilla::Config qw(:DEFAULT $datadir);
@@ -903,4 +908,25 @@ sub MessageToMTA ($) {
$mailer->close;
}
+# Performs substitutions for sending out email with variables in it,
+# or for inserting a parameter into some other string.
+#
+# Takes a string and a reference to a hash containing substitution
+# variables and their values.
+#
+# If the hash is not specified, or if we need to substitute something
+# that's not in the hash, then we will use parameters to do the
+# substitution instead.
+#
+# Substitutions are always enclosed with '%' symbols. So they look like:
+# %some_variable_name%. If "some_variable_name" is a key in the hash, then
+# its value will be placed into the string. If it's not a key in the hash,
+# then the value of the parameter called "some_variable_name" will be placed
+# into the string.
+sub PerformSubsts ($;$) {
+ my ($str, $substs) = (@_);
+ $str =~ s/%([a-z]*)%/(defined $substs->{$1} ? $substs->{$1} : Param($1))/eg;
+ return $str;
+}
+
1;
diff --git a/globals.pl b/globals.pl
index 12f9788bb..6957256a3 100644
--- a/globals.pl
+++ b/globals.pl
@@ -1276,13 +1276,6 @@ sub RemoveVotes {
}
}
-sub PerformSubsts {
- my ($str, $substs) = (@_);
- $str =~ s/%([a-z]*)%/(defined $substs->{$1} ? $substs->{$1} : Param($1))/eg;
- return $str;
-}
-
-
###############################################################################
# Constructs a format object from URL parameters. You most commonly call it
diff --git a/showdependencygraph.cgi b/showdependencygraph.cgi
index da7f0d7b8..9591a284d 100755
--- a/showdependencygraph.cgi
+++ b/showdependencygraph.cgi
@@ -29,6 +29,7 @@ use File::Temp;
use Bugzilla;
use Bugzilla::Config qw(:DEFAULT $webdotdir);
use Bugzilla::Util;
+use Bugzilla::BugMail;
require "CGI.pl";