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'); }
function import($render) { $xml = new XMLReader(); $xml->open($_FILES['opml']['tmp_name']); while ($xml->read()) { if ($xml->nodeType == XMLReader::ELEMENT && $xml->localName == 'outline' && $xml->getAttribute('type') == 'rss') { $feed = $xml->getAttribute('xmlUrl'); $title = $xml->getAttribute('text'); $this->db->Execute('INSERT IGNORE INTO lylina_feeds (url, name) VALUES (?, ?)', array($feed, $title)); $this->db->Execute('INSERT IGNORE INTO lylina_userfeeds (feed_id, user_id, feed_name) VALUES ((select id from lylina_feeds where url = ?), ?, ?)', array($feed, $this->auth->getUserId(), $title)); } } $fetch = new Fetch($this->db); $fetch->get(); header('Location: admin'); }