aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/attach.php3
-rw-r--r--include/conversation.php5
-rw-r--r--include/oembed.php19
-rw-r--r--include/opengraph.php2
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);
}