]> git.mxchange.org Git - friendica-addons.git/commitdiff
Merge pull request #184 from annando/master
authortobiasd <tobias.diekershoff@gmx.net>
Sun, 2 Mar 2014 07:28:58 +0000 (08:28 +0100)
committertobiasd <tobias.diekershoff@gmx.net>
Sun, 2 Mar 2014 07:28:58 +0000 (08:28 +0100)
New function for pictures, calculation period of "statistics" changed

appnetpost/appnetpost.php
fbpost/fbpost.php
fbsync/fbsync.php
fromgplus/fromgplus.php
gpluspost/gpluspost.php
privacy_image_cache/privacy_image_cache.php
statistics_json/statistics_json.php
statusnet/statusnet.php
twitter/twitter.php

index d3f6c19a69fc1483de275e4c0bfcc49864c4f87b..a5c5e8c5fdd388ac22c005ce301d96a4256478e5 100644 (file)
@@ -288,6 +288,8 @@ function appnetpost_feeditem($pid, $uid) {
        $items = q("SELECT `uri`, `plink`, `author-link`, `author-name`, `created`, `edited`, `id`, `title`, `body` from `item` WHERE id=%d", intval($pid));
        foreach ($items AS $item) {
 
+               $item['body'] = bb_CleanPictureLinks($item['body']);
+
                // Looking for the first image
                $image = '';
                if(preg_match("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/is",$item['body'],$matches))
index e6683282d680e89a65288061663463ef426fe675..3b064a56a9ab308e52aa63dda8b7ac77fdfe8b61 100644 (file)
@@ -363,6 +363,8 @@ function fbpost_createmsg($b) {
        require_once("include/bbcode.php");
        require_once("include/html2plain.php");
 
+       $b['body'] = bb_CleanPictureLinks($b['body']);
+
        // Looking for the first image
        $image = '';
        if(preg_match("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/is",$b['body'],$matches))
@@ -632,6 +634,7 @@ function fbpost_post_hook(&$a,&$b) {
 
                                logger('fbpost_post_hook: original msg=' . $msg, LOGGER_DATA);
 
+                               // To-Do: if it is a reply, then only do a simple bbcode2plain conversion
                                $msgarr = fbpost_createmsg($b);
                                $msg = $msgarr["msg"];
                                $link = $msgarr["link"];
@@ -768,7 +771,7 @@ function fbpost_post_hook(&$a,&$b) {
 
                                                // If it is a special kind of failure the post was receiced
                                                // Although facebook said it wasn't received ...
-                                               if (!$likes AND (($retj->error->type != "OAuthException") OR ($retj->error->code != 2))) {
+                                               if (!$likes AND (($retj->error->type != "OAuthException") OR ($retj->error->code != 2)) AND ($x <> "")) {
                                                        $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", intval($b['uid']));
                                                        if (count($r))
                                                                $a->contact = $r[0]["id"];
@@ -920,7 +923,7 @@ function fbpost_queue_hook(&$a,&$b) {
                                        // If it is a special kind of failure the post was receiced
                                        // Although facebook said it wasn't received ...
                                        $ret = json_decode($j);
-                                       if (($ret->error->type != "OAuthException") OR ($ret->error->code != 2))
+                                       if (($ret->error->type != "OAuthException") OR ($ret->error->code != 2) AND ($j <> ""))
                                                update_queue_time($x['id']);
                                        else
                                                logger('fbpost_queue_hook: Not requeued, since it seems to be received');
@@ -1109,7 +1112,7 @@ function fbpost_fetchwall($a, $uid) {
                        $_REQUEST["body"] .= "[class=type-".$type."]";
 
                if ($content)
-                       $_REQUEST["body"] .= $content;
+                       $_REQUEST["body"] .= trim($content);
 
                if ($quote)
                        $_REQUEST["body"] .= "\n[quote]".$quote."[/quote]";
index b4a191ca26ea6bf2ad8ffc09450bc3c6a8165cb0..ee70481c0a980b3734a7185dcc123324fe10a3ea 100644 (file)
@@ -328,7 +328,7 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr
                $postarray["body"] .= "[class=type-".$type."]";
 
        if ($content)
-               $postarray["body"] .= $content;
+               $postarray["body"] .= trim($content);
 
        if ($quote)
                $postarray["body"] .= "\n[quote]".trim($quote)."[/quote]";
index 1c047663fb661557a9e54eba4fa6210b8ab1fc55..343edae7ca55f71b674873f13421ab4b64b3fbd3 100644 (file)
@@ -271,7 +271,7 @@ function fromgplus_handleattachments($item, $displaytext) {
                                //elseif ($images["full"] != "")
                                //      $post .= "\n[img]".$images["full"]."[/img]\n";
                                if ($images["full"] != "")
-                                       $post .= "\n[img]".$images["full"]."[/img]\n";
+                                       $post .= "\n[img]".$images["full"]."[/img]";
 
                                //$post .= "[quote]".trim(fromgplus_html2bbcode($attachment->content))."[/quote]";
                                $quote = trim(fromgplus_html2bbcode($attachment->content));
index 5a638ed9fadd7144c2dc1306b2f0919627af327e..a66e1e45ff4c9516207212006188b02769cebdf0 100644 (file)
@@ -284,6 +284,8 @@ function gpluspost_feeditem($pid, $uid) {
        $items = q("SELECT `uri`, `plink`, `author-link`, `author-name`, `created`, `edited`, `id`, `title`, `body` from `item` WHERE id=%d", intval($pid));
        foreach ($items AS $item) {
 
+               $item['body'] = bb_CleanPictureLinks($item['body']);
+
                // Looking for the first image
                $image = '';
                if(preg_match("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/is",$item['body'],$matches))
index 6122b9ed75b339a1511227dfd75721f7bf36a1b1..1fa6c5e6557762045b5cb262bdd57822ea83d8dc 100644 (file)
@@ -345,8 +345,8 @@ function privacy_image_cache_display_item_hook(&$a, &$o) {
  * @param string $o
  */
 function privacy_image_cache_ping_xmlize_hook(&$a, &$o) {
-    if ($o["photo"] != "" && !privacy_image_cache_is_local_image($o["photo"]))
-        $o["photo"] = $a->get_baseurl() . "/privacy_image_cache/".privacy_image_cache_cachename($o["photo"]);
+       if ($o["photo"] != "" && !privacy_image_cache_is_local_image($o["photo"]))
+               $o["photo"] = $a->get_baseurl() . "/privacy_image_cache/".privacy_image_cache_cachename($o["photo"]);
         //$o["photo"] = $a->get_baseurl() . "/privacy_image_cache/?url=" . escape_tags(addslashes(rawurlencode($o["photo"])));
 }
 
index 1fe96f515d4715ce030eed8f2ecaea7d1d922ffc..494904ba1401c0f9ab4a4b81efd3448ce23b9c84 100644 (file)
@@ -42,8 +42,8 @@ function statistics_json_cron($a,$b) {
        $last = get_config('statistics_json','last_calucation');
 
        if($last) {
-               // Calculate all 6 hours
-               $next = $last + (360 * 60);
+               // Calculate every 24 hours
+               $next = $last + (24 * 60 * 60);
                if($next > time()) {
                        logger('statistics_json_cron: calculation intervall not reached');
                        return;
index 5286657b4baa4845871270e949f824e0f609371f..a159e87ad1bbeb6f415af87f38da4261ad5456df 100755 (executable)
@@ -452,6 +452,8 @@ function statusnet_shortenmsg($b, $max_char) {
        require_once("include/bbcode.php");
        require_once("include/html2plain.php");
 
+       $b['body'] = bb_CleanPictureLinks($b['body']);
+
        // Looking for the first image
        $cleaned_body = api_clean_plain_items($b['body']);
        $image = '';
index ef69740429b4c85a7f3d148f58aa5006376a8f81..711a33fe034bfb9e3b389bde310b8e49eb951dd1 100755 (executable)
@@ -378,6 +378,8 @@ function twitter_shortenmsg($b, $shortlink = false) {
 
        $max_char = 140;
 
+       $b['body'] = bb_CleanPictureLinks($b['body']);
+
        // Looking for the first image
        $cleaned_body = api_clean_plain_items($b['body']);
        $image = '';