RSS

(root)/bugzilla/3.6 : 6113 : attachment.cgi

To get this branch, use:
bzr branch /bugzilla/3.6

« back to all changes in this revision

Viewing changes to attachment.cgi

mkanat%bugzilla.org
2008-06-29 19:57:54
Revision ID: cvs-1:mkanatbugzilla.org-20080630025754-h0rylmikmb6z28g1
Bug 440612 â€“ Use Bugzilla::Bug->check everywhere instead of ValidateBugID
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit

Show diffs side-by-side

added added

removed removed

165
165
      || ThrowUserError("invalid_attach_id", { attach_id => $attach_id });
166
166
 
167
167
    # Make sure the user is authorized to access this attachment's bug.
168
 
    ValidateBugID($attachment->bug_id);
169
 
    if ($attachment->isprivate && $user->id != $attachment->attacher->id && !$user->is_insider) {
 
168
    Bugzilla::Bug->check($attachment->bug_id);
 
169
    if ($attachment->isprivate && $user->id != $attachment->attacher->id 
 
170
        && !$user->is_insider) 
 
171
    {
170
172
        ThrowUserError('auth_failure', {action => 'access',
171
173
                                        object => 'attachment'});
172
174
    }
281
283
# HTML page.
282
284
sub viewall {
283
285
    # Retrieve and validate parameters
284
 
    my $bugid = $cgi->param('bugid');
285
 
    ValidateBugID($bugid);
286
 
    my $bug = new Bugzilla::Bug($bugid);
 
286
    my $bug = Bugzilla::Bug->check(scalar $cgi->param('bugid'));
 
287
    my $bugid = $bug->id;
287
288
 
288
289
    my $attachments = Bugzilla::Attachment->get_attachments_by_bug($bugid);
289
290
 
301
302
# Display a form for entering a new attachment.
302
303
sub enter {
303
304
  # Retrieve and validate parameters
304
 
  my $bugid = $cgi->param('bugid');
305
 
  ValidateBugID($bugid);
 
305
  my $bug = Bugzilla::Bug->check(scalar $cgi->param('bugid'));
 
306
  my $bugid = $bug->id;
306
307
  validateCanChangeBug($bugid);
307
308
  my $dbh = Bugzilla->dbh;
308
309
  my $user = Bugzilla->user;
309
310
 
310
 
  my $bug = new Bugzilla::Bug($bugid, $user->id);
311
311
  # Retrieve the attachments the user can edit from the database and write
312
312
  # them into an array of hashes where each hash represents one attachment.
313
313
  my $canEdit = "";
344
344
    $dbh->bz_start_transaction;
345
345
 
346
346
    # Retrieve and validate parameters
347
 
    my $bugid = $cgi->param('bugid');
348
 
    ValidateBugID($bugid);
 
347
    my $bug = Bugzilla::Bug->check(scalar $cgi->param('bugid'));
 
348
    my $bugid = $bug->id;
349
349
    validateCanChangeBug($bugid);
350
350
    my ($timestamp) = Bugzilla->dbh->selectrow_array("SELECT NOW()");
351
351
 
373
373
        }
374
374
    }
375
375
 
376
 
    my $bug = new Bugzilla::Bug($bugid);
377
376
    my $attachment =
378
377
        Bugzilla::Attachment->insert_attachment_for_bug(THROW_ERROR, $bug, $user,
379
378
                                                        $timestamp, $vars);

Loggerhead 1.18.1 is a web-based interface for Bazaar branches