本文整理汇总了PHP中PFUser::setEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP PFUser::setEmail方法的具体用法?PHP PFUser::setEmail怎么用?PHP PFUser::setEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PFUser
的用法示例。
在下文中一共展示了PFUser::setEmail方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateUsers
public function generateUsers()
{
$user_1 = new PFUser();
$user_1->setUserName(self::TEST_USER_1_NAME);
$user_1->setRealName(self::TEST_USER_1_REALNAME);
$user_1->setLdapId(self::TEST_USER_1_LDAPID);
$user_1->setPassword(self::TEST_USER_1_PASS);
$user_1->setStatus(self::TEST_USER_1_STATUS);
$user_1->setEmail(self::TEST_USER_1_EMAIL);
$user_1->setLanguage($GLOBALS['Language']);
$this->user_manager->createAccount($user_1);
$user_1->setLabFeatures(true);
return $this;
}
示例2: sync
/**
* Do all the synchronization between an ldap result and a Tuleap user.
*
* This method returns if it modified the user or not. This is usefull during
* batch process in order to limit computing.
*
* @param PFUser $user User
* @param LDAPResult $lr Ldap result
*
* @return Boolean True if the method modified the user object
*/
public function sync(PFUser $user, LDAPResult $lr)
{
$modified = false;
$ldapEmail = $lr->getEmail();
$realname = ucwords(preg_replace('/^(\\w+).(\\w+)@.*/', '\\1 \\2', $ldapEmail));
if ($realname !== null && $user->getRealName() != substr($realname, 0, 32)) {
$user->setRealName($realname);
$modified = true;
}
if ($ldapEmail !== null && $user->getEmail() != $ldapEmail) {
$user->setEmail($ldapEmail);
$modified = true;
}
return $modified;
}
示例3: process
public function process(Tracker_IDisplayTrackerLayout $layout, Codendi_Request $request, PFUser $current_user)
{
//TODO : check permissions on this action?
$comment_format = $this->artifact->validateCommentFormat($request, 'comment_formatnew');
$this->artifact->setUseArtifactPermissions($request->get('use_artifact_permissions') ? 1 : 0);
$fields_data = $request->get('artifact');
$fields_data['request_method_called'] = 'artifact-update';
$this->artifact->getTracker()->augmentDataFromRequest($fields_data);
unset($fields_data['request_method_called']);
try {
if ($current_user->isAnonymous()) {
$current_user->setEmail($request->get('email'));
}
$this->artifact->createNewChangeset($fields_data, $request->get('artifact_followup_comment'), $current_user, true, $comment_format);
$art_link = $this->artifact->fetchDirectLinkToArtifact();
$GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_tracker_index', 'update_success', array($art_link)), CODENDI_PURIFIER_LIGHT);
$redirect = $this->getRedirectUrlAfterArtifactUpdate($request);
$this->artifact->summonArtifactRedirectors($request, $redirect);
if ($request->isAjax()) {
$this->sendAjaxCardsUpdateInfo($current_user, $this->artifact, $this->form_element_factory);
} elseif ($request->existAndNonEmpty('from_overlay')) {
echo '<script>window.parent.tuleap.cardwall.cardsEditInPlace.validateEdition(' . $this->artifact->getId() . ')</script>';
return;
} else {
$GLOBALS['Response']->redirect($redirect->toUrl());
}
} catch (Tracker_NoChangeException $e) {
if ($request->isAjax()) {
$this->sendAjaxCardsUpdateInfo($current_user, $this->artifact, $this->form_element_factory);
} else {
$GLOBALS['Response']->addFeedback('info', $e->getMessage(), CODENDI_PURIFIER_LIGHT);
$render = new Tracker_Artifact_ReadOnlyRenderer($this->event_manager, $this->artifact, $this->form_element_factory, $layout);
$render->display($request, $current_user);
}
} catch (Tracker_Exception $e) {
if ($request->isAjax()) {
$this->sendAjaxCardsUpdateInfo($current_user, $this->artifact, $this->form_element_factory);
} else {
$GLOBALS['Response']->addFeedback('error', $e->getMessage());
$render = new Tracker_Artifact_ReadOnlyRenderer($this->event_manager, $this->artifact, $this->form_element_factory, $layout);
$render->display($request, $current_user);
}
}
}
示例4: generateUsers
public function generateUsers()
{
echo "Create users\n";
$user = new PFUser();
$user->setUserName(self::USER_RICHARD_NAME);
$user->setPassword(self::USER_RICHARD_PASS);
$user->setEmail(self::USER_RICHARD_NAME . '@localhost.localdomain');
$user->setRealName("Richard Cover");
$user->setLanguage($GLOBALS['Language']);
$this->richard = UserManager::instance()->createAccount($user);
$user = new PFUser();
$user->setUserName(self::USER_ALICE_NAME);
$user->setPassword(self::USER_ALICE_PASS);
$user->setEmail(self::USER_ALICE_NAME . '@localhost.localdomain');
$user->setRealName("Alice Tyrell");
$user->setLanguage($GLOBALS['Language']);
$this->alice = UserManager::instance()->createAccount($user);
return $this;
}
示例5: generateUsers
public function generateUsers()
{
$user_1 = new PFUser();
$user_1->setUserName(self::TEST_USER_1_NAME);
$user_1->setRealName(self::TEST_USER_1_REALNAME);
$user_1->setLdapId(self::TEST_USER_1_LDAPID);
$user_1->setPassword(self::TEST_USER_1_PASS);
$user_1->setStatus(self::TEST_USER_1_STATUS);
$user_1->setEmail(self::TEST_USER_1_EMAIL);
$user_1->setLanguage($GLOBALS['Language']);
$this->user_manager->createAccount($user_1);
$user_1->setLabFeatures(true);
$user_2 = new PFUser();
$user_2->setUserName(self::TEST_USER_2_NAME);
$user_2->setPassword(self::TEST_USER_2_PASS);
$user_2->setStatus(self::TEST_USER_2_STATUS);
$user_2->setEmail(self::TEST_USER_2_EMAIL);
$user_2->setLanguage($GLOBALS['Language']);
$user_2->setAuthorizedKeys('ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHk9 toto@marche');
$this->user_manager->createAccount($user_2);
$user_3 = new PFUser();
$user_3->setUserName(self::TEST_USER_3_NAME);
$user_3->setPassword(self::TEST_USER_3_PASS);
$user_3->setStatus(self::TEST_USER_3_STATUS);
$user_3->setEmail(self::TEST_USER_3_EMAIL);
$user_3->setLanguage($GLOBALS['Language']);
$this->user_manager->createAccount($user_3);
$user_4 = new PFUser();
$user_4->setUserName(self::TEST_USER_4_NAME);
$user_4->setPassword(self::TEST_USER_4_PASS);
$user_4->setStatus(self::TEST_USER_4_STATUS);
$user_4->setEmail(self::TEST_USER_1_EMAIL);
$user_4->setLanguage($GLOBALS['Language']);
$this->user_manager->createAccount($user_4);
return $this;
}
示例6: getMailPreferencesByEmail
/**
* Return users corresponding to email addresses mapped according to their
* preferences.
*
* @deprecated
*
* @param Array $addresses A set of addresses
*
* @return Array of Array of User
*/
public function getMailPreferencesByEmail($addresses)
{
$default = Codendi_Mail_Interface::FORMAT_HTML;
$res = array('html' => array(), 'text' => array());
$um = $this->getUserManager();
foreach ($addresses as $address) {
$users = $um->getAllUsersByEmail($address);
$pref = $default;
if (count($users) > 0) {
foreach ($users as $user) {
$pref_user = $this->getMailPreferencesByUser($user);
$user_status = $user->getStatus();
if ($pref_user != $default && ($user_status == 'A' || $user_status == 'R')) {
$pref = $pref_user;
break;
}
}
} else {
$user = new PFUser(array('user_id' => 0, 'language_id' => $this->getConfig('sys_lang')));
$user->setEmail($address);
}
$res[$pref][] = $user;
}
return $res;
}
示例7: createArtifact
/**
* Add an artefact in the tracker
*
* @param Tracker $tracker The tracker this artifact belongs to
* @param array $fields_data The data of the artifact to create
* @param PFUser $user The user that want to create the artifact
* @param string $email The email if the user is anonymous (null if anonymous)
* @param boolean $send_notification true if a notification must be sent, false otherwise
*
* @return Tracker_Artifact or false if an error occured
*/
public function createArtifact(Tracker $tracker, $fields_data, PFUser $user, $email, $send_notification = true)
{
$formelement_factory = Tracker_FormElementFactory::instance();
$fields_validator = new Tracker_Artifact_Changeset_InitialChangesetFieldsValidator($formelement_factory);
$changeset_creator = new Tracker_Artifact_Changeset_InitialChangesetCreator($fields_validator, $formelement_factory, new Tracker_Artifact_ChangesetDao(), $this, EventManager::instance());
$creator = new Tracker_ArtifactCreator($this, $fields_validator, $changeset_creator);
if ($user->isAnonymous()) {
$user->setEmail($email);
}
$submitted_on = $_SERVER['REQUEST_TIME'];
return $creator->create($tracker, $fields_data, $user, $submitted_on, $send_notification);
}
示例8: sync
/**
* Do all the synchronization between an ldap result and a Codendi user.
*
* This method returns if it modified the user or not. This is usefull during
* batch process in order to limit computing.
*
* @param PFUser $user Codendi user
* @param LDAPResult $lr Ldap result
*
* @return Boolean True if the method modified the user object
*/
public function sync(PFUser $user, LDAPResult $lr)
{
$modified = false;
if ($lr->getCommonName() !== null && $user->getRealName() != substr($lr->getCommonName(), 0, 32)) {
$user->setRealName($this->getCommonName($lr));
$modified = true;
}
if ($lr->getEmail() !== null && $user->getEmail() != $lr->getEmail()) {
$user->setEmail($lr->getEmail());
$modified = true;
}
return $modified;
}
示例9: createAccount
/**
* Create user account based on LDAP info.
*
* @param String $eduid
* @param String $uid
* @param String $cn
* @param String $email
* @return PFUser
*/
function createAccount($eduid, $uid, $cn, $email)
{
if (trim($uid) == '' || trim($eduid) == '') {
return false;
}
$user = new PFUser();
$user->setUserName($this->generateLogin($uid));
$user->setLdapId($eduid);
$user->setRealName($cn);
$user->setEmail($email);
// Generates a pseudo-random password. Its not full secure but its
// better than nothing.
$user->setPassword(md5((string) mt_rand(10000, 999999) . time()));
// Default LDAP
$user->setStatus($this->getLdap()->getLDAPParam('default_user_status'));
$user->setRegisterPurpose('LDAP');
$user->setUnixStatus('S');
$user->setTimezone('GMT');
$user->setLanguageID($GLOBALS['Language']->getText('conf', 'language_id'));
$um = $this->getUserManager();
$u = $um->createAccount($user);
if ($u) {
$u = $um->getUserById($user->getId());
// Create an entry in the ldap user db
$ldapUserDao = $this->getDao();
$ldapUserDao->createLdapUser($u->getId(), 0, $uid);
return $u;
}
return false;
}
示例10: getFullRESTValueForAnonymous
public function getFullRESTValueForAnonymous(Tracker_Artifact_Changeset $changeset)
{
$user = new PFUser();
$user->setEmail($changeset->getEmail());
$user->setRealName($changeset->getEmail());
$class_user_representation = '\\Tuleap\\User\\REST\\UserRepresentation';
$user_representation = new $class_user_representation();
$user_representation->build($user);
return $user_representation;
}
示例11: getFullRESTValue
public function getFullRESTValue(Tracker_FormElement_Field_List_Value $value)
{
$user_manager = UserManager::instance();
$class_user_representation = '\\Tuleap\\User\\REST\\UserRepresentation';
$user_representation = new $class_user_representation();
$user = $user_manager->getUserByUserName($value->getLabel());
if (!$user) {
$user = new PFUser();
$user->setEmail($value->getLabel());
}
$user_representation->build($user);
return $user_representation;
}
示例12: createAccount
/**
* Create user account based on LDAP info.
*
* @param String $eduid
* @param String $uid
* @param String $cn
* @param String $email
* @return PFUser
*/
function createAccount($eduid, $uid, $cn, $email)
{
if (trim($uid) == '' || trim($eduid) == '') {
return false;
}
$user = new PFUser();
$user->setUserName($this->generateLogin($uid));
$user->setLdapId($eduid);
$user->setRealName($cn);
$user->setEmail($email);
$mail_confirm_code_generator = new MailConfirmationCodeGenerator($this->getUserManager(), new RandomNumberGenerator());
$mail_confirm_code = $mail_confirm_code_generator->getConfirmationCode();
$user->setConfirmHash($mail_confirm_code);
// Default LDAP
$user->setStatus($this->getLdap()->getLDAPParam('default_user_status'));
$user->setRegisterPurpose('LDAP');
$user->setUnixStatus('S');
$user->setTimezone('GMT');
$user->setLanguageID($GLOBALS['Language']->getText('conf', 'language_id'));
$um = $this->getUserManager();
$u = $um->createAccount($user);
if ($u) {
$u = $um->getUserById($user->getId());
// Create an entry in the ldap user db
$ldapUserDao = $this->getDao();
$ldapUserDao->createLdapUser($u->getId(), 0, $uid);
return $u;
}
return false;
}
示例13: account_create
function account_create($loginname = '', $pw = '', $ldap_id = '', $realname = '', $register_purpose = '', $email = '', $status = 'P', $confirm_hash = '', $mail_site = 0, $mail_va = 0, $timezone = 'GMT', $lang_id = 'en_US', $unix_status = 'N', $expiry_date = 0)
{
$um = UserManager::instance();
$user = new PFUser();
$user->setUserName($loginname);
$user->setRealName($realname);
$user->setPassword($pw);
$user->setLdapId($ldap_id);
$user->setRegisterPurpose($register_purpose);
$user->setEmail($email);
$user->setStatus($status);
$user->setConfirmHash($confirm_hash);
$user->setMailSiteUpdates($mail_site);
$user->setMailVA($mail_va);
$user->setTimezone($timezone);
$user->setLanguageID($lang_id);
$user->setUnixStatus($unix_status);
$user->setExpiryDate($expiry_date);
$u = $um->createAccount($user);
if ($u) {
return $u->getId();
} else {
return $u;
}
}