]> git.mxchange.org Git - friendica-addons.git/blobdiff - buffer/buffer.php
Setting "editplain", "page" and "privacy_image_cache" as deprecated. Using new cache...
[friendica-addons.git] / buffer / buffer.php
index 4b81fb31a82c94369d264bab9f3a705467a97728..595dba43d9fcce41ab84bf9d63e8e5416e98280b 100644 (file)
@@ -60,6 +60,13 @@ function buffer_plugin_admin(&$a, &$o){
                '$client_secret' => array('client_secret', t('Client Secret'),  get_config('buffer', 'client_secret' ), ''),
        ));
 }
+function buffer_plugin_admin_post(&$a){
+        $client_id     =       ((x($_POST,'client_id'))              ? notags(trim($_POST['client_id']))   : '');
+        $client_secret =       ((x($_POST,'client_secret'))   ? notags(trim($_POST['client_secret'])): '');
+        set_config('buffer','client_id',$client_id);
+        set_config('buffer','client_secret',$client_secret);
+        info( t('Settings updated.'). EOL );
+}
 
 function buffer_connect(&$a) {
 
@@ -246,9 +253,6 @@ function buffer_send(&$a,&$b) {
        if($access_token) {
                $buffer = new BufferApp($client_id, $client_secret, $callback_url, $access_token);
 
-               $result = q("SELECT `installed` FROM `addon` WHERE `name` = 'privacy_image_cache' AND `installed`");
-               $image_cache = (count($result) > 0);
-
                require_once("include/plaintext.php");
                require_once("include/network.php");
 
@@ -301,15 +305,13 @@ function buffer_send(&$a,&$b) {
                                $post = plaintext($a, $item, $limit, $includedlinks);
                                logger("buffer_send: converted message ".$b["id"]." result: ".print_r($post, true), LOGGER_DEBUG);
 
-                               // The image cache is used as a sanitizer. Buffer seems to be really picky about pictures
-                               if ($image_cache) {
-                                       require_once("addon/privacy_image_cache/privacy_image_cache.php");
-                                       if (isset($post["image"]))
-                                               $post["image"] = $a->get_baseurl() . "/privacy_image_cache/".privacy_image_cache_cachename($post["image"]);
+                               // The image proxy is used as a sanitizer. Buffer seems to be really picky about pictures
+                               require_once("mod/proxy.php");
+                               if (isset($post["image"]))
+                                       $post["image"] = proxy_url($post["image"]);
 
-                                       if (isset($post["preview"]))
-                                               $post["preview"] = $a->get_baseurl() . "/privacy_image_cache/".privacy_image_cache_cachename($post["preview"]);
-                               }
+                               if (isset($post["preview"]))
+                                       $post["preview"] = proxy_url($post["preview"]);
 
                                //if ($profile->service == "twitter") {
                                if ($includedlinks) {