From d44d272da7926f40fa7b22a081b68433b70e75db Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Tue, 7 Oct 2014 18:41:10 +0200 Subject: [PATCH 1/6] appnet: adding PT-BR translations --- appnet/lang/pt-br/messages.po | 118 ++++++++++++++++++++++++++++++++++ appnet/lang/pt-br/strings.php | 29 +++++++++ 2 files changed, 147 insertions(+) create mode 100644 appnet/lang/pt-br/messages.po create mode 100644 appnet/lang/pt-br/strings.php diff --git a/appnet/lang/pt-br/messages.po b/appnet/lang/pt-br/messages.po new file mode 100644 index 00000000..cf677625 --- /dev/null +++ b/appnet/lang/pt-br/messages.po @@ -0,0 +1,118 @@ +# ADDON appnet +# Copyright (C) +# This file is distributed under the same license as the Friendica appnet addon package. +# +# +# Translators: +# Calango Jr , 2014 +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-06-22 11:47+0200\n" +"PO-Revision-Date: 2014-10-04 04:09+0000\n" +"Last-Translator: Calango Jr \n" +"Language-Team: Portuguese (Brazil) (http://www.transifex.com/projects/p/friendica/language/pt_BR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: pt_BR\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: appnet.php:39 +msgid "Permission denied." +msgstr "Permissão negada." + +#: appnet.php:73 +msgid "You are now authenticated to app.net. " +msgstr "Você está autenticado no app.net." + +#: appnet.php:77 +msgid "

Error fetching token. Please try again.

" +msgstr "Erro ocorrido na obtenção do token. Tente novamente." + +#: appnet.php:80 +msgid "return to the connector page" +msgstr "Volte a página de conectores." + +#: appnet.php:94 +msgid "Post to app.net" +msgstr "Postar no app.net" + +#: appnet.php:125 appnet.php:129 +msgid "App.net Export" +msgstr "App.net exportar" + +#: appnet.php:142 +msgid "Currently connected to: " +msgstr "Atualmente conectado em: " + +#: appnet.php:144 +msgid "Enable App.net Post Plugin" +msgstr "Habilitar App.net Plugin de publicação/postagem" + +#: appnet.php:149 +msgid "Post to App.net by default" +msgstr "Postar em App.net por padrão" + +#: appnet.php:153 +msgid "Import the remote timeline" +msgstr "Importar timeline remota" + +#: appnet.php:159 +msgid "" +"

Error fetching user profile. Please clear the configuration and try " +"again.

" +msgstr "Erro na obtenção do perfil do usuário. Confira as configurações e tente novamente." + +#: appnet.php:164 +msgid "

You have two ways to connect to App.net.

" +msgstr "

Você possui duas formas de conectar ao App.net

" + +#: appnet.php:166 +msgid "" +"

First way: Register an application at https://account.app.net/developer/apps/" +" and enter Client ID and Client Secret. " +msgstr "

1º Método: Registre uma aplicação em https://account.app.net/developer/apps/ e entre o Client ID e Client Secret" + +#: appnet.php:167 +#, php-format +msgid "Use '%s' as Redirect URI

" +msgstr "Use '%s' como URI redirecionador

" + +#: appnet.php:169 +msgid "Client ID" +msgstr "Client ID" + +#: appnet.php:173 +msgid "Client Secret" +msgstr "Client Secret" + +#: appnet.php:177 +msgid "" +"

Second way: fetch a token at http://dev-lite.jonathonduerig.com/. " +msgstr "

2º Método: obtenha um token em http://dev-lite.jonathonduerig.com/. " + +#: appnet.php:178 +msgid "" +"Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', " +"'Messages'.

" +msgstr "Adicione valor as estas saídas: 'Basic', 'Stream', 'Write Post', 'Public Messages', 'Messages'.

