use Bugzilla::Util;
use Bugzilla::Error;
use Bugzilla::User;
+use Bugzilla::Token;
my $user = Bugzilla->login(LOGIN_REQUIRED);
my $vars = {};
my $action = $cgi->param('action') || "";
+my $token = $cgi->param('token');
if ($action eq "show") {
# Read in the entire quip list
(Bugzilla->params->{'quip_list_entry_control'} eq "closed") &&
ThrowUserError("no_new_quips");
+ check_hash_token($token, ['create-quips']);
# Add the quip
my $approved = (Bugzilla->params->{'quip_list_entry_control'} eq "open")
|| Bugzilla->user->in_group('admin') || 0;
|| ThrowUserError("auth_failure", {group => "admin",
action => "approve",
object => "quips"});
-
+
+ check_hash_token($token, ['approve-quips']);
# Read in the entire quip list
my $quipsref = $dbh->selectall_arrayref("SELECT quipid, approved FROM quips");
my $quipid = $cgi->param("quipid");
ThrowCodeError("need_quipid") unless $quipid =~ /(\d+)/;
$quipid = $1;
+ check_hash_token($token, ['quips', $quipid]);
($vars->{'deleted_quip'}) = $dbh->selectrow_array(
"SELECT quip FROM quips WHERE quipid = ?",
<form method="post" action="quips.cgi">
<input type="hidden" name="action" value="add">
+ <input type="hidden" name="token"
+ value="[% issue_hash_token(['create-quips']) FILTER html %]">
<input size="80" name="quip">
<p>
<input type="submit" id="add" value="Add This Quip">
</p>
<form name="editform" method="post" action="quips.cgi">
<input type="hidden" name="action" value="approve">
+ <input type="hidden" name="token"
+ value="[% issue_hash_token(['approve-quips']) FILTER html %]">
<table border="1">
<thead><tr>
<th>Quip</th>
[% "Unknown" IF NOT users.$userid %]
</td>
<td>
- <a href="quips.cgi?action=delete&quipid=[% quipid FILTER url_quote %]">
+ <a href="quips.cgi?action=delete&quipid=[% quipid FILTER url_quote %]&token=
+ [%- issue_hash_token(['quips', quipid]) FILTER url_quote %]">
Delete
</a>
</td>