Merge pull request #1072 from annando/master

Less visible options when connecting a friendica contact
This commit is contained in:
fabrixxm 2014-08-22 10:01:49 +02:00
commit 1ead394a94
9 changed files with 129 additions and 88 deletions

View file

@ -1487,7 +1487,6 @@ if(! function_exists('profile_sidebar')) {
$connect = (($profile['uid'] != local_user()) ? t('Connect') : False);
// don't show connect link to authenticated visitors either
if(remote_user() && count($_SESSION['remote'])) {
foreach($_SESSION['remote'] as $visitor) {
if($visitor['uid'] == $profile['uid']) {
@ -1497,13 +1496,21 @@ if(! function_exists('profile_sidebar')) {
}
}
// Is the local user already connected to that user?
if ($connect AND local_user()) {
$profile_url = normalise_link($a->get_baseurl()."/profile/".$profile["nickname"]);
$r = q("SELECT * FROM `contact` WHERE NOT `pending` AND `uid` = %d AND `nurl` = '%s'",
local_user(), $profile_url);
if (count($r))
$connect = false;
}
if( get_my_url() && $profile['unkmail'] && ($profile['uid'] != local_user()) )
$wallmessage = t('Message');
else
$wallmessage = false;
// show edit profile to yourself
if ($profile['uid'] == local_user() && feature_enabled(local_user(),'multi_profiles')) {
$profile['edit'] = array($a->get_baseurl(). '/profiles', t('Profiles'),"", t('Manage/edit profiles'));
@ -1535,17 +1542,14 @@ if(! function_exists('profile_sidebar')) {
}
}
if ($profile['uid'] == local_user() && !feature_enabled(local_user(),'multi_profiles')) {
$profile['edit'] = array($a->get_baseurl(). '/profiles/'.$profile['id'], t('Edit profile'),"", t('Edit profile'));
$profile['menu'] = array(
if ($profile['uid'] == local_user() && !feature_enabled(local_user(),'multi_profiles')) {
$profile['edit'] = array($a->get_baseurl(). '/profiles/'.$profile['id'], t('Edit profile'),"", t('Edit profile'));
$profile['menu'] = array(
'chg_photo' => t('Change profile photo'),
'cr_new' => null,
'entries' => array(),
);
}
}
if((x($profile,'address') == 1)
|| (x($profile,'locality') == 1)

View file

@ -11,11 +11,11 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
$type = "";
preg_match("/type='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "")
$type = $matches[1];
$type = strtolower($matches[1]);
preg_match('/type="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "")
$type = $matches[1];
$type = strtolower($matches[1]);
if ($type == "")
return($match[0]);
@ -42,22 +42,26 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
$title = $matches[1];
$image = "";
preg_match("/image='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "")
$image = $matches[1];
if ($type != "video") {
preg_match("/image='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "")
$image = $matches[1];
preg_match('/image="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "")
$image = $matches[1];
preg_match('/image="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "")
$image = $matches[1];
}
$preview = "";
preg_match("/preview='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "")
$preview = $matches[1];
if ($type != "video") {
preg_match("/preview='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "")
$preview = $matches[1];
preg_match('/preview="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "")
$preview = $matches[1];
preg_match('/preview="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "")
$preview = $matches[1];
}
if ($plaintext)
$text = sprintf('<a href="%s" target="_blank">%s</a>', $url, $title);
@ -156,6 +160,10 @@ function bb_cleanup_share($shared, $plaintext, $nolink) {
if (($text == "") AND ($title != "") AND ($link == ""))
$text .= "\n\n".trim($title);
// If the link already is included in the post, don't add it again
if (($link != "") AND strpos($text, $link))
return(trim($text));
if (($link != "") AND ($title != ""))
$text .= "\n[url=".trim($link)."]".trim($title)."[/url]";
elseif (($link != ""))

View file

@ -28,6 +28,13 @@ function notification($params) {
$sender_email = t('noreply') . '@' . $hostname;
$additional_mail_header = "";
$additional_mail_header .= "Precedence: list\n";
$additional_mail_header .= "X-Friendica-Host: ".$hostname."\n";
$additional_mail_header .= "X-Friendica-Platform: ".FRIENDICA_PLATFORM."\n";
$additional_mail_header .= "X-Friendica-Version: ".FRIENDICA_VERSION."\n";
$additional_mail_header .= "List-ID: <notification.".$hostname.">\n";
$additional_mail_header .= "List-Archive: <".$a->get_baseurl()."/notifications/system>\n";
if(array_key_exists('item',$params)) {
$title = $params['item']['title'];
$body = $params['item']['body'];
@ -367,40 +374,37 @@ function notification($params) {
logger('notification: sending notification email');
$id_for_parent = "${params['parent']}@${hostname}";
if (isset($params['parent']) AND (intval($params['parent']) != 0)) {
$id_for_parent = $params['parent']."@".$hostname;
// Is this the first email notification for this parent item and user?
// Is this the first email notification for this parent item and user?
$r = q("select `id` from `notify-threads` where `master-parent-item` = %d and `receiver-uid` = %d limit 1",
intval($params['parent']),
intval($params['uid']) );
// If so, create the record of it and use a message-id smtp header.
if(!$r) {
logger("notify_id:" . intval($notify_id). ", parent: " . intval($params['parent']) . "uid: " .
intval($params['uid']), LOGGER_DEBUG);
$r = q("insert into `notify-threads` (`notify-id`, `master-parent-item`, `receiver-uid`, `parent-item`)
values(%d,%d,%d,%d)",
intval($notify_id),
$r = q("select `id` from `notify-threads` where `master-parent-item` = %d and `receiver-uid` = %d limit 1",
intval($params['parent']),
intval($params['uid']),
0 );
intval($params['uid']) );
$additional_mail_header .= "Message-ID: <${id_for_parent}>\n";
$log_msg = "include/enotify: No previous notification found for this parent:\n" .
" parent: ${params['parent']}\n" . " uid : ${params['uid']}\n";
logger($log_msg, LOGGER_DEBUG);
// If so, create the record of it and use a message-id smtp header.
if(!$r) {
logger("notify_id:".intval($notify_id).", parent: ".intval($params['parent'])."uid: ".intval($params['uid']), LOGGER_DEBUG);
$r = q("insert into `notify-threads` (`notify-id`, `master-parent-item`, `receiver-uid`, `parent-item`)
values(%d,%d,%d,%d)",
intval($notify_id),
intval($params['parent']),
intval($params['uid']),
0 );
$additional_mail_header .= "Message-ID: <${id_for_parent}>\n";
$log_msg = "include/enotify: No previous notification found for this parent:\n" .
" parent: ${params['parent']}\n" . " uid : ${params['uid']}\n";
logger($log_msg, LOGGER_DEBUG);
} else {
// If not, just "follow" the thread.
$additional_mail_header .= "References: <${id_for_parent}>\nIn-Reply-To: <${id_for_parent}>\n";
logger("include/enotify: There's already a notification for this parent:\n" . print_r($r, true), LOGGER_DEBUG);
}
}
// If not, just "follow" the thread.
else {
$additional_mail_header = "References: <${id_for_parent}>\nIn-Reply-To: <${id_for_parent}>\n";
logger("include/enotify: There's already a notification for this parent:\n" . print_r($r, true), LOGGER_DEBUG);
}
$textversion = strip_tags(html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r", "\\n"), "\n",
$body))),ENT_QUOTES,'UTF-8'));

View file

@ -1567,7 +1567,8 @@ function tag_deliver($uid,$item_id) {
'source_link' => $item['author-link'],
'source_photo' => $photo,
'verb' => ACTIVITY_TAG,
'otype' => 'item'
'otype' => 'item',
'parent' => $item['parent']
));
@ -1970,7 +1971,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
}
if((is_array($contact)) && ($photo_timestamp) && (strlen($photo_url)) && ($photo_timestamp > $contact['avatar-date'])) {
logger('consume_feed: Updating photo for ' . $contact['name']);
logger('consume_feed: Updating photo for '.$contact['name'].' from '.$photo_url.' uid: '.$contact['uid']);
require_once("include/Photo.php");
$photo_failure = false;
$have_photo = false;

View file

@ -768,27 +768,22 @@ function dfrn_request_content(&$a) {
* Try to auto-fill the profile address
*/
if(local_user()) {
// At first look if an address was provided
// Otherwise take the local address
if (x($_GET,'addr') AND ($_GET['addr'] != ""))
$myaddr = hex2bin($_GET['addr']);
elseif (x($_GET,'address') AND ($_GET['address'] != ""))
$myaddr = $_GET['address'];
elseif(local_user()) {
if(strlen($a->path)) {
$myaddr = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
}
else {
$myaddr = $a->user['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
}
}
elseif(x($_GET,'addr')) {
$myaddr = hex2bin($_GET['addr']);
}
else {
/* $_GET variables are already urldecoded */
$myaddr = ((x($_GET,'address')) ? $_GET['address'] : '');
}
// last, try a zrl
if(! strlen($myaddr))
} else // last, try a zrl
$myaddr = get_my_url();
$target_addr = $a->profile['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
@ -805,9 +800,6 @@ function dfrn_request_content(&$a) {
else
$tpl = get_markup_template('auto_request.tpl');
# $page_desc = sprintf( t('Diaspora members: Please do not use this form. Instead, enter "%s" into your Diaspora search bar.'),
# $target_addr) . EOL . EOL;
$page_desc .= t("Please enter your 'Identity Address' from one of the following supported communications networks:");
// see if we are allowed to have NETWORK_MAIL2 contacts
@ -824,7 +816,9 @@ function dfrn_request_content(&$a) {
$mail_disabled = 1;
}
$emailnet = (($mail_disabled) ? '' : t("<strike>Connect as an email follower</strike> \x28Coming soon\x29"));
// "coming soon" is disabled for now
//$emailnet = (($mail_disabled) ? '' : t("<strike>Connect as an email follower</strike> \x28Coming soon\x29"));
$emailnet = "";
$invite_desc = t('If you are not yet a member of the free social web, <a href="http://dir.friendica.com/siteinfo">follow this link to find a public Friendica site and join us today</a>.');
@ -832,9 +826,10 @@ function dfrn_request_content(&$a) {
'$header' => t('Friend/Connection Request'),
'$desc' => t('Examples: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@identi.ca'),
'$pls_answer' => t('Please answer the following:'),
'$does_know' => sprintf( t('Does %s know you?'),$a->profile['name']),
'$does_know_you' => array('knowyou', sprintf(t('Does %s know you?'),$a->profile['name']), false, '', array(t('No'),t('Yes'))),
/*'$does_know' => sprintf( t('Does %s know you?'),$a->profile['name']),
'$yes' => t('Yes'),
'$no' => t('No'),
'$no' => t('No'), */
'$add_note' => t('Add a personal note:'),
'$page_desc' => $page_desc,
'$friendica' => t('Friendica'),

View file

@ -167,7 +167,7 @@ function profiles_post(&$a) {
$profile_name = notags(trim($_POST['profile_name']));
if(! strlen($profile_name)) {
notify( t('Profile Name is required.') . EOL);
notice( t('Profile Name is required.') . EOL);
return;
}

View file

@ -6,6 +6,7 @@
<h1>{{$header}}</h1>
{{if $myaddr == ""}}
<p id="dfrn-request-intro">
{{$page_desc}}<br />
<ul id="dfrn-request-networks">
@ -21,12 +22,17 @@
<p>
{{$desc}}
</p>
{{/if}}
<form action="dfrn_request/{{$nickname}}" method="post" />
<div id="dfrn-request-url-wrapper" >
<label id="dfrn-url-label" for="dfrn-url" >{{$your_address}}</label>
<input type="text" name="dfrn_url" id="dfrn-url" size="32" value="{{$myaddr}}" />
{{if $myaddr}}
{{$myaddr}}
{{else}}
<input type="text" name="dfrn_url" id="dfrn-url" size="32" value="{{$myaddr}}" />
{{/if}}
<div id="dfrn-request-url-end"></div>
</div>

View file

@ -6,6 +6,8 @@
<h1>{{$header}}</h1>
{{if $myaddr}}
{{else}}
<p id="dfrn-request-intro">
{{$page_desc}}<br />
<ul id="dfrn-request-networks">
@ -19,12 +21,17 @@
<p>
{{$desc}}
</p>
{{/if}}
<form action="dfrn_request/{{$nickname}}" method="post" />
<div id="dfrn-request-url-wrapper" >
<label id="dfrn-url-label" for="dfrn-url" >{{$your_address}}</label>
{{if $myaddr}}
{{$myaddr}}
{{else}}
<input type="text" name="dfrn_url" id="dfrn-url" size="32" value="{{$myaddr}}" />
{{/if}}
<div id="dfrn-request-url-end"></div>
</div>
@ -34,7 +41,8 @@
<div id="dfrn-request-info-wrapper" >
{{include file="field_yesno.tpl" field=$does_know_you}}
<!--
<p id="doiknowyou">
{{$does_know}}
</p>
@ -51,7 +59,7 @@
<div id="dfrn-request-knowyou-end"></div>
</div>
-->
<p id="dfrn-request-message-desc">
{{$add_note}}

View file

@ -87,6 +87,21 @@ div.jGrowl div.info {
background: #fff url("../../../images/icons/48/info.png") no-repeat 5px center;
}
div.jGrowl div.notice {
color: #737373;
}
div.jGrowl div.info {
color: #737373;
}
.birthday-notice, .event-notice {
font-weight: initial;
}
div.pager, ul.tabs {
font-weight: initial;
}
nav .nav-menu-icon.selected {
background-color: #fff;
}