X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mailstream%2Fmailstream.php;h=35c6aab0dce095fff272d3a4f266d4a5b2807b07;hb=4e7da2799c1b9f97267bd2cb9de0d2dae52afcfe;hp=f454018874b04d6b4e37a6f984ad4f284d34de6a;hpb=d75f4b30f3c78d979ff52bbd08a4ec56954ad763;p=friendica-addons.git diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php index f4540188..35c6aab0 100644 --- a/mailstream/mailstream.php +++ b/mailstream/mailstream.php @@ -53,7 +53,7 @@ function mailstream_check_version() 'addon/mailstream/mailstream.php', 'mailstream_convert_table_entries' ); - Hook::fork(PRIORITY_LOW, 'mailstream_convert_table_entries'); + Hook::fork(Worker::PRIORITY_LOW, 'mailstream_convert_table_entries'); } } @@ -183,7 +183,7 @@ function mailstream_post_hook(App $a, array &$item) 'message_id' => $message_id, 'tries' => 0, ]; - Hook::fork(PRIORITY_LOW, 'mailstream_send_hook', $send_hook_data); + Hook::fork(Worker::PRIORITY_LOW, 'mailstream_send_hook', $send_hook_data); } /** @@ -439,7 +439,7 @@ function mailstream_send(string $message_id, array $item, array $user): bool * * @param string $text text to word wrap - modified in-place */ -function mailstream_html_wrap(string &$text): string +function mailstream_html_wrap(string &$text) { $lines = str_split($text, 200); for ($i = 0; $i < count($lines); $i++) { @@ -467,7 +467,7 @@ function mailstream_convert_table_entries() continue; } Logger::info('mailstream_convert_table_entries: convert item to workerqueue', $send_hook_data); - Hook::fork(PRIORITY_LOW, 'mailstream_send_hook', $send_hook_data); + Hook::fork(Worker::PRIORITY_LOW, 'mailstream_send_hook', $send_hook_data); } DBA::e('DROP TABLE `mailstream_item`'); } @@ -481,10 +481,10 @@ function mailstream_convert_table_entries() */ function mailstream_addon_settings(App &$a, array &$data) { - $enabled = DI::pConfig()->get(local_user(), 'mailstream', 'enabled'); - $address = DI::pConfig()->get(local_user(), 'mailstream', 'address'); - $nolikes = DI::pConfig()->get(local_user(), 'mailstream', 'nolikes'); - $attachimg = DI::pConfig()->get(local_user(), 'mailstream', 'attachimg'); + $enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'enabled'); + $address = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'address'); + $nolikes = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'nolikes'); + $attachimg = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'attachimg'); $template = Renderer::getMarkupTemplate('settings.tpl', 'addon/mailstream/'); $html = Renderer::replaceMacros($template, [ @@ -529,28 +529,28 @@ function mailstream_addon_settings(App &$a, array &$data) */ function mailstream_addon_settings_post(App $a, array $post) { - if (!local_user() || empty($post['mailstream-submit'])) { + if (!DI::userSession()->getLocalUserId() || empty($post['mailstream-submit'])) { return; } if ($post['mailstream_address'] != "") { - DI::pConfig()->set(local_user(), 'mailstream', 'address', $post['mailstream_address']); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'mailstream', 'address', $post['mailstream_address']); } else { - DI::pConfig()->delete(local_user(), 'mailstream', 'address'); + DI::pConfig()->delete(DI::userSession()->getLocalUserId(), 'mailstream', 'address'); } if ($post['mailstream_nolikes']) { - DI::pConfig()->set(local_user(), 'mailstream', 'nolikes', $post['mailstream_enabled']); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'mailstream', 'nolikes', $post['mailstream_enabled']); } else { - DI::pConfig()->delete(local_user(), 'mailstream', 'nolikes'); + DI::pConfig()->delete(DI::userSession()->getLocalUserId(), 'mailstream', 'nolikes'); } if ($post['mailstream_enabled']) { - DI::pConfig()->set(local_user(), 'mailstream', 'enabled', $post['mailstream_enabled']); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'mailstream', 'enabled', $post['mailstream_enabled']); } else { - DI::pConfig()->delete(local_user(), 'mailstream', 'enabled'); + DI::pConfig()->delete(DI::userSession()->getLocalUserId(), 'mailstream', 'enabled'); } if ($post['mailstream_attachimg']) { - DI::pConfig()->set(local_user(), 'mailstream', 'attachimg', $post['mailstream_attachimg']); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'mailstream', 'attachimg', $post['mailstream_attachimg']); } else { - DI::pConfig()->delete(local_user(), 'mailstream', 'attachimg'); + DI::pConfig()->delete(DI::userSession()->getLocalUserId(), 'mailstream', 'attachimg'); } }