| <?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 |
| */ |
| |
| /* |
| * Returns a PNG decorator for friends |
| * Without benefits, returns a 1x1 transparent PNG |
| */ |
| |
| 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/friend-off.png"; |
| |
| header('Content-Type: image/png'); |
| |
| if (isset($_GET['email']) && !empty($_GET['email'])) { |
| $id = filter_var($_GET['email'], FILTER_SANITIZE_EMAIL); |
| |
| $ldap = new LDAPConnection(); |
| $uid = $ldap->getUIDFromMail($id); |
| |
| if ($uid != "") { |
| $sql = "SELECT COUNT(1) AS RecordCount FROM friends where uid <> '' AND uid = " . $App->returnQuotedString($uid) . " and is_benefit = 1"; |
| $result = $App->eclipse_sql($sql); |
| if ($myrow = mysql_fetch_array($result)) { |
| if ($myrow["RecordCount"] > 0) { |
| $file_name = "../images/friend-on.png"; |
| } |
| } |
| } |
| } |
| |
| header('Content-Length: ' . filesize($file_name)); |
| readfile($file_name); |
| exit(); |