X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=DataObjects%2FCore_person_signup.php;h=4209c60ad1fc25c27edf6db1d2db67ea224496c4;hb=12edfd30b506449e74c304ba1933300b3bebdbd7;hp=588838e9edc0d53840dc857023ef8bbbe88b089a;hpb=4b7e60e4b00639f2a4032acf51e0e81ac57f8388;p=Pman.Core diff --git a/DataObjects/Core_person_signup.php b/DataObjects/Core_person_signup.php index 588838e9..4209c60a 100644 --- a/DataObjects/Core_person_signup.php +++ b/DataObjects/Core_person_signup.php @@ -1,26 +1,10 @@ -CREATE TABLE core_person_signup ( - id int(11) NOT NULL auto_increment, - PRIMARY KEY (id) -) ; - - -ALTER TABLE core_person_signup ADD COLUMN name varchar(128) NOT NULL DEFAULT ''; -ALTER TABLE core_person_signup ADD COLUMN honor varchar(32) NOT NULL DEFAULT ''; -ALTER TABLE core_person_signup ADD COLUMN firstname varchar(128) NOT NULL DEFAULT ''; -ALTER TABLE core_person_signup ADD COLUMN lastname varchar(128) NOT NULL DEFAULT ''; -ALTER TABLE core_person_signup ADD COLUMN firstname_alt varchar(128) NOT NULL DEFAULT ''; -ALTER TABLE core_person_signup ADD COLUMN lastname_alt varchar(128) NOT NULL DEFAULT ''; - -ALTER TABLE core_person_signup ADD COLUMN email varchar(256) NOT NULL DEFAULT ''; -ALTER TABLE core_person_signup ADD COLUMN verify_key varchar(256) NOT NULL DEFAULT ''; -ALTER TABLE core_person_signup ADD COLUMN created_dt DATETIME NOT NULL; 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) + { + $group = DB_DataObject::factory('groups'); + if($group->get('name', 'Administrators')){ + $member = DB_DataObject::factory('group_members'); + $member->group_id = $group->id; + $mids = $member->fetchAll('user_id'); + + $p = DB_DataObject::factory('Person'); + $p->whereAddIn('id', $mids, 'int'); + $admin = $p->fetchAll('email'); + } + + if(empty($admin)){ + $this->jerr("Please contact our administrators - system setting proble"); + } + + $content = array( + 'template' => $template, + 'person' => $this, + 'bcc' => implode(',', $admin), + '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 . '>'; + } } - \ No newline at end of file