/** * Форма фхода в админку * @access protected */ public function admin() { $args = request::get(array('user', 'secret')); $data = array('LC' => LC::get()); try { if (!empty($args)) { authenticate::login(); } } catch (Exception $e) { dbg::write($e->getMessage(), LOG_PATH . 'adm_access.log'); $data['errors'] = $e->getMessage(); } if (!authenticate::is_logged()) { $tmpl = new tmpl($this->pwd() . 'login.html'); response::send($tmpl->parse($data), 'html'); } else { response::redirect('/xxx/'); } }
<?php // NOTE: Инициализация базовой части CMS define('AUTH_MODE', 'public'); define('AUTH_DI', 'user'); include_once 'base.php'; $args = request::get(array('user', 'secret')); try { if (!empty($args)) { authenticate::login(); } } catch (Exception $e) { dbg::write($e->getMessage(), LOG_PATH . 'access.log'); $data['errors'] = $e->getMessage(); } try { if (authenticate::is_logged() && request::get('logout') == 'yes') { authenticate::logout(); } } catch (Exception $e) { }
<?php /** * The data interface initialization code * * @author Litvinenko S. Anthon <*****@*****.**> * @version 2.0 * @access public * @package SBIN Diesel */ try { // NOTE: If defined authentication data interface and user not logged in /* 9* старый вариант не рубил отдачу файлов по сслке /files/?id=6 например в случае если юзер не залогинен и вот потому дополнительно условие если аутх мое публик то на pub_ не будем руибить доступ ибо это публик по дефолту if (defined('AUTH_DI') && !authenticate::is_logged()) */ if (defined('AUTH_DI') && !authenticate::is_logged() && AUTH_MODE != 'public') { // Then send error response::send('Session closed. Authorization needed.', 'error'); } $di = data_interface::get_instance(request::get('di')); // If return FALSE then access denied if (!$di->call(request::get('cll'), request::get())) { response::send('Access denied.', 'error'); } } catch (Exception $e) { dbg::write("UID: " . UID . "\nREQUEST_URI: {$_SERVER['REQUEST_URI']}\n" . $e->getMessage() . "\n" . $e->getTraceAsString(), LOG_PATH . 'di_errors.log'); response::send('Error while process request.', 'error'); }
<?php /** * The user interface initialization code * * @author Litvinenko S. Anthon <*****@*****.**> * @version 2.0 * @access public * @package CFsCMS2(PE) */ try { // NOTE: If defined authentication data interface and user not logged in if (defined('AUTH_DI') && !authenticate::is_logged()) { // Then redicrect to login form response::redirect('login/'); } // Call user interface $ui = user_interface::get_instance(request::get('ui', UI_DEFAULT)); if (($content = $ui->call(request::get('cll', UI_CLL_DEFAULT), request::get())) === FALSE) { response::header('404'); } else { response::send($content, 'html'); } } catch (Exception $e) { dbg::write($e->getMessage() . "\n" . $e->getTraceAsString(), LOG_PATH . 'ui_errors.log'); response::header('404'); }