]> git.mxchange.org Git - friendica.git/blobdiff - mod/oexchange.php
Merge pull request #10229 from MrPetovan/bug/fatal-errors
[friendica.git] / mod / oexchange.php
index 4746651c16985262ff3732bc00deac1ac8d9cc65..7de4acadfeb3043f63131eac4678fa45b7d7a27a 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -44,20 +44,15 @@ function oexchange_content(App $a) {
        }
 
        if (($a->argc > 1) && $a->argv[1] === 'done') {
-               info(DI::l10n()->t('Post successful.') . EOL);
                return;
        }
 
-       $url = ((!empty($_REQUEST['url']))
-               ? urlencode(Strings::escapeTags(trim($_REQUEST['url']))) : '');
-       $title = ((!empty($_REQUEST['title']))
-               ? '&title=' . urlencode(Strings::escapeTags(trim($_REQUEST['title']))) : '');
-       $description = ((!empty($_REQUEST['description']))
-               ? '&description=' . urlencode(Strings::escapeTags(trim($_REQUEST['description']))) : '');
-       $tags = ((!empty($_REQUEST['tags']))
-               ? '&tags=' . urlencode(Strings::escapeTags(trim($_REQUEST['tags']))) : '');
+       $url         = !empty($_REQUEST['url'])         ? trim($_REQUEST['url'])         : '';
+       $title       = !empty($_REQUEST['title'])       ? trim($_REQUEST['title'])       : '';
+       $description = !empty($_REQUEST['description']) ? trim($_REQUEST['description']) : '';
+       $tags        = !empty($_REQUEST['tags'])        ? trim($_REQUEST['tags'])        : '';
 
-       $s = DI::httpRequest()->fetchUrl(DI::baseUrl() . '/parse_url?url=' . $url . $title . $description . $tags);
+       $s = \Friendica\Content\Text\BBCode::embedURL($url, true, $title, $description, $tags);
 
        if (!strlen($s)) {
                return;