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

View file

@ -96,7 +96,7 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
$sql_extra = '';
if($x['mutual']) {
$sql_extra .= sprintf(" AND `rel` = %d ", intval(REL_BUD));
$sql_extra .= sprintf(" AND `rel` = %d ", intval(CONTACT_IS_FRIEND));
}
if(intval($x['exclude']))
@ -163,7 +163,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
$sql_extra = '';
if($privmail || $celeb) {
$sql_extra .= sprintf(" AND `rel` = %d ", intval(REL_BUD));
$sql_extra .= sprintf(" AND `rel` = %d ", intval(CONTACT_IS_FRIEND));
}
if($privmail) {

View file

@ -273,8 +273,8 @@
WHERE `uid` = %d AND `rel` IN ( %d, %d )
AND `self`=0 AND `blocked`=0",
intval($uinfo[0]['uid']),
intval(REL_FAN),
intval(REL_BUD)
intval(CONTACT_IS_SHARING),
intval(CONTACT_IS_FRIEND)
);
$countfriends = $r[0]['count'];
@ -282,8 +282,8 @@
WHERE `uid` = %d AND `rel` IN ( %d, %d )
AND `self`=0 AND `blocked`=0",
intval($uinfo[0]['uid']),
intval(REL_VIP),
intval(REL_BUD)
intval(CONTACT_IS_FOLLOWER),
intval(CONTACT_IS_FRIEND)
);
$countfollowers = $r[0]['count'];
@ -832,9 +832,9 @@
return false;
if($qtype == 'friends')
$sql_extra = sprintf(" AND ( `rel` = %d OR `rel` = %d ) ", intval(REL_FAN), intval(REL_BUD));
$sql_extra = sprintf(" AND ( `rel` = %d OR `rel` = %d ) ", intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND));
if($qtype == 'followers')
$sql_extra = sprintf(" AND ( `rel` = %d OR `rel` = %d ) ", intval(REL_VIP), intval(REL_BUD));
$sql_extra = sprintf(" AND ( `rel` = %d OR `rel` = %d ) ", intval(CONTACT_IS_FOLLOWER), intval(CONTACT_IS_FRIEND));
$r = q("SELECT id FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 $sql_extra",

View file

@ -37,8 +37,6 @@ function DerToRsa($Der)
}
function pkcs8_encode($Modulus,$PublicExponent) {
//Encode key sequence
$modulus = new ASNValue(ASNValue::TAG_INTEGER);
@ -75,17 +73,6 @@ function pkcs1_encode($Modulus,$PublicExponent) {
//Encode bit string
$bitStringValue = $keySequence->Encode();
return $bitStringValue;
// $bitStringValue = chr(0x00) . $bitStringValue; //Add unused bits byte
// $bitString = new ASNValue(ASNValue::TAG_BITSTRING);
// $bitString->Value = $bitStringValue;
//Encode body
// $bodyValue = "\x30\x0d\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x01\x01\x05\x00" . $bitString->Encode();
// $body = new ASNValue(ASNValue::TAG_SEQUENCE);
// $body->Value = $bodyValue;
//Get DER encoded public key:
// $PublicDER = $body->Encode();
// return $PublicDER;
}
@ -107,12 +94,8 @@ function pubrsatome($key,&$m,&$e) {
$r = ASN_BASE::parseASNString($x);
// print_r($r);
$m = base64url_decode($r[0]->asnData[0]->asnData);
$e = base64url_decode($r[0]->asnData[1]->asnData);
}

View file

@ -915,7 +915,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$postvars['dissolve'] = '1';
if((($contact['rel']) && ($contact['rel'] != REL_FAN) && (! $contact['blocked'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
if((($contact['rel']) && ($contact['rel'] != CONTACT_IS_SHARING) && (! $contact['blocked'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
$postvars['data'] = $atom;
$postvars['perm'] = 'rw';
}
@ -1448,9 +1448,9 @@ function new_follower($importer,$contact,$datarray,$item) {
$nick = $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data'];
if(is_array($contact)) {
if($contact['network'] == 'stat' && $contact['rel'] == REL_FAN) {
if($contact['network'] == 'stat' && $contact['rel'] == CONTACT_IS_SHARING) {
$r = q("UPDATE `contact` SET `rel` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval(REL_BUD),
intval(CONTACT_IS_FRIEND),
intval($contact['id']),
intval($importer['uid'])
);
@ -1472,12 +1472,12 @@ function new_follower($importer,$contact,$datarray,$item) {
dbesc($nick),
dbesc($photo),
dbesc('stat'),
intval(REL_VIP)
intval(CONTACT_IS_FOLLOWER)
);
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `pending` = 1 AND `rel` = %d LIMIT 1",
intval($importer['uid']),
dbesc($url),
intval(REL_VIP)
intval(CONTACT_IS_FOLLOWER)
);
if(count($r))
$contact_record = $r[0];
@ -1522,9 +1522,9 @@ function new_follower($importer,$contact,$datarray,$item) {
function lose_follower($importer,$contact,$datarray,$item) {
if(($contact['rel'] == REL_BUD) || ($contact['rel'] == REL_FAN)) {
if(($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_SHARING)) {
q("UPDATE `contact` SET `rel` = %d WHERE `id` = %d LIMIT 1",
intval(REL_FAN),
intval(CONTACT_IS_SHARING),
intval($contact['id'])
);
}

View file

@ -555,7 +555,7 @@ function notifier_run($argv, $argc){
WHERE `network` = 'dfrn' AND `uid` = %d AND `blocked` = 0 AND `pending` = 0
AND `rel` != %d ",
intval($owner['uid']),
intval(REL_FAN)
intval(CONTACT_IS_SHARING)
);
if((count($r)) && (($max_allowed == 0) || (count($r) < $max_allowed))) {

View file

@ -87,8 +87,8 @@ function poller_run($argv, $argc){
WHERE ( `rel` = %d OR `rel` = %d ) AND `poll` != ''
$sql_extra
AND `self` = 0 AND `blocked` = 0 AND `readonly` = 0 ORDER BY RAND()",
intval(REL_FAN),
intval(REL_BUD)
intval(CONTACT_IS_SHARING),
intval(CONTACT_IS_FRIEND)
);
if(! count($contacts)) {
@ -312,7 +312,7 @@ function poller_run($argv, $argc){
// Will only do this once per notify-enabled OStatus contact
// or if relationship changes
$stat_writeable = ((($contact['notify']) && ($contact['rel'] == REL_VIP || $contact['rel'] == REL_BUD)) ? 1 : 0);
$stat_writeable = ((($contact['notify']) && ($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['rel'] == CONTACT_IS_FRIEND)) ? 1 : 0);
if($stat_writeable != $contact['writable']) {
q("UPDATE `contact` SET `writable` = %d WHERE `id` = %d LIMIT 1",
@ -323,7 +323,7 @@ function poller_run($argv, $argc){
// Are we allowed to import from this person?
if($contact['rel'] == REL_VIP || $contact['blocked'] || $contact['readonly'])
if($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['blocked'] || $contact['readonly'])
continue;
$xml = fetch_url($contact['poll']);
@ -463,7 +463,7 @@ function poller_run($argv, $argc){
consume_feed($xml,$importer,$contact,$hub,1);
if((strlen($hub)) && ($hub_update) && (($contact['rel'] == REL_BUD) || (($contact['network'] === NETWORK_OSTATUS) && (! $contact['readonly'])))) {
if((strlen($hub)) && ($hub_update) && (($contact['rel'] == CONTACT_IS_FRIEND) || (($contact['network'] === NETWORK_OSTATUS) && (! $contact['readonly'])))) {
logger('poller: subscribing to hub(s) : ' . $hub . ' contact name : ' . $contact['name'] . ' local user : ' . $importer['name']);
$hubs = explode(',', $hub);
if(count($hubs)) {

View file

@ -114,8 +114,6 @@ EOT;
// Setup RSA stuff to PKCS#1 sign the data
set_include_path(get_include_path() . PATH_SEPARATOR . 'library/phpsec');
require_once('library/phpsec/Crypt/RSA.php');
$rsa = new CRYPT_RSA();

View file

@ -28,8 +28,8 @@ function can_write_wall(&$a,$owner) {
AND `user`.`blockwall` = 0 AND `readonly` = 0 AND ( `contact`.`rel` IN ( %d , %d ) OR `user`.`page-flags` = %d ) LIMIT 1",
intval($owner),
intval(remote_user()),
intval(REL_VIP),
intval(REL_BUD),
intval(CONTACT_IS_FOLLOWER),
intval(CONTACT_IS_FRIEND),
intval(PAGE_COMMUNITY)
);
if(count($r)) {