" + +#: appnet.php:180 +msgid "Token" +msgstr "Token" + +#: appnet.php:192 +msgid "Sign in using App.net" +msgstr "Registre-se usando App.net" + +#: appnet.php:197 +msgid "Clear OAuth configuration" +msgstr "Limpar configuração OAuth" + +#: appnet.php:204 +msgid "Save Settings" +msgstr "Salvar Configurações" diff --git a/appnet/lang/pt-br/strings.php b/appnet/lang/pt-br/strings.php new file mode 100644 index 00000000..6d4a410b --- /dev/null +++ b/appnet/lang/pt-br/strings.php @@ -0,0 +1,29 @@ + 1);; +}} +; +$a->strings["Permission denied."] = "Permissão negada."; +$a->strings["You are now authenticated to app.net. "] = "Você está autenticado no app.net."; +$a->strings["

Error fetching token. Please try again.

"] = "Erro ocorrido na obtenção do token. Tente novamente."; +$a->strings["return to the connector page"] = "Volte a página de conectores."; +$a->strings["Post to app.net"] = "Postar no app.net"; +$a->strings["App.net Export"] = "App.net exportar"; +$a->strings["Currently connected to: "] = "Atualmente conectado em: "; +$a->strings["Enable App.net Post Plugin"] = "Habilitar App.net Plugin de publicação/postagem"; +$a->strings["Post to App.net by default"] = "Postar em App.net por padrão"; +$a->strings["Import the remote timeline"] = "Importar timeline remota"; +$a->strings["

Error fetching user profile. Please clear the configuration and try again.

"] = "Erro na obtenção do perfil do usuário. Confira as configurações e tente novamente."; +$a->strings["

You have two ways to connect to App.net.

"] = "

Você possui duas formas de conectar ao App.net

"; +$a->strings["

First way: Register an application at https://account.app.net/developer/apps/ and enter Client ID and Client Secret. "] = "

1º Método: Registre uma aplicação em https://account.app.net/developer/apps/ e entre o Client ID e Client Secret"; +$a->strings["Use '%s' as Redirect URI

"] = "Use '%s' como URI redirecionador

"; +$a->strings["Client ID"] = "Client ID"; +$a->strings["Client Secret"] = "Client Secret"; +$a->strings["

Second way: fetch a token at http://dev-lite.jonathonduerig.com/. "] = "

2º Método: obtenha um token em http://dev-lite.jonathonduerig.com/. "; +$a->strings["Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', 'Messages'.

"] = "Adicione valor as estas saídas: 'Basic', 'Stream', 'Write Post', 'Public Messages', 'Messages'.

