From 1a1f9b296c163af850d68babfb844e617f154875 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Tue, 17 Aug 2010 18:44:13 -0700 Subject: contact search + sync to personal edition, installer db check + curl proxy --- mod/contacts.php | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'mod/contacts.php') diff --git a/mod/contacts.php b/mod/contacts.php index 2a767102f..45c0040c8 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -209,17 +209,31 @@ function contacts_content(&$a) { } + if(($a->argc == 2) && ($a->argv[1] == 'all')) $sql_extra = ''; else $sql_extra = " AND `blocked` = 0 "; + $search = ((x($_GET,'search')) ? notags(trim($_GET['search'])) : ''); + $tpl = file_get_contents("view/contacts-top.tpl"); $o .= replace_macros($tpl,array( '$hide_url' => ((strlen($sql_extra)) ? 'contacts/all' : 'contacts' ), - '$hide_text' => ((strlen($sql_extra)) ? t('Show Blocked Connections') : t('Hide Blocked Connections')) + '$hide_text' => ((strlen($sql_extra)) ? t('Show Blocked Connections') : t('Hide Blocked Connections')), + '$search' => $search, + '$finding' => (strlen($search) ? '

' . t('Finding: ') . "'" . $search . "'" . '

' : ""), + '$submit' => t('Find'), + '$cmd' => $a->cmd + + )); + if($search) + $search = dbesc($search.'*'); + $sql_extra .= ((strlen($search)) ? " AND MATCH `name` AGAINST ('$search' IN BOOLEAN MODE) " : ""); + + switch($sort_type) { case DIRECTION_BOTH : $sql_extra2 = " AND `dfrn-id` != '' AND `issued-id` != '' "; @@ -242,8 +256,11 @@ function contacts_content(&$a) { if(count($r)) $a->set_pager_total($r[0]['total']); - $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `pending` = 0 $sql_extra $sql_extra2 ", - intval($_SESSION['uid'])); + $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `pending` = 0 $sql_extra $sql_extra2 ORDER BY `name` ASC LIMIT %d , %d ", + intval($_SESSION['uid']), + intval($a->pager['start']), + intval($a->pager['itemspage']) + ); if(count($r)) { @@ -283,8 +300,8 @@ function contacts_content(&$a) { )); } $o .= '
'; - $o .= paginate($a); } + $o .= paginate($a); return $o; } \ No newline at end of file -- cgit v1.2.3