public function __construct() { parent::__construct(); if (!config::item('news_blog', 'news') && uri::segment(1) != 'news') { router::redirect('news/' . utf8::substr(uri::getURI(), 5)); } }
public function __construct() { parent::__construct(); $authID = session::item('auth_id'); $userID = session::item('user_id'); $ipaddress = substr(input::ipaddress(), 0, 15); $useragent = substr(input::useragent(), 0, 255); $user = array(); if ($authID && ($user = $this->getSession($authID, $userID, $ipaddress, $useragent))) { if ($user['active_date'] < date_helper::now() - 60 * $this->timeout) { $this->saveSession($authID, $userID, $ipaddress, $useragent); if (isset($user['user_id']) && $user['user_id']) { $this->saveLastvisit($user['user_id']); } } } else { $cookie = cookie::item('sessdata'); $cookie = $cookie ? @json_decode($cookie, true) : array(); if ($cookie && is_array($cookie)) { $userID = isset($cookie['user_id']) ? $cookie['user_id'] : ''; $email = isset($cookie['email']) ? $cookie['email'] : ''; $passhash = isset($cookie['passhash']) ? $cookie['passhash'] : ''; if ($userID && is_numeric($userID) && $userID > 0) { if ($user = $this->getUser($userID, false, false)) { $newPasshash = $this->generatePasshash($email, $user['password']); if ($user['active'] && $user['verified'] && strcmp($email, $user['email']) == 0 && strcmp($passhash, $newPasshash) == 0) { $authID = $this->saveSession(0, $user['user_id'], $ipaddress, $useragent); $this->saveLastvisit($user['user_id']); } else { $user = array(); } } } } } if (!$user || !isset($user['user_id']) || !$user['user_id'] || !$this->createUserSession($user)) { $userID = 0; if (!$user) { $authID = $this->saveSession(0, $userID, $ipaddress, $useragent); } $this->createGuestSession(); } session::set('auth_id', $authID); session::set('user_id', $userID); // Is the site offline? if (!input::isCP() && !config::item('site_online', 'system') && !session::permission('site_access_offline', 'system') && uri::getURI() != 'site/offline' && uri::segment(1) != 'load') { router::redirect('site/offline'); } elseif (input::isCP() && !session::permission('site_access_cp', 'system') && (uri::getURI() != 'cp' && uri::getURI() != 'cp/users/login' && uri::getURI() != 'cp/users/login/license')) { router::redirect('cp/users/login'); } if (!input::isCP() && $this->isLoggedin() && session::permission('site_access_cp', 'system') && uri::segment(1) != 'load' && input::demo(0, '', session::item('user_id'))) { $this->logout(); view::setInfo('For the purposes of this demo you may not use front end of the site under the administrator account. As such we have now logged you out.<br/>Feel free ' . html_helper::anchor('users/signup', 'register on the site') . ' to test user end functionality or ' . html_helper::anchor('users/login', 'login') . ' using your existing account details if you have one already.'); router::redirect(); } }
public function __construct() { parent::__construct(); if (!config::item('news_active', 'news')) { error::show404(); } elseif (!session::permission('news_access', 'news')) { view::noAccess(); } elseif (config::item('news_blog', 'news') && uri::segment(1) != 'blog') { router::redirect('blog/' . utf8::substr(uri::getURI(), 5)); } loader::model('news/news'); }
public function __construct() { parent::__construct(); if (users_helper::isLoggedin()) { // Does user have permission to access this plugin? if (!session::permission('users_manage', 'users') && uri::getURI() != 'cp/users/login' && uri::getURI() != 'cp/users/login/license' && uri::getURI() != 'cp/users/logout') { view::noAccess(); } view::setCustomParam('section', 'users'); view::setCustomParam('options', config::item('cp_top_nav', 'lists', 'users', 'items')); } view::setTrail('cp/users', __('users', 'system_navigation')); }
<?php echo $button; ?> <?php } ?> </div> </div> </fieldset> <?php echo form_helper::closeForm(array('do_login' => 1)); ?> <?php } elseif (uri::getURI() != 'users/login') { ?> <div class="remote-connect single"> <?php foreach (users_helper::authButtons('login') as $button) { ?> <?php echo $button; ?> <?php } ?> </div> <?php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php echo view::getMetaTitle() ? view::getMetaTitle() . (uri::getURI() != '' ? ' - ' : '') : ''; echo uri::getURI() != '' ? text_helper::entities(config::item('site_title', 'system')) : ''; ?> </title> <?php echo html_helper::style(html_helper::siteURL('load/css/' . session::item('template'))); ?> <?php echo view::getStylesheets(); ?> <?php echo html_helper::script(html_helper::siteURL('load/javascript')); ?> <?php echo view::getJavascripts(); ?> <meta name="description" content="<?php echo view::getMetaDescription(); ?> " /> <meta name="keywords" content="<?php echo view::getMetaKeywords(); ?> " /> <!--[if lt IE 7]> <link rel="stylesheet" type="text/css" media="screen, projection" href="css/pngfix.css">
public function index() { // Get URI vars if (!($location = uri::getURI())) { $this->home(); return; } elseif ($location == 'site/offline') { $this->offline(); return; } // Get page if (!($page = $this->pages_model->getPage($location, 'in_view', array('replace' => true))) || !session::permission('site_access_cp', 'system') && !$page['active']) { error::show404(); } // Set page ID $pageID = $page['page_id']; // Do we have views enabled? if (config::item('page_views', 'pages')) { // Update views counter $this->pages_model->updateViews($pageID); } // Load ratings if (config::item('page_rating', 'pages') == 'stars') { // Load votes model loader::model('comments/votes'); // Get votes $page['user_vote'] = $this->votes_model->getVote('page', $pageID); } elseif (config::item('page_rating', 'pages') == 'likes') { // Load likes model loader::model('comments/likes'); // Get likes $page['user_vote'] = $this->likes_model->getLike('page', $pageID); } // Assign vars view::assign(array('pageID' => $pageID, 'page' => $page)); // Set title view::setTitle($page['data_title']); // Set meta tags view::setMetaDescription($page['data_meta_description']); view::setMetaKeywords($page['data_meta_keywords']); // Do we need to build a trail? if ($page['trail']) { if ($page['parent_id']) { $parents = $this->pages_model->getParents($page['parent_id']); foreach ($parents as $parent) { view::setTrail($parent['location'], $parent['data_title']); } if ($parents) { // Set trail view::setTrail($location, $page['data_title']); } } else { // Set trail view::setTrail($page['location'], $page['data_title']); } } // Do we have a custom file name? if ($page['file_name']) { // Load custom view view::load($page['file_name']); } else { // Load default view view::load('pages/view'); } }