Merge branch 'master' into develop
This commit is contained in:
commit
27d94023ee
70 changed files with 27138 additions and 26508 deletions
|
@ -5931,10 +5931,12 @@ function api_saved_searches_list($type)
|
|||
$result = [];
|
||||
while ($term = $terms->fetch()) {
|
||||
$result[] = [
|
||||
'name' => $term['term'],
|
||||
'query' => $term['term'],
|
||||
'created_at' => api_date(time()),
|
||||
'id' => intval($term['id']),
|
||||
'id_str' => $term['id'],
|
||||
'id' => intval($term['id'])
|
||||
'name' => $term['term'],
|
||||
'position' => null,
|
||||
'query' => $term['term']
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -443,7 +443,7 @@ These Fields are not added below (yet). They are here to for bug search.
|
|||
return "`item`.`author-id`, `item`.`author-link`, `item`.`author-name`, `item`.`author-avatar`,
|
||||
`item`.`owner-id`, `item`.`owner-link`, `item`.`owner-name`, `item`.`owner-avatar`,
|
||||
`item`.`contact-id`, `item`.`uid`, `item`.`id`, `item`.`parent`,
|
||||
`item`.`uri`, `item`.`thr-parent`, `item`.`parent-uri`,
|
||||
`item`.`uri`, `item`.`thr-parent`, `item`.`parent-uri`, `item`.`content-warning`,
|
||||
`item`.`commented`, `item`.`created`, `item`.`edited`, `item`.`received`,
|
||||
`item`.`verb`, `item`.`object-type`, `item`.`postopts`, `item`.`plink`,
|
||||
`item`.`guid`, `item`.`wall`, `item`.`private`, `item`.`starred`,
|
||||
|
@ -1245,7 +1245,7 @@ function format_like($cnt, array $arr, $type, $id) {
|
|||
break;
|
||||
case 'attendmaybe':
|
||||
$phrase = L10n::t('<span %1$s>%2$d people</span> attend maybe', $spanatts, $cnt);
|
||||
$explikers = L10n::t('%s anttend maybe.', $likers);
|
||||
$explikers = L10n::t('%s attend maybe.', $likers);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1643,7 +1643,7 @@ function get_responses($conv_responses, $response_verbs, $ob, $item) {
|
|||
foreach ($response_verbs as $v) {
|
||||
$ret[$v] = [];
|
||||
$ret[$v]['count'] = defaults($conv_responses[$v], $item['uri'], '');
|
||||
$ret[$v]['list'] = defaults($conv_responses[$v], $item['uri'] . '-l', '');
|
||||
$ret[$v]['list'] = defaults($conv_responses[$v], $item['uri'] . '-l', []);
|
||||
$ret[$v]['self'] = defaults($conv_responses[$v], $item['uri'] . '-self', '0');
|
||||
if (count($ret[$v]['list']) > MAX_LIKERS) {
|
||||
$ret[$v]['list_part'] = array_slice($ret[$v]['list'], 0, MAX_LIKERS);
|
||||
|
|
|
@ -16,10 +16,10 @@ use Friendica\Util\Emailer;
|
|||
* @brief Creates a notification entry and possibly sends a mail
|
||||
*
|
||||
* @param array $params Array with the elements:
|
||||
uid, item, parent, type, otype, verb, event,
|
||||
link, subject, body, to_name, to_email, source_name,
|
||||
source_link, activity, preamble, notify_flags,
|
||||
language, show_in_notification_page
|
||||
* uid, item, parent, type, otype, verb, event,
|
||||
* link, subject, body, to_name, to_email, source_name,
|
||||
* source_link, activity, preamble, notify_flags,
|
||||
* language, show_in_notification_page
|
||||
*/
|
||||
function notification($params)
|
||||
{
|
||||
|
@ -368,7 +368,7 @@ function notification($params)
|
|||
'[url='.$params['source_link'].']'.$params['source_name'].'[/url]'
|
||||
);
|
||||
|
||||
$body = L10n::t('Full Name: %1$s\nSite Location: %2$s\nLogin Name: %3$s ' . "\x28" . '%4$s' . "\x28",
|
||||
$body = L10n::t('Full Name: %1$s\nSite Location: %2$s\nLogin Name: %3$s ' . "\x28" . '%4$s' . "\x29",
|
||||
$params['source_name'],
|
||||
$siteurl, $params['source_mail'],
|
||||
$params['source_nick']
|
||||
|
|
|
@ -38,9 +38,9 @@ function format_event_html($ev, $simple = false) {
|
|||
);
|
||||
|
||||
if ($simple) {
|
||||
$o = "<h3>" . BBCode::convert($ev['summary']) . "</h3>";
|
||||
$o = "<h3>" . BBCode::convert($ev['summary'], false, $simple) . "</h3>";
|
||||
|
||||
$o .= "<div>" . BBCode::convert($ev['desc']) . "</div>";
|
||||
$o .= "<p>" . BBCode::convert($ev['desc'], false, $simple) . "</p>";
|
||||
|
||||
$o .= "<h4>" . L10n::t('Starts:') . "</h4><p>" . $event_start . "</p>";
|
||||
|
||||
|
@ -49,7 +49,7 @@ function format_event_html($ev, $simple = false) {
|
|||
}
|
||||
|
||||
if (strlen($ev['location'])) {
|
||||
$o .= "<h4>" . L10n::t('Location:') . "</h4><p>" . $ev['location'] . "</p>";
|
||||
$o .= "<h4>" . L10n::t('Location:') . "</h4><p>" . BBCode::convert($ev['location'], false, $simple) . "</p>";
|
||||
}
|
||||
|
||||
return $o;
|
||||
|
@ -57,7 +57,7 @@ function format_event_html($ev, $simple = false) {
|
|||
|
||||
$o = '<div class="vevent">' . "\r\n";
|
||||
|
||||
$o .= '<div class="summary event-summary">' . BBCode::convert($ev['summary']) . '</div>' . "\r\n";
|
||||
$o .= '<div class="summary event-summary">' . BBCode::convert($ev['summary'], false, $simple) . '</div>' . "\r\n";
|
||||
|
||||
$o .= '<div class="event-start"><span class="event-label">' . L10n::t('Starts:') . '</span> <span class="dtstart" title="'
|
||||
. DateTimeFormat::utc($ev['start'], (($ev['adjust']) ? DateTimeFormat::ATOM : 'Y-m-d\TH:i:s' ))
|
||||
|
@ -71,16 +71,16 @@ function format_event_html($ev, $simple = false) {
|
|||
. '</span></div>' . "\r\n";
|
||||
}
|
||||
|
||||
$o .= '<div class="description event-description">' . BBCode::convert($ev['desc']) . '</div>' . "\r\n";
|
||||
$o .= '<div class="description event-description">' . BBCode::convert($ev['desc'], false, $simple) . '</div>' . "\r\n";
|
||||
|
||||
if (strlen($ev['location'])) {
|
||||
$o .= '<div class="event-location"><span class="event-label">' . L10n::t('Location:') . '</span> <span class="location">'
|
||||
. BBCode::convert($ev['location'])
|
||||
. BBCode::convert($ev['location'], false, $simple)
|
||||
. '</span></div>' . "\r\n";
|
||||
|
||||
// Include a map of the location if the [map] BBCode is used.
|
||||
if (strpos($ev['location'], "[map") !== false) {
|
||||
$map = Map::byLocation($ev['location']);
|
||||
$map = Map::byLocation($ev['location'], $simple);
|
||||
if ($map !== $ev['location']) {
|
||||
$o.= $map;
|
||||
}
|
||||
|
@ -241,14 +241,20 @@ function event_store($arr) {
|
|||
|
||||
$a = get_app();
|
||||
|
||||
$arr['created'] = (($arr['created']) ? $arr['created'] : DateTimeFormat::utcNow());
|
||||
$arr['edited'] = (($arr['edited']) ? $arr['edited'] : DateTimeFormat::utcNow());
|
||||
$arr['created'] = (($arr['created']) ? DateTimeFormat::utc($arr['created']) : DateTimeFormat::utcNow());
|
||||
$arr['edited'] = (($arr['edited']) ? DateTimeFormat::utc($arr['edited']) : DateTimeFormat::utcNow());
|
||||
$arr['start'] = (($arr['start']) ? DateTimeFormat::utc($arr['start']) : NULL_DATE);
|
||||
$arr['finish'] = (($arr['finish']) ? DateTimeFormat::utc($arr['finish']) : NULL_DATE);
|
||||
$arr['type'] = (($arr['type']) ? $arr['type'] : 'event' );
|
||||
$arr['cid'] = ((intval($arr['cid'])) ? intval($arr['cid']) : 0);
|
||||
$arr['uri'] = (x($arr, 'uri') ? $arr['uri'] : item_new_uri($a->get_hostname(), $arr['uid']));
|
||||
$arr['private'] = ((x($arr, 'private')) ? intval($arr['private']) : 0);
|
||||
$arr['guid'] = get_guid(32);
|
||||
|
||||
if ($arr['finish'] < NULL_DATE) {
|
||||
$arr['finish'] = NULL_DATE;
|
||||
}
|
||||
|
||||
if ($arr['cid']) {
|
||||
$c = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($arr['cid']),
|
||||
|
|
|
@ -228,7 +228,7 @@ function add_page_info_to_body($body, $texturl = false, $no_photos = false) {
|
|||
*
|
||||
* @TODO find proper type-hints
|
||||
*/
|
||||
function consume_feed($xml, $importer, &$contact, &$hub, $datedir = 0, $pass = 0) {
|
||||
function consume_feed($xml, $importer, $contact, &$hub, $datedir = 0, $pass = 0) {
|
||||
if ($contact['network'] === NETWORK_OSTATUS) {
|
||||
if ($pass < 2) {
|
||||
// Test - remove before flight
|
||||
|
@ -290,7 +290,7 @@ function subscribe_to_hub($url, $importer, $contact, $hubmode = 'subscribe') {
|
|||
return;
|
||||
}
|
||||
|
||||
$push_url = Config::get('system','url') . '/pubsub/' . $r[0]['nickname'] . '/' . $contact['id'];
|
||||
$push_url = System::baseUrl() . '/pubsub/' . $r[0]['nickname'] . '/' . $contact['id'];
|
||||
|
||||
// Use a single verify token, even if multiple hubs
|
||||
$verify_token = ((strlen($contact['hub-verify'])) ? $contact['hub-verify'] : random_string());
|
||||
|
|
125
include/text.php
125
include/text.php
|
@ -1062,7 +1062,7 @@ function linkify($s) {
|
|||
* Load poke verbs
|
||||
*
|
||||
* @return array index is present tense verb
|
||||
value is array containing past tense verb, translation of present, translation of past
|
||||
* value is array containing past tense verb, translation of present, translation of past
|
||||
* @hook poke_verbs pokes array
|
||||
*/
|
||||
function get_poke_verbs() {
|
||||
|
@ -1169,8 +1169,25 @@ function redir_private_images($a, &$item)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the "rendered-html" field of the provided item
|
||||
*
|
||||
* Body is preserved to avoid side-effects as we modify it just-in-time for spoilers and private image links
|
||||
*
|
||||
* @param array $item
|
||||
* @param bool $update
|
||||
*
|
||||
* @todo Remove reference, simply return "rendered-html" and "rendered-hash"
|
||||
*/
|
||||
function put_item_in_cache(&$item, $update = false)
|
||||
{
|
||||
$body = $item["body"];
|
||||
|
||||
// Add the content warning
|
||||
if (!empty($item['content-warning'])) {
|
||||
$item["body"] = $item['content-warning'] . '[spoiler]' . $item["body"] . '[/spoiler]';
|
||||
}
|
||||
|
||||
$rendered_hash = defaults($item, 'rendered-hash', '');
|
||||
|
||||
if ($rendered_hash == ''
|
||||
|
@ -1178,22 +1195,19 @@ function put_item_in_cache(&$item, $update = false)
|
|||
|| $rendered_hash != hash("md5", $item["body"])
|
||||
|| Config::get("system", "ignore_cache")
|
||||
) {
|
||||
// The function "redir_private_images" changes the body.
|
||||
// I'm not sure if we should store it permanently, so we save the old value.
|
||||
$body = $item["body"];
|
||||
|
||||
$a = get_app();
|
||||
redir_private_images($a, $item);
|
||||
|
||||
$item["rendered-html"] = prepare_text($item["body"]);
|
||||
$item["rendered-hash"] = hash("md5", $item["body"]);
|
||||
$item["body"] = $body;
|
||||
|
||||
if ($update && ($item["id"] > 0)) {
|
||||
dba::update('item', ['rendered-html' => $item["rendered-html"], 'rendered-hash' => $item["rendered-hash"]],
|
||||
['id' => $item["id"]], false);
|
||||
}
|
||||
}
|
||||
|
||||
$item["body"] = $body;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1281,62 +1295,55 @@ function prepare_body(&$item, $attach = false, $preview = false) {
|
|||
|
||||
$as = '';
|
||||
$vhead = false;
|
||||
$arr = explode('[/attach],', $item['attach']);
|
||||
if (count($arr)) {
|
||||
foreach ($arr as $r) {
|
||||
$matches = false;
|
||||
$icon = '';
|
||||
$cnt = preg_match_all('|\[attach\]href=\"(.*?)\" length=\"(.*?)\" type=\"(.*?)\" title=\"(.*?)\"|',$r ,$matches, PREG_SET_ORDER);
|
||||
if ($cnt) {
|
||||
foreach ($matches as $mtch) {
|
||||
$mime = $mtch[3];
|
||||
$matches = [];
|
||||
preg_match_all('|\[attach\]href=\"(.*?)\" length=\"(.*?)\" type=\"(.*?)\"(?: title=\"(.*?)\")?|', $item['attach'], $matches, PREG_SET_ORDER);
|
||||
foreach ($matches as $mtch) {
|
||||
$mime = $mtch[3];
|
||||
|
||||
if ((local_user() == $item['uid']) && ($item['contact-id'] != $a->contact['id']) && ($item['network'] == NETWORK_DFRN)) {
|
||||
$the_url = 'redir/' . $item['contact-id'] . '?f=1&url=' . $mtch[1];
|
||||
} else {
|
||||
$the_url = $mtch[1];
|
||||
}
|
||||
|
||||
if (strpos($mime, 'video') !== false) {
|
||||
if (!$vhead) {
|
||||
$vhead = true;
|
||||
$a->page['htmlhead'] .= replace_macros(get_markup_template('videos_head.tpl'), [
|
||||
'$baseurl' => System::baseUrl(),
|
||||
]);
|
||||
$a->page['end'] .= replace_macros(get_markup_template('videos_end.tpl'), [
|
||||
'$baseurl' => System::baseUrl(),
|
||||
]);
|
||||
}
|
||||
|
||||
$id = end(explode('/', $the_url));
|
||||
$as .= replace_macros(get_markup_template('video_top.tpl'), [
|
||||
'$video' => [
|
||||
'id' => $id,
|
||||
'title' => L10n::t('View Video'),
|
||||
'src' => $the_url,
|
||||
'mime' => $mime,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
$filetype = strtolower(substr($mime, 0, strpos($mime, '/')));
|
||||
if ($filetype) {
|
||||
$filesubtype = strtolower(substr($mime, strpos($mime, '/') + 1));
|
||||
$filesubtype = str_replace('.', '-', $filesubtype);
|
||||
} else {
|
||||
$filetype = 'unkn';
|
||||
$filesubtype = 'unkn';
|
||||
}
|
||||
|
||||
$title = ((strlen(trim($mtch[4]))) ? escape_tags(trim($mtch[4])) : escape_tags($mtch[1]));
|
||||
$title .= ' ' . $mtch[2] . ' ' . L10n::t('bytes');
|
||||
|
||||
$icon = '<div class="attachtype icon s22 type-' . $filetype . ' subtype-' . $filesubtype . '"></div>';
|
||||
$as .= '<a href="' . strip_tags($the_url) . '" title="' . $title . '" class="attachlink" target="_blank" >' . $icon . '</a>';
|
||||
}
|
||||
}
|
||||
if ((local_user() == $item['uid']) && ($item['contact-id'] != $a->contact['id']) && ($item['network'] == NETWORK_DFRN)) {
|
||||
$the_url = 'redir/' . $item['contact-id'] . '?f=1&url=' . $mtch[1];
|
||||
} else {
|
||||
$the_url = $mtch[1];
|
||||
}
|
||||
|
||||
if (strpos($mime, 'video') !== false) {
|
||||
if (!$vhead) {
|
||||
$vhead = true;
|
||||
$a->page['htmlhead'] .= replace_macros(get_markup_template('videos_head.tpl'), [
|
||||
'$baseurl' => System::baseUrl(),
|
||||
]);
|
||||
$a->page['end'] .= replace_macros(get_markup_template('videos_end.tpl'), [
|
||||
'$baseurl' => System::baseUrl(),
|
||||
]);
|
||||
}
|
||||
|
||||
$id = end(explode('/', $the_url));
|
||||
$as .= replace_macros(get_markup_template('video_top.tpl'), [
|
||||
'$video' => [
|
||||
'id' => $id,
|
||||
'title' => L10n::t('View Video'),
|
||||
'src' => $the_url,
|
||||
'mime' => $mime,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
$filetype = strtolower(substr($mime, 0, strpos($mime, '/')));
|
||||
if ($filetype) {
|
||||
$filesubtype = strtolower(substr($mime, strpos($mime, '/') + 1));
|
||||
$filesubtype = str_replace('.', '-', $filesubtype);
|
||||
} else {
|
||||
$filetype = 'unkn';
|
||||
$filesubtype = 'unkn';
|
||||
}
|
||||
|
||||
$title = escape_tags(trim(!empty($mtch[4]) ? $mtch[4] : $mtch[1]));
|
||||
$title .= ' ' . $mtch[2] . ' ' . L10n::t('bytes');
|
||||
|
||||
$icon = '<div class="attachtype icon s22 type-' . $filetype . ' subtype-' . $filesubtype . '"></div>';
|
||||
$as .= '<a href="' . strip_tags($the_url) . '" title="' . $title . '" class="attachlink" target="_blank" >' . $icon . '</a>';
|
||||
}
|
||||
|
||||
if ($as != '') {
|
||||
$s .= '<div class="body-attach">'.$as.'<div class="clear"></div></div>';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue