diff --git a/langfilter/lang/pt-br/messages.po b/langfilter/lang/pt-br/messages.po deleted file mode 100644 index 46149a53..00000000 --- a/langfilter/lang/pt-br/messages.po +++ /dev/null @@ -1,80 +0,0 @@ -# ADDON langfilter -# Copyright (C) -# This file is distributed under the same license as the Friendica langfilter addon package. -# -# -# Translators: -# Beatriz Vital , 2016,2018 -msgid "" -msgstr "" -"Project-Id-Version: friendica\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-04-01 11:11-0400\n" -"PO-Revision-Date: 2018-06-04 01:09+0000\n" -"Last-Translator: Beatriz Vital \n" -"Language-Team: Portuguese (Brazil) (http://www.transifex.com/Friendica/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" - -#: langfilter.php:58 -msgid "Language Filter" -msgstr "Filtro de Idiomas" - -#: langfilter.php:59 -msgid "" -"This addon tries to identify the language posts are writen in. If it does " -"not match any language specifed below, posts will be hidden by collapsing " -"them." -msgstr "Este complemento tenta identificar a língua em que as publicações são escritas. Uma publicação que não se encaixe em nenhum dos idiomas especificados abaixo será ocultada por colapsamento." - -#: langfilter.php:60 -msgid "Use the language filter" -msgstr "Usar o filtro de idiomas" - -#: langfilter.php:61 -msgid "Able to read" -msgstr "Falo" - -#: langfilter.php:61 -msgid "" -"List of abbreviations (iso2 codes) for languages you speak, comma separated." -" For example \"de,it\"." -msgstr "Lista de abreviações (códigos ISO 2) para as línguas que você fala, separadas por vírgula. Por exemplo, \"de,it\"." - -#: langfilter.php:62 -msgid "Minimum confidence in language detection" -msgstr "Confiança mínima na detecção do idioma" - -#: langfilter.php:62 -msgid "" -"Minimum confidence in language detection being correct, from 0 to 100. Posts" -" will not be filtered when the confidence of language detection is below " -"this percent value." -msgstr "Confiança mínima na exatidão da detecção do idioma, de 0 a 100. As publicações não serão filtradas quando a confiança na detecção do idioma estiver abaixo desta porcentagem." - -#: langfilter.php:63 -msgid "Minimum length of message body" -msgstr "Tamanho mínimo do corpo da mensagem" - -#: langfilter.php:63 -msgid "" -"Minimum number of characters in message body for filter to be used. Posts " -"shorter than this will not be filtered. Note: Language detection is " -"unreliable for short content (<200 characters)." -msgstr "Número mínimo de caracteres no corpo da mensagem para aplicação do filtro. As publicações mais curtas que o estipulado não serão filtradas. Atenção: a detecção de idiomas não é confiável para conteúdos curtos (< 200 caracteres)." - -#: langfilter.php:64 -msgid "Save Settings" -msgstr "Salvar configurações" - -#: langfilter.php:105 -msgid "Language Filter Settings saved." -msgstr "Configurações do Filtro de Idiomas salvas." - -#: langfilter.php:182 -#, php-format -msgid "Filtered language: %s" -msgstr "Idioma filtrado: %s" diff --git a/langfilter/lang/pt-br/strings.php b/langfilter/lang/pt-br/strings.php deleted file mode 100644 index bddcc210..00000000 --- a/langfilter/lang/pt-br/strings.php +++ /dev/null @@ -1,20 +0,0 @@ - 1);; -}} -; -$a->strings["Language Filter"] = "Filtro de Idiomas"; -$a->strings["This addon tries to identify the language posts are writen in. If it does not match any language specifed below, posts will be hidden by collapsing them."] = "Este complemento tenta identificar a língua em que as publicações são escritas. Uma publicação que não se encaixe em nenhum dos idiomas especificados abaixo será ocultada por colapsamento."; -$a->strings["Use the language filter"] = "Usar o filtro de idiomas"; -$a->strings["Able to read"] = "Falo"; -$a->strings["List of abbreviations (iso2 codes) for languages you speak, comma separated. For example \"de,it\"."] = "Lista de abreviações (códigos ISO 2) para as línguas que você fala, separadas por vírgula. Por exemplo, \"de,it\"."; -$a->strings["Minimum confidence in language detection"] = "Confiança mínima na detecção do idioma"; -$a->strings["Minimum confidence in language detection being correct, from 0 to 100. Posts will not be filtered when the confidence of language detection is below this percent value."] = "Confiança mínima na exatidão da detecção do idioma, de 0 a 100. As publicações não serão filtradas quando a confiança na detecção do idioma estiver abaixo desta porcentagem."; -$a->strings["Minimum length of message body"] = "Tamanho mínimo do corpo da mensagem"; -$a->strings["Minimum number of characters in message body for filter to be used. Posts shorter than this will not be filtered. Note: Language detection is unreliable for short content (<200 characters)."] = "Número mínimo de caracteres no corpo da mensagem para aplicação do filtro. As publicações mais curtas que o estipulado não serão filtradas. Atenção: a detecção de idiomas não é confiável para conteúdos curtos (< 200 caracteres)."; -$a->strings["Save Settings"] = "Salvar configurações"; -$a->strings["Language Filter Settings saved."] = "Configurações do Filtro de Idiomas salvas."; -$a->strings["Filtered language: %s"] = "Idioma filtrado: %s"; diff --git a/twitter/twitter.php b/twitter/twitter.php index 11c64164..a38fd72b 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -61,6 +61,7 @@ */ use Abraham\TwitterOAuth\TwitterOAuth; +use Abraham\TwitterOAuth\TwitterOAuthException; use Friendica\App; use Friendica\Content\OEmbed; use Friendica\Content\Text\Plaintext; @@ -244,6 +245,8 @@ function twitter_settings_post(App $a, $post) PConfig::set(local_user(), 'twitter', 'post', 1); } catch(Exception $e) { info($e->getMessage()); + } catch(TwitterOAuthException $e) { + info($e->getMessage()); } // reload the Addon Settings page, if we don't do it see Bug #42 goaway('settings/connectors'); @@ -311,59 +314,65 @@ function twitter_settings(App $a, &$s) * account at Twitter. */ $connection = new TwitterOAuth($ckey, $csecret); - $result = $connection->oauth('oauth/request_token', ['oauth_callback' => 'oob']); - - $s .= '

