This fixes the PHP8 warnings. Fixed #873

这个提交包含在:
Andreas 2021-02-08 21:46:53 +01:00
父节点 eedb3c62ac
当前提交 f122a284d7

查看文件

@ -79,7 +79,7 @@ class Logbook_model extends CI_Model {
} }
if($this->input->post('dxcc_id') == "") { if($this->input->post('dxcc_id') == "") {
$dxcc = $this->check_dxcc_table(strtoupper(trim($this->input->post('callsign'))), $datetime); $dxcc = $this->check_dxcc_table(strtoupper(trim($this->input->post('callsign'))), $datetime);
if (empty($dxcc[0])) { if (empty($dxcc[0])) {
$dxcc_id = null; $dxcc_id = null;
@ -184,7 +184,7 @@ class Logbook_model extends CI_Model {
$data['COL_MY_CITY'] = strtoupper(trim($station['station_city'])); $data['COL_MY_CITY'] = strtoupper(trim($station['station_city']));
$data['COL_MY_IOTA'] = strtoupper(trim($station['station_iota'])); $data['COL_MY_IOTA'] = strtoupper(trim($station['station_iota']));
$data['COL_MY_SOTA_REF'] = strtoupper(trim($station['station_sota'])); $data['COL_MY_SOTA_REF'] = strtoupper(trim($station['station_sota']));
$data['COL_STATION_CALLSIGN'] = strtoupper(trim($station['station_callsign'])); $data['COL_STATION_CALLSIGN'] = strtoupper(trim($station['station_callsign']));
$data['COL_MY_DXCC'] = strtoupper(trim($station['station_dxcc'])); $data['COL_MY_DXCC'] = strtoupper(trim($station['station_dxcc']));
$data['COL_MY_COUNTRY'] = strtoupper(trim($station['station_country'])); $data['COL_MY_COUNTRY'] = strtoupper(trim($station['station_country']));
@ -217,7 +217,7 @@ class Logbook_model extends CI_Model {
public function check_station($id){ public function check_station($id){
$this->db->where('station_id', $id); $this->db->where('station_id', $id);
$query = $this->db->get('station_profile'); $query = $this->db->get('station_profile');
if ($query->num_rows() > 0) { if ($query->num_rows() > 0) {
@ -231,7 +231,7 @@ class Logbook_model extends CI_Model {
$CI->load->model('Stations'); $CI->load->model('Stations');
$station_id = $CI->Stations->find_active(); $station_id = $CI->Stations->find_active();
$this->db->where('station_id', $station_id); $this->db->where('station_id', $station_id);
$this->db->where('COL_COUNTRY', $country); $this->db->where('COL_COUNTRY', $country);
if($band != "SAT") { if($band != "SAT") {
$this->db->where('COL_PROP_MODE !=', 'SAT'); $this->db->where('COL_PROP_MODE !=', 'SAT');
@ -259,7 +259,7 @@ class Logbook_model extends CI_Model {
return $this->db->get($this->config->item('table_name')); return $this->db->get($this->config->item('table_name'));
} }
public function vucc_qso_details($gridsquare, $band) { public function vucc_qso_details($gridsquare, $band) {
$CI =& get_instance(); $CI =& get_instance();
$CI->load->model('Stations'); $CI->load->model('Stations');
@ -729,8 +729,8 @@ class Logbook_model extends CI_Model {
// Set Paper to recived // Set Paper to recived
function paperqsl_update($qso_id, $method) { function paperqsl_update($qso_id, $method) {
$data = array( $data = array(
'COL_QSLRDATE' => date('Y-m-d'), 'COL_QSLRDATE' => date('Y-m-d'),
'COL_QSL_RCVD' => 'Y', 'COL_QSL_RCVD' => 'Y',
@ -746,30 +746,30 @@ class Logbook_model extends CI_Model {
$CI =& get_instance(); $CI =& get_instance();
$CI->load->model('Stations'); $CI->load->model('Stations');
$station_id = $CI->Stations->find_active(); $station_id = $CI->Stations->find_active();
$query = $this->db->query('SELECT $query = $this->db->query('SELECT
STATION_CALLSIGN, STATION_CALLSIGN,
COL_PRIMARY_KEY, COL_PRIMARY_KEY,
COL_CALL, COL_CALL,
COL_QSL_VIA, COL_QSL_VIA,
COL_TIME_ON, COL_TIME_ON,
COL_MODE, COL_MODE,
COL_SUBMODE, COL_SUBMODE,
COL_FREQ, COL_FREQ,
UPPER(COL_BAND) as COL_BAND, UPPER(COL_BAND) as COL_BAND,
COL_RST_SENT, COL_RST_SENT,
COL_SAT_NAME, COL_SAT_NAME,
COL_SAT_MODE, COL_SAT_MODE,
COL_QSL_RCVD, COL_QSL_RCVD,
COL_COMMENT, COL_COMMENT,
(CASE WHEN COL_QSL_VIA != \'\' THEN COL_QSL_VIA ELSE COL_CALL END) AS COL_ROUTING, (CASE WHEN COL_QSL_VIA != \'\' THEN COL_QSL_VIA ELSE COL_CALL END) AS COL_ROUTING,
ADIF, ADIF,
ENTITY ENTITY
FROM '.$this->config->item('table_name').', dxcc_prefixes, station_profile FROM '.$this->config->item('table_name').', dxcc_prefixes, station_profile
WHERE WHERE
COL_QSL_SENT in (\'R\', \'Q\') COL_QSL_SENT in (\'R\', \'Q\')
and (CASE WHEN COL_QSL_VIA != \'\' THEN COL_QSL_VIA ELSE COL_CALL END) like CONCAT(dxcc_prefixes.call,\'%\') and (CASE WHEN COL_QSL_VIA != \'\' THEN COL_QSL_VIA ELSE COL_CALL END) like CONCAT(dxcc_prefixes.call,\'%\')
and (end is null or end > now()) and (end is null or end > now())
and '.$this->config->item('table_name').'.station_id = '.$station_id.' and '.$this->config->item('table_name').'.station_id = '.$station_id.'
and '.$this->config->item('table_name').'.station_id = station_profile.station_id and '.$this->config->item('table_name').'.station_id = station_profile.station_id
ORDER BY adif, col_routing'); ORDER BY adif, col_routing');
@ -1023,7 +1023,7 @@ class Logbook_model extends CI_Model {
$date = new DateTime('now'); $date = new DateTime('now');
$date->modify('last day of this month'); $date->modify('last day of this month');
$night = $date->format('Y-m-d')." 23:59:59"; $night = $date->format('Y-m-d')." 23:59:59";
$query = $this->db->query('SELECT COUNT( * ) as count FROM '.$this->config->item('table_name').' WHERE station_id = '.$station_id.' AND COL_TIME_ON between \''.$morning.'\' AND \''.$night.'\''); $query = $this->db->query('SELECT COUNT( * ) as count FROM '.$this->config->item('table_name').' WHERE station_id = '.$station_id.' AND COL_TIME_ON between \''.$morning.'\' AND \''.$night.'\'');
@ -1042,14 +1042,14 @@ class Logbook_model extends CI_Model {
$CI =& get_instance(); $CI =& get_instance();
$CI->load->model('Stations'); $CI->load->model('Stations');
$station_id = $CI->Stations->find_active(); $station_id = $CI->Stations->find_active();
$this->db->where("station_id", $station_id); $this->db->where("station_id", $station_id);
$this->db->order_by("COL_TIME_ON", "ASC"); $this->db->order_by("COL_TIME_ON", "ASC");
$query = $this->db->get($this->config->item('table_name')); $query = $this->db->get($this->config->item('table_name'));
return $query; return $query;
} }
/* Return QSOs made during the current Year */ /* Return QSOs made during the current Year */
function year_qsos() { function year_qsos() {
@ -1233,9 +1233,9 @@ class Logbook_model extends CI_Model {
$CI->load->model('Stations'); $CI->load->model('Stations');
$station_id = $CI->Stations->find_active(); $station_id = $CI->Stations->find_active();
$sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').' $sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').'
WHERE COL_COUNTRY != "Invalid" WHERE COL_COUNTRY != "Invalid"
AND col_dxcc > 0 AND col_dxcc > 0
AND station_id = '.$station_id ; AND station_id = '.$station_id ;
$query = $this->db->query($sql); $query = $this->db->query($sql);
@ -1249,9 +1249,9 @@ class Logbook_model extends CI_Model {
$CI->load->model('Stations'); $CI->load->model('Stations');
$station_id = $CI->Stations->find_active(); $station_id = $CI->Stations->find_active();
$sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').' thcv $sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').' thcv
join dxcc_entities on thcv.col_dxcc = dxcc_entities.adif join dxcc_entities on thcv.col_dxcc = dxcc_entities.adif
WHERE COL_COUNTRY != "Invalid" WHERE COL_COUNTRY != "Invalid"
AND dxcc_entities.end is null AND dxcc_entities.end is null
AND station_id = '.$station_id; AND station_id = '.$station_id;
@ -1266,9 +1266,9 @@ class Logbook_model extends CI_Model {
$CI->load->model('Stations'); $CI->load->model('Stations');
$station_id = $CI->Stations->find_active(); $station_id = $CI->Stations->find_active();
$sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').' $sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').'
WHERE COL_COUNTRY != "Invalid" WHERE COL_COUNTRY != "Invalid"
AND COL_DXCC > 0 AND COL_DXCC > 0
AND station_id = '.$station_id.' AND COL_QSL_RCVD =\'Y\''; AND station_id = '.$station_id.' AND COL_QSL_RCVD =\'Y\'';
$query = $this->db->query($sql); $query = $this->db->query($sql);
@ -1282,9 +1282,9 @@ class Logbook_model extends CI_Model {
$CI->load->model('Stations'); $CI->load->model('Stations');
$station_id = $CI->Stations->find_active(); $station_id = $CI->Stations->find_active();
$sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').' $sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').'
WHERE COL_COUNTRY != "Invalid" WHERE COL_COUNTRY != "Invalid"
AND COL_DXCC > 0 AND COL_DXCC > 0
AND station_id = '.$station_id.' AND COL_EQSL_QSL_RCVD =\'Y\''; AND station_id = '.$station_id.' AND COL_EQSL_QSL_RCVD =\'Y\'';
$query = $this->db->query($sql); $query = $this->db->query($sql);
@ -1298,10 +1298,10 @@ class Logbook_model extends CI_Model {
$CI->load->model('Stations'); $CI->load->model('Stations');
$station_id = $CI->Stations->find_active(); $station_id = $CI->Stations->find_active();
$sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').' $sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').'
WHERE COL_COUNTRY != "Invalid" WHERE COL_COUNTRY != "Invalid"
AND COL_DXCC > 0 AND COL_DXCC > 0
AND station_id = '.$station_id.' AND station_id = '.$station_id.'
AND COL_LOTW_QSL_RCVD =\'Y\''; AND COL_LOTW_QSL_RCVD =\'Y\'';
$query = $this->db->query($sql); $query = $this->db->query($sql);
@ -1359,7 +1359,7 @@ class Logbook_model extends CI_Model {
} }
function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state) { function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state) {
if($state != "") { if($state != "") {
$data = array( $data = array(
'COL_LOTW_QSLRDATE' => $qsl_date, 'COL_LOTW_QSLRDATE' => $qsl_date,
@ -1372,7 +1372,7 @@ class Logbook_model extends CI_Model {
'COL_LOTW_QSLRDATE' => $qsl_date, 'COL_LOTW_QSLRDATE' => $qsl_date,
'COL_LOTW_QSL_RCVD' => $qsl_status, 'COL_LOTW_QSL_RCVD' => $qsl_status,
'COL_LOTW_QSL_SENT' => 'Y' 'COL_LOTW_QSL_SENT' => 'Y'
); );
} }
$this->db->where('date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = "'.$datetime.'"'); $this->db->where('date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = "'.$datetime.'"');
@ -1491,14 +1491,14 @@ class Logbook_model extends CI_Model {
* $markQrz - used in ADIF import to mark QSOs as exported to QRZ Logbook when importing QSOs * $markQrz - used in ADIF import to mark QSOs as exported to QRZ Logbook when importing QSOs
* $skipexport - used in ADIF import to skip the realtime upload to QRZ Logbook when importing QSOs from ADIF * $skipexport - used in ADIF import to skip the realtime upload to QRZ Logbook when importing QSOs from ADIF
*/ */
function import($record, $station_id = "0", $skipDuplicate, $markLotw, $dxccAdif, $markQrz, $skipexport = false) { function import($record, $station_id = "0", $skipDuplicate = false, $markLotw = false, $dxccAdif = false, $markQrz = false, $skipexport = false) {
$CI =& get_instance(); $CI =& get_instance();
$CI->load->library('frequency'); $CI->load->library('frequency');
$my_error = ""; $my_error = "";
// Join date+time // Join date+time
$time_on = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i:s', strtotime($record['time_on'])); $time_on = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i:s', strtotime($record['time_on']));
if (isset($record['time_off'])) { if (isset($record['time_off'])) {
$time_off = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i:s', strtotime($record['time_off'])); $time_off = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i:s', strtotime($record['time_off']));
} else { } else {
@ -1772,7 +1772,7 @@ class Logbook_model extends CI_Model {
$CI->load->model('Stations'); $CI->load->model('Stations');
$station_id = $CI->Stations->find_active(); $station_id = $CI->Stations->find_active();
} }
// Check if QSO is already in the database // Check if QSO is already in the database
if ($skipDuplicate != NULL) { if ($skipDuplicate != NULL) {
$skip = false; $skip = false;
@ -1981,7 +1981,7 @@ class Logbook_model extends CI_Model {
$data['COL_MY_CITY'] = trim($row['station_city']); $data['COL_MY_CITY'] = trim($row['station_city']);
$data['COL_MY_IOTA'] = strtoupper(trim($row['station_iota'])); $data['COL_MY_IOTA'] = strtoupper(trim($row['station_iota']));
$data['COL_MY_SOTA_REF'] = strtoupper(trim($row['station_sota'])); $data['COL_MY_SOTA_REF'] = strtoupper(trim($row['station_sota']));
$data['COL_STATION_CALLSIGN'] = strtoupper(trim($row['station_callsign'])); $data['COL_STATION_CALLSIGN'] = strtoupper(trim($row['station_callsign']));
$data['COL_MY_DXCC'] = strtoupper(trim($row['station_dxcc'])); $data['COL_MY_DXCC'] = strtoupper(trim($row['station_dxcc']));
$data['COL_MY_COUNTRY'] = strtoupper(trim($row['station_country'])); $data['COL_MY_COUNTRY'] = strtoupper(trim($row['station_country']));
@ -2056,7 +2056,7 @@ class Logbook_model extends CI_Model {
public function dxcc_lookup($call, $date){ public function dxcc_lookup($call, $date){
$len = strlen($call); $len = strlen($call);
$dxcc_exceptions = $this->db->select('`entity`, `adif`, `cqz`') $dxcc_exceptions = $this->db->select('`entity`, `adif`, `cqz`')
->where('call', $call) ->where('call', $call)
->where('(start <= CURDATE()') ->where('(start <= CURDATE()')
@ -2106,7 +2106,7 @@ class Logbook_model extends CI_Model {
} }
/* /*
* Same as check_dxcc_table, but the functionality is in * Same as check_dxcc_table, but the functionality is in
* a stored procedure which we call * a stored procedure which we call
*/ */
public function check_dxcc_stored_proc($call, $date){ public function check_dxcc_stored_proc($call, $date){
@ -2115,7 +2115,7 @@ class Logbook_model extends CI_Model {
$d = $res->result_array(); $d = $res->result_array();
// Should only be one result. // Should only be one result.
// NOTE: might cause unexpected data if there's an // NOTE: might cause unexpected data if there's an
// error with clublog.org data. // error with clublog.org data.
return $d[0]; return $d[0];
} }
@ -2160,7 +2160,7 @@ class Logbook_model extends CI_Model {
print("$count updated\n"); print("$count updated\n");
} }
public function check_for_station_id() { public function check_for_station_id() {
$this->db->where('station_id =', 'NULL'); $this->db->where('station_id =', 'NULL');
$query = $this->db->get($this->config->item('table_name')); $query = $this->db->get($this->config->item('table_name'));
@ -2168,7 +2168,7 @@ class Logbook_model extends CI_Model {
return 1; return 1;
} else { } else {
return 0; return 0;
} }
} }
@ -2179,25 +2179,25 @@ class Logbook_model extends CI_Model {
); );
$this->db->where(array('station_id' => NULL)); $this->db->where(array('station_id' => NULL));
return $this->db->update($this->config->item('table_name'), $data); return $this->db->update($this->config->item('table_name'), $data);
} }
public function parse_frequency($frequency) public function parse_frequency($frequency)
{ {
if (is_int($frequency)) if (is_int($frequency))
return $frequency; return $frequency;
if (is_string($frequency)) if (is_string($frequency))
{ {
$frequency = strtoupper($frequency); $frequency = strtoupper($frequency);
$frequency = str_replace(" ", "", $frequency); $frequency = str_replace(" ", "", $frequency);
$frequency = str_replace("HZ", "", $frequency); $frequency = str_replace("HZ", "", $frequency);
$frequency = str_replace(["K", "M", "G", "T"], ["E3", "E6", "E9", "E12"], $frequency); $frequency = str_replace(["K", "M", "G", "T"], ["E3", "E6", "E9", "E12"], $frequency);
// this double conversion will take a string like "3700e3" and convert it into 3700000 // this double conversion will take a string like "3700e3" and convert it into 3700000
return (int)(float) $frequency; return (int)(float) $frequency;
} }
return 0; return 0;
} }
@ -2246,7 +2246,7 @@ class Logbook_model extends CI_Model {
return null; return null;
} }
} }
function get_lotw_qsos_to_upload($station_id, $start_date, $end_date) { function get_lotw_qsos_to_upload($station_id, $start_date, $end_date) {
$this->db->select('COL_PRIMARY_KEY,COL_CALL, COL_BAND, COL_BAND_RX, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_FREQ, COL_FREQ_RX, COL_GRIDSQUARE, COL_SAT_NAME, COL_PROP_MODE, COL_LOTW_QSL_SENT, station_id'); $this->db->select('COL_PRIMARY_KEY,COL_CALL, COL_BAND, COL_BAND_RX, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_FREQ, COL_FREQ_RX, COL_GRIDSQUARE, COL_SAT_NAME, COL_PROP_MODE, COL_LOTW_QSL_SENT, station_id');