/**
  * Save the form
  */
 function execute()
 {
     $userEmail = $this->getData('email');
     $notificationSettingsDao =& DAORegistry::getDAO('NotificationSettingsDAO');
     if ($password = $notificationSettingsDao->subscribeGuest($userEmail)) {
         Notification::sendMailingListEmail($userEmail, $password, 'NOTIFICATION_MAILLIST_WELCOME');
         return true;
     } else {
         PKPRequest::redirect(null, 'notification', 'mailListSubscribed', array('error'));
         return false;
     }
 }
Exemple #2
0
 /**
  * Redirect to the specified page within Open Harvesting Systems.
  * Shorthand for a common call to $request->redirect($dispatcher->url($request, ROUTE_PAGE, ...)).
  * @param $page string The name of the op to redirect to.
  * @param $op string optional The name of the op to redirect to.
  * @param $path mixed string or array containing path info for redirect.
  * @param $params array Map of name => value pairs for additional parameters
  * @param $anchor string Name of desired anchor on the target page
  */
 function redirect($page = null, $op = null, $path = null, $params = null, $anchor = null)
 {
     parent::redirect(null, $page, $op, $path, $params, $anchor);
 }
 /**
  * Save user's new password.
  */
 function savePassword()
 {
     $this->validate();
     $this->setupTemplate();
     import('classes.user.form.LoginChangePasswordForm');
     $passwordForm = new LoginChangePasswordForm();
     $passwordForm->readInputData();
     if ($passwordForm->validate()) {
         if ($passwordForm->execute()) {
             $user = Validation::login($passwordForm->getData('username'), $passwordForm->getData('password'), $reason);
         }
         PKPRequest::redirect(null, 'user');
     } else {
         $passwordForm->display();
     }
 }
Exemple #4
0
 /**
  * Redirect to index if system has already been installed.
  */
 function validate()
 {
     if (Config::getVar('general', 'installed')) {
         PKPRequest::redirect(null, 'index');
     }
 }
 /**
  * Save changes to an announcement type.
  */
 function updateAnnouncementType()
 {
     $this->validate();
     $this->setupTemplate(true);
     import('manager.form.AnnouncementTypeForm');
     $typeId = Request::getUserVar('typeId') == null ? null : (int) Request::getUserVar('typeId');
     $announcementTypeDao =& DAORegistry::getDAO('AnnouncementTypeDAO');
     if ($this->_announcementTypeIsValid($typeId)) {
         $announcementTypeForm = new AnnouncementTypeForm($typeId);
         $announcementTypeForm->readInputData();
         if ($announcementTypeForm->validate()) {
             $announcementTypeForm->execute();
             if (Request::getUserVar('createAnother')) {
                 PKPRequest::redirect(null, null, 'createAnnouncementType');
             } else {
                 PKPRequest::redirect(null, null, 'announcementTypes');
             }
         } else {
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->append('pageHierarchy', array(Request::url(null, null, 'manager', 'announcementTypes'), 'manager.announcementTypes'));
             if ($typeId == null) {
                 $templateMgr->assign('announcementTypeTitle', 'manager.announcementTypes.createTitle');
             } else {
                 $templateMgr->assign('announcementTypeTitle', 'manager.announcementTypes.editTitle');
             }
             $announcementTypeForm->display();
         }
     } else {
         PKPRequest::redirect(null, null, 'announcementTypes');
     }
 }
 /**
  * Save the public notification email subscription form
  */
 function saveSubscribeMailList()
 {
     $this->validate();
     $this->setupTemplate(true);
     import('notification.form.NotificationMailingListForm');
     $notificationMailingListForm = new NotificationMailingListForm();
     $notificationMailingListForm->readInputData();
     if ($notificationMailingListForm->validate()) {
         $notificationMailingListForm->execute();
         PKPRequest::redirect(null, 'notification', 'mailListSubscribed', array('success'));
     } else {
         $notificationMailingListForm->display();
     }
 }
 /**
  * Connector from AnthroNet.  Receives a token in the 'token' query string argument
  * that is used to fetch author information via SOAP, create/or validate the author login,
  * and redirect to author home page.
  * @param array $args
  * @param PKPRequest $request
  */
 function objectsForReviewLogin($args, $request)
 {
     $token = $request->getUserVar('token');
     if ($token) {
         $authToken = $this->_doAuthenticate();
         if ($authToken) {
             $user = $this->_doUserRequest($token, $authToken);
             if ($user) {
                 $sessionManager =& SessionManager::getManager();
                 $sessionManager->regenerateSessionId();
                 $session =& $sessionManager->getUserSession();
                 $session->setSessionVar('userId', $user->getId());
                 $session->setUserId($user->getId());
                 $session->setSessionVar('username', $user->getUsername());
                 $request->redirect(null, 'objectsForReview');
                 // place them on the landing page for available objects.
             } else {
                 $request->redirect(null, 'user');
             }
         }
     }
 }
 /**
  * Save changes to an announcement type.
  */
 function updateAnnouncementType()
 {
     // FIXME: Remove call to validate() when all ManagerHandler implementations
     // (across all apps) have been migrated to the authorize() authorization approach.
     $this->validate();
     $this->setupTemplate(true);
     import('classes.manager.form.AnnouncementTypeForm');
     $typeId = Request::getUserVar('typeId') == null ? null : (int) Request::getUserVar('typeId');
     $announcementTypeDao =& DAORegistry::getDAO('AnnouncementTypeDAO');
     if ($this->_announcementTypeIsValid($typeId)) {
         $announcementTypeForm = new AnnouncementTypeForm($typeId);
         $announcementTypeForm->readInputData();
         if ($announcementTypeForm->validate()) {
             $announcementTypeForm->execute();
             if (Request::getUserVar('createAnother')) {
                 PKPRequest::redirect(null, null, 'createAnnouncementType');
             } else {
                 PKPRequest::redirect(null, null, 'announcementTypes');
             }
         } else {
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->append('pageHierarchy', array(Request::url(null, null, 'manager', 'announcementTypes'), 'manager.announcementTypes'));
             if ($typeId == null) {
                 $templateMgr->assign('announcementTypeTitle', 'manager.announcementTypes.createTitle');
             } else {
                 $templateMgr->assign('announcementTypeTitle', 'manager.announcementTypes.editTitle');
             }
             $announcementTypeForm->display();
         }
     } else {
         PKPRequest::redirect(null, null, 'announcementTypes');
     }
 }
