Merge branch 'dev' into EDI

This commit is contained in:
Stefan (DB4SCW)
2024-08-26 20:09:01 +02:00
committed by GitHub
39 changed files with 5907 additions and 5081 deletions

View File

@@ -8,7 +8,7 @@ class Contesting_model extends CI_Model {
$this->load->model('Stations');
$station_id = $this->Stations->find_active();
$qsoarray = explode(',', $qso);
$qsoarray = explode(',', $this->security->xss_clean($qso));
$contestid = $qsoarray[2];
$date = DateTime::createFromFormat('d-m-Y H:i:s', $qsoarray[0]);
@@ -30,9 +30,11 @@ class Contesting_model extends CI_Model {
$this->load->model('Stations');
$station_id = $this->Stations->find_active();
$sql = "SELECT * from contest_session where station_id = " . $station_id;
$binding=[];
$sql = "SELECT * from contest_session where station_id = ?";
$binding[] = $station_id;
$data = $this->db->query($sql);
$data = $this->db->query($sql, $binding);
return $data->row();
}
@@ -42,9 +44,11 @@ class Contesting_model extends CI_Model {
$this->load->model('Stations');
$station_id = $this->Stations->find_active();
$sql = "delete from contest_session where station_id = " . $station_id;
$binding=[];
$sql = "delete from contest_session where station_id = ?";
$binding[] = $station_id;
$this->db->query($sql);
$this->db->query($sql, $binding);
return;
}
@@ -54,7 +58,7 @@ class Contesting_model extends CI_Model {
$qso = "";
if ($this->input->post('callsign') ?? '' != '') {
if ($this->input->post('callsign', true) ?? '' != '') {
$qso = xss_clean($this->input->post('start_date', true)) . ' ' . xss_clean($this->input->post('start_time', true)) . ',' . xss_clean($this->input->post('callsign', true)) . ',' . xss_clean($this->input->post('contestname', true));
} else {
$qso = xss_clean($this->input->post('start_date', true)) . ' ' . xss_clean($this->input->post('start_time', true)) . ',,' . xss_clean($this->input->post('contestname', true));
@@ -70,9 +74,11 @@ class Contesting_model extends CI_Model {
'station_id' => $station_id,
);
$sql = "SELECT * from contest_session where station_id = " . $station_id;
$binding=[];
$sql = "SELECT * from contest_session where station_id = ?";
$binding[] = $station_id;
$querydata = $this->db->query($sql);
$querydata = $this->db->query($sql, $binding);
if ($querydata->num_rows() == 0) {
$this->db->insert('contest_session', $data);
@@ -165,21 +171,26 @@ class Contesting_model extends CI_Model {
// Clean ID
$clean_id = $this->security->xss_clean($id);
$sql = "SELECT id, name, adifname, active FROM contest where id =" . $clean_id;
$binding=[];
$sql = "SELECT id, name, adifname, active FROM contest where id = ?";
$binding[] = $clean_id;
$data = $this->db->query($sql);
$data = $this->db->query($sql, $binding);
return ($data->row());
}
function edit($id) {
// Clean ID
$clean_id = $this->security->xss_clean($id);
$data = array(
'name' => xss_clean($this->input->post('name', true)),
'adifname' => xss_clean($this->input->post('adifname', true)),
'active' => xss_clean($this->input->post('active', true)),
);
$this->db->where('id', $id);
$this->db->where('id', $clean_id);
$this->db->update('contest', $data);
}
@@ -241,12 +252,12 @@ class Contesting_model extends CI_Model {
// If date is set, we format the date and add it to the where-statement
if ($from != 0) {
$from = DateTime::createFromFormat('Y-m-d', $from);
$from = DateTime::createFromFormat('Y-m-d', $this->security->xss_clean($from));
$from = $from->format('Y-m-d');
$this->db->where("date(".$this->config->item('table_name').".COL_TIME_ON) >= '".$from."'");
}
if ($to != 0) {
$to = DateTime::createFromFormat('Y-m-d', $to);
$to = DateTime::createFromFormat('Y-m-d', $this->security->xss_clean($to));
$to = $to->format('Y-m-d');
$this->db->where("date(".$this->config->item('table_name').".COL_TIME_ON) <= '".$to."'");
}
@@ -256,7 +267,7 @@ class Contesting_model extends CI_Model {
$this->db->where($this->config->item('table_name').'.COL_BAND', $band);
}
$this->db->where($this->config->item('table_name').'.COL_CONTEST_ID', $contest_id);
$this->db->where($this->config->item('table_name').'.COL_CONTEST_ID', $this->security->xss_clean($contest_id));
$this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "ASC");
@@ -286,6 +297,8 @@ class Contesting_model extends CI_Model {
function get_logged_years($station_id) {
$station_id = $this->security->xss_clean($station_id);
$binding=[];
$sql = "select distinct year(col_time_on) year
from " . $this->config->item('table_name') . "
@@ -302,6 +315,10 @@ class Contesting_model extends CI_Model {
}
function get_logged_contests($station_id, $year) {
$station_id = $this->security->xss_clean($station_id);
$year = $this->security->xss_clean($year);
$binding=[];
$sql = "select distinct col_contest_id, coalesce(contest.name, col_contest_id) contestname
from " . $this->config->item('table_name') . " thcv
@@ -321,6 +338,11 @@ class Contesting_model extends CI_Model {
}
function get_contest_dates($station_id, $year, $contestid) {
$station_id = $this->security->xss_clean($station_id);
$year = $this->security->xss_clean($year);
$contestid = $this->security->xss_clean($contestid);
$binding=[];
$sql = "select distinct (date(col_time_on)) date
from " . $this->config->item('table_name') . "
@@ -328,7 +350,7 @@ class Contesting_model extends CI_Model {
and station_id = ?" .
" and year(col_time_on) = ? and col_contest_id = ?";
$binding[] = $station_id;
$binding[] = $station_id;
$binding[] = $year;
$binding[] = $contestid;