diff options
-rw-r--r-- | Zotlabs/Daemon/Notifier.php | 8 | ||||
-rw-r--r-- | Zotlabs/Lib/Activity.php | 20 | ||||
-rw-r--r-- | Zotlabs/Lib/Libzot.php | 30 | ||||
-rw-r--r-- | Zotlabs/Lib/Queue.php | 25 | ||||
-rw-r--r-- | Zotlabs/Module/Network.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Outbox.php | 2 | ||||
-rw-r--r-- | include/channel.php | 14 | ||||
-rw-r--r-- | include/conversation.php | 20 | ||||
-rw-r--r-- | include/items.php | 52 | ||||
-rw-r--r-- | include/network.php | 2 | ||||
-rw-r--r-- | include/photo/photo_driver.php | 17 | ||||
-rw-r--r-- | include/text.php | 6 | ||||
-rw-r--r-- | view/de-de/hstrings.php | 1 | ||||
-rw-r--r-- | view/es-es/hstrings.php | 1 | ||||
-rw-r--r-- | view/fr/hstrings.php | 1 | ||||
-rw-r--r-- | view/it/hstrings.php | 1 | ||||
-rw-r--r-- | view/nl/hstrings.php | 1 | ||||
-rw-r--r-- | view/pl/hstrings.php | 1 | ||||
-rw-r--r-- | view/ru/hstrings.php | 1 |
19 files changed, 112 insertions, 95 deletions
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index 8aee08fe6..776cf4f63 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -111,6 +111,12 @@ class Notifier { $sys = get_sys_channel(); $normal_mode = true; + $upstream = false; + $uplink = false; + $target_item = []; + $parent_item = []; + $top_level_post = false; + $relay_to_owner = false; if ($cmd === 'keychange') { self::$channel = channelx_by_n($item_id); @@ -360,8 +366,6 @@ class Notifier { // the hostname in the message_id and provides a second (fallback) opinion. $relay_to_owner = (!$top_level_post && intval($target_item['item_origin']) && comment_local_origin($target_item)); - $uplink = false; - $upstream = false; // $cmd === 'relay' indicates the owner is sending it to the original recipients // don't allow the item in the relay command to relay to owner under any circumstances, it will loop diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index a93ad9d23..372ef3dd7 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -2252,11 +2252,11 @@ class Activity { // over-ride the object timestamp with the activity - if ($act->data['published']) { + if (isset($act->data['published'])) { $s['created'] = datetime_convert('UTC', 'UTC', $act->data['published']); } - if ($act->data['updated']) { + if (isset($act->data['updated'])) { $s['edited'] = datetime_convert('UTC', 'UTC', $act->data['updated']); } @@ -2710,7 +2710,7 @@ class Activity { // This is a zot6 packet and the raw activitypub or diaspora message json // is possibly available in the attachement. - if (array_key_exists('signed', $raw_arr) && is_array($act->data['attachment'])) { + if (array_key_exists('signed', $raw_arr) && isset($act->data['attachment']) && is_array($act->data['attachment'])) { foreach($act->data['attachment'] as $a) { if ( isset($a['type']) && $a['type'] === 'PropertyValue' && @@ -2730,7 +2730,7 @@ class Activity { } // old style: can be removed after most hubs are on 7.0.2 - elseif (array_key_exists('signed', $raw_arr) && is_array($act->obj) && is_array($act->obj['attachment'])) { + elseif (array_key_exists('signed', $raw_arr) && is_array($act->obj) && isset($act->data['attachment']) && is_array($act->obj['attachment'])) { foreach($act->obj['attachment'] as $a) { if ( isset($a['type']) && $a['type'] === 'PropertyValue' && @@ -3019,30 +3019,34 @@ class Activity { dbesc($item['parent_mid']), intval($item['uid']) ); + if (!$parent) { if (!plugin_is_installed('pubcrawl')) { return; } else { $fetch = false; + // TODO: debug // if (perm_is_allowed($channel['channel_id'],$observer_hash,'send_stream') && (PConfig::Get($channel['channel_id'],'system','hyperdrive',true) || $act->type === 'Announce')) { if (perm_is_allowed($channel['channel_id'], $observer_hash, 'send_stream') || $is_sys_channel) { $fetch = (($fetch_parents) ? self::fetch_and_store_parents($channel, $observer_hash, $item, $force) : false); } + if ($fetch) { $parent = q("select * from item where mid = '%s' and uid = %d limit 1", dbesc($item['parent_mid']), intval($item['uid']) ); } - else { - logger('no parent'); - return; - } } } + if (!$parent) { + logger('no parent'); + return; + } + if ($parent[0]['parent_mid'] !== $item['parent_mid']) { $item['thr_parent'] = $item['parent_mid']; } diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index 340f844d5..8bf3c51d5 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -904,11 +904,11 @@ class Libzot { $s = Libsync::sync_locations($arr, $arr); if ($s) { - if ($s['change_message']) + if (isset($s['change_message'])) $what .= $s['change_message']; - if ($s['changed']) + if (isset($s['changed'])) $changed = $s['changed']; - if ($s['message']) + if (isset($s['message'])) $ret['message'] .= $s['message']; } @@ -1769,7 +1769,7 @@ class Libzot { dbesc($arr['author_xchan']) ); - if (intval($arr['item_deleted'])) { + if (isset($arr['item_deleted']) && $arr['item_deleted']) { // remove_community_tag is a no-op if this isn't a community tag activity self::remove_community_tag($sender, $arr, $channel['channel_id']); @@ -2020,11 +2020,11 @@ class Libzot { $arr['owner_xchan'] = $a['signature']['signer']; } - if ($AS->meta['hubloc'] || $arr['author_xchan'] === $arr['owner_xchan']) { + if (isset($AS->meta['hubloc']) || $arr['author_xchan'] === $arr['owner_xchan']) { $arr['item_verified'] = true; } - if ($AS->meta['signed_data']) { + if (isset($AS->meta['signed_data'])) { IConfig::Set($arr, 'activitypub', 'signed_data', $AS->meta['signed_data'], false); $j = json_decode($AS->meta['signed_data'], true); if ($j) { @@ -2518,14 +2518,14 @@ class Libzot { $access_policy = ACCESS_PRIVATE; } - $directory_url = htmlspecialchars((string)$arr['directory_url'], ENT_COMPAT, 'UTF-8', false); - $url = htmlspecialchars((string)strtolower($arr['url']), ENT_COMPAT, 'UTF-8', false); - $sellpage = htmlspecialchars((string)$arr['sellpage'], ENT_COMPAT, 'UTF-8', false); - $site_location = htmlspecialchars((string)$arr['location'], ENT_COMPAT, 'UTF-8', false); - $site_realm = htmlspecialchars((string)$arr['realm'], ENT_COMPAT, 'UTF-8', false); - $site_project = htmlspecialchars((string)$arr['project'], ENT_COMPAT, 'UTF-8', false); - $site_crypto = ((array_key_exists('encryption', $arr) && is_array($arr['encryption'])) ? htmlspecialchars((string)implode(',', $arr['encryption']), ENT_COMPAT, 'UTF-8', false) : ''); - $site_version = ((array_key_exists('version', $arr)) ? htmlspecialchars((string)$arr['version'], ENT_COMPAT, 'UTF-8', false) : ''); + $directory_url = ((isset($arr['directory_url'])) ? htmlspecialchars($arr['directory_url'], ENT_COMPAT, 'UTF-8', false) : ''); + $url = ((isset($arr['url'])) ? htmlspecialchars(strtolower($arr['url']), ENT_COMPAT, 'UTF-8', false) : ''); + $sellpage = ((isset($arr['sellpage'])) ? htmlspecialchars($arr['sellpage'], ENT_COMPAT, 'UTF-8', false) : ''); + $site_location = ((isset($arr['location'])) ? htmlspecialchars($arr['location'], ENT_COMPAT, 'UTF-8', false) : ''); + $site_realm = ((isset($arr['realm'])) ? htmlspecialchars($arr['realm'], ENT_COMPAT, 'UTF-8', false) : ''); + $site_project = ((isset($arr['project'])) ? htmlspecialchars($arr['project'], ENT_COMPAT, 'UTF-8', false) : ''); + $site_crypto = ((isset($arr['encryption']) && is_array($arr['encryption'])) ? htmlspecialchars(implode(',', $arr['encryption']), ENT_COMPAT, 'UTF-8', false) : ''); + $site_version = ((isset($arr['version'])) ? htmlspecialchars($arr['version'], ENT_COMPAT, 'UTF-8', false) : ''); // You can have one and only one primary directory per realm. // Downgrade any others claiming to be primary. As they have @@ -3198,7 +3198,7 @@ class Libzot { } foreach ($arr as $v) { - if ($v[$check] === 'zot6') { + if (isset($v[$check]) && $v[$check] === 'zot6') { return $v; } } diff --git a/Zotlabs/Lib/Queue.php b/Zotlabs/Lib/Queue.php index 246b42667..a646aee6d 100644 --- a/Zotlabs/Lib/Queue.php +++ b/Zotlabs/Lib/Queue.php @@ -110,21 +110,30 @@ class Queue { return false; } + $hash = $arr['hash'] ?? ''; + $account_id = $arr['account_id'] ?? 0; + $channel_id = $arr['channel_id'] ?? 0; + $driver = $arr['driver'] ?? 'zot6'; + $posturl = $arr['posturl'] ?? ''; + $priority = $arr['priority'] ?? 0; + $priority = $arr['notify'] ?? ''; + $msg = $arr['msg'] ?? ''; + $x = q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_priority, outq_created, outq_updated, outq_scheduled, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', '%s', %d, %d, '%s', '%s', '%s', '%s', '%s' )", - dbesc($arr['hash']), - intval($arr['account_id']), - intval($arr['channel_id']), - dbesc(($arr['driver']) ? $arr['driver'] : 'zot6'), - dbesc($arr['posturl']), + dbesc($hash), + intval($account_id), + intval($channel_id), + dbesc($driver), + dbesc($posturl), intval(1), - intval(isset($arr['priority']) ? $arr['priority'] : 0), + intval($priority), dbesc(datetime_convert()), dbesc(datetime_convert()), dbesc(datetime_convert()), - dbesc($arr['notify']), - dbesc(($arr['msg']) ? $arr['msg'] : '') + dbesc($notify), + dbesc($msg) ); return $x; diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index f4f6cc8d1..279875544 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -129,6 +129,9 @@ class Network extends \Zotlabs\Web\Controller { $pf = ((x($_GET, 'pf')) ? $_GET['pf'] : ''); $unseen = ((x($_GET, 'unseen')) ? $_GET['unseen'] : ''); + $status_editor = ''; + + if (Apps::system_app_installed(local_channel(), 'Affinity Tool')) { $affinity_locked = intval(get_pconfig(local_channel(), 'affinity', 'lock', 1)); if ($affinity_locked) { @@ -208,6 +211,7 @@ class Network extends \Zotlabs\Web\Controller { 'reset' => t('Reset form') ); + $a = ''; $status_editor = status_editor($a, $x, false, 'Network'); $o .= $status_editor; diff --git a/Zotlabs/Module/Outbox.php b/Zotlabs/Module/Outbox.php index 503b464d1..24a3399a5 100644 --- a/Zotlabs/Module/Outbox.php +++ b/Zotlabs/Module/Outbox.php @@ -76,7 +76,7 @@ class Outbox extends Controller { App::set_pager_itemspage(30); } - if (App::$pager['unset'] && $total > 30) { + if (isset(App::$pager['unset']) && $total > 30) { $ret = Activity::paged_collection_init($total, App::$query_string); } else { diff --git a/include/channel.php b/include/channel.php index 68e7fdf31..a309fa5c8 100644 --- a/include/channel.php +++ b/include/channel.php @@ -1376,19 +1376,19 @@ function profile_load($nickname, $profile = '') { } // get the current observer - $observer = App::get_observer(); + $observer_hash = get_observer_hash(); $can_view_profile = true; // Can the observer see our profile? require_once('include/permissions.php'); - if(! perm_is_allowed($user[0]['channel_id'],$observer['xchan_hash'],'view_profile')) { + if(! perm_is_allowed($user[0]['channel_id'], $observer_hash, 'view_profile')) { $can_view_profile = false; } - if(! $profile) { + if($observer_hash && !$profile) { $r = q("SELECT abook_profile FROM abook WHERE abook_xchan = '%s' and abook_channel = '%d' limit 1", - dbesc($observer['xchan_hash']), + dbesc($observer_hash), intval($user[0]['channel_id']) ); if($r) @@ -1575,14 +1575,14 @@ function profile_edit_menu($uid) { */ function profile_sidebar($profile, $block = 0, $show_connect = true, $details = false) { - $observer = App::get_observer(); + $observer_hash = get_observer_hash(); $o = ''; $location = false; $pdesc = true; $reddress = true; - if(! perm_is_allowed($profile['uid'],((is_array($observer)) ? $observer['xchan_hash'] : ''),'view_profile')) { + if(! perm_is_allowed($profile['uid'], $observer_hash, 'view_profile')) { $block = true; } @@ -1654,7 +1654,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $details = $menu = get_pconfig($profile['uid'],'system','channel_menu'); if($menu && ! $block) { require_once('include/menu.php'); - $m = menu_fetch($menu,$profile['uid'],$observer['xchan_hash']); + $m = menu_fetch($menu,$profile['uid'], $observer_hash); if($m) $channel_menu = menu_render($m); } diff --git a/include/conversation.php b/include/conversation.php index 7df7b62c2..5f6bc1654 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -106,7 +106,7 @@ function localize_item(&$item){ $author_link = get_rel_link($obj['author']['link'],'alternate'); elseif(isset($obj['actor']) && isset($obj['actor']['url'])) $author_link = ((is_array($obj['actor']['url'])) ? $obj['actor']['url'][0]['href'] : $obj['actor']['url']); - elseif (is_string($obj['actor'])) + elseif (isset($obj['actor']) && is_string($obj['actor'])) $author_link = $obj['actor']; else $author_link = ''; @@ -116,7 +116,7 @@ function localize_item(&$item){ if(!$author_name) $author_name = $obj['actor']['name'] ?? ''; - if(!$author_name && is_string($obj['actor'])) { + if(!$author_name && isset($obj['actor']) && is_string($obj['actor'])) { $cached_actor = Activity::get_cached_actor($obj['actor']); if (is_array($cached_actor)) { $author_name = $cached_actor['name'] ?? $cached_actor['preferredUsername']; @@ -691,7 +691,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa ]; call_hooks('stream_item',$x); - if($x['item']['blocked']) + if(isset($x['item']['blocked']) && $x['item']['blocked']) continue; $item = $x['item']; @@ -964,14 +964,12 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa function best_link_url($item) { - - $best_url = ''; + $best_url = $item['author-link'] ?? $item['url'] ?? ''; $sparkle = false; - $clean_url = isset($item['author-link']) ? normalise_link($item['author-link']) : ''; - if((local_channel()) && (local_channel() == $item['uid'])) { - if(isset(App::$contacts) && x(App::$contacts,$clean_url)) { + if($clean_url && local_channel() && (local_channel() == $item['uid'])) { + if(isset(App::$contacts) && x(App::$contacts, $clean_url)) { if(App::$contacts[$clean_url]['network'] === NETWORK_DFRN) { $best_url = z_root() . '/redir/' . App::$contacts[$clean_url]['id']; $sparkle = true; @@ -980,12 +978,6 @@ function best_link_url($item) { $best_url = App::$contacts[$clean_url]['url']; } } - if(! $best_url) { - if($item['author-link']) - $best_url = $item['author-link']; - else - $best_url = $item['url']; - } return $best_url; } diff --git a/include/items.php b/include/items.php index c8b032806..be3c83f7d 100644 --- a/include/items.php +++ b/include/items.php @@ -974,10 +974,10 @@ function import_author_rss($x) { $r = xchan_store_lowlevel( [ - 'xchan_hash' => $x['guid'], - 'xchan_guid' => $x['guid'], - 'xchan_url' => $x['url'], - 'xchan_name' => (($name) ? $name : t('(Unknown)')), + 'xchan_hash' => $x['guid'] ?? '', + 'xchan_guid' => $x['guid'] ?? '', + 'xchan_url' => $x['url'] ?? '', + 'xchan_name' => $name ?? '(Unknown)', 'xchan_name_date' => datetime_convert(), 'xchan_network' => 'rss' ] @@ -3424,7 +3424,7 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false function check_item_source($uid, $item) { logger('source: uid: ' . $uid, LOGGER_DEBUG); - $xchan = (($item['source_xchan'] && intval($item['item_uplink'])) ? $item['source_xchan'] : $item['owner_xchan']); + $xchan = ((isset($item['source_xchan']) && $item['source_xchan'] && isset($item['item_uplink']) && $item['item_uplink']) ? $item['source_xchan'] : $item['owner_xchan']); $r = q("select * from source where src_channel_id = %d and ( src_xchan = '%s' or src_xchan = '*' ) limit 1", intval($uid), @@ -4352,7 +4352,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C ); } - if($arr['uid']) { + if(isset($arr['uid'])) { $uid = $arr['uid']; } @@ -4362,30 +4362,30 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C $item_uids = " item.uid = " . intval($uid) . " "; } - if($arr['top']) + if(isset($arr['top'])) $sql_options .= " and item_thread_top = 1 "; - if($arr['star']) + if(isset($arr['star'])) $sql_options .= " and item_starred = 1 "; - if($arr['wall']) + if(isset($arr['wall'])) $sql_options .= " and item_wall = 1 "; - if($arr['item_id']) + if(isset($arr['item_id'])) $sql_options .= " and parent = " . intval($arr['item_id']) . " "; - if($arr['mid']) + if(isset($arr['mid'])) $sql_options .= " and parent_mid = '" . dbesc($arr['mid']) . "' "; $sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE $item_uids and item_thread_top = 1 $sql_options $item_normal ) "; - if($arr['since_id']) + if(isset($arr['since_id'])) $sql_extra .= " and item.id > " . intval($arr['since_id']) . " "; - if($arr['cat']) + if(isset($arr['cat'])) $sql_extra .= protect_sprintf(term_query('item', $arr['cat'], TERM_CATEGORY)); - if($arr['gid'] && $uid) { + if(isset($arr['gid']) && $uid) { $r = q("SELECT * FROM pgrp WHERE id = %d AND uid = %d LIMIT 1", intval($arr['group']), intval($uid) @@ -4416,7 +4416,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C $x = AccessList::by_hash($uid, $r[0]['hash']); $result['headline'] = sprintf( t('Privacy group: %s'),$x['gname']); } - elseif($arr['cid'] && $uid) { + elseif(isset($arr['cid']) && $uid) { $r = q("SELECT abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash where abook_id = %d and abook_channel = %d and abook_blocked = 0 limit 1", intval($arr['cid']), @@ -4435,14 +4435,14 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C $sql_extra = " AND author_xchan = '" . $channel['channel_hash'] . "' and item_private = 0 $item_normal "; } - if ($arr['datequery']) { + if (isset($arr['datequery'])) { $sql_extra3 .= protect_sprintf(sprintf(" AND item.created <= '%s' ", dbesc(datetime_convert('UTC','UTC',$arr['datequery'])))); } - if ($arr['datequery2']) { + if (isset($arr['datequery2'])) { $sql_extra3 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert('UTC','UTC',$arr['datequery2'])))); } - if($arr['search']) { + if(isset($arr['search'])) { if(strpos($arr['search'],'#') === 0) $sql_extra .= term_query('item',substr($arr['search'],1),TERM_HASHTAG,TERM_COMMUNITYTAG); else @@ -4451,11 +4451,11 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C ); } - if($arr['file']) { + if(isset($arr['file'])) { $sql_extra .= term_query('item',$arr['files'],TERM_FILE); } - if($arr['conv'] && $channel) { + if(isset($arr['conv']) && $channel) { $sql_extra .= sprintf(" AND parent IN (SELECT distinct parent from item where ( author_xchan like '%s' or item_mentionsme = 1 )) ", dbesc(protect_sprintf($uidhash)) ); @@ -4465,7 +4465,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C // only setup pagination on initial page view $pager_sql = ''; } else { - if(! $arr['total']) { + if(!isset($arr['total'])) { $itemspage = (($channel) ? get_pconfig($uid,'system','itemspage') : 10); App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 10)); $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start'])); @@ -4505,19 +4505,19 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C require_once('include/security.php'); $sql_extra .= item_permissions_sql($channel['channel_id'],$observer_hash); - if($arr['pages']) + if(isset($arr['pages'])) $item_restrict = " AND item_type = " . ITEM_TYPE_WEBPAGE . " "; else $item_restrict = " AND item_type = 0 "; - if($arr['item_type'] === '*') + if(isset($arr['item_type']) && $arr['item_type'] === '*') $item_restrict = ''; - if ((($arr['compat']) || ($arr['nouveau'] && ($client_mode & CLIENT_MODE_LOAD))) && $channel) { + if (((isset($arr['compat'])) || (isset($arr['nouveau']) && ($client_mode & CLIENT_MODE_LOAD))) && $channel) { // "New Item View" - show all items unthreaded in reverse created date order - if ($arr['total']) { + if (isset($arr['total'])) { $items = dbq("SELECT count(item.id) AS total FROM item WHERE $item_uids $item_restrict $simple_update $sql_options @@ -4544,7 +4544,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C // Normal conversation view - if($arr['order'] === 'post') + if(isset($arr['order']) && $arr['order'] === 'post') $ordering = "created"; else $ordering = "commented"; diff --git a/include/network.php b/include/network.php index a236a6f8e..36859bc2f 100644 --- a/include/network.php +++ b/include/network.php @@ -1997,7 +1997,7 @@ function getBestSupportedMimeType($mimeTypes = null, $acceptedTypes = false) { $AcceptTypes = []; if($acceptedTypes === false) - $acceptedTypes = $_SERVER['HTTP_ACCEPT']; + $acceptedTypes = $_SERVER['HTTP_ACCEPT'] ?? ''; if (!$acceptedTypes) { return null; diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index 3fced76f2..14408ea50 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -263,16 +263,23 @@ function import_xchan_photo($photo, $xchan, $thing = false, $force = false) { $hdrs[strtolower($t)] = $v; } + $expires = time() + 86400; + if(array_key_exists('expires', $hdrs)) $expires = strtotime($hdrs['expires']); - if($expires - 60 < time()) - $expires = time() + 60; + + if($expires - 60 < time()) { + $expires = time() + 60; + } else { $cc = ''; - if(array_key_exists('cache-control', $hdrs)) + if(array_key_exists('cache-control', $hdrs)) { $cc = $hdrs['cache-control']; - if(strpos($cc, 'no-cache')) + } + + if(strpos($cc, 'no-cache')) { $expires = time() + 60; + } else { $ttl = (preg_match('/max-age=(\d+)/i', $cc, $o) ? intval($o[1]) : 86400); $expires = time() + $ttl; @@ -297,7 +304,7 @@ function import_xchan_photo($photo, $xchan, $thing = false, $force = false) { $micro = z_root() . '/photo/' . $hash . '-6'; if(isset($result)) q("UPDATE photo SET expires = '%s' WHERE xchan = '%s' and photo_usage = %d and imgscale IN (4, 5, 6)", - dbescdate(gmdate('Y-m-d H:i:s', (isset($expires) ? $expires : time() + 86400))), + dbescdate(gmdate('Y-m-d H:i:s', $expires)), dbesc($xchan), intval(PHOTO_XCHAN) ); diff --git a/include/text.php b/include/text.php index 63b472bbd..dde810e17 100644 --- a/include/text.php +++ b/include/text.php @@ -1544,8 +1544,10 @@ function link_compare($a, $b) { function theme_attachments(&$item) { + $s = ''; $arr = json_decode($item['attach'],true); + if(is_array($arr) && count($arr)) { $attaches = []; @@ -1568,13 +1570,15 @@ function theme_attachments(&$item) { $title = t('Size') . ' ' . (isset($r['length']) ? userReadableSize($r['length']) : t('unknown')); + $revision = $r['revision'] ?? ''; + require_once('include/channel.php'); if (isset($r['href'])) { if(is_foreigner($item['author_xchan'])) $url = $r['href']; else - $url = z_root() . '/magic?f=&owa=1&hash=' . $item['author_xchan'] . '&bdest=' . bin2hex($r['href'] . '/' . $r['revision']); + $url = z_root() . '/magic?f=&owa=1&hash=' . $item['author_xchan'] . '&bdest=' . bin2hex($r['href'] . '/' . $revision); } //$s .= '<a href="' . $url . '" title="' . $title . '" class="attachlink" >' . $icon . '</a>'; diff --git a/view/de-de/hstrings.php b/view/de-de/hstrings.php index 7321fac1c..7d800f75c 100644 --- a/view/de-de/hstrings.php +++ b/view/de-de/hstrings.php @@ -2858,7 +2858,6 @@ App::$strings["Send multi-media HTML articles"] = "Multimedia HTML Artikel verse App::$strings["Not supported by some microblog services such as Mastodon"] = "Wird von einigen Microblogging-Plattformen wie Mastodon nicht unterstützt"; App::$strings["Activitypub Protocol"] = "ActivityPub-Protokoll"; App::$strings["Your account on %s will expire in a few days."] = "Dein Konto auf %s wird in ein paar Tagen ablaufen."; -App::$strings["Your $Productname test account is about to expire."] = ""; App::$strings["Libertree Crosspost Connector Settings saved."] = ""; App::$strings["Libertree Crosspost Connector App"] = ""; App::$strings["Relay public posts to Libertree"] = ""; diff --git a/view/es-es/hstrings.php b/view/es-es/hstrings.php index 47a18171d..d34078fd0 100644 --- a/view/es-es/hstrings.php +++ b/view/es-es/hstrings.php @@ -677,7 +677,6 @@ App::$strings["Directory to store rotated logs"] = "Directorio para almacenar lo App::$strings["Logfile size in bytes before rotating"] = "Tamaño del fichero de informe en bytes antes de rotarlo"; App::$strings["Number of logfiles to retain"] = "Número de ficheros de informe que se deben retener"; App::$strings["Your account on %s will expire in a few days."] = "Su cuenta en %s caducará en unos pocos días."; -App::$strings["Your $Productname test account is about to expire."] = "Su cuenta de prueba de $Productname está a punto de caducar."; App::$strings["Hide Aside App"] = "App de ocultamiento del panel lateral"; App::$strings["Fade out aside areas after a while when using endless scroll"] = "Se desvanecen las áreas laterales cuando se usa un scroll sin fin"; App::$strings["Some setting"] = "Algunos ajustes"; diff --git a/view/fr/hstrings.php b/view/fr/hstrings.php index cdf233584..3cb997f6a 100644 --- a/view/fr/hstrings.php +++ b/view/fr/hstrings.php @@ -2248,7 +2248,6 @@ App::$strings["Diaspora Protocol Settings"] = "Paramètres du protocole Diaspora App::$strings["No username found in import file."] = "Pas de nom d'utilisateur dans le fichier d'import."; App::$strings["Unable to create a unique channel address. Import failed."] = "Impossible de créer une adresse de canal unique. Echec de l'import."; App::$strings["Your account on %s will expire in a few days."] = "Votre compte sur %s expirera dans quelques jours."; -App::$strings["Your $Productname test account is about to expire."] = "Votre compte de test $NomDeProduit est sur le point d'expirer."; App::$strings["Enable Rainbowtag"] = "Activer Rainbowtag"; App::$strings["Rainbowtag Settings"] = "Paramètres Rainbowtag"; App::$strings["Rainbowtag Settings saved."] = "Paramètres Rainbowtag sauvegardés."; diff --git a/view/it/hstrings.php b/view/it/hstrings.php index 1f5527946..956e0bea7 100644 --- a/view/it/hstrings.php +++ b/view/it/hstrings.php @@ -2188,7 +2188,6 @@ App::$strings["Diaspora Protocol Settings"] = ""; App::$strings["No username found in import file."] = ""; App::$strings["Unable to create a unique channel address. Import failed."] = "Impossibile creare un indirizzo univoco per il canale. L'import è fallito."; App::$strings["Your account on %s will expire in a few days."] = ""; -App::$strings["Your $Productname test account is about to expire."] = ""; App::$strings["Enable Rainbowtag"] = ""; App::$strings["Rainbowtag Settings"] = ""; App::$strings["Rainbowtag Settings saved."] = ""; diff --git a/view/nl/hstrings.php b/view/nl/hstrings.php index 3581950aa..63618df46 100644 --- a/view/nl/hstrings.php +++ b/view/nl/hstrings.php @@ -2248,7 +2248,6 @@ App::$strings["Diaspora Protocol Settings"] = "Diaspora-protocol (incl. Friendic App::$strings["No username found in import file."] = "Geen gebruikersnaam in het importbestand gevonden."; App::$strings["Unable to create a unique channel address. Import failed."] = "Niet in staat om een uniek kanaaladres aan te maken. Importeren is mislukt."; App::$strings["Your account on %s will expire in a few days."] = "Jouw account op %s verloopt over een paar dagen. "; -App::$strings["Your $Productname test account is about to expire."] = "Jouw $Productname-testaccount staat op het punt om te verlopen."; App::$strings["Enable Rainbowtag"] = "Rainbowtag inschakelen"; App::$strings["Rainbowtag Settings"] = "Rainbowtag"; App::$strings["Rainbowtag Settings saved."] = "Rainbowtag-instellingen opgeslagen."; diff --git a/view/pl/hstrings.php b/view/pl/hstrings.php index 68b4ff508..70b813769 100644 --- a/view/pl/hstrings.php +++ b/view/pl/hstrings.php @@ -684,7 +684,6 @@ App::$strings["Directory to store rotated logs"] = "Katalog do przechowywania ro App::$strings["Logfile size in bytes before rotating"] = "Rozmiar pliku dziennika w bajtach przed dokonaniem odnowienia"; App::$strings["Number of logfiles to retain"] = "Liczba plików dziennika do przechowania"; App::$strings["Your account on %s will expire in a few days."] = "Twoje konto na %s wygaśnie za kilka dni."; -App::$strings["Your $Productname test account is about to expire."] = "Twoje konto testowe $Productname wkrótce wygaśnie."; App::$strings["Hide Aside App"] = "Aplikacja Hide Aside"; App::$strings["Fade out aside areas after a while when using endless scroll"] = "Powoduje zanikanie obszaru po chwili, gdy używa się długiego przewijania"; App::$strings["Some setting"] = "Jakieś ustawienie"; diff --git a/view/ru/hstrings.php b/view/ru/hstrings.php index a20ede547..351c89383 100644 --- a/view/ru/hstrings.php +++ b/view/ru/hstrings.php @@ -2928,7 +2928,6 @@ App::$strings["Social authentication settings saved."] = "Настройки Soc App::$strings["Recent Channel/Profile Viewers"] = "Последние просмотры канала / профиля"; App::$strings["No entries."] = "Нет записей."; App::$strings["Your account on %s will expire in a few days."] = "Ваш аккаунт на %s перестанет работать через несколько дней."; -App::$strings["Your $Productname test account is about to expire."] = "аша тестовая учётная запись в $Productname близка к окончанию срока действия"; App::$strings["Post to Twitter"] = "Опубликовать в Twitter"; App::$strings["Submit Settings"] = "Отправить настройки"; App::$strings["Twitter settings updated."] = "Настройки Twitter обновлены"; |