Exemplo n.º 1
0
 public function getAvatarPath()
 {
     $path = parent::getAvatarPath();
     if ($path == null) {
         $path = "default.png";
     }
     return "Uploads/Avatars/" . $path;
 }
Exemplo n.º 2
0
 /**
  * ### Sets a remember token to stay logged in
  *
  * @param User $user
  * @param $hash
  * @throws \Propel\Runtime\Exception\PropelException
  */
 private static function setRememberToken(User $user, $hash)
 {
     $cookie_name = 'remember_token';
     $cookie_time = 3600 * 24 * 30;
     $sha = sha1($hash);
     $remember = $user->getId() . '.' . $sha;
     $hostname = Config::get('app', 'hostname');
     if (filter_var($hostname, FILTER_VALIDATE_IP)) {
         $cookie_host = $hostname;
     } else {
         $cookie_host = '.' . $hostname;
     }
     setcookie($cookie_name, $remember, time() + $cookie_time, '/', $cookie_host);
     $user->setRemember($sha);
     $user->save();
 }