fix missing () from num_rows calls

这个提交包含在:
Warren Volz 2017-11-30 19:01:11 -07:00
父节点 e384826aea
当前提交 73e0f1d7d1
共有 2 个文件被更改,包括 27 次插入27 次删除

查看文件

@ -14,7 +14,7 @@ class API extends CI_Controller {
//$this->db->select("DATE_FORMAT(COL_TIME_ON, '%H:%i') AS time_on", FALSE ); //$this->db->select("DATE_FORMAT(COL_TIME_ON, '%H:%i') AS time_on", FALSE );
//$this->db->select("DATE_FORMAT(COL_TIME_ON, '%d/%c/%Y') AS date_on", FALSE ); //$this->db->select("DATE_FORMAT(COL_TIME_ON, '%d/%c/%Y') AS date_on", FALSE );
$this->db->like('COL_CALL', $callsign); $this->db->like('COL_CALL', $callsign);
$this->db->or_like('COL_GRIDSQUARE', $callsign); $this->db->or_like('COL_GRIDSQUARE', $callsign);
$query = $this->db->get($this->config->item('table_name')); $query = $this->db->get($this->config->item('table_name'));
@ -22,10 +22,10 @@ class API extends CI_Controller {
foreach ($query->result() as $result) foreach ($query->result() as $result)
{ {
$results[] = $result; $results[] = $result;
} }
header('Content-type: application/json'); header('Content-type: application/json');
//$arr = array ('a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5); //$arr = array ('a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5);
echo $_GET['jsoncallback'].'('.json_encode($results).')'; //assign resulting code to $_GET['jsoncallback]. echo $_GET['jsoncallback'].'('.json_encode($results).')'; //assign resulting code to $_GET['jsoncallback].
@ -82,7 +82,7 @@ class API extends CI_Controller {
// Example of authing // Example of authing
function auth($key) { function auth($key) {
$this->load->model('api_model'); $this->load->model('api_model');
header("Content-type: text/xml"); header("Content-type: text/xml");
if($this->api_model->access($key) == "No Key Found" || $this->api_model->access($key) == "Key Disabled") { if($this->api_model->access($key) == "No Key Found" || $this->api_model->access($key) == "Key Disabled") {
echo "<auth>"; echo "<auth>";
echo "<message>Key Invalid - either not found or disabled</message>"; echo "<message>Key Invalid - either not found or disabled</message>";
@ -160,7 +160,7 @@ class API extends CI_Controller {
// Retrieve the arguments from the query string // Retrieve the arguments from the query string
$data['data']['format'] = $arguments['format']; $data['data']['format'] = $arguments['format'];
// Call the parser within the API model to build the query // Call the parser within the API model to build the query
$query = $this->api_model->select_parse($arguments); $query = $this->api_model->select_parse($arguments);
@ -185,7 +185,7 @@ class API extends CI_Controller {
// Cycle through the results, and translate between MySQL column names // Cycle through the results, and translate between MySQL column names
// and more friendly, descriptive names // and more friendly, descriptive names
if($results->num_rows != 0) if($results->num_rows() != 0)
{ {
foreach ($results->result() as $row) { foreach ($results->result() as $row) {
$record = (array)$row; $record = (array)$row;
@ -234,7 +234,7 @@ class API extends CI_Controller {
// Retrieve the arguments from the query string // Retrieve the arguments from the query string
$data['data']['format'] = $arguments['format']; $data['data']['format'] = $arguments['format'];
// Call the parser within the API model to build the query // Call the parser within the API model to build the query
$query = $this->api_model->select_parse($arguments); $query = $this->api_model->select_parse($arguments);
@ -263,7 +263,7 @@ class API extends CI_Controller {
$this->load->view('api/index', $data); $this->load->view('api/index', $data);
} }
function add() function add()
{ {
// Load the API and Logbook models // Load the API and Logbook models
@ -274,7 +274,7 @@ class API extends CI_Controller {
// Retrieve the arguments from the query string // Retrieve the arguments from the query string
$arguments = $this->_retrieve(); $arguments = $this->_retrieve();
// Call the parser within the API model to build the query // Call the parser within the API model to build the query
$query = $this->api_model->insert_parse($arguments); $query = $this->api_model->insert_parse($arguments);
@ -345,45 +345,45 @@ class API extends CI_Controller {
// Return the arguments // Return the arguments
return $arguments; return $arguments;
} }
/* ENDPOINT for Rig Control */ /* ENDPOINT for Rig Control */
function radio() { function radio() {
header('Content-type: application/json'); header('Content-type: application/json');
//$json = '{"radio":"FT-950","frequency":14075,"mode":"SSB","timestamp":"2012/04/07 16:47"}'; //$json = '{"radio":"FT-950","frequency":14075,"mode":"SSB","timestamp":"2012/04/07 16:47"}';
$this->load->model('cat'); $this->load->model('cat');
//var_dump(file_get_contents("php://input"), true); //var_dump(file_get_contents("php://input"), true);
// Decode JSON and store // Decode JSON and store
$obj = json_decode(file_get_contents("php://input"), true); $obj = json_decode(file_get_contents("php://input"), true);
// Store Result to Database // Store Result to Database
$this->cat->update($obj); $this->cat->update($obj);
// Return Message // Return Message
$arr = array('status' => 'success'); $arr = array('status' => 'success');
echo json_encode($arr); echo json_encode($arr);
} }
function cat_status () { function cat_status () {
header('Content-type: application/json'); header('Content-type: application/json');
$this->load->model('cat'); $this->load->model('cat');
// Decode JSON and store // Decode JSON and store
$obj = json_decode(file_get_contents("php://input"), true); $obj = json_decode(file_get_contents("php://input"), true);
// Store Result to Database // Store Result to Database
$this->cat->cat_status($obj); $this->cat->cat_status($obj);
// Return Message // Return Message
$arr = array('status' => 'success'); $arr = array('status' => 'success');
echo json_encode($arr); echo json_encode($arr);

查看文件

@ -46,7 +46,7 @@ class User_Model extends CI_Model {
// FUNCTION: bool exists($username) // FUNCTION: bool exists($username)
// Check if a user exists (by username) // Check if a user exists (by username)
function exists($username) { function exists($username) {
if($this->get($username)->num_rows == 0) { if($this->get($username)->num_rows() == 0) {
return 0; return 0;
} else { } else {
return 1; return 1;
@ -56,7 +56,7 @@ class User_Model extends CI_Model {
// FUNCTION: bool exists_by_id($id) // FUNCTION: bool exists_by_id($id)
// Check if a user exists (by user ID) // Check if a user exists (by user ID)
function exists_by_id($id) { function exists_by_id($id) {
if($this->get_by_id($id)->num_rows == 0) { if($this->get_by_id($id)->num_rows() == 0) {
return 0; return 0;
} else { } else {
return 1; return 1;
@ -66,7 +66,7 @@ class User_Model extends CI_Model {
// FUNCTION: bool exists_by_email($email) // FUNCTION: bool exists_by_email($email)
// Check if a user exists (by email address) // Check if a user exists (by email address)
function exists_by_email($email) { function exists_by_email($email) {
if($this->get_by_email($email)->num_rows == 0) { if($this->get_by_email($email)->num_rows() == 0) {
return 0; return 0;
} else { } else {
return 1; return 1;