public static function getInstance() { if (!isset(self::$instance)) { $class = __CLASS__; self::$instance = new $class(); } return self::$instance; }
public function doAuthentication($request) { $objUsersDO = new UsersDO(); $objUsersDO->setUsername($request['username']); $objUsersDO->setPassword($this->hashPassword($request['password'], $request['username'])); $objUsersDAOFactory = UsersDAOFactory::getInstance()->createDAO(); if ($username = $objUsersDAOFactory->doAuthentication($objUsersDO)) { $connection = Crypto::encrypt(implode("|Z|1|Z|", array($username, time())), _Key_New); $this->setAuthenticated($connection); return true; } else { return false; } }