From 48ffa880f099b19052f18e399bf6af50780a24b0 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 7 Aug 2011 16:15:54 -0700 Subject: cleanup --- include/acl_selectors.php | 4 ++-- include/api.php | 12 ++++++------ include/certfns.php | 17 ----------------- include/items.php | 14 +++++++------- include/notifier.php | 2 +- include/poller.php | 10 +++++----- include/salmon.php | 2 -- include/security.php | 4 ++-- 8 files changed, 23 insertions(+), 42 deletions(-) (limited to 'include') diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 99de67d64..48ba77a88 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -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) { diff --git a/include/api.php b/include/api.php index 2a02458d7..cf7d0304f 100644 --- a/include/api.php +++ b/include/api.php @@ -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", diff --git a/include/certfns.php b/include/certfns.php index ffdc7f0c3..aa84cfeb6 100644 --- a/include/certfns.php +++ b/include/certfns.php @@ -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); - - } diff --git a/include/items.php b/include/items.php index 047dd4442..4c0e8312c 100644 --- a/include/items.php +++ b/include/items.php @@ -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']) ); } diff --git a/include/notifier.php b/include/notifier.php index 9f5b27148..e1bb29eaf 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -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))) { diff --git a/include/poller.php b/include/poller.php index 569eb59d1..c88db6e6b 100644 --- a/include/poller.php +++ b/include/poller.php @@ -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)) { diff --git a/include/salmon.php b/include/salmon.php index f1cef0a49..3ccae2756 100644 --- a/include/salmon.php +++ b/include/salmon.php @@ -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(); diff --git a/include/security.php b/include/security.php index 789e47db2..6fbdd697f 100644 --- a/include/security.php +++ b/include/security.php @@ -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)) { -- cgit v1.2.3