| <?php |
| /******************************************************************************* |
| * Copyright (c) 2015 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: |
| * Denis Roy (Eclipse Foundation) - Initial implementation |
| ******************************************************************************/ |
| |
| |
| /* Returns a PNG decorator for CLA status |
| */ |
| |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); |
| require_once("/home/data/httpd/eclipse-php-classes/system/ldapconnection.class.php"); |
| $App = new App(); |
| |
| # sensible defaults |
| $file_name = "../images/eca-off.png"; |
| |
| header('Content-Type: image/png'); |
| |
| if (isset($_GET['email']) && !empty($_GET['email'])) { |
| # bug 464992 - CLA does not work with "+" email addresses. |
| # We see the + as a space, and since a space is not valid, let's convert it back to a + |
| $_GET['email'] = str_ireplace(" ", "+", $_GET['email']); |
| |
| $id = filter_var($_GET['email'], FILTER_SANITIZE_EMAIL); |
| |
| $ldap = new LDAPConnection(); |
| $uid = $ldap->getUIDFromMail($id); |
| |
| if($uid != "") { |
| if($ldap->checkUserInGroup($uid, "eclipsecla")) { |
| $file_name = "../images/eca-on.png"; |
| } |
| } |
| } |
| |
| header('Content-Length: ' . filesize($file_name)); |
| readfile($file_name); |
| exit; |