本文整理汇总了PHP中PFUser::getEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP PFUser::getEmail方法的具体用法?PHP PFUser::getEmail怎么用?PHP PFUser::getEmail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PFUser
的用法示例。
在下文中一共展示了PFUser::getEmail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: notifyProjectsAdmins
/**
* Send mail to project administrators after daliy user sync.
*
* @param String $recipients List of project administrators emails we want to notify
* @param String $projectName Public name of the project we want to notify its administrators
* @param PFUser $user Suspended user after LDAP daily synchro
* @param String $subject The subject of the notification mail
* @param String $body The content of the notification mail
*
* @return boolean
*/
public function notifyProjectsAdmins($recipients, $projectName, $user, $subject, $body)
{
$notificationStatus = true;
try {
$mail = $this->prepareMail($recipients, $projectName, $subject, $body);
if (!$mail->send()) {
$this->logger->error("LDAP daily synchro job has suspended this user " . $user->getRealName() . " (" . $user->getEmail() . ", but failed to notify administrators of <{$projectName}> project :" . $e->getMessage());
$notificationStatus = false;
}
} catch (InvalidArgumentException $e) {
$this->logger->warn("LDAP daily synchro job has suspended this user " . $user->getRealName() . " (" . $user->getEmail() . ":" . $e->getMessage());
$notificationStatus = false;
} catch (Zend_Mail_Exception $e) {
$this->logger->error("LDAP daily synchro job has suspended this user " . $user->getRealName() . " (" . $user->getEmail() . "), but faced an issue during project administrators notification :" . $e->getMessage());
}
return $notificationStatus;
}
示例2: sendMassmail
/**
*
* Send mails to a group of people and check the max number of emailed people limit.
*
* @param Project $project Project of the receivers
* @param PFO_User $user Sender
* @param string $subject
* @param string $html_body
* @param PFUser[] $receivers
*/
public function sendMassmail(Project $project, PFUser $user, $subject, $html_body, array $receivers)
{
$hp = Codendi_HTMLPurifier::instance();
$project_name = $project->getPublicName();
$sys_max_number_of_emailed_people = ForgeConfig::get('sys_max_number_of_emailed_people');
if (count($receivers) > $sys_max_number_of_emailed_people && !$user->isSuperUser()) {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('my_index', 'massmail_not_sent_max_users', $sys_max_number_of_emailed_people));
return;
}
$mail = new Codendi_Mail();
$mail->setFrom($user->getEmail());
$mail->setTo($user->getEmail());
$mail->setBccUser($receivers);
$mail->setSubject("[" . $GLOBALS['sys_name'] . "] [" . $project_name . "] " . $subject);
$mail->setBodyText($hp->purify($html_body, CODENDI_PURIFIER_STRIP_HTML));
$mail->setBodyHtml($html_body);
$is_sent = $mail->send();
return $is_sent;
}
示例3: doesRequestAppearToBeValid
private function doesRequestAppearToBeValid(Tracker_Artifact $artifact, array $fields_data, PFUser $submitter)
{
if ($submitter->isAnonymous() && !trim($submitter->getEmail())) {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_artifact', 'email_required'));
return false;
}
if (!$this->fields_validator->validate($artifact, $fields_data)) {
return false;
}
return true;
}
示例4: sendMail
public function sendMail(PFUser $user, Project $project, $tv3_id, $tracker_name)
{
$mail = new Codendi_Mail();
$breadcrumbs = array();
$breadcrumbs[] = '<a href="' . get_server_url() . '/projects/' . $project->getUnixName(true) . '" />' . $project->getPublicName() . '</a>';
$mail->getLookAndFeelTemplate()->set('breadcrumbs', $breadcrumbs);
$mail->addAdditionalHeader("X-Codendi-Project", $project->getUnixName());
$mail->setFrom($GLOBALS['sys_noreply']);
$mail->setTo($user->getEmail());
$mail->setSubject('Output of your migration TV3 -> TV5');
$mail->setBody($this->getMailBody($tv3_id, $tracker_name));
$mail->send();
$this->purgeLogStack();
}
示例5: 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;
}
示例6: create
/**
* Update an artifact (means create a new changeset)
*
* @param array $fields_data Artifact fields values
* @param string $comment The comment (follow-up) associated with the artifact update
* @param PFUser $submitter The user who is doing the update
* @param boolean $send_notification true if a notification must be sent, false otherwise
* @param string $comment_format The comment (follow-up) type ("text" | "html")
*
* @throws Tracker_Exception In the validation
* @throws Tracker_NoChangeException In the validation
*
* @return Tracker_Artifact_Changeset|Boolean The new changeset if update is done without error, false otherwise
*/
public function create(Tracker_Artifact $artifact, array $fields_data, $comment, PFUser $submitter, $submitted_on, $send_notification, $comment_format)
{
$this->changeset_dao->startTransaction();
$comment = trim($comment);
$email = null;
if ($submitter->isAnonymous()) {
$email = $submitter->getEmail();
}
$this->validateNewChangeset($artifact, $fields_data, $comment, $submitter, $email);
$previous_changeset = $artifact->getLastChangeset();
/*
* Post actions were run by validateNewChangeset but they modified a
* different set of $fields_data in the case of massChange or soap requests;
* we run them again for the current $fields_data
*/
$artifact->getWorkflow()->before($fields_data, $submitter, $artifact);
$changeset_id = $this->changeset_dao->create($artifact->getId(), $submitter->getId(), $email, $submitted_on);
if (!$changeset_id) {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_artifact', 'unable_update'));
$this->changeset_dao->rollBack();
throw new Tracker_ChangesetNotCreatedException();
}
if (!$this->storeComment($artifact, $comment, $submitter, $submitted_on, $comment_format, $changeset_id)) {
$this->changeset_dao->rollBack();
throw new Tracker_CommentNotStoredException();
}
$this->storeFieldsValues($artifact, $previous_changeset, $fields_data, $submitter, $changeset_id);
$new_changeset = new Tracker_Artifact_Changeset($changeset_id, $artifact, $submitter->getId(), $submitted_on, $email);
$artifact->addChangeset($new_changeset);
$save_after_ok = $this->saveArtifactAfterNewChangeset($artifact, $fields_data, $submitter, $new_changeset, $previous_changeset);
if (!$save_after_ok) {
$this->changeset_dao->rollBack();
throw new Tracker_AfterSaveException();
}
$this->event_manager->processEvent(TRACKER_EVENT_ARTIFACT_POST_UPDATE, array('artifact' => $artifact));
try {
$this->changeset_dao->commit();
} catch (Exception $exception) {
throw new Tracker_ChangesetCommitException();
}
if ($send_notification) {
$artifact->getChangeset($changeset_id)->notify();
}
return $new_changeset;
}
示例7: sendNotificationMail
/**
* Manage the mail content and send it
*
* @param PFUser $user
* @param FRSFile $file
* @param String $bodyContent
* @param Array $option
*
* @return Boolean
*/
function sendNotificationMail($user, $file, $bodyContent, $option)
{
$mail = new Mail();
$language = new BaseLanguage($GLOBALS['sys_supported_languages'], $GLOBALS['sys_lang']);
$language->loadLanguage($user->getLanguageID());
$subject = $GLOBALS['sys_name'] . ' Error in ' . $file->getFileLocation();
$mail->setFrom($GLOBALS['sys_noreply']);
$mail->setBcc($user->getEmail());
$mail->setSubject($subject);
$mail->setBody($language->getText('mail_system_event', $bodyContent, $option));
return $mail->send();
}
示例8: getBody
/**
* Prepare the body of the notification mail
*
* @param Integer $projectName Public name of the project we want to notify its administrators
* @param PFUser $user Suspended user after LDAP daily synchro
*
* @return String
*/
private function getBody($projectName, $user)
{
return $GLOBALS['Language']->getText('plugin_ldap', 'ldap_sync_mail_notification_body', array($user->getRealName(), $user->getEmail(), $projectName, $this->retentionPeriod));
}
示例9: createAccount
/**
* Create new account
*
* @param PFUser $user
*
* @return PFUser
*/
function createAccount($user)
{
$dao = $this->getDao();
$user_id = $dao->create($user->getUserName(), $user->getEmail(), $user->getPassword(), $user->getRealName(), $user->getRegisterPurpose(), $user->getStatus(), $user->getShell(), $user->getUnixStatus(), $user->getUnixUid(), $user->getUnixBox(), $user->getLdapId(), $_SERVER['REQUEST_TIME'], $user->getConfirmHash(), $user->getMailSiteUpdates(), $user->getMailVA(), $user->getStickyLogin(), $user->getAuthorizedKeys(), $user->getNewMail(), $user->getTimeZone(), $user->getTheme(), $user->getLanguageID(), $user->getExpiryDate(), $_SERVER['REQUEST_TIME']);
if (!$user_id) {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('include_exit', 'error'));
return 0;
} else {
$user->setId($user_id);
$this->assignNextUnixUid($user);
$em = $this->_getEventManager();
$em->processEvent(Event::USER_MANAGER_CREATE_ACCOUNT, array('user' => $user));
// Create the first layout for the user and add some initial widgets
$lm = $this->_getWidgetLayoutManager();
$lm->createDefaultLayoutForUser($user_id);
switch ($user->getStatus()) {
case PFUser::STATUS_PENDING:
if (ForgeConfig::get('sys_user_approval')) {
$this->pending_user_notifier->notifyAdministrator($user);
}
break;
case PFUser::STATUS_ACTIVE:
case PFUser::STATUS_RESTRICTED:
$em->processEvent('project_admin_activate_user', array('user_id' => $user_id));
break;
}
return $user;
}
}
示例10: fetchFormattedMailUserInfo
private function fetchFormattedMailUserInfo(PFUser $user)
{
$hp = Codendi_HTMLPurifier::instance();
if ($user && !$user->isAnonymous()) {
$user_info = '<a href="mailto:' . $hp->purify($user->getEmail()) . '">' . $hp->purify($user->getRealName()) . ' (' . $hp->purify($user->getUserName()) . ')
</a>';
} else {
$user = UserManager::instance()->getUserAnonymous();
$user->setEmail($this->changeset->getEmail());
$user_info = $GLOBALS['Language']->getText('tracker_include_artifact', 'anon_user');
}
return $user_info;
}
示例11: prepareMail
/**
* Prepare mail
*
* @param FRSPackage $package Id of th package
* @param PFUser $user The deleted user
*
* @return Codendi_Mail
*/
function prepareMail(FRSPackage $package, PFUser $user)
{
$subject = $GLOBALS['Language']->getText('file_filemodule_monitor', 'mail_subject', array($GLOBALS['sys_name'], $package->getName()));
$mail = new Codendi_Mail();
$mail->getLookAndFeelTemplate()->set('title', $subject);
$mail->setFrom($GLOBALS['sys_noreply']);
$mail->setTo($user->getEmail());
$mail->setSubject($subject);
return $mail;
}
示例12: _addMessage
protected function _addMessage(PFUser $to, $subject, $msg, $link)
{
if (!isset($this->notifications[$msg])) {
$subject = '[' . util_unconvert_htmlspecialchars($this->_group_name) . ' - Documents] ' . $subject;
$this->notifications[$msg] = new Notification(array(), $subject, nl2br($msg), $msg, $link, 'Documents');
}
$this->notifications[$msg]->addEmail($to->getEmail());
}
示例13: getNotification
/**
* @return Notification
*/
private function getNotification(FRSPackage $package, PFUser $user, $html_body, $text_body)
{
$subject = $GLOBALS['Language']->getText('file_filemodule_monitor', 'mail_subject', array($GLOBALS['sys_name'], $package->getName()));
$emails = array($user->getEmail());
$service_name = 'Files';
$goto_link = get_server_url() . '/file/showfiles.php?group_id=' . $package->getGroupID() . '&package_id=' . $package->getPackageID();
return new Notification($emails, $subject, $html_body, $text_body, $goto_link, $service_name);
}
示例14: getEmail
public function getEmail()
{
return $this->user->getEmail();
}
示例15: 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;
}