aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-07-14 21:21:24 -0700
committerfriendica <info@friendica.com>2014-07-14 21:21:24 -0700
commit1accf82bd10f73b22e0c169100932ccfbd81977b (patch)
tree63ddb9e00eee14118254e7cf08a9322ae5cc8add /mod
parentf710ebc7f97845f48cefc3d01acf6793c86f5652 (diff)
downloadvolse-hubzilla-1accf82bd10f73b22e0c169100932ccfbd81977b.tar.gz
volse-hubzilla-1accf82bd10f73b22e0c169100932ccfbd81977b.tar.bz2
volse-hubzilla-1accf82bd10f73b22e0c169100932ccfbd81977b.zip
clean up more code duplication
Diffstat (limited to 'mod')
-rw-r--r--mod/post.php10
-rw-r--r--mod/zfinger.php2
2 files changed, 7 insertions, 5 deletions
diff --git a/mod/post.php b/mod/post.php
index bd68baa17..3b4f66baf 100644
--- a/mod/post.php
+++ b/mod/post.php
@@ -715,7 +715,7 @@ function post_post(&$a) {
}
$arr = $data['sender'];
- $sender_hash = base64url_encode(hash('whirlpool',$arr['guid'] . $arr['guid_sig'], true));
+ $sender_hash = make_xchan_hash($arr['guid'],$arr['guid_sig']);
// garbage collect any old unused notifications
q("delete from verify where type = 'auth' and created < UTC_TIMESTAMP() - INTERVAL 10 MINUTE");
@@ -742,7 +742,7 @@ function post_post(&$a) {
if($data['recipients']) {
$arr = $data['recipients'][0];
- $recip_hash = base64url_encode(hash('whirlpool',$arr['guid'] . $arr['guid_sig'], true));
+ $recip_hash = make_xchan_hash($arr['guid'],$arr['guid_sig']);
$c = q("select channel_id, channel_account_id, channel_prvkey from channel where channel_hash = '%s' limit 1",
dbesc($recip_hash)
);
@@ -787,6 +787,8 @@ function post_post(&$a) {
$ret['DNT'] = true;
if(! perm_is_allowed($c[0]['channel_id'],'','view_profile'))
$ret['DNT'] = true;
+ if(get_pconfig($c[0]['channel_id'],'system','do_not_track'))
+ $ret['DNT'] = true;
json_return_and_die($ret);
@@ -808,7 +810,7 @@ function post_post(&$a) {
if($r) {
$r = q("select abook_id from abook where uid = %d and abook_xchan = '%s' limit 1",
intval($r[0]['channel_id']),
- dbesc(base64url_encode(hash('whirlpool',$sender['guid'] . $sender['guid_sig'], true)))
+ dbesc(make_xchan_hash($sender['guid'],$sender['guid_sig']))
);
if($r) {
contact_remove($r[0]['channel_id'],$r[0]['abook_id']);
@@ -819,7 +821,7 @@ function post_post(&$a) {
else {
// Unfriend everybody - basically this means the channel has committed suicide
$arr = $data['sender'];
- $sender_hash = base64url_encode(hash('whirlpool',$arr['guid'] . $arr['guid_sig'], true));
+ $sender_hash = make_xchan_hash($arr['guid'],$arr['guid_sig']);
require_once('include/Contact.php');
remove_all_xchan_resources($sender_hash);
diff --git a/mod/zfinger.php b/mod/zfinger.php
index bd1463591..d1493da03 100644
--- a/mod/zfinger.php
+++ b/mod/zfinger.php
@@ -188,7 +188,7 @@ function zfinger_init(&$a) {
$ret['follow_url'] = z_root() . '/follow?f=&url=%s';
$ztarget_hash = (($ztarget && $zsig)
- ? base64url_encode(hash('whirlpool',$ztarget . $zsig,true))
+ ? make_xchan_hash($ztarget,$zsig)
: '' );
$permissions = get_all_perms($e['channel_id'],$ztarget_hash,false);