mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-25 12:31:06 -05:00
simplifying
This commit is contained in:
parent
50c7ab7e80
commit
2033d4fe74
@ -56,12 +56,8 @@ $route['trends'] = 'main/trends';
|
||||
$route['trends/:any'] = 'main/trends/$1';
|
||||
$route['spamadmin/:num'] = 'spamadmin/index';
|
||||
$route['spamadmin/blacklist/unblock/(:any)'] = 'spamadmin/unblock_ip';
|
||||
$route['spamadmin/blacklist/(:num)'] = 'spamadmin/blacklist';
|
||||
$route['spamadmin/blacklist'] = 'spamadmin/blacklist';
|
||||
$route['spamadmin/:any'] = 'spamadmin/spam_detail';
|
||||
$route['about'] = 'main/about';
|
||||
$route['api/paste/:any'] = 'api/paste';
|
||||
$route['api/random'] = 'api/random_paste';
|
||||
|
||||
$route['iphone/:num'] = 'iphone';
|
||||
$route['iphone/view/:any'] = 'iphone/view';
|
||||
|
@ -5,6 +5,8 @@
|
||||
* - __construct()
|
||||
* - index()
|
||||
* - create()
|
||||
* - paste()
|
||||
* - random()
|
||||
* Classes list:
|
||||
* - Api extends Main
|
||||
*/
|
||||
@ -54,13 +56,13 @@ class Api extends Main
|
||||
$this->load->view('view/api', $data);
|
||||
}
|
||||
}
|
||||
|
||||
function paste()
|
||||
|
||||
function paste()
|
||||
{
|
||||
$this->load->model('pastes');
|
||||
$check = $this->pastes->checkPaste(3);
|
||||
|
||||
if ($check)
|
||||
|
||||
if ($check)
|
||||
{
|
||||
$data = $this->pastes->getPaste(3);
|
||||
}
|
||||
@ -72,13 +74,13 @@ class Api extends Main
|
||||
}
|
||||
echo stripslashes(json_encode($data));
|
||||
}
|
||||
|
||||
function random_paste()
|
||||
|
||||
function random()
|
||||
{
|
||||
$this->load->model('pastes');
|
||||
$data = $this->pastes->random_paste();
|
||||
|
||||
if (!$data)
|
||||
|
||||
if (!$data)
|
||||
{
|
||||
$data = array(
|
||||
'message' => 'Please try again',
|
||||
|
@ -15,6 +15,7 @@
|
||||
* - getTrends()
|
||||
* - getSpamLists()
|
||||
* - cron()
|
||||
* - random_paste()
|
||||
* Classes list:
|
||||
* - Pastes extends CI_Model
|
||||
*/
|
||||
@ -488,18 +489,17 @@ class Pastes extends CI_Model
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
function random_paste()
|
||||
|
||||
function random_paste()
|
||||
{
|
||||
$this->load->library('process');
|
||||
|
||||
$paste_id = rand(1, $this->countPastes());
|
||||
$this->db->where('id', $paste_id);
|
||||
$query = $this->db->get('pastes');
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
foreach ($query->result_array() as $row)
|
||||
foreach ($query->result_array() as $row)
|
||||
{
|
||||
$data['title'] = $row['title'];
|
||||
$data['pid'] = $row['pid'];
|
||||
@ -515,16 +515,16 @@ class Pastes extends CI_Model
|
||||
$data['snipurl'] = $row['snipurl'];
|
||||
$inreply = $row['replyto'];
|
||||
}
|
||||
|
||||
if ($inreply)
|
||||
|
||||
if ($inreply)
|
||||
{
|
||||
$this->db->select('name, title');
|
||||
$this->db->where('pid', $inreply);
|
||||
$query = $this->db->get('pastes');
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
foreach ($query->result_array() as $row)
|
||||
foreach ($query->result_array() as $row)
|
||||
{
|
||||
$data['inreply']['title'] = $row['title'];
|
||||
$data['inreply']['name'] = $row['name'];
|
||||
@ -538,7 +538,6 @@ class Pastes extends CI_Model
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user