function session_currentSession() { static $session; if (!$session) { $session = Application::session(); } return $session; }
protected function page_load() { $session = Application::session(); if (isset($session->forms['AccountCreate'])) { $this->form = $session->forms['AccountCreate']['form']; $this->messages = $session->forms['AccountCreate']['messages']; unset($session->forms['AccountCreate']); } }
function user_currentUser() { static $user; if (!$user) { $session = Application::session(); if (!empty($session->id)) { $user = new User(); $user->initWithPrimaryKey($session->id); if (empty($user->id)) { $user = null; } } else { $user = null; } } return $user; }
protected function page_load() { if ($this->isPostBack) { if (isset($_POST['AccountModify'])) { new AccountModify(); } } $session = Application::session(); $this->user = Application::current_user(); if (isset($session->forms['AccountModify'])) { $this->messages = $session->forms['AccountModify']['messages']; unset($session->forms['AccountModify']); } if (!$this->user) { header('location:/account/logout'); } }
<?php require $_SERVER['DOCUMENT_ROOT'] . '/application/system/Environment.php'; require $_SERVER['DOCUMENT_ROOT'] . '/application/forms/custom/AccountModify.php'; if (Application::session()->isAuthenticated) { new AccountModify(); } else { header('location:/'); }
public function getFlashMessage($default = "") { $message = Application::session()->get('hflash'); Application::session()->remove('hflash'); Application::session()->remove('hcode'); return $message ? $message : $default; }