diff options
author | Mario <mario@mariovavti.com> | 2022-07-26 18:00:00 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-07-26 18:00:00 +0000 |
commit | 40377796edd8c612ce9d68f52fc146ad32302f9e (patch) | |
tree | 92cce4a3ee3627ed28f45ce8f0bb3598be87c8c9 /include | |
parent | c452a621fe7db5405d929ebc5f5433c9670fc367 (diff) | |
parent | fedad7f31a1b9133bfd63de7fc19de6916485254 (diff) | |
download | volse-hubzilla-40377796edd8c612ce9d68f52fc146ad32302f9e.tar.gz volse-hubzilla-40377796edd8c612ce9d68f52fc146ad32302f9e.tar.bz2 volse-hubzilla-40377796edd8c612ce9d68f52fc146ad32302f9e.zip |
Merge branch '7.6RC'7.6
Diffstat (limited to 'include')
-rw-r--r-- | include/attach.php | 3 | ||||
-rw-r--r-- | include/conversation.php | 5 | ||||
-rw-r--r-- | include/oembed.php | 19 | ||||
-rw-r--r-- | include/opengraph.php | 2 |
4 files changed, 26 insertions, 3 deletions
diff --git a/include/attach.php b/include/attach.php index 2109b84f1..32a86fcba 100644 --- a/include/attach.php +++ b/include/attach.php @@ -2702,10 +2702,11 @@ function attach_move($channel_id, $resource_id, $new_folder_hash, $newname = '', } - q("update attach set content = '%s', folder = '%s', filename = '%s' where id = %d", + q("update attach set content = '%s', folder = '%s', filename = '%s', edited = '%s' where id = %d", dbescbin($newstorepath), dbesc($new_folder_hash), dbesc($filename), + dbesc(datetime_convert()), intval($r[0]['id']) ); diff --git a/include/conversation.php b/include/conversation.php index 1d6295df7..d509342d4 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1719,12 +1719,14 @@ function prepare_page($item) { } $body = prepare_body($item, true, [ 'newwin' => false ]); + $edit_link = (($item['uid'] === local_channel()) ? z_root() . '/editwebpage/' . argv(1) . '/' . $item['id'] : ''); if(App::$page['template'] == 'none') { $tpl = 'page_display_empty.tpl'; return replace_macros(get_markup_template($tpl), array( - '$body' => $body['html'] + '$body' => $body['html'], + '$edit_link' => $edit_link )); } @@ -1741,6 +1743,7 @@ function prepare_page($item) { '$body' => $body['html'], '$preview' => $preview, '$link' => $link, + '$edit_link' => $edit_link )); } diff --git a/include/oembed.php b/include/oembed.php index 36938c577..bcf5d525c 100644 --- a/include/oembed.php +++ b/include/oembed.php @@ -164,6 +164,25 @@ function oembed_fetch_url($embedurl){ $txt = EMPTY_STR; if ($action !== 'block') { + $max_oembed_size = get_config('system', 'oembed_max_size', 1 * 1024 * 1024 /* 1MB */); + + stream_context_set_default( + [ + 'http' => [ + 'method' => 'HEAD', + 'timeout' => 5 + ] + ] + ); + + $headers = get_headers($furl, true); + + if (isset($headers['Content-Length']) && $headers['Content-Length'] > $max_oembed_size) { + $action = 'block'; + } + } + + if ($action !== 'block') { // try oembed autodiscovery $redirects = 0; $result = z_fetch_url($furl, false, $redirects, diff --git a/include/opengraph.php b/include/opengraph.php index 465acbd39..f62970c5d 100644 --- a/include/opengraph.php +++ b/include/opengraph.php @@ -21,7 +21,7 @@ $ogtitle = $item['title']; // find first image if exist - if(preg_match("/\[[zi]mg(=[0-9]+x[0-9]+)?\]([^\[]+)/is", $item['body'], $matches)) { + if (preg_match("/\[[zi]mg(=[0-9]+x[0-9]+)?\]([^\[]+)/is", $item['body'], $matches) || preg_match("/\[[zi]mg(=)([^\]]+)/is", $item['body'], $matches)) { $ogimage = $matches[2]; $ogimagetype = guess_image_type($ogimage); } |