~ubuntu-branches/ubuntu/hardy/bugzilla/hardy-security

« back to all changes in this revision

Viewing changes to sidebar.cgi

  • Committer: Bazaar Package Importer
  • Author(s): Rémi Perrot
  • Date: 2004-04-02 01:13:32 UTC
  • Revision ID: james.westby@ubuntu.com-20040402011332-hxrg0n2szimd7d25
Tags: upstream-2.16.5
Import upstream version 2.16.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bonsaitools/bin/perl -wT
 
2
# -*- Mode: perl; indent-tabs-mode: nil -*-
 
3
#
 
4
# The contents of this file are subject to the Mozilla Public
 
5
# License Version 1.1 (the "License"); you may not use this file
 
6
# except in compliance with the License. You may obtain a copy of
 
7
# the License at http://www.mozilla.org/MPL/
 
8
#
 
9
# Software distributed under the License is distributed on an "AS
 
10
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 
11
# implied. See the License for the specific language governing
 
12
# rights and limitations under the License.
 
13
#
 
14
# The Original Code is the Bugzilla Bug Tracking System.
 
15
#
 
16
# Contributor(s): Jacob Steenhagen <jake@acutex.net>
 
17
 
 
18
use strict;
 
19
use diagnostics;
 
20
 
 
21
use lib ".";
 
22
require "CGI.pl";
 
23
 
 
24
# Shut up "Used Only Once" errors
 
25
use vars qw(
 
26
  $template
 
27
  $vars
 
28
);
 
29
 
 
30
ConnectToDatabase();
 
31
quietly_check_login();
 
32
 
 
33
###############################################################################
 
34
# Main Body Execution
 
35
###############################################################################
 
36
 
 
37
$vars->{'username'} = $::COOKIE{'Bugzilla_login'} || '';
 
38
 
 
39
if (defined $::COOKIE{'Bugzilla_login'}) {
 
40
    SendSQL("SELECT mybugslink, userid, blessgroupset FROM profiles " .
 
41
            "WHERE login_name = " . SqlQuote($::COOKIE{'Bugzilla_login'}));
 
42
    my ($mybugslink, $userid, $blessgroupset) = (FetchSQLData());
 
43
    $vars->{'userid'} = $userid;
 
44
    $vars->{'blessgroupset'} = $blessgroupset;
 
45
    if ($mybugslink) {
 
46
        my $mybugstemplate = Param("mybugstemplate");
 
47
        my %substs = ( 'userid' => url_quote($::COOKIE{'Bugzilla_login'}) );
 
48
        $vars->{'mybugsurl'} = PerformSubsts($mybugstemplate, \%substs);
 
49
    }
 
50
    SendSQL("SELECT name FROM namedqueries WHERE userid = $userid AND linkinfooter");
 
51
    while (MoreSQLData()) {
 
52
        my ($name) = FetchSQLData();
 
53
        push(@{$vars->{'namedqueries'}}, $name);
 
54
    }
 
55
}
 
56
 
 
57
# This sidebar is currently for use with Mozilla based web browsers.
 
58
# Internet Explorer 6 is supposed to have a similar feature, but it
 
59
# most likely won't support XUL ;)  When that does come out, this
 
60
# can be expanded to output normal HTML for IE.  Until then, I like
 
61
# the way Scott's sidebar looks so I'm using that as the base for
 
62
# this file.
 
63
# http://bugzilla.mozilla.org/show_bug.cgi?id=37339
 
64
 
 
65
my $useragent = $ENV{HTTP_USER_AGENT};
 
66
if ($useragent =~ m:Mozilla/([1-9][0-9]*):i && $1 >= 5 && $useragent !~ m/compatible/i) {
 
67
    print "Content-type: application/vnd.mozilla.xul+xml\n\n";
 
68
    # Generate and return the XUL from the appropriate template.
 
69
    $template->process("sidebar.xul.tmpl", $vars)
 
70
      || ThrowTemplateError($template->error());
 
71
} else {
 
72
    DisplayError("sidebar.cgi currently only supports Mozilla based web browsers");
 
73
    exit;
 
74
}
 
75
 
 
76
 
 
77