コード例 #1
0
ファイル: self_detail.php プロジェクト: biow0lf/evedev-kb
 function display()
 {
     global $smarty;
     $alls = $corps = $pilots = false;
     if (config::get('cfg_allianceid')) {
         $alls = array();
         foreach (config::get('cfg_allianceid') as $entity) {
             $alliance = new Alliance($entity);
             if ($alliance->getExternalID()) {
                 $url = edkURI::page('alliance_detail', $alliance->getExternalID(), 'all_ext_id');
             } else {
                 $url = edkURI::page('alliance_detail', $alliance->getID(), 'all_id');
             }
             $alls[] = array('id' => $alliance->getID(), 'extid' => $alliance->getExternalID(), 'name' => $alliance->getName(), 'portrait' => $alliance->getPortraitURL(128), 'url' => $url);
         }
     }
     if (config::get('cfg_corpid')) {
         $corps = array();
         foreach (config::get('cfg_corpid') as $entity) {
             $corp = new Corporation($entity);
             if ($corp->getExternalID()) {
                 $url = edkURI::page('corp_detail', $corp->getExternalID(), 'crp_ext_id');
             } else {
                 $url = edkURI::page('corp_detail', $corp->getID(), 'crp_id');
             }
             $corps[] = array('id' => $corp->getID(), 'extid' => $corp->getExternalID(), 'name' => $corp->getName(), 'portrait' => $corp->getPortraitURL(128), 'url' => $url);
         }
     }
     if (config::get('cfg_pilotid')) {
         $pilots = array();
         foreach (config::get('cfg_pilotid') as $entity) {
             $pilot = new Pilot($entity);
             if ($pilot->getExternalID()) {
                 $url = edkURI::page('pilot_detail', $pilot->getExternalID(), 'plt_ext_id');
             } else {
                 $url = edkURI::page('pilot_detail', $pilot->getID(), 'plt_id');
             }
             $pilots[] = array('id' => $pilot->getID(), 'extid' => $pilot->getExternalID(), 'name' => $pilot->getName(), 'portrait' => $pilot->getPortraitURL(128), 'url' => $url);
         }
     }
     $smarty->assignByRef('alliances', $alls);
     $smarty->assignByRef('corps', $corps);
     $smarty->assignByRef('pilots', $pilots);
     return $smarty->fetch(get_tpl('self'));
 }
コード例 #2
0
ファイル: class.idfeed.php プロジェクト: biow0lf/evedev-kb
 /**
  * Set the type and ID of the feed to retrieve.
  * @param string $type pilot/corp/alliance.
  * @param integer $id
  * @return boolean false on failure.
  */
 function setID($type = '', $id = 0)
 {
     //Check id is int.
     $id = (int) $id;
     //Set to board owner.
     if ($type == '') {
         if (config::get('cfg_allianceid')) {
             $alls = array();
             foreach (config::get('cfg_allianceid') as $val) {
                 $all = new Alliance($val);
                 if (!$all->getExternalID()) {
                     return false;
                 }
                 $alls[] = $all->getExternalID();
             }
             $this->options['alliance'] = implode(',', $alls);
         }
         if (config::get('cfg_corpid')) {
             $crps = array();
             foreach (config::get('cfg_corpid') as $val) {
                 $crp = new Corporation($val);
                 if (!$crp->getExternalID()) {
                     return false;
                 }
                 $crps[] = $crp->getExternalID();
             }
             $this->options['corp'] = implode(',', $crps);
         }
         if (config::get('cfg_pilotid')) {
             $pilots = array();
             foreach (config::get('cfg_pilotid') as $val) {
                 $pilot = new Pilot($val);
                 if (!$pilot->getExternalID()) {
                     return false;
                 }
                 $pilots[] = $pilot->getExternalID();
             }
             $this->options['pilot'] = implode(',', $pilots);
         }
         return true;
     } else {
         if ($id > 0) {
             if ($type == 'alliance') {
                 $this->options['alliance'] = $id;
             } else {
                 if ($type == 'corporation') {
                     $this->options['corp'] = $id;
                 } else {
                     if ($type == 'pilot') {
                         $this->options['pilot'] = $id;
                     } else {
                         return false;
                     }
                 }
             }
             return true;
         }
     }
     return false;
 }
コード例 #3
0
ファイル: class.thumb.php プロジェクト: biow0lf/evedev-kb
 function thumbInt($int_id, $size, $type)
 {
     $this->size = $size;
     switch ($this->type) {
         case 'pilot':
         case '':
             $pilot = new Pilot($int_id);
             $this->id = $pilot->getExternalID();
             if ($this->id) {
                 $url = imageURL::getURL('Pilot', $this->id, $size);
                 header(html_entity_decode("Location: {$url}"));
                 die;
             }
             $this->type = 'pilot';
             $this->encoding = 'jpeg';
             $this->validate();
             break;
         case 'corp':
         case 'npc':
             $this->type = 'corp';
             $corp = new Corporation($int_id);
             if (!$corp->getExternalID()) {
                 $this->id = 0;
             }
             $this->id = $corp->getExternalID();
             if ($this->id) {
                 $url = imageURL::getURL('Corporation', $this->id, $size);
                 header("Location: {$url}");
                 die;
             }
             $this->encoding = 'png';
             if ($this->type == 'npc') {
                 $this->type = 'npc';
                 //$this->encoding = 'png';
             }
             $this->validate();
             break;
         default:
             $this->id = $str_id;
             $this->type = $type;
             $this->encoding = 'jpeg';
             $this->validate();
     }
 }
コード例 #4
0
ファイル: corp_detail.php プロジェクト: biow0lf/evedev-kb
 /**
  * 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"));
 }