]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Modules/Factoids.pl
gmtime
[infobot.git] / src / Modules / Factoids.pl
index 45f85548a9286f07cac6e56a87029dd172dfa9be..7b1ac1446010d76c9d3aebb3593cf1004e4a7419 100644 (file)
@@ -5,7 +5,10 @@
 #     Splitted: SQLExtras.pl
 #
 
-if (&IsParam("useStrict")) { use strict; }
+use strict;
+
+use vars qw($dbh $who);
+use vars qw(%param);
 
 ###
 # Usage: &CmdFactInfo($faqtoid, $query);
@@ -49,7 +52,7 @@ sub CmdFactInfo {
        if ($time) {
            if (time() - $time > 60*60*24*7) {
                my $days = int( (time() - $time)/60/60/24 );
-               $string .= " at \037". scalar(localtime $time). "\037" .
+               $string .= " at \037". scalar(gmtime $time). "\037" .
                                " ($days days)";
            } else {
                $string .= " ".&Time2String(time() - $time)." ago";
@@ -66,7 +69,7 @@ sub CmdFactInfo {
        my $time = $factinfo{'modified_time'};
        if ($time) {
            if (time() - $time > 60*60*24*7) {
-               $string .= " at \037". scalar(localtime $time). "\037";
+               $string .= " at \037". scalar(gmtime $time). "\037";
            } else {
                $string .= " ".&Time2String(time() - $time)." ago ";
            }
@@ -106,7 +109,7 @@ sub CmdFactInfo {
        my $requested_time = $factinfo{'requested_time'};
        if ($requested_time) {
            if (time() - $requested_time > 60*60*24*7) {
-               $string .= " at \037". scalar(localtime $requested_time). "\037";
+               $string .= " at \037". scalar(gmtime $requested_time). "\037";
            } else {
                $string .= ", ".&Time2String(time() - $requested_time)." ago";
            }
@@ -671,6 +674,7 @@ sub CmdFactStats {
 
     } elsif ($type =~ /^(2|too)long$/i) {
        my @list;
+       my $query;
 
        # factoid_key.
        $query = "SELECT factoid_key FROM factoids WHERE length(factoid_key) >= $param{'maxKeySize'}";
@@ -679,14 +683,16 @@ sub CmdFactStats {
        while (my @row = $sth->fetchrow_array) {
            push(@list,$row[0]);
        }
+       $sth->finish;
 
        # factoid_value.
-       my $query = "SELECT factoid_key,factoid_value FROM factoids WHERE length(factoid_value) >= $param{'maxDataSize'}";
+       $query = "SELECT factoid_key,factoid_value FROM factoids WHERE length(factoid_value) >= $param{'maxDataSize'}";
        $sth = $dbh->prepare($query);
        $sth->execute;
        while (my @row = $sth->fetchrow_array) {
            push(@list,sprintf("\002%s\002 - %s", length($row[1]), $row[0]));
        }
+       $sth->finish;
 
        if (scalar @list == 0) {
            return "good. no factoids exceed length.";