Merge remote branch 'upstream/master'

This commit is contained in:
zottel 2011-12-06 00:02:29 -08:00
commit cd3a02ab8e
12 changed files with 49 additions and 26 deletions

View file

@ -9,9 +9,9 @@ require_once('include/nav.php');
require_once('include/cache.php'); require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '2.3.1185' ); define ( 'FRIENDICA_VERSION', '2.3.1186' );
define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
define ( 'DB_UPDATE_VERSION', 1108 ); define ( 'DB_UPDATE_VERSION', 1109 );
define ( 'EOL', "<br />\r\n" ); define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );

View file

@ -92,6 +92,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
`blocked` tinyint(1) NOT NULL DEFAULT '1', `blocked` tinyint(1) NOT NULL DEFAULT '1',
`readonly` tinyint(1) NOT NULL DEFAULT '0', `readonly` tinyint(1) NOT NULL DEFAULT '0',
`writable` 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', `pending` tinyint(1) NOT NULL DEFAULT '1',
`rating` tinyint(1) NOT NULL DEFAULT '0', `rating` tinyint(1) NOT NULL DEFAULT '0',
`reason` text NOT NULL, `reason` text NOT NULL,
@ -114,6 +115,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
KEY `dfrn-id` (`dfrn-id`), KEY `dfrn-id` (`dfrn-id`),
KEY `blocked` (`blocked`), KEY `blocked` (`blocked`),
KEY `readonly` (`readonly`), KEY `readonly` (`readonly`),
KET `hidden` (`hidden`),
KEY `pending` (`pending`) KEY `pending` (`pending`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

View file

@ -296,7 +296,7 @@
// count friends // count friends
$r = q("SELECT COUNT(`id`) as `count` FROM `contact` $r = q("SELECT COUNT(`id`) as `count` FROM `contact`
WHERE `uid` = %d AND `rel` IN ( %d, %d ) 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($uinfo[0]['uid']),
intval(CONTACT_IS_SHARING), intval(CONTACT_IS_SHARING),
intval(CONTACT_IS_FRIEND) intval(CONTACT_IS_FRIEND)
@ -305,7 +305,7 @@
$r = q("SELECT COUNT(`id`) as `count` FROM `contact` $r = q("SELECT COUNT(`id`) as `count` FROM `contact`
WHERE `uid` = %d AND `rel` IN ( %d, %d ) 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($uinfo[0]['uid']),
intval(CONTACT_IS_FOLLOWER), intval(CONTACT_IS_FOLLOWER),
intval(CONTACT_IS_FRIEND) intval(CONTACT_IS_FRIEND)

View file

@ -27,9 +27,27 @@ function send_message($recipient=0, $body='', $subject='', $replyto=''){
$hash = random_string(); $hash = random_string();
$uri = 'urn:X-dfrn:' . $a->get_baseurl() . ':' . local_user() . ':' . $hash ; $uri = 'urn:X-dfrn:' . $a->get_baseurl() . ':' . local_user() . ':' . $hash ;
if(! strlen($replyto)) { $convid = 0;
// look for any existing conversation structure
if(strlen($replyto)) {
$r = q("select convid from mail where uid = %d and uri = '%s' limit 1",
intval(local_user()),
dbesc($replyto)
);
if(count($r))
$convid = $r[0]['convid'];
}
if(! strlen($replyto))
$replyto = $uri; $replyto = $uri;
if(! $convid) {
// create a new conversation
$conv_guid = get_guid(); $conv_guid = get_guid();
$recip_host = substr($contact[0]['url'],strpos($contact[0]['url'],'://')+3); $recip_host = substr($contact[0]['url'],strpos($contact[0]['url'],'://')+3);
@ -52,14 +70,6 @@ function send_message($recipient=0, $body='', $subject='', $replyto=''){
if(count($r)) if(count($r))
$convid = $r[0]['id']; $convid = $r[0]['id'];
} }
else {
$r = q("select convid from mail where uid = %d and uri = '%s' limit 1",
intval(local_user()),
dbesc($replyto)
);
if(count($r))
$convid = $r[0]['convid'];
}
if(! $convid) { if(! $convid) {
logger('send message: conversation not found.'); logger('send message: conversation not found.');

View file

@ -539,7 +539,7 @@ function contact_block() {
if((! is_array($a->profile)) || ($a->profile['hide-friends'])) if((! is_array($a->profile)) || ($a->profile['hide-friends']))
return $o; 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']) intval($a->profile['uid'])
); );
if(count($r)) { if(count($r)) {
@ -550,7 +550,7 @@ function contact_block() {
$micropro = Null; $micropro = Null;
} else { } 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($a->profile['uid']),
intval($shown) intval($shown)
); );

View file

@ -78,6 +78,7 @@ function contacts_post(&$a) {
} }
} }
$hidden = intval($_POST['hidden']);
$priority = intval($_POST['poll']); $priority = intval($_POST['poll']);
if($priority > 5 || $priority < 0) if($priority > 5 || $priority < 0)
@ -85,11 +86,12 @@ function contacts_post(&$a) {
$info = escape_tags(trim($_POST['info'])); $info = escape_tags(trim($_POST['info']));
$r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s' $r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s',
WHERE `id` = %d AND `uid` = %d LIMIT 1", `hidden` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($profile_id), intval($profile_id),
intval($priority), intval($priority),
dbesc($info), dbesc($info),
intval($hidden),
intval($contact_id), intval($contact_id),
intval(local_user()) intval(local_user())
); );
@ -334,6 +336,7 @@ function contacts_content(&$a) {
'$info' => $contact['info'], '$info' => $contact['info'],
'$blocked' => (($contact['blocked']) ? t('Currently blocked') : ''), '$blocked' => (($contact['blocked']) ? t('Currently blocked') : ''),
'$ignored' => (($contact['readonly']) ? t('Currently ignored') : ''), '$ignored' => (($contact['readonly']) ? t('Currently ignored') : ''),
'$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'], '$photo' => $contact['photo'],
'$name' => $contact['name'], '$name' => $contact['name'],
'$dir_icon' => $dir_icon, '$dir_icon' => $dir_icon,

View file

@ -67,6 +67,8 @@ function follow_post(&$a) {
} }
$writeable = ((($ret['network'] === NETWORK_OSTATUS) && ($ret['notify'])) ? 1 : 0); $writeable = ((($ret['network'] === NETWORK_OSTATUS) && ($ret['notify'])) ? 1 : 0);
$hidden = (($ret['network'] === NETWORK_MAIL) ? 1 : 0);
if($ret['network'] === NETWORK_MAIL) { if($ret['network'] === NETWORK_MAIL) {
$writeable = 1; $writeable = 1;
@ -101,8 +103,8 @@ function follow_post(&$a) {
// create contact record // create contact record
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `photo`, `network`, `pubkey`, `rel`, `priority`, $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `photo`, `network`, `pubkey`, `rel`, `priority`,
`writable`, `blocked`, `readonly`, `pending` ) `writable`, `hidden`, `blocked`, `readonly`, `pending` )
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0 ) ", VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, 0, 0, 0 ) ",
intval(local_user()), intval(local_user()),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc($ret['url']), dbesc($ret['url']),
@ -120,7 +122,8 @@ function follow_post(&$a) {
dbesc($ret['pubkey']), dbesc($ret['pubkey']),
intval($new_relation), intval($new_relation),
intval($ret['priority']), intval($ret['priority']),
intval($writeable) intval($writeable),
intval($hidden)
); );
} }

