From 85a4f66695515c937fb0efb5de4d7a42b0ec3fa5 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Sun, 28 Feb 2016 16:48:10 +0300 Subject: [PATCH] ADD alarmerbot --- classes/Alarmer.php | 21 +++++++++++++++++++++ config_template.php | 1 + controllers/ArticleController.php | 3 ++- controllers/CommentsController.php | 3 ++- controllers/JsonController.php | 3 ++- 5 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 classes/Alarmer.php diff --git a/classes/Alarmer.php b/classes/Alarmer.php new file mode 100644 index 0000000..a192d75 --- /dev/null +++ b/classes/Alarmer.php @@ -0,0 +1,21 @@ + App::getConfig('alarmerKey'), + "message" => 'WIKIPOINTS: '.$message, + )); + curl_exec($ch); + curl_close($ch); + } + } +} + diff --git a/config_template.php b/config_template.php index cc5a68f..670250d 100644 --- a/config_template.php +++ b/config_template.php @@ -18,5 +18,6 @@ return array( 'metrika' => true, 'ganalytics' => true, 'disableSMS' => false, + 'alarmerKey' => '02f559-a3c1f3-44d756', // key OR FALSE ); diff --git a/controllers/ArticleController.php b/controllers/ArticleController.php index f420bd6..957a5d8 100644 --- a/controllers/ArticleController.php +++ b/controllers/ArticleController.php @@ -142,7 +142,8 @@ class ArticleController extends Controller $article->pubDate = time(); } $article->status = 'published'; - SMS::send('Статья: ' . $title . ' :: ' . App::$user->nick); +// SMS::send('Статья: ' . $title . ' :: ' . App::$user->nick); + Alarmer::send('новая статья "' . $title . '" от ' . App::$user->nick); } $article->title = $title ? $title : 'Без названия'; diff --git a/controllers/CommentsController.php b/controllers/CommentsController.php index a0bba37..b9acdc6 100644 --- a/controllers/CommentsController.php +++ b/controllers/CommentsController.php @@ -66,7 +66,8 @@ class CommentsController extends Controller } } - SMS::send('Новый комментарий от '.App::$user->nick, '79046106141'); +// SMS::send('Новый комментарий от '.App::$user->nick, '79046106141'); + Alarmer::send('Новый комментарий от '.App::$user->nick); App::redirect('/' . $_POST['parentType'] . '/' . $_POST['parentId'] . '#comment' . $comment->id); } diff --git a/controllers/JsonController.php b/controllers/JsonController.php index d4dea30..76dbff7 100644 --- a/controllers/JsonController.php +++ b/controllers/JsonController.php @@ -308,7 +308,8 @@ class JsonController extends Controller die('Error 500 - Internal Server Error'); } - SMS::send('#' . $point->id . ' ' . $point->name . ' :: ' . App::$user->nick); +// SMS::send('#' . $point->id . ' ' . $point->name . ' :: ' . App::$user->nick); + Alarmer::send('Новая точка #' . $point->id . ' "' . $point->name . '" от ' . App::$user->nick); } self::renderPartial('json.php', array(