public static function render($templateName, $pageVars) { extract($pageVars, EXTR_OVERWRITE); $showMenu = \Auth::isAuthorized(); include BASE_PATH . 'tpls/header.phtml'; include BASE_PATH . 'tpls/' . $templateName . '.phtml'; include BASE_PATH . 'tpls/footer.phtml'; }
/** * Show register form for non-authorized or profile if user known */ public function indexAction() { if (!\Auth::isAuthorized()) { $this->show('register', ['saveErrors' => []]); } else { $user = new \Model\User($_SESSION['uid']); $this->show('profile', ['saveErrors' => [], 'user' => $user, 'saved' => false]); } }
/** * This function init the session and checks user authentification * * @param boolean $ensureAuthentified If user authentication has to be checked * @return array session and user * @throws RestException */ private function initSession($ensureAuthentified) { if ($ensureAuthentified) { if (!Auth::user() || !Auth::isAuthorized()) { throw new RestException("User not connected", 401); } $this->user = Auth::user()->email; } }
/** * class constructor * * @param string */ public function __construct($title = '', $skipAuth = false) { parent::__construct($title); $config = new Config(); $this->_skipAuth = $skipAuth; if (!$skipAuth) { $auth = new Auth(); $this->_auth = $auth; } // Only allow reset to authenticated users and only if the config allows it. $this->_resetOk = $config->getResetOk() && ($skipAuth || $auth->isAuthorized()); $header = <<<HTML <link rel="stylesheet" href="css/main.css" /> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" /> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <script> \$( function() { \$( ".datepicker" ).datepicker( { dateFormat: 'yy-mm-dd' } ); } ) ; </script> <script src="js/common.js"></script> <script src="js/ajaxApplicationStatus.js"></script> <script src="js/ajaxCompany.js"></script> <script src="js/ajaxContact.js"></script> <script src="js/oldValidation.js"></script> HTML; $this->setHead($header); $this->setMeta(array("Cache-Control: no-cache, must-revalidate", "Expires: Sat, 26 Oct 2013 05:00:00 GMT", 'Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT')); $this->setStyles(''); $this->setTop($this->_getTop()); $this->setBottom('<!-- EndOfPage -->'); if (!$skipAuth && !$auth->isAuthorized()) { $this->setBody($auth->getLoginPage()); $this->displayPage(); exit; } }
* */ require_once 'Libs/autoload.php'; // Be sure to specify these in apply order. The reset script will automatically // reverse the order for safe removal. $controllerNames = array('VersionController', 'AuthTicketController', 'ApplicationStatusController', 'ApplicationStatusSummaryController', 'CompanyController', 'ContactController', 'JobController', 'KeywordController', 'NoteController', 'SearchController', 'JobKeywordMapController'); $controllers = array(); try { $config = new Config(); $page = new PJSWebPage($config->getTitle() . " - Reset DB", true); $body = "<ul>\n"; $dbc = new DBConnection("admin", null, null, null, null, null, 'mysqli', true); if (!$dbc->getCreatedDb()) { // Database exists. Don't allow reset if the user is not logged in. $auth = new Auth(); if (!$auth->isAuthorized()) { throw new Exception("User must be logged in to reset the database!"); } if ("1" !== $config->getResetOk()) { throw new Exception("Reset capability is turned off! See config.xml"); } } $dbh = $dbc->getConnection(); foreach (array_reverse($controllerNames) as $controllerName) { $controller = new $controllerName('write'); $controllers[$controllerName] = $controller; if (method_exists($controller, 'dropTriggers')) { $body .= "<li>Dropping Triggers: {$controllerName}</li>\n"; $controller->dropTriggers(); } }
<?php /* * This file is part of the Notes project. * 2013 - 2015 / RENATER */ ?> <?php if (Auth::isAuthenticated()) { //Connected and allowed if (Auth::isAuthorized()) { ?> <section> <ul class="row"> <?php if (PadConfigComponent::isEtherpadAvailable()) { $padConfig = Config::get('pads'); $instantPad = isset($padConfig['enable_instant_pad']) && $padConfig['enable_instant_pad'] === true; ?> <li class="<?php echo $instantPad ? 'small-12 medium-4 columns' : 'small-12 medium-4 medium-offset-2 columns'; ?> "> <a id='createPadButton' href="#"><span class="createPadButton hidden tip-top" data-tooltip aria-haspopup='true' title="Créer un evenement avec propositions de date en invitant des utilisateurs"</span>Planifier un événement</a> </li>
<?php /* * This file is part of the Notes project. * 2013 - 2015 / RENATER */ $errorMsg = ''; $attributesGot = true; // Get error strings if (!Auth::isAuthorized()) { try { $errorMsg = Lang::tr(Auth::user()->HTTP_SHIB_IDENTITY_PROVIDER == 'urn:mace:cru.fr:federation:sac' ? 'You are connected but CRU accounts are not enabled for users from your organisation for Notes.' : 'Your organisation did not release sufficient information about you in order to use this service.'); } catch (PropertyAccessException $e) { $errorMsg = Lang::tr('Your organisation did not release sufficient information about you in order to use this service.'); $attributesGot = false; } } ?> <article class="alert-box alert radius row"> <p class="centertext"> <?php echo $errorMsg; ?> </p> </article>
public static function isPreview() { if (!isset($_GET['preview']) || $_GET['preview'] != '1') { return false; } $user = \Rebond\App::instance()->user(); if (!Auth::isAuthorized($user, 'admin.preview')) { return false; } return true; }
<script type="text/javascript" src="./js/lang.js"></script> <script type="text/javascript" src="./js/main.js"></script> <!--<script type="text/javascript" src="<?php // echo Config::get('site_url') . '/rest.php/Lang'; ?> ?callback=lang.setTranslations"></script>--> <?php if (is_dir('./utils/')) { foreach (glob('./utils/*.php') as $file) { include_once $file; } } ?> <?php $authorized = Auth::isAuthorized() ? 'true' : 'false'; echo '<script type="text/javascript">notes.connected = ' . $authorized . ';</script>'; $etherpadAvailable = PadConfigComponent::isEtherpadAvailable() ? 'true' : 'false'; echo '<script type="text/javascript">notes.etherpad_available = ' . $etherpadAvailable . ';</script>'; ?> <?php // Initialize the lang length for translation purpose echo '<script type="text/javascript">notes.translationSize = ' . Utilities::getDirectorySize(NOTES_BASE . '/language') . ';</script>';
/** * NotesMenu constructor */ public function __construct() { $this->isAuthenticated = Auth::isAuthenticated(); $this->isAuthorized = Auth::isAuthorized(); $this->allRights = Auth::user() && Auth::user()->email != '' && $this->isAuthenticated && $this->isAuthorized; }