"; +$a->strings["Token"] = "Token"; +$a->strings["Sign in using App.net"] = "Registre-se usando App.net"; +$a->strings["Clear OAuth configuration"] = "Limpar configuração OAuth"; +$a->strings["Save Settings"] = "Salvar Configurações"; -- 2.45.3 From 467f1f00f2392817f07214fb7f7ea927ac307daf Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 13 Oct 2014 20:49:46 +0200 Subject: [PATCH 2/6] Statusnet: Improved error handling --- statusnet/statusnet.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index c3591356..959d598a 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -1338,7 +1338,7 @@ function statusnet_fetchhometimeline($a, $uid) { $items = $connection->get('statuses/home_timeline', $parameters); if (!is_array($items)) { - logger("statusnet_fetchhometimeline: Error fetching home timeline: ".print_r($items, true), LOGGER_DEBUG); + logger("statusnet_fetchhometimeline: Error fetching home timeline: ".$items, LOGGER_DEBUG); return; } -- 2.45.3 From d9f0102094d691b70198608dbeb6075f8f6fd263 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Tue, 14 Oct 2014 19:01:26 +0200 Subject: [PATCH 3/6] The changed error handling hadn't behaved like expected. --- statusnet/statusnet.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 959d598a..c8b702d1 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -1338,7 +1338,16 @@ function statusnet_fetchhometimeline($a, $uid) { $items = $connection->get('statuses/home_timeline', $parameters); if (!is_array($items)) { - logger("statusnet_fetchhometimeline: Error fetching home timeline: ".$items, LOGGER_DEBUG); + if (is_object($items) AND isset($items->error)) + $errormsg = $items->error; + elseif (is_object($items)) + $errormsg = print_r($items, true); + elseif (is_string($items) OR is_float($items) OR is_int($items)) + $errormsg = $items; + else + $errormsg = "Unknown error"; + + logger("statusnet_fetchhometimeline: Error fetching home timeline: ".$errormsg, LOGGER_DEBUG); return; } -- 2.45.3 From 76a8623053ae12e4dcb0e63c58e5a14d0a46ba62 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Tue, 14 Oct 2014 19:32:31 +0200 Subject: [PATCH 4/6] Facebook: The system now tries to get the full resolution of an imported post. Additionally URLs are cleaned from tracking variables. --- fbpost/fbpost.php | 21 +++++++++++++++++++-- fbsync/fbsync.php | 4 ++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/fbpost/fbpost.php b/fbpost/fbpost.php index 2ac558ea..38fe1920 100644 --- a/fbpost/fbpost.php +++ b/fbpost/fbpost.php @@ -967,8 +967,21 @@ function fbpost_cron($a,$b) { set_config('facebook','last_poll', time()); } +function fbpost_cleanpicture($url) { + require_once("include/Photo.php"); + + $urldata = parse_url($url); + if (isset($urldata["query"])) { + parse_str($urldata["query"], $querydata); + if (isset($querydata["url"]) AND (get_photo_info($querydata["url"]))) + return($querydata["url"]); + } + return($url); +} + function fbpost_fetchwall($a, $uid) { require_once("include/oembed.php"); + require_once("include/network.php"); require_once('mod/item.php'); $access_token = get_pconfig($uid,'facebook','access_token'); @@ -1029,6 +1042,7 @@ function fbpost_fetchwall($a, $uid) { $type = ""; if(isset($item->name) and isset($item->link)) { + $item->link = original_url($item->link); $oembed_data = oembed_fetch_url($item->link); $type = $oembed_data->type; $content = "[bookmark=".$item->link."]".$item->name."[/bookmark]"; @@ -1071,9 +1085,12 @@ function fbpost_fetchwall($a, $uid) { } } - if(($picture != "") && isset($item->link)) + $picture = fbpost_cleanpicture($picture); + + if(($picture != "") && isset($item->link)) { + $item->link = original_url($item->link); $content .= "\n".'[url='.$item->link.'][img]'.$picture.'[/img][/url]'; - else { + } else { if ($picture != "") $content .= "\n".'[img]'.$picture.'[/img]'; // if just a link, it may be a wall photo - check diff --git a/fbsync/fbsync.php b/fbsync/fbsync.php index 51d2747f..64f6fe2a 100644 --- a/fbsync/fbsync.php +++ b/fbsync/fbsync.php @@ -216,6 +216,7 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr $access_token = get_pconfig($uid,'facebook','access_token'); require_once("include/oembed.php"); + require_once("include/network.php"); // check if it was already imported $r = q("SELECT * FROM `item` WHERE `uid` = %d AND `uri` = '%s' LIMIT 1", @@ -339,6 +340,7 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr $type = ""; if (isset($post->attachment->name) and isset($post->attachment->href)) { + $post->attachment->href = original_url($post->attachment->href); $oembed_data = oembed_fetch_url($post->attachment->href); $type = $oembed_data->type; if ($type == "rich") @@ -391,6 +393,8 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr } } + $preview = fbpost_cleanpicture($preview); + if (isset($media->href) AND ($preview != "") AND ($media->href != "")) $content .= "\n".'[url='.$media->href.'][img]'.$preview.'[/img][/url]'; else { -- 2.45.3 From 39cc0fe4cb909a52b3bb75b685ca7142863a6027 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 19 Oct 2014 00:05:06 +0200 Subject: [PATCH 5/6] Bugfix: Sometimes it happened that the own contact data was deleted. This was caused by the statusnet connector. --- statusnet/statusnet.php | 9 ++++----- twitter/twitter.php | 3 +++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index c3591356..e96a8967 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -872,6 +872,9 @@ function statusnet_address($contact) { } function statusnet_fetch_contact($uid, $contact, $create_user) { + if ($contact->statusnet_profile_url == "") + return(-1); + // Check if the unique contact is existing // To-Do: only update once a while $r = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1", @@ -950,16 +953,12 @@ function statusnet_fetch_contact($uid, $contact, $create_user) { q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s', - `name-date` = '%s', - `uri-date` = '%s', `avatar-date` = '%s' WHERE `id` = %d", dbesc($photos[0]), dbesc($photos[1]), dbesc($photos[2]), dbesc(datetime_convert()), - dbesc(datetime_convert()), - dbesc(datetime_convert()), intval($contact_id) ); @@ -971,7 +970,7 @@ function statusnet_fetch_contact($uid, $contact, $create_user) { // check that we have all the photos, this has been known to fail on occasion - if((! $r[0]['photo']) || (! $r[0]['thumb']) || (! $r[0]['micro']) || ($update_photo)) { + if((!$r[0]['photo']) || (!$r[0]['thumb']) || (!$r[0]['micro']) || ($update_photo)) { logger("statusnet_fetch_contact: Updating contact ".$contact->screen_name, LOGGER_DEBUG); diff --git a/twitter/twitter.php b/twitter/twitter.php index 1919e28c..2669c46d 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -892,6 +892,9 @@ function twitter_queue_hook(&$a,&$b) { function twitter_fetch_contact($uid, $contact, $create_user) { require_once("include/Photo.php"); + if ($contact->id_str == "") + return(-1); + $avatar = str_replace("_normal.", ".", $contact->profile_image_url_https); $info = get_photo_info($avatar); -- 2.45.3 From 8c5ee7e062451dcf4262616456979c67a1bba52f Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 19 Oct 2014 00:26:06 +0200 Subject: [PATCH 6/6] Removed some stuff from another branch --- fbpost/fbpost.php | 21 ++------------------- fbsync/fbsync.php | 4 ---- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/fbpost/fbpost.php b/fbpost/fbpost.php index 38fe1920..2ac558ea 100644 --- a/fbpost/fbpost.php +++ b/fbpost/fbpost.php @@ -967,21 +967,8 @@ function fbpost_cron($a,$b) { set_config('facebook','last_poll', time()); } -function fbpost_cleanpicture($url) { - require_once("include/Photo.php"); - - $urldata = parse_url($url); - if (isset($urldata["query"])) { - parse_str($urldata["query"], $querydata); - if (isset($querydata["url"]) AND (get_photo_info($querydata["url"]))) - return($querydata["url"]); - } - return($url); -} - function fbpost_fetchwall($a, $uid) { require_once("include/oembed.php"); - require_once("include/network.php"); require_once('mod/item.php'); $access_token = get_pconfig($uid,'facebook','access_token'); @@ -1042,7 +1029,6 @@ function fbpost_fetchwall($a, $uid) { $type = ""; if(isset($item->name) and isset($item->link)) { - $item->link = original_url($item->link); $oembed_data = oembed_fetch_url($item->link); $type = $oembed_data->type; $content = "[bookmark=".$item->link."]".$item->name."[/bookmark]"; @@ -1085,12 +1071,9 @@ function fbpost_fetchwall($a, $uid) { } } - $picture = fbpost_cleanpicture($picture); - - if(($picture != "") && isset($item->link)) { - $item->link = original_url($item->link); + if(($picture != "") && isset($item->link)) $content .= "\n".'[url='.$item->link.'][img]'.$picture.'[/img][/url]'; - } else { + else { if ($picture != "") $content .= "\n".'[img]'.$picture.'[/img]'; // if just a link, it may be a wall photo - check diff --git a/fbsync/fbsync.php b/fbsync/fbsync.php index 64f6fe2a..51d2747f 100644 --- a/fbsync/fbsync.php +++ b/fbsync/fbsync.php @@ -216,7 +216,6 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr $access_token = get_pconfig($uid,'facebook','access_token'); require_once("include/oembed.php"); - require_once("include/network.php"); // check if it was already imported $r = q("SELECT * FROM `item` WHERE `uid` = %d AND `uri` = '%s' LIMIT 1", @@ -340,7 +339,6 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr $type = ""; if (isset($post->attachment->name) and isset($post->attachment->href)) { - $post->attachment->href = original_url($post->attachment->href); $oembed_data = oembed_fetch_url($post->attachment->href); $type = $oembed_data->type; if ($type == "rich") @@ -393,8 +391,6 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr } } - $preview = fbpost_cleanpicture($preview); - if (isset($media->href) AND ($preview != "") AND ($media->href != "")) $content .= "\n".'[url='.$media->href.'][img]'.$preview.'[/img][/url]'; else { -- 2.45.3