From 26c53580d128d3ebbbc3d6172525b80690a63255 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 27 Apr 2012 17:17:58 -0700 Subject: implement contact archival --- include/text.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/text.php') 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) ); -- cgit v1.2.3 From 10754ced3e51f796102005b9661b747c06fd4e0b Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 4 May 2012 06:42:56 -0700 Subject: category removal --- include/text.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index af32b2476..4ae5d1333 100644 --- a/include/text.php +++ b/include/text.php @@ -930,7 +930,7 @@ function prepare_body($item,$attach = false) { foreach($matches as $mtch) { if(strlen($x)) $x .= ','; - $x .= xmlify(file_tag_decode($mtch[1])); + $x .= xmlify(file_tag_decode($mtch[1])) . ' ' . t('[remove]') . ''; } if(strlen($x)) $s .= '
' . t('Categories:') . ' ' . $x . '
'; @@ -1466,12 +1466,16 @@ function file_tag_save_file($uid,$item,$file) { return true; } -function file_tag_unsave_file($uid,$item,$file) { +function file_tag_unsave_file($uid,$item,$file,$cat = false) { $result = false; if(! intval($uid)) return false; - $pattern = '[' . file_tag_encode($file) . ']' ; + if($cat == true) + $pattern = '<' . file_tag_encode($file) . '>' ; + else + $pattern = '[' . file_tag_encode($file) . ']' ; + $r = q("select file from item where id = %d and uid = %d limit 1", intval($item), @@ -1486,13 +1490,14 @@ function file_tag_unsave_file($uid,$item,$file) { intval($uid) ); - $r = q("select file from item where uid = %d " . file_tag_file_query('item',$file), + $r = q("select file from item where uid = %d " . file_tag_file_query('item',$file,(($cat) ? 'category' : 'file')), intval($uid) ); if(! count($r)) { $saved = get_pconfig($uid,'system','filetags'); set_pconfig($uid,'system','filetags',str_replace($pattern,'',$saved)); + } return true; } -- cgit v1.2.3 From 7c6e8b30b28a3656f536ba338c3b124533fdadb7 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 4 May 2012 16:45:10 -0700 Subject: only show remove category to item owner --- include/text.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index 4ae5d1333..5d6adaea5 100644 --- a/include/text.php +++ b/include/text.php @@ -930,7 +930,8 @@ function prepare_body($item,$attach = false) { foreach($matches as $mtch) { if(strlen($x)) $x .= ','; - $x .= xmlify(file_tag_decode($mtch[1])) . ' ' . t('[remove]') . ''; + $x .= xmlify(file_tag_decode($mtch[1])) + . ((local_user() == $item['uid']) ? ' ' . t('[remove]') . '' : ''); } if(strlen($x)) $s .= '
' . t('Categories:') . ' ' . $x . '
'; -- cgit v1.2.3 From d0dd22af570a06016053030fa468f83d14f25f5d Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 4 May 2012 17:43:47 -0700 Subject: workaround to clean up orphaned filetags --- include/text.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index 5d6adaea5..1b5b0afd4 100644 --- a/include/text.php +++ b/include/text.php @@ -1491,7 +1491,7 @@ function file_tag_unsave_file($uid,$item,$file,$cat = false) { intval($uid) ); - $r = q("select file from item where uid = %d " . file_tag_file_query('item',$file,(($cat) ? 'category' : 'file')), + $r = q("select file from item where uid = %d and deleted = 0 " . file_tag_file_query('item',$file,(($cat) ? 'category' : 'file')), intval($uid) ); -- cgit v1.2.3