| <?php |
| /******************************************************************************* |
| * Copyright (c) 2014 Eclipse Foundation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Edouard Poitras (Eclipse Foundation) - Further modifications |
| ******************************************************************************/ |
| |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/evt_log.class.php"); |
| include_once "tshirt.php"; |
| |
| define('HEADERS', 'From: Eclipse Webmaster (automated) <webmaster@eclipse.org>' . "\n" . 'Content-Type: text/plain; charset=UTF-8'); |
| define('FOE_LOGO_LINK', 'https://dev.eclipse.org/site_login/myaccount.php'); |
| //define('MIRROR_SITE', 'https://friends.eclipse.org'); // Deprecated |
| define('ECLIPSECON_CODE', 'FRIEND'); |
| define('OREILLY_CODE', 'DSUG'); |
| |
| function send_email($data) { |
| if (!isset($data['firstname']) || $data['firstname'] == '') $data['firstname'] = $data['email']; |
| $content = get_email_content($data); |
| $data['email'] = filter_var($data['email'], FILTER_SANITIZE_EMAIL); |
| _send_email($data['email'], "Thank You For Your Donation", $content); |
| } |
| |
| function _send_email($to, $subject, $content) { |
| mail($to, $subject, $content, HEADERS); |
| $EventLog = new EvtLog(); |
| $EventLog->setLogTable("__paypal.class"); // To make browsing the log table easier |
| $EventLog->setPK1($to); |
| $EventLog->setPK2($_SERVER['REMOTE_ADDR']); |
| $EventLog->setLogAction("DONATION_EMAIL_SENT"); |
| $EventLog->insertModLog($to); |
| } |
| |
| function get_email_content($data) { |
| if ($data['amount'] >= 250) { |
| $data['tshirt_link'] = get_tshirt_link($data['uid'], $data['transaction_id']); |
| return _get_webmaster_idol_email($data); |
| } else if ($data['amount'] >= 100) { |
| $data['tshirt_link'] = get_tshirt_link($data['uid'], $data['transaction_id']); |
| return _get_best_friend_email($data); |
| } else if ($data['amount'] >= 35) { |
| return _get_friend_email($data); |
| } else { |
| return _get_email($data); |
| } |
| } |
| |
| function _get_email($data) { |
| $email = "Dear " . $data['firstname'] . ",\n\n"; |
| $email .= "Thank you for your donation.\n\n"; |
| $email .= "Regards,\nThe Eclipse Foundation"; |
| return $email; |
| } |
| |
| function _get_friend_email($data) { |
| $email = "Dear " . $data['firstname'] . ",\n\n"; |
| $email .= "Thank you for your donation. We are happy to welcome you as a Friend of Eclipse.\n\n"; |
| $email .= "In recognition of your donation, we are pleased to provide the following Friend of Eclipse benefits:\n\n"; |
| $email .= "\t-\tYou may use the Friend of Eclipse logo. It can be found here: " . FOE_LOGO_LINK . "\n"; |
| $email .= "\t-\tYou get access to the Mirror Site while downloading Eclipse when logged in.\n"; |
| $email .= "\t-\tYou get 40% off prints & 50% off ebooks at http://oreilly.com using the discount code: " . OREILLY_CODE . "\n\n"; |
| $email .= "The Eclipse Foundation relies upon our users' generosity to make Eclipse a great place for open source software development. On behalf of the entire community, thank you for making it possible.\n\n"; |
| $email .= "Best Regards,\n\nMike Milinkovich\nExecutive Director\nEclipse Foundation\n\n"; |
| $email .= "http://www.eclipse.org/donate/\nfriends@eclipse.org\n\n"; |
| $email .= "P.S. We have a Corporate Sponsor program for companies that want to support the Eclipse community. Please encourage your employer to contribute to the success of open source software at Eclipse.\nhttp://www.eclipse.org/corporate_sponsors/"; |
| return $email; |
| } |
| |
| function _get_best_friend_email($data) { |
| $email = "Dear " . $data['firstname'] . ",\n\n"; |
| $email .= "Thank you for your generous donation. We are happy to welcome you as a Best Friend of Eclipse.\n\n"; |
| $email .= "In recognition of your donation, we are pleased to provide the following Best Friend of Eclipse benefits:\n\n"; |
| $email .= "\t-\tYou may use the Friend of Eclipse logo. It can be found here: " . FOE_LOGO_LINK . "\n"; |
| $email .= "\t-\tYou get access to the Mirror Site while downloading Eclipse when logged in.\n"; |
| $email .= "\t-\tYou get 40% off prints & 50% off ebooks at http://oreilly.com using the discount code: " . OREILLY_CODE . "\n"; |
| $email .= "\t-\tYou qualify for a Best Friend discount to attend an EclipseCon conference. The amount depends on the event but use the discount code: " . ECLIPSECON_CODE . "\n"; |
| $email .= "\t-\tYou get an Eclipse T-Shirt! Claim it here: " . $data['tshirt_link'] . "\n\n"; |
| $email .= "The Eclipse Foundation relies upon our users' generosity to make Eclipse a great place for open source software development. On behalf of the entire community, thank you for making it possible.\n\n"; |
| $email .= "Best Regards,\n\nMike Milinkovich\nExecutive Director\nEclipse Foundation\n\n"; |
| $email .= "http://www.eclipse.org/donate/\nfriends@eclipse.org\n\n"; |
| $email .= "P.S. We have a Corporate Sponsor program for companies that want to support the Eclipse community. Please encourage your employer to contribute to the success of open source software at Eclipse.\nhttp://www.eclipse.org/corporate_sponsors/"; |
| return $email; |
| } |
| |
| function _get_webmaster_idol_email($data) { |
| $email = "Dear " . $data['firstname'] . ",\n\n"; |
| $email .= "Thank you for your generous donation. We are happy to welcome you as a Best Friend of Eclipse.\n\n"; |
| $email .= "In recognition of your donation, we are pleased to provide the following Best Friend of Eclipse benefits:\n\n"; |
| $email .= "\t-\tYou may use the Friend of Eclipse logo. It can be found here: " . FOE_LOGO_LINK . "\n"; |
| $email .= "\t-\tYou get access to the Mirror Site while downloading Eclipse when logged in.\n"; |
| $email .= "\t-\tYou get 40% off prints & 50% off ebooks at http://oreilly.com using the discount code: " . OREILLY_CODE . "\n"; |
| $email .= "\t-\tYou qualify for a Best Friend discount to attend an EclipseCon conference. The amount depends on the event but use the discount code: " . ECLIPSECON_CODE . "\n"; |
| $email .= "\t-\tYou get an Eclipse T-Shirt! Claim it here: " . $data['tshirt_link'] . "\n\n"; |
| $email .= "The Eclipse Foundation relies upon our users' generosity to make Eclipse a great place for open source software development. On behalf of the entire community, thank you for making it possible.\n\n"; |
| $email .= "Best Regards,\n\nMike Milinkovich\nExecutive Director\nEclipse Foundation\n\n"; |
| $email .= "http://www.eclipse.org/donate/\nfriends@eclipse.org\n\n"; |
| $email .= "P.S. We have a Corporate Sponsor program for companies that want to support the Eclipse community. Please encourage your employer to contribute to the success of open source software at Eclipse.\nhttp://www.eclipse.org/corporate_sponsors/"; |
| return $email; |
| } |