diff options
-rw-r--r-- | include/acl_selectors.php | 4 | ||||
-rw-r--r-- | include/notifier.php | 7 | ||||
-rw-r--r-- | include/text.php | 4 | ||||
-rw-r--r-- | mod/acl.php | 8 | ||||
-rw-r--r-- | mod/contacts.php | 43 | ||||
-rw-r--r-- | mod/viewcontacts.php | 4 | ||||
-rw-r--r-- | view/contact_edit.tpl | 3 | ||||
-rw-r--r-- | view/theme/duepuntozero/style.css | 2 |
8 files changed, 56 insertions, 19 deletions
diff --git a/include/acl_selectors.php b/include/acl_selectors.php index a5f5aff53..461ad0c36 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -122,7 +122,7 @@ function contact_selector($selname, $selclass, $preselected = false, $options) { $o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"" . $x['size'] . "$\" $tabindex >\r\n"; $r = q("SELECT `id`, `name`, `url`, `network` FROM `contact` - WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `notify` != '' + WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != '' $sql_extra ORDER BY `name` ASC ", intval(local_user()) @@ -188,7 +188,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p $o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" $tabindex >\r\n"; $r = q("SELECT `id`, `name`, `url`, `network` FROM `contact` - WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `notify` != '' + WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != '' $sql_extra ORDER BY `name` ASC ", intval(local_user()) diff --git a/include/notifier.php b/include/notifier.php index ca7c7b92e..922e869f6 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -304,7 +304,7 @@ function notifier_run($argv, $argc){ $conversant_str = dbesc(implode(', ',$conversants)); } - $r = q("SELECT * FROM `contact` WHERE `id` IN ( $conversant_str ) AND `blocked` = 0 AND `pending` = 0"); + $r = q("SELECT * FROM `contact` WHERE `id` IN ( $conversant_str ) AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0"); if(count($r)) $contacts = $r; @@ -520,7 +520,8 @@ function notifier_run($argv, $argc){ `user`.* FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid` - WHERE `contact`.`blocked` = 0 AND `contact`.`pending` = 0 + WHERE `contact`.`blocked` = 0 AND `contact`.`archive` = 0 + AND `contact`.`pending` = 0 AND `contact`.`network` = '%s' AND `user`.`nickname` = '%s' $sql_extra AND `user`.`account_expired` = 0 LIMIT 1", @@ -769,7 +770,7 @@ function notifier_run($argv, $argc){ ); $r2 = q("SELECT `id`, `name`,`network` FROM `contact` - WHERE `network` in ( '%s', '%s') AND `uid` = %d AND `blocked` = 0 AND `pending` = 0 + WHERE `network` in ( '%s', '%s') AND `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `rel` != %d order by rand() ", dbesc(NETWORK_DFRN), dbesc(NETWORK_MAIL2), diff --git a/include/text.php b/include/text.php index 8c8db66a9..af32b2476 100644 --- a/include/text.php +++ b/include/text.php @@ -558,7 +558,7 @@ function contact_block() { if((! is_array($a->profile)) || ($a->profile['hide-friends'])) return $o; - $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0", + $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0", intval($a->profile['uid']) ); if(count($r)) { @@ -569,7 +569,7 @@ function contact_block() { $micropro = Null; } else { - $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 ORDER BY RAND() LIMIT %d", + $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ORDER BY RAND() LIMIT %d", intval($a->profile['uid']), intval($shown) ); diff --git a/mod/acl.php b/mod/acl.php index c23ee1a67..88f150d7a 100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -33,7 +33,7 @@ function acl_init(&$a){ if ($type=='' || $type=='c'){ $r = q("SELECT COUNT(`id`) AS c FROM `contact` WHERE `uid` = %d AND `self` = 0 - AND `blocked` = 0 AND `pending` = 0 + AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != '' $sql_extra2" , intval(local_user()) ); @@ -45,7 +45,7 @@ function acl_init(&$a){ $r = q("SELECT COUNT(`id`) AS c FROM `contact` WHERE `uid` = %d AND `self` = 0 - AND `blocked` = 0 AND `pending` = 0 + AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `network` IN ('%s','%s','%s') $sql_extra2" , intval(local_user()), dbesc(NETWORK_DFRN), @@ -94,7 +94,7 @@ function acl_init(&$a){ if ($type=='' || $type=='c'){ $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact` - WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `notify` != '' + WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != '' $sql_extra2 ORDER BY `name` ASC ", intval(local_user()) @@ -102,7 +102,7 @@ function acl_init(&$a){ } elseif($type == 'm') { $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact` - WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 + WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `network` IN ('%s','%s','%s') $sql_extra2 ORDER BY `name` ASC ", diff --git a/mod/contacts.php b/mod/contacts.php index 8670c0c80..754350ae5 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -182,6 +182,22 @@ function contacts_content(&$a) { return; // NOTREACHED } + + if($cmd === 'archive') { + $archived = (($orig_record[0]['archive']) ? 0 : 1); + $r = q("UPDATE `contact` SET `archive` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1", + intval($archived), + intval($contact_id), + intval(local_user()) + ); + if($r) { + //notice( t('Contact has been ') . (($archived) ? t('archived') : t('unarchived')) . EOL ); + info( (($archived) ? t('Contact has been archived') : t('Contact has been unarchived')) . EOL ); + } + goaway($a->get_baseurl(true) . '/contacts/' . $contact_id); + return; // NOTREACHED + } + if($cmd === 'drop') { require_once('include/Contact.php'); @@ -280,6 +296,12 @@ function contacts_content(&$a) { 'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/ignore', 'sel' => '', ), + + array( + 'label' => (($contact['archive']) ? t('Unarchive') : t('Archive') ), + 'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/archive', + 'sel' => '', + ), array( 'label' => t('Repair'), 'url' => $a->get_baseurl(true) . '/crepair/' . $contact_id, @@ -324,6 +346,7 @@ function contacts_content(&$a) { '$info' => $contact['info'], '$blocked' => (($contact['blocked']) ? t('Currently blocked') : ''), '$ignored' => (($contact['readonly']) ? t('Currently ignored') : ''), + '$archived' => (($contact['archive']) ? t('Currently archived') : ''), '$hidden' => array('hidden', t('Hide this contact from others'), ($contact['hidden'] == 1), t('Replies/likes to your public posts <strong>may</strong> still be visible')), '$photo' => $contact['photo'], '$name' => $contact['name'], @@ -365,6 +388,10 @@ function contacts_content(&$a) { $sql_extra = " AND `readonly` = 1 "; $ignored = true; } + elseif(($a->argc == 2) && ($a->argv[1] === 'archived')) { + $sql_extra = " AND `archive` = 1 "; + $archived = true; + } else $sql_extra = " AND `blocked` = 0 "; @@ -383,25 +410,31 @@ function contacts_content(&$a) { 'sel' => ($all) ? 'active' : '', ), array( - 'label' => t('Unblocked Contacts'), + 'label' => t('Unblocked'), 'url' => $a->get_baseurl(true) . '/contacts', - 'sel' => ((! $all) && (! $blocked) && (! $hidden) && (! $search) && (! $nets) && (! $ignored)) ? 'active' : '', + 'sel' => ((! $all) && (! $blocked) && (! $hidden) && (! $search) && (! $nets) && (! $ignored) && (! $archived)) ? 'active' : '', ), array( - 'label' => t('Blocked Contacts'), + 'label' => t('Blocked'), 'url' => $a->get_baseurl(true) . '/contacts/blocked', 'sel' => ($blocked) ? 'active' : '', ), array( - 'label' => t('Ignored Contacts'), + 'label' => t('Ignored'), 'url' => $a->get_baseurl(true) . '/contacts/ignored', 'sel' => ($ignored) ? 'active' : '', ), array( - 'label' => t('Hidden Contacts'), + 'label' => t('Archived'), + 'url' => $a->get_baseurl(true) . '/contacts/archived', + 'sel' => ($archived) ? 'active' : '', + ), + + array( + 'label' => t('Hidden'), 'url' => $a->get_baseurl(true) . '/contacts/hidden', 'sel' => ($hidden) ? 'active' : '', ), diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php index e7d26b73e..8e261e711 100644 --- a/mod/viewcontacts.php +++ b/mod/viewcontacts.php @@ -24,13 +24,13 @@ function viewcontacts_content(&$a) { } - $r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 ", + $r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ", intval($a->profile['uid']) ); if(count($r)) $a->set_pager_total($r[0]['total']); - $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 ORDER BY `name` ASC LIMIT %d , %d ", + $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ORDER BY `name` ASC LIMIT %d , %d ", intval($a->profile['uid']), intval($a->pager['start']), intval($a->pager['itemspage']) diff --git a/view/contact_edit.tpl b/view/contact_edit.tpl index 417578a32..6c66536dd 100644 --- a/view/contact_edit.tpl +++ b/view/contact_edit.tpl @@ -26,6 +26,9 @@ {{ if $ignored }} <li><div id="ignore-message">$ignored</div></li> {{ endif }} + {{ if $archived }} + <li><div id="archive-message">$archived</div></li> + {{ endif }} <li> </li> diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index 2667c4334..7cbcdc4d2 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -1571,7 +1571,7 @@ input#dfrn-url { .contact-photo-menu li a:hover { color: #FFFFFF; background: #3465A4; text-decoration: none; } -#block-message, #ignore-message { +#block-message, #ignore-message, #archive-message { color: #FF0000; } |