mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-26 04:51:08 -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();
|
show_404();
|
||||||
}
|
}
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$pastes = $this->pastes->getLists();
|
$pastes = $this->pastes->getLists('api/recent');
|
||||||
$pastes = $pastes['pastes'];
|
$pastes = $pastes['pastes'];
|
||||||
$data = array();
|
$data = array();
|
||||||
foreach ($pastes as $paste)
|
foreach ($pastes as $paste)
|
||||||
@ -153,7 +153,7 @@ class Api extends Main
|
|||||||
show_404();
|
show_404();
|
||||||
}
|
}
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$pastes = $this->pastes->getTrends();
|
$pastes = $this->pastes->getTrends('api/trending',2);
|
||||||
$pastes = $pastes['pastes'];
|
$pastes = $pastes['pastes'];
|
||||||
$data = array();
|
$data = array();
|
||||||
foreach ($pastes as $paste)
|
foreach ($pastes as $paste)
|
||||||
|
@ -470,6 +470,8 @@ class Pastes extends CI_Model
|
|||||||
// query
|
// query
|
||||||
if($this->db->dbdriver == "postgre") {
|
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";
|
$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 {
|
} 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";
|
$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,7 +553,9 @@ class Pastes extends CI_Model
|
|||||||
// query
|
// query
|
||||||
if($this->db->dbdriver == "postgre") {
|
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";
|
$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 {
|
} 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";
|
$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";
|
||||||
}
|
}
|
||||||
$query = $this->db->query($sql, array(
|
$query = $this->db->query($sql, array(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user