4 $app =& Dataface_Application::getInstance();
5 $query = $app->getQuery();
7 $query[
'-limit'] = 999999999;
9 $at = Dataface_ActionTool::getInstance();
10 $emailAction =
$at->getAction(array(
'name'=>
'email'));
12 import(
'Dataface/Ontology.php');
13 Dataface_Ontology::registerType(
'Person',
'Dataface/Ontology/Person.php',
'Dataface_Ontology_Person');
14 $ontology = Dataface_Ontology::newOntology(
'Person', $query[
'-table']);
16 $emailAction[
'email_column'] = $ontology->getFieldname(
'email');
19 if ( !isset($emailAction) or !isset($emailAction[
'email_column']) ){
20 return PEAR::raiseError(
"No email column specified");
24 $col = $emailAction[
'email_column'];
26 $qb =
new Dataface_QueryBuilder($query[
'-table'], $query);
27 $sql =
"select distinct (`".$col.
"`) `".$col.
"` ".$qb->_from().$qb->_secure($qb->_where());
29 $res = mysql_query($sql, df_db());
30 if ( !$res ) trigger_error(mysql_error(df_db()), E_USER_ERROR);
33 while ($row = mysql_fetch_row($res) ) $addresses[] = $row[0];
34 @mysql_free_result($res);
35 header(
"Content-type: text/plain");
36 echo implode(
', ', $addresses);