Compare commits

..

19 commits

Author SHA1 Message Date
Hypolite Petovan c4876d46b4 Merge pull request 'Tumblr: Added support for hook "support_probe"' (#1376) from heluecht/friendica-addons:tumblr-support-probe into develop
Reviewed-on: friendica/friendica-addons#1376
2023-04-27 13:59:07 +02:00
Michael 8400258f07 Tumblr: Added support for hook "support_probe" 2023-04-27 05:28:05 +00:00
Tobias Diekershoff 8f29a51277 Merge branch 'develop' into stable 2023-04-27 07:24:05 +02:00
Tobias Diekershoff b34c9131ca recovered [mailstream] various modernisations
These changes where made on github as #1354 but got lost due mirroring
issued from the development branch. Original author is mexon.

https://github.com/friendica/friendica-addons/pull/1354
2023-04-27 07:21:20 +02:00
Tobias Diekershoff a733e82c21 Merge pull request 'Tumblr: Small fixes' (#1375) from heluecht/friendica-addons:tumblr-fixes into develop
Reviewed-on: friendica/friendica-addons#1375
2023-04-27 07:12:19 +02:00
Michael 5d8a53b8ec Tumblr: Small fixes 2023-04-27 05:00:04 +00:00
Hypolite Petovan dac297b942 Merge pull request 'Tumblr: We can now follow, unfollow, add posts, ...' (#1374) from heluecht/friendica-addons:tumblr-complete into develop
Reviewed-on: friendica/friendica-addons#1374
2023-04-27 01:39:01 +02:00
Michael dc02e16575 Tumblr: We can now follow, unfollow, add posts, ... 2023-04-26 22:15:59 +00:00
Hypolite Petovan d8af084933 Merge pull request 'Tumblr is now using OAuth2' (#1373) from heluecht/friendica-addons:tumblr-oauth2 into develop
Reviewed-on: friendica/friendica-addons#1373
2023-04-25 21:15:07 +02:00
Michael 477e646fba Further updated the readme 2023-04-25 18:48:58 +00:00
Michael 5307ef3a58 Updated readme 2023-04-25 18:47:54 +00:00
Michael 4c3b4dea96 Improved result check 2023-04-25 18:38:18 +00:00
Michael c811f54958 Tumblr is now using OAuth2 2023-04-25 18:33:39 +00:00
Hypolite Petovan becf10cee6 Merge pull request 'Tumblr: We can now import the remote timeline' (#1372) from heluecht/friendica-addons:tumblr-import into develop
Reviewed-on: friendica/friendica-addons#1372
2023-04-24 01:38:19 +02:00
Michael bb72210fc1 Merge remote-tracking branch 'upstream/develop' into tumblr-import 2023-04-23 21:14:50 +00:00
Michael da65314df5 Resructured code, added documentation 2023-04-23 10:26:19 +00:00
Michael 9e7f06ed44 Tumblr: Dashboard import and activities are working 2023-04-22 10:01:09 +00:00
Michael 9c8e7a23a6 Add more types 2023-04-18 21:05:31 +00:00
Michael 71eb147c13 Tumblr: Import the timeline 2023-04-18 05:56:32 +00:00
28 changed files with 1274 additions and 2360 deletions

View file

@ -180,5 +180,5 @@ function ifttt_message($uid, $item)
$link = hash('ripemd128', $item['msg']);
}
Post\Delayed::add($link, $post, Worker::PRIORITY_MEDIUM, Post\Delayed::UNPREPARED);
Post\Delayed::add($link, $post, Worker::PRIORITY_MEDIUM, Post\Delayed::PREPARED);
}

View file

@ -29,68 +29,72 @@ msgstr ""
msgid "Save Settings"
msgstr ""
#: mailstream.php:301
#: mailstream.php:311
msgid "Re:"
msgstr ""
#: mailstream.php:314 mailstream.php:317
#: mailstream.php:324 mailstream.php:327
msgid "Friendica post"
msgstr ""
#: mailstream.php:320
#: mailstream.php:330
msgid "Diaspora post"
msgstr ""
#: mailstream.php:330
#: mailstream.php:340
msgid "Feed item"
msgstr ""
#: mailstream.php:333
#: mailstream.php:343
msgid "Email"
msgstr ""
#: mailstream.php:335
#: mailstream.php:345
msgid "Friendica Item"
msgstr ""
#: mailstream.php:404
#: mailstream.php:419
msgid "Upstream"
msgstr ""
#: mailstream.php:405
#: mailstream.php:420
msgid "URI"
msgstr ""
#: mailstream.php:421
msgid "Local"
msgstr ""
#: mailstream.php:481
#: mailstream.php:499
msgid "Enabled"
msgstr ""
#: mailstream.php:486
#: mailstream.php:504
msgid "Email Address"
msgstr ""
#: mailstream.php:488
#: mailstream.php:506
msgid "Leave blank to use your account email address"
msgstr ""
#: mailstream.php:492
#: mailstream.php:510
msgid "Exclude Likes"
msgstr ""
#: mailstream.php:494
#: mailstream.php:512
msgid "Check this to omit mailing \"Like\" notifications"
msgstr ""
#: mailstream.php:498
#: mailstream.php:516
msgid "Attach Images"
msgstr ""
#: mailstream.php:500
#: mailstream.php:518
msgid ""
"Download images in posts and attach them to the email. Useful for reading "
"email while offline."
msgstr ""
#: mailstream.php:507
#: mailstream.php:525
msgid "Mail Stream Settings"
msgstr ""

View file

@ -4,96 +4,77 @@
#
#
# Translators:
# Aditoo, 2018
# michal_s <msupler@gmail.com>, 2014
# Michal Šupler <msupler@gmail.com>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-11-21 19:15-0500\n"
"PO-Revision-Date: 2014-06-23 09:54+0000\n"
"Last-Translator: Aditoo, 2018\n"
"Language-Team: Czech (http://app.transifex.com/Friendica/friendica/language/cs/)\n"
"POT-Creation-Date: 2014-06-23 14:45+0200\n"
"PO-Revision-Date: 2014-07-07 19:19+0000\n"
"Last-Translator: Michal Šupler <msupler@gmail.com>\n"
"Language-Team: Czech (http://www.transifex.com/projects/p/friendica/language/cs/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: cs\n"
"Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n >= 2 && n <= 4 && n % 1 == 0) ? 1: (n % 1 != 0 ) ? 2 : 3;\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
#: mailstream.php:77
#: mailstream.php:55
msgid "From Address"
msgstr "Adresa odesílatele"
#: mailstream.php:79
#: mailstream.php:57
msgid "Email address that stream items will appear to be from."
msgstr "Adresa, která vysílá položky, se objeví jako odesílatel."
#: mailstream.php:82
#: mailstream.php:60 mailstream.php:282
msgid "Save Settings"
msgstr "Uložit nastavení"
msgstr "Uložit Nastavení"
#: mailstream.php:301
#: mailstream.php:165
msgid "Re:"
msgstr "Re:"
#: mailstream.php:314 mailstream.php:317
#: mailstream.php:173
msgid "Friendica post"
msgstr "Příspěvek z Friendica"
msgstr "Friendica příspěvky"
#: mailstream.php:320
#: mailstream.php:176
msgid "Diaspora post"
msgstr "Příspěvek z Diaspora"
msgstr "Diaspora příspvěvky"
#: mailstream.php:330
#: mailstream.php:183
msgid "Feed item"
msgstr "Položka kanálu"
msgstr "Zdrojová položka"
#: mailstream.php:333
#: mailstream.php:186
msgid "Email"
msgstr "E-mail"
#: mailstream.php:335
#: mailstream.php:188
msgid "Friendica Item"
msgstr "Položka z Friendica"
msgstr "Friendica položka"
#: mailstream.php:404
#: mailstream.php:229
msgid "Upstream"
msgstr "Upstream"
#: mailstream.php:405
#: mailstream.php:230
msgid "Local"
msgstr "Místní"
msgstr "Lokální"
#: mailstream.php:481
msgid "Enabled"
msgstr "Povoleno"
#: mailstream.php:486
#: mailstream.php:274
msgid "Email Address"
msgstr "E-mailová adresa"
#: mailstream.php:488
#: mailstream.php:276
msgid "Leave blank to use your account email address"
msgstr "Ponechte prázdné pro použití vaší e-mailové adresy"
#: mailstream.php:492
msgid "Exclude Likes"
msgstr "Vynechávat \"lajky\""
#: mailstream.php:279
msgid "Enabled"
msgstr "Povoleno"
#: mailstream.php:494
msgid "Check this to omit mailing \"Like\" notifications"
msgstr "Zaškrtnutím vypnete posílání oznámení o \"To se mi líbí\""
#: mailstream.php:498
msgid "Attach Images"
msgstr "Připojit obrázky"
#: mailstream.php:500
msgid ""
"Download images in posts and attach them to the email. Useful for reading "
"email while offline."
msgstr "Stahovat obrázky v příspěvcích a připojovat je k e-mailu. Užitečné pro čtení e-mailu, když jste offline."
#: mailstream.php:507
#: mailstream.php:281
msgid "Mail Stream Settings"
msgstr "Nastavení Mail Stream"
msgstr "Mail Stream nastavení"

View file

@ -3,24 +3,20 @@
if(! function_exists("string_plural_select_cs")) {
function string_plural_select_cs($n){
$n = intval($n);
if (($n == 1 && $n % 1 == 0)) { return 0; } else if (($n >= 2 && $n <= 4 && $n % 1 == 0)) { return 1; } else if (($n % 1 != 0 )) { return 2; } else { return 3; }
if (($n==1)) { return 0; } else if (($n>=2 && $n<=4)) { return 1; } else { return 2; }
}}
$a->strings['From Address'] = 'Adresa odesílatele';
$a->strings['Email address that stream items will appear to be from.'] = 'Adresa, která vysílá položky, se objeví jako odesílatel.';
$a->strings['Save Settings'] = 'Uložit nastavení';
$a->strings['Save Settings'] = 'Uložit Nastavení';
$a->strings['Re:'] = 'Re:';
$a->strings['Friendica post'] = 'Příspěvek z Friendica';
$a->strings['Diaspora post'] = 'Příspěvek z Diaspora';
$a->strings['Feed item'] = 'Položka kanálu';
$a->strings['Friendica post'] = 'Friendica příspěvky';
$a->strings['Diaspora post'] = 'Diaspora příspvěvky';
$a->strings['Feed item'] = 'Zdrojová položka';
$a->strings['Email'] = 'E-mail';
$a->strings['Friendica Item'] = 'Položka z Friendica';
$a->strings['Friendica Item'] = 'Friendica položka';
$a->strings['Upstream'] = 'Upstream';
$a->strings['Local'] = 'Místní';
$a->strings['Enabled'] = 'Povoleno';
$a->strings['Local'] = 'Lokální';
$a->strings['Email Address'] = 'E-mailová adresa';
$a->strings['Leave blank to use your account email address'] = 'Ponechte prázdné pro použití vaší e-mailové adresy';
$a->strings['Exclude Likes'] = 'Vynechávat "lajky"';
$a->strings['Check this to omit mailing "Like" notifications'] = 'Zaškrtnutím vypnete posílání oznámení o "To se mi líbí"';
$a->strings['Attach Images'] = 'Připojit obrázky';
$a->strings['Download images in posts and attach them to the email. Useful for reading email while offline.'] = 'Stahovat obrázky v příspěvcích a připojovat je k e-mailu. Užitečné pro čtení e-mailu, když jste offline.';
$a->strings['Mail Stream Settings'] = 'Nastavení Mail Stream';
$a->strings['Enabled'] = 'Povoleno';
$a->strings['Mail Stream Settings'] = 'Mail Stream nastavení';

View file

@ -5,17 +5,16 @@
#
# Translators:
# Andreas H., 2014
# foss <oss@disr.it>, 2022
# Tobias Diekershoff <tobias.diekershoff@gmx.net>, 2018
# Ulf Rompe <transifex.com@rompe.org>, 2019
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-11-21 19:15-0500\n"
"PO-Revision-Date: 2014-06-23 09:54+0000\n"
"Last-Translator: foss <oss@disr.it>, 2022\n"
"Language-Team: German (http://app.transifex.com/Friendica/friendica/language/de/)\n"
"POT-Creation-Date: 2018-03-11 19:13+0100\n"
"PO-Revision-Date: 2019-02-18 15:05+0000\n"
"Last-Translator: Ulf Rompe <transifex.com@rompe.org>\n"
"Language-Team: German (http://www.transifex.com/Friendica/friendica/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@ -30,72 +29,72 @@ msgstr "Absender"
msgid "Email address that stream items will appear to be from."
msgstr "E-Mail-Adresse, die in hochgeladenen Artikeln erscheint."
#: mailstream.php:82
#: mailstream.php:82 mailstream.php:380
msgid "Save Settings"
msgstr "Einstellungen speichern"
#: mailstream.php:301
#: mailstream.php:223
msgid "Re:"
msgstr "Re:"
#: mailstream.php:314 mailstream.php:317
#: mailstream.php:231
msgid "Friendica post"
msgstr "Friendica-Veröffentlichung"
#: mailstream.php:320
#: mailstream.php:234
msgid "Diaspora post"
msgstr "Diaspora-Veröffentlichung"
#: mailstream.php:330
#: mailstream.php:244
msgid "Feed item"
msgstr "Artikel-Feed"
#: mailstream.php:333
#: mailstream.php:247
msgid "Email"
msgstr "E-Mail"
#: mailstream.php:335
#: mailstream.php:249
msgid "Friendica Item"
msgstr "Friendica-Artikel"
#: mailstream.php:404
#: mailstream.php:293
msgid "Upstream"
msgstr "Upstream"
#: mailstream.php:405
#: mailstream.php:294
msgid "Local"
msgstr "Lokal"
#: mailstream.php:481
#: mailstream.php:362
msgid "Enabled"
msgstr "Aktiv"
msgstr "eingeschaltet"
#: mailstream.php:486
#: mailstream.php:366
msgid "Email Address"
msgstr "E-Mail-Adresse"
#: mailstream.php:488
#: mailstream.php:368
msgid "Leave blank to use your account email address"
msgstr "Leer lassen für deine Konto-E-Mail-Addresse"
#: mailstream.php:492
#: mailstream.php:371
msgid "Exclude Likes"
msgstr "Likes ignorieren"
#: mailstream.php:494
#: mailstream.php:373
msgid "Check this to omit mailing \"Like\" notifications"
msgstr "Diese Option verhindert das Versenden von \"Like\"-Benachrichtigungen per E-Mail."
#: mailstream.php:498
#: mailstream.php:376
msgid "Attach Images"
msgstr "Bilder anhängen"
#: mailstream.php:500
#: mailstream.php:378
msgid ""
"Download images in posts and attach them to the email. Useful for reading "
"email while offline."
msgstr "Sollen Bilder, die im Beitrag eingebettet sind, als Dateianhang in den E-Mails verschickt werden?"
#: mailstream.php:507
#: mailstream.php:379
msgid "Mail Stream Settings"
msgstr "Mail-Nachrichten-Einstellungen"

View file

@ -16,7 +16,7 @@ $a->strings['Email'] = 'E-Mail';
$a->strings['Friendica Item'] = 'Friendica-Artikel';
$a->strings['Upstream'] = 'Upstream';
$a->strings['Local'] = 'Lokal';
$a->strings['Enabled'] = 'Aktiv';
$a->strings['Enabled'] = 'eingeschaltet';
$a->strings['Email Address'] = 'E-Mail-Adresse';
$a->strings['Leave blank to use your account email address'] = 'Leer lassen für deine Konto-E-Mail-Addresse';
$a->strings['Exclude Likes'] = 'Likes ignorieren';

View file

@ -9,90 +9,90 @@ msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-11-21 19:15-0500\n"
"PO-Revision-Date: 2014-06-23 09:54+0000\n"
"Last-Translator: fabrixxm <fabrix.xm@gmail.com>, 2014,2018\n"
"Language-Team: Italian (http://app.transifex.com/Friendica/friendica/language/it/)\n"
"POT-Creation-Date: 2021-02-01 18:15+0100\n"
"PO-Revision-Date: 2018-03-19 13:12+0000\n"
"Last-Translator: fabrixxm <fabrix.xm@gmail.com>\n"
"Language-Team: Italian (http://www.transifex.com/Friendica/friendica/language/it/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: it\n"
"Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: mailstream.php:77
#: mailstream.php:66
msgid "From Address"
msgstr "Indirizzo di invio"
#: mailstream.php:79
#: mailstream.php:68
msgid "Email address that stream items will appear to be from."
msgstr "Indirizzo email da cui i messaggi appariranno inviati"
#: mailstream.php:82
#: mailstream.php:71 mailstream.php:382
msgid "Save Settings"
msgstr "Salva Impostazioni"
#: mailstream.php:301
#: mailstream.php:225
msgid "Re:"
msgstr "R:"
#: mailstream.php:314 mailstream.php:317
#: mailstream.php:233
msgid "Friendica post"
msgstr "Messaggio Friendica"
#: mailstream.php:320
#: mailstream.php:236
msgid "Diaspora post"
msgstr "Messaggio Diaspora"
#: mailstream.php:330
#: mailstream.php:246
msgid "Feed item"
msgstr "Elemento da feed"
#: mailstream.php:333
#: mailstream.php:249
msgid "Email"
msgstr "Email"
#: mailstream.php:335
#: mailstream.php:251
msgid "Friendica Item"
msgstr "Elemento da Friendica"
#: mailstream.php:404
#: mailstream.php:296
msgid "Upstream"
msgstr "Upstream"
#: mailstream.php:405
#: mailstream.php:297
msgid "Local"
msgstr "Locale"
#: mailstream.php:481
#: mailstream.php:364
msgid "Enabled"
msgstr "Abilitato"
#: mailstream.php:486
#: mailstream.php:368
msgid "Email Address"
msgstr "Indirizzo Email"
#: mailstream.php:488
#: mailstream.php:370
msgid "Leave blank to use your account email address"
msgstr "Lascia in bianco per usare l'indirizzo email del tuo account"
#: mailstream.php:492
#: mailstream.php:373
msgid "Exclude Likes"
msgstr "Escludi \"Mi Piace\""
#: mailstream.php:494
#: mailstream.php:375
msgid "Check this to omit mailing \"Like\" notifications"
msgstr "Seleziona per evitare di inviare notifiche per \"Mi Piace\""
#: mailstream.php:498
#: mailstream.php:378
msgid "Attach Images"
msgstr "Allega Immagini"
#: mailstream.php:500
#: mailstream.php:380
msgid ""
"Download images in posts and attach them to the email. Useful for reading "
"email while offline."
msgstr "Scarica le immagini nei messaggi e le allega alle email. Utile per leggere le email mentre si è offline."
#: mailstream.php:507
#: mailstream.php:381
msgid "Mail Stream Settings"
msgstr "Impostazioni Mail Stream"

View file

@ -3,7 +3,7 @@
if(! function_exists("string_plural_select_it")) {
function string_plural_select_it($n){
$n = intval($n);
if ($n == 1) { return 0; } else if ($n != 0 && $n % 1000000 == 0) { return 1; } else { return 2; }
return intval($n != 1);
}}
$a->strings['From Address'] = 'Indirizzo di invio';
$a->strings['Email address that stream items will appear to be from.'] = 'Indirizzo email da cui i messaggi appariranno inviati';

View file

@ -32,7 +32,6 @@ function mailstream_install()
Hook::register('addon_settings_post', 'addon/mailstream/mailstream.php', 'mailstream_addon_settings_post');
Hook::register('post_local_end', 'addon/mailstream/mailstream.php', 'mailstream_post_hook');
Hook::register('post_remote_end', 'addon/mailstream/mailstream.php', 'mailstream_post_hook');
Hook::register('cron', 'addon/mailstream/mailstream.php', 'mailstream_cron');
Hook::register('mailstream_send_hook', 'addon/mailstream/mailstream.php', 'mailstream_send_hook');
Logger::info("mailstream: installed");
@ -67,9 +66,10 @@ function mailstream_module() {}
/**
* Adds an item in "addon features" in the admin menu of the site
*
* @param App $a App object (unused)
* @param string $o HTML form data
*/
function mailstream_addon_admin(string &$o)
function mailstream_addon_admin(App $a, string &$o)
{
$frommail = DI::config()->get('mailstream', 'frommail');
$template = Renderer::getMarkupTemplate('admin.tpl', 'addon/mailstream/');
@ -103,14 +103,14 @@ function mailstream_addon_admin_post()
*/
function mailstream_generate_id(string $uri): string
{
$host = DI::baseUrl()->getHost();
$host = DI::baseUrl()->getHostname();
$resource = hash('md5', $uri);
$message_id = "<" . $resource . "@" . $host . ">";
Logger::debug('mailstream: Generated message ID ' . $message_id . ' for URI ' . $uri);
return $message_id;
}
function mailstream_send_hook(array $data)
function mailstream_send_hook(App $a, array $data)
{
$criteria = array('uid' => $data['uid'], 'contact-id' => $data['contact-id'], 'uri' => $data['uri']);
$item = Post::selectFirst([], $criteria);
@ -138,15 +138,16 @@ function mailstream_send_hook(array $data)
* mailstream is enabled and the necessary data is available, forks a
* workerqueue item to send the email.
*
* @param App $a App object (unused)
* @param array $item content of the item (may or may not already be stored in the item table)
* @return void
*/
function mailstream_post_hook(array &$item)
function mailstream_post_hook(App $a, array &$item)
{
mailstream_check_version();
if (!DI::pConfig()->get($item['uid'], 'mailstream', 'enabled')) {
Logger::debug('mailstream: not enabled for item ' . $item['id']);
Logger::debug('mailstream: not enabled.', ['item' => $item['id'], ' uid ' => $item['uid']]);
return;
}
if (!$item['uid']) {
@ -161,8 +162,8 @@ function mailstream_post_hook(array &$item)
Logger::debug('mailstream: no uri for item ' . $item['id']);
return;
}
if (!$item['plink']) {
Logger::debug('mailstream: no plink for item ' . $item['id']);
if ($item['verb'] == Activity::ANNOUNCE) {
Logger::debug('mailstream: announce item ', ['item' => $item['id']]);
return;
}
if (DI::pConfig()->get($item['uid'], 'mailstream', 'nolikes')) {
@ -395,7 +396,9 @@ function mailstream_send(string $message_id, array $item, array $user): bool
$mail->addCustomHeader('In-Reply-To: ' . mailstream_generate_id($item['thr-parent']));
}
$mail->addCustomHeader('X-Friendica-Mailstream-URI: ' . $item['uri']);
$mail->addCustomHeader('X-Friendica-Mailstream-Plink: ' . $item['plink']);
if ($item['plink']) {
$mail->addCustomHeader('X-Friendica-Mailstream-Plink: ' . $item['plink']);
}
$encoding = 'base64';
foreach ($attachments as $url => $image) {
$mail->AddStringEmbeddedImage(
@ -411,9 +414,10 @@ function mailstream_send(string $message_id, array $item, array $user): bool
$template = Renderer::getMarkupTemplate('mail.tpl', 'addon/mailstream/');
$mail->AltBody = BBCode::toPlaintext($item['body']);
$item['body'] = BBCode::convertForUriId($item['uri-id'], $item['body'], BBCode::CONNECTORS);
$item['url'] = DI::baseUrl() . '/display/' . $item['guid'];
$item['url'] = DI::baseUrl()->get() . '/display/' . $item['guid'];
$mail->Body = Renderer::replaceMacros($template, [
'$upstream' => DI::l10n()->t('Upstream'),
'$uri' => DI::l10n()->t('URI'),
'$local' => DI::l10n()->t('Local'),
'$item' => $item]);
$mail->Body = mailstream_html_wrap($mail->Body);
@ -447,7 +451,7 @@ function mailstream_html_wrap(string &$text)
$lines[$i] = preg_replace('/ /', "\n", $lines[$i], 1);
}
$text = implode($lines);
return $text;
return $text;
}
/**
@ -464,8 +468,7 @@ function mailstream_convert_table_entries()
'message_id' => $ms_item_id['message-id'],
'tries' => 0);
if (!$ms_item_id['message-id'] || !strlen($ms_item_id['message-id'])) {
Logger::info('mailstream_cron: Item ' .
$ms_item_id['id'] . ' URI ' . $ms_item_id['uri'] . ' has no message-id');
Logger::info('mailstream_convert_table_entries: item has no message-id.', 'item' => $ms_item_id['id'], 'uri' => $ms_item_id['uri']]);
continue;
}
Logger::info('mailstream_convert_table_entries: convert item to workerqueue', $send_hook_data);
@ -477,10 +480,11 @@ function mailstream_convert_table_entries()
/**
* Form for configuring mailstream features for a user
*
* @param App $a App object
* @param array $data Hook data array
* @throws \Friendica\Network\HTTPException\ServiceUnavailableException
*/
function mailstream_addon_settings(array &$data)
function mailstream_addon_settings(App &$a, array &$data)
{
$enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'enabled');
$address = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'address');
@ -524,10 +528,11 @@ function mailstream_addon_settings(array &$data)
/**
* Process data submitted to user's mailstream features form
* @param App $a
* @param array $post POST data
* @return void
*/
function mailstream_addon_settings_post(array $post)
function mailstream_addon_settings_post(App $a, array $post)
{
if (!DI::userSession()->getLocalUserId() || empty($post['mailstream-submit'])) {
return;

View file

@ -6,5 +6,6 @@
<div class="mailstream-item-body">{{$item.body nofilter}}</div>
{{if $item.plink}}
<div>{{$upstream}}: <a class="mailstream-item-plink" href="{{$item.plink}}">{{$item.plink}}</a><div>
<div>{{$uri}}: <a class="mailstream-item-uri" href="{{$item.uri}}">{{$item.uri}}</a><div>
<div>{{$local}}: <a class="mailstream-item-url" href="{{$item.url}}">{{$item.url}}</a></div>
{{/if}}

View file

@ -1,23 +0,0 @@
CREATE TABLE IF NOT EXISTS `phototrack_photo_use` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`resource-id` char(64) NOT NULL,
`table` char(64) NOT NULL,
`field` char(64) NOT NULL,
`row-id` int(11) NOT NULL,
`checked` timestamp NOT NULL DEFAULT now(),
PRIMARY KEY (`id`),
INDEX `resource-id` (`resource-id`),
INDEX `row` (`table`,`field`,`row-id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE IF NOT EXISTS `phototrack_row_check` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`table` char(64) NOT NULL,
`row-id` int(11) NOT NULL,
`checked` timestamp NOT NULL DEFAULT now(),
PRIMARY KEY (`id`),
INDEX `row` (`table`,`row-id`),
INDEX `checked` (`checked`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
SELECT TRUE

View file

@ -1,274 +0,0 @@
<?php
/**
* Name: Photo Track
* Description: Track which photos are actually being used and delete any others
* Version: 1.0
* Author: Matthew Exon <http://mat.exon.name>
*/
/*
* List of tables and the fields that are checked:
*
* contact: photo thumb micro about
* fcontact: photo
* fsuggest: photo
* gcontact: photo about
* item: body
* item-content: body
* mail: from-photo
* notify: photo
* profile: photo thumb about
*/
use Friendica\Core\Addon;
use Friendica\Core\Logger;
use Friendica\Object\Image;
use Friendica\Database\DBA;
use Friendica\Util\Images;
use Friendica\Util\DateTimeFormat;
use Friendica\DI;
if (!defined('PHOTOTRACK_DEFAULT_BATCH_SIZE')) {
define('PHOTOTRACK_DEFAULT_BATCH_SIZE', 1000);
}
// Time in *minutes* between searching for photo uses
if (!defined('PHOTOTRACK_DEFAULT_SEARCH_INTERVAL')) {
define('PHOTOTRACK_DEFAULT_SEARCH_INTERVAL', 10);
}
function phototrack_install() {
global $db;
Addon::registerHook('post_local_end', 'addon/phototrack/phototrack.php', 'phototrack_post_local_end');
Addon::registerHook('post_remote_end', 'addon/phototrack/phototrack.php', 'phototrack_post_remote_end');
Addon::registerHook('notifier_end', 'addon/phototrack/phototrack.php', 'phototrack_notifier_end');
Addon::registerHook('cron', 'addon/phototrack/phototrack.php', 'phototrack_cron');
if (DI::config()->get('phototrack', 'dbversion') != '0.1') {
$schema = file_get_contents(dirname(__file__).'/database.sql');
$arr = explode(';', $schema);
foreach ($arr as $a) {
if (!DBA::e($a)) {
Logger::warning('Unable to create database table: ' . DBA::errorMessage());
return;
}
}
DI::config()->set('phototrack', 'dbversion', '0.1');
}
}
function phototrack_uninstall() {
Addon::unregisterHook('post_local_end', 'addon/phototrack/phototrack.php', 'phototrack_post_local_end');
Addon::unregisterHook('post_remote_end', 'addon/phototrack/phototrack.php', 'phototrack_post_remote_end');
Addon::unregisterHook('notifier_end', 'addon/phototrack/phototrack.php', 'phototrack_notifier_end');
Addon::unregisterHook('cron', 'addon/phototrack/phototrack.php', 'phototrack_cron');
}
function phototrack_module() {}
function phototrack_finished_row($table, $id) {
$existing = DBA::selectFirst('phototrack_row_check', ['id'], ['table' => $table, 'row-id' => $id]);
if (!is_bool($existing)) {
DBA::update('phototrack_row_check', ['checked' => DateTimeFormat::utcNow()], ['table' => $table, 'row-id' => $id]);
}
else {
DBA::insert('phototrack_row_check', ['table' => $table, 'row-id' => $id, 'checked' => DateTimeFormat::utcNow()]);
}
}
function phototrack_photo_use($photo, $table, $field, $id) {
Logger::debug('@@@ phototrack_photo_use ' . $photo);
foreach (Images::supportedTypes() as $m => $e) {
$photo = str_replace(".$e", '', $photo);
}
if (substr($photo, -2, 1) == '-') {
$resolution = intval(substr($photo,-1,1));
$photo = substr($photo,0,-2);
}
if (strlen($photo) != 32) {
return;
}
$r = DBA::selectFirst('photo', ['resource-id'], ['resource-id' => $photo]);
if (!DBA::isResult($r)) {
return;
}
$rid = $r['resource-id'];
$existing = DBA::selectFirst('phototrack_photo_use', ['id'], ['resource-id' => $rid, 'table' => $table, 'field' => $field, 'row-id' => $id]);
if (DBA::isResult($existing)) {
DBA::update('phototrack_photo_use', ['checked' => DateTimeFormat::utcNow()], ['resource-id' => $rid, 'table' => $table, 'field' => $field, 'row-id' => $id]);
}
else {
DBA::insert('phototrack_photo_use', ['resource-id' => $rid, 'table' => $table, 'field' => $field, 'row-id' => $id, 'checked' => DateTimeFormat::utcNow()]);
}
}
function phototrack_check_field_url($a, $table, $field, $id, $url) {
Logger::info('@@@ phototrack_check_field_url table ' . $table . ' field ' . $field . ' id ' . $id . ' url ' . $url);
$baseurl = DI::baseUrl()->get(true);
if (strpos($url, $baseurl) === FALSE) {
return;
}
else {
$url = substr($url, strlen($baseurl));
Logger::info('@@@ phototrack_check_field_url funny url stuff ' . $url . ' base ' . $baseurl);
}
if (strpos($url, '/photo/') === FALSE) {
return;
}
else {
$url = substr($url, strlen('/photo/'));
Logger::info('@@@ phototrack_check_field_url more url stuff ' . $url);
}
if (preg_match('/([0-9a-z]{32})/', $url, $matches)) {
$rid = $matches[0];
Logger::info('@@@ phototrack_check_field_url rid ' . $rid);
phototrack_photo_use($rid, $table, $field, $id);
}
}
function phototrack_check_field_bbcode($a, $table, $field, $id, $value) {
$baseurl = DI::baseUrl()->get(true);
$matches = array();
preg_match_all("/\[img(\=([0-9]*)x([0-9]*))?\](.*?)\[\/img\]/ism", $value, $matches);
foreach ($matches[4] as $url) {
phototrack_check_field_url($a, $table, $field, $id, $url);
}
}
function phototrack_post_local_end(&$a, &$item) {
phototrack_check_row($a, 'item', $item);
phototrack_check_row($a, 'item-content', $item);
}
function phototrack_post_remote_end(&$a, &$item) {
phototrack_check_row($a, 'item', $item);
phototrack_check_row($a, 'item-content', $item);
}
function phototrack_notifier_end($item) {
}
function phototrack_check_row($a, $table, $row) {
switch ($table) {
case 'item':
$fields = array(
'body' => 'bbcode');
break;
case 'item-content':
$fields = array(
'body' => 'bbcode');
break;
case 'contact':
$fields = array(
'photo' => 'url',
'thumb' => 'url',
'micro' => 'url',
'about' => 'bbcode');
break;
case 'fcontact':
$fields = array(
'photo' => 'url');
break;
case 'fsuggest':
$fields = array(
'photo' => 'url');
break;
case 'gcontact':
$fields = array(
'photo' => 'url',
'about' => 'bbcode');
break;
default: $fields = array(); break;
}
foreach ($fields as $field => $type) {
switch ($type) {
case 'bbcode': phototrack_check_field_bbcode($a, $table, $field, $row['id'], $row[$field]); break;
case 'url': phototrack_check_field_url($a, $table, $field, $row['id'], $row[$field]); break;
}
}
phototrack_finished_row($table, $row['id']);
}
function phototrack_batch_size() {
$batch_size = DI::config()->get('phototrack', 'batch_size');
if ($batch_size > 0) {
return $batch_size;
}
return PHOTOTRACK_DEFAULT_BATCH_SIZE;
}
function phototrack_search_table($a, $table) {
$batch_size = phototrack_batch_size();
$rows = DBA::p("SELECT `$table`.* FROM `$table` LEFT OUTER JOIN phototrack_row_check ON ( phototrack_row_check.`table` = '$table' AND phototrack_row_check.`row-id` = `$table`.id ) WHERE ( ( phototrack_row_check.checked IS NULL ) OR ( phototrack_row_check.checked < DATE_SUB(NOW(), INTERVAL 1 MONTH) ) ) ORDER BY phototrack_row_check.checked LIMIT $batch_size");
if (DBA::isResult($rows)) {
while ($row = DBA::fetch($rows)) {
phototrack_check_row($a, $table, $row);
}
}
$r = DBA::p("SELECT COUNT(*) FROM `$table` LEFT OUTER JOIN phototrack_row_check ON ( phototrack_row_check.`table` = '$table' AND phototrack_row_check.`row-id` = `$table`.id ) WHERE ( ( phototrack_row_check.checked IS NULL ) OR ( phototrack_row_check.checked < DATE_SUB(NOW(), INTERVAL 1 MONTH) ) )");
Logger::info("@@@ phototrack_search_table " . print_r(DBA::fetch($r)));
$remaining = DBA::fetch($r)['count'];
Logger::info('phototrack: searched ' . DBA::numRows($rows) . ' rows in table ' . $table . ', ' . $remaining . ' still remaining to search');
return $remaining;
}
function phototrack_cron_time() {
$prev_remaining = DI::config()->get('phototrack', 'remaining_items');
if ($prev_remaining > 10 * phototrack_batch_size()) {
Logger::debug('phototrack: more than ' . (10 * phototrack_batch_size()) . ' items remaining');
return true;
}
$last = DI::config()->get('phototrack', 'last_search');
$search_interval = intval(DI::config()->get('phototrack', 'search_interval'));
if (!$search_interval) {
$search_interval = PHOTOTRACK_DEFAULT_SEARCH_INTERVAL;
}
if ($last) {
$next = $last + ($search_interval * 60);
if ($next > time()) {
Logger::debug('phototrack: search interval not reached');
return false;
}
}
return true;
}
function phototrack_cron($a, $b) {
if (!phototrack_cron_time()) {
return;
}
DI::config()->set('phototrack', 'last_search', time());
$remaining = 0;
$remaining += phototrack_search_table($a, 'item');
$remaining += phototrack_search_table($a, 'item-content');
$remaining += phototrack_search_table($a, 'contact');
$remaining += phototrack_search_table($a, 'fcontact');
$remaining += phototrack_search_table($a, 'fsuggest');
$remaining += phototrack_search_table($a, 'gcontact');
DI::config()->set('phototrack', 'remaining_items', $remaining);
if ($remaining === 0) {
phototrack_tidy();
}
}
function phototrack_tidy() {
$batch_size = phototrack_batch_size();
DBA::e('CREATE TABLE IF NOT EXISTS `phototrack-temp` (`resource-id` char(255) not null)');
DBA::e('INSERT INTO `phototrack-temp` SELECT DISTINCT(`resource-id`) FROM photo WHERE photo.`created` < DATE_SUB(NOW(), INTERVAL 2 MONTH)');
$rows = DBA::p('SELECT `phototrack-temp`.`resource-id` FROM `phototrack-temp` LEFT OUTER JOIN phototrack_photo_use ON (`phototrack-temp`.`resource-id` = phototrack_photo_use.`resource-id`) WHERE phototrack_photo_use.id IS NULL limit ' . /*$batch_size*/1000);
if (DBA::isResult($rows)) {
foreach ($rows as $row) {
Logger::debug('phototrack: remove photo ' . $row['resource-id']);
DBA::e('DELETE FROM photo WHERE `resource-id` = "' . $row['resource-id'] . '"');
}
Logger::info('phototrack_tidy: deleted ' . DBA::numRows($rows) . ' photos');
}
DBA::e('DROP TABLE `phototrack-temp`');
$rows = DBA::p('SELECT id FROM phototrack_photo_use WHERE checked < DATE_SUB(NOW(), INTERVAL 14 DAY)');
foreach ($rows as $row) {
DBA::e( 'DELETE FROM phototrack_photo_use WHERE id = ' . $row['id']);
}
Logger::info('phototrack_tidy: deleted ' . DBA::numRows($rows) . ' phototrack_photo_use rows');
}

View file

@ -1,11 +0,0 @@
"SELECT `uid` FROM `contact` WHERE `id` = %d AND `reason` = 'publicise'", intval($item['contact-id']));
if (!$r1) {
return;
}
Logger::debug('Publicise: moving to wall: ' . $item['uid'] . ' ' . $item['contact-id'] . ' ' . $item['uri']);
$item['type'] = 'wall';
$item['wall'] = 1;
$item['private'] = 0;
}

View file

@ -1,39 +0,0 @@
{{*
* AUTOMATICALLY GENERATED TEMPLATE
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
*
*}}
<form method="post">
<table>
<thead>
<tr>
<th>{{$feed_t}}</th>
<th>{{$publicised_t}}</th>
<th>{{$comments_t}}</th>
<th>{{$expire_t}}</th>
</tr>
</thead>
<tbody>
{{foreach $feeds as $f}}
<tr>
<td>
<a href="{{$f.url}}">
<img style="vertical-align:middle" src='{{$f.micro}}'>
<span style="margin-left:1em">{{$f.name}}</span>
</a>
</td>
<td>
{{include file="field_yesno.tpl" field=$f.enabled}}
</td>
<td>
{{include file="field_yesno.tpl" field=$f.comments}}
</td>
<td>
<input name="publicise-expire-{{$f.id}}" value="{{$f.expire}}">
</td>
</tr>
{{/foreach}}
</tbody>
</table>
<input type="submit" size="70" value="{{$submit_t}}">
</form>

View file

@ -1,42 +0,0 @@
CREATE TABLE IF NOT EXISTS `retriever_rule` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`contact-id` int(11) NOT NULL,
`data` mediumtext NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
KEY `contact-id` (`contact-id`)
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE IF NOT EXISTS `retriever_item` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`item-uri` varbinary(255) NOT NULL,
`item-uid` int(10) unsigned NOT NULL DEFAULT '0',
`contact-id` int(10) unsigned NOT NULL DEFAULT '0',
`resource` int(11) NOT NULL,
`finished` tinyint(1) unsigned NOT NULL DEFAULT '0',
KEY `resource` (`resource`),
KEY `finished` (`finished`),
KEY `item-uid` (`item-uid`),
KEY `all` (`item-uri`, `item-uid`, `contact-id`),
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE IF NOT EXISTS `retriever_resource` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`item-uid` int(10) unsigned NOT NULL DEFAULT '0',
`contact-id` int(10) unsigned NOT NULL DEFAULT '0',
`type` char(255) NULL DEFAULT NULL,
`binary` int(1) NOT NULL DEFAULT 0,
`url` varbinary(700) NOT NULL,
`created` timestamp NOT NULL DEFAULT now(),
`completed` timestamp NULL DEFAULT NULL,
`last-try` timestamp NULL DEFAULT NULL,
`num-tries` int(11) NOT NULL DEFAULT 0,
`data` mediumblob NULL DEFAULT NULL,
`http-code` smallint(1) unsigned NULL DEFAULT NULL,
`redirect-url` varbinary(700) NOT NULL,
KEY `url` (`url`),
KEY `completed` (`completed`),
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

File diff suppressed because it is too large Load diff

View file

@ -1,9 +0,0 @@
{{*
* AUTOMATICALLY GENERATED TEMPLATE
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
*
*}}
{{include file="field_input.tpl" field=$downloads_per_cron}}
{{include file="field_checkbox.tpl" field=$allow_images}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}"></div>

View file

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes" version="4.0"/>
<xsl:template match="text()"/>
{{function clause_xpath}}{{if !$clause.attribute}}{{$clause.element}}{{elseif $clause.attribute == 'class'}}{{$clause.element}}[contains(concat(' ', normalize-space(@class), ' '), '{{$clause.value}}')]{{else}}{{$clause.element}}[@{{$clause.attribute}}='{{$clause.value}}']{{/if}}{{/function}}
{{foreach $spec.include as $clause}}
<xsl:template match="{{clause_xpath clause=$clause}}">
<xsl:copy>
<xsl:apply-templates select="node()|@*" mode="remove"/>
</xsl:copy>
</xsl:template>{{/foreach}}
{{foreach $spec.exclude as $clause}}
<xsl:template match="{{clause_xpath clause=$clause}}" mode="remove"/>{{/foreach}}
<xsl:template match="node()|@*" mode="remove">
<xsl:copy>
<xsl:apply-templates select="node()|@*" mode="remove"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- attempt to replace relative URLs with absolute URLs -->
<!-- http://stackoverflow.com/questions/3824631/replace-href-value-in-anchor-tags-of-html-using-xslt -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes" version="4.0"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*/@src[starts-with(.,'.')]">
<xsl:attribute name="src">
<xsl:value-of select="concat('{{$dirurl}}',.)"/>
</xsl:attribute>
</xsl:template>
<xsl:template match="*/@src[starts-with(.,'/')]">
<xsl:attribute name="src">
<xsl:value-of select="concat('{{$rooturl}}',.)"/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>

View file

@ -1,163 +0,0 @@
<h2>Retriever Plugin Help</h2>
<p>
This plugin replaces the short excerpts you normally get in RSS feeds
with the full content of the article from the source website. You
specify which part of the page you're interested in with a set of
rules. When each item arrives, the plugin downloads the full page
from the website, extracts content using the rules, and replaces the
original article.
</p>
<p>
There's a few reasons you may want to do this. The source website
might be slow or overloaded. The source website might be
untrustworthy, in which case using Friendica to scrub the HTML is a
good idea. You might be on a LAN that blacklists certain websites.
It also works neatly with the mailstream plugin, allowing you to read
a news stream comfortably without needing continuous Internet
connectivity.
</p>
<p>
However, setting up retriever can be quite tricky since it depends on
the internal design of the website. That was designed to make life
easy for the website's developers, not for you. You'll need to have
some familiarity with HTML, and be willing to adapt when the website
suddenly changes everything without notice.
</p>
<h3>Configuring Retriever for a feed</h3>
<p>
To set up retriever for an RSS feed, go to the "Contacts" page and
find your feed. Then click on the drop-down menu on the contact.
Select "Retriever" to get to the retriever configuration.
</p>
<p>
The "Include" configuration section specifies parts of the page to
include in the article. Each row has three components:
</p>
<ul>
<li>An HTML tag (e.g. "div", "span", "p")</li>
<li>An attribute (usually "class" or "id")</li>
<li>A value for the attribute</li>
</ul>
<p>
A simple case is when the article is wrapped in a "div" element:
</p>
<pre>
...
&lt;div class="ArticleWrapper"&gt;
&lt;h2&gt;Man Bites Dog&lt;/h2&gt;
&lt;img src="mbd.jpg"&gt;
&lt;p&gt;
Residents of the sleepy community of Nowheresville were
shocked yesterday by the sight of creepy local weirdo Jim
McOddman assaulting innocent local dog Snufflekins with his
false teeth.
&lt;/p&gt;
...
&lt;/div&gt;
...
</pre>
<p>
You then specify the tag "div", attribute "class", and value
"ArticleWrapper". Everything else in the page, such as navigation
panels and menus and footers and so on, will be discarded. If there
is more than one section of the page you want to include, specify each
one on a separate row. If the matching section contains some sections
you want to remove, specify those in the "Exclude" section in the same
way.
</p>
<p>
Once you've got a configuration that you think will work, you can try
it out on some existing articles. Type a number into the
"Retrospectively Apply" box and click "Submit". After a while
(exactly how long depends on your system's cron configuration) the new
articles should be available.
</p>
<h3>Techniques</h3>
<p>
You can leave the attribute and value blank to include all the
corresponding elements with the specified tag name. You can also use
a tag name of just an asterisk ("*"), which will match any element type with the
specified attribute regardless of the tag.
</p>
<p>
Note that the "class" attribute is a special case. Many web page
templates will put multiple different classes in the same element,
separated by spaces. If you specify an attribute of "class" it will
match an element if any of its classes matches the specified value.
For example:
</p>
<pre>
&lt;div class="article breaking-news"&gt;
</pre>
<p>
In this case you can specify a value of "article", or "breaking-news".
You can also specify "article breaking-news", but that won't match if
the website suddenly changes to "breaking-news article", so that's not
recommended.
</p>
<p>
One useful trick you can try is using the website's "print" pages.
Many news sites have print versions of all their articles. These are
usually drastically simplified compared to the live website page.
Sometimes this is a good way to get the whole article when it's
normally split across multiple pages.
</p>
<p>
Hopefully the URL for the print page is a predictable variant of the
normal article URL. For example, an article URL like:
</p>
<pre>
http://www.newssite.com/article-8636.html
</pre>
<p>
...might have a print version at:
</p>
<pre>
http://www.newssite.com/print/article-8636.html
</pre>
<p>
To change the URL used to retrieve the page, use the "URL Pattern" and
"URL Replace" fields. The pattern is a regular expression matching
part of the URL to replace. In this case, you might use a pattern of
"/article" and a replace string of "/print/article". A common pattern
is simply a dollar sign ("$"), used to add the replace string to the end of the URL.
</p>
<h3>Background Processing</h3>
<p>
Note that retrieving and processing the articles can take some time,
so it's done in the background. Incoming articles will be marked as
invisible while they're in the process of being downloaded. If a URL
fails, the plugin will keep trying at progressively longer intervals
for up to a month, in case the website is temporarily overloaded or
the network is down.
</p>
{{if $allow_images}}
<h3>Retrieving Images</h3>
<p>
Retriever can also optionally download images and store them in the
local Friendica instance. Just check the "Download Images" box. You
can also download images in every item from your network, whether it's
an RSS feed or not. Go to the "Settings" page and
click <a href="$config">"Plugin settings"</a>. Then check the "All
Photos" box in the "Retriever Settings" section and click "Submit".
</p>
{{/if}}
<h2>Configure Feeds:</h2>
<div>
{{foreach $feeds as $feed}}
<div class="contact-entry-wrapper" id="contact-entry-wrapper-{{$feed.id}}">
<a href="{{$feed.url}} title="{{$feed.img_hover}}">
<div class="contact-entry-photo-wrapper">
<div class="contact-entry-photo mframe" id="contact-entry-photo-{{$feed.id}}">
<img src="{{$feed.thumb}}" {{$feed.sparkle}} alt="{{$feed.name}}"/>
</div>
</div>
<div class="contact-entry-desc">
<div class="contact-entry-name" id="contact-entry-name-{{$feed.id}}">
{{$feed.name}}
</div>
</div>
</a>
</div>
{{/foreach}}
</div>

View file

@ -1,154 +0,0 @@
<div class="settings-block">
<script language="javascript">
function retriever_add_row(id)
{
var tbody = document.getElementById(id);
var last = tbody.rows[tbody.childElementCount - 1];
var count = +last.id.replace(id + '-', '');
count++;
var row = document.createElement('tr');
row.id = id + '-' + count;
var cell1 = document.createElement('td');
var inptag = document.createElement('input');
inptag.name = row.id + '-element';
cell1.appendChild(inptag);
row.appendChild(cell1);
var cell2 = document.createElement('td');
var inpatt = document.createElement('input');
inpatt.name = row.id + '-attribute';
cell2.appendChild(inpatt);
row.appendChild(cell2);
var cell3 = document.createElement('td');
var inpval = document.createElement('input');
inpval.name = row.id + '-value';
cell3.appendChild(inpval);
row.appendChild(cell3);
var cell4 = document.createElement('td');
var butrem = document.createElement('input');
butrem.id = row.id + '-rem';
butrem.type = 'button';
butrem.onclick = function(){retriever_remove_row(id, count)};
butrem.value = '{{$remove_t}}';
cell4.appendChild(butrem);
row.appendChild(cell4);
tbody.appendChild(row);
}
function retriever_remove_row(id, number)
{
var tbody = document.getElementById(id);
var row = document.getElementById(id + '-' + number);
tbody.removeChild(row);
}
function retriever_toggle_url_block()
{
var pattern = document.querySelector("#id_retriever_pattern").parentNode;
if (document.querySelector("#id_retriever_modurl").checked) {
pattern.style.display = "block";
}
else {
pattern.style.display = "none";
}
var replace = document.querySelector("#id_retriever_replace").parentNode;
if (document.querySelector("#id_retriever_modurl").checked) {
replace.style.display = "block";
}
else {
replace.style.display = "none";
}
}
function retriever_toggle_cookiedata_block()
{
var div = document.querySelector("#id_retriever_cookiedata").parentNode;
if (document.querySelector("#id_retriever_storecookies").checked) {
div.style.display = "block";
}
else {
div.style.display = "none";
}
}
document.addEventListener('DOMContentLoaded', function() {
retriever_toggle_url_block();
document.querySelector("#id_retriever_modurl").addEventListener('change', retriever_toggle_url_block, false);
retriever_toggle_cookiedata_block();
document.querySelector("#id_retriever_storecookies").addEventListener('change', retriever_toggle_cookiedata_block, false);
}, false);
</script>
<h2>{{$title}}</h2>
<p><a href="{{$help}}">{{$help_t}}</a></p>
<form method="post">
<input type="hidden" name="id" value="{{$id}}">
{{include file="field_checkbox.tpl" field=$enable}}
<h3>{{$include_t}}:</h3>
<div>
<table>
<thead>
<tr><th>{{$tag_t}}</th><th>{{$attribute_t}}</th><th>{{$value_t}}</th></tr>
</thead>
<tbody id="retriever-include">
{{if $include}}
{{foreach $include as $k=>$m}}
<tr id="retriever-include-{{$k}}">
<td><input name="retriever-include-{{$k}}-element" value="{{$m.element}}"></td>
<td><input name="retriever-include-{{$k}}-attribute" value="{{$m.attribute}}"></td>
<td><input name="retriever-include-{{$k}}-value" value="{{$m.value}}"></td>
<td><input id="retrieve-include-{{$k}}-rem" type="button" onclick="retriever_remove_row('retriever-include', {{$k}})" value="{{$remove_t}}"></td>
</tr>
{{/foreach}}
{{else}}
<tr id="retriever-include-0">
<td><input name="retriever-include-0-element"></td>
<td><input name="retriever-include-0-attribute"></td>
<td><input name="retriever-include-0-value"></td>
<td><input id="retrieve-include-0-rem" type="button" onclick="retriever_remove_row('retriever-include', 0)" value="{{$remove_t}}"></td>
</tr>
{{/if}}
</tbody>
</table>
<input type="button" onclick="retriever_add_row('retriever-include')" value="{{$add_t}}">
</div>
<h3>{{$exclude_t}}:</h3>
<div>
<table>
<thead>
<tr><th>{{$tag_t}}</th><th>{{$attribute_t}}</th><th>{{$value_t}}</th></tr>
</thead>
<tbody id="retriever-exclude">
{{if $exclude}}
{{foreach $exclude as $k=>$r}}
<tr id="retriever-exclude-{{$k}}">
<td><input name="retriever-exclude-{{$k}}-element" value="{{$r.element}}"></td>
<td><input name="retriever-exclude-{{$k}}-attribute" value="{{$r.attribute}}"></td>
<td><input name="retriever-exclude-{{$k}}-value" value="{{$r.value}}"></td>
<td><input id="retrieve-exclude-{{$k}}-rem" type="button" onclick="retriever_remove_row('retriever-exclude', {{$k}})" value="{{$remove_t}}"></td>
</tr>
{{/foreach}}
{{else}}
<tr id="retriever-exclude-0">
<td><input name="retriever-exclude-0-element"></td>
<td><input name="retriever-exclude-0-attribute"></td>
<td><input name="retriever-exclude-0-value"></td>
<td><input id="retrieve-exclude-0-rem" type="button" onclick="retriever_remove_row('retriever-exclude', 0)" value="{{$remove_t}}"></td>
</tr>
{{/if}}
</tbody>
</table>
<input type="button" onclick="retriever_add_row('retriever-exclude')" value="{{$add_t}}">
</div>
{{include file="field_checkbox.tpl" field=$modurl}}
{{include file="field_input.tpl" field=$pattern}}
{{include file="field_input.tpl" field=$replace}}
{{if $allow_images}}
{{include file="field_checkbox.tpl" field=$images}}
{{/if}}
{{include file="field_textarea.tpl" field=$customxslt}}
{{include file="field_checkbox.tpl" field=$storecookies}}
{{include file="field_textarea.tpl" field=$cookiedata}}
{{include file="field_input.tpl" field=$retrospective}}
<input type="submit" size="70" value="{{$submit_t}}">
</form>
</div>

View file

@ -1,16 +0,0 @@
<span id="settings_retriever_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose('settings_retriever_expanded'); openClose('settings_retriever_inflated');">
<h3>{{$title}}</h3>
</span>
<div id="settings_retriever_expanded" class="settings-block" style="display: none;">
<span class="fakelink" onclick="openClose('settings_retriever_expanded'); openClose('settings_retriever_inflated');">
<h3>{{$title}}</h3>
</span>
<p>
<a href="{{$help}}">Get Help</a>
</p>
{{if $allow_images}}
{{include file="field_checkbox.tpl" field=$allphotos}}
{{/if}}
{{include file="field_checkbox.tpl" field=$oembed}}
<input type="submit" value="{{$submit}}">
</div>

View file

@ -1,12 +1,7 @@
Installation
------------
[Register](http://www.tumblr.com/oauth/apps) an application and use (your server name)/addon/tumblr/callback.php as
callback URL
[Register](http://www.tumblr.com/oauth/apps) an application and use (your server name)/tumblr/callback as
callback URL and (your server name)/tumblr/redirect as OAuth2 redirect URL.
After the registration please enter the values for "Consumer Key" and "Consumer Secret" in the [administration](admin/addons/tumblr).
Notice
------
This connector is using the Tumblr-OAuth-Library:
[https://groups.google.com/d/msg/tumblr-api/g6SeIBWvsnE/gnWqT9jFSlEJ](https://groups.google.com/d/msg/tumblr-api/g6SeIBWvsnE/gnWqT9jFSlEJ)
After the registration please enter the values for "Consumer Key" and "Consumer Secret" in the [administration](admin/addons/tumblr).

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-11-21 19:17-0500\n"
"POT-Creation-Date: 2023-04-22 10:00+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,54 +17,58 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: tumblr.php:39
#: tumblr.php:60
msgid "Permission denied."
msgstr ""
#: tumblr.php:69
#: tumblr.php:111
msgid "Could not connect to Tumblr. Refresh the page or try again later."
msgstr ""
#: tumblr.php:159
msgid "Unable to authenticate"
msgstr ""
#: tumblr.php:174
msgid "Save Settings"
msgstr ""
#: tumblr.php:71
#: tumblr.php:176
msgid "Consumer Key"
msgstr ""
#: tumblr.php:72
#: tumblr.php:177
msgid "Consumer Secret"
msgstr ""
#: tumblr.php:177
msgid "You are now authenticated to tumblr."
msgstr ""
#: tumblr.php:178
msgid "return to the connector page"
msgstr ""
#: tumblr.php:194
msgid "Post to Tumblr"
msgstr ""
#: tumblr.php:225
#: tumblr.php:212
msgid "Post to page:"
msgstr ""
#: tumblr.php:231
#: tumblr.php:218
msgid "(Re-)Authenticate your tumblr page"
msgstr ""
#: tumblr.php:232
#: tumblr.php:219
msgid "You are not authenticated to tumblr"
msgstr ""
#: tumblr.php:237
#: tumblr.php:224
msgid "Enable Tumblr Post Addon"
msgstr ""
#: tumblr.php:238
#: tumblr.php:225
msgid "Post to Tumblr by default"
msgstr ""
#: tumblr.php:244
msgid "Tumblr Export"
#: tumblr.php:226
msgid "Import the remote timeline"
msgstr ""
#: tumblr.php:232
msgid "Tumblr Import/Export"
msgstr ""
#: tumblr.php:250
msgid "Post to Tumblr"
msgstr ""

View file

@ -1,108 +0,0 @@
<?php
/*
* Abraham Williams (abraham@abrah.am) http://abrah.am
*
* The first PHP Library to support OAuth for Tumblr's REST API. (Originally for Twitter, modified for Tumblr by Lucas)
*/
use Friendica\DI;
use Friendica\Security\OAuth1\OAuthConsumer;
use Friendica\Security\OAuth1\OAuthRequest;
use Friendica\Security\OAuth1\Signature\OAuthSignatureMethod_HMAC_SHA1;
use Friendica\Security\OAuth1\OAuthToken;
use Friendica\Security\OAuth1\OAuthUtil;
/**
* Tumblr OAuth class
*/
class TumblrOAuth
{
/* Contains the last HTTP status code returned. */
public $http_code;
/** @var OAuthConsumer */
private $consumer;
/** @var \Friendica\Security\OAuth1\Signature\OAuthSignatureMethod_HMAC_SHA1 */
private $sha1_method;
// API URLs
const accessTokenURL = 'https://www.tumblr.com/oauth/access_token';
const authorizeURL = 'https://www.tumblr.com/oauth/authorize';
const requestTokenURL = 'https://www.tumblr.com/oauth/request_token';
function __construct(string $consumer_key, string $consumer_secret)
{
$this->sha1_method = new OAuthSignatureMethod_HMAC_SHA1();
$this->consumer = new OAuthConsumer($consumer_key, $consumer_secret);
}
/**
* Get a request_token from Tumblr
*
* @param string $oauth_callback
* @return array
*/
function getRequestToken(string $oauth_callback): array
{
$request = $this->oAuthRequest(self::requestTokenURL, ['oauth_callback' => $oauth_callback]);
return OAuthUtil::parse_parameters($request);
}
/**
* Get the authorize URL
*
* @param string $oauth_token
* @return string
*/
function getAuthorizeURL(string $oauth_token): string
{
return self::authorizeURL . "?oauth_token={$oauth_token}";
}
/**
* Exchange request token and secret for an access token and
* secret, to sign API calls.
*
* @param string $oauth_verifier
* @param string $request_token
* @param string $request_token_secret
* @return array ("oauth_token" => "the-access-token",
* "oauth_token_secret" => "the-access-secret",
* "user_id" => "9436992",
* "screen_name" => "abraham")
*/
function getAccessToken(string $oauth_verifier, string $request_token, string $request_token_secret): array
{
$token = new OAuthToken($request_token, $request_token_secret);
$parameters = [];
if (!empty($oauth_verifier)) {
$parameters['oauth_verifier'] = $oauth_verifier;
}
$request = $this->oAuthRequest(self::accessTokenURL, $parameters, $token);
return OAuthUtil::parse_parameters($request);
}
/**
* Format and sign an OAuth / API request
*
* @param string $url
* @param array $parameters
* @param OAuthToken $token $name
* @return string
*/
private function oAuthRequest(string $url, array $parameters, OAuthToken $token = null): string
{
$request = OAuthRequest::from_consumer_and_token($this->consumer, 'GET', $url, $parameters, $token);
$request->sign_request($this->sha1_method, $this->consumer, $token);
$curlResult = DI::httpClient()->get($request->to_url());
$this->http_code = $curlResult->getReturnCode();
if ($curlResult->isSuccess()) {
return $curlResult->getBody();
}
return '';
}
}

View file

@ -2,6 +2,7 @@
{{include file="field_checkbox.tpl" field=$enable}}
{{include file="field_checkbox.tpl" field=$bydefault}}
{{include file="field_checkbox.tpl" field=$import}}
{{if $page_select}}
{{include file="field_select.tpl" field=$page_select}}

File diff suppressed because it is too large Load diff

View file

@ -1363,7 +1363,7 @@ function twitter_fetchtimeline(int $uid): void
Logger::info('Posting mirror post', ['twitter-id' => $post->id_str, 'uid' => $uid]);
Post\Delayed::add($mirrorpost['extid'], $mirrorpost, Worker::PRIORITY_MEDIUM, Post\Delayed::UNPREPARED);
Post\Delayed::add($mirrorpost['extid'], $mirrorpost, Worker::PRIORITY_MEDIUM, Post\Delayed::PREPARED);
}
}
DI::pConfig()->set($uid, 'twitter', 'lastid', $lastid);