mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-25 12:31:06 -05:00
spamadmin view
This commit is contained in:
parent
79d35012da
commit
e5afc20e9b
@ -52,6 +52,7 @@ $route['view/:any'] = 'main/view';
|
||||
$route['lists'] = 'main/lists';
|
||||
$route['lists/rss'] = 'main/lists/rss';
|
||||
$route['lists/:num'] = 'main/lists/$1';
|
||||
$route['spamadmin/:num'] = 'spamadmin/index';
|
||||
$route['about'] = 'main/about';
|
||||
|
||||
$route['iphone/:num'] = 'iphone';
|
||||
|
@ -4,7 +4,6 @@
|
||||
* Function list:
|
||||
* - __construct()
|
||||
* - index()
|
||||
* - lists()
|
||||
* Classes list:
|
||||
* - Spamadmin extends CI_Controller
|
||||
*/
|
||||
@ -18,26 +17,9 @@ class Spamadmin extends CI_Controller
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
}
|
||||
|
||||
function lists()
|
||||
{
|
||||
$this->load->model('pastes');
|
||||
$data = $this->pastes->getLists();
|
||||
|
||||
if ($this->uri->segment(2) == 'rss')
|
||||
{
|
||||
$this->load->helper('text');
|
||||
$data['page_title'] = $this->config->item('site_name');
|
||||
$data['feed_url'] = site_url('lists/rss');
|
||||
$data['replies'] = $data['pastes'];
|
||||
unset($data['pastes']);
|
||||
$this->load->view('view/rss', $data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->load->view('list', $data);
|
||||
}
|
||||
$data = $this->pastes->getSpamLists();
|
||||
$this->load->view('spamlist', $data);
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
* - getPaste()
|
||||
* - getReplies()
|
||||
* - getLists()
|
||||
* - getSpamLists()
|
||||
* - cron()
|
||||
* Classes list:
|
||||
* - Pastes extends CI_Model
|
||||
@ -366,6 +367,52 @@ class Pastes extends CI_Model
|
||||
return $data;
|
||||
}
|
||||
|
||||
function getSpamLists($root = 'spamadmin/', $seg = 2)
|
||||
{
|
||||
$this->load->library('pagination');
|
||||
$this->load->library('process');
|
||||
$amount = $this->config->item('per_page');
|
||||
|
||||
if (!$this->uri->segment(2))
|
||||
{
|
||||
$page = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$page = $this->uri->segment(2);
|
||||
}
|
||||
$this->db->select('id, title, name, created, pid, lang, session_id');
|
||||
$this->db->where('private', 0);
|
||||
$this->db->order_by('created', 'desc');
|
||||
$query = $this->db->get('pastes', $amount, $page);
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
$n = 0;
|
||||
foreach ($query->result_array() as $row)
|
||||
{
|
||||
$data['pastes'][$n]['id'] = $row['id'];
|
||||
$data['pastes'][$n]['title'] = $row['title'];
|
||||
$data['pastes'][$n]['name'] = $row['name'];
|
||||
$data['pastes'][$n]['created'] = $row['created'];
|
||||
$data['pastes'][$n]['lang'] = $row['lang'];
|
||||
$data['pastes'][$n]['pid'] = $row['pid'];
|
||||
$data['pastes'][$n]['session_id'] = $row['session_id'];
|
||||
$n++;
|
||||
}
|
||||
}
|
||||
$config['base_url'] = site_url($root);
|
||||
$config['total_rows'] = $this->countPastes();
|
||||
$config['per_page'] = $amount;
|
||||
$config['num_links'] = 9;
|
||||
$config['full_tag_open'] = '<div class="pages">';
|
||||
$config['full_tag_close'] = '</div>';
|
||||
$config['uri_segment'] = $seg;
|
||||
$this->pagination->initialize($config);
|
||||
$data['pages'] = $this->pagination->create_links();
|
||||
return $data;
|
||||
}
|
||||
|
||||
function cron()
|
||||
{
|
||||
$now = now();
|
||||
|
44
htdocs/application/views/spamlist.php
Executable file
44
htdocs/application/views/spamlist.php
Executable file
@ -0,0 +1,44 @@
|
||||
<?php $this->load->view('defaults/header');?>
|
||||
<h1>Spamadmin</h1>
|
||||
|
||||
<?php
|
||||
function checkNum($num){
|
||||
return ($num%2) ? TRUE : FALSE;
|
||||
}
|
||||
$n = 0;
|
||||
if(!empty($pastes)){ ?>
|
||||
<table class="recent">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="title">Title</th>
|
||||
<th class="name">Name</th>
|
||||
<th class="lang">Language</th>
|
||||
<th class="time">When</th>
|
||||
<th class="time">Session</th>
|
||||
</tr>
|
||||
<?php foreach($pastes as $paste) {
|
||||
if(checkNum($n) == TRUE) {
|
||||
$eo = "even";
|
||||
} else {
|
||||
$eo = "odd";
|
||||
}
|
||||
$n++;
|
||||
?>
|
||||
|
||||
<tr class="<?php echo $eo; ?>">
|
||||
<td class="first"><a href="<?php echo site_url("view/".$paste['pid']); ?>"><?php echo $paste['title']; ?></a></td>
|
||||
<td><?php echo $paste['name']; ?></td>
|
||||
<td><?php echo $paste['lang']; ?></td>
|
||||
<td><?php $p = explode(",", timespan($paste['created'], time())); echo $p[0]; ?> ago.</td>
|
||||
<td><a href="<?php echo site_url('spamadmin/session/' . $paste['session_id']) ?>">[<?php echo substr($paste['session_id'], 0, 8); ?>...]</a></td>
|
||||
</tr>
|
||||
|
||||
<?php }?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } else { ?>
|
||||
<p>There have been no pastes :(</p>
|
||||
<?php }?>
|
||||
<?php echo $pages; ?>
|
||||
<div class="spacer"></div>
|
||||
<?php $this->load->view('defaults/footer');?>
|
Loading…
x
Reference in New Issue
Block a user