2 function directory_init(&$a) {
3 $a->set_pager_itemspage(60);
6 function directory_content(&$a) {
8 $search = ((x($_GET,'search')) ? notags(trim($_GET['search'])) : '');
10 $tpl .= file_get_contents('view/directory_header.tpl');
12 $o .= replace_macros($tpl, array(
14 '$finding' => (strlen($search) ? "<h4>Finding: '$search'</h4>" : "")
18 $search = dbesc($search);
19 $sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, `user`.`nickname`, `locality`,`region`,`country-name`,`gender`,`marital`,`sexual`,`about`,`romance`,`work`,`education`) AGAINST ('$search' IN BOOLEAN MODE) " : "");
22 $r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `publish` = 1 AND `user`.`blocked` = 0 $sql_extra ");
24 $a->set_pager_total($r[0]['total']);
28 $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `publish` = 1 AND `user`.`blocked` = 0 $sql_extra ORDER BY `name` ASC LIMIT %d , %d ",
29 intval($a->pager['start']),
30 intval($a->pager['itemspage'])
34 $tpl = file_get_contents('view/directory_item.tpl');
36 if(in_array('small', $a->argv))
44 $profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
46 if(strlen($rr['locality']))
47 $details .= $rr['locality'];
48 if(strlen($rr['region'])) {
49 if(strlen($rr['locality']))
51 $details .= $rr['region'];
53 if(strlen($rr['country-name'])) {
56 $details .= $rr['country-name'];
58 if(strlen($rr['dob'])) {
59 if(($years = age($rr['dob'],$rr['timezone'],'')) != 0)
60 $details .= "<br />Age: $years" ;
62 if(strlen($rr['gender']))
63 $details .= '<br />Gender: ' . $rr['gender'];
65 $o .= replace_macros($tpl,array(
67 '$profile-link' => $profile_link,
68 '$photo' => $rr[$photo],
69 '$alt-text' => $rr['name'],
70 '$name' => $rr['name'],
71 '$details' => $details
77 $o .= "<div class=\"directory-end\" ></div>\r\n";
82 notice("No entries (some entries may be hidden).");