public static function loadBySecure($secure, $type) { $db = new Util\Data(); $db->buildQuery('select', self::getList()); $db->buildQuery('from', 'core_user_security user_security'); $db->buildQuery('where', ['secure = ?', $secure]); $user = self::map($db); if (isset($user)) { if ($type == Model::CONFIRM) { $user->getUser()->setStatus(1); $user->getUser()->save(); self::deleteSecure($user->getUserId(), $type); } else { if ($type == Model::RESET) { self::deleteSecure($user->getUserId(), $type); } else { if ($type == Model::REMEMBER) { $expire = time() + 60 * 60 * 24 * 7; // 7 days setcookie('signedUser', $secure, $expire, '/', Util\Nav::removePort(\Rebond\Config::getPath('siteUrl'))); } } } return $user->getUser(); } return null; }
public static function signOut(\Rebond\Core\User\Model $user) { Data::deleteSecure($user->getId()); setcookie('signedUser', '', time() - 3600, '/', Util\Nav::removePort(\Rebond\Config::getPath('siteUrl'))); session_destroy(); session_write_close(); header('Location: /'); exit; }