From bb8c01eba7b870ac67dbde3e500bf9454ea12226 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sat, 29 May 2021 20:59:51 +0200 Subject: [PATCH 1/4] Increase priority for securemail over PHP SMTP mail --- phpmailer/phpmailer.php | 2 +- securemail/securemail.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpmailer/phpmailer.php b/phpmailer/phpmailer.php index 25b94047..3a8898b4 100644 --- a/phpmailer/phpmailer.php +++ b/phpmailer/phpmailer.php @@ -20,7 +20,7 @@ require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'a function phpmailer_install() { Hook::register('load_config' , __FILE__, 'phpmailer_load_config'); - Hook::register('emailer_send_prepare', __FILE__, 'phpmailer_emailer_send_prepare'); + Hook::register('emailer_send_prepare', __FILE__, 'phpmailer_emailer_send_prepare', 5); } function phpmailer_load_config(App $a, ConfigFileLoader $loader) diff --git a/securemail/securemail.php b/securemail/securemail.php index fb801a4c..3f9cadb2 100644 --- a/securemail/securemail.php +++ b/securemail/securemail.php @@ -19,9 +19,9 @@ require_once __DIR__ . '/vendor/autoload.php'; function securemail_install() { Hook::register('addon_settings', 'addon/securemail/securemail.php', 'securemail_settings'); - Hook::register('addon_settings_post', 'addon/securemail/securemail.php', 'securemail_settings_post'); + Hook::register('addon_settings_post', 'addon/securemail/securemail.php', 'securemail_settings_post', 10); - Hook::register('emailer_send_prepare', 'addon/securemail/securemail.php', 'securemail_emailer_send_prepare'); + Hook::register('emailer_send_prepare', 'addon/securemail/securemail.php', 'securemail_emailer_send_prepare', 10); Logger::log('installed securemail'); } -- 2.43.5 From d032800f1e73906d2b641ce0c0634376e2cca6cc Mon Sep 17 00:00:00 2001 From: Philipp Date: Sat, 29 May 2021 21:11:53 +0200 Subject: [PATCH 2/4] Catch Twitter Exceptions --- twitter/twitter.php | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/twitter/twitter.php b/twitter/twitter.php index bac4871b..8bfa1737 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -495,26 +495,30 @@ function twitter_action(App $a, $uid, $pid, $action) Logger::debug('before action', ['action' => $action, 'pid' => $pid, 'data' => $post]); - switch ($action) { - case 'delete': - // To-Do: $result = $connection->post('statuses/destroy', $post); - $result = []; - break; - case 'like': - $result = $connection->post('favorites/create', $post); - if ($connection->getLastHttpCode() != 200) { - Logger::warning('Unable to create favorite', ['result' => $result]); - } - break; - case 'unlike': - $result = $connection->post('favorites/destroy', $post); - if ($connection->getLastHttpCode() != 200) { - Logger::warning('Unable to destroy favorite', ['result' => $result]); - } - break; - default: - Logger::warning('Unhandled action', ['action' => $action]); - $result = []; + try { + switch ($action) { + case 'delete': + // To-Do: $result = $connection->post('statuses/destroy', $post); + $result = []; + break; + case 'like': + $result = $connection->post('favorites/create', $post); + if ($connection->getLastHttpCode() != 200) { + Logger::warning('Unable to create favorite', ['result' => $result]); + } + break; + case 'unlike': + $result = $connection->post('favorites/destroy', $post); + if ($connection->getLastHttpCode() != 200) { + Logger::warning('Unable to destroy favorite', ['result' => $result]); + } + break; + default: + Logger::warning('Unhandled action', ['action' => $action]); + $result = []; + } + } catch (TwitterOAuthException $twitterOAuthException) { + Logger::warning('Unable to communicate with twitter', ['action' => $action, 'data' => $post, 'code' => $twitterOAuthException->getCode(), 'exception' => $twitterOAuthException]); } Logger::info('after action', ['action' => $action, 'result' => $result]); -- 2.43.5 From 58e38651b2e0f3675fa117d9cbb54808675ede7e Mon Sep 17 00:00:00 2001 From: Philipp Date: Sat, 29 May 2021 21:57:14 +0200 Subject: [PATCH 3/4] Fix cat avatar for non-admin users --- catavatar/templates/settings.tpl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/catavatar/templates/settings.tpl b/catavatar/templates/settings.tpl index 086250ea..14212626 100644 --- a/catavatar/templates/settings.tpl +++ b/catavatar/templates/settings.tpl @@ -11,14 +11,14 @@

{{$setrandomize}}

- +
- - + +
-- 2.43.5 From 5ea82418d8bda7ac7d484f766571892e1719486d Mon Sep 17 00:00:00 2001 From: Philipp Date: Sat, 29 May 2021 21:59:54 +0200 Subject: [PATCH 4/4] Revert indentation --- catavatar/templates/settings.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/catavatar/templates/settings.tpl b/catavatar/templates/settings.tpl index 14212626..33563ffe 100644 --- a/catavatar/templates/settings.tpl +++ b/catavatar/templates/settings.tpl @@ -12,13 +12,13 @@

{{$setrandomize}}

+ class="btn btn-primary settings-submit" value="{{$usecat}}">{{$usecat}}
+ class="btn btn-default settings-submit" value="{{$morecat}}">{{$morecat}} + class="btn btn-default settings-submit" value="{{$emailcat}}">{{$emailcat}}
-- 2.43.5