/** * Get interests for reviewer interests autocomplete. * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function getInterests($args, $request) { // Get the input text used to filter on $filter = $request->getUserVar('term'); import('lib.pkp.classes.user.InterestManager'); $interestManager = new InterestManager(); $interests = $interestManager->getAllInterests($filter); import('lib.pkp.classes.core.JSONMessage'); return new JSONMessage(true, $interests); }
/** * Save roles settings. * @param $request PKPRequest */ function execute($request) { $user = $request->getUser(); // Save the roles import('lib.pkp.classes.user.form.UserFormHelper'); $userFormHelper = new UserFormHelper(); $userFormHelper->saveRoleContent($this, $user); // Insert the user interests import('lib.pkp.classes.user.InterestManager'); $interestManager = new InterestManager(); $interestManager->setInterestsForUser($user, $this->getData('interests')); parent::execute($request, $user); }
/** * 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); }
/** * Save review assignment * @param $args array * @param $request PKPRequest */ function execute($args, &$request) { $seriesEditorSubmissionDao =& DAORegistry::getDAO('SeriesEditorSubmissionDAO'); $submission =& $seriesEditorSubmissionDao->getSeriesEditorSubmission($this->getMonographId()); $press =& $request->getPress(); // FIXME: Bug #6199 $reviewType = $this->getData('reviewType'); $round = $this->getData('round'); $reviewDueDate = $this->getData('reviewDueDate'); $responseDueDate = $this->getData('responseDueDate'); $selectionType = (int) $this->getData('selectionType'); if ($selectionType == REVIEWER_SELECT_CREATE) { $userDao =& DAORegistry::getDAO('UserDAO'); $user = new User(); $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->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->insertUser($user); // Add reviewing interests to interests table import('lib.pkp.classes.user.InterestManager'); $interestManager = new InterestManager(); $interestManager->insertInterests($userId, $this->getData('interestsKeywords'), $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('sendNotify')) { // Send welcome email to user import('classes.mail.MailTemplate'); $mail = new MailTemplate('REVIEWER_REGISTER'); $mail->setFrom($press->getSetting('contactEmail'), $press->getSetting('contactName')); $mail->assignParams(array('username' => $this->getData('username'), 'password' => $password, 'userFullName' => $user->getFullName())); $mail->addRecipient($user->getEmail(), $user->getFullName()); $mail->send(); } } elseif ($selectionType == REVIEWER_SELECT_ENROLL) { // Assign a reviewer user group to an existing non-reviewer $userId = $this->getData('userId'); $userGroupId = $this->getData('userGroupId'); $userGroupId = $this->getData('userGroupId'); $userGroupDao =& DAORegistry::getDAO('UserGroupDAO'); /* @var $userGroupDao UserGroupDAO */ $userGroupDao->assignUserToGroup($userId, $userGroupId); // Set the reviewerId to the userId to return to the grid $reviewerId = $userId; } else { $reviewerId = $this->getData('reviewerId'); } import('classes.submission.seriesEditor.SeriesEditorAction'); $seriesEditorAction = new SeriesEditorAction(); $seriesEditorAction->addReviewer($submission, $reviewerId, $reviewType, $round, $reviewDueDate, $responseDueDate); // Get the reviewAssignment object now that it has been added $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); /* @var $reviewAssignmentDao ReviewAssignmentDAO */ $reviewAssignment =& $reviewAssignmentDao->getReviewAssignment($submission->getId(), $reviewerId, $round, $reviewType); $reviewAssignment->setDateNotified(Core::getCurrentDate()); $reviewAssignment->setCancelled(0); $reviewAssignment->stampModified(); $reviewAssignmentDao->updateObject($reviewAssignment); // Update the review round status if this is the first reviewer added $reviewRoundDao =& DAORegistry::getDAO('ReviewRoundDAO'); $currentReviewRound =& $reviewRoundDao->build($this->getMonographId(), $submission->getCurrentReviewType(), $submission->getCurrentRound()); if ($currentReviewRound->getStatus() == REVIEW_ROUND_STATUS_PENDING_REVIEWERS) { $currentReviewRound->setStatus(REVIEW_ROUND_STATUS_PENDING_REVIEWS); $reviewRoundDao->updateObject($currentReviewRound); } return $reviewAssignment; }
/** * Register a new user. * @param $request PKPRequest * @return int|null User ID, or false on failure */ function execute($request) { $requireValidation = Config::getVar('email', 'require_validation'); $userDao = DAORegistry::getDAO('UserDAO'); // New user $user = $userDao->newDataObject(); $user->setUsername($this->getData('username')); // Set the base user fields (name, etc.) $user->setFirstName($this->getData('firstName')); $user->setMiddleName($this->getData('middleName')); $user->setLastName($this->getData('lastName')); $user->setInitials($this->getData('initials')); $user->setEmail($this->getData('email')); $user->setCountry($this->getData('country')); $user->setAffiliation($this->getData('affiliation'), null); // Localized $user->setDateRegistered(Core::getCurrentDate()); $user->setInlineHelp(1); // default new users to having inline help visible. if (isset($this->defaultAuth)) { $user->setPassword($this->getData('password')); // FIXME Check result and handle failures $this->defaultAuth->doCreateUser($user); $user->setAuthId($this->defaultAuth->authId); } $user->setPassword(Validation::encryptCredentials($this->getData('username'), $this->getData('password'))); if ($requireValidation) { // The account should be created in a disabled // state. $user->setDisabled(true); $user->setDisabledReason(__('user.login.accountNotValidated')); } parent::execute($user); $userDao->insertObject($user); $userId = $user->getId(); if (!$userId) { return false; } // Associate the new user with the existing session $sessionManager = SessionManager::getManager(); $session = $sessionManager->getUserSession(); $session->setSessionVar('username', $user->getUsername()); // Save the roles import('lib.pkp.classes.user.form.UserFormHelper'); $userFormHelper = new UserFormHelper(); $userFormHelper->saveRoleContent($this, $user); // Insert the user interests import('lib.pkp.classes.user.InterestManager'); $interestManager = new InterestManager(); $interestManager->setInterestsForUser($user, $this->getData('interests')); import('lib.pkp.classes.mail.MailTemplate'); if ($requireValidation) { // Create an access key import('lib.pkp.classes.security.AccessKeyManager'); $accessKeyManager = new AccessKeyManager(); $accessKey = $accessKeyManager->createKey('RegisterContext', $user->getId(), null, Config::getVar('email', 'validation_timeout')); // Send email validation request to user $mail = new MailTemplate('USER_VALIDATE'); $this->_setMailFrom($request, $mail); $context = $request->getContext(); $mail->assignParams(array('userFullName' => $user->getFullName(), 'activateUrl' => $request->url($context->getPath(), 'user', 'activateUser', array($this->getData('username'), $accessKey)))); $mail->addRecipient($user->getEmail(), $user->getFullName()); $mail->send(); unset($mail); } return $userId; }
/** * 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'); $interestManager = new InterestManager(); $interestManager->setInterestsForUser($user, $this->getData('interests')); return $user; }
<?php require_once "functions.php"; require_once "InterestManager.class.php"; if (!isset($_SESSION['user_id'])) { header("Location: login.php"); //Ära enne suunamist midagi rohkem tee exit; } if (isset($_GET["logout"])) { session_destroy(); header("Location: login.php"); exit; } ##HALDUS## $InterestManager = new InterestManager($mysqli, $_SESSION['user_id']); if (isset($_GET["insert"])) { $int_name = $_GET["insert"]; $InterestManager->addInterest($int_name); $interest_response = $InterestManager->addInterest($int_name); } if (isset($_GET["dropdown_interest"])) { $InterestManager->addUserInterests($_SESSION['user_id'], $_GET["dropdown_interest"]); $user_int_response = $InterestManager->addUserInterests($_SESSION['user_id'], $_GET["dropdown_interest"]); var_dump($user_int_response); } ?> Tere, <?php echo $_SESSION['user_email']; ?>
/** * Register a new user. */ function execute() { $userDao =& DAORegistry::getDAO('UserDAO'); $journal =& Request::getJournal(); if (isset($this->userId)) { $user =& $userDao->getById($this->userId); } if (!isset($user)) { $user = new User(); } $user->setSalutation($this->getData('salutation')); $user->setFirstName($this->getData('firstName')); $user->setMiddleName($this->getData('middleName')); $user->setLastName($this->getData('lastName')); $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->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->setFrom($journal->getSetting('contactEmail'), $journal->getSetting('contactName')); $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); }
//kontrollin kas sessiooni muutuja olemas if (!isset($_SESSION['user_id'])) { header("Location: login.php"); //ära enne suunamist midagi tee exit; } // aadressireale tekkis ?logout=1 if (isset($_GET["logout"])) { //kustutame sessiooni muutujad session_destroy(); header("Location: login.php"); } //**************** //****HALDUS****** //**************** $InterestManager = new InterestManager($mysqli, $_SESSION['user_id']); if (isset($_GET["new_interest"])) { $add_interest_response = $InterestManager->addInterest($_GET["new_interest"]); } if (isset($_GET["dropdown_interest"])) { $add_user_interest_response = $InterestManager->addUserInterest($_GET["dropdown_interest"]); } ?> <p> Tere, <?php echo $_SESSION['user_email']; ?> <a href="?logout=1">Logi välja</a>
/** * Update user interests * @param $user */ function _updateUserInterests($user) { // 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); }
require_once "functions.php"; require_once "InterestManager.class.php"; //kontrollin, kas kasutaja ei ole sisseloginud if (!isset($_SESSION["id_from_db"])) { // suunan login lehele header("Location: login.php"); exit; } //login välja, aadressireal on ?logout=1 if (isset($_GET["logout"])) { //kustutab kõik sessiooni muutujad session_destroy(); header("Location: login.php"); exit; } $InterestManager = new InterestManager($mysqli); if (isset($_GET["new_interest"])) { $interests_response = $InterestManager->addInterest($_GET["new_interest"]); } if (isset($_GET["dropdownselect"])) { $added_user_interests = $InterestManager->addUserInterest($_GET["dropdownselect"], $_SESSION["id_from_db"]); } ?> <p> Tere, <?php echo $_SESSION["user_email"]; ?> <a href="?logout=1"> Logi välja</a> </p>
/** * Do the actual web SOAP service request. * @param $token string * @param $authToken string The token returned from _doAuthenticate * @return boolean|string True for success, an error message otherwise. */ function _doUserRequest($token, $authToken) { // Build the multipart SOAP message from scratch. $soapMessage = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.avectra.com/2005/"> <soapenv:Header> <ns:AuthorizationToken> <ns:Token>' . $authToken . '</ns:Token> </ns:AuthorizationToken> </soapenv:Header> <soapenv:Body> <ns:BNEGetIndividualInformation> <ns:SSOToken>' . $token . '</ns:SSOToken> </ns:BNEGetIndividualInformation> </soapenv:Body> </soapenv:Envelope>'; // Prepare HTTP session. $curlCh = curl_init(); curl_setopt($curlCh, CURLOPT_RETURNTRANSFER, true); curl_setopt($curlCh, CURLOPT_POST, true); // Set up SSL. curl_setopt($curlCh, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curlCh, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); // Make SOAP request. $ofrPlugin =& $this->_getObjectsForReviewPlugin(); $journal =& Request::getJournal(); curl_setopt($curlCh, CURLOPT_URL, $ofrPlugin->getSetting($journal->getId(), 'anthroNetSoapURL')); $extraHeaders = array('Host: avectra.aaanet.org', 'SOAPAction: "http://www.avectra.com/2005/BNEGetIndividualInformation"', 'Content-Type: text/xml;charset=UTF-8'); curl_setopt($curlCh, CURLOPT_HTTPHEADER, $extraHeaders); curl_setopt($curlCh, CURLOPT_POSTFIELDS, $soapMessage); $result = true; $response = curl_exec($curlCh); // We do not localize our error messages as they are all // fatal errors anyway and must be analyzed by technical staff. if ($response === false) { $result = 'OJS-OFR: Expected string response.'; } if ($result === true && ($status = curl_getinfo($curlCh, CURLINFO_HTTP_CODE)) != OFR_WS_RESPONSE_OK) { $result = 'OJS-OFR: Expected ' . OFR_WS_RESPONSE_OK . ' response code, got ' . $status . ' instead.'; } curl_close($curlCh); // Check SOAP response by simple string manipulation rather // than instantiating a DOM. if (is_string($response)) { $request = Application::getRequest(); /** * The XML returned looks something like this: * * <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> * <soap:Header><AuthorizationToken xmlns="http://www.avectra.com/2005/"><Token>2a51ca85-d490-4444-802c-d247259d674a</Token></AuthorizationToken></soap:Header> * <soap:Body> * <BNEGetIndividualInformationResponse xmlns="http://www.avectra.com/2005/"> * <BNEGetIndividualInformationResult> * <Individual xmlns=""> * <ind_cst_key>2a51ca85-d490-9999-802c-d24XX59d674a</ind_cst_key> * <cst_recno>000001</cst_recno> * <ind_first_name>John</ind_first_name> * <ind_last_name>Public</ind_last_name> * <cst_eml_address_dn>user@email.com</cst_eml_address_dn> * <InterestCodes><InterestCode>Art and Material Culture</InterestCode></InterestCodes> * </Individual> * </BNEGetIndividualInformationResult> * </BNEGetIndividualInformationResponse> * </soap:Body> * </soap:Envelope> */ $matches = array(); if (!preg_match('#<faultstring>([^<]*)</faultstring>#', $response)) { // Ensure that the user is logged into the AnthroNet portal. if (preg_match('#<ind_cst_key>00000000\\-0000\\-0000\\-0000\\-000000000000</ind_cst_key>#', $response)) { $request->redirect(null, 'user'); } else { $email = $firstName = $lastName = $interestCodes = null; $interestCodesArray = array(); if (preg_match('#<cst_eml_address_dn>(.*?)</cst_eml_address_dn>#', $response, $matches)) { $email = $matches[1]; } if (preg_match('#<ind_first_name>(.*?)</ind_first_name>#', $response, $matches)) { $firstName = $matches[1]; } if (preg_match('#<ind_last_name>(.*?)</ind_last_name>#', $response, $matches)) { $lastName = $matches[1]; } if (preg_match('#<InterestCodes>(.*?)</InterestCodes>#', $response, $matches)) { $interestCodes = $matches[1]; preg_match_all('#<InterestCode>(.*?)</InterestCode>#', $interestCodes, $matches, PREG_PATTERN_ORDER); if (is_array($matches[1])) { $interestCodesArray = $matches[1]; } } $userDao =& DAORegistry::getDAO('UserDAO'); // see if this user exists already. $user = $userDao->getUserByEmail($email); if (!$user) { $user = new User(); $userName = Validation::suggestUsername($firstName, $lastName); $user->setUsername($userName); $user->setFirstName($firstName); $user->setLastName($lastName); $user->setEmail($email); $user->setDateRegistered(Core::getCurrentDate()); $locales = array('en_US'); $user->setLocales($locales); $user->setPassword(Validation::encryptCredentials($userName, Validation::generatePassword())); $userDao->insertUser($user); } import('lib.pkp.classes.user.InterestManager'); $interestManager = new InterestManager(); $interestManager->setInterestsForUser($user, $interestCodesArray); // enroll as Author, if not already. $roleDao =& DAORegistry::getDAO('RoleDAO'); if (!$roleDao->userHasRole($journal->getId(), $user->getId(), ROLE_ID_AUTHOR)) { $role = new Role(); $role->setJournalId($journal->getId()); $role->setUserId($user->getId()); $role->setRoleId(ROLE_ID_AUTHOR); $roleDao->insertRole($role); } return $user; } } else { $result = 'OFR: ' . $status . ' - ' . $matches[1]; } } else { $result = 'OJS-OFR: Expected string response.'; } return false; }
<?php require_once "functions.php"; require_once "../classes/Confirm.class.php"; require_once "../classes/InterestManager.class.php"; if (!isset($_SESSION['logged_in_user_id'])) { header("Location: login.php"); } if (isset($_GET["logout"])) { //kustutame sessiooni muutujad session_destroy(); header("Location: login.php"); } $InterestManager = new InterestManager($mysqli, $_GET["id"]); $Confirm = new Confirm($mysqli); $contest_array = $Confirm->getAllData(); ?> <?php // lehe nimi $page_title = "Kasutaja info"; ?> <?php require_once "../header.php"; ?> <br><br> <div class="container"> <div class="row">
/** * Import the parsed users into the system. * @param $sendNotify boolean send an email notification to each imported user containing their username and password * @param $continueOnError boolean continue to import remaining users if a failure occurs * @return boolean success */ function importUsers($sendNotify = false, $continueOnError = false) { $success = true; $this->importedUsers = array(); $this->errors = array(); $userDao =& DAORegistry::getDAO('UserDAO'); $roleDao =& DAORegistry::getDAO('RoleDAO'); if ($sendNotify) { // Set up mail template to send to added users import('classes.mail.MailTemplate'); $mail = new MailTemplate('USER_REGISTER'); $journalDao =& DAORegistry::getDAO('JournalDAO'); $journal =& $journalDao->getJournal($this->journalId); $mail->setFrom($journal->getSetting('contactEmail'), $journal->getSetting('contactName')); } for ($i = 0, $count = count($this->usersToImport); $i < $count; $i++) { $user =& $this->usersToImport[$i]; // If the email address already exists in the system, // then assign the user the username associated with that email address. if ($user->getEmail() != null) { $emailExists = $userDao->getUserByEmail($user->getEmail(), true); if ($emailExists != null) { $user->setUsername($emailExists->getUsername()); } } if ($user->getUsername() == null) { $newUsername = true; $this->generateUsername($user); } else { $newUsername = false; } if ($user->getUnencryptedPassword() != null) { $user->setPassword(Validation::encryptCredentials($user->getUsername(), $user->getUnencryptedPassword())); } else { if ($user->getPassword() == null) { $this->generatePassword($user); } } if (!$newUsername) { // Check if user already exists $userExists = $userDao->getUserByUsername($user->getUsername(), true); if ($userExists != null) { $user->setId($userExists->getId()); } } else { $userExists = false; } if ($newUsername || !$userExists) { // Create new user account // If the user's username was specified in the data file and // the username already exists, only the new roles are added for that user if (!$userDao->insertUser($user)) { // Failed to add user! $this->errors[] = sprintf('%s: %s (%s)', __('manager.people.importUsers.failedToImportUser'), $user->getFullName(), $user->getUsername()); if ($continueOnError) { // Skip to next user $success = false; continue; } else { return false; } } } // Add reviewing interests to interests table $interests = $user->getTemporaryInterests(); $interests = explode(',', $interests); $interests = array_map('trim', $interests); // Trim leading whitespace import('lib.pkp.classes.user.InterestManager'); $interestManager = new InterestManager(); $interestManager->setInterestsForUser($user, $interests); // Enroll user in specified roles // If the user is already enrolled in a role, that role is skipped foreach ($user->getRoles() as $role) { $role->setUserId($user->getId()); $role->setJournalId($this->journalId); if (!$roleDao->roleExists($role->getJournalId(), $role->getUserId(), $role->getRoleId())) { if (!$roleDao->insertRole($role)) { // Failed to add role! $this->errors[] = sprintf('%s: %s - %s (%s)', __('manager.people.importUsers.failedToImportRole'), $role->getRoleName(), $user->getFullName(), $user->getUsername()); if ($continueOnError) { // Continue to insert other roles for this user $success = false; continue; } else { return false; } } } } if ($sendNotify && !$userExists) { // Send email notification to user as if user just registered themselves $mail->addRecipient($user->getEmail(), $user->getFullName()); $mail->sendWithParams(array('journalName' => $journal->getTitle($journal->getPrimaryLocale()), 'username' => $user->getUsername(), 'password' => $user->getUnencryptedPassword() == null ? '-' : $user->getUnencryptedPassword(), 'userFullName' => $user->getFullName())); $mail->clearRecipients(); } array_push($this->importedUsers, $user); } return $success; }
function &exportUsers(&$journal, &$users, $allowedRoles = null) { $roleDao =& DAORegistry::getDAO('RoleDAO'); $doc =& XMLCustomWriter::createDocument('users', USERS_DTD_ID, USERS_DTD_URL); $root =& XMLCustomWriter::createElement($doc, 'users'); foreach ($users as $user) { $userNode =& XMLCustomWriter::createElement($doc, 'user'); XMLCustomWriter::createChildWithText($doc, $userNode, 'username', $user->getUserName(), false); $passwordNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'password', $user->getPassword()); XMLCustomWriter::setAttribute($passwordNode, 'encrypted', Config::getVar('security', 'encryption')); XMLCustomWriter::createChildWithText($doc, $userNode, 'salutation', $user->getSalutation(), false); XMLCustomWriter::createChildWithText($doc, $userNode, 'first_name', $user->getFirstName()); XMLCustomWriter::createChildWithText($doc, $userNode, 'middle_name', $user->getMiddleName(), false); XMLCustomWriter::createChildWithText($doc, $userNode, 'last_name', $user->getLastName()); XMLCustomWriter::createChildWithText($doc, $userNode, 'initials', $user->getInitials(), false); XMLCustomWriter::createChildWithText($doc, $userNode, 'gender', $user->getGender(), false); XMLCustomWriter::createChildWithText($doc, $userNode, 'email', $user->getEmail()); XMLCustomWriter::createChildWithText($doc, $userNode, 'url', $user->getUrl(), false); XMLCustomWriter::createChildWithText($doc, $userNode, 'phone', $user->getPhone(), false); XMLCustomWriter::createChildWithText($doc, $userNode, 'fax', $user->getFax(), false); XMLCustomWriter::createChildWithText($doc, $userNode, 'mailing_address', $user->getMailingAddress(), false); XMLCustomWriter::createChildWithText($doc, $userNode, 'country', $user->getCountry(), false); if (is_array($user->getAffiliation(null))) { foreach ($user->getAffiliation(null) as $locale => $value) { $affiliationNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'affiliation', $value, false); if ($affiliationNode) { XMLCustomWriter::setAttribute($affiliationNode, 'locale', $locale); } unset($affiliationNode); } } if (is_array($user->getSignature(null))) { foreach ($user->getSignature(null) as $locale => $value) { $signatureNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'signature', $value, false); if ($signatureNode) { XMLCustomWriter::setAttribute($signatureNode, 'locale', $locale); } unset($signatureNode); } } import('lib.pkp.classes.user.InterestManager'); $interestManager = new InterestManager(); $interests = $interestManager->getInterestsForUser($user); if (is_array($interests)) { foreach ($interests as $interest) { XMLCustomWriter::createChildWithText($doc, $userNode, 'interests', $interest, false); } } if (is_array($user->getGossip(null))) { foreach ($user->getGossip(null) as $locale => $value) { $gossipNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'gossip', $value, false); if ($gossipNode) { XMLCustomWriter::setAttribute($gossipNode, 'locale', $locale); } unset($gossipNode); } } if (is_array($user->getBiography(null))) { foreach ($user->getBiography(null) as $locale => $value) { $biographyNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'biography', $value, false); if ($biographyNode) { XMLCustomWriter::setAttribute($biographyNode, 'locale', $locale); } unset($biographyNode); } } XMLCustomWriter::createChildWithText($doc, $userNode, 'locales', join(':', $user->getLocales()), false); $roles =& $roleDao->getRolesByUserId($user->getId(), $journal->getId()); foreach ($roles as $role) { $rolePath = $role->getRolePath(); if ($allowedRoles !== null && !in_array($rolePath, $allowedRoles)) { continue; } $roleNode =& XMLCustomWriter::createElement($doc, 'role'); XMLCustomWriter::setAttribute($roleNode, 'type', $rolePath); XMLCustomWriter::appendChild($userNode, $roleNode); unset($roleNode); } XMLCustomWriter::appendChild($root, $userNode); } XMLCustomWriter::appendChild($doc, $root); return $doc; }
/** * Get the user's interests displayed as a comma-separated string * @return string */ function getInterestString() { import('lib.pkp.classes.user.InterestManager'); $interestManager = new InterestManager(); return $interestManager->getInterestsString($this); }
/** * Register a new user. * @return userId int */ function execute() { $userDao =& DAORegistry::getDAO('UserDAO'); $user = new User(); $user->setSalutation($this->getData('salutation')); $user->setFirstName($this->getData('firstName')); $user->setMiddleName($this->getData('middleName')); $user->setLastName($this->getData('lastName')); $user->setGender($this->getData('gender')); $user->setInitials($this->getData('initials')); $user->setAffiliation($this->getData('affiliation'), 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 $authDao =& DAORegistry::getDAO('AuthSourceDAO'); $auth =& $authDao->getDefaultPlugin(); $user->setAuthId($auth ? $auth->getAuthId() : 0); $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); $user->setUsername($this->getData('username')); $password = Validation::generatePassword(); $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->setMustChangePassword(isset($auth) ? 0 : 1); $user->setDateRegistered(Core::getCurrentDate()); parent::execute($user); $userId = $userDao->insertUser($user); // 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); $roleDao =& DAORegistry::getDAO('RoleDAO'); $journal =& Request::getJournal(); $role = new Role(); $role->setJournalId($journal->getId()); $role->setUserId($userId); $role->setRoleId(ROLE_ID_REVIEWER); $roleDao->insertRole($role); if ($sendNotify) { // Send welcome email to user import('classes.mail.MailTemplate'); $mail = new MailTemplate('REVIEWER_REGISTER'); $mail->setReplyTo(null); $mail->assignParams(array('username' => $this->getData('username'), 'password' => $password, 'userFullName' => $user->getFullName())); $mail->addRecipient($user->getEmail(), $user->getFullName()); $mail->send(); } return $userId; }
/** * Initialize form data from current settings. */ function initData() { $user = $this->getUser(); import('lib.pkp.classes.user.InterestManager'); $interestManager = new InterestManager(); $this->_data = array('salutation' => $user->getSalutation(), 'firstName' => $user->getFirstName(), 'middleName' => $user->getMiddleName(), 'initials' => $user->getInitials(), 'lastName' => $user->getLastName(), 'suffix' => $user->getSuffix(), 'gender' => $user->getGender(), 'affiliation' => $user->getAffiliation(null), 'signature' => $user->getSignature(null), 'email' => $user->getEmail(), 'userUrl' => $user->getUrl(), 'phone' => $user->getPhone(), 'fax' => $user->getFax(), 'mailingAddress' => $user->getMailingAddress(), 'country' => $user->getCountry(), 'biography' => $user->getBiography(null), 'userLocales' => $user->getLocales(), 'interestsKeywords' => $interestManager->getInterestsForUser($user), 'interestsTextOnly' => $interestManager->getInterestsString($user)); }
/** * Create and return a user node. * @param $doc DOMDocument * @param $user PKPUser * @return DOMElement */ function createPKPUserNode($doc, $user) { $deployment = $this->getDeployment(); $context = $deployment->getContext(); // Create the user node $userNode = $doc->createElementNS($deployment->getNamespace(), 'user'); // Add metadata $userNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'firstname', $user->getFirstName())); $this->createOptionalNode($doc, $userNode, 'middlename', $user->getMiddleName()); $userNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'lastname', $user->getLastName())); if (is_array($user->getAffiliation(null))) { $this->createLocalizedNodes($doc, $userNode, 'affiliation', $user->getAffiliation(null)); } $this->createOptionalNode($doc, $userNode, 'country', $user->getCountry()); $userNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'email', $user->getEmail())); $this->createOptionalNode($doc, $userNode, 'url', $user->getUrl()); if (is_array($user->getBiography(null))) { $this->createLocalizedNodes($doc, $userNode, 'biography', $user->getBiography(null)); } $userNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'username', $user->getUsername())); if (is_array($user->getGossip(null))) { $this->createLocalizedNodes($doc, $userNode, 'gossip', $user->getGossip(null)); } if (is_array($user->getSignature(null))) { $this->createLocalizedNodes($doc, $userNode, 'signature', $user->getSignature(null)); } $passwordNode = $doc->createElementNS($deployment->getNamespace(), 'password'); $passwordNode->setAttribute('is_disabled', $user->getDisabled() ? 'true' : 'false'); $passwordNode->setAttribute('must_change', $user->getMustChangePassword() ? 'true' : 'false'); $passwordNode->setAttribute('encryption', Config::getVar('security', 'encryption')); $passwordNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'value', $user->getPassword())); $userNode->appendChild($passwordNode); $this->createOptionalNode($doc, $userNode, 'salutation', $user->getSalutation()); $this->createOptionalNode($doc, $userNode, 'initials', $user->getInitials()); $this->createOptionalNode($doc, $userNode, 'suffix', $user->getSuffix()); $this->createOptionalNode($doc, $userNode, 'gender', $user->getGender()); $this->createOptionalNode($doc, $userNode, 'date_registered', $user->getDateRegistered()); $this->createOptionalNode($doc, $userNode, 'date_last_login', $user->getDateLastLogin()); $this->createOptionalNode($doc, $userNode, 'date_last_email', $user->getDateLastEmail()); $this->createOptionalNode($doc, $userNode, 'date_validated', $user->getDateValidated()); $this->createOptionalNode($doc, $userNode, 'inline_help', $user->getInlineHelp() ? 'true' : 'false'); $this->createOptionalNode($doc, $userNode, 'auth_id', $user->getAuthId()); $this->createOptionalNode($doc, $userNode, 'auth_string', $user->getAuthStr()); $this->createOptionalNode($doc, $userNode, 'fax', $user->getFax()); $this->createOptionalNode($doc, $userNode, 'phone', $user->getPhone()); $this->createOptionalNode($doc, $userNode, 'mailing_address', $user->getMailingAddress()); $this->createOptionalNode($doc, $userNode, 'billing_address', $user->getBillingAddress()); $this->createOptionalNode($doc, $userNode, 'locales', join(':', $user->getLocales())); if ($user->getDisabled()) { $this->createOptionalNode($doc, $userNode, 'disabled_reason', $user->getDisabledReason()); } $userGroupAssignmentDao = DAORegistry::getDAO('UserGroupAssignmentDAO'); $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); $assignedGroups = $userGroupAssignmentDao->getByUserId($user->getId(), $context->getId()); while ($assignedGroup = $assignedGroups->next()) { $userGroup = $userGroupDao->getById($assignedGroup->getUserGroupId()); if ($userGroup) { $userNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'user_group_ref', $userGroup->getName($context->getPrimaryLocale()))); } } // Add Reviewing Interests, if any. import('lib.pkp.classes.user.InterestManager'); $interestManager = new InterestManager(); $interests = $interestManager->getInterestsString($user); $this->createOptionalNode($doc, $userNode, 'review_interests', $interests); return $userNode; }
require_once "functions.php"; require_once "InterestManager.class.php"; if (!isset($_SESSION["user_id"])) { header("Location: login.php"); exit; } if (isset($_GET["logout"])) { session_destroy(); header("Location: login.php"); exit; } //*************** //** HALDUS ***** //*************** $InterestManager = new InterestManager($mysqli, $_SESSION["user_id"]); if (isset($_GET["new_interest"])) { $add_interest_response = $InterestManager->addInterest($_GET["new_interest"]); } ?> <?php if (isset($add_interest_response->success)) { ?> <p style="color:green;"> <?php echo $add_interest_response->success->message; ?> </p>
/** * Save profile settings. */ function execute() { $user =& Request::getUser(); $user->setSalutation($this->getData('salutation')); $user->setFirstName($this->getData('firstName')); $user->setMiddleName($this->getData('middleName')); $user->setLastName($this->getData('lastName')); $user->setGender($this->getData('gender')); $user->setInitials($this->getData('initials')); $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->setFax($this->getData('fax')); $user->setMailingAddress($this->getData('mailingAddress')); $user->setCountry($this->getData('country')); $user->setBiography($this->getData('biography'), null); // Localized // Add reviewing interests to interests table import('lib.pkp.classes.user.InterestManager'); $interestManager = new InterestManager(); $interestManager->insertInterests($userId, $this->getData('interestsKeywords'), $this->getData('interests')); $site =& Request::getSite(); $availableLocales = $site->getSupportedLocales(); $locales = array(); foreach ($this->getData('userLocales') as $locale) { if (Locale::isLocaleValid($locale) && in_array($locale, $availableLocales)) { array_push($locales, $locale); } } $user->setLocales($locales); $userDao =& DAORegistry::getDAO('UserDAO'); $userDao->updateObject($user); $userGroupDao =& DAORegistry::getDAO('UserGroupDAO'); $pressDao =& DAORegistry::getDAO('PressDAO'); $notificationStatusDao =& DAORegistry::getDAO('NotificationStatusDAO'); // Roles $press =& Request::getPress(); if ($press) { if ($press->getSetting('allowRegReviewer')) { foreach ($this->getData('reviewerGroup') as $groupId => $wantsGroup) { $inGroup = $userGroupDao->userInGroup($user->getId(), $groupId); if ($inGroup && !$wantsGroup) { $userGroupDao->removeUserFromGroup($user->getId(), $groupId); } if (!$hasRole && $wantsRole) { $userGroupDao->assignUserToGroup($user->getId(), $groupId); } } } if ($press->getSetting('allowRegAuthor')) { foreach ($this->getData('authorGroup') as $groupId => $wantsGroup) { $inGroup = $userGroupDao->userInGroup($user->getId(), $groupId); if ($inGroup && !$wantsGroup) { $userGroupDao->removeUserFromGroup($user->getId(), $groupId); } if (!$hasRole && $wantsRole) { $userGroupDao->assignUserToGroup($user->getId(), $groupId); } } } if ($press->getSetting('allowRegReader')) { foreach ($this->getData('readerGroup') as $groupId => $wantsGroup) { $inGroup = $userGroupDao->userInGroup($user->getId(), $groupId); if ($inGroup && !$wantsGroup) { $userGroupDao->removeUserFromGroup($user->getId(), $groupId); } if (!$hasRole && $wantsRole) { $userGroupDao->assignUserToGroup($user->getId(), $groupId); } } } } $presses =& $pressDao->getPresses(); $presses =& $presses->toArray(); $pressNotifications = $notificationStatusDao->getPressNotifications($user->getId()); $readerNotify = Request::getUserVar('pressNotify'); foreach ($presses as $thisPress) { $thisPressId = $thisPress->getId(); $currentlyReceives = !empty($pressNotifications[$thisPressId]); $shouldReceive = !empty($readerNotify) && in_array($thisPress->getId(), $readerNotify); if ($currentlyReceives != $shouldReceive) { $notificationStatusDao->setPressNotifications($thisPressId, $user->getId(), $shouldReceive); } } $userSettingsDao =& DAORegistry::getDAO('UserSettingsDAO'); if ($user->getAuthId()) { $authDao =& DAORegistry::getDAO('AuthSourceDAO'); $auth =& $authDao->getPlugin($user->getAuthId()); } if (isset($auth)) { $auth->doSetUserInfo($user); } }
/** * Register a new user. */ function execute() { $requireValidation = Config::getVar('email', 'require_validation'); if ($this->existingUser) { // If using implicit auth - we hardwire that we are working on an existing user // Existing user in the system $userDao =& DAORegistry::getDAO('UserDAO'); if ($this->implicitAuth) { // If we are using implicit auth - then use the session username variable - rather than data from the form $sessionManager =& SessionManager::getManager(); $session =& $sessionManager->getUserSession(); $user =& $userDao->getUserByUsername($session->getSessionVar('username')); } else { $user =& $userDao->getUserByUsername($this->getData('username')); } if ($user == null) { return false; } $userId = $user->getId(); } else { // New user $user = new User(); $user->setUsername($this->getData('username')); $user->setSalutation($this->getData('salutation')); $user->setFirstName($this->getData('firstName')); $user->setMiddleName($this->getData('middleName')); $user->setInitials($this->getData('initials')); $user->setLastName($this->getData('lastName')); $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->setFax($this->getData('fax')); $user->setMailingAddress($this->getData('mailingAddress')); $user->setBiography($this->getData('biography'), null); // Localized $user->setDateRegistered(Core::getCurrentDate()); $user->setCountry($this->getData('country')); $site =& Request::getSite(); $availableLocales = $site->getSupportedLocales(); $locales = array(); foreach ($this->getData('userLocales') as $locale) { if (Locale::isLocaleValid($locale) && in_array($locale, $availableLocales)) { array_push($locales, $locale); } } $user->setLocales($locales); if (isset($this->defaultAuth)) { $user->setPassword($this->getData('password')); // FIXME Check result and handle failures $this->defaultAuth->doCreateUser($user); $user->setAuthId($this->defaultAuth->authId); } $user->setPassword(Validation::encryptCredentials($this->getData('username'), $this->getData('password'))); if ($requireValidation) { // The account should be created in a disabled // state. $user->setDisabled(true); $user->setDisabledReason(Locale::translate('user.login.accountNotValidated')); } $userDao =& DAORegistry::getDAO('UserDAO'); $userDao->insertUser($user); $userId = $user->getId(); if (!$userId) { return false; } // Add reviewing interests to interests table import('lib.pkp.classes.user.InterestManager'); $interestManager = new InterestManager(); $interestManager->insertInterests($userId, $this->getData('interestsKeywords'), $this->getData('interests')); $sessionManager =& SessionManager::getManager(); $session =& $sessionManager->getUserSession(); $session->setSessionVar('username', $user->getUsername()); } $press =& Request::getPress(); $roleDao =& DAORegistry::getDAO('RoleDAO'); // Roles users are allowed to register themselves in $allowedRoles = array('reader' => 'registerAsReader', 'author' => 'registerAsAuthor', 'reviewer' => 'registerAsReviewer'); $pressSettingsDao =& DAORegistry::getDAO('PressSettingsDAO'); if (!$pressSettingsDao->getSetting($press->getId(), 'allowRegReader')) { unset($allowedRoles['reader']); } if (!$pressSettingsDao->getSetting($press->getId(), 'allowRegAuthor')) { unset($allowedRoles['author']); } if (!$pressSettingsDao->getSetting($press->getId(), 'allowRegReviewer')) { unset($allowedRoles['reviewer']); } foreach ($allowedRoles as $k => $v) { $roleId = $roleDao->getRoleIdFromPath($k); if ($this->getData($v) && !$roleDao->userHasRole($press->getId(), $userId, $roleId)) { $role = new Role(); $role->setPressId($press->getId()); $role->setUserId($userId); $role->setRoleId($roleId); $roleDao->insertRole($role); } } if (!$this->existingUser) { import('classes.mail.MailTemplate'); if ($requireValidation) { // Create an access key import('lib.pkp.classes.security.AccessKeyManager'); $accessKeyManager = new AccessKeyManager(); $accessKey = $accessKeyManager->createKey('RegisterContext', $user->getId(), null, Config::getVar('email', 'validation_timeout')); // Send email validation request to user $mail = new MailTemplate('USER_VALIDATE'); $mail->setFrom($press->getSetting('contactEmail'), $press->getSetting('contactName')); $mail->assignParams(array('userFullName' => $user->getFullName(), 'activateUrl' => Request::url($press->getPath(), 'user', 'activateUser', array($this->getData('username'), $accessKey)))); $mail->addRecipient($user->getEmail(), $user->getFullName()); $mail->send(); unset($mail); } if ($this->getData('sendPassword')) { // Send welcome email to user $mail = new MailTemplate('USER_REGISTER'); $mail->setFrom($press->getSetting('contactEmail'), $press->getSetting('contactName')); $mail->assignParams(array('username' => $this->getData('username'), 'password' => String::substr($this->getData('password'), 0, 30), 'userFullName' => $user->getFullName())); $mail->addRecipient($user->getEmail(), $user->getFullName()); $mail->send(); unset($mail); } } // By default, self-registering readers will receive // press updates. (The double set is here to prevent a // duplicate insert error msg if there was a notification entry // left over from a previous role.) if (isset($allowedRoles['reader']) && $this->getData($allowedRoles['reader'])) { $notificationStatusDao =& DAORegistry::getDAO('NotificationStatusDAO'); $notificationStatusDao->setPressNotifications($press->getId(), $userId, false); $notificationStatusDao->setPressNotifications($press->getId(), $userId, true); } }
function exportUsers($writer) { import('lib.pkp.classes.user.InterestManager'); $interestManager = new InterestManager(); $roleDao =& DAORegistry::getDAO('RoleDAO'); $userDAO =& DAORegistry::getDAO('UserDAO'); $result =& $userDAO->retrieveRange('SELECT DISTINCT u.* FROM users u LEFT JOIN controlled_vocabs cv ON (cv.symbolic = "interest") LEFT JOIN user_interests ui ON (ui.user_id = u.user_id) LEFT JOIN controlled_vocab_entries cve ON (cve.controlled_vocab_id = cv.controlled_vocab_id AND ui.controlled_vocab_entry_id = cve.controlled_vocab_entry_id) LEFT JOIN controlled_vocab_entry_settings cves ON (cves.controlled_vocab_entry_id = cve.controlled_vocab_entry_id) WHERE u.user_id IN ( SELECT r.user_id FROM roles AS r WHERE r.journal_id = ? UNION SELECT gm.user_id FROM group_memberships AS gm INNER JOIN groups AS g ON gm.group_id=g.group_id WHERE g.assoc_id = ? UNION SELECT se.user_id FROM section_editors AS se WHERE se.journal_id = ? UNION SELECT a.user_id FROM articles AS a WHERE a.journal_id = ? UNION SELECT ea.editor_id FROM edit_assignments AS ea INNER JOIN articles AS a ON ea.article_id=a.article_id WHERE a.journal_id = ? UNION SELECT ed.editor_id FROM edit_decisions AS ed INNER JOIN articles AS a ON ed.article_id=a.article_id WHERE a.journal_id = ? UNION SELECT ra.reviewer_id FROM review_assignments AS ra INNER JOIN articles AS a ON ra.submission_id=a.article_id WHERE a.journal_id = ? UNION SELECT s.user_id FROM signoffs AS s INNER JOIN articles AS a ON s.assoc_id=a.article_id WHERE a.journal_id = ? UNION SELECT el.sender_id FROM email_log AS el INNER JOIN articles AS a ON el.assoc_id=a.article_id WHERE a.journal_id = ? UNION SELECT evenl.user_id FROM event_log AS evenl INNER JOIN articles AS a ON evenl.assoc_id=a.article_id WHERE a.journal_id = ? UNION SELECT ac.author_id FROM article_comments AS ac INNER JOIN articles AS a ON ac.article_id=a.article_id WHERE a.journal_id = ? UNION SELECT n.user_id FROM notes AS n INNER JOIN articles AS a ON n.assoc_id=a.article_id WHERE a.journal_id = ? )', array($this->journal->getId(), $this->journal->getId(), $this->journal->getId(), $this->journal->getId(), $this->journal->getId(), $this->journal->getId(), $this->journal->getId(), $this->journal->getId(), $this->journal->getId(), $this->journal->getId(), $this->journal->getId(), $this->journal->getId()), null); $users =& new DAOResultFactory($result, $userDAO, '_returnUserFromRowWithData'); $writer->startElement('users'); while (!$users->eof()) { $user = $users->next(); $writer->startElement('user'); $this->writeElement($writer, 'oldId', $user->getId()); $this->writeElement($writer, 'username', $user->getUsername()); $this->writeElement($writer, 'password', $user->getPassword()); $this->writeElement($writer, 'salutation', $user->getSalutation()); $this->writeElement($writer, 'firstName', $user->getFirstName()); $this->writeElement($writer, 'middleName', $user->getMiddleName()); $this->writeElement($writer, 'initials', $user->getInitials()); $this->writeElement($writer, 'lastName', $user->getLastName()); $this->writeElement($writer, 'suffix', $user->getSuffix()); $this->writeElement($writer, 'gender', $user->getGender()); $this->writeElement($writer, 'email', $user->getEmail()); $this->writeElement($writer, 'url', $user->getUrl()); $this->writeElement($writer, 'phone', $user->getPhone()); $this->writeElement($writer, 'fax', $user->getFax()); $this->writeElement($writer, 'mailingAddress', $user->getMailingAddress()); $this->writeElement($writer, 'billingAddress', $user->getBillingAddress()); $this->writeElement($writer, 'country', $user->getCountry()); $this->writeElement($writer, 'locales', $user->getLocales() ? implode(':', $user->getLocales()) : null); $this->writeElement($writer, 'dateLastEmail', $user->getDateLastEmail()); $this->writeElement($writer, 'dateRegistered', $user->getDateRegistered()); $this->writeElement($writer, 'dateValidated', $user->getDateValidated()); $this->writeElement($writer, 'dateLastLogin', $user->getDateLastLogin()); $this->writeElement($writer, 'mustChangePassword', $user->getMustChangePassword()); $this->writeElement($writer, 'disabled', $user->getDisabled()); $this->writeElement($writer, 'disabledReason', $user->getDisabledReason()); $this->writeElement($writer, 'authId', $user->getAuthId()); $this->writeElement($writer, 'authStr', $user->getAuthStr()); $this->writeElement($writer, 'inlineHelp', $user->getInlineHelp()); $interests = $interestManager->getInterestsForUser($user); if (is_array($interests)) { foreach ($interests as $interest) { $this->writeElement($writer, 'interest', $interest); } } $roles = $roleDao->getRolesByUserId($user->getId(), $this->journal->getId()); foreach ($roles as $role) { $this->writeElement($writer, 'role', $role->getRoleId()); } $this->exportUserSettings($userDAO, $writer, $user->getId()); $writer->endElement(); $writer->flush(); } $writer->endElement(); $writer->flush(); }
/** * Save profile settings. */ function execute() { $user =& Request::getUser(); $user->setSalutation($this->getData('salutation')); $user->setFirstName($this->getData('firstName')); $user->setMiddleName($this->getData('middleName')); $user->setLastName($this->getData('lastName')); $user->setGender($this->getData('gender')); $user->setInitials($this->getData('initials')); $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->setFax($this->getData('fax')); $user->setMailingAddress($this->getData('mailingAddress')); $user->setCountry($this->getData('country')); $user->setBiography($this->getData('biography'), null); // Localized $userId = $user->getId(); // Insert the user interests import('lib.pkp.classes.user.InterestManager'); $interestManager = new InterestManager(); $interestManager->insertInterests($userId, $this->getData('interestsKeywords'), $this->getData('interests')); $site =& Request::getSite(); $availableLocales = $site->getSupportedLocales(); $locales = array(); foreach ($this->getData('userLocales') as $locale) { if (Locale::isLocaleValid($locale) && in_array($locale, $availableLocales)) { array_push($locales, $locale); } } $user->setLocales($locales); $userDao =& DAORegistry::getDAO('UserDAO'); $userDao->updateObject($user); $roleDao =& DAORegistry::getDAO('RoleDAO'); $journalDao =& DAORegistry::getDAO('JournalDAO'); // Roles $journal =& Request::getJournal(); if ($journal) { $role = new Role(); $role->setUserId($user->getId()); $role->setJournalId($journal->getId()); if ($journal->getSetting('allowRegReviewer')) { $role->setRoleId(ROLE_ID_REVIEWER); $hasRole = Validation::isReviewer(); $wantsRole = Request::getUserVar('reviewerRole'); if ($hasRole && !$wantsRole) { $roleDao->deleteRole($role); } if (!$hasRole && $wantsRole) { $roleDao->insertRole($role); } } if ($journal->getSetting('allowRegAuthor')) { $role->setRoleId(ROLE_ID_AUTHOR); $hasRole = Validation::isAuthor(); $wantsRole = Request::getUserVar('authorRole'); if ($hasRole && !$wantsRole) { $roleDao->deleteRole($role); } if (!$hasRole && $wantsRole) { $roleDao->insertRole($role); } } if ($journal->getSetting('allowRegReader')) { $role->setRoleId(ROLE_ID_READER); $hasRole = Validation::isReader(); $wantsRole = Request::getUserVar('readerRole'); if ($hasRole && !$wantsRole) { $roleDao->deleteRole($role); } if (!$hasRole && $wantsRole) { $roleDao->insertRole($role); } } } $openAccessNotify = Request::getUserVar('openAccessNotify'); $userSettingsDao =& DAORegistry::getDAO('UserSettingsDAO'); $journals =& $journalDao->getEnabledJournals(); $journals =& $journals->toArray(); foreach ($journals as $thisJournal) { if ($thisJournal->getSetting('publishingMode') == PUBLISHING_MODE_SUBSCRIPTION && $thisJournal->getSetting('enableOpenAccessNotification')) { $currentlyReceives = $user->getSetting('openAccessNotification', $thisJournal->getJournalId()); $shouldReceive = !empty($openAccessNotify) && in_array($thisJournal->getJournalId(), $openAccessNotify); if ($currentlyReceives != $shouldReceive) { $userSettingsDao->updateSetting($user->getId(), 'openAccessNotification', $shouldReceive, 'bool', $thisJournal->getJournalId()); } } } if ($user->getAuthId()) { $authDao =& DAORegistry::getDAO('AuthSourceDAO'); $auth =& $authDao->getPlugin($user->getAuthId()); } if (isset($auth)) { $auth->doSetUserInfo($user); } }
function importUsers() { assert($this->xml->name == 'users'); import('lib.pkp.classes.user.InterestManager'); $interestManager = new InterestManager(); $roleDao =& DAORegistry::getDAO('RoleDAO'); $userDAO =& DAORegistry::getDAO('UserDAO'); $publicFileManager =& new PublicFileManager(); $site =& Request::getSite(); $siteSupportedLocales = $site->getSupportedLocales(); $this->nextElement(); while ($this->xml->name == 'user') { $userXML = $this->getCurrentElementAsDom(); $username = (string) $userXML->username; $email = (string) $userXML->email; $userByEmail = $userDAO->getUserByEmail($email); $user = null; if (!empty($userByEmail)) { $user = $userByEmail; } else { $user = new User(); $user->setUsername((string) $userXML->username); $user->setPassword((string) $userXML->password); $user->setSalutation((string) $userXML->salutation); $user->setFirstName((string) $userXML->firstName); $user->setMiddleName((string) $userXML->middleName); $user->setInitials((string) $userXML->initials); $user->setLastName((string) $userXML->lastName); $user->setSuffix((string) $userXML->suffix); $user->setGender((string) $userXML->gender); $user->setEmail((string) $userXML->email); $user->setUrl((string) $userXML->url); $user->setPhone((string) $userXML->phone); $user->setFax((string) $userXML->fax); $user->setMailingAddress((string) $userXML->mailingAddress); $user->setBillingAddress((string) $userXML->billingAddress); $user->setCountry((string) $userXML->country); $locales = array(); foreach (explode(':', (string) $userXML->locales) as $locale) { if (AppLocale::isLocaleValid($locale) && in_array($locale, $siteSupportedLocales)) { array_push($locales, $locale); } } $user->setLocales($locales); $user->setDateLastEmail((string) $userXML->dateLastEmail); $user->setDateRegistered((string) $userXML->dateRegistered); $user->setDateValidated((string) $userXML->dateValidated); $user->setDateLastLogin((string) $userXML->dateLastLogin); $user->setMustChangePassword((int) $userXML->mustChangePassword); $user->setDisabled((int) $userXML->disabled); $user->setDisabledReason((string) $userXML->disabledReason); $user->setAuthId((int) $userXML->authId); $user->setAuthStr((string) $userXML->authStr); $user->setInlineHelp((int) $userXML->inlineHelp); $this->generateUsername($user); $userDAO->insertUser($user); $this->restoreDataObjectSettings($userDAO, $userXML->settings, 'user_settings', 'user_id', $user->getId()); $user = $userDAO->getById($user->getId()); $profileImage =& $user->getSetting('profileImage'); if ($profileImage) { $oldProfileImage = $profileImage['uploadName']; $extension = $publicFileManager->getExtension($oldProfileImage); $newProfileImage = 'profileImage-' . $user->getId() . "." . $extension; $sourceFile = $this->siteFolderPath . '/' . $oldProfileImage; $publicFileManager->copyFile($sourceFile, $publicFileManager->getSiteFilesPath() . "/" . $newProfileImage); unlink($sourceFile); $profileImage['uploadName'] = $newProfileImage; $user->updateSetting('profileImage', $profileImage); } $interests = array(); foreach ($userXML->interest as $interest) { $interests[] = (string) $interest; } $interestManager->setInterestsForUser($user, $interests); } $this->idTranslationTable->register(INTERNAL_TRANSFER_OBJECT_USER, (int) $userXML->oldId, $user->getId()); foreach ($userXML->role as $roleXML) { $role = new Role(); $role->setRoleId((int) $roleXML); $role->setUserId($user->getId()); $role->setJournalId($this->journal->getId()); $roleDao->insertRole($role); } $this->nextElement(); } }
/** * Handle a users element * @param $node DOMElement * @return array Array of User objects */ function parseUser($node) { $deployment = $this->getDeployment(); $context = $deployment->getContext(); // Create the data object $userDao = DAORegistry::getDAO('UserDAO'); $user = $userDao->newDataObject(); // Handle metadata in subelements for ($n = $node->firstChild; $n !== null; $n = $n->nextSibling) { if (is_a($n, 'DOMElement')) { switch ($n->tagName) { case 'username': $user->setUsername($n->textContent); break; case 'firstname': $user->setFirstName($n->textContent); break; case 'middlename': $user->setMiddleName($n->textContent); break; case 'lastname': $user->setLastName($n->textContent); break; case 'initials': $user->setInitials($n->textContent); break; case 'salutation': $user->setSalutation($n->textContent); break; case 'suffix': $user->setSuffix($n->textContent); break; case 'gender': $user->setGender($n->textContent); break; case 'affiliation': $user->setAffiliation($n->textContent, $n->getAttribute('locale')); break; case 'country': $user->setCountry($n->textContent); break; case 'email': $user->setEmail($n->textContent); break; case 'url': $user->setUrl($n->textContent); break; case 'phone': $user->setPhone($n->textContent); break; case 'billing_address': $user->setBillingAddress($n->textContent); break; case 'mailing_address': $user->setMailingAddress($n->textContent); break; case 'biography': $user->setBiography($n->textContent, $n->getAttribute('locale')); break; case 'gossip': $user->setGossip($n->textContent, $n->getAttribute('locale')); break; case 'signature': $user->setSignature($n->textContent, $n->getAttribute('locale')); break; case 'date_registered': $user->setDateRegistered($n->textContent); break; case 'date_last_login': $user->setDateLastLogin($n->textContent); break; case 'date_last_email': $user->setDateLastEmail($n->textContent); break; case 'date_validated': $user->setDateValidated($n->textContent); break; case 'inline_help': $n->textContent == 'true' ? $user->setInlineHelp(true) : $user->setInlineHelp(false); break; case 'auth_id': $user->setAuthId($n->textContent); break; case 'auth_string': $user->setAuthString($n->textContent); break; case 'disabled_reason': $user->setDisabledReason($n->textContent); break; case 'locales': $user->setLocales(preg_split('/:/', $n->textContent)); break; case 'password': if ($n->getAttribute('must_change') == 'true') { $user->setMustChangePassword(true); } if ($n->getAttribute('is_disabled') == 'true') { $user->setIsDisabled(true); } $passwordValueNodeList = $n->getElementsByTagNameNS($deployment->getNamespace(), 'value'); if ($passwordValueNodeList->length == 1) { $password = $passwordValueNodeList->item(0); $user->setPassword($password->textContent); } else { fatalError("User has no password. Check your import XML format."); } break; } } } // ensure that this username and email address are not already in use. if (!$userDao->getByUsername($user->getUsername(), false) && !$userDao->getUserByEmail($user->getEmail(), false)) { $userId = $userDao->insertObject($user); // Insert reviewing interests, now that there is a userId. $interestNodeList = $node->getElementsByTagNameNS($deployment->getNamespace(), 'review_interests'); if ($interestNodeList->length == 0) { $n = $interestNodeList->item(0); if ($n) { $interests = preg_split('/,\\s*/', $n->textContent); import('lib.pkp.classes.user.InterestManager'); $interestManager = new InterestManager(); $interestManager->setInterestsForUser($user, $interests); } } $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); $userGroups = $userGroupDao->getByContextId($context->getId()); // Extract user groups from the User XML and assign the user to those (existing) groups. // Note: It is possible for a user to exist with no user group assignments so there is // no fatalError() as is the case with PKPAuthor import. $userGroupNodeList = $node->getElementsByTagNameNS($deployment->getNamespace(), 'user_group_ref'); if ($userGroupNodeList->length > 0) { for ($i = 0; $i < $userGroupNodeList->length; $i++) { $n = $userGroupNodeList->item($i); while ($userGroup = $userGroups->next()) { if (in_array($n->textContent, $userGroup->getName(null))) { // Found a candidate; assign user to it. $userGroupDao->assignUserToGroup($userId, $userGroup->getId()); } } } } return $user; } }
/** * Register a new user. */ function execute() { $requireValidation = Config::getVar('email', 'require_validation'); if ($this->existingUser) { // Existing user in the system $userDao = DAORegistry::getDAO('UserDAO'); $user =& $userDao->getByUsername($this->getData('username')); if ($user == null) { return false; } $userId = $user->getId(); } else { // New user $user = new User(); $user->setUsername($this->getData('username')); $user->setSalutation($this->getData('salutation')); $user->setFirstName($this->getData('firstName')); $user->setMiddleName($this->getData('middleName')); $user->setInitials($this->getData('initials')); $user->setLastName($this->getData('lastName')); $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->setFax($this->getData('fax')); $user->setMailingAddress($this->getData('mailingAddress')); $user->setBillingAddress($this->getData('billingAddress')); $user->setBiography($this->getData('biography'), null); // Localized $user->setDateRegistered(Core::getCurrentDate()); $user->setCountry($this->getData('country')); $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 (isset($this->defaultAuth)) { $user->setPassword($this->getData('password')); // FIXME Check result and handle failures $this->defaultAuth->doCreateUser($user); $user->setAuthId($this->defaultAuth->authId); } $user->setPassword(Validation::encryptCredentials($this->getData('username'), $this->getData('password'))); if ($requireValidation) { // The account should be created in a disabled // state. $user->setDisabled(true); $user->setDisabledReason(__('user.login.accountNotValidated')); } $userDao = DAORegistry::getDAO('UserDAO'); $userDao->insertObject($user); $userId = $user->getId(); if (!$userId) { return false; } // 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); $sessionManager =& SessionManager::getManager(); $session =& $sessionManager->getUserSession(); $session->setSessionVar('username', $user->getUsername()); } $conference =& Request::getConference(); $schedConf =& Request::getSchedConf(); $roleDao = DAORegistry::getDAO('RoleDAO'); // Roles users are allowed to register themselves in $allowedRoles = array('reader' => 'createAsReader', 'author' => 'createAsAuthor', 'reviewer' => 'createAsReviewer'); import('classes.schedConf.SchedConfAction'); if (!SchedConfAction::allowRegReader($schedConf)) { unset($allowedRoles['reader']); } if (!SchedConfAction::allowRegAuthor($schedConf)) { unset($allowedRoles['author']); } if (!SchedConfAction::allowRegReviewer($schedConf)) { unset($allowedRoles['reviewer']); } foreach ($allowedRoles as $k => $v) { $roleId = $roleDao->getRoleIdFromPath($k); if ($this->getData($v) && !$roleDao->userHasRole($conference->getId(), $schedConf->getId(), $userId, $roleId)) { $role = new Role(); $role->setConferenceId($conference->getId()); $role->setSchedConfId($schedConf->getId()); $role->setUserId($userId); $role->setRoleId($roleId); $roleDao->insertRole($role); } } if (!$this->existingUser) { $this->sendConfirmationEmail($user, $this->getData('password'), $this->getData('sendPassword')); } if (isset($allowedRoles['reader']) && $this->getData('openAccessNotification')) { $userSettingsDao = DAORegistry::getDAO('UserSettingsDAO'); $userSettingsDao->updateSetting($userId, 'openAccessNotification', true, 'bool', $conference->getId()); } }