diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/contacts.php | 25 | ||||
-rw-r--r-- | mod/directory.php | 2 | ||||
-rw-r--r-- | mod/install.php | 2 |
3 files changed, 23 insertions, 6 deletions
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) ? '<h4>' . t('Finding: ') . "'" . $search . "'" . '</h4>' : ""), + '$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 .= '<div id="contact-edit-end"></div>'; - $o .= paginate($a); } + $o .= paginate($a); return $o; }
\ No newline at end of file diff --git a/mod/directory.php b/mod/directory.php index dd80ef2b8..8b7f34c41 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -11,7 +11,7 @@ function directory_content(&$a) { $o .= replace_macros($tpl, array( '$search' => $search, - '$finding' => (strlen($search) ? "<h4>Finding: '$search'</h4>" : "") + '$finding' => (strlen($search) ? '<h4>' . t('Finding: ') . "'" . $search . "'" . '</h4>' : "") )); if($search) diff --git a/mod/install.php b/mod/install.php index cb23b31ed..dafc86ee6 100644 --- a/mod/install.php +++ b/mod/install.php @@ -16,7 +16,7 @@ function install_post(&$a) { $db = new dba($dbhost, $dbuser, $dbpass, $dbdata, $true); - if(! $db->getdb()) { + if(mysqli_connect_errno()) { notice( t('Could not connect to database.') . EOL); return; } |