blob: 14ae4a9def0eafdc05da674b9754b9fa12809b0a [file] [log] [blame]
<?php
/*******************************************************************************
* Copyright (c) 2010 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://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wayne Beaton (Eclipse Foundation)- initial API and implementation
*******************************************************************************/
require_once(dirname(__FILE__) . '/common.inc');
mustBeEclipseFoundationCaller();
header("Content-type: text/plain");
require_once "/home/data/httpd/eclipse-php-classes/system/dbconnection_foundation_ro.class.php";
$_dbcf = new DBConnectionFoundation();
$_dbhf = $_dbcf->connect();
$foundation_query = "SELECT DISTINCT People.PersonID, Name1, Name2, FName, LName from People
LEFT JOIN OrganizationContacts ON People.PersonID = OrganizationContacts.PersonID AND Relation IN ('CC', 'EMPLY')
LEFT JOIN Organizations ON Organizations.OrganizationID = OrganizationContacts.OrganizationID
;";
// echo( $foundation_query . "\n" );
$result = mysql_query($foundation_query, $_dbhf);
if( !$result ) {
echo("MySQL Error: ". mysql_error());
echo( $foundation_query . "\n" );
exit( "Stopped because error\n" );
}
while( $row = mysql_fetch_array($result) ) {
$company = $row[1] . $row[2];
//$company = preg_replace( "/[^A-Za-z0-9_\.\-]/", "", $company );
$login = trim($row[0]);
$fullname = $row[3] . " " . $row[4];
if( $company == "" ) $company = "individual";
echo "$login\t$company\t$fullname\n";
}
?>