diff --git a/classes/SMS.php b/classes/SMS.php new file mode 100644 index 0000000..9e66d37 --- /dev/null +++ b/classes/SMS.php @@ -0,0 +1,25 @@ + "2c2af6a7-a935-0e84-5952-599f5cd61905", + "to" => $to, + "text" => $text, + "from" => "WIKIPOINTS", + )); + curl_exec($ch); + curl_close($ch); + } + } +} + diff --git a/controllers/ArticleController.php b/controllers/ArticleController.php index 79a617a..288c18a 100644 --- a/controllers/ArticleController.php +++ b/controllers/ArticleController.php @@ -142,6 +142,7 @@ class ArticleController extends Controller $article->pubDate = time(); } $article->status = 'published'; + SMS::send('Статья: ' . $title . ' :: ' . App::$user->nick); } $article->title = $title ? $title : 'Без названия'; diff --git a/controllers/JsonController.php b/controllers/JsonController.php index 53e63e8..abbfdf1 100644 --- a/controllers/JsonController.php +++ b/controllers/JsonController.php @@ -308,19 +308,7 @@ class JsonController extends Controller die('Error 500 - Internal Server Error'); } - if (!App::getConfig('disableSMS')) { - $ch = curl_init("http://sms.ru/sms/send"); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_TIMEOUT, 10); - curl_setopt($ch, CURLOPT_POSTFIELDS, array( - "api_id" => "2c2af6a7-a935-0e84-5952-599f5cd61905", - "to" => "79046106141, 79046106144", - "text" => "#" . $point->id . ": " . $point->name . ' :: ' . App::$user->nick, - "from" => "WIKIPOINTS", - )); - curl_exec($ch); - curl_close($ch); - } + SMS::send('#' . $point->id . ' ' . $point->name . ' :: ' . App::$user->nick); } self::renderPartial('json.php', array(