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


PHP MailTemplate::setReplyTo方法代码示例

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


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

示例1:

 /**
  * Helper Function - set mail from address
  * @param $request PKPRequest
  * @param MailTemplate $mail
  */
 function _setMailFrom($request, &$mail)
 {
     $site = $request->getSite();
     $press = $request->getPress();
     // Set the sender based on the current context
     if ($press && $press->getSetting('supportEmail')) {
         $mail->setReplyTo($press->getSetting('supportEmail'), $press->getSetting('supportName'));
     } else {
         $mail->setReplyTo($site->getLocalizedContactEmail(), $site->getLocalizedContactName());
     }
 }
开发者ID:PublishingWithoutWalls,项目名称:omp,代码行数:16,代码来源:LoginHandler.inc.php

示例2: sendReminder

 function sendReminder($subscription, $journal, $emailKey)
 {
     $userDao = DAORegistry::getDAO('UserDAO');
     $subscriptionTypeDao = DAORegistry::getDAO('SubscriptionTypeDAO');
     $journalName = $journal->getLocalizedName();
     $user = $userDao->getById($subscription->getUserId());
     if (!isset($user)) {
         return false;
     }
     $subscriptionType = $subscriptionTypeDao->getSubscriptionType($subscription->getTypeId());
     $subscriptionName = $journal->getSetting('subscriptionName');
     $subscriptionEmail = $journal->getSetting('subscriptionEmail');
     $subscriptionPhone = $journal->getSetting('subscriptionPhone');
     $subscriptionMailingAddress = $journal->getSetting('subscriptionMailingAddress');
     $subscriptionContactSignature = $subscriptionName;
     AppLocale::requireComponents(LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_APP_COMMON);
     if ($subscriptionMailingAddress != '') {
         $subscriptionContactSignature .= "\n" . $subscriptionMailingAddress;
     }
     if ($subscriptionPhone != '') {
         $subscriptionContactSignature .= "\n" . AppLocale::Translate('user.phone') . ': ' . $subscriptionPhone;
     }
     $subscriptionContactSignature .= "\n" . AppLocale::Translate('user.email') . ': ' . $subscriptionEmail;
     $paramArray = array('subscriberName' => $user->getFullName(), 'journalName' => $journalName, 'subscriptionType' => $subscriptionType->getSummaryString(), 'expiryDate' => $subscription->getDateEnd(), 'username' => $user->getUsername(), 'subscriptionContactSignature' => $subscriptionContactSignature);
     import('lib.pkp.classes.mail.MailTemplate');
     $mail = new MailTemplate($emailKey, $journal->getPrimaryLocale(), $journal, false);
     $mail->setReplyTo($subscriptionEmail, $subscriptionName);
     $mail->addRecipient($user->getEmail(), $user->getFullName());
     $mail->setSubject($mail->getSubject($journal->getPrimaryLocale()));
     $mail->setBody($mail->getBody($journal->getPrimaryLocale()));
     $mail->assignParams($paramArray);
     $mail->send();
 }
开发者ID:mariojp,项目名称:ojs,代码行数:33,代码来源:SubscriptionExpiryReminder.inc.php

