From: gerv%gerv.net <> Date: Sat, 21 Sep 2002 22:17:03 +0000 (+0000) Subject: Bug 108987 - Linkify script to use quoteUrls on texts provided by user. Patch by... X-Git-Tag: bugzilla-2.17.1~127 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66493d5e7e811c387faefd8f27edadcaf762c829;p=thirdparty%2Fbugzilla.git Bug 108987 - Linkify script to use quoteUrls on texts provided by user. Patch by gerv; r=kiko. --- diff --git a/bug_form.pl b/bug_form.pl index e6b59e0510..8d7a2b02ef 100644 --- a/bug_form.pl +++ b/bug_form.pl @@ -58,7 +58,6 @@ sub show_bug { my $vars = $::vars; $vars->{'GetBugLink'} = \&GetBugLink; - $vars->{'quoteUrls'} = \"eUrls, $vars->{'lsearch'} = \&lsearch, $vars->{'header_done'} = (@_), diff --git a/globals.pl b/globals.pl index 3edcab4604..4570a56580 100644 --- a/globals.pl +++ b/globals.pl @@ -1545,6 +1545,9 @@ $::vars = # Generic linear search function 'lsearch' => \&Bugzilla::Util::lsearch , + # quoteUrls - autolinkifies text + 'quoteUrls' => \"eUrls , + # UserInGroup - you probably want to cache this 'UserInGroup' => \&UserInGroup , diff --git a/long_list.cgi b/long_list.cgi index eba0946997..6acee0332a 100755 --- a/long_list.cgi +++ b/long_list.cgi @@ -98,7 +98,6 @@ $vars->{'bugs'} = \@bugs; $vars->{'use_keywords'} = 1 if (@::legal_keywords); -$vars->{'quoteUrls'} = \"eUrls; $vars->{'str2time'} = \&str2time; # Work out a sensible filename for Content-Disposition. diff --git a/page.cgi b/page.cgi index af0903c300..960774cc4b 100755 --- a/page.cgi +++ b/page.cgi @@ -39,11 +39,14 @@ ConnectToDatabase(); quietly_check_login(); -if (defined $::FORM{'id'}) { +if ($::FORM{'id'}) { + # Remove all dodgy chars, and split into name and ctype. $::FORM{'id'} =~ s/[^\w\-\.]//g; - $::FORM{'id'} =~ /(.*)(\.(.*))?/; + $::FORM{'id'} =~ /(.*)\.(.*)/; - my $format = GetFormat($1, undef, $3); + my $format = GetFormat($1, undef, $2); + + $vars->{'form'} = \%::FORM; print "Content-Type: $format->{'ctype'}\n\n"; diff --git a/process_bug.cgi b/process_bug.cgi index be661c629b..f62285ffbb 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -1089,7 +1089,6 @@ foreach my $id (@idlist) { $vars->{'mform'} = \%::MFORM; $vars->{'bug_id'} = $id; - $vars->{'quoteUrls'} = \"eUrls; SendSQL("UNLOCK TABLES"); diff --git a/template/en/default/pages/linked.html.tmpl b/template/en/default/pages/linked.html.tmpl new file mode 100644 index 0000000000..8c854e2bd8 --- /dev/null +++ b/template/en/default/pages/linked.html.tmpl @@ -0,0 +1,43 @@ + +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Netscape Communications + # Corporation. Portions created by Netscape are + # Copyright (C) 1998 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): Stefan Seifert + # Gervase Markham + #%] + +[% INCLUDE global/header.html.tmpl title = "Your Linkified Text" %] + +

+ Copy and paste the text below: +

+ +

+ + [% quoteUrls(form.text) FILTER html %] + +

+ +

+ It will end up looking like this: +

+ +

+ [% quoteUrls(form.text) %] +

+ +[% INCLUDE global/footer.html.tmpl %] diff --git a/template/en/default/pages/linkify.html.tmpl b/template/en/default/pages/linkify.html.tmpl new file mode 100644 index 0000000000..57f455dd28 --- /dev/null +++ b/template/en/default/pages/linkify.html.tmpl @@ -0,0 +1,38 @@ + +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Netscape Communications + # Corporation. Portions created by Netscape are + # Copyright (C) 1998 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): Stefan Seifert + # Gervase Markham + #%] + +[% INCLUDE global/header.html.tmpl title = "Linkify Text" %] + +

+ If you enter some text, this form will return it marked up like a + standard Bugzilla comment. That is, valid bug numbers, URLs, email addresses + and so on will be replaced with appropriate HTML links. +

+ +
+ +
+ + +
+ +[% INCLUDE global/footer.html.tmpl %]