mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Do stuff only if config is set (+re-add line at dashboard)
This commit is contained in:
@@ -67,11 +67,13 @@
|
||||
$data['mode_rx'] = NULL;
|
||||
}
|
||||
|
||||
$this->load->library('Mh');
|
||||
$eventdata=$data;
|
||||
$h_user=$this->User_model->get_by_id($user_id);
|
||||
$eventdata['user_name']=$h_user->row()->user_name;
|
||||
$eventdata['user_id']=$h_user->row()->user_id ?? '';
|
||||
if (($this->config->item('mqtt_server') ?? '') != '') {
|
||||
$h_user=$this->User_model->get_by_id($user_id);
|
||||
$this->load->library('Mh');
|
||||
$eventdata=$data;
|
||||
$eventdata['user_name']=$h_user->row()->user_name;
|
||||
$eventdata['user_id']=$h_user->row()->user_id ?? '';
|
||||
}
|
||||
if ($query->num_rows() > 0) {
|
||||
// Update the record
|
||||
foreach ($query->result() as $row) {
|
||||
@@ -79,7 +81,9 @@
|
||||
$this->db->where('id', $radio_id);
|
||||
$this->db->where('user_id', $user_id);
|
||||
$this->db->update('cat', $data);
|
||||
$this->mh->wl_event('cat/'.$user_id, json_encode(array_merge($data,$eventdata)));
|
||||
if (($this->ci->config->item('mqtt_server') ?? '') != '') {
|
||||
$this->mh->wl_event('cat/'.$user_id, json_encode(array_merge($data,$eventdata)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Add a new record
|
||||
@@ -87,7 +91,9 @@
|
||||
$data['user_id'] = $user_id;
|
||||
$data['operator'] = $operator;
|
||||
$this->db->insert('cat', $data);
|
||||
$this->mh->wl_event('cat/'.$user_id, json_encode(array_merge($data,$eventdata)));
|
||||
if (($this->ci->config->item('mqtt_server') ?? '') != '') {
|
||||
$this->mh->wl_event('cat/'.$user_id, json_encode(array_merge($data,$eventdata)));
|
||||
}
|
||||
}
|
||||
unset($eventdata);
|
||||
unset($h_user);
|
||||
|
||||
Reference in New Issue
Block a user