public function beforeValidate() { if ($this->isNewRecord) { $this->password = md5($this->salt . $this->password); $this->created_at = time(); } if (empty($this->activation_key)) { $this->activation_key = md5(microtime()) . rand(10, 100); } return parent::beforeValidate(); }
public function beforeValidate() { if (is_array($this->languages)) { $this->languages = implode(',', $this->languages); } parent::beforeValidate(); return true; }
public function beforeValidate() { if (is_array($this->languages)) { $this->languages = implode(',', $this->languages); } if ($this->tryGravatar && 0) { $email = $this->user->email; $url = "http://www.gravatar.com/avatar/" . md5(strtolower(trim($email))) . "?s=190&d=404"; $url = parse_url($url); $errno = ''; $errstr = ''; if (FALSE !== ($f = @fsockopen($url['hostname'], '80', $errno, $errstr, 30))) { $out = "GET {$url['path']}?{$url['query']} HTTP/1.1\r\n"; $out .= "Host: {$url['hostname']}\r\n"; $out .= "Connection: close\r\n\r\n"; @fwrite($f, $out); } } parent::beforeValidate(); return true; }