* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-require_once("xorg.misc.inc.php");
-
// {{{ Global variables used for the search Queries
@$globals->search->result_fields = '
// hide private information if not logged
if (S::logged())
$globals->search->result_fields .='
- q.profile_mobile AS mobile,
q.profile_freetext AS freetext,
adr.city, gp.pays AS countrytxt, gr.name AS region,
e.entreprise,
nwe.name AS networking_name,';
else
$globals->search->result_fields .="
- IF(q.profile_mobile_pub='public', q.profile_mobile, '') AS mobile,
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,
*/
private static function defaultHandler($explain)
{
- global $page, $globals;
+ global $globals;
+ $page =& Platal::page();
$page->changeTpl('search/index.tpl');
- $page->assign('xorg_title','Polytechnique.org - Annuaire');
+ $page->setTitle('Polytechnique.org - Annuaire');
$page->assign('baseurl', $globals->baseurl);
$page->trigError($explain);
$page->run();
/** stores admin searches */
var $email;
var $ip;
+ /** stores phone number */
+ var $phone;
// }}}
// {{{ constructor
function isempty()
{
- return empty($this->strings) && empty($this->ranges) && empty($this->email) && empty($this->ip);
+ return empty($this->strings) && empty($this->ranges) && empty($this->email) && empty($this->ip) && empty($this->phone);
}
// }}}
$s = preg_replace('!\d+!', ' ', $s);
$this->strings = preg_split("![^a-zA-Z%]+!",$s, -1, PREG_SPLIT_NO_EMPTY);
if (count($this->strings) > 5) {
- global $page;
- $page->trigWarning("Tu as indiqué trop d'éléments dans ta recherche, seuls les 5 premiers seront pris en compte");
+ Platal::page()->trigWarning("Tu as indiqué trop d'éléments dans ta recherche, seuls les 5 premiers seront pris en compte");
$this->strings = array_slice($this->strings, 0, 5);
}
foreach ($ranges as $r) {
if (preg_match('!^([<>]\d{4}|\d{4}(-\d{4})?)$!', $r)) $this->ranges[] = $r;
}
+
+ $t = preg_replace('!(\d{4}-\d{4}|>\d{4}|<\d{4})!', '', $s);
+ $t = preg_replace('![<>\- ]!', '', $t);
+ if (strlen($t) > 4) {
+ $this->phone = $t;
+ }
}
// }}}
$ip = ip_to_uint($this->ip);
$where[] = "( ls.ip = $ip OR ls.forward_ip = $ip ) AND ls.suid = 0";
}
+ if (!empty($this->phone)){
+ require_once("profil.func.inc.php");
+ $phone = format_phone_number($this->phone) . "%";
+ $where[] = 't.search_tel LIKE ' . XDB::escape($phone);
+ }
return join(" AND ", $where);
}
if (!empty($this->ip)) {
$join .= "INNER JOIN logger.sessions AS ls ON (ls.uid = u.user_id)\n";
}
+ if (!empty($this->phone)) {
+ if (!S::logged()) {
+ $join .= "INNER JOIN profile_phones AS t ON (t.uid = u.user_id AND t.pub = 'public')";
+ } else {
+ $join .= "INNER JOIN profile_phones AS t ON (t.uid = u.user_id)";
+ }
+ }
return $join;
}
// }}}