Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Haakon Meland Eriksen 2016-02-12 06:28:40 +01:00
commit ac4a8fde3a
11 changed files with 159 additions and 92 deletions

View File

@ -48,7 +48,7 @@ require_once('include/AccessList.php');
define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); define ( 'RED_VERSION', trim(file_get_contents('version.inc')));
define ( 'STD_VERSION', '1.2.1' ); define ( 'STD_VERSION', '1.2.2' );
define ( 'ZOT_REVISION', 1 ); define ( 'ZOT_REVISION', 1 );
define ( 'DB_UPDATE_VERSION', 1161 ); define ( 'DB_UPDATE_VERSION', 1161 );
@ -85,6 +85,7 @@ $DIRECTORY_FALLBACK_SERVERS = array(
'https://hubzilla.zottel.net', 'https://hubzilla.zottel.net',
'https://hub.pixelbits.de', 'https://hub.pixelbits.de',
'https://my.federated.social', 'https://my.federated.social',
'https://blablanet.es',
'https://hubzilla.nl' 'https://hubzilla.nl'
); );

View File

@ -388,3 +388,4 @@ function db_getfunc($f) {
logger('Unable to abstract DB function "'. $f . '" for dbtype ' . ACTIVE_DBTYPE, LOGGER_DEBUG); logger('Unable to abstract DB function "'. $f . '" for dbtype ' . ACTIVE_DBTYPE, LOGGER_DEBUG);
return $f; return $f;
} }

View File

