mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-25 12:31:06 -05:00
This commit is contained in:
parent
bd9a2dbc7c
commit
f3730cacda
@ -293,19 +293,24 @@ class Pastes extends CI_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
// hits
|
// hits
|
||||||
$hits_where = array(
|
|
||||||
'paste_id' => $pid,
|
|
||||||
);
|
|
||||||
$hits_data = array(
|
$hits_data = array(
|
||||||
'paste_id' => $pid,
|
'paste_id' => $pid,
|
||||||
'ip_address' => $this->input->ip_address() ,
|
'ip_address' => $this->input->ip_address() ,
|
||||||
'created' => mktime() ,
|
'created' => mktime() ,
|
||||||
);
|
);
|
||||||
$update_query = $this->db->update_string('trending', $hits_data, $hits_where);
|
$hits_where = array(
|
||||||
$this->db->query($update_query);
|
'paste_id' => $pid,
|
||||||
if ($this->db->affected_rows() == 0) {
|
'ip_address' => $this->input->ip_address() ,
|
||||||
$insert_query = $this->db->insert_string('trending', $hits_data);
|
);
|
||||||
$this->db->query($insert_query);
|
|
||||||
|
// First check if record already exists. If it does, do not insert.
|
||||||
|
// INSERT IGNORE INTO does not work for postgres.
|
||||||
|
|
||||||
|
$query = $this->db->get('trending', $hits_where);
|
||||||
|
|
||||||
|
if ($query->num_rows == 0)
|
||||||
|
{
|
||||||
|
$this->db->insert('trending', $hits_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mktime() > (60 + $data['hits_updated']))
|
if (mktime() > (60 + $data['hits_updated']))
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
* NOTE: If you change these, also change the error_reporting() code below
|
* NOTE: If you change these, also change the error_reporting() code below
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
define('ENVIRONMENT', 'production');
|
define('ENVIRONMENT', 'development');
|
||||||
/*
|
/*
|
||||||
*---------------------------------------------------------------
|
*---------------------------------------------------------------
|
||||||
* ERROR REPORTING
|
* ERROR REPORTING
|
||||||
|
Loading…
x
Reference in New Issue
Block a user