Code style for the rest of *.cgi
parent
7b3c75c7a0
commit
7d40840dd1
|
@ -1,6 +1,4 @@
|
|||
#!/usr/bin/perl -wT
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# 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
|
||||
|
@ -27,12 +25,12 @@ use Bugzilla;
|
|||
use Bugzilla::Constants;
|
||||
use Bugzilla::Error;
|
||||
|
||||
my $cgi = Bugzilla->cgi;
|
||||
my $template = Bugzilla->template;
|
||||
my $user = Bugzilla->login(LOGIN_REQUIRED);
|
||||
|
||||
$user->administration_visible
|
||||
|| ThrowUserError('auth_failure', {action => 'access', object => 'administrative_pages'});
|
||||
|| ThrowUserError('auth_failure', { action => 'access', object => 'administrative_pages' });
|
||||
|
||||
$template->process('admin/admin.html.tmpl')
|
||||
|| ThrowTemplateError($template->error());
|
||||
|| ThrowTemplateError($template->error());
|
||||
exit;
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
#!/usr/bin/perl -wT
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# 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
|
||||
|
@ -31,15 +29,15 @@ use Bugzilla::Keyword;
|
|||
|
||||
Bugzilla->login();
|
||||
|
||||
my $cgi = Bugzilla->cgi;
|
||||
my $template = Bugzilla->template;
|
||||
my $vars = {};
|
||||
|
||||
# Run queries against the shadow DB.
|
||||
Bugzilla->switch_to_shadow_db;
|
||||
|
||||
$vars->{'keywords'} = Bugzilla::Keyword->get_all_with_bug_count();
|
||||
$vars->{'caneditkeywords'} = Bugzilla->user->in_group("editkeywords");
|
||||
$vars->{keywords} = Bugzilla::Keyword->get_all_with_bug_count();
|
||||
$vars->{caneditkeywords} = Bugzilla->user->in_group("editkeywords");
|
||||
|
||||
$template->process("reports/keywords.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
|| ThrowTemplateError($template->error());
|
||||
exit;
|
||||
|
|
10
jsonrpc.cgi
10
jsonrpc.cgi
|
@ -1,6 +1,4 @@
|
|||
#!/usr/bin/perl -wT
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# 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
|
||||
|
@ -17,7 +15,7 @@
|
|||
# University Foundation. Portions created by the Initial Developer
|
||||
# are Copyright (C) 2008 the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Contributor(s):
|
||||
# Max Kanat-Alexander <mkanat@bugzilla.org>
|
||||
|
||||
use strict;
|
||||
|
@ -27,8 +25,10 @@ use Bugzilla;
|
|||
use Bugzilla::Constants;
|
||||
use Bugzilla::Error;
|
||||
use Bugzilla::WebService::Constants;
|
||||
BEGIN {
|
||||
if (!Bugzilla->feature('jsonrpc')) {
|
||||
BEGIN
|
||||
{
|
||||
if (!Bugzilla->feature('jsonrpc'))
|
||||
{
|
||||
ThrowCodeError('feature_disabled', { feature => 'jsonrpc' });
|
||||
}
|
||||
}
|
||||
|
|
25
query.cgi
25
query.cgi
|
@ -1,6 +1,4 @@
|
|||
#!/usr/bin/perl -wT
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# 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
|
||||
|
@ -41,7 +39,6 @@ use Bugzilla::Keyword;
|
|||
use Bugzilla::Field;
|
||||
use Bugzilla::Install::Util qw(vers_cmp);
|
||||
|
||||
my $cgi = Bugzilla->cgi;
|
||||
my $params = Bugzilla->input_params;
|
||||
my $dbh = Bugzilla->dbh;
|
||||
my $template = Bugzilla->template;
|
||||
|
@ -56,15 +53,18 @@ my $userid = $user->id;
|
|||
if ($userid)
|
||||
{
|
||||
my @oldquerycookies;
|
||||
foreach my $i (keys %{Bugzilla->cookies}) {
|
||||
if ($i =~ /^QUERY_(.*)$/) {
|
||||
push @oldquerycookies, [$1, $i, Bugzilla->cookies->{$i}];
|
||||
foreach my $i (keys %{Bugzilla->cookies})
|
||||
{
|
||||
if ($i =~ /^QUERY_(.*)$/)
|
||||
{
|
||||
push @oldquerycookies, [ $1, $i, Bugzilla->cookies->{$i} ];
|
||||
}
|
||||
}
|
||||
if (defined Bugzilla->cookies->{DEFAULTQUERY})
|
||||
{
|
||||
push @oldquerycookies, [DEFAULT_QUERY_NAME, 'DEFAULTQUERY',
|
||||
Bugzilla->cookies->{DEFAULTQUERY}];
|
||||
push @oldquerycookies, [
|
||||
DEFAULT_QUERY_NAME, 'DEFAULTQUERY', Bugzilla->cookies->{DEFAULTQUERY},
|
||||
];
|
||||
}
|
||||
if (@oldquerycookies)
|
||||
{
|
||||
|
@ -92,7 +92,7 @@ if ($userid)
|
|||
}
|
||||
$dbh->bz_commit_transaction();
|
||||
}
|
||||
$cgi->remove_cookie($cookiename);
|
||||
Bugzilla->cgi->remove_cookie($cookiename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +199,8 @@ $vars->{chart_fields} = [
|
|||
unshift @{$vars->{chart_fields}}, { id => 'noop', name => '---' };
|
||||
|
||||
# If we're not in the time-tracking group, exclude time-tracking fields.
|
||||
if (!Bugzilla->user->is_timetracker) {
|
||||
if (!Bugzilla->user->is_timetracker)
|
||||
{
|
||||
@{$vars->{chart_fields}} = grep { !TIMETRACKING_FIELDS->{$_} } @{$vars->{chart_fields}};
|
||||
}
|
||||
|
||||
|
@ -292,7 +293,7 @@ if ($vars->{query_format} eq 'create-series')
|
|||
# Set cookie to current format as default.
|
||||
if ($vars->{query_format})
|
||||
{
|
||||
$cgi->send_cookie(
|
||||
Bugzilla->cgi->send_cookie(
|
||||
-name => 'DEFAULTFORMAT',
|
||||
-value => $vars->{query_format},
|
||||
-expires => "Fri, 01-Jan-2038 00:00:00 GMT"
|
||||
|
@ -304,7 +305,7 @@ if ($vars->{query_format})
|
|||
# preserve format information; hence query_format taking priority over format.
|
||||
my $format = $template->get_format("search/search", $vars->{query_format}, $params->{ctype});
|
||||
|
||||
$cgi->send_header($format->{ctype});
|
||||
Bugzilla->cgi->send_header($format->{ctype});
|
||||
$template->process($format->{template}, $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
exit;
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
#!/usr/bin/perl -wT
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# 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
|
||||
|
@ -24,20 +22,21 @@ use Bugzilla::Constants;
|
|||
|
||||
Bugzilla->login();
|
||||
|
||||
my $cgi = Bugzilla->cgi;
|
||||
my $template = Bugzilla->template;
|
||||
my $vars = {};
|
||||
|
||||
# Return the appropriate HTTP response headers.
|
||||
$cgi->send_header('application/xml');
|
||||
Bugzilla->cgi->send_header('application/xml');
|
||||
|
||||
# Get the contents of favicon.ico
|
||||
my $filename = bz_locations()->{'libpath'} . "/images/favicon.ico";
|
||||
if (open(IN, $filename)) {
|
||||
my $filename = bz_locations()->{libpath} . "/images/favicon.ico";
|
||||
if (open(IN, $filename))
|
||||
{
|
||||
local $/;
|
||||
binmode IN;
|
||||
$vars->{'favicon'} = <IN>;
|
||||
close IN;
|
||||
}
|
||||
$template->process("search/search-plugin.xml.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
|| ThrowTemplateError($template->error());
|
||||
exit;
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
#!/usr/bin/perl -wT
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# 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
|
||||
|
@ -21,4 +19,3 @@ use strict;
|
|||
print "content-type:text/plain\n\n";
|
||||
print "OK " . ($::ENV{MOD_PERL} || "mod_cgi") . "\n";
|
||||
exit;
|
||||
|
||||
|
|
15
xmlrpc.cgi
15
xmlrpc.cgi
|
@ -1,6 +1,4 @@
|
|||
#!/usr/bin/perl -wT
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# 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
|
||||
|
@ -22,8 +20,10 @@ use Bugzilla;
|
|||
use Bugzilla::Constants;
|
||||
use Bugzilla::Error;
|
||||
use Bugzilla::WebService::Constants;
|
||||
BEGIN {
|
||||
if (!Bugzilla->feature('xmlrpc')) {
|
||||
BEGIN
|
||||
{
|
||||
if (!Bugzilla->feature('xmlrpc'))
|
||||
{
|
||||
ThrowCodeError('feature_disabled', { feature => 'xmlrpc' });
|
||||
}
|
||||
}
|
||||
|
@ -41,8 +41,7 @@ $XMLRPC::Constants::FAULT_SERVER = ERROR_UNKNOWN_FATAL;
|
|||
|
||||
local @INC = (bz_locations()->{extensionsdir}, @INC);
|
||||
my $server = new Bugzilla::WebService::Server::XMLRPC;
|
||||
# We use a sub for on_action because that gets us the info about what
|
||||
# class is being called. Note that this is a hack--this is technically
|
||||
# We use a sub for on_action because that gets us the info about what
|
||||
# class is being called. Note that this is a hack--this is technically
|
||||
# for setting SOAPAction, which isn't used by XML-RPC.
|
||||
$server->on_action(sub { $server->handle_login(WS_DISPATCH, @_) })
|
||||
->handle();
|
||||
$server->on_action(sub { $server->handle_login(WS_DISPATCH, @_) })->handle();
|
||||
|
|
Loading…
Reference in New Issue