From 2398e5532a43f94757c41054ded46142541c41ee Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Wed, 20 Aug 2008 00:18:54 +0200 Subject: [PATCH] Some clean up. --- include/userset.inc.php | 56 ++++++++++++++------------- modules/profile.php | 86 +++++++++++++++++++++--------------------- modules/search.php | 32 ++++++++-------- modules/search/classes.inc.php | 34 ++++++++--------- modules/search/search.inc.php | 71 +++++++++++++++++----------------- 5 files changed, 142 insertions(+), 137 deletions(-) diff --git a/include/userset.inc.php b/include/userset.inc.php index 3f543a3..2fae930 100644 --- a/include/userset.inc.php +++ b/include/userset.inc.php @@ -26,16 +26,16 @@ global $globals; @$globals->search->result_where_statement = ' LEFT JOIN profile_education AS edu ON (u.user_id = edu.uid) LEFT JOIN profile_education_enum AS ede ON (ede.id = edu.eduid) - LEFT JOIN entreprises AS e ON (e.entrid = 0 AND e.uid = u.user_id) - LEFT JOIN emploi_secteur AS es ON (e.secteur = es.id) - LEFT JOIN fonctions_def AS ef ON (e.fonction = ef.id) - LEFT JOIN geoloc_pays AS n1 ON (u.nationalite = n1.a2) - LEFT JOIN geoloc_pays AS n2 ON (u.nationalite2 = n2.a2) - LEFT JOIN geoloc_pays AS n3 ON (u.nationalite2 = n3.a2) - LEFT JOIN adresses AS adr ON (u.user_id = adr.uid AND FIND_IN_SET(\'active\',adr.statut)) - LEFT JOIN geoloc_pays AS gp ON (adr.country = gp.a2) - LEFT JOIN geoloc_region AS gr ON (adr.country = gr.a2 AND adr.region = gr.region) - LEFT JOIN emails AS em ON (em.uid = u.user_id AND em.flags = \'active\')'; + LEFT JOIN entreprises AS e ON (e.entrid = 0 AND e.uid = u.user_id) + LEFT JOIN emploi_secteur AS es ON (e.secteur = es.id) + LEFT JOIN fonctions_def AS ef ON (e.fonction = ef.id) + LEFT JOIN geoloc_pays AS n1 ON (u.nationalite = n1.a2) + LEFT JOIN geoloc_pays AS n2 ON (u.nationalite2 = n2.a2) + LEFT JOIN geoloc_pays AS n3 ON (u.nationalite2 = n3.a2) + LEFT JOIN adresses AS adr ON (u.user_id = adr.uid AND FIND_IN_SET(\'active\',adr.statut)) + LEFT JOIN geoloc_pays AS gp ON (adr.country = gp.a2) + LEFT JOIN geoloc_region AS gr ON (adr.country = gr.a2 AND adr.region = gr.region) + LEFT JOIN emails AS em ON (em.uid = u.user_id AND em.flags = \'active\')'; class UserSet extends PlSet { @@ -195,12 +195,12 @@ class MinificheView extends MultipageView public function joins() { - return "LEFT JOIN entreprises AS e ON (e.entrid = 0 AND e.uid = u.user_id".(S::logged() ? "" : " AND e.pub = 'public'").") - LEFT JOIN emploi_secteur AS es ON (e.secteur = es.id) - LEFT JOIN fonctions_def AS ef ON (e.fonction = ef.id) - LEFT JOIN geoloc_pays AS n1 ON (u.nationalite = n1.a2) - LEFT JOIN geoloc_pays AS n2 ON (u.nationalite2 = n2.a2) - LEFT JOIN geoloc_pays AS n3 ON (u.nationalite3 = n3.a2) + return "LEFT JOIN entreprises AS e ON (e.entrid = 0 AND e.uid = u.user_id".(S::logged() ? "" : " AND e.pub = 'public'").") + LEFT JOIN emploi_secteur AS es ON (e.secteur = es.id) + LEFT JOIN fonctions_def AS ef ON (e.fonction = ef.id) + LEFT JOIN geoloc_pays AS n1 ON (u.nationalite = n1.a2) + LEFT JOIN geoloc_pays AS n2 ON (u.nationalite2 = n2.a2) + LEFT JOIN geoloc_pays AS n3 ON (u.nationalite3 = n3.a2) LEFT JOIN profile_education AS edu0 ON (u.user_id = edu0.uid AND edu0.id = 0) LEFT JOIN profile_education_enum AS ede0 ON (ede0.id = edu0.eduid) LEFT JOIN profile_education_degree_enum AS edd0 ON (edd0.id = edu0.degreeid) @@ -217,14 +217,15 @@ class MinificheView extends MultipageView LEFT JOIN profile_education_enum AS ede3 ON (ede3.id = edu3.eduid) LEFT JOIN profile_education_degree_enum AS edd3 ON (edd3.id = edu3.degreeid) LEFT JOIN profile_education_field_enum AS f3 ON (f3.id = edu3.fieldid) - LEFT JOIN adresses AS adr ON (u.user_id = adr.uid - AND FIND_IN_SET('active', adr.statut)".(S::logged() ? "" : " AND adr.pub = 'public'").") - LEFT JOIN geoloc_pays AS gp ON (adr.country = gp.a2) - LEFT JOIN geoloc_region AS gr ON (adr.country = gr.a2 AND adr.region = gr.region) - LEFT JOIN emails AS em ON (em.uid = u.user_id AND em.flags = 'active') - INNER JOIN profile_names_display AS nd ON (nd.user_id = u.user_id)" . + LEFT JOIN adresses AS adr ON (u.user_id = adr.uid + AND FIND_IN_SET('active', adr.statut)".(S::logged() ? "" : " + AND adr.pub = 'public'").") + LEFT JOIN geoloc_pays AS gp ON (adr.country = gp.a2) + LEFT JOIN geoloc_region AS gr ON (adr.country = gr.a2 AND adr.region = gr.region) + LEFT JOIN emails AS em ON (em.uid = u.user_id AND em.flags = 'active') + INNER JOIN profile_names_display AS nd ON (nd.user_id = u.user_id)" . (S::logged() ? - "LEFT JOIN contacts AS c On (c.contact = u.user_id AND c.uid = " . S::v('uid') . ")" + "LEFT JOIN contacts AS c ON (c.contact = u.user_id AND c.uid = " . S::v('uid') . ")" : ""); } @@ -472,11 +473,12 @@ class GadgetView implements PlView public function joins() { - return "LEFT JOIN adresses AS adr ON (u.user_id = adr.uid AND FIND_IN_SET('active', adr.statut)".(S::logged() ? "" : " AND adr.pub = 'public'").") - LEFT JOIN geoloc_pays AS gp ON (adr.country = gp.a2) - LEFT JOIN geoloc_region AS gr ON (adr.country = gr.a2 AND adr.region = gr.region)" . + return "LEFT JOIN adresses AS adr ON (u.user_id = adr.uid AND FIND_IN_SET('active', adr.statut)".(S::logged() ? "" : " + AND adr.pub = 'public'").") + LEFT JOIN geoloc_pays AS gp ON (adr.country = gp.a2) + LEFT JOIN geoloc_region AS gr ON (adr.country = gr.a2 AND adr.region = gr.region)" . (S::logged() ? - "LEFT JOIN contacts AS c On (c.contact = u.user_id AND c.uid = " . S::v('uid') . ")" + "LEFT JOIN contacts AS c ON (c.contact = u.user_id AND c.uid = " . S::v('uid') . ")" : ""); } diff --git a/modules/profile.php b/modules/profile.php index 419b3bf..765afe8 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -24,50 +24,50 @@ class ProfileModule extends PLModule function handlers() { return array( - 'photo' => $this->make_hook('photo', AUTH_PUBLIC), - 'photo/change' => $this->make_hook('photo_change', AUTH_MDP), - - 'fiche.php' => $this->make_hook('fiche', AUTH_PUBLIC), - 'profile' => $this->make_hook('profile', AUTH_PUBLIC), - 'profile/private' => $this->make_hook('profile', AUTH_COOKIE), - 'profile/ax' => $this->make_hook('ax', AUTH_COOKIE, 'admin'), - 'profile/edit' => $this->make_hook('p_edit', AUTH_MDP), - 'profile/ajax/address' => $this->make_hook('ajax_address', AUTH_COOKIE, 'user', NO_AUTH), - 'profile/ajax/tel' => $this->make_hook('ajax_tel', AUTH_COOKIE, 'user', NO_AUTH), - 'profile/ajax/edu' => $this->make_hook('ajax_edu', AUTH_COOKIE, 'user', NO_AUTH), - 'profile/ajax/medal' => $this->make_hook('ajax_medal', AUTH_COOKIE, 'user', NO_AUTH), - 'profile/networking' => $this->make_hook('networking', AUTH_PUBLIC), - 'profile/ajax/job' => $this->make_hook('ajax_job', AUTH_COOKIE, 'user', NO_AUTH), - 'profile/ajax/secteur' => $this->make_hook('ajax_secteur', AUTH_COOKIE, 'user', NO_AUTH), - 'profile/ajax/skill' => $this->make_hook('ajax_skill', AUTH_COOKIE, 'user', NO_AUTH), - 'profile/ajax/searchname' => $this->make_hook('ajax_searchname', AUTH_COOKIE, 'user', NO_AUTH), - 'javascript/applis.js' => $this->make_hook('applis_js', AUTH_COOKIE), - 'javascript/grades.js' => $this->make_hook('grades_js', AUTH_COOKIE), - 'profile/medal' => $this->make_hook('medal', AUTH_PUBLIC), - 'profile/orange' => $this->make_hook('p_orange', AUTH_MDP), - 'profile/usage' => $this->make_hook('p_usage', AUTH_MDP), - - 'referent' => $this->make_hook('referent', AUTH_COOKIE), - 'emploi' => $this->make_hook('ref_search', AUTH_COOKIE), - 'referent/search' => $this->make_hook('ref_search', AUTH_COOKIE), - 'referent/ssect' => $this->make_hook('ref_sect', AUTH_COOKIE, 'user', NO_AUTH), - 'referent/country' => $this->make_hook('ref_country', AUTH_COOKIE, 'user', NO_AUTH), - - 'groupes-x' => $this->make_hook('xnet', AUTH_COOKIE), - - 'vcard' => $this->make_hook('vcard', AUTH_COOKIE, 'user', NO_HTTPS), - 'admin/binets' => $this->make_hook('admin_binets', AUTH_MDP, 'admin'), - 'admin/medals' => $this->make_hook('admin_medals', AUTH_MDP, 'admin'), - 'admin/education' => $this->make_hook('admin_education', AUTH_MDP, 'admin'), - 'admin/education_field' => $this->make_hook('admin_education_field', AUTH_MDP, 'admin'), - 'admin/education_degree' => $this->make_hook('admin_education_degree', AUTH_MDP, 'admin'), + 'photo' => $this->make_hook('photo', AUTH_PUBLIC), + 'photo/change' => $this->make_hook('photo_change', AUTH_MDP), + + 'fiche.php' => $this->make_hook('fiche', AUTH_PUBLIC), + 'profile' => $this->make_hook('profile', AUTH_PUBLIC), + 'profile/private' => $this->make_hook('profile', AUTH_COOKIE), + 'profile/ax' => $this->make_hook('ax', AUTH_COOKIE, 'admin'), + 'profile/edit' => $this->make_hook('p_edit', AUTH_MDP), + 'profile/ajax/address' => $this->make_hook('ajax_address', AUTH_COOKIE, 'user', NO_AUTH), + 'profile/ajax/tel' => $this->make_hook('ajax_tel', AUTH_COOKIE, 'user', NO_AUTH), + 'profile/ajax/edu' => $this->make_hook('ajax_edu', AUTH_COOKIE, 'user', NO_AUTH), + 'profile/ajax/medal' => $this->make_hook('ajax_medal', AUTH_COOKIE, 'user', NO_AUTH), + 'profile/networking' => $this->make_hook('networking', AUTH_PUBLIC), + 'profile/ajax/job' => $this->make_hook('ajax_job', AUTH_COOKIE, 'user', NO_AUTH), + 'profile/ajax/secteur' => $this->make_hook('ajax_secteur', AUTH_COOKIE, 'user', NO_AUTH), + 'profile/ajax/skill' => $this->make_hook('ajax_skill', AUTH_COOKIE, 'user', NO_AUTH), + 'profile/ajax/searchname' => $this->make_hook('ajax_searchname', AUTH_COOKIE, 'user', NO_AUTH), + 'javascript/applis.js' => $this->make_hook('applis_js', AUTH_COOKIE), + 'javascript/grades.js' => $this->make_hook('grades_js', AUTH_COOKIE), + 'profile/medal' => $this->make_hook('medal', AUTH_PUBLIC), + 'profile/orange' => $this->make_hook('p_orange', AUTH_MDP), + 'profile/usage' => $this->make_hook('p_usage', AUTH_MDP), + + 'referent' => $this->make_hook('referent', AUTH_COOKIE), + 'emploi' => $this->make_hook('ref_search', AUTH_COOKIE), + 'referent/search' => $this->make_hook('ref_search', AUTH_COOKIE), + 'referent/ssect' => $this->make_hook('ref_sect', AUTH_COOKIE, 'user', NO_AUTH), + 'referent/country' => $this->make_hook('ref_country', AUTH_COOKIE, 'user', NO_AUTH), + + 'groupes-x' => $this->make_hook('xnet', AUTH_COOKIE), + + 'vcard' => $this->make_hook('vcard', AUTH_COOKIE, 'user', NO_HTTPS), + 'admin/binets' => $this->make_hook('admin_binets', AUTH_MDP, 'admin'), + 'admin/medals' => $this->make_hook('admin_medals', AUTH_MDP, 'admin'), + 'admin/education' => $this->make_hook('admin_education', AUTH_MDP, 'admin'), + 'admin/education_field' => $this->make_hook('admin_education_field', AUTH_MDP, 'admin'), + 'admin/education_degree' => $this->make_hook('admin_education_degree', AUTH_MDP, 'admin'), 'admin/education_degree_set' => $this->make_hook('admin_education_degree_set', AUTH_MDP, 'admin'), - 'admin/sections' => $this->make_hook('admin_sections', AUTH_MDP, 'admin'), - 'admin/secteurs' => $this->make_hook('admin_secteurs', AUTH_MDP, 'admin'), - 'admin/networking' => $this->make_hook('admin_networking', AUTH_MDP, 'admin'), - 'admin/trombino' => $this->make_hook('admin_trombino', AUTH_MDP, 'admin'), - 'admin/ss_secteurs' => $this->make_hook('admin_ss_secteurs', AUTH_MDP, 'admin'), - 'admin/fonctions' => $this->make_hook('admin_fonctions', AUTH_MDP, 'admin'), + 'admin/sections' => $this->make_hook('admin_sections', AUTH_MDP, 'admin'), + 'admin/secteurs' => $this->make_hook('admin_secteurs', AUTH_MDP, 'admin'), + 'admin/networking' => $this->make_hook('admin_networking', AUTH_MDP, 'admin'), + 'admin/trombino' => $this->make_hook('admin_trombino', AUTH_MDP, 'admin'), + 'admin/ss_secteurs' => $this->make_hook('admin_ss_secteurs', AUTH_MDP, 'admin'), + 'admin/fonctions' => $this->make_hook('admin_fonctions', AUTH_MDP, 'admin'), ); } diff --git a/modules/search.php b/modules/search.php index c4d96af..1de908c 100644 --- a/modules/search.php +++ b/modules/search.php @@ -172,19 +172,19 @@ class SearchModule extends PLModule $this->form_prepare(); } else { $textFields = array( - 'country' => array('field' => 'a2', 'table' => 'geoloc_pays', 'text' => 'pays', 'exact' => false), - 'fonction' => array('field' => 'id', 'table' => 'fonctions_def', 'text' => 'fonction_fr', 'exact' => true), - 'secteur' => array('field' => 'id', 'table' => 'emploi_secteur', 'text' => 'label', 'exact' => false), - 'nationalite' => array('field' => 'a2', 'table' => 'geoloc_pays', 'text' => 'nat', 'exact' => 'false'), - 'binet' => array('field' => 'id', 'table' => 'binets_def', 'text' => 'text', 'exact' => false), + 'country' => array('field' => 'a2', 'table' => 'geoloc_pays', 'text' => 'pays', 'exact' => false), + 'fonction' => array('field' => 'id', 'table' => 'fonctions_def', 'text' => 'fonction_fr', 'exact' => true), + 'secteur' => array('field' => 'id', 'table' => 'emploi_secteur', 'text' => 'label', 'exact' => false), + 'nationalite' => array('field' => 'a2', 'table' => 'geoloc_pays', 'text' => 'nat', 'exact' => 'false'), + 'binet' => array('field' => 'id', 'table' => 'binets_def', 'text' => 'text', 'exact' => false), 'networking_type' => array('field' => 'network_type', 'table' => 'profile_networking_enum', 'text' => 'name', 'exact' => false), - 'groupex' => array('field' => 'id', 'table' => 'groupex.asso', - 'text' => "(a.cat = 'GroupesX' OR a.cat = 'Institutions') AND pub = 'public' AND nom", - 'exact' => false), - 'section' => array('field' => 'id', 'table' => 'sections', 'text' => 'text', 'exact' => false), - 'school' => array('field' => 'id', 'table' => 'profile_education_enum', 'text' => 'name', 'exact' => false), - 'city' => array('table' => 'geoloc_city', 'text' => 'name', 'exact' => false) + 'groupex' => array('field' => 'id', 'table' => 'groupex.asso', + 'text' => "(a.cat = 'GroupesX' OR a.cat = 'Institutions') AND pub = 'public' AND nom", + 'exact' => false), + 'section' => array('field' => 'id', 'table' => 'sections', 'text' => 'text', 'exact' => false), + 'school' => array('field' => 'id', 'table' => 'profile_education_enum', 'text' => 'name', 'exact' => false), + 'city' => array('table' => 'geoloc_city', 'text' => 'name', 'exact' => false) ); if (!Env::has('page')) { S::logger()->log('search', 'adv=' . var_export($_GET, true)); @@ -264,7 +264,7 @@ class SearchModule extends PLModule case 'binetTxt': $db = '`binets_def` INNER JOIN `binets_ins` ON(`binets_def`.`id` = `binets_ins`.`binet_id`)'; - $field='`binets_def`.`text`'; + $field = '`binets_def`.`text`'; if (strlen($q) > 2) $beginwith = false; $realid = '`binets_def`.`id`'; @@ -285,15 +285,15 @@ class SearchModule extends PLModule case 'countryTxt': $db = '`geoloc_pays` INNER JOIN `adresses` ON(`geoloc_pays`.`a2` = `adresses`.`country`)'; - $unique='`uid`'; + $unique = '`uid`'; $field = '`geoloc_pays`.`pays`'; $field2 = '`geoloc_pays`.`country`'; - $realid='`geoloc_pays`.`a2`'; + $realid = '`geoloc_pays`.`a2`'; break; case 'entreprise': $db = '`entreprises`'; $field = '`entreprise`'; - $unique='`uid`'; + $unique = '`uid`'; break; case 'firstname': $field = '`prenom`'; @@ -342,7 +342,7 @@ class SearchModule extends PLModule case 'poste': $db = '`entreprises`'; $field = '`poste`'; - $unique='`uid`'; + $unique = '`uid`'; break; case 'schoolTxt': $db = 'profile_education_enum INNER JOIN diff --git a/modules/search/classes.inc.php b/modules/search/classes.inc.php index 5c0307b..d51ebe3 100644 --- a/modules/search/classes.inc.php +++ b/modules/search/classes.inc.php @@ -50,12 +50,12 @@ if (S::logged()) else $globals->search->result_fields .=" IF(q.profile_freetext_pub='public', q.profile_freetext, '') AS freetext, - IF(adr.pub='public', adr.city, '') AS city, - IF(adr.pub='public', gp.pays, '') AS countrytxt, - IF(adr.pub='public', gr.name, '') AS region, + IF(adr.pub='public', adr.city, '') AS city, + IF(adr.pub='public', gp.pays, '') AS countrytxt, + IF(adr.pub='public', gr.name, '') AS region, IF(e.pub='public', e.entreprise, '') AS entreprise, - IF(nw.pub='public', nw.address, '') AS networking_address, - IF(nw.pub='public', nwe.name, '') AS networking_name,"; + IF(nw.pub='public', nw.address, '') AS networking_address, + IF(nw.pub='public', nwe.name, '') AS networking_name,"; @$globals->search->result_where_statement = ' LEFT JOIN profile_education AS edu0 ON (u.user_id = edu0.uid AND edu0.id = 0) LEFT JOIN profile_education_enum AS ede0 ON (ede0.id = edu0.eduid) @@ -73,18 +73,18 @@ else LEFT JOIN profile_education_enum AS ede3 ON (ede3.id = edu3.eduid) LEFT JOIN profile_education_degree_enum AS edd3 ON (edd3.id = edu3.degreeid) LEFT JOIN profile_education_field_enum AS f3 ON (f3.id = edu3.fieldid) - LEFT JOIN entreprises AS e ON (e.entrid = 0 AND e.uid = u.user_id) - LEFT JOIN emploi_secteur AS es ON (e.secteur = es.id) - LEFT JOIN fonctions_def AS ef ON (e.fonction = ef.id) - LEFT JOIN geoloc_pays AS n1 ON (u.nationalite = n1.a2) - LEFT JOIN geoloc_pays AS n2 ON (u.nationalite2 = n2.a2) - LEFT JOIN geoloc_pays AS n3 ON (u.nationalite3 = n3.a2) - LEFT JOIN adresses AS adr ON (u.user_id = adr.uid AND FIND_IN_SET(\'active\',adr.statut)) - LEFT JOIN geoloc_pays AS gp ON (adr.country = gp.a2) - LEFT JOIN geoloc_region AS gr ON (adr.country = gr.a2 AND adr.region = gr.region) - LEFT JOIN emails AS em ON (em.uid = u.user_id AND em.flags = \'active\') - LEFT JOIN profile_networking AS nw ON (nw.uid = u.user_id) - LEFT JOIN profile_networking_enum AS nwe ON (nwe.network_type = nw.network_type)'; + LEFT JOIN entreprises AS e ON (e.entrid = 0 AND e.uid = u.user_id) + LEFT JOIN emploi_secteur AS es ON (e.secteur = es.id) + LEFT JOIN fonctions_def AS ef ON (e.fonction = ef.id) + LEFT JOIN geoloc_pays AS n1 ON (u.nationalite = n1.a2) + LEFT JOIN geoloc_pays AS n2 ON (u.nationalite2 = n2.a2) + LEFT JOIN geoloc_pays AS n3 ON (u.nationalite3 = n3.a2) + LEFT JOIN adresses AS adr ON (u.user_id = adr.uid AND FIND_IN_SET(\'active\',adr.statut)) + LEFT JOIN geoloc_pays AS gp ON (adr.country = gp.a2) + LEFT JOIN geoloc_region AS gr ON (adr.country = gr.a2 AND adr.region = gr.region) + LEFT JOIN emails AS em ON (em.uid = u.user_id AND em.flags = \'active\') + LEFT JOIN profile_networking AS nw ON (nw.uid = u.user_id) + LEFT JOIN profile_networking_enum AS nwe ON (nwe.network_type = nw.network_type)'; // }}} // {{{ class ThrowError diff --git a/modules/search/search.inc.php b/modules/search/search.inc.php index c91dc54..863d1ae 100644 --- a/modules/search/search.inc.php +++ b/modules/search/search.inc.php @@ -23,7 +23,7 @@ require_once dirname(__FILE__).'/classes.inc.php'; // {{{ function advancedSearchFromInput function getadr_join($table) { - return 'u.user_id='.$table.'.uid'.(Env::v('only_current',false)?' AND FIND_IN_SET(\'active\','.$table.'.statut)':''); + return 'u.user_id = ' . $table . '.uid' . (Env::v('only_current', false) ? ' AND FIND_IN_SET(\'active\', ' . $table . '.statut)' : ''); } function advancedSearchFromInput() { @@ -31,55 +31,58 @@ function advancedSearchFromInput() $nameField = new RefWithSoundexSField('name',array('rn.nom1_soundex','rn.nom2_soundex','rn.nom3_soundex'),'recherche_soundex','rn','u.matricule = rn.matricule'); $firstnameField = new RefWithSoundexSField('firstname',array('rp.prenom1_soundex','rp.prenom2_soundex'),'recherche_soundex','rp','u.matricule = rp.matricule'); } else { - $nameField = new NameSField('name',array('u.nom','u.nom_usage'),''); - $firstnameField = new StringSField('firstname',array('u.prenom'),''); + $nameField = new NameSField('name', array('u.nom','u.nom_usage'), ''); + $firstnameField = new StringSField('firstname', array('u.prenom'), ''); } - $nicknameField = new StringSField('nickname',array('q.profile_nick'),''); + $nicknameField = new StringSField('nickname', array('q.profile_nick'), ''); - $promo1Field = new PromoSField('promo1','egal1',array('u.promo'),''); - $promo2Field = new PromoSField('promo2','egal2',array('u.promo'),''); - $womanField = new RefSField('woman',array('FIND_IN_SET(\'femme\',u.flags)+1'),'','',''); - $subscriberField = new RefSField('subscriber',array('!(u.perms IN (\'admin\',\'user\'))+1'),'','',''); - $aliveField = new RefSField('alive',array('(u.deces!=0)+1'),'','',''); + $promo1Field = new PromoSField('promo1', 'egal1', array('u.promo'), ''); + $promo2Field = new PromoSField('promo2', 'egal2', array('u.promo'), ''); + $womanField = new RefSField('woman', array('FIND_IN_SET(\'femme\', u.flags) + 1'), '', '', ''); + $subscriberField = new RefSField('subscriber', array('!(u.perms IN (\'admin\', \'user\')) + 1'), '', '', ''); + $aliveField = new RefSField('alive', array('(u.deces != 0) + 1'), '', '', ''); if (Env::v('only_referent') == 'on') { - $referentField = new RefSField('only_referent', array('"on"'), 'mentor', 'mt', 'mt.expertise != "" AND mt.uid=u.user_id'); + $referentField = new RefSField('only_referent', array('"on"'), 'mentor', 'mt', 'mt.expertise != "" AND mt.uid = u.user_id'); } else { - $referentField = null; + $referentField = null; } if (!Env::i('cityid')) { - $townField = new RefSField('city',array('ac.city', 'ac.postcode'),'adresses','ac',getadr_join('ac'),false); + $townField = new RefSField('city', array('ac.city', 'ac.postcode'), 'adresses', 'ac', getadr_join('ac'), false); } else { - $townField = new RefSField('cityid',array('av.cityid', 'av.postcode'),'adresses','av',getadr_join('av')); + $townField = new RefSField('cityid', array('av.cityid', 'av.postcode'), 'adresses', 'av', getadr_join('av')); } - $countryField = new RefSField('country',array('ap.country'),'adresses','ap',getadr_join('ap')); - $regionField = new RefSField('region',array('ar.region'),'adresses','ar',getadr_join('ar')); - $mapField = new MapSField('mapid', array('sgcim.map_id'), array('adresses','geoloc_city_in_maps'), array('amp','sgcim'), array(getadr_join('amp'), 'amp.cityid = sgcim.city_id')); + $countryField = new RefSField('country', array('ap.country'), 'adresses', 'ap',g etadr_join('ap')); + $regionField = new RefSField('region',array('ar.region'), 'adresses', 'ar', getadr_join('ar')); + $mapField = new MapSField('mapid', array('sgcim.map_id'), array('adresses', 'geoloc_city_in_maps'), + array('amp', 'sgcim'), array(getadr_join('amp'), 'amp.cityid = sgcim.city_id')); - $entrepriseField = new RefSField('entreprise',array('ee.entreprise'),'entreprises','ee','u.user_id=ee.uid',false); - $posteField = new RefSField('poste',array('ep.poste'),'entreprises','ep','u.user_id=ep.uid', false); - $fonctionField = new RefSField('fonction',array('en.fonction'),'entreprises','en','u.user_id=en.uid'); - $secteurField = new RefSField('secteur',array('fm.secteur'),'entreprises','fm','u.user_id=fm.uid'); - $cvField = new RefSField('cv',array('u.cv'),'','','',false); + $entrepriseField = new RefSField('entreprise', array('ee.entreprise'), 'entreprises', 'ee', 'u.user_id = ee.uid', false); + $posteField = new RefSField('poste', array('ep.poste'), 'entreprises', 'ep', 'u.user_id = ep.uid', false); + $fonctionField = new RefSField('fonction', array('en.fonction'), 'entreprises', 'en', 'u.user_id = en.uid'); + $secteurField = new RefSField('secteur', array('fm.secteur'), 'entreprises', 'fm', 'u.user_id = fm.uid'); + $cvField = new RefSField('cv', array('u.cv'), '', '', '', false); - $natField = new RefSField('nationalite',array('u.nationalite', 'u.nationalite2', 'u.nationalite3'),'','',''); - $binetField = new RefSField('binet',array('b.binet_id'),'binets_ins','b','u.user_id=b.user_id'); - $groupexField = new RefSField('groupex',array('g.id'),array('groupex.asso', 'groupex.membres'),array('g', 'gm'), - array("(g.cat = 'GroupesX' OR g.cat = 'Institutions') AND g.pub = 'public'", - 'gm.asso_id = g.id AND u.user_id=gm.uid')); - $sectionField = new RefSField('section',array('u.section'),'','',''); - $schoolField = new RefSField('school', array('edu.eduid'), 'profile_education', 'edu', 'u.user_id = edu.uid'); - $diplomaField = new RefSField('diploma', array('edd.degreeid'), 'profile_education', 'edd', 'u.user_id = edd.uid'); + $natField = new RefSField('nationalite', array('u.nationalite', 'u.nationalite2', 'u.nationalite3'), '', '', ''); + $binetField = new RefSField('binet', array('b.binet_id'), 'binets_ins', 'b', 'u.user_id=b.user_id'); + $groupexField = new RefSField('groupex', array('g.id'), array('groupex.asso', 'groupex.membres'), array('g', 'gm'), + array("(g.cat = 'GroupesX' OR g.cat = 'Institutions') AND g.pub = 'public'", + 'gm.asso_id = g.id AND u.user_id = gm.uid')); + $sectionField = new RefSField('section', array('u.section'), '', '', ''); + $schoolField = new RefSField('school', array('edu.eduid'), 'profile_education', 'edu', 'u.user_id = edu.uid'); + $diplomaField = new RefSField('diploma', array('edd.degreeid'), 'profile_education', 'edd', 'u.user_id = edd.uid'); - $freeField = new RefSField('free',array('q.profile_freetext'),'','','',false); + $freeField = new RefSField('free', array('q.profile_freetext'), '', '', '', false); - $nwAddressField = new RefSField('networking_address', array('nw.address'), 'profile_networking', 'nw', 'nw.uid=u.user_id', false); + $nwAddressField = new RefSField('networking_address', array('nw.address'), 'profile_networking', 'nw', 'nw.uid=u.user_id', false); if (Env::v('networking_address') == '') { - $nwTypeField = new IndexSField('networking_type', array('nwe.network_type'), array('profile_networking', 'profile_networking_enum'), array('nw', 'nwe'), array('nw.uid = u.user_id', 'nwe.network_type = nw.network_type')); + $nwTypeField = new IndexSField('networking_type', array('nwe.network_type'), array('profile_networking', 'profile_networking_enum'), + array('nw', 'nwe'), array('nw.uid = u.user_id', 'nwe.network_type = nw.network_type')); } else { - $nwTypeField = new IndexSField('networking_type', array('nwe.network_type'), 'profile_networking_enum', 'nwe', 'nwe.network_type = nw.network_type'); + $nwTypeField = new IndexSField('networking_type', + array('nwe.network_type'), 'profile_networking_enum', 'nwe', 'nwe.network_type = nw.network_type'); } - $nwPhoneField = new PhoneSField('phone_number', array('t.search_tel'), 'profile_phones', 't', 't.uid=u.user_id'); + $nwPhoneField = new PhoneSField('phone_number', array('t.search_tel'), 'profile_phones', 't', 't.uid = u.user_id'); return array( $nameField, $firstnameField, $nicknameField, $promo1Field, $promo2Field, $womanField, $subscriberField, $aliveField, -- 2.1.4