1
1
Fork 0
This commit is contained in:
Friendika 2011-08-07 16:15:54 -07:00
commit 48ffa880f0
22 changed files with 2871 additions and 2432 deletions

View file

@ -249,16 +249,16 @@ function contacts_content(&$a) {
$tpl = get_markup_template("contact_edit.tpl");
switch($r[0]['rel']) {
case REL_BUD:
case CONTACT_IS_FRIEND:
$dir_icon = 'images/lrarrow.gif';
$alt_text = t('Mutual Friendship');
break;
case REL_VIP;
case CONTACT_IS_FOLLOWER;
$dir_icon = 'images/larrow.gif';
$alt_text = t('is a fan of yours');
break;
case REL_FAN;
case CONTACT_IS_SHARING;
$dir_icon = 'images/rarrow.gif';
$alt_text = t('you are a fan of');
break;
@ -368,7 +368,7 @@ function contacts_content(&$a) {
$search = dbesc($search.'*');
$sql_extra .= ((strlen($search)) ? " AND MATCH `name` AGAINST ('$search' IN BOOLEAN MODE) " : "");
$sql_extra2 = ((($sort_type > 0) && ($sort_type <= REL_BUD)) ? sprintf(" AND `rel` = %d ",intval($sort_type)) : '');
$sql_extra2 = ((($sort_type > 0) && ($sort_type <= CONTACT_IS_FRIEND)) ? sprintf(" AND `rel` = %d ",intval($sort_type)) : '');
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
@ -392,15 +392,15 @@ function contacts_content(&$a) {
continue;
switch($rr['rel']) {
case REL_BUD:
case CONTACT_IS_FRIEND:
$dir_icon = 'images/lrarrow.gif';
$alt_text = t('Mutual Friendship');
break;
case REL_VIP;
case CONTACT_IS_FOLLOWER;
$dir_icon = 'images/larrow.gif';
$alt_text = t('is a fan of yours');
break;
case REL_FAN;
case CONTACT_IS_SHARING;
$dir_icon = 'images/rarrow.gif';
$alt_text = t('you are a fan of');
break;

View file

@ -306,11 +306,11 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
if($network === 'dfrn') {
$new_relation = REL_VIP;
if(($relation == REL_FAN) || ($duplex))
$new_relation = REL_BUD;
$new_relation = CONTACT_IS_FOLLOWER;
if(($relation == CONTACT_IS_SHARING) || ($duplex))
$new_relation = CONTACT_IS_FRIEND;
if(($relation == REL_FAN) && ($duplex))
if(($relation == CONTACT_IS_SHARING) && ($duplex))
$duplex = 0;
$r = q("UPDATE `contact` SET `photo` = '%s',
@ -401,7 +401,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$r = q("SELECT `hide-friends` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1",
intval($uid)
);
if((count($r)) && ($r[0]['hide-friends'] == 0) && (is_array($contact)) && isset($new_relation) && ($new_relation == REL_BUD)) {
if((count($r)) && ($r[0]['hide-friends'] == 0) && (is_array($contact)) && isset($new_relation) && ($new_relation == CONTACT_IS_FRIEND)) {
require_once('include/items.php');
@ -592,11 +592,11 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
logger('dfrn_confirm: request - photos imported');
$new_relation = REL_FAN;
if(($relation == REL_VIP) || ($duplex))
$new_relation = REL_BUD;
$new_relation = CONTACT_IS_SHARING;
if(($relation == CONTACT_IS_FOLLOWER) || ($duplex))
$new_relation = CONTACT_IS_FRIEND;
if(($relation == REL_VIP) && ($duplex))
if(($relation == CONTACT_IS_FOLLOWER) && ($duplex))
$duplex = 0;
$r = q("UPDATE `contact` SET
@ -639,7 +639,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
if((count($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) {
push_lang($r[0]['language']);
$tpl = (($new_relation == REL_BUD)
$tpl = (($new_relation == CONTACT_IS_FRIEND)
? get_intltext_template('friend_complete_eml.tpl')
: get_intltext_template('intro_complete_eml.tpl'));

View file

@ -309,7 +309,7 @@ function dfrn_request_post(&$a) {
notice( t('You have already introduced yourself here.') . EOL );
return;
}
elseif($ret[0]['rel'] == REL_BUD) {
elseif($ret[0]['rel'] == CONTACT_IS_FRIEND) {
notice( sprintf( t('Apparently you are already friends with %s.'), $a->profile['name']) . EOL);
return;
}
@ -445,7 +445,7 @@ function dfrn_request_post(&$a) {
*
* OStatus network
* Check contact existence
* Try and scrape together enough information to create a contact record, with us as REL_VIP
* Try and scrape together enough information to create a contact record, with us as CONTACT_IS_FOLLOWER
* Substitute our user's feed URL into $url template
* Send the subscriber home to subscribe
*

View file

@ -82,9 +82,9 @@ function follow_post(&$a) {
if(count($r)) {
// update contact
if($r[0]['rel'] == REL_VIP) {
if($r[0]['rel'] == CONTACT_IS_FOLLOWER) {
q("UPDATE `contact` SET `rel` = %d , `readonly` = 0 WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval(REL_BUD),
intval(CONTACT_IS_FRIEND),
intval($r[0]['id']),
intval(local_user())
);
@ -106,7 +106,7 @@ function follow_post(&$a) {
dbesc($ret['nick']),
dbesc($ret['photo']),
dbesc($ret['network']),
intval(($ret['network'] === NETWORK_MAIL) ? REL_BUD : REL_FAN),
intval(($ret['network'] === NETWORK_MAIL) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING),
intval($ret['priority']),
intval($writeable)
);

View file

@ -111,8 +111,8 @@ function pubsub_post(&$a) {
AND ( `rel` = %d OR `rel` = %d ) AND `blocked` = 0 AND `readonly` = 0 LIMIT 1",
intval($contact_id),
intval($importer['uid']),
intval(REL_FAN),
intval(REL_BUD)
intval(CONTACT_IS_SHARING),
intval(CONTACT_IS_FRIEND)
);
if(! count($r)) {

View file

@ -238,7 +238,7 @@ function receive_post(&$a) {
// is this a follower? Or have we ignored the person?
// If so we can not accept this post.
if((count($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == REL_VIP) || ($r[0]['blocked']))) {
if((count($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']))) {
logger('mod-diaspora: Ignoring this author.');
receive_return(202);
// NOTREACHED

View file

@ -134,7 +134,14 @@ function salmon_post(&$a) {
// Setup RSA stuff to verify the signature
set_include_path(get_include_path() . PATH_SEPARATOR . 'library/phpsec');
require_once('library/phpsec/Crypt/RSA.php');
$rsa = new CRYPT_RSA();
$rsa->signatureMode = CRYPT_RSA_SIGNATURE_PKCS1;
$rsa->setHash('sha256');
$rsa->loadKey($prvkey);
$sig = $rsa->sign($data);
require_once('library/phpsec/Crypt/RSA.php');
@ -194,7 +201,7 @@ function salmon_post(&$a) {
// is this a follower? Or have we ignored the person?
// If so we can not accept this post.
if((count($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == REL_VIP) || ($r[0]['blocked']))) {
if((count($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']))) {
logger('mod-salmon: Ignoring this author.');
salmon_return(202);
// NOTREACHED