/** * Get logged user permissions. * * @static * @access public * @return array * @since 1.0.0, 2015-01-10 * @version 1.0.0, 2015-01-10 */ public static function getPerms() { if (static::$aPermissions === NULL) { static::$aPermissions = Session::get('permissions'); } return static::$aPermissions; }
/** * ACTION - User logout. * * @access public * @return View * @since 1.0.2, 2013-12-07 * @version 1.0.3, 2013-12-23 */ public function actionLogout() { $this->setTitle(__('Logout')); if (Session::get('uid') === NULL) { Route::factory('home')->redirectTo(); } Session::destroy(); return View::factory('user/frontend/logout'); }
/** * Get currently logged user. * * @static * @access public * @return User * @since 2.0.2, 2013-12-25 * @version 2.1.2-dev */ public static function getLoggedUser() { if (static::$loggedUser === NULL && Session::get('uid') !== NULL) { static::$loggedUser = DB::find('\\Model\\User', Session::get('uid')); } return static::$loggedUser; }
<?php /* @version 1.0.1, 2014-11-27 */ /* @var $oUser \Model\User */ ?> <?php if (\Plethora\Router::getParam('id') == \Plethora\Session::get('uid')) { ?> <p style="text-align: center;"> <a href="<?php echo \Plethora\Route::factory('user_profile_edit')->url(); ?> " title="<?php echo __('Edit profile'); ?> "> [ <?php echo __('Edit profile'); ?> ] </a> </p> <?php } ?> <div class="user_profile"> <table> <tbody> <tr>
/** * Get data about failed login operations from cache. * * @static * @access private * @return integer * @since 2.1.2-dev * @version 2.1.2-dev */ public static function getCachedData() { $ip = Session::get('ip'); $cacheData = Cache::get($ip, static::$cacheName); return $cacheData; }
<?php /** * @author Krzysztof Trzos * @package base * @subpackage views * @since 1.0.0-alpha * @version 1.0.0-alpha */ ?> <?php $sFlash = \Plethora\Session::get('flash'); ?> <?php if (!is_null($sFlash)) { ?> <?php $aUnserializedFlash = unserialize($sFlash); ?> <div class="alert alert-<?php echo $aUnserializedFlash['type']; ?> "> <p><?php echo $aUnserializedFlash['content']; ?> </p> </div>
/** * Constructor. * * @access public * @since 1.0.0-alpha * @version 1.0.0-alpha */ public function __construct() { // renew logged user permissions (only for those users, which already have some permissions) if (!is_null(Session::get('uid')) && !is_null(Session::get('perm'))) { \UserPermissions::reset(); } // set default page title and description (based on app config "base") $this->setTitle(Config::get('base.app_name')); $this->setDescription(Config::get('base.app_description')); $this->setBodyBasicClasses(); // initalize basic views $this->oViewMain = View::factory($this->sViewMain); $this->oViewBody = View::factory($this->sViewBody); $this->oViewBodyContent = View::factory($this->sViewBodyContent); $this->oViewBodyFooter = View::factory($this->sViewBodyFooter); $this->oViewBodyHeader = View::factory($this->sViewBodyHeader); $this->oViewHead = View::factory($this->sViewHead); $this->oView = View::factory($this->sView); $this->oViewBreadcrumbs = View::factory($this->sViewBreadcrumbs); $this->oViewSystemMessages = View::factory($this->sViewSystemMessages); // relate views with each other $this->oViewMain->bind('oHead', $this->oViewHead); $this->oViewMain->bind('oBody', $this->oViewBody); $this->oViewMain->bind('sBodyClasses', $this->sBodyClasses); $this->oViewBody->bind('sTitle', $this->sTitle); $this->oViewBody->bind('oHeader', $this->oViewBodyHeader); $this->oViewBody->bind('oContent', $this->oViewBodyContent); $this->oViewBody->bind('oFooter', $this->oViewBodyFooter); $this->oViewBodyContent->bind('oContent', $this->oView); $this->oViewBodyContent->bind('oController', $this); $this->oViewBodyContent->bind('oBreadcrumbs', $this->oViewBreadcrumbs); $this->oViewBodyContent->bind('oSystemMessages', $this->oViewSystemMessages); $this->oViewBreadcrumbs->bind('aBreadcrumbs', $this->aBreadcrumbs); $this->oViewSystemMessages->bind('aSystemMessages', $this->aSystemMessages); $this->oViewHead->bind('sTitle', $this->sTitle); $this->oViewHead->bind('aCss', $this->css); $this->oViewHead->bind('aJs', $this->js); $this->oViewHead->bind('aMeta', $this->aMeta); // set default meta $this->findDefaultMeta(); // Create log about Controller initalization Log::insert('Main controller class initialized!'); }
/** * Get (generate) token for this form. * * @access public * @return string * @since 1.0.0-alpha * @version 1.0.0-alpha */ public function getFormToken() { $sFormID = $this->getFormID(); $aFormTokens = Session::get('form_tokens'); if (!isset($aFormTokens[$sFormID]) || !is_array($aFormTokens[$sFormID]) || $aFormTokens[$sFormID][1] < time()) { $sToken = base64_encode(openssl_random_pseudo_bytes(16)); $aFormTokens[$sFormID] = [$sToken, time() + 3600]; Session::set('form_tokens', $aFormTokens); } else { $sToken = $aFormTokens[$sFormID][0]; } return $sToken; }