/** * pass magic method to owner object */ public function __set($name, $value) { if ($this->mix) { $this->mix->{$name} = $value; } else { parent::__set($name, $value); } }
public function __set($name, $value) { switch ($name) { case 'latitude': case 'longitude': $value = sprintf('%01.6lf', $value); break; } return parent::__set($name, $value); }
public function confirmNewPassword($key) { if (!isset($this->profile->new_password) || !isset($this->profile->new_password_ts) || !isset($this->profile->new_password_key)) { return false; } if (time() - $this->profile->new_password_ts > 86400) { return false; } if ($this->profile->new_password_key != $key) { return false; } parent::__set('password', $this->profile->new_password); unset($this->profile->new_password); unset($this->profile->new_password_ts); unset($this->profile->new_password_key); return $this->save(); }
public function confirmNewPassword($key) { //check that valid password reset data is set if (!isset($this->profile->new_password) || !isset($this->profile->new_password_ts) || !isset($this->profile->new_password_key)) { return false; } //check if the password is being confirm winthin a day if (time() - $this->profile->new_password_ts > 86400) { return false; } if ($this->profile->new_password_key != $key) { return false; } //everything is valid, nowupadte the account to use the new password //bypass the local setter as new_password is already an md5 parent::__set('password', $this->profile->new_password); unset($this->profile->new_password); unset($this->profile->new_password_ts); unset($this->profile->new_password_key); //finally, save the updated user record and the updated profile return $this->save(); }