@ -552,6 +552,12 @@ function get_public_feed($channel, $params) {
$params['top'] = ((x($params,'top')) ? intval($params['top']) : 0); $params['top'] = ((x($params,'top')) ? intval($params['top']) : 0);
$params['cat'] = ((x($params,'cat')) ? $params['cat'] : ''); $params['cat'] = ((x($params,'cat')) ? $params['cat'] : '');
// put a sane lower limit on feed requests if not specified
if($params['begin'] === NULL_DATE)
$params['begin'] = datetime_convert('UTC','UTC','now - 1 month');
switch($params['type']) { switch($params['type']) {
case 'json': case 'json':
header("Content-type: application/atom+json"); header("Content-type: application/atom+json");
@ -587,8 +593,8 @@ function get_feed_for($channel, $observer_hash, $params) {
} }
$items = items_fetch(array( $items = items_fetch(array(
'wall' => '1', 'wall' => '1',
'datequery' => $params['begin'], 'datequery' => $params['end'],
'datequery2' => $params['end'], 'datequery2' => $params['begin'],
'start' => $params['start'], // FIXME 'start' => $params['start'], // FIXME
'records' => $params['records'], // FIXME 'records' => $params['records'], // FIXME
'direction' => $params['direction'], // FIXME 'direction' => $params['direction'], // FIXME
@ -623,6 +629,7 @@ function get_feed_for($channel, $observer_hash, $params) {
'$community' => '', '$community' => '',
)); ));
call_hooks('atom_feed', $atom); call_hooks('atom_feed', $atom);
if($items) { if($items) {
@ -4901,15 +4908,15 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
} }
if ($arr['datequery']) { if ($arr['datequery']) {
$sql_extra3 .= protect_sprintf(sprintf(" AND item.created <= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$arr['datequery'])))); $sql_extra3 .= protect_sprintf(sprintf(" AND item.created <= '%s' ", dbesc(datetime_convert('UTC','UTC',$arr['datequery']))));
} }
if ($arr['datequery2']) { if ($arr['datequery2']) {
$sql_extra3 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$arr['datequery2'])))); $sql_extra3 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert('UTC','UTC',$arr['datequery2']))));
} }
if(! array_key_exists('nouveau',$arr)) { if(! array_key_exists('nouveau',$arr)) {
$sql_extra2 = " AND item.parent = item.id "; $sql_extra2 = " AND item.parent = item.id ";
$sql_extra3 = ''; // $sql_extra3 = '';
} }
if($arr['search']) { if($arr['search']) {

View File

@ -423,6 +423,7 @@ function notifier_run($argv, $argc){
$details = q("select xchan_hash, xchan_instance_url, xchan_network, xchan_addr, xchan_guid, xchan_guid_sig from xchan where xchan_hash in (" . implode(',',$recipients) . ")"); $details = q("select xchan_hash, xchan_instance_url, xchan_network, xchan_addr, xchan_guid, xchan_guid_sig from xchan where xchan_hash in (" . implode(',',$recipients) . ")");
$recip_list = array(); $recip_list = array();
if($details) { if($details) {
@ -437,12 +438,39 @@ function notifier_run($argv, $argc){
if(! $delivery_options) if(! $delivery_options)
format_and_send_email($channel,$d,$target_item); format_and_send_email($channel,$d,$target_item);
} }
} }
} }
$narr = array(
'channel' => $channel,
'env_recips' => $env_recips,
'packet_recips' => $packet_recips,
'recipients' => $recipients,
'item' => $item,
'target_item' => $target_item,
'top_level_post' => $top_level_post,
'private' => $private,
'followup' => $followup,
'relay_to_owner' => $relay_to_owner,
'uplink' => $uplink,
'cmd' => $cmd,
'mail' => $mail,
'location' => $location,
'request' => $request,
'normal_mode' => $normal_mode,
'packet_type' => $packet_type,
'walltowall' => $walltowall,
'queued' => array()
);
call_hooks('notifier_process', $narr);
if($narr['queued']) {
foreach($narr['queued'] as $pq)
$deliveries[] = $pq;
}
if(($private) && (! $env_recips)) { if(($private) && (! $env_recips)) {
// shouldn't happen // shouldn't happen
logger('notifier: private message with no envelope recipients.' . print_r($argv,true), LOGGER_NORMAL, LOG_NOTICE); logger('notifier: private message with no envelope recipients.' . print_r($argv,true), LOGGER_NORMAL, LOG_NOTICE);
@ -504,7 +532,7 @@ function notifier_run($argv, $argc){
} }
logger('notifier: will notify/deliver to these hubs: ' . print_r($hublist,true), LOGGER_DEBUG, LOG_DEBUG); logger('notifier: will notify/deliver to these hubs: ' . print_r($hublist,true), LOGGER_DEBUG, LOG_DEBUG);
foreach($dhubs as $hub) { foreach($dhubs as $hub) {

View File

@ -291,7 +291,7 @@ function call_hooks($name, &$data = null) {
$func = $hook[1]; $func = $hook[1];
$func($a, $data); $func($a, $data);
} else { } else {
// remove orphan hooks
q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND function = '%s'", q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND function = '%s'",
dbesc($name), dbesc($name),
dbesc($hook[0]), dbesc($hook[0]),

View File

@ -101,7 +101,7 @@ function queue_deliver($outq, $immediate = false) {
} }
} }
$arr = array('outq' => $outq, 'handled' => false, 'immediate' => $immediate); $arr = array('outq' => $outq, 'base' => $base, 'handled' => false, 'immediate' => $immediate);
call_hooks('queue_deliver',$arr); call_hooks('queue_deliver',$arr);
if($arr['handled']) if($arr['handled'])
return; return;

View File

@ -11,7 +11,18 @@
/* global jQuery */ /* global jQuery */
(function($) { (function(factory) {
if (typeof define === 'function' && define.amd) {
// AMD
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// CommonJS
module.exports = factory(require('jquery'));
} else {
// Browser globals
factory(jQuery);
}
}(function($) {
'use strict'; 'use strict';
var readmore = 'readmore', var readmore = 'readmore',
@ -61,20 +72,19 @@
} }
function setBoxHeights(element) { function setBoxHeights(element) {
var el = element, var el = element.clone().css({
expandedHeight = el.outerHeight(true), height: 'auto',
width: element.width(),
maxHeight: 'none',
overflow: 'hidden'
}).insertAfter(element),
expandedHeight = el.outerHeight(),
cssMaxHeight = parseInt(el.css({maxHeight: ''}).css('max-height').replace(/[^-\d\.]/g, ''), 10), cssMaxHeight = parseInt(el.css({maxHeight: ''}).css('max-height').replace(/[^-\d\.]/g, ''), 10),
defaultHeight = element.data('defaultHeight'); defaultHeight = element.data('defaultHeight');
console.log("el height: " + expandedHeight); el.remove();
var collapsedHeight = element.data('collapsedHeight') || defaultHeight;
if (!cssMaxHeight) { var collapsedHeight = cssMaxHeight || element.data('collapsedHeight') || defaultHeight;
collapsedHeight = defaultHeight;
}
else if (cssMaxHeight > collapsedHeight) {
collapsedHeight = cssMaxHeight;
}
// Store our measurements. // Store our measurements.
element.data({ element.data({
@ -137,69 +147,75 @@ console.log("el height: " + expandedHeight);
} }
function Readmore(element, options) { function Readmore(element, options) {
var $this = this;
this.element = element; this.element = element;
this.options = $.extend({}, defaults, options); this.options = $.extend({}, defaults, options);
$(this.element).data({
defaultHeight: this.options.collapsedHeight,
heightMargin: this.options.heightMargin
});
embedCSS(this.options); embedCSS(this.options);
this._defaults = defaults; this._defaults = defaults;
this._name = readmore; this._name = readmore;
// Waiting for the page to load doesn't work when there is dynamic content this.init();
// But usually we already have the content, so no need to wait
//window.addEventListener('load', function() { // IE8 chokes on `window.addEventListener`, so need to test for support.
$this.init(); if (window.addEventListener) {
//}); // Need to resize boxes when the page has fully loaded.
window.addEventListener('load', resizeBoxes);
window.addEventListener('resize', resizeBoxes);
}
else {
window.attachEvent('load', resizeBoxes);
window.attachEvent('resize', resizeBoxes);
}
} }
Readmore.prototype = { Readmore.prototype = {
init: function() { init: function() {
var $this = this; var current = $(this.element);
$(this.element).each(function() { current.data({
var current = $(this); defaultHeight: this.options.collapsedHeight,
heightMargin: this.options.heightMargin
setBoxHeights(current);
var collapsedHeight = current.data('collapsedHeight'),
heightMargin = current.data('heightMargin');
if (current.outerHeight(true) <= collapsedHeight + heightMargin) {
// The block is shorter than the limit, so there's no need to truncate it.
return true;
}
else {
var id = current.attr('id') || uniqueId(),
useLink = $this.options.startOpen ? $this.options.lessLink : $this.options.moreLink;
current.attr({
'data-readmore': '',
'aria-expanded': false,
'id': id
});
current.after($(useLink)
.on('click', function(event) { $this.toggle(this, current[0], event); })
.attr({
'data-readmore-toggle': '',
'aria-controls': id
}));
if (! $this.options.startOpen) {
current.css({
height: collapsedHeight
});
}
}
}); });
setBoxHeights(current);
var collapsedHeight = current.data('collapsedHeight'),
heightMargin = current.data('heightMargin');
if (current.outerHeight(true) <= collapsedHeight + heightMargin) {
// The block is shorter than the limit, so there's no need to truncate it.
return true;
}
else {
var id = current.attr('id') || uniqueId(),
useLink = this.options.startOpen ? this.options.lessLink : this.options.moreLink;
current.attr({
'data-readmore': '',
'aria-expanded': this.options.startOpen,
'id': id
});
current.after($(useLink)
.on('click', (function(_this) {
return function(event) {
_this.toggle(this, current[0], event);
};
})(this))
.attr({
'data-readmore-toggle': '',
'aria-controls': id
}));
if (! this.options.startOpen) {
current.css({
height: collapsedHeight
});
}
}
}, },
toggle: function(trigger, element, event) { toggle: function(trigger, element, event) {
@ -208,22 +224,21 @@ console.log("el height: " + expandedHeight);
} }
if (! trigger) { if (! trigger) {
trigger = $('[aria-controls="' + this.element.id + '"]')[0]; trigger = $('[aria-controls="' + _this.element.id + '"]')[0];
} }
if (! element) { if (! element) {
element = this.element; element = _this.element;
} }
var $this = this, var $element = $(element),
$element = $(element),
newHeight = '', newHeight = '',
newLink = '', newLink = '',
expanded = false, expanded = false,
collapsedHeight = $element.data('collapsedHeight'); collapsedHeight = $element.data('collapsedHeight');
if ($element.height() <= collapsedHeight) { if ($element.height() <= collapsedHeight) {
newHeight = $element.data('expandedHeight') + 'px'; newHeight = 100 + '%';
newLink = 'lessLink'; newLink = 'lessLink';
expanded = true; expanded = true;
} }
@ -235,25 +250,31 @@ console.log("el height: " + expandedHeight);
// Fire beforeToggle callback // Fire beforeToggle callback
// Since we determined the new "expanded" state above we're now out of sync // Since we determined the new "expanded" state above we're now out of sync
// with our true current state, so we need to flip the value of `expanded` // with our true current state, so we need to flip the value of `expanded`
$this.options.beforeToggle(trigger, element, ! expanded); this.options.beforeToggle(trigger, $element, ! expanded);
$element.css({'height': newHeight}); $element.css({'height': newHeight});
// Fire afterToggle callback // Fire afterToggle callback
$element.on('transitionend', function() { $element.on('transitionend', (function(_this) {
$this.options.afterToggle(trigger, element, expanded); return function() {
_this.options.afterToggle(trigger, $element, expanded);
$(this).attr({ $(this).attr({
'aria-expanded': expanded 'aria-expanded': expanded
}).off('transitionend'); }).off('transitionend');
}); }
})(this));
$(trigger).replaceWith($($this.options[newLink]) $(trigger).replaceWith($(this.options[newLink])
.on('click', function(event) { $this.toggle(this, element, event); }) .on('click', (function(_this) {
.attr({ return function(event) {
'data-readmore-toggle': '', _this.toggle(this, element, event);
'aria-controls': $element.attr('id') };
})); })(this))
.attr({
'data-readmore-toggle': '',
'aria-controls': $element.attr('id')
}));
}, },
destroy: function() { destroy: function() {
@ -305,6 +326,5 @@ console.log("el height: " + expandedHeight);
} }
}; };
})(jQuery); }));

View File

@ -31,7 +31,9 @@ function feed_init(&$a) {
killme(); killme();
logger('mod_feed: public feed request from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $channel['channel_address']); logger('mod_feed: public feed request from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $channel['channel_address']);
echo get_public_feed($channel,$params); echo get_public_feed($channel,$params);
killme(); killme();
} }

