Skip to content

Commit 628ab83

Browse files
committed
Fixed some errors to get keys example working
1 parent 001852a commit 628ab83

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

application/controllers/api/key.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ private function _generate_key()
198198

199199
do
200200
{
201-
$salt = dohash(time().mt_rand());
201+
$salt = do_hash(time().mt_rand());
202202
$new_key = substr($salt, 0, config_item('rest_key_length'));
203203
}
204204

@@ -214,14 +214,14 @@ private function _generate_key()
214214

215215
private function _get_key($key)
216216
{
217-
return $this->rest->db->where('key', $key)->get(config_item('rest_keys_table'))->row();
217+
return $this->db->where('key', $key)->get(config_item('rest_keys_table'))->row();
218218
}
219219

220220
// --------------------------------------------------------------------
221221

222222
private function _key_exists($key)
223223
{
224-
return $this->rest->db->where('key', $key)->count_all_results(config_item('rest_keys_table')) > 0;
224+
return $this->db->where('key', $key)->count_all_results(config_item('rest_keys_table')) > 0;
225225
}
226226

227227
// --------------------------------------------------------------------
@@ -232,20 +232,20 @@ private function _insert_key($key, $data)
232232
$data['key'] = $key;
233233
$data['date_created'] = function_exists('now') ? now() : time();
234234

235-
return $this->rest->db->set($data)->insert(config_item('rest_keys_table'));
235+
return $this->db->set($data)->insert(config_item('rest_keys_table'));
236236
}
237237

238238
// --------------------------------------------------------------------
239239

240240
private function _update_key($key, $data)
241241
{
242-
return $this->rest->db->where('key', $key)->update(config_item('rest_keys_table'), $data);
242+
return $this->db->where('key', $key)->update(config_item('rest_keys_table'), $data);
243243
}
244244

245245
// --------------------------------------------------------------------
246246

247247
private function _delete_key($key)
248248
{
249-
return $this->rest->db->where('key', $key)->delete(config_item('rest_keys_table'));
249+
return $this->db->where('key', $key)->delete(config_item('rest_keys_table'));
250250
}
251251
}

0 commit comments

Comments
 (0)