示例3: sendNotification

 function sendNotification($users, $journal, $issue)
 {
     if ($users->getCount() != 0) {
         import('lib.pkp.classes.mail.MailTemplate');
         $email = new MailTemplate('OPEN_ACCESS_NOTIFY', $journal->getPrimaryLocale());
         $email->setSubject($email->getSubject($journal->getPrimaryLocale()));
         $email->setReplyTo(null);
         $email->addRecipient($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
         $paramArray = array('journalName' => $journal->getLocalizedName(), 'journalUrl' => Request::url($journal->getPath()), 'editorialContactSignature' => $journal->getSetting('contactName') . "\n" . $journal->getLocalizedName());
         $email->assignParams($paramArray);
         $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
         $publishedArticles = $publishedArticleDao->getPublishedArticlesInSections($issue->getId());
         $mimeBoundary = '==boundary_' . md5(microtime());
         $templateMgr = TemplateManager::getManager();
         $templateMgr->assign('body', $email->getBody($journal->getPrimaryLocale()));
         $templateMgr->assign('templateSignature', $journal->getSetting('emailSignature'));
         $templateMgr->assign('mimeBoundary', $mimeBoundary);
         $templateMgr->assign('issue', $issue);
         $templateMgr->assign('publishedArticles', $publishedArticles);
         $email->addHeader('MIME-Version', '1.0');
         $email->setContentType('multipart/alternative; boundary="' . $mimeBoundary . '"');
         $email->setBody($templateMgr->fetch('subscription/openAccessNotifyEmail.tpl'));
         while ($user = $users->next()) {
             $email->addBcc($user->getEmail(), $user->getFullName());
         }
         $email->send();
     }
 }
开发者ID:laelnasan,项目名称:UTFPR-ojs,代码行数:28,代码来源:OpenAccessNotification.inc.php

示例4: sendReminder

 /**
  * Send email to a book for review author
  */
 function sendReminder($book, $journal, $emailKey)
 {
     $journalId = $journal->getId();
     $paramArray = array('authorName' => strip_tags($book->getUserFullName()), 'bookForReviewTitle' => '"' . strip_tags($book->getLocalizedTitle()) . '"', 'bookForReviewDueDate' => date('l, F j, Y', strtotime($book->getDateDue())), 'submissionUrl' => Request::url(null, 'author', 'submit'), 'editorialContactSignature' => strip_tags($book->getEditorContactSignature()));
     import('classes.mail.MailTemplate');
     $mail = new MailTemplate($emailKey);
     $mail->setReplyTo($book->getEditorEmail(), $book->getEditorFullName());
     $mail->addRecipient($book->getUserEmail(), $book->getUserFullName());
     $mail->setSubject($mail->getSubject($journal->getPrimaryLocale()));
     $mail->setBody($mail->getBody($journal->getPrimaryLocale()));
     $mail->assignParams($paramArray);
     $mail->send();
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:16,代码来源:BooksForReviewReminder.inc.php

示例5: execute

 /**
  * Send the email
  * @param $args array
  * @param $request PKPRequest
  */
 function execute($args, $request)
 {
     $userDao = DAORegistry::getDAO('UserDAO');
     $toUser = $userDao->getById($this->userId);
     $fromUser = $request->getUser();
     import('lib.pkp.classes.mail.MailTemplate');
     $email = new MailTemplate();
     $email->addRecipient($toUser->getEmail(), $toUser->getFullName());
     $email->setReplyTo($fromUser->getEmail(), $fromUser->getFullName());
     $email->setSubject($this->getData('subject'));
     $email->setBody($this->getData('message'));
     $email->send();
 }
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:18,代码来源:UserEmailForm.inc.php

示例6: sendReminder

 /**
  * Send email to object for review author
  * @param $ofrAssignment ObjectForReviewAssignment
  * @param $journal Journal
  * @param $emailKey string
  */
 function sendReminder($ofrAssignment, $journal, $emailKey)
 {
     $journalId = $journal->getId();
     $author =& $ofrAssignment->getUser();
     $objectForReview =& $ofrAssignment->getObjectForReview();
     $editor =& $objectForReview->getEditor();
     $paramArray = array('authorName' => strip_tags($author->getFullName()), 'objectForReviewTitle' => '"' . strip_tags($objectForReview->getTitle()) . '"', 'objectForReviewDueDate' => date('l, F j, Y', strtotime($ofrAssignment->getDateDue())), 'submissionUrl' => Request::url($journal->getPath(), 'author', 'submit'), 'editorialContactSignature' => strip_tags($editor->getContactSignature()));
     import('classes.mail.MailTemplate');
     $mail = new MailTemplate($emailKey);
     $mail->setReplyTo($editor->getEmail(), $editor->getFullName());
     $mail->addRecipient($author->getEmail(), $author->getFullName());
     $mail->setSubject($mail->getSubject($journal->getPrimaryLocale()));
     $mail->setBody($mail->getBody($journal->getPrimaryLocale()));
     $mail->assignParams($paramArray);
     $mail->send();
     $ofrAssignment->setDateReminded(Core::getCurrentDate());
     $ofrAssignmentDao =& DAORegistry::getDAO('ObjectForReviewAssignmentDAO');
     $ofrAssignmentDao->updateObject($ofrAssignment);
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:25,代码来源:ObjectsForReviewReminder.inc.php

示例7: handle

 /**
  * Handle incoming requests/notifications
  * @param $args array
  * @param $request PKPRequest
  */
 function handle($args, $request)
 {
     $templateMgr = TemplateManager::getManager($request);
     $journal = $request->getJournal();
     if (!$journal) {
         return parent::handle($args, $request);
     }
     // Just in case we need to contact someone
     import('lib.pkp.classes.mail.MailTemplate');
     // Prefer technical support contact
     $contactName = $journal->getSetting('supportName');
     $contactEmail = $journal->getSetting('supportEmail');
     if (!$contactEmail) {
         // Fall back on primary contact
         $contactName = $journal->getSetting('contactName');
         $contactEmail = $journal->getSetting('contactEmail');
     }
     $mail = new MailTemplate('PAYPAL_INVESTIGATE_PAYMENT');
     $mail->setReplyTo(null);
     $mail->addRecipient($contactEmail, $contactName);
     $paymentStatus = $request->getUserVar('payment_status');
     switch (array_shift($args)) {
         case 'ipn':
             // Build a confirmation transaction.
             $req = 'cmd=_notify-validate';
             if (get_magic_quotes_gpc()) {
                 foreach ($_POST as $key => $value) {
                     $req .= '&' . urlencode(stripslashes($key)) . '=' . urlencode(stripslashes($value));
                 }
             } else {
                 foreach ($_POST as $key => $value) {
                     $req .= '&' . urlencode($key) . '=' . urlencode($value);
                 }
             }
             // Create POST response
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_URL, $this->getSetting($journal->getId(), 'paypalurl'));
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
             curl_setopt($ch, CURLOPT_POST, 1);
             curl_setopt($ch, CURLOPT_HTTPHEADER, array('User-Agent: PKP PayPal Service', 'Content-Type: application/x-www-form-urlencoded', 'Content-Length: ' . strlen($req)));
             curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
             $ret = curl_exec($ch);
             $curlError = curl_error($ch);
             curl_close($ch);
             // Check the confirmation response and handle as necessary.
             if (strcmp($ret, 'VERIFIED') == 0) {
                 switch ($paymentStatus) {
                     case 'Completed':
                         $payPalDao = DAORegistry::getDAO('PayPalDAO');
                         $transactionId = $request->getUserVar('txn_id');
                         if ($payPalDao->transactionExists($transactionId)) {
                             // A duplicate transaction was received; notify someone.
                             $mail->assignParams(array('journalName' => $journal->getLocalizedName(), 'postInfo' => print_r($_POST, true), 'additionalInfo' => "Duplicate transaction ID: {$transactionId}", 'serverVars' => print_r($_SERVER, true)));
                             $mail->send();
                             exit;
                         } else {
                             // New transaction succeeded. Record it.
                             $payPalDao->insertTransaction($transactionId, $request->getUserVar('txn_type'), String::strtolower($request->getUserVar('payer_email')), String::strtolower($request->getUserVar('receiver_email')), $request->getUserVar('item_number'), $request->getUserVar('payment_date'), $request->getUserVar('payer_id'), $request->getUserVar('receiver_id'));
                             $queuedPaymentId = $request->getUserVar('custom');
                             import('classes.payment.ojs.OJSPaymentManager');
                             $ojsPaymentManager = new OJSPaymentManager($request);
                             // Verify the cost and user details as per PayPal spec.
                             $queuedPayment =& $ojsPaymentManager->getQueuedPayment($queuedPaymentId);
                             if (!$queuedPayment) {
                                 // The queued payment entry is missing. Complain.
                                 $mail->assignParams(array('journalName' => $journal->getLocalizedName(), 'postInfo' => print_r($_POST, true), 'additionalInfo' => "Missing queued payment ID: {$queuedPaymentId}", 'serverVars' => print_r($_SERVER, true)));
                                 $mail->send();
                                 exit;
                             }
                             //NB: if/when paypal subscriptions are enabled, these checks will have to be adjusted
                             // because subscription prices may change over time
                             $queuedAmount = $queuedPayment->getAmount();
                             $grantedAmount = $request->getUserVar('mc_gross');
                             $queuedCurrency = $queuedPayment->getCurrencyCode();
                             $grantedCurrency = $request->getUserVar('mc_currency');
                             $grantedEmail = String::strtolower($request->getUserVar('receiver_email'));
                             $queuedEmail = String::strtolower($this->getSetting($journal->getId(), 'selleraccount'));
                             if ($queuedAmount != $grantedAmount && $queuedAmount > 0 || $queuedCurrency != $grantedCurrency || $grantedEmail != $queuedEmail) {
                                 // The integrity checks for the transaction failed. Complain.
                                 $mail->assignParams(array('journalName' => $journal->getLocalizedName(), 'postInfo' => print_r($_POST, true), 'additionalInfo' => "Granted amount: {$grantedAmount}\n" . "Queued amount: {$queuedAmount}\n" . "Granted currency: {$grantedCurrency}\n" . "Queued currency: {$queuedCurrency}\n" . "Granted to PayPal account: {$grantedEmail}\n" . "Configured PayPal account: {$queuedEmail}", 'serverVars' => print_r($_SERVER, true)));
                                 $mail->send();
                                 exit;
                             }
                             // Update queued amount if amount set by user (e.g. donation)
                             if ($queuedAmount == 0 && $grantedAmount > 0) {
                                 $queuedPaymentDao = DAORegistry::getDAO('QueuedPaymentDAO');
                                 $queuedPayment->setAmount($grantedAmount);
                                 $queuedPayment->setCurrencyCode($grantedCurrency);
                                 $queuedPaymentDao->updateQueuedPayment($queuedPaymentId, $queuedPayment);
                             }
                             // Fulfill the queued payment.
                             if ($ojsPaymentManager->fulfillQueuedPayment($request, $queuedPayment, $this->getName())) {
                                 exit;
                             }
                             // If we're still here, it means the payment couldn't be fulfilled.
//.........这里部分代码省略.........
开发者ID:ucsal,项目名称:ojs,代码行数:101,代码来源:PayPalPlugin.inc.php

示例8: sendOnlinePaymentNotificationEmail

 /**
  * Send notification email to Subscription Manager when online payment is completed.
  */
 function sendOnlinePaymentNotificationEmail($request, &$subscription, $mailTemplateKey)
 {
     $validKeys = array('SUBSCRIPTION_PURCHASE_INDL', 'SUBSCRIPTION_PURCHASE_INSTL', 'SUBSCRIPTION_RENEW_INDL', 'SUBSCRIPTION_RENEW_INSTL');
     if (!in_array($mailTemplateKey, $validKeys)) {
         return false;
     }
     $journal = $request->getJournal();
     $subscriptionContactName = $journal->getSetting('subscriptionName');
     $subscriptionContactEmail = $journal->getSetting('subscriptionEmail');
     if (empty($subscriptionContactEmail)) {
         $subscriptionContactEmail = $journal->getSetting('contactEmail');
         $subscriptionContactName = $journal->getSetting('contactName');
     }
     if (empty($subscriptionContactEmail)) {
         return false;
     }
     $userDao = DAORegistry::getDAO('UserDAO');
     $user = $userDao->getById($subscription->getUserId());
     $subscriptionTypeDao = DAORegistry::getDAO('SubscriptionTypeDAO');
     $subscriptionType =& $subscriptionTypeDao->getSubscriptionType($subscription->getTypeId());
     $roleDao = DAORegistry::getDAO('RoleDAO');
     $role = $roleDao->newDataObject();
     if ($roleDao->getJournalUsersRoleCount($journal->getId(), ROLE_ID_SUBSCRIPTION_MANAGER) > 0) {
         $role->setId(ROLE_ID_SUBSCRIPTION_MANAGER);
         $rolePath = $role->getPath();
     } else {
         $role->setId(ROLE_ID_MANAGER);
         $rolePath = $role->getPath();
     }
     $paramArray = array('subscriptionType' => $subscriptionType->getSummaryString(), 'userDetails' => $user->getContactSignature(), 'membership' => $subscription->getMembership());
     switch ($mailTemplateKey) {
         case 'SUBSCRIPTION_PURCHASE_INDL':
         case 'SUBSCRIPTION_RENEW_INDL':
             $paramArray['subscriptionUrl'] = $request->url($journal->getPath(), $rolePath, 'editSubscription', 'individual', array($subscription->getId()));
             break;
         case 'SUBSCRIPTION_PURCHASE_INSTL':
         case 'SUBSCRIPTION_RENEW_INSTL':
             $paramArray['subscriptionUrl'] = $request->rl($journal->getPath(), $rolePath, 'editSubscription', 'institutional', array($subscription->getId()));
             $paramArray['institutionName'] = $subscription->getInstitutionName();
             $paramArray['institutionMailingAddress'] = $subscription->getInstitutionMailingAddress();
             $paramArray['domain'] = $subscription->getDomain();
             $paramArray['ipRanges'] = $subscription->getIPRangesString();
             break;
     }
     import('lib.pkp.classes.mail.MailTemplate');
     $mail = new MailTemplate($mailTemplateKey);
     $mail->setReplyTo($subscriptionContactEmail, $subscriptionContactName);
     $mail->addRecipient($subscriptionContactEmail, $subscriptionContactName);
     $mail->setSubject($mail->getSubject($journal->getPrimaryLocale()));
     $mail->setBody($mail->getBody($journal->getPrimaryLocale()));
     $mail->assignParams($paramArray);
     $mail->send();
 }
开发者ID:jalperin,项目名称:ojs,代码行数:56,代码来源:SubscriptionAction.inc.php

示例9: execute


//.........这里部分代码省略.........
     // Localized
     $user->setSignature($this->getData('signature'), null);
     // Localized
     $user->setEmail($this->getData('email'));
     $user->setData('orcid', $this->getData('orcid'));
     $user->setUrl($this->getData('userUrl'));
     $user->setPhone($this->getData('phone'));
     $user->setFax($this->getData('fax'));
     $user->setMailingAddress($this->getData('mailingAddress'));
     $user->setCountry($this->getData('country'));
     $user->setBiography($this->getData('biography'), null);
     // Localized
     $user->setGossip($this->getData('gossip'), null);
     // Localized
     $user->setMustChangePassword($this->getData('mustChangePassword') ? 1 : 0);
     $user->setAuthId((int) $this->getData('authId'));
     $site =& Request::getSite();
     $availableLocales = $site->getSupportedLocales();
     $locales = array();
     foreach ($this->getData('userLocales') as $locale) {
         if (AppLocale::isLocaleValid($locale) && in_array($locale, $availableLocales)) {
             array_push($locales, $locale);
         }
     }
     $user->setLocales($locales);
     if ($user->getAuthId()) {
         $authDao =& DAORegistry::getDAO('AuthSourceDAO');
         $auth =& $authDao->getPlugin($user->getAuthId());
     }
     if ($user->getId() != null) {
         $userId = $user->getId();
         if ($this->getData('password') !== '') {
             if (isset($auth)) {
                 $auth->doSetUserPassword($user->getUsername(), $this->getData('password'));
                 $user->setPassword(Validation::encryptCredentials($userId, Validation::generatePassword()));
                 // Used for PW reset hash only
             } else {
                 $user->setPassword(Validation::encryptCredentials($user->getUsername(), $this->getData('password')));
             }
         }
         if (isset($auth)) {
             // FIXME Should try to create user here too?
             $auth->doSetUserInfo($user);
         }
         $userDao->updateObject($user);
     } else {
         $user->setUsername($this->getData('username'));
         if ($this->getData('generatePassword')) {
             $password = Validation::generatePassword();
             $sendNotify = true;
         } else {
             $password = $this->getData('password');
             $sendNotify = $this->getData('sendNotify');
         }
         if (isset($auth)) {
             $user->setPassword($password);
             // FIXME Check result and handle failures
             $auth->doCreateUser($user);
             $user->setAuthId($auth->authId);
             $user->setPassword(Validation::encryptCredentials($user->getId(), Validation::generatePassword()));
             // Used for PW reset hash only
         } else {
             $user->setPassword(Validation::encryptCredentials($this->getData('username'), $password));
         }
         $user->setDateRegistered(Core::getCurrentDate());
         $userId = $userDao->insertUser($user);
         $isManager = Validation::isJournalManager();
         if (!empty($this->_data['enrollAs'])) {
             foreach ($this->getData('enrollAs') as $roleName) {
                 // Enroll new user into an initial role
                 $roleDao =& DAORegistry::getDAO('RoleDAO');
                 $roleId = $roleDao->getRoleIdFromPath($roleName);
                 if (!$isManager && $roleId != ROLE_ID_READER) {
                     continue;
                 }
                 if ($roleId != null) {
                     $role = new Role();
                     $role->setJournalId($journal->getId());
                     $role->setUserId($userId);
                     $role->setRoleId($roleId);
                     $roleDao->insertRole($role);
                 }
             }
         }
         if ($sendNotify) {
             // Send welcome email to user
             import('classes.mail.MailTemplate');
             $mail = new MailTemplate('USER_REGISTER');
             $mail->setReplyTo(null);
             $mail->assignParams(array('username' => $this->getData('username'), 'password' => $password, 'userFullName' => $user->getFullName()));
             $mail->addRecipient($user->getEmail(), $user->getFullName());
             $mail->send();
         }
     }
     // Insert the user interests
     $interests = $this->getData('interestsKeywords') ? $this->getData('interestsKeywords') : $this->getData('interestsTextOnly');
     import('lib.pkp.classes.user.InterestManager');
     $interestManager = new InterestManager();
     $interestManager->setInterestsForUser($user, $interests);
 }
开发者ID:jasonzou,项目名称:OJS-2.4.6,代码行数:101,代码来源:UserManagementForm.inc.php

示例10: array

 /**
  * Create or update a user.
  * @param $args array
  * @param $request PKPRequest
  */
 function &execute($args, $request)
 {
     parent::execute($request);
     $userDao = DAORegistry::getDAO('UserDAO');
     $context = $request->getContext();
     if (isset($this->userId)) {
         $userId = $this->userId;
         $user = $userDao->getById($userId);
     }
     if (!isset($user)) {
         $user = $userDao->newDataObject();
         $user->setInlineHelp(1);
         // default new users to having inline help visible
     }
     $user->setSalutation($this->getData('salutation'));
     $user->setFirstName($this->getData('firstName'));
     $user->setMiddleName($this->getData('middleName'));
     $user->setLastName($this->getData('lastName'));
     $user->setSuffix($this->getData('suffix'));
     $user->setInitials($this->getData('initials'));
     $user->setGender($this->getData('gender'));
     $user->setAffiliation($this->getData('affiliation'), null);
     // Localized
     $user->setSignature($this->getData('signature'), null);
     // Localized
     $user->setEmail($this->getData('email'));
     $user->setUrl($this->getData('userUrl'));
     $user->setPhone($this->getData('phone'));
     $user->setOrcid($this->getData('orcid'));
     $user->setMailingAddress($this->getData('mailingAddress'));
     $user->setCountry($this->getData('country'));
     $user->setBiography($this->getData('biography'), null);
     // Localized
     $user->setMustChangePassword($this->getData('mustChangePassword') ? 1 : 0);
     $user->setAuthId((int) $this->getData('authId'));
     $site = $request->getSite();
     $availableLocales = $site->getSupportedLocales();
     $locales = array();
     foreach ($this->getData('userLocales') as $locale) {
         if (AppLocale::isLocaleValid($locale) && in_array($locale, $availableLocales)) {
             array_push($locales, $locale);
         }
     }
     $user->setLocales($locales);
     if ($user->getAuthId()) {
         $authDao = DAORegistry::getDAO('AuthSourceDAO');
         $auth =& $authDao->getPlugin($user->getAuthId());
     }
     if ($user->getId() != null) {
         if ($this->getData('password') !== '') {
             if (isset($auth)) {
                 $auth->doSetUserPassword($user->getUsername(), $this->getData('password'));
                 $user->setPassword(Validation::encryptCredentials($user->getId(), Validation::generatePassword()));
                 // Used for PW reset hash only
             } else {
                 $user->setPassword(Validation::encryptCredentials($user->getUsername(), $this->getData('password')));
             }
         }
         if (isset($auth)) {
             // FIXME Should try to create user here too?
             $auth->doSetUserInfo($user);
         }
         $userDao->updateObject($user);
     } else {
         $user->setUsername($this->getData('username'));
         if ($this->getData('generatePassword')) {
             $password = Validation::generatePassword();
             $sendNotify = true;
         } else {
             $password = $this->getData('password');
             $sendNotify = $this->getData('sendNotify');
         }
         if (isset($auth)) {
             $user->setPassword($password);
             // FIXME Check result and handle failures
             $auth->doCreateUser($user);
             $user->setAuthId($auth->authId);
             $user->setPassword(Validation::encryptCredentials($user->getId(), Validation::generatePassword()));
             // Used for PW reset hash only
         } else {
             $user->setPassword(Validation::encryptCredentials($this->getData('username'), $password));
         }
         $user->setDateRegistered(Core::getCurrentDate());
         $userId = $userDao->insertObject($user);
         if ($sendNotify) {
             // Send welcome email to user
             import('lib.pkp.classes.mail.MailTemplate');
             $mail = new MailTemplate('USER_REGISTER');
             $mail->setReplyTo($context->getSetting('contactEmail'), $context->getSetting('contactName'));
             $mail->assignParams(array('username' => $this->getData('username'), 'password' => $password, 'userFullName' => $user->getFullName()));
             $mail->addRecipient($user->getEmail(), $user->getFullName());
             $mail->send();
         }
     }
     import('lib.pkp.classes.user.InterestManager');
//.........这里部分代码省略.........
开发者ID:selwyntcy,项目名称:pkp-lib,代码行数:101,代码来源:UserDetailsForm.inc.php

示例11: array

 /**
  * Internal function to prepare notification email
  * @param $emailTemplateKey string
  */
 function _prepareNotificationEmail($mailTemplateKey)
 {
     $userDao = DAORegistry::getDAO('UserDAO');
     $subscriptionTypeDao = DAORegistry::getDAO('SubscriptionTypeDAO');
     $journalSettingsDao = DAORegistry::getDAO('JournalSettingsDAO');
     $journal = Request::getJournal();
     $journalName = $journal->getLocalizedTitle();
     $journalId = $journal->getId();
     $user = $userDao->getById($this->subscription->getUserId());
     $subscriptionType =& $subscriptionTypeDao->getSubscriptionType($this->subscription->getTypeId());
     $subscriptionName = $journalSettingsDao->getSetting($journalId, 'subscriptionName');
     $subscriptionEmail = $journalSettingsDao->getSetting($journalId, 'subscriptionEmail');
     $subscriptionPhone = $journalSettingsDao->getSetting($journalId, 'subscriptionPhone');
     $subscriptionMailingAddress = $journalSettingsDao->getSetting($journalId, 'subscriptionMailingAddress');
     $subscriptionContactSignature = $subscriptionName;
     if ($subscriptionMailingAddress != '') {
         $subscriptionContactSignature .= "\n" . $subscriptionMailingAddress;
     }
     if ($subscriptionPhone != '') {
         $subscriptionContactSignature .= "\n" . __('user.phone') . ': ' . $subscriptionPhone;
     }
     $subscriptionContactSignature .= "\n" . __('user.email') . ': ' . $subscriptionEmail;
     $paramArray = array('subscriberName' => $user->getFullName(), 'journalName' => $journalName, 'subscriptionType' => $subscriptionType->getSummaryString(), 'username' => $user->getUsername(), 'subscriptionContactSignature' => $subscriptionContactSignature);
     import('lib.pkp.classes.mail.MailTemplate');
     $mail = new MailTemplate($mailTemplateKey);
     $mail->setReplyTo($subscriptionEmail, $subscriptionName);
     $mail->addRecipient($user->getEmail(), $user->getFullName());
     $mail->setSubject($mail->getSubject($journal->getPrimaryLocale()));
     $mail->setBody($mail->getBody($journal->getPrimaryLocale()));
     $mail->assignParams($paramArray);
     return $mail;
 }
开发者ID:bkroll,项目名称:ojs,代码行数:36,代码来源:SubscriptionForm.inc.php

示例12: fulfillQueuedPayment


//.........这里部分代码省略.........
                 $journal = $journalDao->getById($journalId);
                 if (!$journal) {
                     return false;
                 }
                 // Check if user account corresponding to recipient email exists in the system
                 $userDao = DAORegistry::getDAO('UserDAO');
                 $roleDao = DAORegistry::getDAO('RoleDAO');
                 $recipientFirstName = $gift->getRecipientFirstName();
                 $recipientEmail = $gift->getRecipientEmail();
                 $newUserAccount = false;
                 if ($userDao->userExistsByEmail($recipientEmail)) {
                     // User already has account, check if enrolled as reader in journal
                     $user = $userDao->getUserByEmail($recipientEmail);
                     $userId = $user->getId();
                     if (!$roleDao->userHasRole($journalId, $userId, ROLE_ID_READER)) {
                         // User not enrolled as reader, enroll as reader
                         $role = new Role();
                         $role->setJournalId($journalId);
                         $role->setUserId($userId);
                         $role->setRoleId(ROLE_ID_READER);
                         $roleDao->insertRole($role);
                     }
                 } else {
                     // User does not have an account. Create one and enroll as reader.
                     $recipientLastName = $gift->getRecipientLastName();
                     $username = Validation::suggestUsername($recipientFirstName, $recipientLastName);
                     $password = Validation::generatePassword();
                     $user = $userDao->newDataObject();
                     $user->setUsername($username);
                     $user->setPassword(Validation::encryptCredentials($username, $password));
                     $user->setFirstName($recipientFirstName);
                     $user->setMiddleName($gift->getRecipientMiddleName());
                     $user->setLastName($recipientLastName);
                     $user->setEmail($recipientEmail);
                     $user->setDateRegistered(Core::getCurrentDate());
                     $userDao->insertObject($user);
                     $userId = $user->getId();
                     $role = new Role();
                     $role->setJournalId($journalId);
                     $role->setUserId($userId);
                     $role->setRoleId(ROLE_ID_READER);
                     $roleDao->insertRole($role);
                     $newUserAccount = true;
                 }
                 // Update gift status (make it redeemable) and add recipient user account reference
                 import('classes.gift.Gift');
                 $gift->setStatus(GIFT_STATUS_NOT_REDEEMED);
                 $gift->setRecipientUserId($userId);
                 $giftDao->updateObject($gift);
                 // Send gift available email to recipient, cc buyer
                 $giftNoteTitle = $gift->getGiftNoteTitle();
                 $buyerFullName = $gift->getBuyerFullName();
                 $giftNote = $gift->getGiftNote();
                 $giftLocale = $gift->getLocale();
                 AppLocale::requireComponents(LOCALE_COMPONENT_APP_COMMON, $giftLocale);
                 $giftDetails = $gift->getGiftName($giftLocale);
                 $giftJournalName = $journal->getName($giftLocale);
                 $giftContactSignature = $journal->getSetting('contactName');
                 import('lib.pkp.classes.mail.MailTemplate');
                 $mail = new MailTemplate('GIFT_AVAILABLE', $giftLocale);
                 $mail->setReplyTo(null);
                 $mail->assignParams(array('giftJournalName' => $giftJournalName, 'giftNoteTitle' => $giftNoteTitle, 'recipientFirstName' => $recipientFirstName, 'buyerFullName' => $buyerFullName, 'giftDetails' => $giftDetails, 'giftNote' => $giftNote, 'giftContactSignature' => $giftContactSignature));
                 $mail->addRecipient($recipientEmail, $user->getFullName());
                 $mail->addCc($gift->getBuyerEmail(), $gift->getBuyerFullName());
                 $mail->send();
                 unset($mail);
                 // Send gift login details to recipient
                 $params = array('giftJournalName' => $giftJournalName, 'recipientFirstName' => $recipientFirstName, 'buyerFullName' => $buyerFullName, 'giftDetails' => $giftDetails, 'giftUrl' => $request->url($journal->getPath(), 'user', 'gifts'), 'username' => $user->getUsername(), 'giftContactSignature' => $giftContactSignature);
                 if ($newUserAccount) {
                     $mail = new MailTemplate('GIFT_USER_REGISTER', $giftLocale);
                     $params['password'] = $password;
                 } else {
                     $mail = new MailTemplate('GIFT_USER_LOGIN', $giftLocale);
                 }
                 $mail->setReplyTo(null);
                 $mail->assignParams($params);
                 $mail->addRecipient($recipientEmail, $user->getFullName());
                 $mail->send();
                 unset($mail);
                 $returner = true;
                 break;
             case PAYMENT_TYPE_PURCHASE_ARTICLE:
             case PAYMENT_TYPE_PURCHASE_ISSUE:
             case PAYMENT_TYPE_DONATION:
             case PAYMENT_TYPE_SUBMISSION:
             case PAYMENT_TYPE_PUBLICATION:
                 $returner = true;
                 break;
             default:
                 // Invalid payment type
                 assert(false);
         }
     }
     $completedPaymentDao = DAORegistry::getDAO('OJSCompletedPaymentDAO');
     $completedPayment =& $this->createCompletedPayment($queuedPayment, $payMethodPluginName);
     $completedPaymentDao->insertCompletedPayment($completedPayment);
     $queuedPaymentDao = DAORegistry::getDAO('QueuedPaymentDAO');
     $queuedPaymentDao->deleteQueuedPayment($queuedPayment->getId());
     return $returner;
 }
开发者ID:pkp,项目名称:ojs,代码行数:101,代码来源:OJSPaymentManager.inc.php

示例13: sendMailingListEmail

 /**
  * Static function to send an email to a mailing list user e.g. regarding signup
  * @param $request PKPRequest
  * @param $email string
  * @param $token string the user's token (for confirming and unsubscribing)
  * @param $template string The mail template to use
  */
 function sendMailingListEmail(&$request, $email, $token, $template)
 {
     import('classes.mail.MailTemplate');
     $site = $request->getSite();
     $router =& $request->getRouter();
     $dispatcher =& $router->getDispatcher();
     $params = array('siteTitle' => $site->getLocalizedTitle(), 'unsubscribeLink' => $dispatcher->url($request, ROUTE_PAGE, null, 'notification', 'unsubscribeMailList', array($token)));
     if ($template == 'NOTIFICATION_MAILLIST_WELCOME') {
         $router =& $request->getRouter();
         $dispatcher =& $router->getDispatcher();
         $confirmLink = $dispatcher->url($request, ROUTE_PAGE, null, 'notification', 'confirmMailListSubscription', array($token));
         $params["confirmLink"] = $confirmLink;
     }
     $mail = new MailTemplate($template);
     $mail->setReplyTo($site->getLocalizedContactEmail(), $site->getLocalizedContactName());
     $mail->assignParams($params);
     $mail->addRecipient($email);
     $mail->send();
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:26,代码来源:PKPNotificationManager.inc.php

示例14: handle

 /**
  * Handle incoming requests/notifications
  * @param $args array
  * @param $request PKPRequest
  */
 function handle($args, &$request)
 {
     $user =& $request->getUser();
     $templateMgr =& TemplateManager::getManager();
     $journal =& $request->getJournal();
     if (!$journal) {
         return parent::handle($args, $request);
     }
     // Just in case we need to contact someone
     import('classes.mail.MailTemplate');
     // Prefer technical support contact
     $contactName = $journal->getSetting('supportName');
     $contactEmail = $journal->getSetting('supportEmail');
     if (!$contactEmail) {
         // Fall back on primary contact
         $contactName = $journal->getSetting('contactName');
         $contactEmail = $journal->getSetting('contactEmail');
     }
     $mail = new MailTemplate('DPS_INVESTIGATE_PAYMENT');
     $mail->setReplyTo(null);
     $mail->addRecipient($contactEmail, $contactName);
     $paymentStatus = $request->getUserVar('payment_status');
     @session_start();
     switch (array_shift($args)) {
         case 'purchase':
             error_log("Forming XML for transaction API call");
             try {
                 # get access to queuedPayment
                 $orderId = $_SESSION['dps_plugin_payment_id'];
                 import('classes.payment.ojs.OJSPaymentManager');
                 $ojsPaymentManager = new OJSPaymentManager($request);
                 $queuedPayment =& $ojsPaymentManager->getQueuedPayment($orderId);
                 if (!$queuedPayment) {
                     throw new Exception("OJS: DPS: No order for this transaction or transaction ID lost from session. See DPS statement for OJS order number: TxnData1.");
                 }
                 $amount = sprintf("%01.2f", $queuedPayment->amount);
                 $domDoc = new DOMDocument('1.0', 'UTF-8');
                 $rootElt = $domDoc->createElement('GenerateRequest');
                 $rootNode = $domDoc->appendChild($rootElt);
                 $rootNode->appendChild($domDoc->createElement('PxPayUserId', $this->getSetting($journal->getId(), 'dpsuser')));
                 $rootNode->appendChild($domDoc->createElement('PxPayKey', $this->getSetting($journal->getId(), 'dpskey')));
                 $rootNode->appendChild($domDoc->createElement('MerchantReference', $this->getSetting($journal->getId(), 'dpsmerchant')));
                 $rootNode->appendChild($domDoc->createElement('AmountInput', $amount));
                 $rootNode->appendChild($domDoc->createElement('CurrencyInput', 'NZD'));
                 $rootNode->appendChild($domDoc->createElement('TxnType', 'Purchase'));
                 $rootNode->appendChild($domDoc->createElement('TxnData1', $orderId));
                 $rootNode->appendChild($domDoc->createElement('TxnData2', $user->getUserName()));
                 $rootNode->appendChild($domDoc->createElement('EmailAddress', $user->getEmail()));
                 $rootNode->appendChild($domDoc->createElement('UrlSuccess', $request->url(null, 'payment', 'plugin', array($this->getName(), 'success'))));
                 $rootNode->appendChild($domDoc->createElement('UrlFail', $request->url(null, 'payment', 'plugin', array($this->getName(), 'failure'))));
                 $xmlRequest = $domDoc->saveXML();
                 if (!$xmlRequest) {
                     throw new Exception("DPS: Generating XML API call failed ", "119");
                 }
                 error_log("xmlrequest: " . print_r($xmlRequest, true));
                 $ch = curl_init();
                 curl_setopt($ch, CURLOPT_URL, $this->getSetting($journal->getId(), 'dpsurl'));
                 curl_setopt($ch, CURLOPT_POST, 1);
                 curl_setopt($ch, CURLOPT_POSTFIELDS, $domDoc->saveXML());
                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
                 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
                 curl_setopt($ch, CURLOPT_CAINFO, $this->getSetting($journal->getId(), 'dpscertpath'));
                 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
                 curl_setopt($ch, CURLOPT_TIMEOUT, 10);
                 $result = curl_exec($ch);
                 $curlError = curl_error($ch);
                 $curlErrorNo = curl_errno($ch);
                 curl_close($ch);
                 # check that we got a response
                 if ($result == false) {
                     error_log("DPS error: {$curlError} ({$curlErrorNo})");
                     throw new Exception("DPS error: {$curlError}", $curlErrorNo);
                 }
                 # make sure response is valid.
                 error_log("Parsing response XML");
                 libxml_use_internal_errors(true);
                 $rexml = simplexml_load_string($result);
                 error_log("XML response: " . print_r($rexml, true));
                 if (!$rexml) {
                     error_log("Invalid XML response from DPS");
                     throw new Exception("Invalid XML response from DPS");
                 }
                 # check URL exists in response
                 if (!isset($rexml->URI[0])) {
                     throw new Exception("URI not returned: " . $rexml->ResponseText[0]);
                 }
                 $payment_url = (string) $rexml->URI[0];
                 # redirect to that URL
                 header("Location: {$payment_url}");
                 exit;
             } catch (exception $e) {
                 @curl_close($ch);
                 error_log("Fatal error with credit card entry stage: " . $e->getCode() . ": " . $e->getMessage());
                 # create a notification about this error
//.........这里部分代码省略.........
开发者ID:robmint,项目名称:ojs-dps-plugin,代码行数:101,代码来源:DpsPlugin.inc.php

示例15: execute

 /**
  * Save review assignment
  * @param $args array
  * @param $request PKPRequest
  */
 function execute($args, $request)
 {
     $userDao = DAORegistry::getDAO('UserDAO');
     $user = $userDao->newDataObject();
     $user->setFirstName($this->getData('firstName'));
     $user->setMiddleName($this->getData('middleName'));
     $user->setLastName($this->getData('lastName'));
     $user->setEmail($this->getData('email'));
     $authDao = DAORegistry::getDAO('AuthSourceDAO');
     $auth = $authDao->getDefaultPlugin();
     $user->setAuthId($auth ? $auth->getAuthId() : 0);
     $user->setInlineHelp(1);
     // default new reviewers to having inline help visible
     $user->setUsername($this->getData('username'));
     $password = Validation::generatePassword();
     if (isset($auth)) {
         $user->setPassword($password);
         // FIXME Check result and handle failures
         $auth->doCreateUser($user);
         $user->setAuthId($auth->authId);
         $user->setPassword(Validation::encryptCredentials($user->getId(), Validation::generatePassword()));
         // Used for PW reset hash only
     } else {
         $user->setPassword(Validation::encryptCredentials($this->getData('username'), $password));
     }
     $user->setDateRegistered(Core::getCurrentDate());
     $reviewerId = $userDao->insertObject($user);
     // Set the reviewerId in the Form for the parent class to use
     $this->setData('reviewerId', $reviewerId);
     // Insert the user interests
     import('lib.pkp.classes.user.InterestManager');
     $interestManager = new InterestManager();
     $interestManager->setInterestsForUser($user, $this->getData('interests'));
     // Assign the selected user group ID to the user
     $userGroupDao = DAORegistry::getDAO('UserGroupDAO');
     /* @var $userGroupDao UserGroupDAO */
     $userGroupId = (int) $this->getData('userGroupId');
     $userGroupDao->assignUserToGroup($reviewerId, $userGroupId);
     if (!$this->getData('skipEmail')) {
         // Send welcome email to user
         import('lib.pkp.classes.mail.MailTemplate');
         $mail = new MailTemplate('REVIEWER_REGISTER');
         if ($mail->isEnabled()) {
             $context = $request->getContext();
             $mail->setReplyTo($context->getSetting('contactEmail'), $context->getSetting('contactName'));
             $mail->assignParams(array('username' => $this->getData('username'), 'password' => $password, 'userFullName' => $user->getFullName()));
             $mail->addRecipient($user->getEmail(), $user->getFullName());
             $mail->send($request);
         }
     }
     return parent::execute($args, $request);
 }
开发者ID:relaciones-internacionales-journal,项目名称:pkp-lib,代码行数:57,代码来源:CreateReviewerForm.inc.php


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