]> ruin.nu Git - ndwebbie.git/blobdiff - index.pl
launchConfirmation and minor fixes
[ndwebbie.git] / index.pl
index 1b55a133f8c3b74b9ccc1d4a21208ebe9e0958fc..9adbbd75ebd60921732a14182c1c5936a1f59b44 100755 (executable)
--- a/index.pl
+++ b/index.pl
@@ -51,6 +51,7 @@ for my $file ("db.pl","include.pl"){
 
 ($TICK) = $DBH->selectrow_array('SELECT tick()',undef);
 
+
 my $query = $DBH->prepare('SELECT groupname,attack,gid from groupmembers NATURAL JOIN groups WHERE uid = ?');
 $query->execute($UID);
 
@@ -61,17 +62,11 @@ while (my ($name,$attack,$gid) = $query->fetchrow()){
        $ATTACKER = 1 if $attack;
 }
 
-$TEMPLATE->param(Tick => $TICK);
-$TEMPLATE->param(isMember => isMember());
-$TEMPLATE->param(isHC => isHC());
-$TEMPLATE->param(isDC => isDC());
-$TEMPLATE->param(isBC => isBC());
-$TEMPLATE->param(isAttacker => $ATTACKER);
 
 our $LOG = $DBH->prepare('INSERT INTO log (uid,text) VALUES(?,?)');
 
 my $page = 'main';
-if (param('page') =~ /^(main|check)$/){
+if (param('page') =~ /^(main|check|motd|points|covop|top100|launchConfirmation)$/){
        $page = $1;
 }
 
@@ -84,6 +79,15 @@ unless (my $return = do "${page}.pl"){
        print "<p><b>couldn't run $page</b></p>"       unless $return;
 }
 
+my $fleetupdate = $DBH->selectrow_array('SELECT landing_tick FROM fleets WHERE uid = ? AND fleet = 0',undef,$UID);
+
+$TEMPLATE->param(Tick => $TICK);
+$TEMPLATE->param(isMember => (($TICK - $fleetupdate < 24) || isScanner()) && $PLANET && isMember());
+$TEMPLATE->param(isHC => isHC());
+$TEMPLATE->param(isDC => isDC());
+$TEMPLATE->param(isBC => isBC());
+$TEMPLATE->param(isAttacker => $ATTACKER && (!isMember() || ((($TICK - $fleetupdate < 24) || isScanner()) && $PLANET)));
+
 $ND::TEMPLATE->param(BODY => $ND::BODY->output);
 print $TEMPLATE->output;