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