aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--boot.php25
-rw-r--r--include/ItemObject.php10
-rw-r--r--include/conversation.php60
-rw-r--r--include/security.php3
-rw-r--r--include/text.php4
-rw-r--r--index.php10
-rw-r--r--mod/dfrn_request.php4
-rw-r--r--mod/directory.php2
-rw-r--r--mod/dirfind.php2
-rw-r--r--mod/match.php2
-rw-r--r--mod/notifications.php4
-rw-r--r--mod/randprof.php2
-rw-r--r--mod/suggest.php2
-rw-r--r--mod/viewcontacts.php2
-rw-r--r--view/tpl/nav.tpl2
15 files changed, 73 insertions, 61 deletions
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;
}
diff --git a/include/ItemObject.php b/include/ItemObject.php
index 89e8dd3bc..2147b00b9 100644
--- a/include/ItemObject.php
+++ b/include/ItemObject.php
@@ -135,7 +135,7 @@ class Item extends BaseObject {
$profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']);
$profile_avatar = $item['author']['xchan_photo_m'];
- $profile_link = zrl($item['author']['xchan_url']);
+ $profile_link = zid($item['author']['xchan_url']);
$profile_name = $item['author']['xchan_name'];
// if($item['author-link'] && (! $item['author-name']))
@@ -147,9 +147,9 @@ class Item extends BaseObject {
if($sp)
$sparkle = ' sparkle';
else
- $profile_link = zrl($profile_link);
+ $profile_link = zid($profile_link);
- $profile_link = zrl($item['author']['xchan_url']);
+ $profile_link = zid($item['author']['xchan_url']);
// $normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
@@ -586,7 +586,7 @@ class Item extends BaseObject {
// This will have been stored in $a->page_contact by our calling page.
// Put this person as the wall owner of the wall-to-wall notice.
- $this->owner_url = zrl($a->page_contact['url']);
+ $this->owner_url = zid($a->page_contact['url']);
$this->owner_photo = $a->page_contact['thumb'];
$this->owner_name = $a->page_contact['name'];
$this->wall_to_wall = true;
@@ -617,7 +617,7 @@ class Item extends BaseObject {
$this->owner_url = $this->get_redirect_url();
}
else
- $this->owner_url = zrl($this->get_data_value('owner-link'));
+ $this->owner_url = zid($this->get_data_value('owner-link'));
}
}
}
diff --git a/include/conversation.php b/include/conversation.php
index ae7b47569..be6b3f3ef 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -107,12 +107,12 @@ function localize_item(&$item){
// If we couldn't parse something useful, don't bother translating.
- // We need something better than zrl here, probably magic_link(), but it needs writing
+ // We need something better than zid here, probably magic_link(), but it needs writing
if($author_link && $author_name && $item_url) {
- $author = '[url=' . zrl($item['author']['xchan_url']) . ']' . $item['author']['xchan_name'] . '[/url]';
- $objauthor = '[url=' . zrl($author_link) . ']' . $author_name . '[/url]';
+ $author = '[url=' . zid($item['author']['xchan_url']) . ']' . $item['author']['xchan_name'] . '[/url]';
+ $objauthor = '[url=' . zid($author_link) . ']' . $author_name . '[/url]';
switch($obj->type) {
case ACTIVITY_OBJ_PHOTO:
@@ -127,7 +127,7 @@ function localize_item(&$item){
break;
}
- $plink = '[url=' . zrl($item_url) . ']' . $post_type . '[/url]';
+ $plink = '[url=' . zid($item_url) . ']' . $post_type . '[/url]';
if(activity_match($item['verb'],ACTIVITY_LIKE)) {
$bodyverb = t('%1$s likes %2$s\'s %3$s');
@@ -164,9 +164,9 @@ function localize_item(&$item){
}
- $A = '[url=' . zrl($Alink) . ']' . $Aname . '[/url]';
- $B = '[url=' . zrl($Blink) . ']' . $Bname . '[/url]';
- if ($Bphoto!="") $Bphoto = '[url=' . zrl($Blink) . '][img]' . $Bphoto . '[/img][/url]';
+ $A = '[url=' . zid($Alink) . ']' . $Aname . '[/url]';
+ $B = '[url=' . zid($Blink) . ']' . $Bname . '[/url]';
+ if ($Bphoto!="") $Bphoto = '[url=' . zid($Blink) . '][img]' . $Bphoto . '[/img][/url]';
$item['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$Bphoto;
@@ -196,9 +196,9 @@ function localize_item(&$item){
}
- $A = '[url=' . zrl($Alink) . ']' . $Aname . '[/url]';
- $B = '[url=' . zrl($Blink) . ']' . $Bname . '[/url]';
- if ($Bphoto!="") $Bphoto = '[url=' . zrl($Blink) . '][img=80x80]' . $Bphoto . '[/img][/url]';
+ $A = '[url=' . zid($Alink) . ']' . $Aname . '[/url]';
+ $B = '[url=' . zid($Blink) . ']' . $Bname . '[/url]';
+ if ($Bphoto!="") $Bphoto = '[url=' . zid($Blink) . '][img=80x80]' . $Bphoto . '[/img][/url]';
// we can't have a translation string with three positions but no distinguishable text
// So here is the translate string.
@@ -221,7 +221,7 @@ function localize_item(&$item){
$Aname = $item['author-name'];
$Alink = $item['author-link'];
- $A = '[url=' . zrl($Alink) . ']' . $Aname . '[/url]';
+ $A = '[url=' . zid($Alink) . ']' . $Aname . '[/url]';
$txt = t('%1$s is currently %2$s');
@@ -235,8 +235,8 @@ function localize_item(&$item){
if(count($r)==0) return;
$obj=$r[0];
- $author = '[url=' . zrl($item['author-link']) . ']' . $item['author-name'] . '[/url]';
- $objauthor = '[url=' . zrl($obj['author-link']) . ']' . $obj['author-name'] . '[/url]';
+ $author = '[url=' . zid($item['author-link']) . ']' . $item['author-name'] . '[/url]';
+ $objauthor = '[url=' . zid($obj['author-link']) . ']' . $obj['author-name'] . '[/url]';
switch($obj['verb']){
case ACTIVITY_POST:
@@ -285,8 +285,8 @@ function localize_item(&$item){
$target = $r[0];
$Bname = $target['author-name'];
$Blink = $target['author-link'];
- $A = '[url=' . zrl($Alink) . ']' . $Aname . '[/url]';
- $B = '[url=' . zrl($Blink) . ']' . $Bname . '[/url]';
+ $A = '[url=' . zid($Alink) . ']' . $Aname . '[/url]';
+ $B = '[url=' . zid($Blink) . ']' . $Bname . '[/url]';
$P = '[url=' . $target['plink'] . ']' . t('post/item') . '[/url]';
$item['body'] = sprintf( t('%1$s marked %2$s\'s %3$s as favorite'), $A, $B, $P)."\n";
@@ -296,15 +296,15 @@ function localize_item(&$item){
$matches = null;
if(preg_match_all('/@\[url=(.*?)\]/is',$item['body'],$matches,PREG_SET_ORDER)) {
foreach($matches as $mtch) {
- if(! strpos($mtch[1],'zrl='))
- $item['body'] = str_replace($mtch[0],'@[url=' . zrl($mtch[1]). ']',$item['body']);
+ if(! strpos($mtch[1],'zid='))
+ $item['body'] = str_replace($mtch[0],'@[url=' . zid($mtch[1]). ']',$item['body']);
}
}
- // add zrl's to public images
+ // add zid's to public images
if(preg_match_all('/\[url=(.*?)\/photos\/(.*?)\/image\/(.*?)\]\[img(.*?)\]h(.*?)\[\/img\]\[\/url\]/is',$item['body'],$matches,PREG_SET_ORDER)) {
foreach($matches as $mtch) {
- $item['body'] = str_replace($mtch[0],'[url=' . zrl($mtch[1] . '/photos/' . $mtch[2] . '/image/' . $mtch[3] ,true) . '][img' . $mtch[4] . ']h' . $mtch[5] . '[/img][/url]',$item['body']);
+ $item['body'] = str_replace($mtch[0],'[url=' . zid($mtch[1] . '/photos/' . $mtch[2] . '/image/' . $mtch[3] ,true) . '][img' . $mtch[4] . ']h' . $mtch[5] . '[/img][/url]',$item['body']);
}
}
@@ -440,7 +440,7 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
if($sp)
$sparkle = ' sparkle';
else
- $profile_link = zrl($profile_link);
+ $profile_link = zid($profile_link);
$normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
if(x($a->contacts,$normalised))
@@ -449,7 +449,7 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
$profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $a->get_cached_avatar_image($thumb));
$profile_avatar = $item['author']['xchan_photo_m'];
- $profile_link = zrl($item['author']['xchan_url']);
+ $profile_link = zid($item['author']['xchan_url']);
$profile_name = $item['author']['xchan_name'];
$locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
@@ -483,7 +483,7 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
// This will have been stored in $a->page_contact by our calling page.
// Put this person as the wall owner of the wall-to-wall notice.
- $owner_url = zrl($a->page_contact['url']);
+ $owner_url = zid($a->page_contact['url']);
$owner_photo = $a->page_contact['thumb'];
$owner_name = $a->page_contact['name'];
$template = $wallwall_template;
@@ -518,7 +518,7 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
$osparkle = ' sparkle';
}
else
- $owner_url = zrl($owner_url);
+ $owner_url = zid($owner_url);
}
}
}
@@ -885,7 +885,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
if($sp)
$sparkle = ' sparkle';
else
- $profile_link = zrl($profile_link);
+ $profile_link = zid($profile_link);
$normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
if(x($a->contacts,$normalised))
@@ -1182,7 +1182,7 @@ old code
// This will have been stored in $a->page_contact by our calling page.
// Put this person as the wall owner of the wall-to-wall notice.
- $owner_url = zrl($a->page_contact['url']);
+ $owner_url = zid($a->page_contact['url']);
$owner_photo = $a->page_contact['thumb'];
$owner_name = $a->page_contact['name'];
$template = $wallwall;
@@ -1218,7 +1218,7 @@ old code
$osparkle = ' sparkle';
}
else
- $owner_url = zrl($owner_url);
+ $owner_url = zid($owner_url);
}
}
}
@@ -1328,7 +1328,7 @@ old code
if($sp)
$sparkle = ' sparkle';
else
- $profile_link = zrl($profile_link);
+ $profile_link = zid($profile_link);
$normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
if(x($a->contacts,$normalised))
@@ -1339,7 +1339,7 @@ old code
$profile_avatar = $item['author']['xchan_photo_m'];
- $profile_link = zrl($item['author']['xchan_url']);
+ $profile_link = zid($item['author']['xchan_url']);
$profile_name = $item['author']['xchan_name'];
@@ -1547,7 +1547,7 @@ function item_photo_menu($item){
$zurl = '';
}
else {
- $profile_link = zrl($profile_link);
+ $profile_link = zid($profile_link);
if(local_user() && local_user() == $item['uid'] && link_compare($item['url'],$item['author-link'])) {
$cid = $item['contact-id'];
}
@@ -1615,7 +1615,7 @@ function like_puller($a,$item,&$arr,$mode) {
$sparkle = ' class="sparkle" ';
}
else
- $url = zrl($url);
+ $url = zid($url);
if(! $item['thr_parent'])
$item['thr_parent'] = $item['parent_uri'];
diff --git a/include/security.php b/include/security.php
index ea3df2511..eeec2b3d6 100644
--- a/include/security.php
+++ b/include/security.php
@@ -222,6 +222,9 @@ function change_channel($change_channel) {
dbesc($hash)
);
if($x) {
+ $_SESSION['my_url'] = $x[0]['xchan_url'];
+ $_SESSION['my_address'] = $x[0]['xchan_addr'];
+
get_app()->set_observer($x[0]);
get_app()->set_perms(get_all_perms(local_user(),$hash));
}
diff --git a/include/text.php b/include/text.php
index 0d92c6875..dcd3ad07f 100644
--- a/include/text.php
+++ b/include/text.php
@@ -230,7 +230,7 @@ function paginate(&$a) {
$o = '';
$stripped = preg_replace('/(&page=[0-9]*)/','',$a->query_string);
-// $stripped = preg_replace('/&zrl=(.*?)([\?&]|$)/ism','',$stripped);
+// $stripped = preg_replace('/&zid=(.*?)([\?&]|$)/ism','',$stripped);
$stripped = str_replace('q=','',$stripped);
$stripped = trim($stripped,'/');
@@ -588,7 +588,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
$sparkle = ' sparkle';
}
else
- $url = zrl($url);
+ $url = zid($url);
}
$click = ((x($contact,'click')) ? ' onclick="' . $contact['click'] . '" ' : '');
if($click)
diff --git a/index.php b/index.php
index 32597cf04..393d0cf4d 100644
--- a/index.php
+++ b/index.php
@@ -85,10 +85,12 @@ if((x($_SESSION,'language')) && ($_SESSION['language'] !== $lang)) {
load_translation_table($a->language);
}
-if((x($_GET,'zrl')) && (! $install)) {
- $_SESSION['my_url'] = $_GET['zrl'];
- $a->query_string = preg_replace('/[\?&]zrl=(.*?)([\?&]|$)/is','',$a->query_string);
- zrl_init($a);
+if((x($_GET,'zid')) && (! $install)) {
+ $a->query_string = preg_replace('/[\?&]zid=(.*?)([\?&]|$)/is','',$a->query_string);
+ if(! local_user()) {
+ $_SESSION['my_address'] = $_GET['zid'];
+ zid_init($a);
+ }
}
if((x($_SESSION,'authenticated')) || (x($_POST,'auth-params')) || ($a->module === 'login'))
diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php
index dc329aa19..95b2ec3a4 100644
--- a/mod/dfrn_request.php
+++ b/mod/dfrn_request.php
@@ -196,7 +196,7 @@ function dfrn_request_post(&$a) {
// (ignore reply, nothing we can do it failed)
- goaway(zrl($dfrn_url));
+ goaway(zid($dfrn_url));
return; // NOTREACHED
}
@@ -780,7 +780,7 @@ function dfrn_request_content(&$a) {
$myaddr = ((x($_GET,'address')) ? $_GET['address'] : '');
}
- // last, try a zrl
+ // last, try a zid
if(! strlen($myaddr))
$myaddr = get_my_url();
diff --git a/mod/directory.php b/mod/directory.php
index 1854a0e62..58e9be293 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -41,7 +41,7 @@ function directory_content(&$a) {
$gdirpath = dirname(get_config('system','directory_submit_url'));
if(strlen($gdirpath)) {
$globaldir = '<ul><li><div id="global-directory-link"><a href="'
- . zrl($gdirpath,true) . '">' . t('Global Directory') . '</a></div></li></ul>';
+ . zid($gdirpath,true) . '">' . t('Global Directory') . '</a></div></li></ul>';
}
$admin = '';
diff --git a/mod/dirfind.php b/mod/dirfind.php
index 5c5d0e933..54bbf31af 100644
--- a/mod/dirfind.php
+++ b/mod/dirfind.php
@@ -49,7 +49,7 @@ function dirfind_content(&$a) {
foreach($j->results as $jj) {
$o .= replace_macros($tpl,array(
- '$url' => zrl($jj->url),
+ '$url' => zid($jj->url),
'$name' => $jj->name,
'$photo' => $jj->photo,
'$tags' => $jj->tags
diff --git a/mod/match.php b/mod/match.php
index fbe3aa91f..b845b0d46 100644
--- a/mod/match.php
+++ b/mod/match.php
@@ -51,7 +51,7 @@ function match_content(&$a) {
$connlnk = $a->get_baseurl() . '/follow/?url=' . $jj->url;
$o .= replace_macros($tpl,array(
- '$url' => zrl($jj->url),
+ '$url' => zid($jj->url),
'$name' => $jj->name,
'$photo' => $jj->photo,
'$inttxt' => ' ' . t('is interested in:'),
diff --git a/mod/notifications.php b/mod/notifications.php
index 8221dd7c3..7d861037c 100644
--- a/mod/notifications.php
+++ b/mod/notifications.php
@@ -149,7 +149,7 @@ function notifications_content(&$a) {
'$contact_id' => $rr['contact-id'],
'$photo' => ((x($rr,'fphoto')) ? $rr['fphoto'] : "images/person-175.jpg"),
'$fullname' => $rr['fname'],
- '$url' => zrl($rr['furl']),
+ '$url' => zid($rr['furl']),
'$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''),
'$activity' => array('activity', t('Post a new friend activity'), (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0), t('if applicable')),
@@ -199,7 +199,7 @@ function notifications_content(&$a) {
'$fullname' => $rr['name'],
'$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''),
'$activity' => array('activity', t('Post a new friend activity'), (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0), t('if applicable')),
- '$url' => zrl($rr['url']),
+ '$url' => zid($rr['url']),
'$knowyou' => $knowyou,
'$approve' => t('Approve'),
'$note' => $rr['note'],
diff --git a/mod/randprof.php b/mod/randprof.php
index 6713a81d9..0726b231a 100644
--- a/mod/randprof.php
+++ b/mod/randprof.php
@@ -5,6 +5,6 @@ function randprof_init(&$a) {
require_once('include/Contact.php');
$x = random_profile();
if($x)
- goaway(zrl($x));
+ goaway(zid($x));
goaway($a->get_baseurl() . '/profile');
}
diff --git a/mod/suggest.php b/mod/suggest.php
index 7a86d53a1..4aed2e61a 100644
--- a/mod/suggest.php
+++ b/mod/suggest.php
@@ -52,7 +52,7 @@ function suggest_content(&$a) {
$connlnk = $a->get_baseurl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']);
$o .= replace_macros($tpl,array(
- '$url' => zrl($rr['url']),
+ '$url' => zid($rr['url']),
'$name' => $rr['name'],
'$photo' => $rr['photo'],
'$ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['id'],
diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php
index 3c595567f..8133fb4a0 100644
--- a/mod/viewcontacts.php
+++ b/mod/viewcontacts.php
@@ -55,7 +55,7 @@ function viewcontacts_content(&$a) {
if($is_owner && ($rr['network'] === NETWORK_DFRN) && ($rr['rel']))
$url = 'redir/' . $rr['id'];
else
- $url = zrl($url);
+ $url = zid($url);
$contacts[] = array(
'id' => $rr['id'],
diff --git a/view/tpl/nav.tpl b/view/tpl/nav.tpl
index 373af036d..d2e525756 100644
--- a/view/tpl/nav.tpl
+++ b/view/tpl/nav.tpl
@@ -11,7 +11,7 @@
{{ endif }}
{{ if $userinfo }}
- <li id="nav-user-linkmenu" class="nav-menu-icon"><a href="#" rel="#nav-user-menu" title="$sitelocation"><img src="$userinfo.icon" alt="$userinfo.name"></a>
+ <li id="nav-user-linkmenu" class="nav-menu-icon"><a href="#" rel="#nav-user-menu" title="$userinfo.name"><img src="$userinfo.icon" alt="$userinfo.name"></a>
{{ if $localuser }}
<ul id="nav-user-menu" class="menu-popup">
{{ for $nav.usermenu as $usermenu }}