open (FUNNYFEET, "$EntriesPath/$IN{'entry'}.cgi") || &gm_dangermouse("Can't open $EntriesPath/$IN{'entry'}.cgi. Please make sure your paths are configured correctly and that your entries/archives directory is CHMODed to 777.");
open (FUNNYFEET, "gm-banlist.cgi") || &gm_dangermouse("Can't read the banlist file. Please make sure that gm-banlist.cgi is CHMODed to 666 and is in the same place as all your other Greymatter CGI files.");
if (($keeplog eq "yes") && ($logkarmaandcomments eq "yes")) {
&date;
open (FUNNYFEET, ">>gm-cplog.cgi") || &gm_dangermouse("Can't write to the control panel log. Please make sure that gm-cplog.cgi is CHMODed to 666 and is in the same place as all your other Greymatter CGI files.");
print FUNNYFEET "<FONT SIZE=1>[$basedate] [$userip]</FONT> <FONT COLOR=\"#FF0000\"><B>A banned IP ($checkthisip/$checkthisiphost";
if ($checkthisperson ne "") { print FUNNYFEET ", \"$checkthisperson\""; }
print FUNNYFEET ") attempted to cast a $IN{'vote'} karma vote on entry #$IN{'entry'}</B></FONT>\n";
close (FUNNYFEET);
}
print "Content-type: text/html\n";
print<<GMBANNEDNOTICE;
$gmheadtag
$gmframetop
You have been banned from voting on this site.<BR>(IP: $userip)
$gmframebottom
</BODY>
</HTML>
GMBANNEDNOTICE
exit;
}
}
}
}
# --------------------------------
# check if karma votes can be cast
# --------------------------------
sub gm_allowedcheck {
if (($posttoarchives eq "no") && ($thisentrynumber <= $newarchivenumber)) {
if (($keeplog eq "yes") && ($logkarmaandcomments eq "yes")) {
&date;
open (FUNNYFEET, ">>gm-cplog.cgi") || &gm_dangermouse("Can't write to the control panel log. Please make sure that gm-cplog.cgi is CHMODed to 666 and is in the same place as all your other Greymatter CGI files.");
print FUNNYFEET "<FONT SIZE=1>[$basedate] [$userip]</FONT> A $IN{'vote'} karma vote was blocked from being added to archived entry #$IN{'entry'}\n";
close (FUNNYFEET);
}
print "Content-type: text/html\n";
print<<GMKARMADISALLOWEDNOTICE;
$gmheadtag
$gmframetop
Sorryùkarma votes cannot be cast on archived entries. Please use your browser's Back button to return.
if (($keeplog eq "yes") && ($logkarmaandcomments eq "yes")) {
&date;
open (FUNNYFEET, ">>gm-cplog.cgi") || &gm_dangermouse("Can't write to the control panel log. Please make sure that gm-cplog.cgi is CHMODed to 666 and is in the same place as all your other Greymatter CGI files.");
print FUNNYFEET "<FONT SIZE=1>[$basedate] [$userip]</FONT> A $IN{'vote'} karma vote was blocked from being cast on entry #$IN{'newcommententrynumber'}\n";
close (FUNNYFEET);
}
print "Content-type: text/html\n";
print<<GMKARMABLOCKEDNOTICE;
$gmheadtag
$gmframetop
Sorryùkarma votes cannot be cast on this entry. Please use your browser's Back button to return.
$gmframebottom
</BODY>
</HTML>
GMKARMABLOCKEDNOTICE
exit;
}
}
# --------------------------------------
# check if this person has already voted
# --------------------------------------
sub gm_votetwicecheck {
@pastkarmavotes = split (/\|/, $entrylines[1]);
$votedtwice = "no";
foreach $googoogajoob (@pastkarmavotes) {
if ($googoogajoob eq $userip) {
if ($allowmultiplekarmavotes eq "yes") {
$votedtwice = "yes";
} else {
if (($keeplog eq "yes") && ($logkarmaandcomments eq "yes")) {
&date;
open (FUNNYFEET, ">>gm-cplog.cgi") || &gm_dangermouse("Can't write to the control panel log. Please make sure that gm-cplog.cgi is CHMODed to 666 and is in the same place as all your other Greymatter CGI files.");
print FUNNYFEET "<FONT SIZE=1>[$basedate] [$userip]</FONT> A repeat karma vote ($IN{'vote'}) was blocked from being added to entry #$IN{'entry'}\n";
close (FUNNYFEET);
}
print "Content-type: text/html\n";
print<<GMVOTETWICEDISALLOWEDNOTICE;
$gmheadtag
$gmframetop
Sorryùyou can't vote twice on the same entry. Please use your browser's Back button to return.
$gmframebottom
</BODY>
</HTML>
GMVOTETWICEDISALLOWEDNOTICE
exit;
}
}
}
}
# ---------------------------
# check if the input is blank
# ---------------------------
sub gm_blankcheck {
if (($IN{'vote'} eq "") || ($IN{'entry'} eq "")) {
print "Content-type: text/html\n";
print<<GMBLANKNOTICE;
$gmheadtag
$gmframetop
Error: Blank fields reported in the karma module input. Please report to this site's webmaster.
open (FUNNYFEET, ">$EntriesPath/$IN{'entry'}.cgi") || &gm_dangermouse("Can't write to $EntriesPath/$IN{'entry'}.cgi. Please make sure that your paths are configured correctly and that your entries/archives directory is CHMODed to 777.");
open (THISFILE, ">$EntriesPath/$IN{'entry'}.$entrysuffix") || &gm_dangermouse("Can't write to $EntriesPath/$IN{'entry'}.$entrysuffix. Please make sure that your paths are configured correctly and that your entries/archives directory is CHMODed to 777.");;
print THISFILE $entryreturn;
close (THISFILE);
}
if ($thisentryisanarchive eq "no") {
&gm_generatemainindex;
} else {
&gm_readcounter;
$stoppednumber = $newarchivenumber;
do { &gm_generatearchive($stoppednumber); } until $stoppednumber <= 1;
}
&gm_readconfig;
if (($NotifyForStatus eq "karma") || ($NotifyForStatus eq "both")) {
if ($NotifyEmail ne "") {
&gm_getentryvariables($IN{'entry'});
$sendithere = "$mailprog -t";
@sendestinations = split (/;/, $NotifyEmail);
foreach $destinationow (@sendestinations) {
open (MAIL, "|$sendithere") || &gm_dangermouse("Can't open the mail program at $mailprog. Please make sure you have this configured correctly.");
print MAIL <<__MAILNOTIFY__;
To: $destinationow
From: $destinationow
Subject: [Greymatter] Notice: Karma Vote Cast
A $IN{'vote'} karma vote has just been cast by $userip IP on entry #$thisentrynumber ($thisentrysubject). That brings this entry to $thisentrypositivekarma positive and $thisentrynegativekarma negative karma votes for a $thisentrytotalkarma total karma rating.
-----
Greymatter $gmversion
http://noahgrey.com/greysoft/
__MAILNOTIFY__
close(MAIL);
}
}
}
if (($keeplog eq "yes") && ($logkarmaandcomments eq "yes")) {
&date;
open (FUNNYFEET, ">>gm-cplog.cgi") || &gm_dangermouse("Can't write to the control panel log. Please make sure that gm-cplog.cgi is CHMODed to 666 and is in the same place as all your other Greymatter CGI files.");
print FUNNYFEET "<FONT SIZE=1>[$basedate] [$userip]</FONT> <I>A $IN{'vote'} karma vote was cast on entry #$thisentrynumber ($thisentrysubject)</I>\n";