Merge branch 'dev' of https://framagit.org/hubzilla/core into xdev_merge

This commit is contained in:
zotlabs 2018-07-15 18:43:41 -07:00
commit cc91db55b7
10 changed files with 64 additions and 28 deletions

View File

@ -41,8 +41,6 @@ class Notifications extends \Zotlabs\Web\Controller {
$notifications_available = 1;
foreach ($r as $rr) {
$x = strip_tags(bbcode($rr['msg']));
if(strpos($x,','))
$x = substr($x,strpos($x,',')+1);
$notif_content .= replace_macros(get_markup_template('notify.tpl'),array(
'$item_link' => z_root().'/notify/view/'. $rr['id'],
'$item_image' => $rr['photo'],

View File

@ -2234,8 +2234,35 @@ function construct_page() {
if(App::get_scheme() === 'https' && App::$config['system']['transport_security_header'])
header("Strict-Transport-Security: max-age=31536000");
if(App::$config['system']['content_security_policy'])
header("Content-Security-Policy: script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'");
if(App::$config['system']['content_security_policy']) {
$cspsettings = Array (
'script-src' => Array ("'self'","'unsafe-inline'","'unsafe-eval'"),
'style-src' => Array ("'self'","'unsafe-inline'")
);
call_hooks('content_security_policy',$cspsettings);
// Legitimate CSP directives (cxref: https://content-security-policy.com/)
$validcspdirectives=Array(
"default-src", "script-src", "style-src",
"img-src", "connect-src", "font-src",
"object-src", "media-src", 'frame-src',
'sandbox', 'report-uri', 'child-src',
'form-action', 'frame-ancestors', 'plugin-types'
);
$cspheader = "Content-Security-Policy:";
foreach ($cspsettings as $cspdirective => $csp) {
if (!in_array($cspdirective,$validcspdirectives)) {
logger("INVALID CSP DIRECTIVE: ".$cspdirective,LOGGER_DEBUG);
continue;
}
$cspsettingsarray=array_unique($cspsettings[$cspdirective]);
$cspsetpolicy = implode(' ',$cspsettingsarray);
if ($cspsetpolicy) {
$cspheader .= " ".$cspdirective." ".$cspsetpolicy.";";
}
}
header($cspheader);
}
if(App::$config['system']['x_security_headers']) {
header("X-Frame-Options: SAMEORIGIN");

View File

@ -3,7 +3,7 @@
* updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago").
*
* @name timeago
* @version 1.4.1
* @version 1.6.3
* @requires jQuery v1.2.3+
* @author Ryan McGeary
* @license MIT License - http://www.opensource.org/licenses/mit-license.php
@ -11,13 +11,15 @@
* For usage and examples, visit:
* http://timeago.yarp.com/
*
* Copyright (c) 2008-2013, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org)
* Copyright (c) 2008-2017, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org)
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof module === 'object' && typeof module.exports === 'object') {
factory(require('jquery'));
} else {
// Browser globals
factory(jQuery);
@ -43,6 +45,7 @@
allowFuture: false,
localeTitle: false,
cutoff: 0,
autoDispose: true,
strings: {
prefixAgo: null,
prefixFromNow: null,
@ -66,7 +69,7 @@
},
inWords: function(distanceMillis) {
if(!this.settings.allowPast && ! this.settings.allowFuture) {
if (!this.settings.allowPast && ! this.settings.allowFuture) {
throw 'timeago allowPast and allowFuture settings can not both be set to false.';
}
@ -80,7 +83,7 @@
}
}
if(!this.settings.allowPast && distanceMillis >= 0) {
if (!this.settings.allowPast && distanceMillis >= 0) {
return this.settings.strings.inPast;
}
@ -136,7 +139,8 @@
// init is default when no action is given
// functions are called with context of a single element
var functions = {
init: function(){
init: function() {
functions.dispose.call(this);
var refresh_el = $.proxy(refresh, this);
refresh_el();
var $s = $t.settings;
@ -144,13 +148,15 @@
this._timeagoInterval = setInterval(refresh_el, $s.refreshMillis);
}
},
update: function(time){
var parsedTime = $t.parse(time);
$(this).data('timeago', { datetime: parsedTime });
if($t.settings.localeTitle) $(this).attr("title", parsedTime.toLocaleString());
update: function(timestamp) {
var date = (timestamp instanceof Date) ? timestamp : $t.parse(timestamp);
$(this).data('timeago', { datetime: date });
if ($t.settings.localeTitle) {
$(this).attr("title", date.toLocaleString());
}
refresh.apply(this);
},
updateFromDOM: function(){
updateFromDOM: function() {
$(this).data('timeago', { datetime: $t.parse( $t.isTime(this) ? $(this).attr("datetime") : $(this).attr("title") ) });
refresh.apply(this);
},
@ -164,30 +170,35 @@
$.fn.timeago = function(action, options) {
var fn = action ? functions[action] : functions.init;
if(!fn){
if (!fn) {
throw new Error("Unknown function name '"+ action +"' for timeago");
}
// each over objects here and call the requested function
this.each(function(){
this.each(function() {
fn.call(this, options);
});
return this;
};
function refresh() {
var $s = $t.settings;
//check if it's still visible
if(!$.contains(document.documentElement,this)){
if ($s.autoDispose && !$.contains(document.documentElement,this)) {
//stop if it has been removed
$(this).timeago("dispose");
return this;
}
var data = prepareData(this);
var $s = $t.settings;
if (!isNaN(data.datetime)) {
if ( $s.cutoff == 0 || Math.abs(distance(data.datetime)) < $s.cutoff) {
if ( $s.cutoff === 0 || Math.abs(distance(data.datetime)) < $s.cutoff) {
$(this).text(inWords(data.datetime));
} else {
if ($(this).attr('title').length > 0) {
$(this).text($(this).attr('title'));
}
}
}
return this;

View File

@ -277,7 +277,7 @@ App::$strings["Name or caption"] = "Name oder Titel";
App::$strings["Examples: \"Bob Jameson\", \"Lisa and her Horses\", \"Soccer\", \"Aviation Group\""] = "Beispiele: „Horst Weidinger“, „Lisa und ihr Meerschweinchen“, „Fußball“, „Segelflieger-Forum“ ";
App::$strings["Choose a short nickname"] = "Wähle einen kurzen Spitznamen";
App::$strings["Your nickname will be used to create an easy to remember channel address e.g. nickname%s"] = "Dein Spitzname wird verwendet, um eine leicht zu merkende Kanal-Adresse (ähnlich einer E-Mail-Adresse) zu erzeugen, die Du mit anderen austauschen kannst, z.B. nickname%s";
App::$strings["Channel role and privacy"] = "Kanaltyp und Privatspäre-Einstellungen";
App::$strings["Channel role and privacy"] = "Kanaltyp und Privatsphäre-Einstellungen";
App::$strings["Select a channel role with your privacy requirements."] = "Wähle einen passenden Kanaltyp mit den zugehörigen Voreinstellungen zur Privatsphäre.";
App::$strings["Read more about roles"] = "Mehr Informationen über Rollen";
App::$strings["Create Channel"] = "Einen neuen Kanal anlegen";

View File

@ -62,6 +62,9 @@ $(document).ready(function() {
numbers : aStr['t17'],
};
//mod_mail only
$(".mail-conv-detail .autotime").timeago();
savedTitle = document.title;
updateInit();

View File

@ -2,7 +2,6 @@ $(document).ready(function() {
$("#recip").name_autocomplete(baseurl + '/acl', 'm', false, function(data) {
$("#recip-complete").val(data.xid);
});
$(".autotime").timeago()
$('#prvmail-text').bbco_autocomplete('bbcode');
$("#prvmail-text").editor_autocomplete(baseurl+"/acl");
});

View File

@ -1152,7 +1152,6 @@ img.mail-conv-sender-photo {
.wall-item-ago,
.dropdown-sub-text {
color: #777;
display: block;
}
.wall-item-content,

View File

@ -6,7 +6,7 @@
<div class="mail-conv-detail">
{{if $mail.is_recalled}}<strong>{{$mail.is_recalled}}</strong>{{/if}}
<div class="wall-item-name"><a class="wall-item-name-link" href="{{$mail.from_url}}">{{$mail.from_name}}</a></div>
<div class="autotime wall-item-ago" title="{{$mail.date}}">{{$mail.date}}</div>
<div class="autotime wall-item-ago" title="{{$mail.date}}"></div>
</div>
</div>
<div class="clearfix mail-conv-content">

View File

@ -2,6 +2,6 @@
<a href="mail/{{$message.mailbox}}/{{$message.id}}" class="nav-link{{if $message.selected}} active{{/if}}">
<span class="{{if ! $message.seen || $message.selected}}font-weight-bold{{/if}}">{{$message.subject}}</span><br>
<span class="conv-participants">{{$message.from_name}} > {{$message.to_name}}</span><br>
<span class="wall-item-ago autotime" title="{{$message.date}}">{{$message.date}}</span>
<span class="wall-item-ago autotime" title="{{$message.date}}"></span>
</a>
</li>

View File

@ -1,6 +1,5 @@
<a class="list-group-item{{if $class}} {{$class}}{{/if}} fakelink" href="{{if $click}}#{{else}}{{$url}}{{/if}}" {{if $click}}onclick="{{$click}}"{{/if}}>
<img class="menu-img-3" src="{{$photo}}" title="{{$title}}" alt="" />{{if $oneway}}<i class="fa fa-fw fa-minus-circle oneway-overlay text-danger"></i>{{/if}}
<span class="contactname">{{$name}}</span>
<span class="dropdown-sub-text">{{$addr}}</span>
<span class="dropdown-sub-text">{{$network}}</span>
<span class="dropdown-sub-text">{{$addr}}<br>{{$network}}</span>
</a>