mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
* show notice in notification extension if allow_url_fopen directive is off
This commit is contained in:
parent
df031728da
commit
1f0b707193
5 changed files with 11 additions and 3 deletions
|
|
@ -53,7 +53,7 @@ class TelegramApi
|
|||
$body = @file_get_contents('https://api.telegram.org/bot'. $this->token .'/'. $method, false, $context);
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
$err = ini_get('html_errors') ? htmlspecialchars_decode($e->getMessage()) : $e->getMessage();
|
||||
$err = boolval(ini_get('html_errors')) ? htmlspecialchars_decode($e->getMessage()) : $e->getMessage();
|
||||
}
|
||||
restore_error_handler();
|
||||
if ($body === false || null !== $err) {
|
||||
|
|
@ -88,7 +88,7 @@ class TelegramApi
|
|||
$body = @file_get_contents('https://api.telegram.org/bot'. $this->token .'/'. $method, false, $context);
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
$err = ini_get('html_errors') ? htmlspecialchars_decode($e->getMessage()) : $e->getMessage();
|
||||
$err = boolval(ini_get('html_errors')) ? htmlspecialchars_decode($e->getMessage()) : $e->getMessage();
|
||||
}
|
||||
restore_error_handler();
|
||||
if ($body === false || null !== $err) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"bundleId": "notifications",
|
||||
"name": "Notifications",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"description": "Notify about new tasks and lists on e-mail or telegram"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"ext.notifications.name": "Notifications",
|
||||
"notifications.urlconfigwarning": "Enable PHP 'allow_url_fopen' directive to use Telegram notifications.",
|
||||
"notifications.check": "Check",
|
||||
"notifications.bot_not_configured": "Bot is not configured",
|
||||
"notifications.h_email": "E-Mail:",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"ext.notifications.name": "Уведомления",
|
||||
"notifications.urlconfigwarning": "Для использования Telegram требуется включить директиву 'allow_url_fopen' в настройках PHP .",
|
||||
"notifications.check": "Проверить",
|
||||
"notifications.bot_not_configured": "Бот не настроен",
|
||||
"notifications.h_email": "E-Mail:",
|
||||
|
|
|
|||
|
|
@ -100,11 +100,17 @@ class NotificationsExtension extends MTTExtension implements MTTHttpApiExtender,
|
|||
$newChat = $e('notifications.bot_not_configured');
|
||||
}
|
||||
|
||||
$warning = '';
|
||||
if (!boolval(ini_get('allow_url_fopen'))) {
|
||||
$warning = "<div class=\"tr\"><div style=\"width:100%;text-align:center;\">⚠️ {$e('notifications.urlconfigwarning')}</div></div>";
|
||||
}
|
||||
|
||||
//$e = function($s) { return __($s, true); };
|
||||
//$c = function($key) { return htmlspecialchars(Config::get($key)); };
|
||||
|
||||
return
|
||||
<<<EOD
|
||||
$warning
|
||||
<div class="tr">
|
||||
<div class="th"> {$e('notifications.h_email')}
|
||||
<div class="descr">{$e('notifications.d_email')}</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue