View | Details | Raw Unified | Return to bug 9010
Collapse All | Expand All

(-)a/tools/quotes/quotes_ajax.pl (-4 / +6 lines)
Lines 58-67 if ($params->{'action'} eq 'add') { Link Here
58
    my $new_quote_id = $dbh->{q{mysql_insertid}}; # ALERT: mysqlism here
58
    my $new_quote_id = $dbh->{q{mysql_insertid}}; # ALERT: mysqlism here
59
    $sth = $dbh->prepare('SELECT * FROM quotes WHERE id = ?;');
59
    $sth = $dbh->prepare('SELECT * FROM quotes WHERE id = ?;');
60
    $sth->execute($new_quote_id);
60
    $sth->execute($new_quote_id);
61
    print to_json($sth->fetchall_arrayref);
61
    print to_json($sth->fetchall_arrayref, {utf8 =>1});
62
    exit 1;
62
    exit 1;
63
}
63
}
64
elsif ($params->{'action'} eq 'edit') {
64
elsif ($params->{'action'} eq 'edit') {
65
    my $aaData = [];
65
    my $editable_columns = [qw(source text)]; # pay attention to element order; these columns match the quotes table columns
66
    my $editable_columns = [qw(source text)]; # pay attention to element order; these columns match the quotes table columns
66
    my $sth = $dbh->prepare("UPDATE quotes SET $editable_columns->[$params->{'column'}-1]  = ? WHERE id = ?;");
67
    my $sth = $dbh->prepare("UPDATE quotes SET $editable_columns->[$params->{'column'}-1]  = ? WHERE id = ?;");
67
    $sth->execute($params->{'value'}, $params->{'id'});
68
    $sth->execute($params->{'value'}, $params->{'id'});
Lines 71-77 elsif ($params->{'action'} eq 'edit') { Link Here
71
    }
72
    }
72
    $sth = $dbh->prepare("SELECT $editable_columns->[$params->{'column'}-1] FROM quotes WHERE id = ?;");
73
    $sth = $dbh->prepare("SELECT $editable_columns->[$params->{'column'}-1] FROM quotes WHERE id = ?;");
73
    $sth->execute($params->{'id'});
74
    $sth->execute($params->{'id'});
74
    print $sth->fetchrow_array();
75
    $aaData = $sth->fetchrow_array();
76
    print Encode::encode('utf8', $aaData);
77
75
    exit 1;
78
    exit 1;
76
}
79
}
77
elsif ($params->{'action'} eq 'delete') {
80
elsif ($params->{'action'} eq 'delete') {
Lines 106-110 else { Link Here
106
                    iTotalDisplayRecords=>  $iTotalDisplayRecords,
109
                    iTotalDisplayRecords=>  $iTotalDisplayRecords,
107
                    sEcho               =>  $params->{'sEcho'},
110
                    sEcho               =>  $params->{'sEcho'},
108
                    aaData              =>  $aaData,
111
                    aaData              =>  $aaData,
109
                  });
112
                  }, {utf8 =>1});
110
}
113
}
111
- 

Return to bug 9010