mirror of
https://github.com/magicbug/Cloudlog
synced 2026-08-13 17:49:35 -04:00
Replace ad-hoc xss_clean calls with explicit casting and stronger type checks for ID/parameter handling, and convert many raw SQL strings to CodeIgniter Query Builder usage. Added normalize_location_ids helpers (Activators_model, Oqrs_model) to safely parse location lists and used where_in/parameter binding/escaping to avoid injection and improve maintainability. Also adjusted session user_id handling, improved LIKE/DATE/TIMEDIFF usage, and tightened several model/controller methods (Labels, Activators, Bands, Contesting, Labels_model, Modes, Oqrs_model, Qsl_model, Setup_model, Sstv_model, User_model) for safer, clearer DB queries and inputs.
117 lines
No EOL
2.4 KiB
PHP
117 lines
No EOL
2.4 KiB
PHP
<?php
|
|
|
|
class Modes extends CI_Model {
|
|
|
|
function all() {
|
|
$this->db->order_by('mode', 'ASC');
|
|
$this->db->order_by('submode', 'ASC');
|
|
return $this->db->get('adif_modes');
|
|
}
|
|
|
|
function active() {
|
|
$this->db->where('active', 1);
|
|
$this->db->order_by('mode', 'ASC');
|
|
$this->db->order_by('submode', 'ASC');
|
|
return $this->db->get('adif_modes');
|
|
}
|
|
|
|
function mode($id) {
|
|
$clean_id = (int) $id;
|
|
|
|
|
|
$this->db->where('id', $clean_id);
|
|
return $this->db->get('adif_modes');
|
|
}
|
|
|
|
|
|
function add() {
|
|
if ($this->input->post('submode', true) == "")
|
|
$submode = null;
|
|
else
|
|
$submode = xss_clean($this->input->post('submode', true));
|
|
|
|
$data = array(
|
|
'mode' => xss_clean($this->input->post('mode', true)),
|
|
'submode' => $submode,
|
|
'qrgmode' => xss_clean(strtoupper($this->input->post('qrgmode', true))),
|
|
'active' => xss_clean($this->input->post('active', true)),
|
|
);
|
|
|
|
$this->db->insert('adif_modes', $data);
|
|
}
|
|
|
|
function edit() {
|
|
if ($this->input->post('submode', true) == "")
|
|
$submode = null;
|
|
else
|
|
$submode = xss_clean($this->input->post('submode', true));
|
|
|
|
$data = array(
|
|
'mode' => xss_clean($this->input->post('mode', true)),
|
|
'submode' => $submode,
|
|
'qrgmode' => xss_clean(strtoupper($this->input->post('qrgmode', true))),
|
|
'active' => xss_clean($this->input->post('active', true)),
|
|
);
|
|
|
|
$this->db->where('id', xss_clean($this->input->post('id', true)));
|
|
$this->db->update('adif_modes', $data);
|
|
}
|
|
|
|
function delete($id) {
|
|
$clean_id = (int) $id;
|
|
|
|
// Delete Mode
|
|
$this->db->delete('adif_modes', array('id' => $clean_id));
|
|
}
|
|
|
|
function activate($id) {
|
|
$clean_id = (int) $id;
|
|
|
|
$data = array(
|
|
'active' => '1',
|
|
);
|
|
|
|
$this->db->where('id', $clean_id);
|
|
|
|
$this->db->update('adif_modes', $data);
|
|
|
|
return true;
|
|
}
|
|
|
|
function deactivate($id) {
|
|
$clean_id = (int) $id;
|
|
|
|
$data = array(
|
|
'active' => '0',
|
|
);
|
|
|
|
$this->db->where('id', $clean_id);
|
|
|
|
$this->db->update('adif_modes', $data);
|
|
|
|
return true;
|
|
}
|
|
|
|
function activateall() {
|
|
$data = array(
|
|
'active' => '1',
|
|
);
|
|
|
|
$this->db->update('adif_modes', $data);
|
|
|
|
return true;
|
|
}
|
|
|
|
function deactivateall() {
|
|
$data = array(
|
|
'active' => '0',
|
|
);
|
|
|
|
$this->db->update('adif_modes', $data);
|
|
|
|
return true;
|
|
}
|
|
|
|
}
|
|
|
|
?>
|