/** * Start constructing the page. * Prepare all the shared variables such as dates and check alliance ID. * */ function start() { $this->page = new Page('Corporation details'); $this->scl_id = (int) edkURI::getArg('scl_id'); $this->crp_id = (int) edkURI::getArg('crp_id'); if (!$this->crp_id) { $this->crp_external_id = (int) edkURI::getArg('crp_ext_id'); if (!$this->crp_external_id) { $id = (int) edkURI::getArg('id', 1); // True for NPC corps too, but NPC alliances recorded as corps // fail here. Use Jedi mind tricks? if ($id > 1000000) { $this->crp_external_id = $id; } else { $this->crp_id = $id; } } } $this->view = preg_replace('/[^a-zA-Z0-9_-]/', '', edkURI::getArg('view', 2)); if ($this->view) { $this->page->addHeader('<meta name="robots" content="noindex, nofollow" />'); } if (!$this->crp_id) { if ($this->crp_external_id) { $this->corp = new Corporation($this->crp_external_id, true); $this->crp_id = $this->corp->getID(); } else { $html = 'That corporation does not exist.'; $this->page->setContent($html); $this->page->generate(); exit; } } else { $this->corp = Cacheable::factory('Corporation', $this->crp_id); $this->crp_external_id = $this->corp->getExternalID(); } if ($this->crp_external_id) { $this->page->addHeader("<link rel='canonical' href='" . edkURI::build(array('crp_ext_id', $this->crp_external_id, true)) . "' />"); } else { $this->page->addHeader("<link rel='canonical' href='" . edkURI::build(array('crp_id', $this->crp_id, true)) . "' />"); } $this->alliance = $this->corp->getAlliance(); if ($this->view) { $this->year = (int) edkURI::getArg('y', 3); $this->month = (int) edkURI::getArg('m', 4); } else { $this->year = (int) edkURI::getArg('y', 2); $this->month = (int) edkURI::getArg('m', 3); } if (!$this->month) { $this->month = kbdate('m'); } if (!$this->year) { $this->year = kbdate('Y'); } if ($this->month == 12) { $this->nmonth = 1; $this->nyear = $this->year + 1; } else { $this->nmonth = $this->month + 1; $this->nyear = $this->year; } if ($this->month == 1) { $this->pmonth = 12; $this->pyear = $this->year - 1; } else { $this->pmonth = $this->month - 1; $this->pyear = $this->year; } $this->monthname = kbdate("F", strtotime("2000-" . $this->month . "-2")); }