本文整理汇总了PHP中Validation::generatePasswordResetHash方法的典型用法代码示例。如果您正苦于以下问题:PHP Validation::generatePasswordResetHash方法的具体用法?PHP Validation::generatePasswordResetHash怎么用?PHP Validation::generatePasswordResetHash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Validation
的用法示例。
在下文中一共展示了Validation::generatePasswordResetHash方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initData
/**
* Initialize form data from the associated author.
* @param $args array
* @param $request PKPRequest
*/
function initData($args, $request)
{
$userDao = DAORegistry::getDAO('UserDAO');
$user = $request->getUser();
$context = $request->getContext();
$reviewAssignment = $this->getReviewAssignment();
$reviewerId = $reviewAssignment->getReviewerId();
$reviewer = $userDao->getById($reviewerId);
$submissionDao = Application::getSubmissionDAO();
$submission = $submissionDao->getById($reviewAssignment->getSubmissionId());
import('lib.pkp.classes.mail.SubmissionMailTemplate');
$email = new SubmissionMailTemplate($submission, 'REVIEW_REMIND');
// Format the review due date
$reviewDueDate = strtotime($reviewAssignment->getDateDue());
$dateFormatShort = Config::getVar('general', 'date_format_short');
if ($reviewDueDate == -1) {
$reviewDueDate = $dateFormatShort;
} else {
$reviewDueDate = strftime($dateFormatShort, $reviewDueDate);
}
$dispatcher = $request->getDispatcher();
$paramArray = array('reviewerName' => $reviewer->getFullName(), 'reviewDueDate' => $reviewDueDate, 'editorialContactSignature' => $user->getContactSignature(), 'reviewerUserName' => $reviewer->getUsername(), 'passwordResetUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getId()))), 'submissionReviewUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'reviewer', 'submission', null, array('submissionId' => $reviewAssignment->getSubmissionId())));
$email->assignParams($paramArray);
$this->setData('stageId', $reviewAssignment->getStageId());
$this->setData('reviewAssignmentId', $reviewAssignment->getId());
$this->setData('submissionId', $submission->getId());
$this->setData('reviewAssignment', $reviewAssignment);
$this->setData('reviewerName', $reviewer->getFullName() . ' <' . $reviewer->getEmail() . '>');
$this->setData('message', $email->getBody() . "\n" . $context->getSetting('emailSignature'));
}
示例2: sendReminder
function sendReminder($reviewAssignment, $article, $journal)
{
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$userDao =& DAORegistry::getDAO('UserDAO');
$reviewId = $reviewAssignment->getReviewId();
$reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
if (!isset($reviewer)) {
return false;
}
import('mail.ArticleMailTemplate');
$reviewerAccessKeysEnabled = $journal->getSetting('reviewerAccessKeysEnabled');
$email =& new ArticleMailTemplate($article, $reviewerAccessKeysEnabled ? 'REVIEW_REMIND_AUTO_ONECLICK' : 'REVIEW_REMIND_AUTO', null, false, $journal);
$email->setJournal($journal);
$email->setFrom($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
$email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
$email->setAssoc(ARTICLE_EMAIL_REVIEW_REMIND, ARTICLE_EMAIL_TYPE_REVIEW, $reviewId);
$email->setSubject($email->getSubject($journal->getPrimaryLocale()));
$email->setBody($email->getBody($journal->getPrimaryLocale()));
$urlParams = array();
if ($reviewerAccessKeysEnabled) {
import('security.AccessKeyManager');
$accessKeyManager =& new AccessKeyManager();
// Key lifetime is the typical review period plus four weeks
$keyLifetime = ($journal->getSetting('numWeeksPerReview') + 4) * 7;
$urlParams['key'] = $accessKeyManager->createKey('ReviewerContext', $reviewer->getUserId(), $reviewId, $keyLifetime);
}
$submissionReviewUrl = Request::url($journal->getPath(), 'reviewer', 'submission', $reviewId, $urlParams);
$paramArray = array('reviewerName' => $reviewer->getFullName(), 'reviewerUsername' => $reviewer->getUsername(), 'journalUrl' => $journal->getUrl(), 'reviewerPassword' => $reviewer->getPassword(), 'reviewDueDate' => strftime(Config::getVar('general', 'date_format_short'), strtotime($reviewAssignment->getDateDue())), 'editorialContactSignature' => $journal->getSetting('contactName') . "\n" . $journal->getJournalTitle(), 'passwordResetUrl' => Request::url($journal->getPath(), 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getUserId()))), 'submissionReviewUrl' => $submissionReviewUrl);
$email->assignParams($paramArray);
$email->send();
$reviewAssignment->setDateReminded(Core::getCurrentDate());
$reviewAssignment->setReminderWasAutomatic(1);
$reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
}
示例3: sendReminder
function sendReminder($reviewAssignment, $paper, $conference, $schedConf)
{
$reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
$userDao = DAORegistry::getDAO('UserDAO');
$reviewId = $reviewAssignment->getId();
$reviewer =& $userDao->getById($reviewAssignment->getReviewerId());
if (!isset($reviewer)) {
return false;
}
import('classes.mail.PaperMailTemplate');
$reviewerAccessKeysEnabled = $schedConf->getSetting('reviewerAccessKeysEnabled');
$email = new PaperMailTemplate($paper, $reviewerAccessKeysEnabled ? 'REVIEW_REMIND_AUTO_ONECLICK' : 'REVIEW_REMIND_AUTO', $conference->getPrimaryLocale(), false, $conference, $schedConf);
$email->setConference($conference);
$email->setSchedConf($schedConf);
$contactEmail = $schedConf->getSetting('contactEmail') ? $schedConf->getSetting('contactEmail') : $conference->getSetting('contactEmail');
$contactName = $schedConf->getSetting('contactName') ? $schedConf->getSetting('contactName') : $conference->getSetting('contactName');
$email->setFrom($contactEmail, $contactName);
$email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
$email->setAssoc(PAPER_EMAIL_REVIEW_REMIND, PAPER_EMAIL_TYPE_REVIEW, $reviewId);
$email->setSubject($email->getSubject($conference->getPrimaryLocale()));
$email->setBody($email->getBody($conference->getPrimaryLocale()));
$urlParams = array();
if ($reviewerAccessKeysEnabled) {
import('lib.pkp.classes.security.AccessKeyManager');
$accessKeyManager = new AccessKeyManager();
// Key lifetime is the typical review period plus four weeks
if ($schedConf->getSetting('reviewDeadlineType') == REVIEW_DEADLINE_TYPE_ABSOLUTE) {
// Get number of days from now until review deadline date
$reviewDeadlineDate = $schedConf->getSetting('numWeeksPerReviewAbsolute');
$daysDiff = ($reviewDeadlineDate - strtotime(date("Y-m-d"))) / (60 * 60 * 24);
$keyLifetime = (round($daysDiff / 7) + 4) * 7;
} elseif ($schedConf->getSetting('reviewDeadlineType') == REVIEW_DEADLINE_TYPE_RELATIVE) {
$keyLifetime = ((int) $schedConf->getSetting('numWeeksPerReviewRelative') + 4) * 7;
}
$urlParams['key'] = $accessKeyManager->createKey('ReviewerContext', $reviewer->getId(), $reviewId, $keyLifetime);
}
$submissionReviewUrl = Request::url($conference->getPath(), $schedConf->getPath(), 'reviewer', 'submission', $reviewId, $urlParams);
// Format the review due date
$reviewDueDate = strtotime($reviewAssignment->getDateDue());
$dateFormatShort = Config::getVar('general', 'date_format_short');
if ($reviewDueDate === -1 || $reviewDueDate === false) {
// Use something human-readable if unspecified.
$reviewDueDate = '_____';
} else {
$reviewDueDate = strftime($dateFormatShort, $reviewDueDate);
}
$paramArray = array('reviewerName' => $reviewer->getFullName(), 'reviewerUsername' => $reviewer->getUsername(), 'conferenceUrl' => Request::url($conference->getPath()), 'schedConfUrl' => Request::url($conference->getPath(), $schedConf->getPath()), 'reviewerPassword' => $reviewer->getPassword(), 'reviewDueDate' => $reviewDueDate, 'weekLaterDate' => strftime(Config::getVar('general', 'date_format_short'), strtotime('+1 week')), 'editorialContactSignature' => $contactName . "\n" . $schedConf->getLocalizedName(), 'passwordResetUrl' => Request::url($conference->getPath(), $schedConf->getPath(), 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getId()))), 'submissionReviewUrl' => $submissionReviewUrl);
$email->assignParams($paramArray);
$email->send();
$reviewAssignment->setDateReminded(Core::getCurrentDate());
$reviewAssignment->setReminderWasAutomatic(1);
$reviewAssignmentDao->updateObject($reviewAssignment);
}
示例4: sendReminder
function sendReminder($reviewAssignment, $article, $journal)
{
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$userDao =& DAORegistry::getDAO('UserDAO');
$reviewId = $reviewAssignment->getId();
$reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
if (!isset($reviewer)) {
return false;
}
import('classes.mail.ArticleMailTemplate');
$reviewerAccessKeysEnabled = $journal->getSetting('reviewerAccessKeysEnabled');
$email = new ArticleMailTemplate($article, $reviewerAccessKeysEnabled ? 'REVIEW_REMIND_AUTO_ONECLICK' : 'REVIEW_REMIND_AUTO', $journal->getPrimaryLocale(), false, $journal, false, true);
$email->setJournal($journal);
$email->setReplyTo(null);
$email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
$email->setSubject($email->getSubject($journal->getPrimaryLocale()));
$email->setBody($email->getBody($journal->getPrimaryLocale()));
$urlParams = array();
if ($reviewerAccessKeysEnabled) {
import('lib.pkp.classes.security.AccessKeyManager');
$accessKeyManager = new AccessKeyManager();
// Key lifetime is the typical review period plus four weeks
$keyLifetime = ($journal->getSetting('numWeeksPerReview') + 4) * 7;
$urlParams['key'] = $accessKeyManager->createKey('ReviewerContext', $reviewer->getId(), $reviewId, $keyLifetime);
}
$submissionReviewUrl = Request::url($journal->getPath(), 'reviewer', 'submission', $reviewId, $urlParams);
// Format the review due date
$reviewDueDate = strtotime($reviewAssignment->getDateDue());
$dateFormatShort = Config::getVar('general', 'date_format_short');
if ($reviewDueDate === -1 || $reviewDueDate === false) {
// Default to something human-readable if no date specified
$reviewDueDate = '_____';
} else {
$reviewDueDate = strftime($dateFormatShort, $reviewDueDate);
}
$paramArray = array('reviewerName' => $reviewer->getFullName(), 'reviewerUsername' => $reviewer->getUsername(), 'journalUrl' => $journal->getUrl(), 'reviewerPassword' => $reviewer->getPassword(), 'reviewDueDate' => $reviewDueDate, 'weekLaterDate' => strftime(Config::getVar('general', 'date_format_short'), strtotime('+1 week')), 'editorialContactSignature' => $journal->getSetting('contactName') . "\n" . $journal->getLocalizedTitle(), 'passwordResetUrl' => Request::url($journal->getPath(), 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getId()))), 'submissionReviewUrl' => $submissionReviewUrl);
$email->assignParams($paramArray);
$email->send();
$reviewAssignment->setDateReminded(Core::getCurrentDate());
$reviewAssignment->setReminderWasAutomatic(1);
$reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
}
示例5: initData
/**
* Initialize form data from the associated author.
* @param $args array
* @param $request PKPRequest
*/
function initData($args, $request)
{
$userDao = DAORegistry::getDAO('UserDAO');
$user = $request->getUser();
$context = $request->getContext();
$reviewAssignment = $this->getReviewAssignment();
$reviewerId = $reviewAssignment->getReviewerId();
$reviewer = $userDao->getById($reviewerId);
$submissionDao = Application::getSubmissionDAO();
$submission = $submissionDao->getById($reviewAssignment->getSubmissionId());
import('lib.pkp.classes.mail.SubmissionMailTemplate');
$email = new SubmissionMailTemplate($submission, 'REVIEW_ACK');
$dispatcher = $request->getDispatcher();
$email->assignParams(array('reviewerName' => $reviewer->getFullName(), 'editorialContactSignature' => $user->getContactSignature(), 'reviewerUserName' => $reviewer->getUsername(), 'passwordResetUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getId()))), 'submissionReviewUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'reviewer', 'submission', null, array('submissionId' => $reviewAssignment->getSubmissionId()))));
$email->replaceParams();
$this->setData('submissionId', $submission->getId());
$this->setData('stageId', $reviewAssignment->getStageId());
$this->setData('reviewAssignmentId', $reviewAssignment->getId());
$this->setData('reviewAssignment', $reviewAssignment);
$this->setData('reviewerName', $reviewer->getFullName() . ' <' . $reviewer->getEmail() . '>');
$this->setData('message', $email->getBody());
}
示例6: initData
/**
* Initialize form data from the associated submissionContributor.
* @param $args array
* @param $request PKPRequest
*/
function initData($args, &$request)
{
$userDao =& DAORegistry::getDAO('UserDAO');
$user =& $request->getUser();
$reviewAssignment =& $this->getReviewAssignment();
$reviewerId = $reviewAssignment->getReviewerId();
$reviewer =& $userDao->getUser($reviewerId);
$monographDao =& DAORegistry::getDAO('MonographDAO');
$monograph =& $monographDao->getMonograph($reviewAssignment->getSubmissionId());
import('classes.mail.MonographMailTemplate');
$email = new MonographMailTemplate($monograph, 'REVIEW_REMIND');
// Format the review due date
$reviewDueDate = strtotime($reviewAssignment->getDateDue());
$dateFormatShort = Config::getVar('general', 'date_format_short');
if ($reviewDueDate == -1) {
$reviewDueDate = $dateFormatShort;
} else {
$reviewDueDate = strftime($dateFormatShort, $reviewDueDate);
}
$paramArray = array('reviewerName' => $reviewer->getFullName(), 'reviewDueDate' => $reviewDueDate, 'editorialContactSignature' => $user->getContactSignature(), 'passwordResetUrl' => Request::url(null, 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getId()))), 'submissionReviewUrl' => Request::url(null, 'reviewer', 'submission', null, array('monographId' => $reviewAssignment->getMonographId())));
$email->assignParams($paramArray);
$this->_data = array('monographId' => $monograph->getId(), 'reviewAssignmentId' => $this->getReviewAssignmentId(), 'reviewAssignment' => $reviewAssignment, 'reviewerName' => $reviewer->getFullName(), 'message' => $email->getBody());
}
示例7: remindReviewer
/**
* Reminds a reviewer about a review assignment.
* @param $sectionEditorSubmission object
* @param $reviewId int
* @param $send boolean
* @param $request object
* @return boolean true iff no error was encountered
*/
function remindReviewer($sectionEditorSubmission, $reviewId, $send, $request)
{
$sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$userDao =& DAORegistry::getDAO('UserDAO');
$journal =& $request->getJournal();
$user =& $request->getUser();
$reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
$reviewerAccessKeysEnabled = $journal->getSetting('reviewerAccessKeysEnabled');
// If we're using access keys, disable the address fields
// for this message. (Prevents security issue: section editor
// could CC or BCC someone else, or change the reviewer address,
// in order to get the access key.)
$preventAddressChanges = $reviewerAccessKeysEnabled;
import('classes.mail.ArticleMailTemplate');
$email = new ArticleMailTemplate($sectionEditorSubmission, $reviewerAccessKeysEnabled ? 'REVIEW_REMIND_ONECLICK' : 'REVIEW_REMIND');
if ($preventAddressChanges) {
$email->setAddressFieldsEnabled(false);
}
if ($send && !$email->hasErrors()) {
HookRegistry::call('SectionEditorAction::remindReviewer', array(&$sectionEditorSubmission, &$reviewAssignment, &$email));
$reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
if ($reviewerAccessKeysEnabled) {
import('lib.pkp.classes.security.AccessKeyManager');
import('pages.reviewer.ReviewerHandler');
$accessKeyManager = new AccessKeyManager();
// Key lifetime is the typical review period plus four weeks
$keyLifetime = ($journal->getSetting('numWeeksPerReview') + 4) * 7;
$email->addPrivateParam('ACCESS_KEY', $accessKeyManager->createKey('ReviewerContext', $reviewer->getId(), $reviewId, $keyLifetime));
}
if ($preventAddressChanges) {
// Ensure that this messages goes to the reviewer, and the reviewer ONLY.
$email->clearAllRecipients();
$email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
}
$email->send($request);
$reviewAssignment->setDateReminded(Core::getCurrentDate());
$reviewAssignment->setReminderWasAutomatic(0);
$reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
return true;
} elseif ($reviewAssignment->getSubmissionId() == $sectionEditorSubmission->getId()) {
$reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
if (!$request->getUserVar('continued')) {
if (!isset($reviewer)) {
return true;
}
$email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
$submissionUrl = $request->url(null, 'reviewer', 'submission', $reviewId, $reviewerAccessKeysEnabled ? array('key' => 'ACCESS_KEY') : array());
// Format the review due date
$reviewDueDate = strtotime($reviewAssignment->getDateDue());
$dateFormatShort = Config::getVar('general', 'date_format_short');
if ($reviewDueDate === -1 || $reviewDueDate === false) {
// Default to something human-readable if no date specified
$reviewDueDate = '_____';
} else {
$reviewDueDate = strftime($dateFormatShort, $reviewDueDate);
}
$paramArray = array('reviewerName' => $reviewer->getFullName(), 'reviewerUsername' => $reviewer->getUsername(), 'reviewerPassword' => $reviewer->getPassword(), 'reviewDueDate' => $reviewDueDate, 'editorialContactSignature' => $user->getContactSignature(), 'passwordResetUrl' => $request->url(null, 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getId()))), 'submissionReviewUrl' => $submissionUrl);
$email->assignParams($paramArray);
}
$email->displayEditForm($request->url(null, null, 'remindReviewer', 'send'), array('reviewerId' => $reviewer->getId(), 'articleId' => $sectionEditorSubmission->getId(), 'reviewId' => $reviewId));
return false;
}
return true;
}
示例8: resetPassword
/**
* Reset a user's password
* @param $args array first param contains the username of the user whose password is to be reset
*/
function resetPassword($args)
{
$this->validate();
$this->setupTemplate();
$username = isset($args[0]) ? $args[0] : null;
$userDao =& DAORegistry::getDAO('UserDAO');
$confirmHash = Request::getUserVar('confirm');
if ($username == null || ($user =& $userDao->getUserByUsername($username)) == null) {
PKPRequest::redirect(null, null, 'lostPassword');
return;
}
$templateMgr =& TemplateManager::getManager();
$hash = Validation::generatePasswordResetHash($user->getId());
if ($hash == false || $confirmHash != $hash) {
$templateMgr->assign('errorMsg', 'user.login.lostPassword.invalidHash');
$templateMgr->assign('backLink', PKPRequest::url(null, null, 'lostPassword'));
$templateMgr->assign('backLinkLabel', 'user.login.resetPassword');
$templateMgr->display('common/error.tpl');
} else {
// Reset password
$newPassword = Validation::generatePassword();
if ($user->getAuthId()) {
$authDao =& DAORegistry::getDAO('AuthSourceDAO');
$auth =& $authDao->getPlugin($user->getAuthId());
}
if (isset($auth)) {
$auth->doSetUserPassword($user->getUsername(), $newPassword);
$user->setPassword(Validation::encryptCredentials($user->getId(), Validation::generatePassword()));
// Used for PW reset hash only
} else {
$user->setPassword(Validation::encryptCredentials($user->getUsername(), $newPassword));
}
$user->setMustChangePassword(1);
$userDao->updateObject($user);
// Send email with new password
$site =& Request::getSite();
import('classes.mail.MailTemplate');
$mail = new MailTemplate('PASSWORD_RESET');
$this->_setMailFrom($mail);
$mail->assignParams(array('username' => $user->getUsername(), 'password' => $newPassword, 'siteTitle' => $site->getLocalizedTitle()));
$mail->addRecipient($user->getEmail(), $user->getFullName());
$mail->send();
$templateMgr->assign('pageTitle', 'user.login.resetPassword');
$templateMgr->assign('message', 'user.login.lostPassword.passwordSent');
$templateMgr->assign('backLink', PKPRequest::url(null, Request::getRequestedPage()));
$templateMgr->assign('backLinkLabel', 'user.login');
$templateMgr->display('common/message.tpl');
}
}
示例9: execute
/**
* Save review assignment
* @param $args array
* @param $request PKPRequest
*/
function execute($args, $request)
{
$userDao = DAORegistry::getDAO('UserDAO');
$submissionDao = Application::getSubmissionDAO();
$reviewAssignment = $this->getReviewAssignment();
$reviewerId = $reviewAssignment->getReviewerId();
$reviewer = $userDao->getById($reviewerId);
$submission = $submissionDao->getById($reviewAssignment->getSubmissionId());
$reviewDueDate = $this->getData('reviewDueDate');
$dispatcher = $request->getDispatcher();
$user = $request->getUser();
import('lib.pkp.classes.mail.SubmissionMailTemplate');
$email = new SubmissionMailTemplate($submission, 'REVIEW_REMIND', null, null, null, false);
$email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
$email->setBody($this->getData('message'));
$email->assignParams(array('reviewerName' => $reviewer->getFullName(), 'reviewDueDate' => $reviewDueDate, 'passwordResetUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getId()))), 'submissionReviewUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'reviewer', 'submission', null, array('submissionId' => $reviewAssignment->getSubmissionId())), 'editorialContactSignature' => $user->getContactSignature()));
$email->send($request);
// update the ReviewAssignment with the reminded and modified dates
$reviewAssignment->setDateReminded(Core::getCurrentDate());
$reviewAssignment->stampModified();
$reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
$reviewAssignmentDao->updateObject($reviewAssignment);
}
示例10: sendReminder
/**
* Send the automatic review reminder to the reviewer.
* @param $reviewAssignment ReviewAssignment
* @param $submission Submission
* @param $context Context
* @param $reminderType string
* REVIEW_REMIND_AUTO, REVIEW_REQUEST_REMIND_AUTO
*/
function sendReminder($reviewAssignment, $submission, $context, $reminderType = REVIEW_REMIND_AUTO)
{
$reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
$userDao = DAORegistry::getDAO('UserDAO');
$reviewId = $reviewAssignment->getId();
$reviewer = $userDao->getById($reviewAssignment->getReviewerId());
if (!isset($reviewer)) {
return false;
}
import('lib.pkp.classes.mail.SubmissionMailTemplate');
$emailKey = $reminderType;
$reviewerAccessKeysEnabled = $context->getSetting('reviewerAccessKeysEnabled');
switch (true) {
case $reviewerAccessKeysEnabled && $reminderType == REVIEW_REMIND_AUTO:
$emailKey = 'REVIEW_REMIND_AUTO_ONECLICK';
break;
case $reviewerAccessKeysEnabled && $reminderType == REVIEW_REQUEST_REMIND_AUTO:
$emailKey = 'REVIEW_REQUEST_REMIND_AUTO_ONECLICK';
break;
}
$email = new SubmissionMailTemplate($submission, $emailKey, $context->getPrimaryLocale(), $context, false);
$email->setContext($context);
$email->setReplyTo(null);
$email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
$email->setSubject($email->getSubject($context->getPrimaryLocale()));
$email->setBody($email->getBody($context->getPrimaryLocale()));
$urlParams = array('submissionId' => $reviewAssignment->getSubmissionId());
if ($reviewerAccessKeysEnabled) {
import('lib.pkp.classes.security.AccessKeyManager');
$accessKeyManager = new AccessKeyManager();
// Key lifetime is the typical review period plus four weeks
$keyLifetime = ($context->getSetting('numWeeksPerReview') + 4) * 7;
$urlParams['key'] = $accessKeyManager->createKey('ReviewerContext', $reviewer->getId(), $reviewId, $keyLifetime);
}
$application = PKPApplication::getApplication();
$request = $application->getRequest();
$dispatcher = $application->getDispatcher();
$submissionReviewUrl = $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'reviewer', 'submission', null, $urlParams);
// Format the review due date
$reviewDueDate = strtotime($reviewAssignment->getDateDue());
$dateFormatShort = Config::getVar('general', 'date_format_short');
if ($reviewDueDate === -1 || $reviewDueDate === false) {
// Default to something human-readable if no date specified
$reviewDueDate = '_____';
} else {
$reviewDueDate = strftime($dateFormatShort, $reviewDueDate);
}
// Format the review response due date
$responseDueDate = strtotime($reviewAssignment->getDateResponseDue());
if ($responseDueDate === -1 || $responseDueDate === false) {
// Default to something human-readable if no date specified
$responseDueDate = '_____';
} else {
$responseDueDate = strftime($dateFormatShort, $responseDueDate);
}
AppLocale::requireComponents(LOCALE_COMPONENT_PKP_REVIEWER);
AppLocale::requireComponents(LOCALE_COMPONENT_PKP_COMMON);
$paramArray = array('reviewerName' => $reviewer->getFullName(), 'reviewerUserName' => $reviewer->getUsername(), 'reviewDueDate' => $reviewDueDate, 'responseDueDate' => $responseDueDate, 'editorialContactSignature' => $context->getSetting('contactName') . "\n" . $context->getLocalizedName(), 'passwordResetUrl' => $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getId()))), 'submissionReviewUrl' => $submissionReviewUrl, 'messageToReviewer' => __('reviewer.step1.requestBoilerplate'), 'abstractTermIfEnabled' => $submission->getLocalizedAbstract() == '' ? '' : __('common.abstract'));
$email->assignParams($paramArray);
$email->send();
$reviewAssignment->setDateReminded(Core::getCurrentDate());
$reviewAssignment->setReminderWasAutomatic(1);
$reviewAssignmentDao->updateObject($reviewAssignment);
}
示例11: requestResetPassword
/**
* Send a request to reset a user's password
*/
function requestResetPassword($args, &$request)
{
$this->validate();
$this->setupTemplate($request);
$templateMgr =& TemplateManager::getManager();
$email = $request->getUserVar('email');
$userDao =& DAORegistry::getDAO('UserDAO');
$user =& $userDao->getUserByEmail($email);
if ($user == null || ($hash = Validation::generatePasswordResetHash($user->getId())) == false) {
$templateMgr->assign('error', 'user.login.lostPassword.invalidUser');
$templateMgr->display('user/lostPassword.tpl');
} else {
$site =& $request->getSite();
// Send email confirming password reset
import('classes.mail.MailTemplate');
$mail = new MailTemplate('PASSWORD_RESET_CONFIRM');
$this->_setMailFrom($request, $mail, $site);
$mail->assignParams(array('url' => $request->url(null, 'login', 'resetPassword', $user->getUsername(), array('confirm' => $hash)), 'siteTitle' => $site->getLocalizedTitle()));
$mail->addRecipient($user->getEmail(), $user->getFullName());
$mail->send();
$templateMgr->assign('pageTitle', 'user.login.resetPassword');
$templateMgr->assign('message', 'user.login.lostPassword.confirmationSent');
$templateMgr->assign('backLink', $request->url(null, $request->getRequestedPage()));
$templateMgr->assign('backLinkLabel', 'user.login');
$templateMgr->display('common/message.tpl');
}
}
示例12: remindReviewer
/**
* Reminds a reviewer about a review assignment.
* @param $trackDirectorSubmission object
* @param $reviewId int
* @return boolean true iff no error was encountered
*/
function remindReviewer($trackDirectorSubmission, $reviewId, $send = false)
{
$trackDirectorSubmissionDao =& DAORegistry::getDAO('TrackDirectorSubmissionDAO');
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$userDao =& DAORegistry::getDAO('UserDAO');
$conference =& Request::getConference();
$schedConf =& Request::getSchedConf();
$user =& Request::getUser();
$reviewAssignment =& $reviewAssignmentDao->getReviewAssignmentById($reviewId);
$reviewerAccessKeysEnabled = $schedConf->getSetting('reviewerAccessKeysEnabled');
// If we're using access keys, disable the address fields
// for this message. (Prevents security issue: track director
// could CC or BCC someone else, or change the reviewer address,
// in order to get the access key.)
$preventAddressChanges = $reviewerAccessKeysEnabled;
import('mail.PaperMailTemplate');
$email = new PaperMailTemplate($trackDirectorSubmission, $reviewerAccessKeysEnabled ? 'REVIEW_REMIND_ONECLICK' : 'REVIEW_REMIND');
if ($preventAddressChanges) {
$email->setAddressFieldsEnabled(false);
}
if ($send && !$email->hasErrors()) {
HookRegistry::call('TrackDirectorAction::remindReviewer', array(&$trackDirectorSubmission, &$reviewAssignment, &$email));
$email->setAssoc(PAPER_EMAIL_REVIEW_REMIND, PAPER_EMAIL_TYPE_REVIEW, $reviewId);
$reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
if ($reviewerAccessKeysEnabled) {
import('security.AccessKeyManager');
import('pages.reviewer.ReviewerHandler');
$accessKeyManager = new AccessKeyManager();
// Key lifetime is the typical review period plus four weeks
if ($schedConf->getSetting('reviewDeadlineType') == REVIEW_DEADLINE_TYPE_ABSOLUTE) {
// Get number of days from now until review deadline date
$reviewDeadlineDate = strtotime($schedConf->getSetting('numWeeksPerReviewAbsolute'));
$daysDiff = ($reviewDeadlineDate - strtotime(date("Y-m-d"))) / (60 * 60 * 24);
$keyLifetime = (round($daysDiff / 7) + 4) * 7;
} elseif ($schedConf->getSetting('reviewDeadlineType') == REVIEW_DEADLINE_TYPE_RELATIVE) {
$keyLifetime = ((int) $schedConf->getSetting('numWeeksPerReviewRelative') + 4) * 7;
}
$email->addPrivateParam('ACCESS_KEY', $accessKeyManager->createKey('ReviewerContext', $reviewer->getId(), $reviewId, $keyLifetime));
}
if ($preventAddressChanges) {
// Ensure that this messages goes to the reviewer, and the reviewer ONLY.
$email->clearAllRecipients();
$email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
}
$email->send();
$reviewAssignment->setDateReminded(Core::getCurrentDate());
$reviewAssignment->setReminderWasAutomatic(0);
$reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
return true;
} elseif ($reviewAssignment->getPaperId() == $trackDirectorSubmission->getPaperId()) {
$reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
if (!Request::getUserVar('continued')) {
if (!isset($reviewer)) {
return true;
}
$email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
$submissionUrl = Request::url(null, null, 'reviewer', 'submission', $reviewId, $reviewerAccessKeysEnabled ? array('key' => 'ACCESS_KEY') : array());
//
// FIXME: Assign correct values!
//
$paramArray = array('reviewerName' => $reviewer->getFullName(), 'reviewerUsername' => $reviewer->getUsername(), 'reviewerPassword' => $reviewer->getPassword(), 'reviewDueDate' => strftime(Config::getVar('general', 'date_format_short'), strtotime($reviewAssignment->getDateDue())), 'editorialContactSignature' => $user->getContactSignature(), 'passwordResetUrl' => Request::url(null, null, 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getId()))), 'submissionReviewUrl' => $submissionUrl);
$email->assignParams($paramArray);
}
$email->displayEditForm(Request::url(null, null, null, 'remindReviewer', 'send'), array('reviewerId' => $reviewer->getId(), 'paperId' => $trackDirectorSubmission->getPaperId(), 'reviewId' => $reviewId));
return false;
}
return true;
}
示例13: initData
/**
* Initialize form data from the associated author.
* @param $args array
* @param $request PKPRequest
*/
function initData($args, $request)
{
$userDao = DAORegistry::getDAO('UserDAO');
$user = $request->getUser();
$context = $request->getContext();
$signoff = $this->getSignoff();
$auditorId = $signoff->getUserId();
$auditor = $userDao->getById($auditorId);
$submissionDao = Application::getSubmissionDAO();
$submission = $submissionDao->getById($this->getSubmissionId());
$email = $this->_getMailTemplate($submission);
// Format the review due date
$signoffDueDate = strtotime($signoff->getDateUnderway());
$dateFormatShort = Config::getVar('general', 'date_format_short');
if ($signoffDueDate == -1) {
$signoffDueDate = $dateFormatShort;
} else {
$signoffDueDate = strftime($dateFormatShort, $signoffDueDate);
}
import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider');
list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $submission, $auditor->getId());
$dispatcher = $request->getDispatcher();
$auditUrl = $dispatcher->url($request, ROUTE_PAGE, null, $page, $operation, array('submissionId' => $submission->getId()));
$paramArray = array('reviewerName' => $auditor->getFullName(), 'reviewDueDate' => $signoffDueDate, 'editorialContactSignature' => $user->getContactSignature(), 'auditorUserName' => $auditor->getUsername(), 'passwordResetUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'login', 'resetPassword', $auditor->getUsername(), array('confirm' => Validation::generatePasswordResetHash($auditor->getId()))), 'submissionReviewUrl' => $auditUrl, 'contextName' => $context->getLocalizedName(), 'submissionTitle' => $submission->getLocalizedTitle());
$email->assignParams($paramArray);
$this->setData('submissionId', $submission->getId());
$this->setData('stageId', $this->getStageId());
$this->setData('signoffId', $signoff->getId());
$this->setData('signoff', $signoff);
$this->setData('auditorName', $auditor->getFullName());
$this->setData('message', $email->getBody() . "\n" . $context->getSetting('emailSignature'));
}
示例14: verifyPasswordResetHash
/**
* Check if provided password reset hash is valid.
* @param $userId int
* @param $hash string
* @return boolean
*/
function verifyPasswordResetHash($userId, $hash)
{
// append ":" to ensure the explode results in at least 2 elements
list(, $expiry) = explode(':', $hash . ':');
if (empty($expiry) || (int) $expiry < time()) {
// expired
return false;
}
return $hash === Validation::generatePasswordResetHash($userId, $expiry);
}