Exemple #9
0
 /**
  * Redirect to the specified page within OCS.
  * Shorthand for a common call to $request->redirect($dispatcher->url($request, ROUTE_PAGE, ...)).
  * @param $conferencePath string The path of the conference to redirect to.
  * @param $schedConfPath string The path of the conference to redirect to.
  * @param $page string The name of the op to redirect to.
  * @param $op string optional The name of the op to redirect to.
  * @param $path mixed string or array containing path info for redirect.
  * @param $params array Map of name => value pairs for additional parameters
  * @param $anchor string Name of desired anchor on the target page
  */
 function redirect($conferencePath = null, $schedConfPath = null, $page = null, $op = null, $path = null, $params = null, $anchor = null)
 {
     parent::redirect(array($conferencePath, $schedConfPath), $page, $op, $path, $params, $anchor);
 }
Exemple #10
0
 /**
  * Download an article file
  * @param array $args
  * @param PKPRequest $request
  */
 function viewFile($args, $request)
 {
     // For deprecated OJS 2.x URLs; see https://github.com/pkp/pkp-lib/issues/1541
     $articleId = isset($args[0]) ? $args[0] : 0;
     $galleyId = isset($args[1]) ? $args[1] : 0;
     $fileId = isset($args[2]) ? (int) $args[2] : 0;
     header("HTTP/1.1 301 Moved Permanently");
     $request->redirect(null, null, 'download', array($articleId, $galleyId, $fileId));
 }
 /**
  * Unenroll a publisher.
  * @param array $args
  * @param PKPRequest $request
  */
 function objectsForReviewUnenroll($args, &$request)
 {
     $publisherId = (int) Request::getUserVar('publisherId');
     $userId = (int) Request::getUserVar('userId');
     if ($publisherId && $userId) {
         $ofrEdAssOrgDao = DAORegistry::getDAO('ObjectForReviewEditorAssignmentDAO');
         $assignment = $ofrEdAssOrgDao->getByPublisherAndUserId($publisherId, $userId);
         if ($assignment) {
             $ofrEdAssOrgDao->deleteById($assignment->getId());
         }
     }
     $request->redirect(null, 'editor', 'objectsForReviewEnrollPublishers');
 }