当前位置: 首页>>代码示例>>PHP>>正文


PHP Contacts::getByEmail方法代码示例

本文整理汇总了PHP中Contacts::getByEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Contacts::getByEmail方法的具体用法?PHP Contacts::getByEmail怎么用?PHP Contacts::getByEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Contacts的用法示例。


在下文中一共展示了Contacts::getByEmail方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendQueuedEmails

 static function sendQueuedEmails()
 {
     $date = DateTimeValueLib::now();
     $date->add("d", -2);
     $emails = QueuedEmails::getQueuedEmails($date);
     if (count($emails) <= 0) {
         return 0;
     }
     Env::useLibrary('swift');
     $mailer = self::getMailer();
     if (!$mailer instanceof Swift_Mailer) {
         throw new NotifierConnectionError();
     }
     // if
     $fromSMTP = config_option("mail_transport", self::MAIL_TRANSPORT_MAIL) == self::MAIL_TRANSPORT_SMTP && config_option("smtp_authenticate", false);
     $count = 0;
     foreach ($emails as $email) {
         try {
             $body = $email->getBody();
             $subject = $email->getSubject();
             Hook::fire('notifier_email_body', $body, $body);
             Hook::fire('notifier_email_subject', $subject, $subject);
             if ($fromSMTP && config_option("smtp_address")) {
                 $pos = strrpos($email->getFrom(), "<");
                 if ($pos !== false) {
                     $sender_name = trim(substr($email->getFrom(), 0, $pos));
                 } else {
                     $sender_name = "";
                 }
                 $from = array(config_option("smtp_address") => $sender_name);
             } else {
                 $pos = strrpos($email->getFrom(), "<");
                 if ($pos !== false) {
                     $sender_name = trim(substr($email->getFrom(), 0, $pos));
                     $sender_address = str_replace(array("<", ">"), array("", ""), trim(substr($email->getFrom(), $pos, strlen($email->getFrom()) - 1)));
                 } else {
                     $sender_name = "";
                     $sender_address = $email->getFrom();
                 }
                 $from = array($sender_address => $sender_name);
             }
             $message = Swift_Message::newInstance($subject)->setFrom($from)->setBody($body)->setContentType('text/html');
             if ($email->columnExists('attachments')) {
                 $attachments = json_decode($email->getColumnValue('attachments'));
                 foreach ($attachments as $a) {
                     // if file does not exists or its size is greater than 20 MB then don't process the atachments
                     if (!file_exists($a->path) || filesize($a->path) / (1024 * 1024) > 20) {
                         continue;
                     }
                     $attach = Swift_Attachment::fromPath($a->path, $a->type);
                     $attach->setDisposition($a->disposition);
                     if ($a->cid) {
                         $attach->setId($a->cid);
                     }
                     if ($a->name) {
                         $attach->setFilename($a->name);
                     }
                     $message->attach($attach);
                 }
             }
             $to = prepare_email_addresses(implode(",", explode(";", $email->getTo())));
             foreach ($to as $address) {
                 $message->addTo(array_var($address, 0), array_var($address, 1));
             }
             $cc = prepare_email_addresses(implode(",", explode(";", $email->getCc())));
             foreach ($cc as $address) {
                 $message->addCc(array_var($address, 0), array_var($address, 1));
             }
             $bcc = prepare_email_addresses(implode(",", explode(";", $email->getBcc())));
             foreach ($bcc as $address) {
                 $message->addBcc(array_var($address, 0), array_var($address, 1));
             }
             $result = $mailer->send($message);
             if ($result) {
                 DB::beginWork();
                 // save notification history after cron sent the email
                 self::saveNotificationHistory(array('email_object' => $email));
                 // delte from queued_emails
                 $email->delete();
                 DB::commit();
             }
             $count++;
         } catch (Exception $e) {
             DB::rollback();
             // save log in server
             if (defined('EMAIL_ERRORS_LOGDIR') && file_exists(EMAIL_ERRORS_LOGDIR) && is_dir(EMAIL_ERRORS_LOGDIR)) {
                 $err_msg = ROOT_URL . "\nError sending notification (queued_email_id=" . $email->getId() . ") using account " . print_r($from, 1) . "\n\nError detail:\n" . $e->getMessage() . "\n" . $e->getTraceAsString();
                 file_put_contents(EMAIL_ERRORS_LOGDIR . basename(ROOT), $err_msg, FILE_APPEND);
             }
             Logger::log("There has been a problem when sending the Queued emails.\nError Message: " . $e->getMessage() . "\nTrace: " . $e->getTraceAsString());
             $msg = $e->getMessage();
             if (strpos($msg, 'Failed to authenticate') !== false) {
                 $from_k = array_keys($from);
                 $usu = Contacts::getByEmail($from_k[0]);
                 $rem = ObjectReminders::instance()->findOne(array('conditions' => "context='eauthfail " . $from_k[0] . "'"));
                 if (!$rem instanceof ObjectReminder && $usu instanceof Contact) {
                     $reminder = new ObjectReminder();
                     $reminder->setMinutesBefore(0);
                     $reminder->setType("reminder_popup");
                     $reminder->setContext("eauthfail " . $from_k[0]);
//.........这里部分代码省略.........
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:101,代码来源:Notifier.class.php

示例2: getSenderUrl

	function getSenderUrl() {
		$user = Contacts::getByEmail($this->getFrom());
		if ($user instanceof Contact && $user->canSeeUser(logged_user())) {
			return $user->getCardUrl();
		} else {
			$contact = Contacts::getByEmail($this->getFrom());
			if ($contact instanceof Contact && $contact->canView(logged_user())) {
				return $contact->getCardUrl();
			}
		}
		return $this->getViewUrl();
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:12,代码来源:MailContent.class.php

示例3: initLoggedUser

 /**
  * This function will use session ID from session or cookie and if presend log user
  * with that ID. If not it will simply break.
  *
  * When this function uses session ID from cookie the whole process will be treated
  * as new login and users last login time will be set to current time.
  *
  * @access public
  * @param void
  * @return boolean
  */
 private function initLoggedUser()
 {
     //Hack for API Auth & Magic login!
     if (isset($_REQUEST['auth']) && !empty($_REQUEST['auth']) || array_var($_REQUEST, 'm') == "login") {
         if (array_var($_REQUEST, 'm') != "login") {
             $contact = Contacts::findAll(array("conditions" => "`token` = '" . $_REQUEST['auth'] . "'"));
             $contact = $contact[0];
         } else {
             $username = $_REQUEST['username'];
             $password = $_REQUEST['password'];
             if (preg_match(EMAIL_FORMAT, $username)) {
                 $contact = Contacts::getByEmail($username);
             } else {
                 $contact = Contacts::getByUsername($username);
             }
             if ($contact) {
                 if (!$contact->isValidPassword($password)) {
                     die('API Response: Invalid password.');
                 }
             } else {
                 die('API Response: Invalid username.');
             }
         }
         if ($contact instanceof Contact) {
             $this->logUserIn($contact, false);
             if (array_var($_REQUEST, 'm') == "login") {
                 $temp = array('token' => $contact->getToken(), 'username' => $contact->getUsername(), 'user_id' => $contact->getId(), 'company' => owner_company()->getName());
                 echo json_encode($temp);
                 exit;
             }
         } else {
             die('API Response: Invalid authorization code.');
         }
     }
     $user_id = Cookie::getValue('id');
     $twisted_token = Cookie::getValue('token');
     $remember = (bool) Cookie::getValue('remember', false);
     if (empty($user_id) || empty($twisted_token)) {
         return false;
         // we don't have a user
     }
     // if
     $user = Contacts::findById($user_id);
     if (!$user instanceof Contact) {
         return false;
         // failed to find user
     }
     // if
     if (!$user->isValidToken($twisted_token)) {
         return false;
         // failed to validate token
     }
     // if
     $last_act = $user->getLastActivity();
     if ($last_act instanceof DateTimeValue) {
         $session_expires = $last_act->advance(SESSION_LIFETIME, false);
     }
     if (!$last_act instanceof DateTimeValue || $session_expires != null && DateTimeValueLib::now()->getTimestamp() < $session_expires->getTimestamp()) {
         $this->setLoggedUser($user, $remember, true);
     } else {
         $this->logUserIn($user, $remember);
     }
     // if
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:75,代码来源:CompanyWebsite.class.php

示例4: createMinimumUser

 function createMinimumUser($email, $compId)
 {
     $contact = Contacts::getByEmail($email);
     $posArr = strpos_utf($email, '@') === FALSE ? null : strpos($email, '@');
     $user_data = array('username' => $email, 'display_name' => $posArr != null ? substr_utf($email, 0, $posArr) : $email, 'email' => $email, 'contact_id' => isset($contact) ? $contact->getId() : null, 'password_generator' => 'random', 'timezone' => isset($contact) ? $contact->getTimezone() : 0, 'create_contact' => !isset($contact), 'company_id' => $compId, 'send_email_notification' => true);
     // array
     $user = null;
     $user = create_user($user_data, false, '');
     return $user;
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:10,代码来源:ObjectController.class.php

示例5: forgot_password

 /**
  * Render and process forgot password form
  *
  * @param void
  * @return null
  */
 function forgot_password()
 {
     if (isset($_GET['your_email'])) {
         $your_email = trim(array_var($_GET, 'your_email'));
     } else {
         $your_email = trim(array_var($_POST, 'your_email'));
     }
     tpl_assign('your_email', $your_email);
     if (array_var($_REQUEST, 'submited') == 'submited') {
         if (!is_valid_email($your_email)) {
             tpl_assign('error', new InvalidEmailAddressError($your_email, lang('invalid email address')));
             $this->render();
         }
         // if
         $user = Contacts::getByEmail($your_email);
         if (!($user instanceof Contact && $user->isUser()) || $user->getDisabled()) {
             flash_error(lang('email address not in use', $your_email));
             $this->redirectTo('access', 'forgot_password');
         }
         // if
         $token = sha1(gen_id() . (defined('SEED') ? SEED : ''));
         $timestamp = time() + 60 * 60 * 24;
         set_user_config_option('reset_password', $token . ";" . $timestamp, $user->getId());
         try {
             DB::beginWork();
             Notifier::forgotPassword($user, $token);
             flash_success(lang('success forgot password'));
             DB::commit();
         } catch (Exception $e) {
             DB::rollback();
             flash_error(lang('error forgot password'));
         }
         // try
         $this->redirectTo('access', 'forgot_password', array('instructions_sent' => 1));
     }
     // if
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:43,代码来源:AccessController.class.php

示例6: getPersonLinkFromEmailAddress

 private static function getPersonLinkFromEmailAddress($email, $addr_name, $clean = true, $add_contact_link = true)
 {
     $name = $email;
     $url = "";
     $user = Users::getByEmail($email);
     if ($user instanceof User && $user->canSeeUser(logged_user())) {
         $name = $clean ? clean($user->getDisplayName()) : $user->getDisplayName();
         $url = $user->getCardUrl();
     } else {
         $contact = Contacts::getByEmail($email);
         if ($contact instanceof Contact && $contact->canView(logged_user())) {
             $name = $clean ? clean($contact->getDisplayName()) : $contact->getDisplayName();
             $url = $contact->getCardUrl();
         }
     }
     if ($url != "") {
         return '<a class="internalLink" href="' . $url . '" title="' . $email . '">' . $name . " &lt;{$email}&gt;</a>";
     } else {
         if (!(active_project() instanceof Project ? Contact::canAdd(logged_user(), active_project()) : can_manage_contacts(logged_user()))) {
             return $email;
         } else {
             $url = get_url('contact', 'add', array('ce' => $email));
             $to_show = $addr_name == '' ? $email : $addr_name . " &lt;{$email}&gt;";
             return $to_show . ($add_contact_link ? '&nbsp;<a class="internalLink link-ico ico-add" style="padding-left:12px;" href="' . $url . '" title="' . lang('add contact') . '">&nbsp;</a>' : '');
         }
     }
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:27,代码来源:MailUtilities.class.php

示例7: add_mail


//.........这里部分代码省略.........
                                 if (!$email instanceof MailContent) {
                                     flash_error(lang('email dnx'));
                                     $err++;
                                 }
                                 // if
                                 if (!$email->canView(logged_user())) {
                                     flash_error(lang('no access permissions'));
                                     $err++;
                                 }
                                 // if
                                 $attachments[] = array("data" => $email->getContent(), "name" => $email->getSubject() . ".eml", "type" => 'message/rfc822');
                             }
                         }
                     } else {
                         $linked_attachments[] = array("data" => $object->getViewUrl(), "name" => clean($object->getObjectName()), "type" => lang($object->getObjectTypeName()), "manager" => $object->getObjectManagerName(), "id" => $object->getId());
                     }
                 }
             }
             if ($err > 0) {
                 flash_error(lang('some objects could not be linked', $err));
                 ajx_current('empty');
                 return;
             }
         }
         $to = preg_split('/;|,/', $to);
         $to = $utils->parse_to($to);
         if ($body == '') {
             $body .= ' ';
         }
         try {
             if (count($linked_attachments)) {
                 $linked_users = array();
                 foreach ($to as $to_user) {
                     $linked_user = Users::getByEmail($to_user[1]);
                     if (!$linked_user instanceof User) {
                         try {
                             $linked_user = create_user_from_email($to_user[1], $to_user[0]);
                         } catch (Exception $e) {
                             //Logger::log($e->getMessage());
                         }
                     }
                     if ($linked_user instanceof User) {
                         $linked_users[] = $linked_user;
                     }
                 }
                 $linked_atts = $type == 'text/html' ? '<div style="font-family:arial;"><br><br><br><span style="font-size:12pt;font-weight:bold;color:#777">' . lang('linked attachments') . '</span><ul>' : "\n\n\n-----------------------------------------\n" . lang('linked attachments') . "\n\n";
                 foreach ($linked_attachments as $att) {
                     $linked_atts .= $type == 'text/html' ? '<li><a href="' . $att['data'] . '">' . $att['name'] . ' (' . $att['type'] . ')</a></li>' : $att['name'] . ' (' . $att['type'] . '): ' . $att['data'] . "\n";
                     foreach ($linked_users as $linked_user) {
                         try {
                             $linked_user->giveAccessToObject(get_object_by_manager_and_id($att['id'], $att['manager']));
                         } catch (Exception $e) {
                             //Logger::log($e->getMessage());
                         }
                     }
                 }
                 $linked_atts .= $type == 'text/html' ? '</ul></div>' : '';
             } else {
                 $linked_atts = '';
             }
             $body .= $linked_atts;
             if (count($attachments) > 0) {
                 $i = 0;
                 $str = "";
                 /*	foreach ($attachments as $att) {
                 					$str .= "--000000000000000000000000000$i\n";
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:67,代码来源:MailController.class.php

示例8: getPersonLinkFromEmailAddress

 private static function getPersonLinkFromEmailAddress($email, $addr_name, $clean = true, $add_contact_link = true)
 {
     $name = $email;
     $url = "";
     if (trim($email) == "") {
         return "";
     }
     if (!is_valid_email($email)) {
         return $email;
     }
     $contact = Contacts::getByEmail($email);
     if ($contact instanceof Contact && $contact->canView(logged_user())) {
         $name = $clean ? clean($contact->getObjectName()) : $contact->getObjectName();
         $url = $contact->getCardUrl();
     }
     if ($url != "") {
         return '<a class="internalLink" href="' . $url . '" title="' . $email . '">' . $name . " &lt;{$email}&gt;</a>";
     } else {
         $null = null;
         if (!Contact::canAdd(logged_user(), active_context(), $null)) {
             return $email;
         } else {
             if (trim($email) == "") {
                 return "";
             }
             $url = get_url('contact', 'add', array('ce' => $email));
             $to_show = $addr_name == '' ? $email : $addr_name . " &lt;{$email}&gt;";
             return $to_show . ($add_contact_link ? '&nbsp;<a class="internalLink link-ico ico-add" style="padding-left:12px;" href="' . $url . '" title="' . lang('add contact') . '">&nbsp;</a>' : '');
         }
     }
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:31,代码来源:MailUtilities.class.php

示例9: create_user


//.........这里部分代码省略.........
			}
			
		}
		
	}
	if(!isset($_POST['sys_perm'])){
		$rol_permissions=SystemPermissions::getRolePermissions(array_var($user_data, 'type'));
		$_POST['sys_perm']=array();
		foreach($rol_permissions as $pr){
			$_POST['sys_perm'][$pr]=1;
		}
		
	}
	if(!isset($_POST['mod_perm'])){
		$tabs_permissions=TabPanelPermissions::getRoleModules(array_var($user_data, 'type'));
		$_POST['mod_perm']=array();
		foreach($tabs_permissions as $pr){
			$_POST['mod_perm'][$pr]=1;
		}
	}
        
    $password = '';
	if (array_var($user_data, 'password_generator') == 'specify') {
		$perform_password_validation = true;
		// Validate input
		$password = array_var($user_data, 'password');
		if (trim($password) == '') {
			throw new Error(lang('password value required'));
		} // if
		if ($password <> array_var($user_data, 'password_a')) {
			throw new Error(lang('passwords dont match'));
		} // if
	} else {
		$user_data['password_generator'] = 'link';
		$perform_password_validation = false;
	}

	$contact->setPassword($password);   
	$contact->save();

	$user_password = new ContactPassword();
	$user_password->setContactId($contact->getId());
	$user_password->setPasswordDate(DateTimeValueLib::now());
	$user_password->setPassword(cp_encrypt($password, $user_password->getPasswordDate()->getTimestamp()));
	$user_password->password_temp = $password;
	$user_password->perform_validation = $perform_password_validation;
	$user_password->save();
        
	if (array_var($user_data, 'autodetect_time_zone', 1) == 1) {
		set_user_config_option('autodetect_time_zone', 1, $contact->getId());
	}
	
	/* create contact for this user*/

	ApplicationLogs::createLog($contact, ApplicationLogs::ACTION_ADD);

	// Set role permissions for active members
	$active_context = active_context();
	$sel_members = array();
	foreach ($active_context as $selection) {
		if ($selection instanceof Member) {
			$sel_members[] = $selection;
			$has_project_permissions = ContactMemberPermissions::instance()->count("permission_group_id = '".$contact->getPermissionGroupId()."' AND member_id = ".$selection->getId()) > 0;
			if (!$has_project_permissions) {
				RoleObjectTypePermissions::createDefaultUserPermissions($contact, $selection);
			}
		}
	}
	save_permissions($contact->getPermissionGroupId(), $contact->isGuest());
	
	Hook::fire('after_user_add', $contact, $null);
	
	// add user content object to associated members
	if (count($sel_members) > 0) {
		ObjectMembers::addObjectToMembers($contact->getId(), $sel_members);
		$contact->addToSharingTable();
	}
	
	// Send notification
	try {
		if (array_var($user_data, 'send_email_notification') && $contact->getEmailAddress()) {
                    
			if (array_var($user_data, 'password_generator', 'link') == 'link') {
				// Generate link password
				$user = Contacts::getByEmail(array_var($user_data, 'email'));
				$token = sha1(gen_id() . (defined('SEED') ? SEED : ''));
				$timestamp = time() + 60*60*24;
				set_user_config_option('reset_password', $token . ";" . $timestamp, $user->getId());
				Notifier::newUserAccountLinkPassword($contact, $password, $token);

			} else {
				Notifier::newUserAccount($contact, $password);
			}
			
		}
	} catch(Exception $e) {
		Logger::log($e->getTraceAsString());
	} // try
	return $contact;
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:functions.php

示例10: create_user

function create_user($user_data, $permissionsString)
{
    $user = new User();
    $user->setUsername(array_var($user_data, 'username'));
    $user->setDisplayName(array_var($user_data, 'display_name'));
    $user->setEmail(array_var($user_data, 'email'));
    $user->setCompanyId(array_var($user_data, 'company_id'));
    $user->setType(array_var($user_data, 'type'));
    $user->setTimezone(array_var($user_data, 'timezone'));
    if (!logged_user() instanceof User || can_manage_security(logged_user())) {
        $user->setCanEditCompanyData(array_var($user_data, 'can_edit_company_data'));
        $user->setCanManageSecurity(array_var($user_data, 'can_manage_security'));
        $user->setCanManageWorkspaces(array_var($user_data, 'can_manage_workspaces'));
        $user->setCanManageConfiguration(array_var($user_data, 'can_manage_configuration'));
        $user->setCanManageContacts(array_var($user_data, 'can_manage_contacts'));
        $user->setCanManageTemplates(array_var($user_data, 'can_manage_templates'));
        $user->setCanManageReports(array_var($user_data, 'can_manage_reports'));
        $user->setCanManageTime(array_var($user_data, 'can_manage_time'));
        $user->setCanAddMailAccounts(array_var($user_data, 'can_add_mail_accounts'));
        $other_permissions = array();
        Hook::fire('add_user_permissions', $user, $other_permissions);
        foreach ($other_permissions as $k => $v) {
            $user->setColumnValue($k, array_var($user_data, $k));
        }
    }
    if (array_var($user_data, 'password_generator', 'random') == 'random') {
        // Generate random password
        $password = UserPasswords::generateRandomPassword();
    } else {
        // Validate input
        $password = array_var($user_data, 'password');
        if (trim($password) == '') {
            throw new Error(lang('password value required'));
        }
        // if
        if ($password != array_var($user_data, 'password_a')) {
            throw new Error(lang('passwords dont match'));
        }
        // if
    }
    // if
    $user->setPassword($password);
    $user->save();
    $user_password = new UserPassword();
    $user_password->setUserId($user->getId());
    $user_password->setPasswordDate(DateTimeValueLib::now());
    $user_password->setPassword(cp_encrypt($password, $user_password->getPasswordDate()->getTimestamp()));
    $user_password->password_temp = $password;
    $user_password->save();
    if (array_var($user_data, 'autodetect_time_zone', 1) == 1) {
        set_user_config_option('autodetect_time_zone', 1, $user->getId());
    }
    if ($user->getType() == 'admin') {
        if ($user->getCompanyId() != owner_company()->getId() || logged_user() instanceof User && !can_manage_security(logged_user())) {
            // external users can't be admins or logged user has no rights to create admins => set as Normal
            $user->setType('normal');
        } else {
            $user->setAsAdministrator(true);
        }
    }
    /* create contact for this user*/
    if (array_var($user_data, 'create_contact', 1)) {
        // if contact with same email exists take it, else create new
        $contact = Contacts::getByEmail($user->getEmail(), true);
        if (!$contact instanceof Contact) {
            $contact = new Contact();
            $contact->setEmail($user->getEmail());
        } else {
            if ($contact->isTrashed()) {
                $contact->untrash();
            }
        }
        $contact->setFirstname($user->getDisplayName());
        $contact->setUserId($user->getId());
        $contact->setTimezone($user->getTimezone());
        $contact->setCompanyId($user->getCompanyId());
        $contact->save();
    } else {
        $contact_id = array_var($user_data, 'contact_id');
        $contact = Contacts::findById($contact_id);
        if ($contact instanceof Contact) {
            // user created from a contact
            $contact->setUserId($user->getId());
            $contact->save();
        } else {
            // if contact with same email exists use it as user's contact, without changing it
            $contact = Contacts::getByEmail($user->getEmail(), true);
            if ($contact instanceof Contact) {
                $contact->setUserId($user->getId());
                if ($contact->isTrashed()) {
                    $contact->untrash();
                }
                $contact->save();
            }
        }
    }
    $contact = $user->getContact();
    if ($contact instanceof Contact) {
        // update contact data with data entered for this user
        $contact->setCompanyId($user->getCompanyId());
//.........这里部分代码省略.........
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:101,代码来源:functions.php

示例11: send_notification

function send_notification($user_data, $contact_id)
{
    $contact = Contacts::findById($contact_id);
    //$contact->getId()
    $password = '';
    // Send notification
    try {
        if (array_var($user_data, 'send_email_notification') && $contact->getEmailAddress()) {
            if (array_var($user_data, 'password_generator', 'link') == 'link') {
                // Generate link password
                $user = Contacts::getByEmail(array_var($user_data, 'email'));
                $token = sha1(gen_id() . (defined('SEED') ? SEED : ''));
                $timestamp = time() + 60 * 60 * 24;
                set_user_config_option('reset_password', $token . ";" . $timestamp, $user->getId());
                Notifier::newUserAccountLinkPassword($contact, $password, $token);
            } else {
                $password = array_var($user_data, 'password');
                Notifier::newUserAccount($contact, $password);
            }
        }
    } catch (Exception $e) {
        Logger::log($e->getTraceAsString());
    }
    // try
}
开发者ID:abhinay100,项目名称:feng_app,代码行数:25,代码来源:functions.php


注:本文中的Contacts::getByEmail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。