Server : Apache/2.4.41 (Ubuntu) System : Linux journalup 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /var/www/html/pages/payments/ |
<?php /** * @file pages/payments/PaymentsHandler.inc.php * * Copyright (c) 2014-2020 Simon Fraser University * Copyright (c) 2003-2020 John Willinsky * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. * * @class PaymentsHandler * @ingroup pages_payments * * @brief Handle requests for payment management. */ import('classes.handler.Handler'); class PaymentsHandler extends Handler { /** * Constructor. */ function __construct() { parent::__construct(); $this->addRoleAssignment( array(ROLE_ID_MANAGER, ROLE_ID_SUBSCRIPTION_MANAGER), array('index', 'subscriptions', 'subscriptionTypes', 'subscriptionPolicies', 'saveSubscriptionPolicies', 'paymentTypes', 'savePaymentTypes', 'payments') ); } /** * Display a list of payment tabs for the current journal. * @param $args array * @param $request PKPRequest */ function index($args, $request) { $this->setupTemplate($request); AppLocale::requireComponents(LOCALE_COMPONENT_APP_MANAGER); $templateMgr = TemplateManager::getManager($request); $templateMgr->display('payments/index.tpl'); } /** * @copydoc PKPHandler::authorize() */ function authorize($request, &$args, $roleAssignments) { import('lib.pkp.classes.security.authorization.PKPSiteAccessPolicy'); $this->addPolicy(new PKPSiteAccessPolicy($request, null, $roleAssignments)); return parent::authorize($request, $args, $roleAssignments); } /** * Display a list of subscriptions for the current journal. * @param $args array * @param $request PKPRequest */ function subscriptions($args, $request) { $templateMgr = TemplateManager::getManager($request); $dispatcher = $request->getDispatcher(); switch (array_shift($args)) { case 'institutional': return $templateMgr->fetchAjax( 'institutionalSubscriptionsGridContainer', $dispatcher->url( $request, ROUTE_COMPONENT, null, 'grid.subscriptions.InstitutionalSubscriptionsGridHandler', 'fetchGrid' ) ); case 'individual': return $templateMgr->fetchAjax( 'individualSubscriptionsGridContainer', $dispatcher->url( $request, ROUTE_COMPONENT, null, 'grid.subscriptions.IndividualSubscriptionsGridHandler', 'fetchGrid' ) ); } $dispatcher->handle404(); } /** * Display a list of subscription types for the current journal. * @param $args array * @param $request PKPRequest */ function subscriptionTypes($args, $request) { $templateMgr = TemplateManager::getManager($request); $dispatcher = $request->getDispatcher(); return $templateMgr->fetchAjax( 'subscriptionTypesGridContainer', $dispatcher->url( $request, ROUTE_COMPONENT, null, 'grid.subscriptions.SubscriptionTypesGridHandler', 'fetchGrid' ) ); } /** * Display subscription policies for the current journal. * @param $args array * @param $request PKPRequest */ function subscriptionPolicies($args, $request) { $this->validate(); $this->setupTemplate($request); import('classes.subscription.form.SubscriptionPolicyForm'); $templateMgr = TemplateManager::getManager($request); if (Config::getVar('general', 'scheduled_tasks')) { $templateMgr->assign('scheduledTasksEnabled', true); } $paymentManager = Application::getPaymentManager($request->getJournal()); $templateMgr->assign('acceptSubscriptionPayments', $paymentManager->isConfigured()); $subscriptionPolicyForm = new SubscriptionPolicyForm(); $subscriptionPolicyForm->initData(); return new JSONMessage(true, $subscriptionPolicyForm->fetch($request)); } /** * Save subscription policies for the current journal. * @param $args array * @param $request PKPRequest */ function saveSubscriptionPolicies($args, $request) { $this->validate(); $this->setupTemplate($request); import('classes.subscription.form.SubscriptionPolicyForm'); $subscriptionPolicyForm = new SubscriptionPolicyForm(); $subscriptionPolicyForm->readInputData(); if ($subscriptionPolicyForm->validate()) { $subscriptionPolicyForm->execute(); $notificationManager = new NotificationManager(); $user = $request->getUser(); $notificationManager->createTrivialNotification($user->getId()); return new JSONMessage(true); } return new JSONMessage(true, $subscriptionPolicyForm->fetch($request)); } /** * Display payment types for the current journal. * @param $args array * @param $request PKPRequest */ function paymentTypes($args, $request) { $this->validate(); $this->setupTemplate($request); import('classes.subscription.form.PaymentTypesForm'); $paymentTypesForm = new PaymentTypesForm(); $paymentTypesForm->initData(); return new JSONMessage(true, $paymentTypesForm->fetch($request)); } /** * Save payment types for the current journal. * @param $args array * @param $request PKPRequest */ function savePaymentTypes($args, $request) { $this->validate(); $this->setupTemplate($request); import('classes.subscription.form.PaymentTypesForm'); $paymentTypesForm = new PaymentTypesForm(); $paymentTypesForm->readInputData(); if ($paymentTypesForm->validate()) { $paymentTypesForm->execute(); $notificationManager = new NotificationManager(); $user = $request->getUser(); $notificationManager->createTrivialNotification($user->getId()); return new JSONMessage(true); } return new JSONMessage(true, $paymentTypesForm->fetch($request)); } /** * Display a list of payments for the current journal. * @param $args array * @param $request PKPRequest */ function payments($args, $request) { $templateMgr = TemplateManager::getManager($request); $dispatcher = $request->getDispatcher(); return $templateMgr->fetchAjax( 'paymentsGridContainer', $dispatcher->url( $request, ROUTE_COMPONENT, null, 'grid.subscriptions.PaymentsGridHandler', 'fetchGrid' ) ); } }