mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-25 20:41:20 -05:00
Fixing Trending & Recent API bug
Fixed Trending & Recent API bug Fixing Trending & Recent API bug Fixed Trending & Recent API bug
This commit is contained in:
parent
ac9ae70078
commit
8d7ff6ce46
@ -129,7 +129,7 @@ class Api extends Main
|
||||
show_404();
|
||||
}
|
||||
$this->load->model('pastes');
|
||||
$pastes = $this->pastes->getLists();
|
||||
$pastes = $this->pastes->getLists('api/recent');
|
||||
$pastes = $pastes['pastes'];
|
||||
$data = array();
|
||||
foreach ($pastes as $paste)
|
||||
@ -153,7 +153,7 @@ class Api extends Main
|
||||
show_404();
|
||||
}
|
||||
$this->load->model('pastes');
|
||||
$pastes = $this->pastes->getTrends();
|
||||
$pastes = $this->pastes->getTrends('api/trending',2);
|
||||
$pastes = $pastes['pastes'];
|
||||
$data = array();
|
||||
foreach ($pastes as $paste)
|
||||
|
@ -470,6 +470,8 @@ class Pastes extends CI_Model
|
||||
// query
|
||||
if($this->db->dbdriver == "postgre") {
|
||||
$sql = "SELECT id, title, name, created, pid, lang, raw FROM pastes WHERE private = 0 AND (title LIKE ? OR raw LIKE ?) ORDER BY created DESC LIMIT $amount OFFSET $page";
|
||||
} else if ($root == 'api/recent'){
|
||||
$sql = "SELECT id, title, name, created, pid, lang, raw FROM pastes WHERE private = 0 AND (title LIKE ? OR raw LIKE ?) ORDER BY created DESC LIMIT 0,15";
|
||||
} else {
|
||||
$sql = "SELECT id, title, name, created, pid, lang, raw FROM pastes WHERE private = 0 AND (title LIKE ? OR raw LIKE ?) ORDER BY created DESC LIMIT $page,$amount";
|
||||
}
|
||||
@ -551,6 +553,8 @@ class Pastes extends CI_Model
|
||||
// query
|
||||
if($this->db->dbdriver == "postgre") {
|
||||
$sql = "SELECT id, title, name, created, pid, lang, raw, hits FROM pastes WHERE private = 0 AND (title LIKE ? OR raw LIKE ?) ORDER BY hits DESC, created DESC LIMIT $amount OFFSET $page";
|
||||
} else if ($root == "api/trending"){
|
||||
$sql = "SELECT id, title, name, created, pid, lang, raw, hits FROM pastes WHERE private = 0 AND (title LIKE ? OR raw LIKE ?) ORDER BY hits DESC, created DESC LIMIT 0,15";
|
||||
}else {
|
||||
$sql = "SELECT id, title, name, created, pid, lang, raw, hits FROM pastes WHERE private = 0 AND (title LIKE ? OR raw LIKE ?) ORDER BY hits DESC, created DESC LIMIT $page,$amount";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user