Commit d0050300 authored by jocuri%softhome.net's avatar jocuri%softhome.net

Patch for bug 234879: remove %FORM from editkeywords.cgi; r=kiko, a=justdave.

parent 11891792
...@@ -27,6 +27,8 @@ require "CGI.pl"; ...@@ -27,6 +27,8 @@ require "CGI.pl";
use Bugzilla::Config qw(:DEFAULT $datadir); use Bugzilla::Config qw(:DEFAULT $datadir);
my $cgi = Bugzilla->cgi;
use vars qw($template $vars); use vars qw($template $vars);
...@@ -62,11 +64,9 @@ unless (UserInGroup("editkeywords")) { ...@@ -62,11 +64,9 @@ unless (UserInGroup("editkeywords")) {
} }
my $action = trim($::FORM{action} || ''); my $action = trim($cgi->param('action') || '');
$vars->{'action'} = $action; $vars->{'action'} = $action;
detaint_natural($::FORM{id});
if ($action eq "") { if ($action eq "") {
my @keywords; my @keywords;
...@@ -115,8 +115,8 @@ if ($action eq 'add') { ...@@ -115,8 +115,8 @@ if ($action eq 'add') {
if ($action eq 'new') { if ($action eq 'new') {
# Cleanups and valididy checks # Cleanups and valididy checks
my $name = trim($::FORM{name} || ''); my $name = trim($cgi->param('name') || '');
my $description = trim($::FORM{description} || ''); my $description = trim($cgi->param('description') || '');
Validate($name, $description); Validate($name, $description);
...@@ -173,7 +173,9 @@ if ($action eq 'new') { ...@@ -173,7 +173,9 @@ if ($action eq 'new') {
# #
if ($action eq 'edit') { if ($action eq 'edit') {
my $id = trim($::FORM{id} || 0); my $id = trim(cgi->param('id'));
detaint_natural($id);
# get data of keyword # get data of keyword
SendSQL("SELECT name,description SendSQL("SELECT name,description
FROM keyworddefs FROM keyworddefs
...@@ -211,9 +213,11 @@ if ($action eq 'edit') { ...@@ -211,9 +213,11 @@ if ($action eq 'edit') {
# #
if ($action eq 'update') { if ($action eq 'update') {
my $id = $::FORM{id}; my $id = $cgi->param('id');
my $name = trim($::FORM{name} || ''); detaint_natural($id);
my $description = trim($::FORM{description} || '');
my $name = trim($cgi->param('name') || '');
my $description = trim($cgi->param('description') || '');
Validate($name, $description); Validate($name, $description);
...@@ -246,12 +250,13 @@ if ($action eq 'update') { ...@@ -246,12 +250,13 @@ if ($action eq 'update') {
if ($action eq 'delete') { if ($action eq 'delete') {
my $id = $::FORM{id}; my $id = $cgi->param('id');
detaint_natural($id);
SendSQL("SELECT name FROM keyworddefs WHERE id=$id"); SendSQL("SELECT name FROM keyworddefs WHERE id=$id");
my $name = FetchOneColumn(); my $name = FetchOneColumn();
if (!$::FORM{reallydelete}) { if (!$cgi->param('reallydelete')) {
SendSQL("SELECT count(*) SendSQL("SELECT count(*)
FROM keywords FROM keywords
WHERE keywordid = $id"); WHERE keywordid = $id");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment