1 #!/usr/bin/env perl -wT
2 # -*- Mode: perl; indent-tabs-mode: nil -*-
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/
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.
14 # The Original Code is the Bugzilla Bug Tracking System.
16 # The Initial Developer of the Original Code is Netscape Communications
17 # Corporation. Portions created by Netscape are
18 # Copyright (C) 1998 Netscape Communications Corporation. All
21 # Contributor(s): Jacob Steenhagen <jake@bugzilla.org>
22 # Frédéric Buclin <LpSolit@gmail.com>
24 ###############################################################################
25 # Script Initialization
26 ###############################################################################
28 # Make it harder for us to do dangerous things in Perl.
31 # Include the Bugzilla CGI and general utility library.
35 use Bugzilla
::Constants
;
39 # Check whether or not the user is logged in
40 my $user = Bugzilla
->login(LOGIN_OPTIONAL
);
42 ###############################################################################
44 ###############################################################################
46 my $cgi = Bugzilla
->cgi;
47 # Force to use HTTPS unless Bugzilla->params->{'ssl'} equals 'never'.
48 # This is required because the user may want to log in from here.
49 if ($cgi->protocol ne 'https' && Bugzilla
->params->{'sslbase'} ne ''
50 && Bugzilla
->params->{'ssl'} ne 'never')
52 $cgi->require_https(Bugzilla
->params->{'sslbase'});
55 my $template = Bugzilla
->template;
58 # Return the appropriate HTTP response headers.
61 if ($user->in_group('admin')) {
62 # If 'urlbase' is not set, display the Welcome page.
63 unless (Bugzilla
->params->{'urlbase'}) {
64 $template->process('welcome-admin.html.tmpl')
65 || ThrowTemplateError
($template->error());
68 # Inform the administrator about new releases, if any.
69 $vars->{'release'} = Bugzilla
::Update
::get_notifications
();
72 # Generate and return the UI (HTML page) from the appropriate template.
73 $template->process("index.html.tmpl", $vars)
74 || ThrowTemplateError
($template->error());