From 22841e15666a6678517cf7a1f8f8791dcd37e1a6 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 8 Nov 2012 19:07:19 -0800 Subject: start implementing zot-id --- boot.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index fca06f57c..8e8b92593 100644 --- a/boot.php +++ b/boot.php @@ -1829,26 +1829,33 @@ function get_my_url() { return false; } -function zrl_init(&$a) { +function get_my_address() { + if(x($_SESSION,'my_address')) + return $_SESSION['my_address']; + return false; +} + +function zid_init(&$a) { $tmp_str = get_my_url(); if(validate_url($tmp_str)) { proc_run('php','include/gprobe.php',bin2hex($tmp_str)); - $arr = array('zrl' => $tmp_str, 'url' => $a->cmd); - call_hooks('zrl_init',$arr); + $arr = array('zid' => $tmp_str, 'url' => $a->cmd); + call_hooks('zid_init',$arr); } } -function zrl($s,$force = false) { +function zid($s,$force = false) { if(! strlen($s)) return $s; - if((! strpos($s,'/channel/')) && (! $force)) - return $s; - if($force && substr($s,-1,1) !== '/') - $s = $s . '/'; + $has_params = ((strpos($s,'?')) ? true : false); + if(! $has_params) + $has_params = ((strpos($s,'&')) ? true : false); $achar = strpos($s,'?') ? '&' : '?'; + $mine = get_my_url(); + $myaddr = get_my_address(); if($mine and ! link_compare($mine,$s)) - return $s . $achar . 'zrl=' . urlencode($mine); + return $s . (($has_params) ? '' : '/') . $achar . 'zid=' . urlencode($myaddr); return $s; } -- cgit v1.2.3