View file

@ -54,7 +54,7 @@ function poco_init(&$a) {
and uid in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = 1) "); and uid in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = 1) ");
} }
else { 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 ", $sql_extra ",
intval($user['uid']) intval($user['uid'])
); );
@ -79,7 +79,7 @@ function poco_init(&$a) {
} }
else { 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", $sql_extra LIMIT %d, %d",
intval($user['uid']), intval($user['uid']),
intval($startIndex), intval($startIndex),

View file

@ -25,13 +25,13 @@ function viewcontacts_content(&$a) {
$o .= '<h3>' . t('View Contacts') . '</h3>'; $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']) intval($a->profile['uid'])
); );
if(count($r)) if(count($r))
$a->set_pager_total($r[0]['total']); $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->profile['uid']),
intval($a->pager['start']), intval($a->pager['start']),
intval($a->pager['itemspage']) intval($a->pager['itemspage'])

View file

@ -1,6 +1,6 @@
<?php <?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` ) ");
}

View file

@ -59,7 +59,7 @@
{{ endif }} {{ endif }}
<div id="contact-edit-end" ></div> <div id="contact-edit-end" ></div>
{{inc field_checkbox.tpl with $field=$hidden }}{{endinc}}
<div id="contact-edit-info-wrapper"> <div id="contact-edit-info-wrapper">
<h4>$lbl_info1</h4> <h4>$lbl_info1</h4>

View file

@ -1461,6 +1461,7 @@ input#dfrn-url {
#contact-edit-end { #contact-edit-end {
clear: both; clear: both;
margin-top: 15px;
} }
#contact-profile-selector { #contact-profile-selector {