' . L10n::t('At this Friendica instance the Twitter addon was enabled but you have not yet connected your account to your Twitter account. To do so click the button below to get a PIN from Twitter which you have to copy into the input box below and submit the form. Only your public posts will be posted to Twitter.') . '

'; - $s .= '' . L10n::t('Log in with Twitter') . ''; - $s .= '
'; - $s .= ''; - $s .= ''; - $s .= ''; - $s .= ''; - $s .= '
'; - $s .= '
'; + try { + $result = $connection->oauth('oauth/request_token', ['oauth_callback' => 'oob']); + $s .= '

' . L10n::t('At this Friendica instance the Twitter addon was enabled but you have not yet connected your account to your Twitter account. To do so click the button below to get a PIN from Twitter which you have to copy into the input box below and submit the form. Only your public posts will be posted to Twitter.') . '

'; + $s .= '' . L10n::t('Log in with Twitter') . ''; + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= ''; + $s .= ''; + $s .= '
'; + $s .= '
'; + } catch (TwitterOAuthException $e) { + $s .= '

' . L10n::t('An error occured: ') . $e->getMessage() . '

'; + } } else { /* * * * we have an OAuth key / secret pair for the user * so let's give a chance to disable the postings to Twitter */ $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret); - $details = $connection->get('account/verify_credentials'); + try { + $details = $connection->get('account/verify_credentials'); - $field_checkbox = get_markup_template('field_checkbox.tpl'); + $field_checkbox = get_markup_template('field_checkbox.tpl'); - $s .= '
-

' . L10n::t('Currently connected to: ') . '' . $details->screen_name . ' - -

-

- - ' . $details->description . ' -

-
'; - $s .= '
'; + $s .= '
+

' . L10n::t('Currently connected to: ') . '' . $details->screen_name . ' + +

+

+ + ' . $details->description . ' +

+
'; + $s .= '
'; - $s .= replace_macros($field_checkbox, [ - '$field' => ['twitter-enable', L10n::t('Allow posting to Twitter'), $enabled, L10n::t('If enabled all your public postings can be posted to the associated Twitter account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.')] - ]); - if ($a->user['hidewall']) { - $s .= '

' . L10n::t('Note: Due to your privacy settings (Hide your profile details from unknown viewers?) the link potentially included in public postings relayed to Twitter will lead the visitor to a blank page informing the visitor that the access to your profile has been restricted.') . '

'; + $s .= replace_macros($field_checkbox, [ + '$field' => ['twitter-enable', L10n::t('Allow posting to Twitter'), $enabled, L10n::t('If enabled all your public postings can be posted to the associated Twitter account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.')] + ]); + if ($a->user['hidewall']) { + $s .= '

' . L10n::t('Note: Due to your privacy settings (Hide your profile details from unknown viewers?) the link potentially included in public postings relayed to Twitter will lead the visitor to a blank page informing the visitor that the access to your profile has been restricted.') . '

'; + } + $s .= replace_macros($field_checkbox, [ + '$field' => ['twitter-default', L10n::t('Send public postings to Twitter by default'), $defenabled, ''] + ]); + $s .= replace_macros($field_checkbox, [ + '$field' => ['twitter-mirror', L10n::t('Mirror all posts from twitter that are no replies'), $mirrorenabled, ''] + ]); + $s .= replace_macros($field_checkbox, [ + '$field' => ['twitter-import', L10n::t('Import the remote timeline'), $importenabled, ''] + ]); + $s .= replace_macros($field_checkbox, [ + '$field' => ['twitter-create_user', L10n::t('Automatically create contacts'), $create_userenabled, L10n::t('This will automatically create a contact in Friendica as soon as you receive a message from an existing contact via the Twitter network. If you do not enable this, you need to manually add those Twitter contacts in Friendica from whom you would like to see posts here. However if enabled, you cannot merely remove a twitter contact from the Friendica contact list, as it will recreate this contact when they post again.')] + ]); + $s .= '
'; + $s .= '
'; + } catch (TwitterOAuthException $e) { + $s .= '

' . L10n::t('An error occured: ') . $e->getMessage() . '

'; } - $s .= replace_macros($field_checkbox, [ - '$field' => ['twitter-default', L10n::t('Send public postings to Twitter by default'), $defenabled, ''] - ]); - $s .= replace_macros($field_checkbox, [ - '$field' => ['twitter-mirror', L10n::t('Mirror all posts from twitter that are no replies'), $mirrorenabled, ''] - ]); - $s .= replace_macros($field_checkbox, [ - '$field' => ['twitter-import', L10n::t('Import the remote timeline'), $importenabled, ''] - ]); - $s .= replace_macros($field_checkbox, [ - '$field' => ['twitter-create_user', L10n::t('Automatically create contacts'), $create_userenabled, L10n::t('This will automatically create a contact in Friendica as soon as you receive a message from an existing contact via the Twitter network. If you do not enable this, you need to manually add those Twitter contacts in Friendica from whom you would like to see posts here. However if enabled, you cannot merely remove a twitter contact from the Friendica contact list, as it will recreate this contact when they post again.')] - ]); - - $s .= '
'; - $s .= '
'; } } $s .= '
'; @@ -866,7 +875,12 @@ function twitter_fetchtimeline(App $a, $uid) $parameters["since_id"] = $lastid; } - $items = $connection->get('statuses/user_timeline', $parameters); + try { + $items = $connection->get('statuses/user_timeline', $parameters); + } catch (TwitterOAuthException $e) { + logger('twitter_fetchtimeline: Error fetching timeline for user ' . $uid . ': ' . $e->getMessage()); + return; + } if (!is_array($items)) { return; @@ -1081,7 +1095,12 @@ function twitter_fetchuser(App $a, $uid, $screen_name = "", $user_id = "") // Fetching user data $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret); - $user = $connection->get('users/show', $parameters); + try { + $user = $connection->get('users/show', $parameters); + } catch (TwitterOAuthException $e) { + logger('twitter_fetchuser: Error fetching user ' . $uid . ': ' . $e->getMessage()); + return; + } if (!is_object($user)) { return; @@ -1552,7 +1571,12 @@ function twitter_fetchparentposts(App $a, $uid, $post, $connection, $self, $own_ while ($post->in_reply_to_status_id_str != "") { $parameters = ["trim_user" => false, "tweet_mode" => "extended", "id" => $post->in_reply_to_status_id_str]; - $post = $connection->get('statuses/show', $parameters); + try { + $post = $connection->get('statuses/show', $parameters); + } catch (TwitterOAuthException $e) { + logger('twitter_fetchparentposts: Error fetching for user ' . $uid . ' and post ' . $post->id_str . ': ' . $e->getMessage()); + break; + } if (!count($post)) { logger("twitter_fetchparentposts: Can't fetch post " . $parameters->id, LOGGER_DEBUG); @@ -1621,7 +1645,12 @@ function twitter_fetchhometimeline(App $a, $uid) $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret); - $own_contact = twitter_fetch_own_contact($a, $uid); + try { + $own_contact = twitter_fetch_own_contact($a, $uid); + } catch (TwitterOAuthException $e) { + logger('twitter_fetchhometimeline: Error fetching own contact for user ' . $uid . ': ' . $e->getMessage()); + return; + } $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($own_contact), @@ -1662,7 +1691,12 @@ function twitter_fetchhometimeline(App $a, $uid) $parameters["since_id"] = $lastid; } - $items = $connection->get('statuses/home_timeline', $parameters); + try { + $items = $connection->get('statuses/home_timeline', $parameters); + } catch (TwitterOAuthException $e) { + logger('twitter_fetchhometimeline: Error fetching home timeline: ' . $e->getMessage()); + return; + } if (!is_array($items)) { logger("twitter_fetchhometimeline: Error fetching home timeline: " . print_r($items, true), LOGGER_DEBUG); @@ -1734,7 +1768,12 @@ function twitter_fetchhometimeline(App $a, $uid) $parameters["since_id"] = $lastid; } - $items = $connection->get('statuses/mentions_timeline', $parameters); + try { + $items = $connection->get('statuses/mentions_timeline', $parameters); + } catch (TwitterOAuthException $e) { + logger('twitter_fetchhometimeline: Error fetching mentions: ' . $e->getMessage()); + return; + } if (!is_array($items)) { logger("twitter_fetchhometimeline: Error fetching mentions: " . print_r($items, true), LOGGER_DEBUG); @@ -1831,6 +1870,7 @@ function twitter_fetch_own_contact(App $a, $uid) $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret); // Fetching user data + // get() may throw TwitterOAuthException, but we will catch it later $user = $connection->get('account/verify_credentials'); PConfig::set($uid, 'twitter', 'own_id', $user->id_str); diff --git a/viewsrc/lang/nl/messages.po b/viewsrc/lang/nl/messages.po deleted file mode 100644 index f290920a..00000000 --- a/viewsrc/lang/nl/messages.po +++ /dev/null @@ -1,23 +0,0 @@ -# ADDON viewsrc -# Copyright (C) -# This file is distributed under the same license as the Friendica viewsrc addon package. -# -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-02-27 05:01-0500\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: Pascal , 2018\n" -"Language-Team: Dutch (https://www.transifex.com/Friendica/teams/12172/nl/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: nl\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: viewsrc.php:39 -msgid "View Source" -msgstr "Bekijk Bron" diff --git a/viewsrc/lang/nl/strings.php b/viewsrc/lang/nl/strings.php deleted file mode 100644 index c64e24c0..00000000 --- a/viewsrc/lang/nl/strings.php +++ /dev/null @@ -1,9 +0,0 @@ -strings["View Source"] = "Bekijk Bron"; diff --git a/xmpp/lang/pt-br/messages.po b/xmpp/lang/pt-br/messages.po deleted file mode 100644 index a43cc313..00000000 --- a/xmpp/lang/pt-br/messages.po +++ /dev/null @@ -1,61 +0,0 @@ -# ADDON xmpp -# Copyright (C) -# This file is distributed under the same license as the Friendica xmpp addon package. -# -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-11-27 09:30+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: Beatriz Vital , 2018\n" -"Language-Team: Portuguese (Brazil) (https://www.transifex.com/Friendica/teams/12172/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" - -#: xmpp.php:38 -msgid "XMPP settings updated." -msgstr "Configurações de XMPP atualizadas." - -#: xmpp.php:63 xmpp.php:67 -msgid "XMPP-Chat (Jabber)" -msgstr "Bate-papo XMPP (Jabber)" - -#: xmpp.php:71 -msgid "Enable Webchat" -msgstr "Habilitar webchat" - -#: xmpp.php:76 -msgid "Individual Credentials" -msgstr "Credenciais individuais" - -#: xmpp.php:82 xmpp.php:108 -msgid "Jabber BOSH host" -msgstr "Host BOSH de Jabber" - -#: xmpp.php:91 xmpp.php:107 -msgid "Save Settings" -msgstr "Salvar configurações" - -#: xmpp.php:109 -msgid "Use central userbase" -msgstr "Usar base de usuários central" - -#: xmpp.php:109 -msgid "" -"If enabled, users will automatically login to an ejabberd server that has to" -" be installed on this machine with synchronized credentials via the " -"\"auth_ejabberd.php\" script." -msgstr "" -"Se habilitado, a autenticação será feita automaticamente em um servidor " -"ejabberd, que precisa ser instalado neste computador com credenciais " -"sincronizadas por meio do script \"auth_ejabberd.php\"." - -#: xmpp.php:119 -msgid "Settings updated." -msgstr "Configurações atualizadas." diff --git a/xmpp/lang/pt-br/strings.php b/xmpp/lang/pt-br/strings.php deleted file mode 100644 index c3bd9bb1..00000000 --- a/xmpp/lang/pt-br/strings.php +++ /dev/null @@ -1,17 +0,0 @@ - 1);; -}} -; -$a->strings["XMPP settings updated."] = "Configurações de XMPP atualizadas."; -$a->strings["XMPP-Chat (Jabber)"] = "Bate-papo XMPP (Jabber)"; -$a->strings["Enable Webchat"] = "Habilitar webchat"; -$a->strings["Individual Credentials"] = "Credenciais individuais"; -$a->strings["Jabber BOSH host"] = "Host BOSH de Jabber"; -$a->strings["Save Settings"] = "Salvar configurações"; -$a->strings["Use central userbase"] = "Usar base de usuários central"; -$a->strings["If enabled, users will automatically login to an ejabberd server that has to be installed on this machine with synchronized credentials via the \"auth_ejabberd.php\" script."] = "Se habilitado, a autenticação será feita automaticamente em um servidor ejabberd, que precisa ser instalado neste computador com credenciais sincronizadas por meio do script \"auth_ejabberd.php\"."; -$a->strings["Settings updated."] = "Configurações atualizadas.";