diff options
author | zotlabs <mike@macgirvin.com> | 2018-07-15 18:43:41 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-07-15 18:43:41 -0700 |
commit | cc91db55b7ca24cb0b97273bab948af91dac0511 (patch) | |
tree | acdc5df67e366a4bf472bccf42fa1e68d30a3812 | |
parent | d71e70bedf4fa7244f3fcce789e29504c452d5cd (diff) | |
parent | bb7022350943c6f049641d50d28cb99caf019b83 (diff) | |
download | volse-hubzilla-cc91db55b7ca24cb0b97273bab948af91dac0511.tar.gz volse-hubzilla-cc91db55b7ca24cb0b97273bab948af91dac0511.tar.bz2 volse-hubzilla-cc91db55b7ca24cb0b97273bab948af91dac0511.zip |
Merge branch 'dev' of https://framagit.org/hubzilla/core into xdev_merge
-rw-r--r-- | Zotlabs/Module/Notifications.php | 2 | ||||
-rwxr-xr-x | boot.php | 33 | ||||
-rw-r--r-- | library/jquery.timeago.js | 41 | ||||
-rw-r--r-- | view/de-de/hstrings.php | 2 | ||||
-rw-r--r-- | view/js/main.js | 3 | ||||
-rw-r--r-- | view/js/mod_mail.js | 3 | ||||
-rw-r--r-- | view/theme/redbasic/css/style.css | 1 | ||||
-rwxr-xr-x | view/tpl/mail_conv.tpl | 2 | ||||
-rwxr-xr-x | view/tpl/mail_list.tpl | 2 | ||||
-rw-r--r-- | view/tpl/micropro_card.tpl | 3 |
10 files changed, 64 insertions, 28 deletions
diff --git a/Zotlabs/Module/Notifications.php b/Zotlabs/Module/Notifications.php index dfa007548..1762ad5f6 100644 --- a/Zotlabs/Module/Notifications.php +++ b/Zotlabs/Module/Notifications.php @@ -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'], @@ -1720,7 +1720,7 @@ function can_view_public_stream() { if(observer_prohibited(true)) { return false; } - + if(! (intval(get_config('system','open_pubstream',1)))) { if(! get_observer_hash()) { return false; @@ -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"); diff --git a/library/jquery.timeago.js b/library/jquery.timeago.js index ef9327aac..f7b640149 100644 --- a/library/jquery.timeago.js +++ b/library/jquery.timeago.js @@ -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; diff --git a/view/de-de/hstrings.php b/view/de-de/hstrings.php index 749afef5d..884267319 100644 --- a/view/de-de/hstrings.php +++ b/view/de-de/hstrings.php @@ -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"; diff --git a/view/js/main.js b/view/js/main.js index 45c412296..17f94dd16 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -62,6 +62,9 @@ $(document).ready(function() { numbers : aStr['t17'], }; + //mod_mail only + $(".mail-conv-detail .autotime").timeago(); + savedTitle = document.title; updateInit(); diff --git a/view/js/mod_mail.js b/view/js/mod_mail.js index 15a45519b..917e5414c 100644 --- a/view/js/mod_mail.js +++ b/view/js/mod_mail.js @@ -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"); + $("#prvmail-text").editor_autocomplete(baseurl+"/acl"); }); diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 6ffccb4e9..970e4bc89 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -1152,7 +1152,6 @@ img.mail-conv-sender-photo { .wall-item-ago, .dropdown-sub-text { color: #777; - display: block; } .wall-item-content, diff --git a/view/tpl/mail_conv.tpl b/view/tpl/mail_conv.tpl index 759517b7f..cd810e999 100755 --- a/view/tpl/mail_conv.tpl +++ b/view/tpl/mail_conv.tpl @@ -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"> diff --git a/view/tpl/mail_list.tpl b/view/tpl/mail_list.tpl index 65d8dcdb4..a1784e1e6 100755 --- a/view/tpl/mail_list.tpl +++ b/view/tpl/mail_list.tpl @@ -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> diff --git a/view/tpl/micropro_card.tpl b/view/tpl/micropro_card.tpl index c1b621349..a3c693dbd 100644 --- a/view/tpl/micropro_card.tpl +++ b/view/tpl/micropro_card.tpl @@ -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> |