]> git.mxchange.org Git - friendica.git/commitdiff
oembed: replace base64 url for iframe with url site/oembed/url_encoded
authorFabio Comuni <fabrix.xm@gmail.com>
Fri, 11 Nov 2011 16:33:32 +0000 (17:33 +0100)
committerFabio Comuni <fabrix.xm@gmail.com>
Fri, 11 Nov 2011 16:33:32 +0000 (17:33 +0100)
fix http://bugs.friendika.com/view.php?id=191

include/oembed.php
mod/oembed.php [new file with mode: 0644]

index 3e86627e4dd384683a96e834bd8ec56503ce90a3..7c0da459409c2859ac543cfa88cf79f6a4450cf4 100644 (file)
@@ -56,7 +56,7 @@ function oembed_fetch_url($embedurl){
        
 function oembed_format_object($j){
        $embedurl = $j->embedurl;
-       $jhtml = oembed_iframe($j->html,$j->width,$j->height );
+       $jhtml = oembed_iframe($j->embedurl,$j->width,$j->height );
        $ret="<span class='oembed ".$j->type."'>";
        switch ($j->type) {
                case "video": {
@@ -116,7 +116,9 @@ function oembed_iframe($src,$width,$height) {
        $height = intval($height) + 80;
        $width  = intval($width) + 40;
 
-       $s = 'data:text/html;base64,' . base64_encode('<html><body>' . $src . '</body></html>');
+       $a = get_app();
+
+       $s = $a->get_baseurl()."/oembed/".base64url_encode($src);
        return '<iframe height="' . $height . '" width="' . $width . '" src="' . $s . '" frameborder="no" >' . t('Embedded content') . '</iframe>'; 
 
 }
diff --git a/mod/oembed.php b/mod/oembed.php
new file mode 100644 (file)
index 0000000..2599581
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+require_once("include/oembed.php");
+
+function oembed_content(&$a){
+       if ($a->argc == 2){
+               echo "<html><body>";
+               $url = base64url_decode($a->argv[1]);
+               $j = oembed_fetch_url($url);
+               echo $j->html;
+               echo "</body></html>";
+       }
+       killme();
+}