| <?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: |
| * Denis Roy (Eclipse Foundation) - Initial implementation |
| * Christopher Guindon (Eclipse Foundation) |
| ******************************************************************************/ |
| |
| |
| /* 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; |