/** * Session constructor * * Check if cookie or session variables exists to retrieve directly informations * * Otherwise it calls get_browser method * * @access public */ public function __construct() { session_start(); $this->_db =& Database::load(); if (VCookie::lynxpress()) { $array = json_decode(stripslashes(VCookie::lynxpress()), true); $_SESSION['html5'] = $array['html5']; $_SESSION['renderer'] = $array['renderer']; $this->_html5 = VSession::html5(); $this->_renderer = VSession::renderer(); } elseif (!VSession::html5() && !VSession::renderer()) { $this->get_browser(); $_SESSION['html5'] = $this->_html5; $_SESSION['renderer'] = $this->_renderer; setcookie('lynxpress', json_encode(array('html5' => $this->_html5, 'renderer' => $this->_renderer)), time() + 365 * 24 * 60 * 60); } else { $this->_html5 = VSession::html5(); $this->_renderer = VSession::renderer(); } }
/** * Determine cache filename * * @access private */ private function build_url() { if (self::ACTIVATED === false) { return false; } if (VSession::renderer() == 'mobile') { $this->_url .= 'mobile'; } elseif (VSession::html5()) { $this->_url .= 'html5'; } else { $this->_url .= 'html'; } $this->_url .= '-ctl-' . VGet::ctl(); if (VGet::ctl() == 'albums' && VGet::album() && !VGet::comments()) { $this->_url .= '-album-' . VGet::album(); } elseif (VGet::ctl() == 'search') { foreach (VGet::all() as $key => $value) { if ($key != 'ctl') { $this->_url .= '-' . $key . '-' . $value; } } } }
/** * Display page content * * @access public */ public function display_content() { Html::header_authors(VGet::author()); if (!empty($this->_content)) { if (!VSession::html5()) { echo '<ul id="authors">'; } foreach ($this->_content as $user) { Html::author($user->_publicname, $user->_email, $user->_website, $user->_msn, $user->_twitter, $user->_facebook, $user->_google, $user->_avatar, $user->_bio); } if (!VSession::html5()) { echo '</ul>'; } } else { Html::no_content('Wanted user doesn\'t exist'); } }
/** * Display page content * * @access public */ public function display_content() { if (!empty($this->_content)) { Html::header_links(); if (!VSession::html5()) { echo '<ul id="links">'; } foreach ($this->_content as $link) { Html::related_link($link->_name, $link->_link, $link->_rss_link, $link->_notes, $link->_priority); } if (!Vsession::html5()) { echo '</ul>'; } } else { Html::header_links(); if (!VSession::html5()) { echo '<ul id="links">'; } Html::no_content('There\'s no link registered yet.'); if (!Vsession::html5()) { echo '</ul>'; } } }
/** * Display albums listing * * @access private */ private function display_albums() { if (!empty($this->_content)) { Html::header_albums($this->_category); if (!VSession::html5()) { echo '<ul id="listing_albums">'; } else { echo '<section id="listing_albums">'; } foreach ($this->_content as $album) { Html::album_label($album->_id, $album->_name, $album->_permalink, $album->_description); } if (!VSession::html5()) { echo '</ul>'; } else { echo '</section>'; } } else { Html::header_albums($this->_category); if (!VSession::html5()) { echo '<ul>'; } Html::no_content('There\'s no albums right now.'); if (!VSession::html5()) { echo '</ul>'; } } }
/** * Display the posts listing * * @access private */ private function display_listing() { if (!VSession::html5() || VSession::renderer() == 'mobile') { echo '<ul id="listing_articles">'; } if (!empty($this->_content)) { foreach ($this->_content as $article) { $crop_length = Helper\Posts::crop_length($article->_content); $cats = explode(',', $article->_category); try { foreach ($cats as &$cat) { $id = $cat; $infos = new Category($id); $cat = Helper\Posts::make_category_link($id, $infos->_name); } } catch (Exception $e) { @error_log($e->getMessage() . ' file: ' . __FILE__ . '; line: ' . __LINE__, 1, WS_EMAIL); } $content = nl2br(substr($article->_content, 0, $crop_length)); Html::listing_article($article->_title, $article->_permalink, $cats, $article->_date, $article->_author_name, $content); } } else { Html::no_content('There\'s no post right now.'); } if (!VSession::html5() || VSession::renderer() == 'mobile') { echo '</ul>'; } if (VSession::renderer() != 'mobile' && !empty($this->_content)) { Html::navigation($this->_page, $this->_nb_pages, parent::link_navigation()); } }
/** * Display an error message what says there's no result for the search * * @access private */ private function display_error() { if (!empty($this->_search)) { $msg = $this->_search; } elseif (!empty($this->_by_date)) { $msg = date('M Y', strtotime($this->_by_date)); } elseif (!empty($this->_tag)) { $msg = $this->_tag; } elseif (!empty($this->_cat)) { try { $cat = new Category($this->_cat); $msg = ucwords($cat->_name); } catch (Exception $e) { header('Location: 404.php'); } } if (!VSession::html5()) { echo '<ul id="listing_articles">'; } Html::no_content('No results founded for "' . $msg . '"'); if (!VSession::html5()) { echo '</ul>'; } }
/** * Method to display a related link * * @static * @access public * @param string [$name] Link name * @param string [$link] Link url * @param string [$rss_link] Link RSS url * @param string [$notes] Link notes * @param integer [$priority] Link priority level */ public static function related_link($name, $link, $rss_link, $notes, $priority) { if (VSession::html5()) { echo '<section class="link">' . '<h3>' . $name . '</h3>' . '<details open>' . '<summary>Website links</summary>' . '<p>' . 'Website: <a href="' . $link . '">' . $link . '</a><br/>' . 'Feed: <a href="' . $rss_link . '">' . $rss_link . '</a>' . '</p>' . '</details>' . '<section class="description">' . nl2br($notes) . '</section>' . '</section>'; } else { echo '<li class="link">' . '<h3>' . $name . '</h3>' . '<p class="details">' . 'Website: <a href="' . $link . '">' . $link . '</a><br/>' . 'Feed: <a href="' . $rss_link . '">' . $rss_link . '</a>' . '</p>' . '<p class="description">' . nl2br($notes) . '</p>' . '</li>'; } }
/** * Display page content * * @access public */ public function display_content() { if (VGet::cat()) { $add = $this->_menu[VGet::cat()]; } else { $add = null; } Html::header_videos($add); if (!empty($this->_content)) { Html::html5('o', 'id="videos">'); if (!VSession::html5()) { echo '<ul>'; } foreach ($this->_content as $video) { Html::video($video->_name, $video->_author_publicname, $video->_permalink, $video->_embed_code, nl2br($video->_description), $video->_date); } if (!VSession::html5()) { echo '</ul>'; } Html::html5('c'); } else { if (!VSession::html5()) { echo '<ul>'; } Html::no_content('There\'s no videos right now.'); if (!VSession::html5()) { echo '</ul>'; } } }