X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=DataObjects%2FCore_person_signup.php;h=a59f67d09c430106d492c9741c341a68911d7ed2;hp=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391;hb=HEAD;hpb=054584a7f916d14885c3fc91900ed18fbfc4f4c9 diff --git a/DataObjects/Core_person_signup.php b/DataObjects/Core_person_signup.php index e69de29b..a59f67d0 100644 --- a/DataObjects/Core_person_signup.php +++ b/DataObjects/Core_person_signup.php @@ -0,0 +1,87 @@ +page; + $old = clone($this); + // this shold not really happen... + if($target->get('email', $this->email)){ + return false; + } + + $target->setFrom($this->toArray()); + + $target->insert(); + + $this->person_id = $target->id; + $this->person_table = $target->tableName(); + $this->update($old); + + if(!empty($this->inviter_id) && method_exists($target, 'createFriend')){ + $target->createFriend($this->inviter_id); + } + + return $target; + } + + function sendVerification($template, $roo) + { + $content = array( + 'template' => $template, + 'person' => $this, + 'serverName' => $_SERVER['SERVER_NAME'], + 'baseURL' => $roo->baseURL + ); + + $sent = DB_DataObject::factory('core_email')->send($content); + + if(!is_object($sent)){ + return true; + } + + return $sent; + } + + function getEmailFrom() + { + if (empty($this->name)) { + return $this->email; + } + return '"' . addslashes($this->name) . '" <' . $this->email . '>'; + } +} +