예제 #1
0
 *
 * Jeedom is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Jeedom. If not, see <http://www.gnu.org/licenses/>.
 */
try {
    require_once dirname(__FILE__) . '/../../../../core/php/core.inc.php';
    include_file('core', 'authentification', 'php');
    if (!isConnect('admin')) {
        throw new Exception(__('401 - Accès non autorisé', __FILE__));
    }
    ajax::init();
    if (init('action') == 'tts') {
        if (init('message') == '') {
            throw new Exception(__('Veuillez saisir un message', __FILE__));
        }
        $nabaztag = nabaztag::byId(init('id'));
        if (!is_object($nabaztag)) {
            throw new Exception(__('Nabaztag non trouvé', __FILE__));
        }
        $cmd = $nabaztag->getCmd(null, 'speak');
        if (!is_object($cmd)) {
            throw new Exception(__('Commande non trouvée', __FILE__));
        }
        $cmd->execCmd(array('message' => init('message')));
        ajax::success();
    }