diff --git a/CHANGELOG b/CHANGELOG
index b11016eba..444c7b2e4 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,21 @@
+Hubzilla 3.8.6 (2018-12-03)
+ - Prevent incompatible export files (osada/zap) from being imported
+ - Catch exception if readImageBlob() receives bogus data
+ - Streamline PDF previews
+ - Allow notification filtering by name or address
+ - Fix too restrictive attached photo permissions
+ - Update ES translation
+ - Use flex for the default template
+ - Do not store serialized pconfig value received via to Module/Pconfig.php
+ - Update jquery-file-upload lib and move to composer
+ - Update imagesloaded lib and move to composer
+ - Fix activitypub tag notifications
+ - Fix call to undefined function in PConfig
+ - Fix typo which prevented propagation of comments to zot6 (dev)
+ - Activitypub: add support for pterotype (wordpress plugin)
+ - Openstreetmap: check validity of lat+lon before rendering a map
+
+
Hubzilla 3.8.5 (2018-11-19)
- Fix pconfig for new installs
- Fix delayed publication of posts in combination with channel clones
diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php
index 25e49b817..8b6b42c8a 100644
--- a/Zotlabs/Daemon/Cron.php
+++ b/Zotlabs/Daemon/Cron.php
@@ -94,6 +94,29 @@ class Cron {
@time_sleep_until(microtime(true) + (float) $interval);
}
}
+
+ // Clean expired photos from cache
+
+ $age = get_config('system','active_expire_days', '30');
+ $r = q("SELECT DISTINCT xchan, content FROM photo WHERE photo_usage = %d AND expires < %s - INTERVAL %s",
+ intval(PHOTO_CACHE),
+ db_utcnow(),
+ db_quoteinterval($age . ' DAY')
+ );
+ if($r) {
+ foreach($r as $rr) {
+ $file = dbunescbin($rr['content']);
+ if(is_file($file)) {
+ @unlink($file);
+ logger('info: deleted cached photo file ' . $file, LOGGER_DEBUG);
+ }
+ }
+ }
+ q("DELETE FROM photo WHERE photo_usage = %d AND expires < %s - INTERVAL %s",
+ intval(PHOTO_CACHE),
+ db_utcnow(),
+ db_quoteinterval($age . ' DAY')
+ );
// publish any applicable items that were set to be published in the future
// (time travel posts). Restrict to items that have come of age in the last
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 6ddbbb9db..8cef41c42 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -11,9 +11,15 @@ class Activity {
static function encode_object($x) {
+
if(($x) && (! is_array($x)) && (substr(trim($x),0,1)) === '{' ) {
$x = json_decode($x,true);
}
+
+ if(is_array($x) && array_key_exists('asld',$x)) {
+ $x = $x['asld'];
+ }
+
if($x['type'] === ACTIVITY_OBJ_PERSON) {
return self::fetch_person($x);
}
@@ -1149,7 +1155,7 @@ class Activity {
}
if($act->obj['type'] === 'Note' && $s['attach']) {
- $s['body'] .= self::bb_attach($s['attach']);
+ $s['body'] .= self::bb_attach($s['attach'],$s['body']);
}
// we will need a hook here to extract magnet links e.g. peertube
@@ -1233,19 +1239,20 @@ class Activity {
static function decode_note($act) {
+ $response_activity = false;
+
$s = [];
-
-
- $content = self::get_content($act->obj);
-
+ if(is_array($act->obj)) {
+ $content = self::get_content($act->obj);
+ }
+
$s['owner_xchan'] = $act->actor['id'];
$s['author_xchan'] = $act->actor['id'];
- $s['mid'] = $act->id;
+ $s['mid'] = $act->obj['id'];
$s['parent_mid'] = $act->parent_id;
-
if($act->data['published']) {
$s['created'] = datetime_convert('UTC','UTC',$act->data['published']);
}
@@ -1259,42 +1266,59 @@ class Activity {
$s['edited'] = datetime_convert('UTC','UTC',$act->obj['updated']);
}
+
+ if(in_array($act->type, [ 'Like', 'Dislike', 'Flag', 'Block', 'Announce', 'Accept', 'Reject', 'TentativeAccept' ])) {
+
+ $response_activity = true;
+
+ $s['mid'] = $act->id;
+ $s['parent_mid'] = $act->obj['id'];
+
+ // over-ride the object timestamp with the activity
+
+ if($act->data['published']) {
+ $s['created'] = datetime_convert('UTC','UTC',$act->data['published']);
+ }
+
+ if($act->data['updated']) {
+ $s['edited'] = datetime_convert('UTC','UTC',$act->data['updated']);
+ }
+
+ $obj_actor = ((isset($act->obj['actor'])) ? $act->obj['actor'] : $act->get_actor('attributedTo', $act->obj));
+ // ensure we store the original actor
+ self::actor_store($obj_actor['id'],$obj_actor);
+
+ $mention = self::get_actor_bbmention($obj_actor['id']);
+
+ if($act->type === 'Like') {
+ $content['content'] = sprintf( t('Likes %1$s\'s %2$s'),$mention,$act->obj['type']) . "\n\n" . $content['content'];
+ }
+ if($act->type === 'Dislike') {
+ $content['content'] = sprintf( t('Doesn\'t like %1$s\'s %2$s'),$mention,$act->obj['type']) . "\n\n" . $content['content'];
+ }
+ if($act->type === 'Accept' && $act->obj['type'] === 'Event' ) {
+ $content['content'] = sprintf( t('Will attend %1$s\'s %2$s'),$mention,$act->obj['type']) . "\n\n" . $content['content'];
+ }
+ if($act->type === 'Reject' && $act->obj['type'] === 'Event' ) {
+ $content['content'] = sprintf( t('Will not attend %1$s\'s %2$s'),$mention,$act->obj['type']) . "\n\n" . $content['content'];
+ }
+ if($act->type === 'TentativeAccept' && $act->obj['type'] === 'Event' ) {
+ $content['content'] = sprintf( t('May attend %1$s\'s %2$s'),$mention,$act->obj['type']) . "\n\n" . $content['content'];
+ }
+ if($act->type === 'Announce') {
+ $content['content'] = sprintf( t('🔁 Repeated %1$s\'s %2$s'), $mention, $act->obj['type']);
+ }
+ }
+
if(! $s['created'])
$s['created'] = datetime_convert();
if(! $s['edited'])
$s['edited'] = $s['created'];
- if(in_array($act->type,['Announce'])) {
- $root_content = self::get_content($act->raw);
-
- $s['title'] = self::bb_content($root_content,'name');
- $s['summary'] = self::bb_content($root_content,'summary');
- $s['body'] = (self::bb_content($root_content,'bbcode') ? : self::bb_content($root_content,'content'));
-
- if(strpos($s['body'],'[share') === false) {
-
- // @fixme - error check and set defaults
-
- $name = urlencode($act->obj['actor']['name']);
- $profile = $act->obj['actor']['id'];
- $photo = $act->obj['icon']['url'];
-
- $s['body'] .= "\r\n[share author='" . $name .
- "' profile='" . $profile .
- "' avatar='" . $photo .
- "' link='" . $act->obj['id'] .
- "' auth='" . ((is_matrix_url($act->obj['id'])) ? 'true' : 'false' ) .
- "' posted='" . $act->obj['published'] .
- "' message_id='" . $act->obj['id'] .
- "']";
- }
- }
- else {
- $s['title'] = self::bb_content($content,'name');
- $s['summary'] = self::bb_content($content,'summary');
- $s['body'] = (self::bb_content($content,'bbcode') ? : self::bb_content($content,'content'));
- }
+ $s['title'] = self::bb_content($content,'name');
+ $s['summary'] = self::bb_content($content,'summary');
+ $s['body'] = ((self::bb_content($content,'bbcode') && (! $response_activity)) ? self::bb_content($content,'bbcode') : self::bb_content($content,'content'));
$s['verb'] = self::activity_mapper($act->type);
@@ -1306,56 +1330,227 @@ class Activity {
$s['obj'] = $act->obj;
$instrument = $act->get_property_obj('instrument');
- if(! $instrument)
+ if((! $instrument) && (! $response_activity)) {
$instrument = $act->get_property_obj('instrument',$act->obj);
+ }
if($instrument && array_key_exists('type',$instrument)
&& $instrument['type'] === 'Service' && array_key_exists('name',$instrument)) {
$s['app'] = escape_tags($instrument['name']);
}
- $a = self::decode_taxonomy($act->obj);
- if($a) {
- $s['term'] = $a;
+
+ if(! $response_activity) {
+ $a = self::decode_taxonomy($act->obj);
+ if($a) {
+ $s['term'] = $a;
+ foreach($a as $b) {
+ if($b['ttype'] === TERM_EMOJI) {
+ $s['title'] = str_replace($b['term'],'[img=16x16]' . $b['url'] . '[/img]',$s['title']);
+ $s['summary'] = str_replace($b['term'],'[img=16x16]' . $b['url'] . '[/img]',$s['summary']);
+ $s['body'] = str_replace($b['term'],'[img=16x16]' . $b['url'] . '[/img]',$s['body']);
+ }
+ }
+ }
+
+ $a = self::decode_attachment($act->obj);
+ if($a) {
+ $s['attach'] = $a;
+ }
}
- $a = self::decode_attachment($act->obj);
- if($a) {
- $s['attach'] = $a;
+ if($act->obj['type'] === 'Note' && $s['attach']) {
+ $s['body'] .= self::bb_attach($s['attach'],$s['body']);
}
+
// we will need a hook here to extract magnet links e.g. peertube
// right now just link to the largest mp4 we find that will fit in our
// standard content region
- if($act->obj['type'] === 'Video') {
+ if(! $response_activity) {
+ if($act->obj['type'] === 'Video') {
- $vtypes = [
- 'video/mp4',
- 'video/ogg',
- 'video/webm'
- ];
+ $vtypes = [
+ 'video/mp4',
+ 'video/ogg',
+ 'video/webm'
+ ];
- $mps = [];
- if(array_key_exists('url',$act->obj) && is_array($act->obj['url'])) {
- foreach($act->obj['url'] as $vurl) {
- if(in_array($vurl['mimeType'], $vtypes)) {
- if(! array_key_exists('width',$vurl)) {
- $vurl['width'] = 0;
+ $mps = [];
+ $ptr = null;
+
+ if(array_key_exists('url',$act->obj)) {
+ if(is_array($act->obj['url'])) {
+ if(array_key_exists(0,$act->obj['url'])) {
+ $ptr = $act->obj['url'];
}
- $mps[] = $vurl;
+ else {
+ $ptr = [ $act->obj['url'] ];
+ }
+ foreach($ptr as $vurl) {
+ // peertube uses the non-standard element name 'mimeType' here
+ if(array_key_exists('mimeType',$vurl)) {
+ if(in_array($vurl['mimeType'], $vtypes)) {
+ if(! array_key_exists('width',$vurl)) {
+ $vurl['width'] = 0;
+ }
+ $mps[] = $vurl;
+ }
+ }
+ elseif(array_key_exists('mediaType',$vurl)) {
+ if(in_array($vurl['mediaType'], $vtypes)) {
+ if(! array_key_exists('width',$vurl)) {
+ $vurl['width'] = 0;
+ }
+ $mps[] = $vurl;
+ }
+ }
+ }
+ }
+ if($mps) {
+ usort($mps,[ __CLASS__, 'vid_sort' ]);
+ foreach($mps as $m) {
+ if(intval($m['width']) < 500 && self::media_not_in_body($m['href'],$s['body'])) {
+ $s['body'] .= "\n\n" . '[video]' . $m['href'] . '[/video]';
+ break;
+ }
+ }
+ }
+ elseif(is_string($act->obj['url']) && self::media_not_in_body($act->obj['url'],$s['body'])) {
+ $s['body'] .= "\n\n" . '[video]' . $act->obj['url'] . '[/video]';
}
}
}
- if($mps) {
- usort($mps,'as_vid_sort');
- foreach($mps as $m) {
- if(intval($m['width']) < 500) {
- $s['body'] .= "\n\n" . '[video]' . $m['href'] . '[/video]';
- break;
+
+ if($act->obj['type'] === 'Audio') {
+
+ $atypes = [
+ 'audio/mpeg',
+ 'audio/ogg',
+ 'audio/wav'
+ ];
+
+ $ptr = null;
+
+ if(array_key_exists('url',$act->obj)) {
+ if(is_array($act->obj['url'])) {
+ if(array_key_exists(0,$act->obj['url'])) {
+ $ptr = $act->obj['url'];
+ }
+ else {
+ $ptr = [ $act->obj['url'] ];
+ }
+ foreach($ptr as $vurl) {
+ if(in_array($vurl['mediaType'], $atypes) && self::media_not_in_body($vurl['href'],$s['body'])) {
+ $s['body'] .= "\n\n" . '[audio]' . $vurl['href'] . '[/audio]';
+ break;
+ }
+ }
+ }
+ elseif(is_string($act->obj['url']) && self::media_not_in_body($act->obj['url'],$s['body'])) {
+ $s['body'] .= "\n\n" . '[audio]' . $act->obj['url'] . '[/audio]';
+ }
+ }
+
+ }
+
+ if($act->obj['type'] === 'Image') {
+
+ $ptr = null;
+
+ if(array_key_exists('url',$act->obj)) {
+ if(is_array($act->obj['url'])) {
+ if(array_key_exists(0,$act->obj['url'])) {
+ $ptr = $act->obj['url'];
+ }
+ else {
+ $ptr = [ $act->obj['url'] ];
+ }
+ foreach($ptr as $vurl) {
+ if(strpos($s['body'],$vurl['href']) === false) {
+ $s['body'] .= "\n\n" . '[zmg]' . $vurl['href'] . '[/zmg]';
+ break;
+ }
+ }
+ }
+ elseif(is_string($act->obj['url'])) {
+ if(strpos($s['body'],$act->obj['url']) === false) {
+ $s['body'] .= "\n\n" . '[zmg]' . $act->obj['url'] . '[/zmg]';
+ }
}
}
}
+
+
+ if($act->obj['type'] === 'Page' && ! $s['body']) {
+
+ $ptr = null;
+ $purl = EMPTY_STR;
+
+ if(array_key_exists('url',$act->obj)) {
+ if(is_array($act->obj['url'])) {
+ if(array_key_exists(0,$act->obj['url'])) {
+ $ptr = $act->obj['url'];
+ }
+ else {
+ $ptr = [ $act->obj['url'] ];
+ }
+ foreach($ptr as $vurl) {
+ if(array_key_exists('mediaType',$vurl) && $vurl['mediaType'] === 'text/html') {
+ $purl = $vurl['href'];
+ break;
+ }
+ elseif(array_key_exists('mimeType',$vurl) && $vurl['mimeType'] === 'text/html') {
+ $purl = $vurl['href'];
+ break;
+ }
+ }
+ }
+ elseif(is_string($act->obj['url'])) {
+ $purl = $act->obj['url'];
+ }
+ if($purl) {
+ $li = z_fetch_url(z_root() . '/linkinfo?binurl=' . bin2hex($purl));
+ if($li['success'] && $li['body']) {
+ $s['body'] .= "\n" . $li['body'];
+ }
+ else {
+ $s['body'] .= "\n\n" . $purl;
+ }
+ }
+ }
+ }
+ }
+
+
+
+ if(in_array($act->obj['type'],[ 'Note','Article','Page' ])) {
+ $ptr = null;
+
+ if(array_key_exists('url',$act->obj)) {
+ if(is_array($act->obj['url'])) {
+ if(array_key_exists(0,$act->obj['url'])) {
+ $ptr = $act->obj['url'];
+ }
+ else {
+ $ptr = [ $act->obj['url'] ];
+ }
+ foreach($ptr as $vurl) {
+ if(array_key_exists('mediaType',$vurl) && $vurl['mediaType'] === 'text/html') {
+ $s['plink'] = $vurl['href'];
+ break;
+ }
+ }
+ }
+ elseif(is_string($act->obj['url'])) {
+ $s['plink'] = $act->obj['url'];
+ }
+ }
+ }
+
+ if(! $s['plink']) {
+ $s['plink'] = $s['mid'];
}
if($act->recips && (! in_array(ACTIVITY_PUBLIC_INBOX,$act->recips)))
@@ -1371,8 +1566,6 @@ class Activity {
}
-
-
static function announce_note($channel,$observer_hash,$act) {
$s = [];
@@ -1464,7 +1657,7 @@ class Activity {
$body .= self::bb_content($content,'content');
if($act->obj['type'] === 'Note' && $s['attach']) {
- $body .= self::bb_attach($s['attach']);
+ $body .= self::bb_attach($s['attach'],$body);
}
$body .= "[/share]";
@@ -1642,19 +1835,26 @@ class Activity {
}
- static function bb_attach($attach) {
+
+ static function bb_attach($attach,$body) {
$ret = false;
foreach($attach as $a) {
if(strpos($a['type'],'image') !== false) {
- $ret .= "\n\n" . '[img]' . $a['href'] . '[/img]';
+ if(self::media_not_in_body($a['href'],$body)) {
+ $ret .= "\n\n" . '[img]' . $a['href'] . '[/img]';
+ }
}
if(array_key_exists('type',$a) && strpos($a['type'], 'video') === 0) {
- $ret .= "\n\n" . '[video]' . $a['href'] . '[/video]';
+ if(self::media_not_in_body($a['href'],$body)) {
+ $ret .= "\n\n" . '[video]' . $a['href'] . '[/video]';
+ }
}
if(array_key_exists('type',$a) && strpos($a['type'], 'audio') === 0) {
- $ret .= "\n\n" . '[audio]' . $a['href'] . '[/audio]';
+ if(self::media_not_in_body($a['href'],$body)) {
+ $ret .= "\n\n" . '[audio]' . $a['href'] . '[/audio]';
+ }
}
}
@@ -1662,16 +1862,31 @@ class Activity {
}
+ // check for the existence of existing media link in body
+
+ static function media_not_in_body($s,$body) {
+
+ if((strpos($body,']' . $s . '[/img]') === false) &&
+ (strpos($body,']' . $s . '[/zmg]') === false) &&
+ (strpos($body,']' . $s . '[/video]') === false) &&
+ (strpos($body,']' . $s . '[/audio]') === false)) {
+ return true;
+ }
+ return false;
+ }
+
static function bb_content($content,$field) {
require_once('include/html2bbcode.php');
-
+ require_once('include/event.php');
$ret = false;
if(is_array($content[$field])) {
foreach($content[$field] as $k => $v) {
- $ret .= '[language=' . $k . ']' . html2bbcode($v) . '[/language]';
+ $ret .= html2bbcode($v);
+ // save this for auto-translate or dynamic filtering
+ // $ret .= '[language=' . $k . ']' . html2bbcode($v) . '[/language]';
}
}
else {
@@ -1682,6 +1897,9 @@ class Activity {
$ret = html2bbcode($content[$field]);
}
}
+ if($field === 'content' && $content['event'] && (! strpos($ret,'[event'))) {
+ $ret .= format_event_bbcode($content['event']);
+ }
return $ret;
}
@@ -1690,21 +1908,52 @@ class Activity {
static function get_content($act) {
$content = [];
- if (! $act) {
+ $event = null;
+
+ if ((! $act) || (! is_array($act))) {
return $content;
}
+ if($act['type'] === 'Event') {
+ $adjust = false;
+ $event = [];
+ $event['event_hash'] = $act['id'];
+ if(array_key_exists('startTime',$act) && strpos($act['startTime'],-1,1) === 'Z') {
+ $adjust = true;
+ $event['adjust'] = 1;
+ $event['dtstart'] = datetime_convert('UTC','UTC',$event['startTime'] . (($adjust) ? '' : 'Z'));
+ }
+ if(array_key_exists('endTime',$act)) {
+ $event['dtend'] = datetime_convert('UTC','UTC',$event['endTime'] . (($adjust) ? '' : 'Z'));
+ }
+ else {
+ $event['nofinish'] = true;
+ }
+ }
+
foreach ([ 'name', 'summary', 'content' ] as $a) {
if (($x = self::get_textfield($act,$a)) !== false) {
$content[$a] = $x;
}
}
+
+ if($event) {
+ $event['summary'] = html2bbcode($content['summary']);
+ $event['description'] = html2bbcode($content['content']);
+ if($event['summary'] && $event['dtstart']) {
+ $content['event'] = $event;
+ }
+ }
+
if (array_key_exists('source',$act) && array_key_exists('mediaType',$act['source'])) {
if ($act['source']['mediaType'] === 'text/bbcode') {
$content['bbcode'] = purify_html($act['source']['content']);
}
}
+
+
+
return $content;
}
@@ -1722,4 +1971,6 @@ class Activity {
}
return $content;
}
+
+
}
\ No newline at end of file
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index 25c96d9cc..5e5798cac 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -828,6 +828,7 @@ class Enotify {
$x = array(
'notify_link' => $item['llink'],
'name' => $item['author']['xchan_name'],
+ 'addr' => (($item['author']['xchan_addr']) ? $item['author']['xchan_addr'] : $item['author']['xchan_url']),
'url' => $item['author']['xchan_url'],
'photo' => $item['author']['xchan_photo_s'],
'when' => relative_date(($edit)? $item['edited'] : $item['created']),
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index 70f013eb7..0fbde9765 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -1418,7 +1418,7 @@ logger('4');
$DR = new DReport(z_root(),$sender,$d,$arr['mid']);
- $channel = channelx_by_hash($d);
+ $channel = channelx_by_portid($d);
if (! $channel) {
$DR->update('recipient not found');
@@ -1505,8 +1505,10 @@ logger('4');
}
}
- if($arr['mid'] != $arr['parent_mid']) {
+logger('item: ' . print_r($arr,true), LOGGER_DATA);
+ if($arr['mid'] !== $arr['parent_mid']) {
+logger('checking source: "' . $arr['mid'] . '" != "' . $arr['parent_mid'] . '"');
// check source route.
// We are only going to accept comments from this sender if the comment has the same route as the top-level-post,
// this is so that permissions mismatches between senders apply to the entire conversation
@@ -1591,7 +1593,7 @@ logger('4');
$arr['route'] = $last_prior_route;
}
}
-
+logger('hey');
$ab = q("select * from abook where abook_channel = %d and abook_xchan = '%s'",
intval($channel['channel_id']),
dbesc($arr['owner_xchan'])
diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php
index 6016328a5..0daf28aa9 100644
--- a/Zotlabs/Module/Import.php
+++ b/Zotlabs/Module/Import.php
@@ -127,6 +127,15 @@ class Import extends \Zotlabs\Web\Controller {
//
// }
+
+ // prevent incompatible osada or zap data from horking your database
+
+ if(array_path_exists('compatibility/codebase',$data)) {
+ notice('Data export format is not compatible with this software');
+ return;
+ }
+
+
if($moving)
$seize = 1;
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index 1d64ef60c..24949c626 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -760,7 +760,7 @@ class Item extends Controller {
// fix permalinks for cards
if($webpage == ITEM_TYPE_CARD) {
- $plink = z_root() . '/cards/' . $channel['channel_address'] . '/' . (($pagetitle) ? $pagetitle : substr($mid,0,16));
+ $plink = z_root() . '/cards/' . $channel['channel_address'] . '/' . (($pagetitle) ? $pagetitle : $uuid);
}
if(($parent_item) && ($parent_item['item_type'] == ITEM_TYPE_CARD)) {
$r = q("select v from iconfig where iconfig.cat = 'system' and iconfig.k = 'CARD' and iconfig.iid = %d limit 1",
@@ -772,7 +772,7 @@ class Item extends Controller {
}
if($webpage == ITEM_TYPE_ARTICLE) {
- $plink = z_root() . '/articles/' . $channel['channel_address'] . '/' . (($pagetitle) ? $pagetitle : substr($mid,0,16));
+ $plink = z_root() . '/articles/' . $channel['channel_address'] . '/' . (($pagetitle) ? $pagetitle : $uuid);
}
if(($parent_item) && ($parent_item['item_type'] == ITEM_TYPE_ARTICLE)) {
$r = q("select v from iconfig where iconfig.cat = 'system' and iconfig.k = 'ARTICLE' and iconfig.iid = %d limit 1",
@@ -784,7 +784,7 @@ class Item extends Controller {
}
if ((! $plink) && ($item_thread_top)) {
- $plink = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $mid;
+ $plink = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . gen_link_id($mid);
$plink = substr($plink,0,190);
}
diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php
index c39726b88..d19154eb4 100644
--- a/Zotlabs/Module/Like.php
+++ b/Zotlabs/Module/Like.php
@@ -1,6 +1,8 @@
$objtype,
'id' => $item['mid'],
+ 'asld' => Activity::fetch_item( [ 'id' => $item['mid'] ] ),
'parent' => (($item['thr_parent']) ? $item['thr_parent'] : $item['parent_mid']),
'link' => $links,
'title' => $item['title'],
diff --git a/Zotlabs/Module/Pconfig.php b/Zotlabs/Module/Pconfig.php
index 44fe5d9a9..f31d5fdf6 100644
--- a/Zotlabs/Module/Pconfig.php
+++ b/Zotlabs/Module/Pconfig.php
@@ -22,6 +22,11 @@ class Pconfig extends \Zotlabs\Web\Controller {
$k = trim(escape_tags($_POST['k']));
$v = trim($_POST['v']);
$aj = intval($_POST['aj']);
+
+ // Do not store "serialized" data received in the $_POST
+ if (preg_match('|^a:[0-9]+:{.*}$|s',$v) || preg_match('O:8:"stdClass":[0-9]+:{.*}$|s',$v)) {
+ return;
+ }
if(in_array(argv(2),$this->disallowed_pconfig())) {
notice( t('This setting requires special processing and editing has been blocked.') . EOL);
diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php
index 30e8340e2..ddff3a68e 100644
--- a/Zotlabs/Module/Photo.php
+++ b/Zotlabs/Module/Photo.php
@@ -1,19 +1,20 @@
get_config('system','photo_cache_enable', 0),
+ 'age' => 86400,
+ 'exp' => true,
+ 'leak' => false
+ );
+ call_hooks('cache_mode_hook', $cache_mode);
+
$observer_xchan = get_observer_hash();
$ismodified = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
@@ -106,13 +115,14 @@ class Photo extends \Zotlabs\Web\Controller {
License link: http://creativecommons.org/licenses/by/3.0/
*/
+ // @FIXME It seems this part doesn't work because we are not setting such cookie
$cookie_value = false;
if (isset($_COOKIE['devicePixelRatio'])) {
$cookie_value = intval($_COOKIE['devicePixelRatio']);
}
else {
// Force revalidation of cache on next request
- $cache_directive = 'no-cache';
+ // $prvcachecontrol = 'no-cache';
$status = 'no cookie';
}
@@ -129,27 +139,40 @@ class Photo extends \Zotlabs\Web\Controller {
$resolution = 1;
}
- $r = q("SELECT uid, photo_usage FROM photo WHERE resource_id = '%s' AND imgscale = %d LIMIT 1",
+ $r = q("SELECT uid, photo_usage, display_path FROM photo WHERE resource_id = '%s' AND imgscale = %d LIMIT 1",
dbesc($photo),
intval($resolution)
);
if($r) {
-
$allowed = (-1);
- if(intval($r[0]['photo_usage'])) {
+ $u = intval($r[0]['photo_usage']);
+ if($u) {
$allowed = 1;
- if(intval($r[0]['photo_usage']) === PHOTO_COVER)
+ if($u === PHOTO_COVER)
if($resolution < PHOTO_RES_COVER_1200)
$allowed = (-1);
- if(intval($r[0]['photo_usage']) === PHOTO_PROFILE)
+ if($u === PHOTO_PROFILE)
if(! in_array($resolution,[4,5,6]))
$allowed = (-1);
+ if($u === PHOTO_CACHE) {
+ // Validate cache
+ $cache = array(
+ 'resid' => $photo,
+ 'uid' => $r[0]['uid'],
+ 'status' => false
+ );
+ if($cache_mode['on'])
+ call_hooks('cache_url_hook', $cache);
+ if(! $cache['status']) {
+ header("Location: " . htmlspecialchars_decode($r[0]['display_path']));
+ killme();
+ }
+ }
}
- if($allowed === (-1)) {
+ if($allowed === (-1))
$allowed = attach_can_view($r[0]['uid'],$observer_xchan,$photo);
- }
$channel = channelx_by_n($r[0]['uid']);
@@ -158,18 +181,21 @@ class Photo extends \Zotlabs\Web\Controller {
dbesc($photo),
intval($resolution)
);
-
+
$exists = (($e) ? true : false);
-
+
if($exists && $allowed) {
+ $expires = strtotime($e[0]['expires'] . 'Z');
$data = dbunescbin($e[0]['content']);
$filesize = $e[0]['filesize'];
$mimetype = $e[0]['mimetype'];
$modified = strtotime($e[0]['edited'] . 'Z');
- if(intval($e[0]['os_storage']))
+
+ if(intval($e[0]['os_storage'])) {
$streaming = $data;
+ }
if($e[0]['allow_cid'] != '' || $e[0]['allow_gid'] != '' || $e[0]['deny_gid'] != '' || $e[0]['deny_gid'] != '')
- $prvcachecontrol = true;
+ $prvcachecontrol = 'no-store, no-cache, must-revalidate';
}
else {
if(! $allowed) {
@@ -180,9 +206,9 @@ class Photo extends \Zotlabs\Web\Controller {
}
}
- } else {
+ }
+ else
http_status_exit(404,'not found');
- }
}
header_remove('Pragma');
@@ -225,24 +251,14 @@ class Photo extends \Zotlabs\Web\Controller {
$mimetype = $ph->getType();
}
}
-
- // @FIXME Seems never invoked
- // Writing in cachefile
- if (isset($cachefile) && $cachefile != '') {
- file_put_contents($cachefile, $data);
- $modified = filemtime($cachefile);
- }
-
- header("Content-type: " . $mimetype);
-
- if($prvcachecontrol) {
+ if(isset($prvcachecontrol)) {
// it is a private photo that they have no permission to view.
// tell the browser not to cache it, in case they authenticate
// and subsequently have permission to see it
- header("Cache-Control: no-store, no-cache, must-revalidate");
+ header("Cache-Control: " . $prvcachecontrol);
}
else {
@@ -255,18 +271,23 @@ class Photo extends \Zotlabs\Web\Controller {
// This has performance considerations but we highly recommend you
// leave it alone.
- $cache = get_config('system','photo_cache_time', 86400); // 1 day by default
+ $maxage = $cache_mode['age'];
- header("Expires: " . gmdate("D, d M Y H:i:s", time() + $cache) . " GMT");
- header("Cache-Control: max-age=" . $cache);
+ if($cache_mode['exp'] || (! isset($expires)) || (isset($expires) && $expires - 60 < time()))
+ $expires = time() + $maxage;
+ else
+ $maxage = $expires - time();
+
+ header("Expires: " . gmdate("D, d M Y H:i:s", $expires) . " GMT");
+ header("Cache-Control: max-age=" . $maxage);
}
+ header("Content-type: " . $mimetype);
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $modified) . " GMT");
header("Content-Length: " . (isset($filesize) ? $filesize : strlen($data)));
// If it's a file resource, stream it.
-
if($streaming && $channel) {
if(strpos($streaming,'store') !== false)
$istream = fopen($streaming,'rb');
diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php
index f660c3b55..12244d88c 100644
--- a/Zotlabs/Module/Ping.php
+++ b/Zotlabs/Module/Ping.php
@@ -330,6 +330,7 @@ class Ping extends \Zotlabs\Web\Controller {
$notifs[] = array(
'notify_link' => z_root() . '/mail/' . $zz['id'],
'name' => $zz['xchan_name'],
+ 'addr' => $zz['xchan_addr'],
'url' => $zz['xchan_url'],
'photo' => $zz['xchan_photo_s'],
'when' => relative_date($zz['created']),
@@ -383,6 +384,7 @@ class Ping extends \Zotlabs\Web\Controller {
$result[] = array(
'notify_link' => z_root() . '/connections/ifpending',
'name' => $rr['xchan_name'],
+ 'addr' => $rr['xchan_addr'],
'url' => $rr['xchan_url'],
'photo' => $rr['xchan_photo_s'],
'when' => relative_date($rr['abook_created']),
@@ -407,6 +409,7 @@ class Ping extends \Zotlabs\Web\Controller {
$result[] = array(
'notify_link' => z_root() . '/admin/accounts',
'name' => $rr['account_email'],
+ 'addr' => $rr['account_email'],
'url' => '',
'photo' => z_root() . '/' . get_default_profile_photo(48),
'when' => relative_date($rr['account_created']),
@@ -444,6 +447,7 @@ class Ping extends \Zotlabs\Web\Controller {
$result[] = array(
'notify_link' => z_root() . '/events', /// @FIXME this takes you to an edit page and it may not be yours, we really want to just view the single event --> '/events/event/' . $rr['event_hash'],
'name' => $rr['xchan_name'],
+ 'addr' => $rr['xchan_addr'],
'url' => $rr['xchan_url'],
'photo' => $rr['xchan_photo_s'],
'when' => $when,
@@ -460,7 +464,7 @@ class Ping extends \Zotlabs\Web\Controller {
if(argc() > 1 && (argv(1) === 'files')) {
$result = array();
- $r = q("SELECT item.created, xchan.xchan_name, xchan.xchan_url, xchan.xchan_photo_s FROM item
+ $r = q("SELECT item.created, xchan.xchan_name, xchan.xchan_addr, xchan.xchan_url, xchan.xchan_photo_s FROM item
LEFT JOIN xchan on author_xchan = xchan_hash
WHERE item.verb = '%s'
AND item.obj_type = '%s'
@@ -477,6 +481,7 @@ class Ping extends \Zotlabs\Web\Controller {
$result[] = array(
'notify_link' => z_root() . '/sharedwithme',
'name' => $rr['xchan_name'],
+ 'addr' => $rr['xchan_addr'],
'url' => $rr['xchan_url'],
'photo' => $rr['xchan_photo_s'],
'when' => relative_date($rr['created']),
@@ -658,6 +663,7 @@ class Ping extends \Zotlabs\Web\Controller {
if($r[0]['unseen']) {
$forums[$x]['notify_link'] = (($forums[$x]['private_forum']) ? $forums[$x]['xchan_url'] : z_root() . '/network/?f=&pf=1&unseen=1&cid=' . $forums[$x]['abook_id']);
$forums[$x]['name'] = $forums[$x]['xchan_name'];
+ $forums[$x]['addr'] = $forums[$x]['xchan_addr'];
$forums[$x]['url'] = $forums[$x]['xchan_url'];
$forums[$x]['photo'] = $forums[$x]['xchan_photo_s'];
$forums[$x]['unseen'] = $r[0]['unseen'];
diff --git a/Zotlabs/Module/Wfinger.php b/Zotlabs/Module/Wfinger.php
index e4591df12..03275abbc 100644
--- a/Zotlabs/Module/Wfinger.php
+++ b/Zotlabs/Module/Wfinger.php
@@ -43,6 +43,9 @@ class Wfinger extends \Zotlabs\Web\Controller {
if(strpos($resource,'acct:') === 0) {
$channel = str_replace('acct:','',$resource);
+ if(substr($channel,0,1) === '@' && strpos(substr($channel,1),'@')) {
+ $channel = substr($channel,1);
+ }
if(strpos($channel,'@') !== false) {
$host = substr($channel,strpos($channel,'@')+1);
diff --git a/Zotlabs/Update/_1228.php b/Zotlabs/Update/_1228.php
index f8a506bb4..9e6bf8047 100644
--- a/Zotlabs/Update/_1228.php
+++ b/Zotlabs/Update/_1228.php
@@ -11,8 +11,8 @@ class _1228 {
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
$r1 = q("ALTER TABLE item ADD uuid text NOT NULL DEFAULT '' ");
- $r2 = q("create index \"uuid_idx\" on channel (\"uuid\")");
- $r3 = q("ALTER TABLE item add summary TEXT NOT NULL");
+ $r2 = q("create index \"uuid_idx\" on item (\"uuid\")");
+ $r3 = q("ALTER TABLE item add summary TEXT NOT NULL DEFAULT ''");
$r = ($r1 && $r2 && $r3);
}
diff --git a/Zotlabs/Update/_1229.php b/Zotlabs/Update/_1229.php
new file mode 100644
index 000000000..8e8711644
--- /dev/null
+++ b/Zotlabs/Update/_1229.php
@@ -0,0 +1,32 @@
+ [
'posts_label' => t('Show new posts only'),
- 'name_label' => t('Filter by name')
+ 'name_label' => t('Filter by name or address')
]
];
@@ -43,7 +43,7 @@ class Notifications {
],
'filter' => [
'posts_label' => t('Show new posts only'),
- 'name_label' => t('Filter by name')
+ 'name_label' => t('Filter by name or address')
]
];
@@ -119,7 +119,7 @@ class Notifications {
'label' => t('Forums'),
'title' => t('Forums'),
'filter' => [
- 'name_label' => t('Filter by name')
+ 'name_label' => t('Filter by name or address')
]
];
}
@@ -150,7 +150,7 @@ class Notifications {
],
'filter' => [
'posts_label' => t('Show new posts only'),
- 'name_label' => t('Filter by name')
+ 'name_label' => t('Filter by name or address')
]
];
}
diff --git a/boot.php b/boot.php
index c74309be0..e49134a55 100755
--- a/boot.php
+++ b/boot.php
@@ -53,7 +53,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'STD_VERSION', '3.9.5' );
define ( 'ZOT_REVISION', '6.0a' );
-define ( 'DB_UPDATE_VERSION', 1228 );
+define ( 'DB_UPDATE_VERSION', 1229 );
define ( 'PROJECT_BASE', __DIR__ );
@@ -217,6 +217,7 @@ define ( 'PHOTO_PROFILE', 0x0001 );
define ( 'PHOTO_XCHAN', 0x0002 );
define ( 'PHOTO_THING', 0x0004 );
define ( 'PHOTO_COVER', 0x0010 );
+define ( 'PHOTO_CACHE', 0x0020 );
define ( 'PHOTO_ADULT', 0x0008 );
define ( 'PHOTO_FLAG_OS', 0x4000 );
diff --git a/composer.json b/composer.json
index f117cc3b1..e6cefa241 100644
--- a/composer.json
+++ b/composer.json
@@ -40,7 +40,8 @@
"smarty/smarty": "~3.1",
"ramsey/uuid": "^3.8",
"twbs/bootstrap": "4.1.3",
- "blueimp/jquery-file-upload": "^9.25"
+ "blueimp/jquery-file-upload": "^9.25",
+ "desandro/imagesloaded": "^4.1"
},
"require-dev" : {
"phpunit/phpunit" : "@stable",
diff --git a/composer.lock b/composer.lock
index d7e8d11f6..bd95e8c78 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "63d0e52cc07f8113059ec30d3637b850",
+ "content-hash": "fe5e71d7076eeddf1c174be4a5c052dd",
"packages": [
{
"name": "blueimp/jquery-file-upload",
- "version": "v9.25.1",
+ "version": "v9.28.0",
"source": {
"type": "git",
"url": "https://github.com/vkhramtsov/jQuery-File-Upload.git",
- "reference": "28891f9b2bc339bcc1ca8d548e5401e8563bf04b"
+ "reference": "ff5accfe2e5c4a522777faa980a90cf86a636d1d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/vkhramtsov/jQuery-File-Upload/zipball/28891f9b2bc339bcc1ca8d548e5401e8563bf04b",
- "reference": "28891f9b2bc339bcc1ca8d548e5401e8563bf04b",
+ "url": "https://api.github.com/repos/vkhramtsov/jQuery-File-Upload/zipball/ff5accfe2e5c4a522777faa980a90cf86a636d1d",
+ "reference": "ff5accfe2e5c4a522777faa980a90cf86a636d1d",
"shasum": ""
},
"type": "library",
@@ -59,7 +59,7 @@
"upload",
"widget"
],
- "time": "2018-10-26T07:21:48+00:00"
+ "time": "2018-11-13T05:41:39+00:00"
},
{
"name": "bshaffer/oauth2-server-php",
@@ -163,6 +163,45 @@
"description": "Internationalization library powered by CLDR data.",
"time": "2017-12-29T00:13:05+00:00"
},
+ {
+ "name": "desandro/imagesloaded",
+ "version": "v4.1.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/desandro/imagesloaded.git",
+ "reference": "67c4e57453120935180c45c6820e7d3fbd2ea1f9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/desandro/imagesloaded/zipball/67c4e57453120935180c45c6820e7d3fbd2ea1f9",
+ "reference": "67c4e57453120935180c45c6820e7d3fbd2ea1f9",
+ "shasum": ""
+ },
+ "type": "component",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "David DeSandro",
+ "homepage": "http://desandro.com/",
+ "role": "developer"
+ }
+ ],
+ "description": "JavaScript is all like _You images done yet or what?_",
+ "homepage": "http://imagesloaded.desandro.com",
+ "keywords": [
+ "dom",
+ "images",
+ "javascript",
+ "jquery-plugin",
+ "library",
+ "loaded",
+ "ui"
+ ],
+ "time": "2018-01-02T16:53:35+00:00"
+ },
{
"name": "ezyang/htmlpurifier",
"version": "v4.10.0",
@@ -446,16 +485,16 @@
},
{
"name": "psr/log",
- "version": "1.0.2",
+ "version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
- "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
+ "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
- "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
+ "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
"shasum": ""
},
"require": {
@@ -489,7 +528,7 @@
"psr",
"psr-3"
],
- "time": "2016-10-10T12:19:37+00:00"
+ "time": "2018-11-20T15:27:04+00:00"
},
{
"name": "ramsey/uuid",
@@ -1110,7 +1149,7 @@
},
{
"name": "symfony/polyfill-ctype",
- "version": "v1.9.0",
+ "version": "v1.10.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
@@ -2536,16 +2575,16 @@
},
{
"name": "phpunit/php-code-coverage",
- "version": "6.1.3",
+ "version": "6.1.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "4d3ae9b21a7d7e440bd0cf65565533117976859f"
+ "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/4d3ae9b21a7d7e440bd0cf65565533117976859f",
- "reference": "4d3ae9b21a7d7e440bd0cf65565533117976859f",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d",
+ "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d",
"shasum": ""
},
"require": {
@@ -2595,7 +2634,7 @@
"testing",
"xunit"
],
- "time": "2018-10-23T05:59:32+00:00"
+ "time": "2018-10-31T16:06:48+00:00"
},
{
"name": "phpunit/php-file-iterator",
@@ -2788,16 +2827,16 @@
},
{
"name": "phpunit/phpunit",
- "version": "7.4.3",
+ "version": "7.4.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "c151651fb6ed264038d486ea262e243af72e5e64"
+ "reference": "b1be2c8530c4c29c3519a052c9fb6cee55053bbd"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c151651fb6ed264038d486ea262e243af72e5e64",
- "reference": "c151651fb6ed264038d486ea262e243af72e5e64",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b1be2c8530c4c29c3519a052c9fb6cee55053bbd",
+ "reference": "b1be2c8530c4c29c3519a052c9fb6cee55053bbd",
"shasum": ""
},
"require": {
@@ -2868,7 +2907,7 @@
"testing",
"xunit"
],
- "time": "2018-10-23T05:57:41+00:00"
+ "time": "2018-11-14T16:52:02+00:00"
},
{
"name": "psr/container",
@@ -3534,7 +3573,7 @@
},
{
"name": "symfony/browser-kit",
- "version": "v4.1.6",
+ "version": "v4.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/browser-kit.git",
@@ -3591,16 +3630,16 @@
},
{
"name": "symfony/class-loader",
- "version": "v3.4.17",
+ "version": "v3.4.18",
"source": {
"type": "git",
"url": "https://github.com/symfony/class-loader.git",
- "reference": "f31333bdff54c7595f834d510a6d2325573ddb36"
+ "reference": "5605edec7b8f034ead2497ff4aab17bb70d558c1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/class-loader/zipball/f31333bdff54c7595f834d510a6d2325573ddb36",
- "reference": "f31333bdff54c7595f834d510a6d2325573ddb36",
+ "url": "https://api.github.com/repos/symfony/class-loader/zipball/5605edec7b8f034ead2497ff4aab17bb70d558c1",
+ "reference": "5605edec7b8f034ead2497ff4aab17bb70d558c1",
"shasum": ""
},
"require": {
@@ -3643,20 +3682,20 @@
],
"description": "Symfony ClassLoader Component",
"homepage": "https://symfony.com",
- "time": "2018-10-02T12:28:39+00:00"
+ "time": "2018-10-31T09:06:03+00:00"
},
{
"name": "symfony/config",
- "version": "v4.1.6",
+ "version": "v4.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/config.git",
- "reference": "b3d4d7b567d7a49e6dfafb6d4760abc921177c96"
+ "reference": "991fec8bbe77367fc8b48ecbaa8a4bd6e905a238"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/config/zipball/b3d4d7b567d7a49e6dfafb6d4760abc921177c96",
- "reference": "b3d4d7b567d7a49e6dfafb6d4760abc921177c96",
+ "url": "https://api.github.com/repos/symfony/config/zipball/991fec8bbe77367fc8b48ecbaa8a4bd6e905a238",
+ "reference": "991fec8bbe77367fc8b48ecbaa8a4bd6e905a238",
"shasum": ""
},
"require": {
@@ -3706,20 +3745,20 @@
],
"description": "Symfony Config Component",
"homepage": "https://symfony.com",
- "time": "2018-09-08T13:24:10+00:00"
+ "time": "2018-10-31T09:09:42+00:00"
},
{
"name": "symfony/console",
- "version": "v4.1.6",
+ "version": "v4.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
- "reference": "dc7122fe5f6113cfaba3b3de575d31112c9aa60b"
+ "reference": "432122af37d8cd52fba1b294b11976e0d20df595"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/console/zipball/dc7122fe5f6113cfaba3b3de575d31112c9aa60b",
- "reference": "dc7122fe5f6113cfaba3b3de575d31112c9aa60b",
+ "url": "https://api.github.com/repos/symfony/console/zipball/432122af37d8cd52fba1b294b11976e0d20df595",
+ "reference": "432122af37d8cd52fba1b294b11976e0d20df595",
"shasum": ""
},
"require": {
@@ -3774,11 +3813,11 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
- "time": "2018-10-03T08:15:46+00:00"
+ "time": "2018-10-31T09:30:44+00:00"
},
{
"name": "symfony/css-selector",
- "version": "v3.4.17",
+ "version": "v3.4.18",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
@@ -3831,16 +3870,16 @@
},
{
"name": "symfony/dependency-injection",
- "version": "v4.1.6",
+ "version": "v4.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/dependency-injection.git",
- "reference": "f6b9d893ad28aefd8942dc0469c8397e2216fe30"
+ "reference": "e72ee2c23d952e4c368ee98610fa22b79b89b483"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/f6b9d893ad28aefd8942dc0469c8397e2216fe30",
- "reference": "f6b9d893ad28aefd8942dc0469c8397e2216fe30",
+ "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/e72ee2c23d952e4c368ee98610fa22b79b89b483",
+ "reference": "e72ee2c23d952e4c368ee98610fa22b79b89b483",
"shasum": ""
},
"require": {
@@ -3898,11 +3937,11 @@
],
"description": "Symfony DependencyInjection Component",
"homepage": "https://symfony.com",
- "time": "2018-10-02T12:40:59+00:00"
+ "time": "2018-10-31T10:54:16+00:00"
},
{
"name": "symfony/dom-crawler",
- "version": "v4.1.6",
+ "version": "v4.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/dom-crawler.git",
@@ -3959,16 +3998,16 @@
},
{
"name": "symfony/event-dispatcher",
- "version": "v4.1.6",
+ "version": "v4.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
- "reference": "bfb30c2ad377615a463ebbc875eba64a99f6aa3e"
+ "reference": "552541dad078c85d9414b09c041ede488b456cd5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/bfb30c2ad377615a463ebbc875eba64a99f6aa3e",
- "reference": "bfb30c2ad377615a463ebbc875eba64a99f6aa3e",
+ "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/552541dad078c85d9414b09c041ede488b456cd5",
+ "reference": "552541dad078c85d9414b09c041ede488b456cd5",
"shasum": ""
},
"require": {
@@ -4018,20 +4057,20 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
- "time": "2018-07-26T09:10:45+00:00"
+ "time": "2018-10-10T13:52:42+00:00"
},
{
"name": "symfony/filesystem",
- "version": "v4.1.6",
+ "version": "v4.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
- "reference": "596d12b40624055c300c8b619755b748ca5cf0b5"
+ "reference": "fd7bd6535beb1f0a0a9e3ee960666d0598546981"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/filesystem/zipball/596d12b40624055c300c8b619755b748ca5cf0b5",
- "reference": "596d12b40624055c300c8b619755b748ca5cf0b5",
+ "url": "https://api.github.com/repos/symfony/filesystem/zipball/fd7bd6535beb1f0a0a9e3ee960666d0598546981",
+ "reference": "fd7bd6535beb1f0a0a9e3ee960666d0598546981",
"shasum": ""
},
"require": {
@@ -4068,20 +4107,20 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
- "time": "2018-10-02T12:40:59+00:00"
+ "time": "2018-10-30T13:18:25+00:00"
},
{
"name": "symfony/polyfill-mbstring",
- "version": "v1.9.0",
+ "version": "v1.10.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
- "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8"
+ "reference": "c79c051f5b3a46be09205c73b80b346e4153e494"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8",
- "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494",
+ "reference": "c79c051f5b3a46be09205c73b80b346e4153e494",
"shasum": ""
},
"require": {
@@ -4127,20 +4166,20 @@
"portable",
"shim"
],
- "time": "2018-08-06T14:22:27+00:00"
+ "time": "2018-09-21T13:07:52+00:00"
},
{
"name": "symfony/translation",
- "version": "v4.1.6",
+ "version": "v4.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
- "reference": "9f0b61e339160a466ebcde167a6c5521c810e304"
+ "reference": "aa04dc1c75b7d3da7bd7003104cd0cfc5dff635c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/translation/zipball/9f0b61e339160a466ebcde167a6c5521c810e304",
- "reference": "9f0b61e339160a466ebcde167a6c5521c810e304",
+ "url": "https://api.github.com/repos/symfony/translation/zipball/aa04dc1c75b7d3da7bd7003104cd0cfc5dff635c",
+ "reference": "aa04dc1c75b7d3da7bd7003104cd0cfc5dff635c",
"shasum": ""
},
"require": {
@@ -4196,11 +4235,11 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
- "time": "2018-10-02T16:36:10+00:00"
+ "time": "2018-10-28T18:38:52+00:00"
},
{
"name": "symfony/yaml",
- "version": "v4.1.6",
+ "version": "v4.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
diff --git a/include/channel.php b/include/channel.php
index 1e5570f6b..95a3f96cf 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -2333,6 +2333,21 @@ function channelx_by_hash($hash) {
return(($r) ? $r[0] : false);
}
+
+/**
+ * @brief Get a channel array by a channel_hash.
+ *
+ * @param string $hash
+ * @return array|boolean false if channel ID not found, otherwise the channel array
+ */
+function channelx_by_portid($hash) {
+ $r = q("SELECT * FROM channel left join xchan on channel_portable_id = xchan_hash WHERE channel_portable_id = '%s' and channel_removed = 0 LIMIT 1",
+ dbesc($hash)
+ );
+
+ return(($r) ? $r[0] : false);
+}
+
/**
* @brief Get a channel array by a channel ID.
*
diff --git a/include/items.php b/include/items.php
index 2cee376d0..0cbca23fc 100755
--- a/include/items.php
+++ b/include/items.php
@@ -420,7 +420,7 @@ function post_activity_item($arr, $allow_code = false, $deliver = true) {
$arr['comment_policy'] = map_scope(PermissionLimits::Get($channel['channel_id'],'post_comments'));
if ((! $arr['plink']) && (intval($arr['item_thread_top']))) {
- $arr['plink'] = substr(z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . urlencode($arr['mid']),0,190);
+ $arr['plink'] = substr(z_root() . '/channel/' . $channel['channel_address'] . '/' . (filter_var($arr['mid'], FILTER_VALIDATE_URL) === false ? '?f=&mid=' : '') . urlencode($arr['mid']),0,190);
}
@@ -4629,10 +4629,10 @@ function fix_attached_photo_permissions($uid,$xchan_hash,$body,
if(! stristr($image,z_root() . '/photo/'))
continue;
$image_uri = substr($image,strrpos($image,'/') + 1);
- if(strpos($image_uri,'-') !== false)
- $image_uri = substr($image_uri,0, strpos($image_uri,'-'));
- if(strpos($image_uri,'.') !== false)
- $image_uri = substr($image_uri,0, strpos($image_uri,'.'));
+ if(strrpos($image_uri,'-') !== false)
+ $image_uri = substr($image_uri,0, strrpos($image_uri,'-'));
+ if(strrpos($image_uri,'.') !== false)
+ $image_uri = substr($image_uri,0, strrpos($image_uri,'.'));
if(! strlen($image_uri))
continue;
$srch = '<' . $xchan_hash . '>';
diff --git a/include/oembed.php b/include/oembed.php
index e5557dc11..426197c5f 100755
--- a/include/oembed.php
+++ b/include/oembed.php
@@ -221,7 +221,11 @@ function oembed_fetch_url($embedurl){
if(strpos(strtolower($embedurl),'.pdf') !== false) {
$action = 'allow';
- $j = [ 'html' => '', 'width' => 500, 'height' => 720, 'type' => 'pdf' ];
+ $j = [
+ 'html' => '',
+ 'title' => t('View PDF'),
+ 'type' => 'pdf'
+ ];
}
diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php
index b70a13622..9aeb2ef17 100644
--- a/include/photo/photo_driver.php
+++ b/include/photo/photo_driver.php
@@ -112,7 +112,7 @@ abstract class photo_driver {
public function saveImage($path) {
if(!$this->is_valid())
return FALSE;
- file_put_contents($path, $this->imageString());
+ return (file_put_contents($path, $this->imageString()) ? true : false);
}
@@ -330,9 +330,9 @@ abstract class photo_driver {
}
- public function save($arr) {
+ public function save($arr, $skipcheck = false) {
- if(! $this->is_valid()) {
+ if(! ($skipcheck || $this->is_valid())) {
logger('attempt to store invalid photo.');
return false;
}
@@ -344,6 +344,7 @@ abstract class photo_driver {
$p['xchan'] = (($arr['xchan']) ? $arr['xchan'] : '');
$p['resource_id'] = (($arr['resource_id']) ? $arr['resource_id'] : '');
$p['filename'] = (($arr['filename']) ? $arr['filename'] : '');
+ $p['mimetype'] = (($arr['mimetype']) ? $arr['mimetype'] : $this->getType());
$p['album'] = (($arr['album']) ? $arr['album'] : '');
$p['imgscale'] = ((intval($arr['imgscale'])) ? intval($arr['imgscale']) : 0);
$p['allow_cid'] = (($arr['allow_cid']) ? $arr['allow_cid'] : '');
@@ -360,6 +361,7 @@ abstract class photo_driver {
$p['display_path'] = (($arr['display_path']) ? $arr['display_path'] : '');
$p['width'] = (($arr['width']) ? $arr['width'] : $this->getWidth());
$p['height'] = (($arr['height']) ? $arr['height'] : $this->getHeight());
+ $p['expires'] = (($arr['expires']) ? $arr['expires'] : gmdate('Y-m-d H:i:s', time() + get_config('system','photo_cache_time', 86400)));
if(! intval($p['imgscale']))
logger('save: ' . print_r($arr,true), LOGGER_DATA);
@@ -397,17 +399,18 @@ abstract class photo_driver {
allow_cid = '%s',
allow_gid = '%s',
deny_cid = '%s',
- deny_gid = '%s'
+ deny_gid = '%s',
+ expires = '%s'
where id = %d",
intval($p['aid']),
intval($p['uid']),
dbesc($p['xchan']),
dbesc($p['resource_id']),
- dbesc($p['created']),
- dbesc($p['edited']),
+ dbescdate($p['created']),
+ dbescdate($p['edited']),
dbesc(basename($p['filename'])),
- dbesc($this->getType()),
+ dbesc($p['mimetype']),
dbesc($p['album']),
intval($p['height']),
intval($p['width']),
@@ -424,22 +427,23 @@ abstract class photo_driver {
dbesc($p['allow_gid']),
dbesc($p['deny_cid']),
dbesc($p['deny_gid']),
+ dbescdate($p['expires']),
intval($x[0]['id'])
);
}
else {
$p['created'] = (($arr['created']) ? $arr['created'] : $p['edited']);
$r = q("INSERT INTO photo
- ( aid, uid, xchan, resource_id, created, edited, filename, mimetype, album, height, width, content, os_storage, filesize, imgscale, photo_usage, title, description, os_path, display_path, allow_cid, allow_gid, deny_cid, deny_gid )
- VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
+ ( aid, uid, xchan, resource_id, created, edited, filename, mimetype, album, height, width, content, os_storage, filesize, imgscale, photo_usage, title, description, os_path, display_path, allow_cid, allow_gid, deny_cid, deny_gid, expires )
+ VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
intval($p['aid']),
intval($p['uid']),
dbesc($p['xchan']),
dbesc($p['resource_id']),
- dbesc($p['created']),
- dbesc($p['edited']),
+ dbescdate($p['created']),
+ dbescdate($p['edited']),
dbesc(basename($p['filename'])),
- dbesc($this->getType()),
+ dbesc($p['mimetype']),
dbesc($p['album']),
intval($p['height']),
intval($p['width']),
@@ -455,7 +459,8 @@ abstract class photo_driver {
dbesc($p['allow_cid']),
dbesc($p['allow_gid']),
dbesc($p['deny_cid']),
- dbesc($p['deny_gid'])
+ dbesc($p['deny_gid']),
+ dbescdate($p['expires'])
);
}
logger('photo save ' . $p['imgscale'] . ' returned ' . intval($r));
diff --git a/include/photo/photo_imagick.php b/include/photo/photo_imagick.php
index 89577e71e..f04c00245 100644
--- a/include/photo/photo_imagick.php
+++ b/include/photo/photo_imagick.php
@@ -31,8 +31,12 @@ class photo_imagick extends photo_driver {
if(! $data)
return;
- $this->image->readImageBlob($data);
-
+ try {
+ $this->image->readImageBlob($data);
+ }
+ catch (Exception $e) {
+ logger('imagick readImageBlob() exception:' . print_r($e,true));
+ }
/**
* Setup the image to the format it will be saved to
@@ -205,4 +209,4 @@ class photo_imagick extends photo_driver {
-}
\ No newline at end of file
+}
diff --git a/include/text.php b/include/text.php
index 646bfe749..bd0d8048d 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1105,23 +1105,33 @@ function linkify($s, $me = false) {
* to a local redirector which uses https and which redirects to the selected content
*
* @param string $s
+ * @param int $uid
* @returns string
*/
function sslify($s) {
+
+ // Local photo cache
+ $str = array(
+ 'body' => $s,
+ 'uid' => local_channel()
+ );
+ call_hooks('cache_body_hook', $str);
+
+ $s = $str['body'];
+
if (strpos(z_root(),'https:') === false)
return $s;
-
+
// By default we'll only sslify img tags because media files will probably choke.
// You can set sslify_everything if you want - but it will likely white-screen if it hits your php memory limit.
// The downside is that http: media files will likely be blocked by your browser
// Complain to your browser maker
$allow = get_config('system','sslify_everything');
-
- $pattern = (($allow) ? "/\<(.*?)src=\"(http\:.*?)\"(.*?)\>/" : "/\
/" );
+ $pattern = (($allow) ? "/\<(.*?)src=[\"|'](http\:.*?)[\"|'](.*?)\>/" : "/\
/" );
$matches = null;
- $cnt = preg_match_all($pattern,$s,$matches,PREG_SET_ORDER);
+ $cnt = preg_match_all($pattern, $s, $matches, PREG_SET_ORDER);
if ($cnt) {
foreach ($matches as $match) {
$filename = basename( parse_url($match[2], PHP_URL_PATH) );
@@ -3295,7 +3305,7 @@ function cleanup_bbcode($body) {
$body = preg_replace('/\[\/code\]\s*\[code\]/ism',"\n",$body);
- $body = scale_external_images($body,false);
+ $body = scale_external_images($body, false);
return $body;
}
@@ -3411,7 +3421,7 @@ function get_forum_channels($uid) {
$sql_extra = (($xf) ? " and ( xchan_hash in (" . $xf . ") or xchan_pubforum = 1 ) " : " and xchan_pubforum = 1 ");
- $r = q("select abook_id, xchan_hash, xchan_name, xchan_url, xchan_photo_s from abook left join xchan on abook_xchan = xchan_hash where xchan_deleted = 0 and abook_channel = %d and abook_pending = 0 and abook_ignored = 0 and abook_blocked = 0 and abook_archived = 0 $sql_extra order by xchan_name",
+ $r = q("select abook_id, xchan_hash, xchan_name, xchan_url, xchan_addr, xchan_photo_s from abook left join xchan on abook_xchan = xchan_hash where xchan_deleted = 0 and abook_channel = %d and abook_pending = 0 and abook_ignored = 0 and abook_blocked = 0 and abook_archived = 0 $sql_extra order by xchan_name",
intval($uid)
);
@@ -3467,6 +3477,28 @@ function print_val($v) {
}
+function array_path_exists($str,$arr) {
+
+ $ptr = $arr;
+ $search = explode('/', $str);
+
+ if($search) {
+ foreach($search as $s) {
+ if(array_key_exists($s,$ptr)) {
+ $ptr = $ptr[$s];
+ }
+ else {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ return false;
+
+}
+
+
/**
* @brief Generate a unique ID.
*
@@ -3482,3 +3514,4 @@ function new_uuid() {
return $hash;
}
+
diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index 3e3e6fe88..49a2c476a 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -947,6 +947,7 @@ CREATE TABLE IF NOT EXISTS `photo` (
`resource_id` char(191) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
+ `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`title` char(191) NOT NULL DEFAULT '',
`description` text NOT NULL,
`album` char(191) NOT NULL DEFAULT '',
@@ -979,6 +980,7 @@ CREATE TABLE IF NOT EXISTS `photo` (
KEY `xchan` (`xchan`),
KEY `filesize` (`filesize`),
KEY `resource_id` (`resource_id`),
+ KEY `expires` (`expires`),
KEY `is_nsfw` (`is_nsfw`),
KEY `os_storage` (`os_storage`),
KEY `photo_usage` (`photo_usage`)
diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql
index 44f98b944..1b6cab51b 100644
--- a/install/schema_postgres.sql
+++ b/install/schema_postgres.sql
@@ -928,6 +928,7 @@ CREATE TABLE "photo" (
"resource_id" text NOT NULL,
"created" timestamp NOT NULL,
"edited" timestamp NOT NULL,
+ "expires" timestamp NOT NULL,
"title" text NOT NULL,
"description" text NOT NULL,
"album" text NOT NULL,
@@ -961,6 +962,7 @@ create index "photo_aid" on photo ("aid");
create index "photo_xchan" on photo ("xchan");
create index "photo_filesize" on photo ("filesize");
create index "photo_resource_id" on photo ("resource_id");
+create index "photo_expires_idx" on photo ("expires");
create index "photo_usage" on photo ("photo_usage");
create index "photo_is_nsfw" on photo ("is_nsfw");
create index "photo_os_storage" on photo ("os_storage");
diff --git a/library/imagesloaded/imagesloaded.pkgd.min.js b/library/imagesloaded/imagesloaded.pkgd.min.js
deleted file mode 100644
index c3e71fadc..000000000
--- a/library/imagesloaded/imagesloaded.pkgd.min.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/*!
- * imagesLoaded PACKAGED v4.1.0
- * JavaScript is all like "You images are done yet or what?"
- * MIT License
- */
-
-!function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}(this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||[];return n[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=0,o=i[n];e=e||[];for(var r=this._onceEvents&&this._onceEvents[t];o;){var s=r&&r[o];s&&(this.off(t,o),delete r[o]),o.apply(this,e),n+=s?0:1,o=i[n]}return this}},t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define(["ev-emitter/ev-emitter"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.imagesLoaded=e(t,t.EvEmitter)}(window,function(t,e){function i(t,e){for(var i in e)t[i]=e[i];return t}function n(t){var e=[];if(Array.isArray(t))e=t;else if("number"==typeof t.length)for(var i=0;i
-
+
@@ -177,8 +177,8 @@
-
-
+
+
@@ -186,7 +186,7 @@
-
+
diff --git a/vendor/blueimp/jquery-file-upload/basic-plus.html b/vendor/blueimp/jquery-file-upload/basic-plus.html
index acee24843..6d53acdc1 100644
--- a/vendor/blueimp/jquery-file-upload/basic-plus.html
+++ b/vendor/blueimp/jquery-file-upload/basic-plus.html
@@ -20,7 +20,7 @@
-
+
@@ -96,15 +96,15 @@
-
+
-
+
-
+
diff --git a/vendor/blueimp/jquery-file-upload/basic.html b/vendor/blueimp/jquery-file-upload/basic.html
index 232a24624..a9ef6273e 100644
--- a/vendor/blueimp/jquery-file-upload/basic.html
+++ b/vendor/blueimp/jquery-file-upload/basic.html
@@ -20,7 +20,7 @@
-
+
@@ -96,7 +96,7 @@
-
+
@@ -104,7 +104,7 @@
-
+
+
-
+
@@ -226,7 +226,7 @@
-
+
diff --git a/vendor/blueimp/jquery-file-upload/jquery-ui.html b/vendor/blueimp/jquery-file-upload/jquery-ui.html
index 842dd4ca7..e44d41e89 100644
--- a/vendor/blueimp/jquery-file-upload/jquery-ui.html
+++ b/vendor/blueimp/jquery-file-upload/jquery-ui.html
@@ -22,7 +22,7 @@
-
+
@@ -201,8 +201,8 @@
{% } %}
-
-
+
+
diff --git a/vendor/blueimp/jquery-file-upload/package.json b/vendor/blueimp/jquery-file-upload/package.json
index 4b33a0362..0a635397c 100644
--- a/vendor/blueimp/jquery-file-upload/package.json
+++ b/vendor/blueimp/jquery-file-upload/package.json
@@ -1,6 +1,6 @@
{
"name": "blueimp-file-upload",
- "version": "9.25.1",
+ "version": "9.28.0",
"title": "jQuery File Upload",
"description": "File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.",
"keywords": [
diff --git a/vendor/blueimp/jquery-file-upload/server/php/UploadHandler.php b/vendor/blueimp/jquery-file-upload/server/php/UploadHandler.php
old mode 100755
new mode 100644
index e44004395..5215e4c0f
--- a/vendor/blueimp/jquery-file-upload/server/php/UploadHandler.php
+++ b/vendor/blueimp/jquery-file-upload/server/php/UploadHandler.php
@@ -38,9 +38,9 @@ class UploadHandler
'image_resize' => 'Failed to resize image'
);
- protected const IMAGETYPE_GIF = 1;
- protected const IMAGETYPE_JPEG = 2;
- protected const IMAGETYPE_PNG = 3;
+ const IMAGETYPE_GIF = 1;
+ const IMAGETYPE_JPEG = 2;
+ const IMAGETYPE_PNG = 3;
protected $image_objects = array();
@@ -1047,13 +1047,18 @@ class UploadHandler
}
protected function create_scaled_image($file_name, $version, $options) {
- if ($this->options['image_library'] === 2) {
- return $this->imagemagick_create_scaled_image($file_name, $version, $options);
+ try {
+ if ($this->options['image_library'] === 2) {
+ return $this->imagemagick_create_scaled_image($file_name, $version, $options);
+ }
+ if ($this->options['image_library'] && extension_loaded('imagick')) {
+ return $this->imagick_create_scaled_image($file_name, $version, $options);
+ }
+ return $this->gd_create_scaled_image($file_name, $version, $options);
+ } catch (\Exception $e) {
+ error_log($e->getMessage());
+ return false;
}
- if ($this->options['image_library'] && extension_loaded('imagick')) {
- return $this->imagick_create_scaled_image($file_name, $version, $options);
- }
- return $this->gd_create_scaled_image($file_name, $version, $options);
}
protected function destroy_image_object($file_path) {
@@ -1066,12 +1071,12 @@ class UploadHandler
$fp = fopen($file_path, 'r');
$data = fread($fp, 4);
fclose($fp);
- // GIF: 47 49 46
- if (substr($data, 0, 3) === 'GIF') {
+ // GIF: 47 49 46 38
+ if ($data === 'GIF8') {
return self::IMAGETYPE_GIF;
}
- // JPG: FF D8
- if (bin2hex(substr($data, 0, 2)) === 'ffd8') {
+ // JPG: FF D8 FF
+ if (bin2hex(substr($data, 0, 3)) === 'ffd8ff') {
return self::IMAGETYPE_JPEG;
}
// PNG: 89 50 4E 47
@@ -1082,6 +1087,9 @@ class UploadHandler
}
protected function is_valid_image_file($file_path) {
+ if (!preg_match('/\.(gif|jpe?g|png)$/i', $file_path)) {
+ return false;
+ }
return !!$this->imagetype($file_path);
}
diff --git a/vendor/blueimp/jquery-file-upload/server/php/index.php b/vendor/blueimp/jquery-file-upload/server/php/index.php
index 9c2cfb8eb..6caabb710 100644
--- a/vendor/blueimp/jquery-file-upload/server/php/index.php
+++ b/vendor/blueimp/jquery-file-upload/server/php/index.php
@@ -9,7 +9,7 @@
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
*/
-exit;
+
error_reporting(E_ALL | E_STRICT);
require('UploadHandler.php');
$upload_handler = new UploadHandler();
diff --git a/vendor/blueimp/jquery-file-upload/test/index.html b/vendor/blueimp/jquery-file-upload/test/index.html
index 0b5cf57b7..b8c585df5 100644
--- a/vendor/blueimp/jquery-file-upload/test/index.html
+++ b/vendor/blueimp/jquery-file-upload/test/index.html
@@ -20,7 +20,7 @@
jQuery File Upload Plugin Test
-
+
@@ -145,7 +145,7 @@
{% } %}
-
+
@@ -166,7 +166,7 @@ window.testBasicWidget = $.blueimp.fileupload;
/* global window, $ */
window.testUIWidget = $.blueimp.fileupload;
-
+