Ejemplo n.º 1
0
 public static function check($token)
 {
     $tokenName = SettingsFactory::getSettingsProperty('session/token_name');
     if (Session::sessionExists($tokenName) && $token === Session::sessionGet($tokenName)) {
         Session::sessionDelete($tokenName);
         return true;
     }
     return false;
 }
Ejemplo n.º 2
0
 public function __construct($user = null)
 {
     $this->databaseController = DatabaseController::getDatabaseInstance();
     $this->sessionName = SettingsFactory::getSettingsProperty(SettingsFactory::$SESSIONNAME_PATH);
     if (!$user) {
         // no arg provided
         if (Session::sessionExists($this->sessionName)) {
             $user = Session::sessionGet($this->sessionName);
             if ($this->find($user)) {
                 $this->isLoggedIn = true;
             }
         }
     } else {
         $this->find($user);
     }
 }
Ejemplo n.º 3
0
function applicationLayout()
{
    $r = getRenderer();
    $form = new Form(array('controller' => 'Company', 'action' => 'show', 'method' => 'get', 'title' => 'getName', 'auto_submit' => array('id')));
    $f = $r->classSelect('Company', array('title' => 'Jump to Client', 'id' => 'client_quicksearch', 'name' => 'id'));
    $form->content = $f;
    $client_search_form = $form->html;
    $bookmark_widget = $r->view('bookmarkWidget', array());
    $hour_widget = $r->view('hourWidget', array());
    if (Session::sessionExists()) {
        $bookmarks = Session::getUser()->getBookmarks();
        $bookmark_list = $r->view('bookmarkTable', $bookmarks);
    } else {
        $bookmark_list = '';
    }
    return array('client_quicksearch' => $client_search_form, 'bookmark' => $bookmark_widget, 'bookmark_list' => $bookmark_list, 'hour_widget' => $hour_widget);
}
Ejemplo n.º 4
0
 private function authenticate()
 {
     $this->auth_type = $this->page->getAuthenticationType();
     if ($this->auth_type == 'public') {
         return true;
     }
     if (!Session::sessionExists()) {
         return false;
     }
     $user_type = Session::getUserType();
     if ($user_type == 'staff') {
         return true;
     }
     if ($this->auth_type == Session::getUserType()) {
         return true;
     }
     return false;
 }