aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2011-12-05 02:16:59 -0800
committerfriendica <info@friendica.com>2011-12-05 02:16:59 -0800
commitc8d5274ceea95bdf9df5ca2ab698fa9860319e31 (patch)
treee2d977f26214e30ba4e6e6059d58e26ad287bce3
parent116e20c89dc5874912c7e3870623c747f75238ce (diff)
downloadvolse-hubzilla-c8d5274ceea95bdf9df5ca2ab698fa9860319e31.tar.gz
volse-hubzilla-c8d5274ceea95bdf9df5ca2ab698fa9860319e31.tar.bz2
volse-hubzilla-c8d5274ceea95bdf9df5ca2ab698fa9860319e31.zip
data structures to support hidden friends
-rw-r--r--boot.php2
-rw-r--r--database.sql2
-rw-r--r--include/api.php4
-rw-r--r--include/text.php4
-rw-r--r--mod/poco.php4
-rw-r--r--mod/viewcontacts.php4
-rw-r--r--update.php6
7 files changed, 16 insertions, 10 deletions
diff --git a/boot.php b/boot.php
index d283fa778..13546d6bb 100644
--- a/boot.php
+++ b/boot.php
@@ -11,7 +11,7 @@ require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '2.3.1185' );
define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
-define ( 'DB_UPDATE_VERSION', 1108 );
+define ( 'DB_UPDATE_VERSION', 1109 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
diff --git a/database.sql b/database.sql
index 26580d60d..18fe5f8c3 100644
--- a/database.sql
+++ b/database.sql
@@ -92,6 +92,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
`blocked` tinyint(1) NOT NULL DEFAULT '1',
`readonly` tinyint(1) NOT NULL DEFAULT '0',
`writable` tinyint(1) NOT NULL DEFAULT '0',
+ `hidden` tinyint(1) NOT NULL DEFAULT '0',
`pending` tinyint(1) NOT NULL DEFAULT '1',
`rating` tinyint(1) NOT NULL DEFAULT '0',
`reason` text NOT NULL,
@@ -114,6 +115,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
KEY `dfrn-id` (`dfrn-id`),
KEY `blocked` (`blocked`),
KEY `readonly` (`readonly`),
+ KET `hidden` (`hidden`),
KEY `pending` (`pending`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
diff --git a/include/api.php b/include/api.php
index 1196e0aac..9cf4551bd 100644
--- a/include/api.php
+++ b/include/api.php
@@ -296,7 +296,7 @@
// count friends
$r = q("SELECT COUNT(`id`) as `count` FROM `contact`
WHERE `uid` = %d AND `rel` IN ( %d, %d )
- AND `self`=0 AND `blocked`=0",
+ AND `self`=0 AND `blocked`=0 AND `pending`=0 AND `hidden`=0",
intval($uinfo[0]['uid']),
intval(CONTACT_IS_SHARING),
intval(CONTACT_IS_FRIEND)
@@ -305,7 +305,7 @@
$r = q("SELECT COUNT(`id`) as `count` FROM `contact`
WHERE `uid` = %d AND `rel` IN ( %d, %d )
- AND `self`=0 AND `blocked`=0",
+ AND `self`=0 AND `blocked`=0 AND `pending`=0 AND `hidden`=0",
intval($uinfo[0]['uid']),
intval(CONTACT_IS_FOLLOWER),
intval(CONTACT_IS_FRIEND)
diff --git a/include/text.php b/include/text.php
index c4fd76e3e..29e53c663 100644
--- a/include/text.php
+++ b/include/text.php
@@ -539,7 +539,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",
+ $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0",
intval($a->profile['uid'])
);
if(count($r)) {
@@ -550,7 +550,7 @@ function contact_block() {
$micropro = Null;
} else {
- $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 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 ORDER BY RAND() LIMIT %d",
intval($a->profile['uid']),
intval($shown)
);
diff --git a/mod/poco.php b/mod/poco.php
index 6331131fa..dd8df6008 100644
--- a/mod/poco.php
+++ b/mod/poco.php
@@ -54,7 +54,7 @@ function poco_init(&$a) {
and uid in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = 1) ");
}
else {
- $r = q("SELECT count(*) as `total` from `contact` where `uid` = %d and blocked = 0 and pending = 0
+ $r = q("SELECT count(*) as `total` from `contact` where `uid` = %d and blocked = 0 and pending = 0 and hidden = 0
$sql_extra ",
intval($user['uid'])
);
@@ -79,7 +79,7 @@ function poco_init(&$a) {
}
else {
- $r = q("SELECT * from `contact` where `uid` = %d and blocked = 0 and pending = 0
+ $r = q("SELECT * from `contact` where `uid` = %d and blocked = 0 and pending = 0 and hidden = 0
$sql_extra LIMIT %d, %d",
intval($user['uid']),
intval($startIndex),
diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php
index f9510bd6b..cd8d100ed 100644
--- a/mod/viewcontacts.php
+++ b/mod/viewcontacts.php
@@ -25,13 +25,13 @@ function viewcontacts_content(&$a) {
$o .= '<h3>' . t('View Contacts') . '</h3>';
- $r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0",
+ $r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 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 ORDER BY `name` ASC LIMIT %d , %d ",
+ $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 ORDER BY `name` ASC LIMIT %d , %d ",
intval($a->profile['uid']),
intval($a->pager['start']),
intval($a->pager['itemspage'])
diff --git a/update.php b/update.php
index 6e7b5f2c1..d94bf82d1 100644
--- a/update.php
+++ b/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1108 );
+define( 'UPDATE_VERSION' , 1109 );
/**
*
@@ -923,4 +923,8 @@ function update_1107() {
}
+function update_1108() {
+ q("ALTER TABLE `contact` ADD `hidden` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `writable` ,
+ADD INDEX ( `hidden` ) ");
+}