| <?php |
| /** |
| * Copyright (c) 2014, 2018 Eclipse Foundation. |
| * |
| * This program and the accompanying materials are made |
| * available under the terms of the Eclipse Public License 2.0 |
| * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * Contributors: |
| * Christopher Guindon (Eclipse Foundation) - Initial implementation |
| * Eric Poirier (Eclipse Foundation) |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| */ |
| require_once ($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); |
| require_once ($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/friends/payment.class.php"); |
| |
| $App = new App(); |
| $Theme = $App->getThemeClass(); |
| $PaymentGateway = new PaymentGateway(); |
| $App->preventCaching(); |
| |
| // Begin: page-specific settings. Change these. |
| $pageTitle = "Link donation with your Eclipse account"; |
| $Theme->setPageTitle($pageTitle); |
| $Theme->setPageKeywords("friends of eclipse, donation, contribution"); |
| $Theme->setPageAuthor("Christopher Guindon"); |
| |
| // Custom logic |
| $hide_form = FALSE; |
| if (!$PaymentGateway->Donation->link_donation()) { |
| $PaymentGateway->set_client_message('This is not a valid transaction.', 'danger'); |
| $hide_form = TRUE; |
| } |
| else { |
| $stage = $PaymentGateway->Donation->update_donation(); |
| if ($stage == 'updated') { |
| $PaymentGateway->set_client_message('Your donation was succesfully updated. Please check your e-mail for addionnal information.', 'success'); |
| $hide_form = TRUE; |
| } |
| elseif ($stage == 'invalid_eclipse_id') { |
| $PaymentGateway->set_client_message('Unable to find an eclipse account from your e-mail address.', 'danger'); |
| } |
| elseif ($stage == 'link_already_done') { |
| $PaymentGateway->set_client_message('Your donation is already linked to an eclipse account.', 'danger'); |
| $hide_form = TRUE; |
| } |
| } |
| |
| // Custom theme variables |
| $variables = array(); |
| $variables['main_container_classes'] = 'container-full'; |
| $App->setThemeVariables($variables); |
| |
| // Generate the web page |
| ob_start(); |
| include ("content/en_" . $App->getScriptName()); |
| $html = ob_get_clean(); |
| |
| $Theme->setHtml($html); |
| $Theme->generatePage(); |