$retrieveDescription
)
);
- if (! empty($title) && strtolower($charset) !== 'utf-8') {
+ if (! empty($title) && strtolower($charset) !== 'utf-8' && mb_check_encoding($charset)) {
$title = mb_convert_encoding($title, 'utf-8', $charset);
}
}
$title = $this->container->conf->get('general.default_note_title', t('Note: '));
}
- $link = escape([
+ $link = [
'title' => $title,
'url' => $url ?? '',
'description' => $description ?? '',
'tags' => $tags ?? '',
'private' => $private,
- ]);
+ ];
} else {
$formatter = $this->container->formatterFactory->getFormatter('raw');
$link = $formatter->format($bookmark);
$this->checkToken($request);
// lf_id should only be present if the link exists.
- $id = $request->getParam('lf_id') ? intval(escape($request->getParam('lf_id'))) : null;
+ $id = $request->getParam('lf_id') !== null ? intval(escape($request->getParam('lf_id'))) : null;
if (null !== $id && true === $this->container->bookmarkService->exists($id)) {
// Edit
$bookmark = $this->container->bookmarkService->get($id);
$tags[BookmarkMarkdownFormatter::NO_MD_TAG] = 1;
}
- $data = [
+ $data = escape([
'link' => $link,
'link_is_new' => $isNew,
- 'http_referer' => escape($this->container->environment['HTTP_REFERER'] ?? ''),
+ 'http_referer' => $this->container->environment['HTTP_REFERER'] ?? '',
'source' => $request->getParam('source') ?? '',
'tags' => $tags,
'default_private_links' => $this->container->conf->get('privacy.default_private_links', false),
- ];
+ ]);
$this->executePageHooks('render_editlink', $data, TemplatePage::EDIT_LINK);