diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index f0bce7f3c..fdf8a3326 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -1464,55 +1464,57 @@ class Awards extends CI_Controller { This displays the DXCC map */ public function dxcc_map() { - $this->load->model('dxcc'); - $this->load->model('bands'); + $this->load->model('dxcc'); + $this->load->model('bands'); - $bands[] = $this->security->xss_clean($this->input->post('band')); + $bands[] = $this->security->xss_clean($this->input->post('band')); - $postdata['qsl'] = $this->input->post('qsl') == 0 ? NULL: 1; - $postdata['lotw'] = $this->input->post('lotw') == 0 ? NULL: 1; - $postdata['eqsl'] = $this->input->post('eqsl') == 0 ? NULL: 1; - $postdata['qrz'] = $this->input->post('qrz') == 0 ? NULL: 1; - $postdata['clublog'] = $this->input->post('clublog') == 0 ? NULL: 1; - $postdata['worked'] = $this->input->post('worked') == 0 ? NULL: 1; - $postdata['confirmed'] = $this->input->post('confirmed') == 0 ? NULL: 1; - $postdata['notworked'] = $this->input->post('notworked') == 0 ? NULL: 1; - $postdata['band'] = $this->security->xss_clean($this->input->post('band')); - $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); - $postdata['includedeleted'] = $this->input->post('includedeleted') == 0 ? NULL: 1; - $postdata['Africa'] = $this->input->post('Africa') == 0 ? NULL: 1; - $postdata['Asia'] = $this->input->post('Asia') == 0 ? NULL: 1; - $postdata['Europe'] = $this->input->post('Europe') == 0 ? NULL: 1; - $postdata['NorthAmerica'] = $this->input->post('NorthAmerica') == 0 ? NULL: 1; - $postdata['SouthAmerica'] = $this->input->post('SouthAmerica') == 0 ? NULL: 1; - $postdata['Oceania'] = $this->input->post('Oceania') == 0 ? NULL: 1; - $postdata['Antarctica'] = $this->input->post('Antarctica') == 0 ? NULL: 1; - $postdata['sat'] = $this->security->xss_clean($this->input->post('sat')); - $postdata['orbit'] = $this->security->xss_clean($this->input->post('orbit')); + $postdata['qsl'] = ($this->input->post('qsl',true) ?? 0) == 0 ? NULL: 1; + $postdata['lotw'] = ($this->input->post('lotw',true) ?? 0) == 0 ? NULL: 1; + $postdata['eqsl'] = ($this->input->post('eqsl',true) ?? 0) == 0 ? NULL: 1; + $postdata['qrz'] = ($this->input->post('qrz',true) ?? 0) == 0 ? NULL: 1; + $postdata['clublog'] = ($this->input->post('clublog',true) ?? 0) == 0 ? NULL: 1; + $postdata['worked'] = ($this->input->post('worked',true) ?? 0) == 0 ? NULL: 1; + $postdata['confirmed'] = ($this->input->post('confirmed',true) ?? 0) == 0 ? NULL: 1; + $postdata['notworked'] = ($this->input->post('notworked',true) ?? 0) == 0 ? NULL: 1; - $dxcclist = $this->dxcc->fetchdxcc($postdata); - if ($dxcclist[0]->adif == "0") { - unset($dxcclist[0]); - } + $postdata['includedeleted'] = ($this->input->post('includedeleted',true) ?? 0) == 0 ? NULL: 1; + $postdata['Africa'] = ($this->input->post('Africa',true) ?? 0) == 0 ? NULL: 1; + $postdata['Asia'] = ($this->input->post('Asia',true) ?? 0) == 0 ? NULL: 1; + $postdata['Europe'] = ($this->input->post('Europe',true) ?? 0) == 0 ? NULL: 1; + $postdata['NorthAmerica'] = ($this->input->post('NorthAmerica',true) ?? 0) == 0 ? NULL: 1; + $postdata['SouthAmerica'] = ($this->input->post('SouthAmerica',true) ?? 0) == 0 ? NULL: 1; + $postdata['Oceania'] = ($this->input->post('Oceania',true) ?? 0) == 0 ? NULL: 1; + $postdata['Antarctica'] = ($this->input->post('Antarctica',true) ?? 0) == 0 ? NULL: 1; + $postdata['band'] = $this->security->xss_clean($this->input->post('band')); + $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); + $postdata['sat'] = $this->security->xss_clean($this->input->post('sat')); + $postdata['orbit'] = $this->security->xss_clean($this->input->post('orbit')); - $dxcc_array = $this->dxcc->get_dxcc_array($dxcclist, $bands, $postdata); - $i = 0; + $dxcclist = $this->dxcc->fetchdxcc($postdata); + if ($dxcclist[0]->adif == "0") { + unset($dxcclist[0]); + } - foreach ($dxcclist as $dxcc) { - $newdxcc[$i]['adif'] = $dxcc->adif; - $newdxcc[$i]['prefix'] = $dxcc->prefix; - $newdxcc[$i]['name'] = ucwords(strtolower($dxcc->name), "- (/"); - if ($dxcc->Enddate!=null) { - $newdxcc[$i]['name'] .= ' (deleted)'; - } - $newdxcc[$i]['lat'] = $dxcc->lat; - $newdxcc[$i]['long'] = $dxcc->long; - $newdxcc[$i++]['status'] = isset($dxcc_array[$dxcc->adif]) ? $this->returnStatus($dxcc_array[$dxcc->adif]) : 'x'; - } + $dxcc_array = $this->dxcc->get_dxcc_array($dxcclist, $bands, $postdata); - header('Content-Type: application/json'); - echo json_encode($newdxcc); + $i = 0; + + foreach ($dxcclist as $dxcc) { + $newdxcc[$i]['adif'] = $dxcc->adif; + $newdxcc[$i]['prefix'] = $dxcc->prefix; + $newdxcc[$i]['name'] = ucwords(strtolower($dxcc->name), "- (/"); + if ($dxcc->Enddate!=null) { + $newdxcc[$i]['name'] .= ' (deleted)'; + } + $newdxcc[$i]['lat'] = $dxcc->lat; + $newdxcc[$i]['long'] = $dxcc->long; + $newdxcc[$i++]['status'] = isset($dxcc_array[$dxcc->adif]) ? $this->returnStatus($dxcc_array[$dxcc->adif]) : 'x'; + } + + header('Content-Type: application/json'); + echo json_encode($newdxcc); } /*