diff options
author | friendica <info@friendica.com> | 2013-04-16 16:03:41 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-04-16 16:03:41 -0700 |
commit | 6f24c7cb27dbb269562b0123f429822cc3b57eea (patch) | |
tree | c5d8fc5bb2742fe8ef163e414a24c92ee5dd8908 /boot.php | |
parent | 97957e0c1b3f4ab39111e923a621aa3ef99581df (diff) | |
download | volse-hubzilla-6f24c7cb27dbb269562b0123f429822cc3b57eea.tar.gz volse-hubzilla-6f24c7cb27dbb269562b0123f429822cc3b57eea.tar.bz2 volse-hubzilla-6f24c7cb27dbb269562b0123f429822cc3b57eea.zip |
zid fixes
Diffstat (limited to 'boot.php')
-rw-r--r-- | boot.php | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -2029,10 +2029,23 @@ function zid_init(&$a) { } } +/** + * @function zid($s,$force = false) + * Adds a zid parameter to a url + * @param string $s + * The url to accept the zid + * @param boolean $force + * Currently unused + * @return string + * + */ + + function zid($s,$force = false) { - if(! strlen($s)) + if(! strlen($s) || strpos('zid=',$s)) return $s; $has_params = ((strpos($s,'?')) ? true : false); + $num_slashes = substr_count($s,'/'); if(! $has_params) $has_params = ((strpos($s,'&')) ? true : false); $achar = strpos($s,'?') ? '&' : '?'; @@ -2040,7 +2053,7 @@ function zid($s,$force = false) { $mine = get_my_url(); $myaddr = get_my_address(); if($mine and ! link_compare($mine,$s)) - return $s . (($has_params) ? '' : '/') . $achar . 'zid=' . urlencode($myaddr); + return $s . (($num_slashes >= 3) ? '' : '/') . $achar . 'zid=' . urlencode($myaddr); return $s; } |