/** * Method to determine pid and sql table of the page * * @access private */ private function pid() { switch (VGet::ctl('posts')) { case 'albums': $this->_pid = 'albums'; $this->_sql_table = 'media'; break; case 'video': $this->_pid = 'video'; $this->_sql_table = 'media'; break; case 'author': $this->_pid = 'author'; $this->_sql_table = 'user'; break; case 'search': $this->_pid = 'search'; $this->_sql_table = 'post'; break; case 'contact': $this->_pid = 'contact'; break; default: $this->_pid = 'posts'; $this->_sql_table = 'post'; break; } }
/** * Display a pagination, for listings controllers * * @static * @access public * @param integer [$p] Current page * @param integer [$max] Maximum pages available * @param string [$link] Additional GET parameter, if in a search * @param string [$text] Text to display after older/newest */ public static function pagination($p, $max, $link, $text) { echo '<nav id="pagination">'; if ($p < $max) { echo '<a class="a_button" href="index.php?ns=' . VGet::ns() . '&ctl=' . VGet::ctl('manage') . $link . '&p=' . ($p + 1) . '">Older ' . $text . '</a>'; } if ($p > 1) { echo '<a class="a_button" href="index.php?ns=' . VGet::ns() . '&ctl=' . VGet::ctl('manage') . $link . '&p=' . ($p - 1) . '">Newest ' . $text . '</a>'; } echo '</nav>'; }
use Library\Variable\Get as VGet; use Exception; define('PATH', ''); define('ADMIN', 'admin/'); define('INC', 'includes/'); try { require_once INC . 'class.install.inc.php'; //If the config file doesn't exist or the database install is not made, redirect to install.php if (!file_exists('config.php') || file_exists('config.php') && !\Install\Install::check_installed()) { header('Location: install.php'); } require_once 'config.php'; require_once INC . 'class.loader.inc.php'; Loader::load(); $controller = '\\Site\\' . ucfirst(VGet::ctl('defaultpage')); //forbidden classes if ($controller::CONTROLLER === false) { throw new Exception('Unknown controllers'); } new Session(); $page = new $controller(); $cache = new Cache(); if ($cache->_exist === false) { $cache->build('s'); $title = $page->_title; $menu = $page->_menu; require_once Html::header(); $page->display_content(); require_once Html::footer(); $cache->build('e');
/** * Build cache * * Exceptions of the exist method continue here * So cache generation is stopped if its not a landing page or * when we are on an album comments page and also when a form * has been submitted * * @access public * @param string [$action] Can be "s" or "e" (meaning start or end) */ public function build($action) { if (self::ACTIVATED === false) { return false; } if ((!empty($this->_post) || count($this->_get) > 1) && !in_array(VGet::ctl(), array('search', 'albums'))) { return true; } elseif (VGet::ctl() == 'albums' && VGet::comments()) { return true; } if ($action == 's') { ob_start(); } elseif ($action == 'e') { $content = ob_get_contents(); ob_end_flush(); $cache = new File(); $cache->_content = $content; $cache->save($this->_url); } else { throw new Exception('Unknown cache command'); } }
* * This file is part of Lynxpress. * * Lynxpress is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Lynxpress is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Lynxpress. If not, see http://www.gnu.org/licenses/. */ require_once 'needed.php'; use Library\Variable\Get as VGet; try { $controller = '\\Admin\\' . ucfirst(VGet::ns('timeline')) . '\\' . ucfirst(VGet::ctl('manage')); $page = new $controller(); if ($page->html === true) { require_once INC . 'html/header.php'; } $page->display_content(); if ($page->html === true) { require_once INC . 'html/footer.html'; } } catch (Exception $e) { die('<h1>' . $e->getMessage() . '</h1>'); }
/** * Check if current controller can display an archive list * * @static * @access public * @return boolean */ public static function check_pub_dates() { if (in_array(VGet::ctl(), array('posts', 'search'))) { return true; } else { return false; } }