mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Codeignitor 3.1.6 and corresponding changes
- fixes missing () from num_rows in authenticate user function - removes passwordhash library in favor of built in PHP password_hash and password_verify functions - uppercase all class filenames - add new CLI error templates, move HTML error templates - update mimes file to latest version - update routes to latest version
This commit is contained in:
135
application/models/Cat.php
Normal file
135
application/models/Cat.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
class Cat extends CI_Model {
|
||||
|
||||
function __construct()
|
||||
{
|
||||
// Call the Model constructor
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function update($result) {
|
||||
|
||||
$this->db->where('radio', $result['radio']);
|
||||
$query = $this->db->get('cat');
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
if($result['radio'] == "SatPC32") {
|
||||
// Update the record
|
||||
foreach ($query->result() as $row)
|
||||
{
|
||||
$radio_id = $row->id;
|
||||
|
||||
$data = array(
|
||||
'sat_name' => $result['sat_name'],
|
||||
'downlink_freq' => $result['downlink_freq'],
|
||||
'uplink_freq' => $result['uplink_freq'],
|
||||
'downlink_mode' => $result['downlink_mode'],
|
||||
'uplink_mode' => $result['uplink_mode'],
|
||||
);
|
||||
|
||||
$this->db->where('id', $radio_id);
|
||||
$this->db->update('cat', $data);
|
||||
}
|
||||
} else {
|
||||
// Update the record
|
||||
foreach ($query->result() as $row)
|
||||
{
|
||||
$radio_id = $row->id;
|
||||
|
||||
$data = array(
|
||||
'frequency' => $result['frequency'],
|
||||
'mode' => $result['mode'],
|
||||
);
|
||||
|
||||
$this->db->where('id', $radio_id);
|
||||
$this->db->update('cat', $data);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Add a new record
|
||||
|
||||
if($result['radio'] == "SatPC32") {
|
||||
$data = array(
|
||||
'radio' => $result['radio'],
|
||||
'frequency' => $result['frequency'],
|
||||
'mode' => $result['mode'],
|
||||
'sat_name' => $result['sat_name'],
|
||||
'downlink_freq' => $result['downlink_freq'],
|
||||
'uplink_freq' => $result['uplink_freq'],
|
||||
'downlink_mode' => $result['downlink_mode'],
|
||||
'uplink_mode' => $result['uplink_mode'],
|
||||
);
|
||||
} else {
|
||||
$data = array(
|
||||
'radio' => $result['radio'],
|
||||
'frequency' => $result['frequency'],
|
||||
'mode' => $result['mode']
|
||||
);
|
||||
}
|
||||
|
||||
$this->db->insert('cat', $data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function cat_status($result) {
|
||||
|
||||
$this->db->where('profile_name', $result['profile_name']);
|
||||
$query = $this->db->get('cat');
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
// Update the record
|
||||
foreach ($query->result() as $row)
|
||||
{
|
||||
$radio_id = $row->id;
|
||||
|
||||
$data = array(
|
||||
'profile_name' => $result['profile_name'],
|
||||
'profile_url' => $result['profile_url']
|
||||
);
|
||||
|
||||
$this->db->where('id', $radio_id);
|
||||
$this->db->update('cat', $data);
|
||||
}
|
||||
} else {
|
||||
// Add a new record
|
||||
$data = array(
|
||||
'profile_name' => $result['profile_name'],
|
||||
'profile_url' => $result['profile_url']
|
||||
);
|
||||
|
||||
$this->db->insert('cat', $data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function status() {
|
||||
//$this->db->where('radio', $result['radio']);
|
||||
$query = $this->db->get('cat');
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/* Return list of radios */
|
||||
function radios() {
|
||||
$this->db->select('id, radio');
|
||||
$query = $this->db->get('cat');
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function delete($id) {
|
||||
$this->db->where('id', $id);
|
||||
$this->db->delete('cat');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user