From be090cc8513504edcfaf368915e45308711f7e7c Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 14 Jun 2012 16:56:46 -0700 Subject: better handling of dead contacts --- mod/contacts.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mod/contacts.php') diff --git a/mod/contacts.php b/mod/contacts.php index a3e3f409b..f84a988c8 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -335,6 +335,7 @@ function contacts_content(&$a) { $tab_tpl = get_markup_template('common_tabs.tpl'); $tab_str = replace_macros($tab_tpl, array('$tabs' => $tabs)); + $lost_contact = (($contact['archive'] && $contact['term-date'] != '0000-00-00 00:00:00' && $contact['term-date'] < datetime_convert('','','now')) ? t('Communications lost with this contact!') : ''); $o .= replace_macros($tpl,array( '$header' => t('Contact Editor'), @@ -359,6 +360,7 @@ function contacts_content(&$a) { '$poll_interval' => contact_poll_interval($contact['priority'],(! $poll_enabled)), '$poll_enabled' => $poll_enabled, '$lastupdtext' => t('Last update:'), + '$lost_contact' => $lost_contact, '$updpub' => t('Update public posts'), '$last_update' => $last_update, '$udnow' => t('Update now'), -- cgit v1.2.3 From 0f0e5be549e4bea3086f59614ad5eb3458f2e53f Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 20 Jun 2012 16:05:46 -0700 Subject: contact search oddities --- mod/contacts.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'mod/contacts.php') diff --git a/mod/contacts.php b/mod/contacts.php index f84a988c8..1463af903 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -479,12 +479,13 @@ function contacts_content(&$a) { - + $searching = false; if($search) { $search_hdr = $search; - $search = dbesc($search.'*'); + $search = dbesc(protect_sprintf('%' . $search . '%'); + $searching = true; } - $sql_extra .= ((strlen($search)) ? " AND MATCH `name` AGAINST ('$search' IN BOOLEAN MODE) " : ""); + $sql_extra .= (($searching) ? " AND `name` REGEXP '$search' " : ""); if($nets) $sql_extra .= sprintf(" AND network = '%s' ", dbesc($nets)); -- cgit v1.2.3 From 03c05d8a2875e84b3de3b5a1aed0ee608aac302f Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 20 Jun 2012 16:07:41 -0700 Subject: missing paren --- mod/contacts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod/contacts.php') diff --git a/mod/contacts.php b/mod/contacts.php index 1463af903..423fd40a2 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -482,7 +482,7 @@ function contacts_content(&$a) { $searching = false; if($search) { $search_hdr = $search; - $search = dbesc(protect_sprintf('%' . $search . '%'); + $search = dbesc(protect_sprintf('%' . $search . '%')); $searching = true; } $sql_extra .= (($searching) ? " AND `name` REGEXP '$search' " : ""); -- cgit v1.2.3 From f4e434cd46efccde7d341d7ae9c2b11859fb41ce Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 20 Jun 2012 16:20:55 -0700 Subject: sort out contact search oddities --- mod/contacts.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'mod/contacts.php') diff --git a/mod/contacts.php b/mod/contacts.php index 423fd40a2..fb4595739 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -482,10 +482,10 @@ function contacts_content(&$a) { $searching = false; if($search) { $search_hdr = $search; - $search = dbesc(protect_sprintf('%' . $search . '%')); + $search_txt = dbesc(protect_sprintf(preg_quote($search))); $searching = true; } - $sql_extra .= (($searching) ? " AND `name` REGEXP '$search' " : ""); + $sql_extra .= (($searching) ? " AND `name` REGEXP '$search_txt' " : ""); if($nets) $sql_extra .= sprintf(" AND network = '%s' ", dbesc($nets)); @@ -502,7 +502,6 @@ function contacts_content(&$a) { } - $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ORDER BY `name` ASC LIMIT %d , %d ", intval($_SESSION['uid']), intval($a->pager['start']), @@ -569,7 +568,7 @@ function contacts_content(&$a) { '$total' => $total, '$search' => $search_hdr, '$desc' => t('Search your contacts'), - '$finding' => (strlen($search) ? t('Finding: ') . "'" . $search . "'" : ""), + '$finding' => (($searching) ? t('Finding: ') . "'" . $search . "'" : ""), '$submit' => t('Find'), '$cmd' => $a->cmd, '$contacts' => $contacts, -- cgit v1.2.3