]> git.mxchange.org Git - friendica-addons.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorMichael Vogel <icarus@dabo.de>
Thu, 7 Aug 2014 06:29:28 +0000 (08:29 +0200)
committerMichael Vogel <icarus@dabo.de>
Thu, 7 Aug 2014 06:29:28 +0000 (08:29 +0200)
appnet/appnet.php
convpath/convpath.php
fbpost/fbpost.php
fbsync/fbsync.php
gpluspost/gpluspost.php
jappixmini/jappixmini.php
privacy_image_cache/privacy_image_cache.php
statusnet/statusnet.php
twitter/twitter.php

index b74e29ff8c5ecb7bd31fbcc521db74b87dc1e6be..3a6046b3646b91a741d7e5641569c15a3f3ea96e 100644 (file)
@@ -968,10 +968,9 @@ function appnet_createpost($a, $uid, $post, $me, $user, $ownid, $createuser, $th
 
        if (sizeof($links)) {
                $link = array_pop($links);
-               $url = "[url=".$link."]".$link."[/url]";
-
-               $removedlink = trim(str_replace($url, "", $postarray['body']));
+               $url = str_replace(array('/', '.'), array('\/', '\.'), $link);
 
+               $removedlink = preg_replace("/\[url\=".$url."\](.*?)\[\/url\]/ism", '', $postarray['body']);
                if (($removedlink == "") OR strstr($postarray['body'], $removedlink))
                        $postarray['body'] = $removedlink;
 
index 9509369420fc4fbbcb5f18c0060dccd8c7587749..8deb46cf346cbc09c6a2e979f28b3476f8ed258f 100644 (file)
@@ -34,7 +34,8 @@ function convpath_page_header(&$a, &$o){
 
 function convpath_page_end(&$a, &$o){
        $o = convpath_convert($o);
-       $a->page['aside'] = convpath_convert($a->page['aside']);
+       if (isset($a->page['aside']))
+               $a->page['aside'] = convpath_convert($a->page['aside']);
 }
 
 function convpath_prepare_body_hook(&$a, &$o) {
index f4f29f1e827987c203a07999e97f9d4ba4ab0a81..579fb148c1f25b718d84ac462f4ec3c7e3122a16 100644 (file)
@@ -564,7 +564,7 @@ function fbpost_post_hook(&$a,&$b) {
 
                                if ($toplevel) {
                                        require_once("include/plaintext.php");
-                                       $msgarr = plaintext($a, $b, 0, false);
+                                       $msgarr = plaintext($a, $b, 0, false, 9);
                                        $msg = $msgarr["text"];
                                        $link = $msgarr["url"];
                                        $linkname = $msgarr["title"];
@@ -1050,11 +1050,25 @@ function fbpost_fetchwall($a, $uid) {
 
                        $type = $item->type;
 
-                       if(isset($item->picture) && isset($item->link))
-                               $content .= "\n".'[url='.$item->link.'][img]'.fpost_cleanpicture($item->picture).'[/img][/url]';
+                       if (isset($item->picture))
+                               $picture = $item->picture;
+
+                       if (($type == "photo") AND isset($item->object_id)) {
+                                logger('fbpost_fetchwall: fetching fbid '.$item->object_id, LOGGER_DEBUG);
+                               $url = "https://graph.facebook.com/".$item->object_id."?access_token=".$access_token;
+                               $feed = fetch_url($url);
+                               $data = json_decode($feed);
+                               if (isset($data->images)) {
+                                       $picture = $data->images[0]->source;
+                                       logger('fbpost_fetchwall: got fbid image '.$preview, LOGGER_DEBUG);
+                               }
+                       }
+
+                       if(($picture != "") && isset($item->link))
+                               $content .= "\n".'[url='.$item->link.'][img]'.$picture.'[/img][/url]';
                        else {
-                               if (isset($item->picture))
-                                       $content .= "\n".'[img]'.fpost_cleanpicture($item->picture).'[/img]';
+                               if ($picture != "")
+                                       $content .= "\n".'[img]'.$picture.'[/img]';
                                // if just a link, it may be a wall photo - check
                                if(isset($item->link))
                                        $content .= fbpost_get_photo($uid,$item->link);
@@ -1125,7 +1139,7 @@ function fbpost_get_photo($uid,$link) {
        $x = fetch_url('https://graph.facebook.com/'.$photo_id.'?access_token='.$access_token);
        $j = json_decode($x);
        if($j->picture)
-               return "\n\n".'[url='.$link.'][img]'.fpost_cleanpicture($j->picture).'[/img][/url]';
+               return "\n\n".'[url='.$link.'][img]'.$j->picture.'[/img][/url]';
 
        return "";
 }
index fc9d7c187db0ed2b5254737cc3b94437e39cc01c..fe5b6faf0ae8b5823498386a1c2899137a23ab8a 100644 (file)
@@ -213,6 +213,8 @@ function fbsync_expire($a,$b) {
 
 function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $create_user) {
 
+       $access_token = get_pconfig($uid,'facebook','access_token');
+
        require_once("include/oembed.php");
 
        // check if it was already imported
@@ -365,10 +367,23 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr
                        if (isset($media->src))
                                $preview = $media->src;
 
-                       if (isset($media->photo))
+                       if (isset($media->photo)) {
                                if (isset($media->photo->images) AND (count($media->photo->images) > 1))
                                        $preview = $media->photo->images[1]->src;
 
+                               if (isset($media->photo->fbid)) {
+                                       logger('fbsync_createpost: fetching fbid '.$media->photo->fbid, LOGGER_DEBUG);
+                                       $url = "https://graph.facebook.com/".$media->photo->fbid."?access_token=".$access_token;
+                                       $feed = fetch_url($url);
+                                       $data = json_decode($feed);
+                                       if (isset($data->images)) {
+                                               $preview = $data->images[0]->source;
+                                               logger('fbsync_createpost: got fbid '.$media->photo->fbid.' image '.$preview, LOGGER_DEBUG);
+                                       } else
+                                               logger('fbsync_createpost: error fetching fbid '.$media->photo->fbid.' '.print_r($data, true), LOGGER_DEBUG);
+                               }
+                       }
+
                        if (isset($media->href) AND ($preview != "") AND ($media->href != ""))
                                $content .= "\n".'[url='.$media->href.'][img]'.$preview.'[/img][/url]';
                        else {
index 415e031b2629780a43f5cf75bfcae567922cd052..1df6e7500858e72062cb06314e62fd070df3ce92 100644 (file)
@@ -271,7 +271,7 @@ function gpluspost_send(&$a,&$b) {
                        $item["body"] = preg_replace("(\[i\](.*?)\[\/i\])ism",'_$1_',$item["body"]);
                        $item["body"] = preg_replace("(\[s\](.*?)\[\/s\])ism",'-$1-',$item["body"]);
 
-                       $data = plaintext($a, $item, 0, false);
+                       $data = plaintext($a, $item, 0, false, 9);
 
                        logger('gpluspost_send: data: '.print_r($data, true), LOGGER_DEBUG);
 
index f998acd13646a3f3937f50a474d289ae94d0db26..73062aae2050caa9d0a6d027083955e38883b2cf 100644 (file)
@@ -485,7 +485,8 @@ function jappixmini_script(&$a,&$s) {
                dbesc($dfrn_id),
                dbesc($dfrn_id)
        );
-       $name = $r[0]["name"];
+       if (count($r))
+               $name = $r[0]["name"];
 
         $value = $row['v'];
         $pos = strpos($value, ":");
index 0a6d8be1de3002614f0d5eef44a6080deb8bb68e..930fab538cdac73843eadff2320f2dd64d5f5466 100644 (file)
@@ -307,8 +307,8 @@ function privacy_image_cache_img_cb($matches) {
                $matches[2] = urldecode($queryvar['url']);
 
        // if fetching facebook pictures don't fetch the thumbnail but the big one
-       if (((strpos($matches[2], ".fbcdn.net/") OR strpos($matches[2], "/fbcdn-photos-"))) and (substr($matches[2], -6) == "_s.jpg"))
-               $matches[2] = substr($matches[2], 0, -6)."_n.jpg";
+       //if (((strpos($matches[2], ".fbcdn.net/") OR strpos($matches[2], "/fbcdn-photos-"))) and (substr($matches[2], -6) == "_s.jpg"))
+       //      $matches[2] = substr($matches[2], 0, -6)."_n.jpg";
 
        // following line changed per bug #431
        if (privacy_image_cache_is_local_image($matches[2]))
index 0cabbca8de2895c78d2b68693a01435b9c82db97..b7ba8d7d6363c6a2f3a6da9a1f640e85a3380c63 100644 (file)
@@ -1538,7 +1538,7 @@ function statusnet_convertmsg($a, $body, $no_tags = false) {
                if (($footerlink != "") AND (trim($footer) != "")) {
                        $removedlink = trim(str_replace($footerlink, "", $body));
 
-                       if (strstr($body, $removedlink))
+                       if (($removedlink == "") OR strstr($body, $removedlink))
                                $body = $removedlink;
 
                        $body .= $footer;
index 25c64b481a068655eafaa206e0d2cc1da6fe8ff0..c961b6a9955a337b997d1aee5f2fc9ffd11eaeb6 100644 (file)
@@ -1142,7 +1142,7 @@ function twitter_expand_entities($a, $body, $item, $no_tags = false, $picture) {
                if (($footerlink != "") AND (trim($footer) != "")) {
                        $removedlink = trim(str_replace($footerlink, "", $body));
 
-                       if (strstr($body, $removedlink))
+                       if (($removedlink == "") OR strstr($body, $removedlink))
                                $body = $removedlink;
 
                        $body .= $footer;