View File

@ -603,6 +603,14 @@ function photos_content(&$a) {
$aclselect = (($_is_owner) ? populate_acl($channel_acl,false) : ''); $aclselect = (($_is_owner) ? populate_acl($channel_acl,false) : '');
// this is wrong but is to work around an issue with js_upload wherein it chokes if these variables
// don't exist. They really should be set to a parseable representation of the channel's default permissions
// which can be processed by getSelected()
if(! $aclselect) {
$aclselect = '<input id="group_allow" type="hidden" name="allow_gid[]" value="" /><input id="contact_allow" type="hidden" name="allow_cid[]" value="" /><input id="group_deny" type="hidden" name="deny_gid[]" value="" /><input id="contact_deny" type="hidden" name="deny_cid[]" value="" />';
}
$selname = (($datum) ? hex2bin($datum) : ''); $selname = (($datum) ? hex2bin($datum) : '');
$albums = ((array_key_exists('albums', $a->data)) ? $a->data['albums'] : photos_albums_list($a->data['channel'],$a->data['observer'])); $albums = ((array_key_exists('albums', $a->data)) ? $a->data['albums'] : photos_albums_list($a->data['channel'],$a->data['observer']));

View File

@ -365,7 +365,7 @@ function setup_content(&$a) {
'$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.')), '$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.')),
'$siteurl' => array('siteurl', t('Website URL'), z_root(), t('Please use SSL (https) URL if available.')), '$siteurl' => array('siteurl', t('Website URL'), z_root(), t('Please use SSL (https) URL if available.')),
'$advanced' => array('advanced', t('Enable $Projectname <strong>advanced</strong> features?'), 0, t('Some advanced features, while useful - may be best suited for technically proficient audiences')), '$advanced' => array('advanced', t('Enable $Projectname <strong>advanced</strong> features?'), 1, t('Some advanced features, while useful - may be best suited for technically proficient audiences')),
'$timezone' => array('timezone', t('Please select a default timezone for your website'), $timezone, '', get_timezones()), '$timezone' => array('timezone', t('Please select a default timezone for your website'), $timezone, '', get_timezones()),

View File

@ -1 +1 @@
2016-02-07.1302H 2016-02-11.1306H