<?php
// Проверка статуса СМС
run_query("ALTER TABLE `" . $config['table_prefix'] . "module_sms_gates` ADD `check_status` TEXT NOT NULL AFTER `code`");
run_query("ALTER TABLE `" . $config['table_prefix'] . "module_sms_archive` ADD `id_sms` VARCHAR(255) NOT NULL AFTER `sended_from`");
run_query("ALTER TABLE `" . $config['table_prefix'] . "module_sms_archive` ADD `delivered_time` TIMESTAMP NOT NULL AFTER `id_sms`");
run_query("UPDATE `" . $config['table_prefix'] . "module_sms_gates` SET `code` = 'function send_sms()\n{\n  global \$sms, \$smsc;\n  \$snoopy = new Snoopy\Snoopy;\n  \$snoopy->fetch(\"http://cb-sms.ru/send.php?login=\".urlencode(\$smsc[\'login\']).\"&password=\".urlencode(\$smsc[\'password\']).\"&phone=\".urlencode(\$sms[\'phone\']).\"&text=\".urlencode(\$sms[\'text\']).\"&sender=\".urlencode(\$sms[\'sender\']).\"&id_return\");\n  return \$snoopy->results;\n}', `check_status` = 'function check_sms_status(\$id_sms)\n{\n  \$snoopy = new Snoopy\Snoopy;\n  \$snoopy->fetch(\"http://cb-sms.ru/status.php?id_sms=\".\$id_sms);\n  return \$snoopy->results;\n}' WHERE `id` = 1");
run_query("INSERT INTO `" . $config['table_prefix'] . "cron` (`description`, `period`, `command`, `thread_name`, `max_exec_time`, `check_enabled`, `check_cond`, `check_text`, `check_last_status`) VALUES ('" . $lang['Check_SMS_status'] . "', '* * * * *', 'check_all_sms();echo ''Done'';', 'main', 0, 1, 'like', 'Done', 0)");
?>