diff options
author | gerv%gerv.net <> | 2002-07-25 06:22:55 +0000 |
---|---|---|
committer | gerv%gerv.net <> | 2002-07-25 06:22:55 +0000 |
commit | f71149e1af4ac0b03678fc80da73a7cdc352c3aa (patch) | |
tree | e2bdebeb1b6a27171fc22b14fd5b4f9412052c3e /quips.cgi | |
parent | 8685e9a274f0b6d88d0b3447662ff8db9564c8a9 (diff) | |
download | bugs-f71149e1af4ac0b03678fc80da73a7cdc352c3aa.tar bugs-f71149e1af4ac0b03678fc80da73a7cdc352c3aa.tar.gz bugs-f71149e1af4ac0b03678fc80da73a7cdc352c3aa.tar.bz2 bugs-f71149e1af4ac0b03678fc80da73a7cdc352c3aa.tar.xz bugs-f71149e1af4ac0b03678fc80da73a7cdc352c3aa.zip |
Bug 67950 - Move the quip list into the database. Patch by davef@tetsubo.com; r=gerv, preed.
Diffstat (limited to 'quips.cgi')
-rwxr-xr-x | quips.cgi | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -20,6 +20,7 @@ # # Contributor(s): Owen Taylor <otaylor@redhat.com> # Gervase Markham <gerv@gerv.net> +# David Fallon <davef@tetsubo.com> use diagnostics; use strict; @@ -34,8 +35,6 @@ use lib qw(.); require "CGI.pl"; -# Even though quips aren't (yet) in the database, we need to check -# logins for the footer ConnectToDatabase(); quietly_check_login(); @@ -43,14 +42,16 @@ my $action = $::FORM{'action'} || ""; if ($action eq "show") { # Read in the entire quip list - if (open (COMMENTS, "<data/comments")) { - my @quips; - push (@quips, $_) while (<COMMENTS>); - close COMMENTS; - - $vars->{'quips'} = \@quips; - $vars->{'show_quips'} = 1; + SendSQL("SELECT quip FROM quips"); + + my @quips; + while (MoreSQLData()) { + my ($quip) = FetchSQLData(); + push(@quips, $quip); } + + $vars->{'quips'} = \@quips; + $vars->{'show_quips'} = 1; } if ($action eq "add") { @@ -67,9 +68,7 @@ if ($action eq "add") { exit(); } - open(COMMENTS, ">>data/comments"); - print COMMENTS $comment . "\n"; - close(COMMENTS); + SendSQL("INSERT INTO quips (userid, quip) VALUES (". $::userid . ", " . SqlQuote($comment) . ")"); $vars->{'added_quip'} = $comment; } |