public function __construct() { socialFeed::get_favicon_from('http://www.delicious.com/sydlawrence'); $this->session = Session::instance(); $this->db = new Database(); parent::__construct(); $_POST = $this->input->xss_clean($_POST); if ($this->input->post('attempt_login')) { $return = login::attempt_login(); if (isset($return->id) && $return->id > 0) { $this->user = $return; } else { $this->__set_options(array('error' => $return)); } if (isset($_GET['redirect'])) { url::redirect(urldecode($_GET['redirect'])); } } $this->user = login::check_login(); if ($this->input->get('logout')) { Auth::instance()->logout(TRUE); url::redirect(); } $this->page = Page_Model::get_by_url(); $this->feed = Feed_Model::get_by_url(); $this->feedpost = Feedpost_Model::get_by_url(); $this->__setup(); $this->header = new View('includes/header'); $this->footer = new View('includes/footer'); $this->__binds(); }
/** * Returns a feedpost from the current url * * $param bool $unpublished Return unpublished posts too? * @return object|bool $post The feedpost generated by the url, or null if no feedpost found */ public static function get_by_url($unpublished = false) { $uri = uri::instance(); $feed = Feed_Model::get_by_url(); if ($feed && $feed->id > 0) { $post_id = $uri->segment(2); $post = ORM::factory('feedpost', $post_id); if (!$unpublished) { if ($post->status_id == 2) { return $post; } } else { return $post; } } return null; }