diff --git a/boot.php b/boot.php index b02e686ba..1f2b69077 100755 --- a/boot.php +++ b/boot.php @@ -9,7 +9,7 @@ require_once('include/nav.php'); require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); -define ( 'FRIENDICA_VERSION', '2.3.1295' ); +define ( 'FRIENDICA_VERSION', '2.3.1296' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); define ( 'DB_UPDATE_VERSION', 1133 ); @@ -1415,3 +1415,21 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){ return replace_macros($tpl,array('$tabs' => $arr['tabs'])); }} + +function get_my_url() { + if(x($_SESSION,'my_url')) + return $_SESSION['my_url']; + return false; +} + +function zrl($s) { + if(! strlen($s)) + return $s; + if(! strpos($s,'/profile/')) + return $s; + $achar = strpos($s,'?') ? '&' : '?'; + $mine = get_my_url(); + if($mine and ! link_compare($mine,$s)) + return $s . $achar . 'zrl=' . urlencode($mine); + return $s; +} \ No newline at end of file diff --git a/include/conversation.php b/include/conversation.php index 5de4fcb51..1c3ee43b0 100755 --- a/include/conversation.php +++ b/include/conversation.php @@ -94,9 +94,9 @@ function localize_item(&$item){ } - $A = '[url=' . $Alink . ']' . $Aname . '[/url]'; - $B = '[url=' . $Blink . ']' . $Bname . '[/url]'; - if ($Bphoto!="") $Bphoto = '[url=' . $Blink . '][img]' . $Bphoto . '[/img][/url]'; + $A = '[url=' . zrl($Alink) . ']' . $Aname . '[/url]'; + $B = '[url=' . zrl($Blink) . ']' . $Bname . '[/url]'; + if ($Bphoto!="") $Bphoto = '[url=' . zrl($Blink) . '][img]' . $Bphoto . '[/img][/url]'; $item['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$Bphoto; @@ -108,8 +108,8 @@ function localize_item(&$item){ if(count($r)==0) return; $obj=$r[0]; - $author = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]'; - $objauthor = '[url=' . $obj['author-link'] . ']' . $obj['author-name'] . '[/url]'; + $author = '[url=' . zrl($item['author-link']) . ']' . $item['author-name'] . '[/url]'; + $objauthor = '[url=' . zrl($obj['author-link']) . ']' . $obj['author-name'] . '[/url]'; switch($obj['verb']){ case ACTIVITY_POST: @@ -158,14 +158,21 @@ function localize_item(&$item){ $target = $r[0]; $Bname = $target['author-name']; $Blink = $target['author-link']; - $A = '[url=' . $Alink . ']' . $Aname . '[/url]'; - $B = '[url=' . $Blink . ']' . $Bname . '[/url]'; + $A = '[url=' . zrl($Alink) . ']' . $Aname . '[/url]'; + $B = '[url=' . zrl($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"; } } } + $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']); + } + } } @@ -276,13 +283,16 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { if($item['author-link'] && (! $item['author-name'])) $profile_name = $item['author-link']; + + $sp = false; $profile_link = best_link_url($item,$sp); - if($sp) - $sparkle = ' sparkle'; if($profile_link === 'mailbox') $profile_link = ''; - + if($sp) + $sparkle = ' sparkle'; + else + $profile_link = zrl($profile_link); $normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']); if(($normalised != 'mailbox') && (x($a->contacts[$normalised]))) @@ -484,7 +494,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { // This will have been stored in $a->page_contact by our calling page. // Put this person on the left of the wall-to-wall notice. - $owner_url = $a->page_contact['url']; + $owner_url = zrl($a->page_contact['url']); $owner_photo = $a->page_contact['thumb']; $owner_name = $a->page_contact['name']; $template = $wallwall; @@ -501,10 +511,12 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { $commentww = 'ww'; // If it is our contact, use a friendly redirect link if((link_compare($item['owner-link'],$item['url'])) - && ($item['network'] === 'dfrn')) { + && ($item['network'] === NETWORK_DFRN)) { $owner_url = $redirect_url; $osparkle = ' sparkle'; } + else + $owner_url = zrl($owner_url); } } @@ -596,14 +608,14 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { if($item['author-link'] && (! $item['author-name'])) $profile_name = $item['author-link']; - $sp = false; $profile_link = best_link_url($item,$sp); - if($sp) - $sparkle = ' sparkle'; - if($profile_link === 'mailbox') $profile_link = ''; + if($sp) + $sparkle = ' sparkle'; + else + $profile_link = zrl($profile_link); $normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']); if(($normalised != 'mailbox') && (x($a->contacts,$normalised))) @@ -767,8 +779,10 @@ function item_photo_menu($item){ $photos_link = $profile_link . "?url=photos"; $profile_link = $profile_link . "?url=profile"; $pm_url = $a->get_baseurl($ssl_state) . '/message/new/' . $cid; + $zurl = ''; } else { + $profile_link = zrl($profile_link); if(local_user() && local_user() == $item['uid'] && link_compare($item['url'],$item['author-link'])) { $cid = $item['contact-id']; } @@ -795,7 +809,7 @@ function item_photo_menu($item){ $menu = Array( t("View status") => $status_link, t("View profile") => $profile_link, - t("View photos") => $photos_link, + t("View photos") => $photos_link, t("View recent") => $posts_link, t("Edit contact") => $contact_url, t("Send PM") => $pm_url, @@ -828,6 +842,8 @@ function like_puller($a,$item,&$arr,$mode) { $url = $a->get_baseurl(true) . '/redir/' . $item['contact-id']; $sparkle = ' class="sparkle" '; } + else + $url = zrl($url); if(! ((isset($arr[$item['parent'] . '-l'])) && (is_array($arr[$item['parent'] . '-l'])))) $arr[$item['parent'] . '-l'] = array(); if(! isset($arr[$item['parent']])) diff --git a/include/dba.php b/include/dba.php index 138e82b58..76cc0bc7b 100755 --- a/include/dba.php +++ b/include/dba.php @@ -209,9 +209,8 @@ function q($sql) { if($db && $db->connected) { $stmt = vsprintf($sql,$args); if($stmt === false) - logger('dba: vsprintf error: ' . print_r(debug_bracktrace(),true)); - $ret = $db->q($stmt); - return $ret; + logger('dba: vsprintf error: ' . print_r(debug_backtrace(),true)); + return $db->q($stmt); } /** diff --git a/include/nav.php b/include/nav.php index f40e92dbc..2c9c643a9 100755 --- a/include/nav.php +++ b/include/nav.php @@ -69,7 +69,9 @@ function nav(&$a) { * "Home" should also take you home from an authenticated remote profile connection */ - $homelink = ((x($_SESSION,'visitor_home')) ? $_SESSION['visitor_home'] : ''); + $homelink = get_my_url(); + if(! $homelink) + $homelink = ((x($_SESSION,'visitor_home')) ? $_SESSION['visitor_home'] : ''); if(($a->module != 'home') && (! (local_user()))) $nav['home'] = array($homelink, t('Home'), "", t('Home Page')); diff --git a/include/security.php b/include/security.php index 19e91eb63..66622fd33 100755 --- a/include/security.php +++ b/include/security.php @@ -9,6 +9,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive $_SESSION['authenticated'] = 1; $_SESSION['page_flags'] = $user_record['page-flags']; $_SESSION['my_url'] = $a->get_baseurl() . '/profile/' . $user_record['nickname']; + $_SESSION['my_address'] = $user_record['nickname'] . '@' . substr($a->get_baseurl(),strpos($a->get_baseurl(),'://')+3); $_SESSION['addr'] = $_SERVER['REMOTE_ADDR']; $a->user = $user_record; diff --git a/include/text.php b/include/text.php index 6d557ed84..0b825cc39 100644 --- a/include/text.php +++ b/include/text.php @@ -610,6 +610,8 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) { $url = $redirect_url; $sparkle = ' sparkle'; } + else + $url = zrl($url); } $click = ((x($contact,'click')) ? ' onclick="' . $contact['click'] . '" ' : ''); if($click) diff --git a/index.php b/index.php index 0916ed8b1..2faac1f28 100755 --- a/index.php +++ b/index.php @@ -93,6 +93,9 @@ if((x($_SESSION,'language')) && ($_SESSION['language'] !== $lang)) { load_translation_table($lang); } +if(x($_GET,'zrl')) { + $_SESSION['my_url'] = $_GET['zrl']; +} /** * diff --git a/mod/dirfind.php b/mod/dirfind.php index 75b1c4976..34c54dd91 100755 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -46,7 +46,7 @@ function dirfind_content(&$a) { foreach($j->results as $jj) { $o .= replace_macros($tpl,array( - '$url' => $jj->url, + '$url' => zrl($jj->url), '$name' => $jj->name, '$photo' => $jj->photo, '$tags' => $jj->tags diff --git a/mod/friendica.php b/mod/friendica.php index d5dad9448..52a064224 100755 --- a/mod/friendica.php +++ b/mod/friendica.php @@ -4,8 +4,12 @@ function friendica_init(&$a) { if ($a->argv[1]=="json"){ $register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN'); + $sql_extra = ''; + if(x($a->config,'admin_nickname')) { + $sql_extra = sprintf(" AND nickname = '%s' ",dbesc($a->config['admin_nickname'])); + } if (isset($a->config['admin_email']) && $a->config['admin_email']!=''){ - $r = q("SELECT username, nickname FROM user WHERE email='%s'", $a->config['admin_email']); + $r = q("SELECT username, nickname FROM user WHERE email='%s' $sql_extra", dbesc($a->config['admin_email'])); $admin = array( 'name' => $r[0]['username'], 'profile'=> $a->get_baseurl().'/profile/'.$r[0]['nickname'], diff --git a/mod/match.php b/mod/match.php index 1ae7848a6..926df1dff 100755 --- 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' => $jj->url, + '$url' => zrl($jj->url), '$name' => $jj->name, '$photo' => $jj->photo, '$inttxt' => ' ' . t('is interested in:'), diff --git a/mod/notifications.php b/mod/notifications.php index ff131010f..551b307db 100755 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -145,7 +145,7 @@ function notifications_content(&$a) { '$contact_id' => $rr['contact-id'], '$photo' => ((x($rr,'fphoto')) ? $rr['fphoto'] : "images/person-175.jpg"), '$fullname' => $rr['fname'], - '$url' => $rr['furl'], + '$url' => zrl($rr['furl']), '$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''), '$activity' => array('activity', t('Post a new friend activity'), 1, t('if applicable')), @@ -195,7 +195,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'), 1, t('if applicable')), - '$url' => $rr['url'], + '$url' => zrl($rr['url']), '$knowyou' => $knowyou, '$approve' => t('Approve'), '$note' => $rr['note'], diff --git a/mod/suggest.php b/mod/suggest.php index b8ca423c5..7a86d53a1 100755 --- 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' => $rr['url'], + '$url' => zrl($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 6b66f60d7..e7d26b73e 100755 --- a/mod/viewcontacts.php +++ b/mod/viewcontacts.php @@ -54,6 +54,8 @@ function viewcontacts_content(&$a) { if($is_owner && ($rr['network'] === NETWORK_DFRN) && ($rr['rel'])) $url = 'redir/' . $rr['id']; + else + $url = zrl($url); $contacts[] = array( 'id' => $rr['id'], diff --git a/view/field_combobox.tpl b/view/field_combobox.tpl index 658133071..a4dc8e571 100644 --- a/view/field_combobox.tpl +++ b/view/field_combobox.tpl @@ -1,6 +1,6 @@
- + {# html5 don't work on Chrome, Safari and IE9 diff --git a/view/theme/diabook-blue/communityhome.tpl b/view/theme/diabook-blue/communityhome.tpl index fa8197dd4..00a59eec0 100755 --- a/view/theme/diabook-blue/communityhome.tpl +++ b/view/theme/diabook-blue/communityhome.tpl @@ -7,10 +7,10 @@
{{ if $lastusers_title }}

Help or @NewHere ?

+NewHere
Friendica Support
Let's talk
Local Friendica -NewHere {{ endif }}
@@ -30,13 +30,14 @@ {{ endif }}
-
+
{{ if $nv }}

Find Friends

$nv.directory.1
$nv.match.1
-$nv.suggest.1 +$nv.suggest.1
$nv.invite.1 +$nv.search {{ endif }}
diff --git a/view/theme/diabook-blue/icons/srch_bg.gif b/view/theme/diabook-blue/icons/srch_bg.gif new file mode 100644 index 000000000..6a523ba8f Binary files /dev/null and b/view/theme/diabook-blue/icons/srch_bg.gif differ diff --git a/view/theme/diabook-blue/icons/srch_l.gif b/view/theme/diabook-blue/icons/srch_l.gif new file mode 100644 index 000000000..6d95bf35d Binary files /dev/null and b/view/theme/diabook-blue/icons/srch_l.gif differ diff --git a/view/theme/diabook-blue/icons/srch_r.gif b/view/theme/diabook-blue/icons/srch_r.gif new file mode 100644 index 000000000..89833a316 Binary files /dev/null and b/view/theme/diabook-blue/icons/srch_r.gif differ diff --git a/view/theme/diabook-blue/icons/srch_r_f2.gif b/view/theme/diabook-blue/icons/srch_r_f2.gif new file mode 100644 index 000000000..6df457bed Binary files /dev/null and b/view/theme/diabook-blue/icons/srch_r_f2.gif differ diff --git a/view/theme/diabook-blue/nav.tpl b/view/theme/diabook-blue/nav.tpl index 651b9647d..d73dd047a 100644 --- a/view/theme/diabook-blue/nav.tpl +++ b/view/theme/diabook-blue/nav.tpl @@ -65,15 +65,11 @@ - + {{ if $nav.directory }} + + {{ endif }} {{ if $nav.apps }} @@ -98,7 +98,7 @@ {{ endif }} - {{ if $nav.home }} + {{ if $nav.settings }}
-
+ +