Commit 56f998af authored by asmecher's avatar asmecher
Browse files

#4245# Updated user ID getters / setters

parent e50d91eb
......@@ -46,7 +46,7 @@ class ArticleLog {
if ($entry->getUserId() == null) {
$user =& Request::getUser();
$entry->setUserId($user == null ? 0 : $user->getUserId());
$entry->setUserId($user == null ? 0 : $user->getId());
}
$logDao =& DAORegistry::getDAO('ArticleEventLogDAO');
......@@ -126,7 +126,7 @@ class ArticleLog {
if ($entry->getSenderId() == null) {
$user =& Request::getUser();
$entry->setSenderId($user == null ? 0 : $user->getUserId());
$entry->setSenderId($user == null ? 0 : $user->getId());
}
$logDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
......
......@@ -92,7 +92,7 @@ class AuthorSubmitForm extends Form {
foreach ($sectionEditors as $sectionEditorEntry) {
$editAssignment = new EditAssignment();
$editAssignment->setArticleId($article->getArticleId());
$editAssignment->setEditorId($sectionEditorEntry['user']->getUserId());
$editAssignment->setEditorId($sectionEditorEntry['user']->getId());
$editAssignment->setCanReview($sectionEditorEntry['canReview']);
$editAssignment->setCanEdit($sectionEditorEntry['canEdit']);
$editAssignmentDao->insertEditAssignment($editAssignment);
......
......@@ -48,7 +48,7 @@ class AuthorSubmitStep1Form extends AuthorSubmitForm {
// to submit to sections flagged as "editor-only" for submissions.
// Otherwise, display only sections they are allowed to submit to.
$roleDao =& DAORegistry::getDAO('RoleDAO');
$isEditor = $roleDao->roleExists($journal->getJournalId(), $user->getUserId(), ROLE_ID_EDITOR) || $roleDao->roleExists($journal->getJournalId(), $user->getUserId(), ROLE_ID_SECTION_EDITOR);
$isEditor = $roleDao->roleExists($journal->getJournalId(), $user->getId(), ROLE_ID_EDITOR) || $roleDao->roleExists($journal->getJournalId(), $user->getId(), ROLE_ID_SECTION_EDITOR);
// Set up required Payment Related Information
import('payment.ojs.OJSPaymentManager');
......@@ -113,7 +113,7 @@ class AuthorSubmitStep1Form extends AuthorSubmitForm {
$user =& Request::getUser();
$this->article = new Article();
$this->article->setUserId($user->getUserId());
$this->article->setUserId($user->getId());
$this->article->setJournalId($journal->getJournalId());
$this->article->setSectionId($this->getData('sectionId'));
$this->article->stampStatusModified();
......
......@@ -112,7 +112,7 @@ class AuthorSubmitStep5Form extends AuthorSubmitForm {
} elseif ( Request::getUserVar('paymentSent') ) {
return parent::validate();
} else {
$queuedPayment =& $paymentManager->createQueuedPayment($journalId, PAYMENT_TYPE_SUBMISSION, $user->getUserId(), $articleId, $journal->getSetting('submissionFee'));
$queuedPayment =& $paymentManager->createQueuedPayment($journalId, PAYMENT_TYPE_SUBMISSION, $user->getId(), $articleId, $journal->getSetting('submissionFee'));
$queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
$paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
......@@ -155,7 +155,7 @@ class AuthorSubmitStep5Form extends AuthorSubmitForm {
$copyeditAuthorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getArticleId());
$copyeditFinalSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $article->getArticleId());
$copyeditInitialSignoff->setUserId(0);
$copyeditAuthorSignoff->setUserId($user->getUserId());
$copyeditAuthorSignoff->setUserId($user->getId());
$copyeditFinalSignoff->setUserId(0);
$signoffDao->updateObject($copyeditInitialSignoff);
$signoffDao->updateObject($copyeditAuthorSignoff);
......@@ -168,7 +168,7 @@ class AuthorSubmitStep5Form extends AuthorSubmitForm {
$proofAuthorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getArticleId());
$proofProofreaderSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $article->getArticleId());
$proofLayoutEditorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getArticleId());
$proofAuthorSignoff->setUserId($user->getUserId());
$proofAuthorSignoff->setUserId($user->getId());
$proofProofreaderSignoff->setUserId(0);
$proofLayoutEditorSignoff->setUserId(0);
$signoffDao->updateObject($proofAuthorSignoff);
......@@ -220,7 +220,7 @@ class AuthorSubmitStep5Form extends AuthorSubmitForm {
import('article.log.ArticleLog');
import('article.log.ArticleEventLogEntry');
ArticleLog::logEvent($this->articleId, ARTICLE_LOG_ARTICLE_SUBMIT, ARTICLE_LOG_TYPE_AUTHOR, $user->getUserId(), 'log.author.submitted', array('submissionId' => $article->getArticleId(), 'authorName' => $user->getFullName()));
ArticleLog::logEvent($this->articleId, ARTICLE_LOG_ARTICLE_SUBMIT, ARTICLE_LOG_TYPE_AUTHOR, $user->getId(), 'log.author.submitted', array('submissionId' => $article->getArticleId(), 'authorName' => $user->getFullName()));
return $this->articleId;
}
......
......@@ -172,7 +172,7 @@ class CommentDAO extends DAO {
$comment->getArticleId(),
$comment->getChildCommentCount(),
$comment->getParentCommentId(),
(isset($user)?$user->getUserId():null),
(isset($user)?$user->getId():null),
$comment->getPosterIP(),
$comment->getTitle(),
$comment->getBody(),
......@@ -259,7 +259,7 @@ class CommentDAO extends DAO {
$comment->getArticleId(),
$comment->getChildCommentCount(),
$comment->getParentCommentId(),
(isset($user)?$user->getUserId():null),
(isset($user)?$user->getId():null),
$comment->getPosterIP(),
$comment->getTitle(),
$comment->getBody(),
......
......@@ -139,7 +139,7 @@ class Request extends PKPRequest {
function redirectHome() {
$roleDao =& DAORegistry::getDAO('RoleDAO');
$user = Request::getUser();
$userId = $user->getUserId();
$userId = $user->getId();
if ($journal =& Request::getJournal()) {
// The user is in the journal context, see if they have one role only
......
......@@ -46,9 +46,9 @@ class HandlerValidatorRoles extends HandlerValidator {
$returner = true;
foreach ( $this->roles as $roleId ) {
if ( $roleId == ROLE_ID_SITE_ADMIN ) {
$exists = $roleDao->roleExists(0, $user->getUserId(), $roleId);
$exists = $roleDao->roleExists(0, $user->getId(), $roleId);
} else {
$exists = $roleDao->roleExists($journalId, $user->getUserId(), $roleId);
$exists = $roleDao->roleExists($journalId, $user->getId(), $roleId);
}
if ( !$this->all && $exists) return true;
$returner = $returner && $exists;
......
......@@ -105,7 +105,7 @@ class Install extends PKPInstall {
$roleDao =& DAORegistry::getDao('RoleDAO', $this->dbconn);
$role = new Role();
$role->setJournalId(0);
$role->setUserId($user->getUserId());
$role->setUserId($user->getId());
$role->setRoleId(ROLE_ID_SITE_ADMIN);
if (!$roleDao->insertRole($role)) {
$this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg());
......
......@@ -82,7 +82,7 @@ class IssueAction {
$user =& Request::getUser();
if ($user && $journal) {
$journalId = $journal->getJournalId();
$userId = $user->getUserId();
$userId = $user->getId();
$subscriptionAssumedRoles = array(
ROLE_ID_JOURNAL_MANAGER,
ROLE_ID_EDITOR,
......@@ -121,7 +121,7 @@ class IssueAction {
if (IssueAction::allowedPrePublicationAccess($journal, $publishedArticle)) {
$result = true;
} else {
$result = $subscriptionDao->isValidSubscription(null, null, $user->getUserId(), $journal->getJournalId());
$result = $subscriptionDao->isValidSubscription(null, null, $user->getId(), $journal->getJournalId());
}
// If no valid subscription, check if there is an expired subscription
......@@ -130,14 +130,14 @@ class IssueAction {
if (isset($articleId)) {
if (isset($publishedArticle)) {
import('subscription.SubscriptionDAO');
$result = $subscriptionDao->isValidSubscription(null, null, $user->getUserId(), $journal->getJournalId(), SUBSCRIPTION_DATE_END, $publishedArticle->getDatePublished());
$result = $subscriptionDao->isValidSubscription(null, null, $user->getId(), $journal->getJournalId(), SUBSCRIPTION_DATE_END, $publishedArticle->getDatePublished());
}
} else if (isset($issueId)) {
$issueDao =& DAORegistry::getDAO('IssueDAO');
$issue =& $issueDao->getIssueById($issueId);
if (isset($issue) && $issue->getPublished()) {
import('subscription.SubscriptionDAO');
$result = $subscriptionDao->isValidSubscription(null, null, $user->getUserId(), $journal->getJournalId(), SUBSCRIPTION_DATE_END, $issue->getDatePublished());
$result = $subscriptionDao->isValidSubscription(null, null, $user->getId(), $journal->getJournalId(), SUBSCRIPTION_DATE_END, $issue->getDatePublished());
}
}
}
......
......@@ -73,7 +73,7 @@ class ArticleMailTemplate extends MailTemplate {
if (parent::send(false)) {
if (!isset($this->skip) || !$this->skip) $this->log();
$user =& Request::getUser();
if ($this->attachmentsEnabled) $this->_clearAttachments($user->getUserId());
if ($this->attachmentsEnabled) $this->_clearAttachments($user->getId());
return true;
} else {
......
......@@ -72,7 +72,7 @@ class AnnouncementForm extends PKPAnnouncementForm {
$allUsers = $roleDao->getUsersByJournalId($journalId);
while (!$allUsers->eof()) {
$user =& $allUsers->next();
$notificationUsers[] = array('id' => $user->getUserId());
$notificationUsers[] = array('id' => $user->getId());
unset($user);
}
$url = Request::url(null, 'announcement', 'view', array(1));
......
......@@ -68,7 +68,7 @@ class SectionForm extends Form {
*/
function includeSectionEditor($sectionEditorId) {
foreach ($this->sectionEditors as $key => $junk) {
if ($this->sectionEditors[$key]->getUserId() == $sectionEditorId) {
if ($this->sectionEditors[$key]->getId() == $sectionEditorId) {
$this->includeSectionEditor =& $this->sectionEditors[$key];
}
}
......@@ -80,7 +80,7 @@ class SectionForm extends Form {
*/
function omitSectionEditor($sectionEditorId) {
foreach ($this->sectionEditors as $key => $junk) {
if ($this->sectionEditors[$key]->getUserId() == $sectionEditorId) {
if ($this->sectionEditors[$key]->getId() == $sectionEditorId) {
$this->omitSectionEditor =& $this->sectionEditors[$key];
}
}
......@@ -168,10 +168,10 @@ class SectionForm extends Form {
foreach ($this->sectionEditors as $key => $junk) {
$sectionEditor =& $this->sectionEditors[$key]; // Ref
$userId = $sectionEditor->getUserId();
$userId = $sectionEditor->getId();
$isIncludeEditor = $this->includeSectionEditor && $this->includeSectionEditor->getUserId() == $userId;
$isOmitEditor = $this->omitSectionEditor && $this->omitSectionEditor->getUserId() == $userId;
$isIncludeEditor = $this->includeSectionEditor && $this->includeSectionEditor->getId() == $userId;
$isOmitEditor = $this->omitSectionEditor && $this->omitSectionEditor->getId() == $userId;
if ((in_array($userId, $assignedEditorIds) || $isIncludeEditor) && !$isOmitEditor) {
$assignedEditors[] = array(
'user' => &$sectionEditor,
......@@ -241,7 +241,7 @@ class SectionForm extends Form {
$sectionEditorsDao->deleteEditorsBySectionId($sectionId, $journalId);
foreach ($this->sectionEditors as $key => $junk) {
$sectionEditor =& $this->sectionEditors[$key];
$userId = $sectionEditor->getUserId();
$userId = $sectionEditor->getId();
// We don't have to worry about omit- and include-
// section editors because this function is only called
// when the Save button is pressed and those are only
......
......@@ -278,11 +278,11 @@ class UserManagementForm extends Form {
$auth =& $authDao->getPlugin($user->getAuthId());
}
if ($user->getUserId() != null) {
if ($user->getId() != null) {
if ($this->getData('password') !== '') {
if (isset($auth)) {
$auth->doSetUserPassword($user->getUsername(), $this->getData('password'));
$user->setPassword(Validation::encryptCredentials($user->getUserId(), Validation::generatePassword())); // Used for PW reset hash only
$user->setPassword(Validation::encryptCredentials($user->getId(), Validation::generatePassword())); // Used for PW reset hash only
} else {
$user->setPassword(Validation::encryptCredentials($user->getUsername(), $this->getData('password')));
}
......@@ -309,7 +309,7 @@ class UserManagementForm extends Form {
$user->setPassword($password);
// FIXME Check result and handle failures
$auth->doCreateUser($user);
$user->setAuthId($auth->authId); $user->setPassword(Validation::encryptCredentials($user->getUserId(), Validation::generatePassword())); // Used for PW reset hash only
$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));
}
......
......@@ -94,7 +94,7 @@ class NotificationSettingsForm extends PKPNotificationSettingsForm {
*/
function execute() {
$user = Request::getUser();
$userId = $user->getUserId();
$userId = $user->getId();
// Notification settings
$settings = array();
......
......@@ -160,7 +160,7 @@ class CreateReviewerForm extends Form {
// FIXME Check result and handle failures
$auth->doCreateUser($user);
$user->setAuthId($auth->authId);
$user->setPassword(Validation::encryptCredentials($user->getUserId(), Validation::generatePassword())); // Used for PW reset hash only
$user->setPassword(Validation::encryptCredentials($user->getId(), Validation::generatePassword())); // Used for PW reset hash only
} else {
$user->setPassword(Validation::encryptCredentials($this->getData('username'), $password));
}
......
......@@ -96,8 +96,8 @@ class Validation {
$sessionManager->regenerateSessionId();
$session =& $sessionManager->getUserSession();
$session->setSessionVar('userId', $user->getUserId());
$session->setUserId($user->getUserId());
$session->setSessionVar('userId', $user->getId());
$session->setUserId($user->getId());
$session->setSessionVar('username', $user->getUsername());
$session->setRemember($remember);
......@@ -201,7 +201,7 @@ class Validation {
$user =& $session->getUser();
$roleDao =& DAORegistry::getDAO('RoleDAO');
return $roleDao->roleExists($journalId, $user->getUserId(), $roleId);
return $roleDao->roleExists($journalId, $user->getId(), $roleId);
}
/**
......@@ -259,7 +259,7 @@ class Validation {
// No such user
return false;
}
return substr(md5($user->getUserId() . $user->getUsername() . $user->getPassword()), 0, 6);
return substr(md5($user->getId() . $user->getUsername() . $user->getPassword()), 0, 6);
}
/**
......
......@@ -253,7 +253,7 @@ class ImportOJS1 {
foreach ($admins->toArray() as $admin) {
$role = new Role();
$role->setJournalId($this->journalId);
$role->setUserId($admin->getUserId());
$role->setUserId($admin->getId());
$role->setRoleId(ROLE_ID_JOURNAL_MANAGER);
$roleDao->insertRole($role);
}
......@@ -622,7 +622,7 @@ class ImportOJS1 {
$userDao->insertUser($user);
}
$userId = $user->getUserId();
$userId = $user->getId();
if ($row['fkEditorID']) {
$role = new Role();
......
......@@ -114,7 +114,7 @@ class AuthorAction extends Action {
$user =& Request::getUser();
import('article.log.ArticleLog');
import('article.log.ArticleEventLogEntry');
ArticleLog::logEvent($authorSubmission->getArticleId(), ARTICLE_LOG_AUTHOR_REVISION, ARTICLE_LOG_TYPE_AUTHOR, $user->getUserId(), 'log.author.documentRevised', array('authorName' => $user->getFullName(), 'fileId' => $fileId, 'articleId' => $authorSubmission->getArticleId()));
ArticleLog::logEvent($authorSubmission->getArticleId(), ARTICLE_LOG_AUTHOR_REVISION, ARTICLE_LOG_TYPE_AUTHOR, $user->getId(), 'log.author.documentRevised', array('authorName' => $user->getFullName(), 'fileId' => $fileId, 'articleId' => $authorSubmission->getArticleId()));
}
}
......@@ -151,7 +151,7 @@ class AuthorAction extends Action {
$authorSignoff->setDateCompleted(Core::getCurrentDate());
$finalSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $authorSubmission->getArticleId());
$finalSignoff->setUserId($copyeditor->getUserId());
$finalSignoff->setUserId($copyeditor->getId());
$finalSignoff->setDateNotified(Core::getCurrentDate());
$signoffDao->updateObject($authorSignoff);
......@@ -160,7 +160,7 @@ class AuthorAction extends Action {
// Add log entry
import('article.log.ArticleLog');
import('article.log.ArticleEventLogEntry');
ArticleLog::logEvent($authorSubmission->getArticleId(), ARTICLE_LOG_COPYEDIT_REVISION, ARTICLE_LOG_TYPE_AUTHOR, $user->getUserId(), 'log.copyedit.authorFile');
ArticleLog::logEvent($authorSubmission->getArticleId(), ARTICLE_LOG_COPYEDIT_REVISION, ARTICLE_LOG_TYPE_AUTHOR, $user->getId(), 'log.copyedit.authorFile');
return true;
......
......@@ -295,7 +295,7 @@ class Action {
$articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO');
$comment =& $articleCommentDao->getArticleCommentById($commentId);
if ($comment->getAuthorId() == $user->getUserId()) {
if ($comment->getAuthorId() == $user->getId()) {
if (!HookRegistry::call('Action::deleteComment', array(&$comment))) {
$articleCommentDao->deleteArticleComment($comment);
}
......
......@@ -64,7 +64,7 @@ class CopyeditorAction extends Action {
$initialSignoff->setDateCompleted(Core::getCurrentDate());
$authorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $copyeditorSubmission->getArticleId());
$authorSignoff->setUserId($author->getUserId());
$authorSignoff->setUserId($author->getId());
$authorSignoff->setDateNotified(Core::getCurrentDate());
$signoffDao->updateObject($initialSignoff);
$signoffDao->updateObject($authorSignoff);
......@@ -73,7 +73,7 @@ class CopyeditorAction extends Action {
// Add log entry
import('article.log.ArticleLog');
import('article.log.ArticleEventLogEntry');
ArticleLog::logEvent($copyeditorSubmission->getArticleId(), ARTICLE_LOG_COPYEDIT_INITIAL, ARTICLE_LOG_TYPE_COPYEDIT, $user->getUserId(), 'log.copyedit.initialEditComplete', Array('copyeditorName' => $user->getFullName(), 'articleId' => $copyeditorSubmission->getArticleId()));
ArticleLog::logEvent($copyeditorSubmission->getArticleId(), ARTICLE_LOG_COPYEDIT_INITIAL, ARTICLE_LOG_TYPE_COPYEDIT, $user->getId(), 'log.copyedit.initialEditComplete', Array('copyeditorName' => $user->getFullName(), 'articleId' => $copyeditorSubmission->getArticleId()));
return true;
......@@ -145,7 +145,7 @@ class CopyeditorAction extends Action {
// Add log entry
import('article.log.ArticleLog');
import('article.log.ArticleEventLogEntry');
ArticleLog::logEvent($copyeditorSubmission->getArticleId(), ARTICLE_LOG_COPYEDIT_FINAL, ARTICLE_LOG_TYPE_COPYEDIT, $user->getUserId(), 'log.copyedit.finalEditComplete', Array('copyeditorName' => $user->getFullName(), 'articleId' => $copyeditorSubmission->getArticleId()));
ArticleLog::logEvent($copyeditorSubmission->getArticleId(), ARTICLE_LOG_COPYEDIT_FINAL, ARTICLE_LOG_TYPE_COPYEDIT, $user->getId(), 'log.copyedit.finalEditComplete', Array('copyeditorName' => $user->getFullName(), 'articleId' => $copyeditorSubmission->getArticleId()));
return true;
......@@ -203,7 +203,7 @@ class CopyeditorAction extends Action {
$user =& Request::getUser();
import('article.log.ArticleLog');
import('article.log.ArticleEventLogEntry');
ArticleLog::logEvent($copyeditorSubmission->getArticleId(), ARTICLE_LOG_COPYEDIT_INITIATE, ARTICLE_LOG_TYPE_COPYEDIT, $user->getUserId(), 'log.copyedit.initiate', Array('copyeditorName' => $user->getFullName(), 'articleId' => $copyeditorSubmission->getArticleId()));
ArticleLog::logEvent($copyeditorSubmission->getArticleId(), ARTICLE_LOG_COPYEDIT_INITIATE, ARTICLE_LOG_TYPE_COPYEDIT, $user->getId(), 'log.copyedit.initiate', Array('copyeditorName' => $user->getFullName(), 'articleId' => $copyeditorSubmission->getArticleId()));
}
}
}
......@@ -254,7 +254,7 @@ class CopyeditorAction extends Action {
$entry = new ArticleEventLogEntry();
$entry->setArticleId($copyeditorSubmission->getArticleId());
$entry->setUserId($user->getUserId());
$entry->setUserId($user->getId());
$entry->setDateLogged(Core::getCurrentDate());
$entry->setEventType(ARTICLE_LOG_COPYEDIT_COPYEDITOR_FILE);
$entry->setLogMessage('log.copyedit.copyeditorFile');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment