private function execQuery() { if ($this->executed) { return; } $qry = DBFactory::getDBQuery(); // general $sql = "select * from kb3_contracts ctr\n where ctr.ctr_id = " . $this->ctr_id; if (!$qry->execute($sql)) { die($qry->getErrorMsg()); } $this->executed = true; $row = $qry->getRow(); $this->ctr_name = $row['ctr_name']; $this->ctr_started = $row['ctr_started']; $this->ctr_ended = $row['ctr_ended']; $this->ctr_comment = $row['ctr_comment']; // get corps & alliances for contract $sql = "select ctd.ctd_crp_id, ctd.ctd_all_id, ctd.ctd_reg_id, ctd.ctd_sys_id\n from kb3_contract_details ctd\n where ctd.ctd_ctr_id = " . $row['ctr_id'] . "\n\t order by 3, 2, 1 -- get corps & alliances for contract"; $caqry = DBFactory::getDBQuery(); if (!$caqry->execute($sql)) { check_contracts(); $caqry->execute($sql); } $this->contracttargets = array(); $this->corps = array(); $this->alliances = array(); $this->regions = array(); $this->systems = array(); while ($carow = $caqry->getRow()) { $contracttarget = new ContractTarget($this, $carow['ctd_crp_id'], $carow['ctd_all_id'], $carow['ctd_reg_id'], $carow['ctd_sys_id']); $this->contracttargets[] = $contracttarget; if ($carow['ctd_crp_id']) { $this->klist->addVictimCorp($carow['ctd_crp_id']); $this->llist->addInvolvedCorp($carow['ctd_crp_id']); $this->corps[] = $carow['ctd_crp_id']; } elseif ($carow['ctd_all_id']) { $this->klist->addVictimAlliance($carow['ctd_all_id']); $this->llist->addInvolvedAlliance($carow['ctd_all_id']); $this->alliances[] = $carow['ctd_all_id']; } elseif ($carow['ctd_reg_id']) { $this->klist->addRegion($carow['ctd_reg_id']); $this->llist->addRegion($carow['ctd_reg_id']); $this->regions[] = $carow['ctd_reg_id']; } elseif ($carow['ctd_sys_id']) { $this->klist->addSystem($carow['ctd_sys_id']); $this->llist->addSystem($carow['ctd_sys_id']); $this->systems[] = $carow['ctd_sys_id']; } } $this->klist->setStartDate($this->getStartDate()); $this->llist->setStartDate($this->getStartDate()); if ($this->getEndDate() != "") { $this->klist->setEndDate($this->getEndDate()); $this->llist->setEndDate($this->getEndDate()); } }
function check_killtables() { $qry = DBFactory::getDBQuery(); $query = 'SELECT kll_dmgtaken FROM kb3_kills LIMIT 1'; $result = mysql_query($query); if ($result) { return; } $qry->execute('ALTER TABLE `kb3_kills` ADD `kll_dmgtaken` INT(11) NOT NULL DEFAULT \'0\''); $qry = DBFactory::getDBQuery(); $query = 'SELECT ind_dmgdone FROM kb3_inv_detail LIMIT 1'; $result = mysql_query($query); if ($result) { return; } $qry->execute('ALTER TABLE `kb3_inv_detail` ADD `ind_dmgdone` INT(11) NOT NULL DEFAULT \'0\''); } check_commenttable(); check_navigationtable(); check_commenttablerow(); check_shipvaltable(); check_invdetail(); check_pilots(); check_contracts(); check_index(); check_index_invcrp(); check_index_invall(); check_tblstrct1(); check_tblstrct5(); check_tblstrct6(); check_killtables();