Esempio n. 1
0
 function render()
 {
     $render = new Render();
     $render->assign('update', true);
     $render->display('head.tpl');
     $items = new Items($this->db);
     $list = $items->get_items();
     $render->assign('items', $list);
     $render->display('items.tpl');
     $render->display('foot.tpl');
 }
Esempio n. 2
0
 function render()
 {
     $render = new Render($this->db);
     // Check our authorization
     $auth = new Auth($this->db);
     // If we've been posted a password and it's wrong
     if (isset($_POST['user']) && isset($_POST['pass']) && !$auth->validate($_POST['user'], $_POST['pass'])) {
         // TODO: Use a real error handler instead of this
         header('HTTP/1.1 403 Forbidden');
         $render->assign('title', 'There was an error');
         $render->assign('reason', "I'm sorry, the password you entered is incorrect");
         $render->display('auth_fail.tpl');
         return;
     }
     // Otherwise we need to check to see if the user has already logged in or not
     if (!$this->auth->check()) {
         header('HTTP/1.1 403 Not Found');
         $render->assign('title', 'There was an error');
         $render->assign('reason', 'You need to login to perform this operation.');
         $render->display('auth_fail.tpl');
         return;
     }
     if (empty($_REQUEST['op'])) {
         $op = 'main';
     } else {
         $op = $_REQUEST['op'];
     }
     if (method_exists($this, $op)) {
         $this->{$op}($render);
     } else {
         header('HTTP/1.1 404 Not Found');
         $render->assign('title', 'There was an error');
         $render->assign('reason', 'The page you are looking for does not seem to exist.');
         $render->display('auth_fail.tpl');
         return;
     }
 }
Esempio n. 3
0
 function render()
 {
     $newest = $_REQUEST['newest'];
     $items = $this->db->GetAll('SELECT lylina_items.id, lylina_items.url, lylina_items.title, lylina_items.body, UNIX_TIMESTAMP(lylina_items.dt) AS timestamp, lylina_items.viewed, lylina_feeds.url AS feed_url, lylina_feeds.name AS feed_name FROM lylina_items, lylina_feeds WHERE UNIX_TIMESTAMP(lylina_items.dt) > UNIX_TIMESTAMP()-(8*60*60) AND lylina_items.feed_id = lylina_feeds.id ORDER BY lylina_items.dt DESC');
     foreach ($items as &$item) {
         // If we have a newer item, mark it as new
         if ($newest && $item['id'] > $newest) {
             $item['new'] = 1;
         }
         print "\n";
         // Format the date for headers
         $item['date'] = date('l F j, Y', $item['timestamp']);
     }
     $render = new Render();
     $render->assign('items', $items);
     $render->display('items.tpl');
 }
Esempio n. 4
0
 function render()
 {
     if (isset($_REQUEST['newest'])) {
         $newest = $_REQUEST['newest'];
     } else {
         $newest = 0;
     }
     if (isset($_REQUEST['pivot'])) {
         $pivot = $_REQUEST['pivot'];
     } else {
         $pivot = false;
     }
     $items = new Items($this->db);
     $list = $items->get_items($newest, $pivot);
     $render = new Render();
     $render->assign('items', $list);
     $render->display('items.tpl');
 }
Esempio n. 5
0
 function render()
 {
     $newest = $_REQUEST['newest'];
     $fetch = new Fetch($this->db);
     $fetch->get();
     $query = 'SELECT COUNT(*) 
               FROM lylina_items';
     if ($this->auth->check()) {
         $query .= ' INNER JOIN (lylina_userfeeds) ON (lylina_items.feed_id = lylina_userfeeds.feed_id)';
     }
     $query .= ' WHERE id > ? AND UNIX_TIMESTAMP(dt) > UNIX_TIMESTAMP()-(8*60*60)';
     if ($this->auth->check()) {
         $query .= ' AND lylina_userfeeds.user_id = ?';
     }
     $result = $this->db->GetRow($query, array($newest, $this->auth->getUserId()));
     if ($result) {
         $count = $result['COUNT(*)'];
     } else {
         $count = 0;
     }
     $render = new Render();
     $render->assign('count', $count);
     $render->display('update.tpl');
 }