ADD alarmerbot
This commit is contained in:
parent
8383af2730
commit
85a4f66695
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
class Alarmer
|
||||
{
|
||||
static public function send($message)
|
||||
{
|
||||
if (App::getConfig('alarmerKey')) {
|
||||
|
||||
$ch = curl_init("https://alarmerbot.ru/");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
|
||||
"key" => App::getConfig('alarmerKey'),
|
||||
"message" => 'WIKIPOINTS: '.$message,
|
||||
));
|
||||
curl_exec($ch);
|
||||
curl_close($ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -18,5 +18,6 @@ return array(
|
|||
'metrika' => true,
|
||||
'ganalytics' => true,
|
||||
'disableSMS' => false,
|
||||
'alarmerKey' => '02f559-a3c1f3-44d756', // key OR FALSE
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -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 : 'Без названия';
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Reference in New Issue