Example #1
0
 function get_ids()
 {
     # order matters!!!!
     if (is_null($this->alliance_id)) {
         $this->alliance_id = get_alliance_id($this->alliance);
     }
     if (is_null($this->corp_id)) {
         $this->corp_id = get_corp_id($this->corp, $this->alliance_id);
     }
     if (is_null($this->pilot_id)) {
         $this->pilot_id = get_pilot_id($this->pilot, $this->corp_id);
     }
     if (is_null($this->char_id)) {
         $this->char_id = get_pilot_charid($this->pilot_id);
     }
     if (is_null($this->ship_id)) {
         $this->ship_id = get_item_id($this->ship);
     }
     if (is_null($this->group_id)) {
         $this->group_id = get_item_group_id($this->ship_id);
     }
     if (is_null($this->weapon_id)) {
         $this->weapon_id = get_item_id($this->weapon);
     }
 }
Example #2
0
function get_corp_id($name, $allianceid = null, $first = 1)
{
    global $ft;
    if (is_null($name)) {
        return 0;
    }
    $corp = $ft->dbh->_select_row_as_object('SELECT corpid, allianceid FROM tbl:corps WHERE name = ?', array($name));
    $corpid = null;
    if ($corp) {
        $corpid = $corp->corpid;
        if ($allianceid && $corp->allianceid != $allianceid) {
            $ft->dbh->_do_query('UPDATE tbl:corps SET allianceid = ? WHERE corpid = ?', array($allianceid, $corpid));
        }
    }
    if (!$corpid && !is_null($allianceid) && $first) {
        if ($allianceid <= 0) {
            $allianceid = null;
        }
        $ft->dbh->_do_query('INSERT INTO tbl:corps (name, allianceid) VALUES (?, ?)', array($name, $allianceid));
        $corpid = get_corp_id($name, $allianceid, 0);
    }
    return $corpid;
}
    return $ft->igberrorpage('Sorry, that run is already scheduled by <font color="#ff0000">' . get_corp_name($run->corpid) . '</font>.');
}
# see if they are allowed to reserve spots
# FIXME: implement
if (0) {
    return $ft->igberrorpage('Sorry, you must be an accountant or director in your corporation in order to schedule a run.');
}
# store output here
$out = "<center><b><font color='#ffff00'>Plexer - The Complex Scheduler</font></b><br />";
$out .= "<font color='#ff0000'><b>{$plex->name}</b> in <b>{$plex->system}</b> rated <b>{$plex->rating}/10</b></font><br />";
$out .= "[ <a href='{$_WEB_URL}/'>Back to Top</a> ] [ <a href='{$_WEB_URL}/igb-showcomplex.php?id={$id}'>Back to Complex</a> ]";
$out .= "</center><br />";
# if they're trying to confirm
if ($_GET['confirm'] == 1) {
    # okay, set the confirmation
    $run = submit_schedule($id, $dayid, $slotid, get_corp_id($ft->eve->CorpName), get_pilot_id($ft->eve->CharName));
    $out .= "Your reservation has been confirmed.  <b>Good luck!</b>";
} else {
    # so they want to reserve it eh...
    $out .= "Okay, so you want to run a complex?  Well, from the looks of it, the run you've chosen is not ";
    $out .= "already reserved for someone.  That's good for you, means you should be able to get in.";
    $out .= "<p>Please review the information below and confirm that you intend to run this complex.  <b>You are ";
    $out .= "responsible for ensuring your corporation/group runs the complex.  If you reserve slots and do not ";
    $out .= "use them, we will hunt you down and barbeque you.  :-)</p>";
    # now dump the information
    $info = array("Complex" => "<a href='{$_WEB_URL}/igb-showcomplex.php?id={$id}'>{$plex->name}</a> (" . $plex->rating . "/10)", "System" => $plex->system . " (" . $plex->region . ")", "a" => "-", "Date" => stddate(slot_to_date($dayid)), "Name" => get_complex_slot_name($slotid), "Description" => get_complex_slot_desc($slotid), "b" => "-", "Reserve for corp" => $ft->eve->CorpName, "Reserve by pilot" => $ft->eve->CharName);
    foreach ($info as $k => $v) {
        if ($v == "-") {
            $out .= "<br />";
            continue;
        }
<?php

include 'lib/fortissimo.php';
# if not trusted, get trust
global $_WEB_URL;
if (!$ft->eve->TrustInit($_WEB_URL . '/', 'You must trust this Fortissimo killboard site in order to proceed.')) {
    return $ft->igberrorpage("You must trust this site to use it.  Sorry!");
}
# see if we know them
$corpid = get_corp_id($ft->eve->CorpName, 0);
if (!$corpid) {
    return $ft->igberrorpage("Sorry, unable to verify your corporation.  I cannot let you pass!");
}
$pilotid = get_pilot_id($ft->eve->CharName, $corpid);
if (!$pilotid) {
    return $ft->igberrorpage("Sorry, unable to verify your account.  I cannot let you pass!");
}
# okay, they're in, do we know them?
$obj = new User($pilotid);
if (!$obj) {
    return $ft->igberrorpage("Sorry, unable to access your account.  I cannot let you pass!");
}
# see what their standings are
if (!$obj->trustable()) {
    return $ft->igberrorpage("Sorry, we don't allow your type here.");
}
# do they have a password?
if ($obj->password()) {
    return $ft->igberrorpage("Sorry, you already have a password on your account.  If you need to reset your " . "password you must talk to an administrator.  Thank you!");
}
# store output here
# store output here
$out = "<center><b><font color='#ffff00'>Plexer - The Complex Scheduler</font></b><br />";
$out .= "<font color='#ff0000'><b>{$plex->name}</b> in <b>{$plex->system}</b> rated <b>{$plex->rating}/10</b></font><br />";
$out .= "[ <a href='{$_WEB_URL}/'>Back to Top</a> ] [ <a href='{$_WEB_URL}/igb-showcomplex.php?id={$id}'>Back to Complex</a> ]";
$out .= "</center><br />";
# dump the information
$info = array("Complex" => "<a href='{$_WEB_URL}/igb-showcomplex.php?id={$id}'>{$plex->name}</a> (" . $plex->rating . "/10)", "System" => $plex->system . " (" . $plex->region . ")", "1" => "-", "Date" => stddate(slot_to_date($run->dayid)), "Name" => get_complex_slot_name($id, $run->slotid), "Description" => get_complex_slot_desc($id, $run->slotid), "2" => "-", "Reserved for corp" => get_corp_name($run->corpid), "Reserved by pilot" => get_pilot_name($run->pilotid), "3" => "-", "Was ran at" => is_null($run->ranattime) ? "not run yet" : stddate($run->ranattime));
foreach ($info as $k => $v) {
    if ($v == "-") {
        $out .= "<br />";
        continue;
    }
    $out .= " &bull; <font color='#ffff00'>{$k}:</font> {$v}<br />";
}
# set some flags
$is_corp_mgr = $run->corpid == get_corp_id($ft->eve->CorpName) ? 1 : 0;
$is_site_mgr = $obj->manager();
$is_mgr = $is_corp_mgr || $is_site_mgr;
# now give them some commands
if ($is_mgr) {
    $out .= "<br />";
    if (is_null($run->ranattime)) {
        # run options
        if ($is_corp_mgr) {
            $out .= "[ <a href='{$_WEB_URL}/igb-runcomplete.php?id={$id}&schedid={$schedid}'>Run Completed</a> ] ";
            $out .= "[ <a href='{$_WEB_URL}/igb-abandonrun.php?id={$id}&schedid={$schedid}'>Abandon This Run</a> ] ";
        } elseif ($is_site_mgr) {
            $out .= "[ <a href='{$_WEB_URL}/igb-runcomplete.php?id={$id}&schedid={$schedid}&admin=1'>Admin: Run Completed</a> ] ";
            $out .= "[ <a href='{$_WEB_URL}/igb-abandonrun.php?id={$id}&schedid={$schedid}&admin=1'>Admin: Abandon This Run</a> ]";
        }
    }
if (!$run) {
    return $ft->igberrorpage('Sorry, that run was not found.');
}
# store output here
$out = "<center><b><font color='#ffff00'>Plexer - The Complex Scheduler</font></b><br />";
$out .= "<font color='#ff0000'><b>{$plex->name}</b> in <b>{$plex->system}</b> rated <b>{$plex->rating}/10</b></font><br />";
$out .= "[ <a href='{$_WEB_URL}/'>Back to Top</a> ] [ <a href='{$_WEB_URL}/igb-showcomplex.php?id={$id}'>Back to Complex</a> ]";
$out .= "</center><br />";
# now, if admin, do those checks
if ($_GET['admin']) {
    if (!$obj->manager) {
        return $ft->igberrorpage("Sorry, you're not an administrator of this site.");
    }
} else {
    # now give them some commands
    if ($run->corpid != get_corp_id($ft->eve->CorpName)) {
        # same corp, allow them to mark this done
        return $ft->igberrorpage("Sorry, you're not in the right corp for that.");
    }
    # FIXME: not everybody in the corp can abandon the run, so make this check
    if (0) {
        return $ft->igberrorpage("Sorry, you aren't an administrator of your corporation.");
    }
}
# okay they are, so mark it as run
abandon_run($id, $schedid);
$out .= "<p>Thank you, this run has been abandoned so someone else can do it.</p>";
# all done
echo "<html><title>Plexer - The Complex Scheduler</title><body>{$out}</body></html>";
?>