Exemple #1
0
    if (init('action') == 'clearMessage') {
        message::removeAll(init('plugin'));
        ajax::success();
    }
    if (init('action') == 'nbMessage') {
        ajax::success(message::nbMessage());
    }
    if (init('action') == 'all') {
        if (init('plugin') == '') {
            $messages = utils::o2a(message::all());
        } else {
            $messages = utils::o2a(message::byPlugin(init('plugin')));
        }
        foreach ($messages as &$message) {
            $message['message'] = htmlentities($message['message']);
        }
        ajax::success($messages);
    }
    if (init('action') == 'removeMessage') {
        $message = message::byId(init('id'));
        if (!is_object($message)) {
            throw new Exception(__('Message inconnu verifié l\'id', __FILE__));
        }
        $message->remove();
        ajax::success();
    }
    throw new Exception(__('Aucune methode correspondante à : ', __FILE__) . init('action'));
    /*     * *********Catch exeption*************** */
} catch (Exception $e) {
    ajax::error(displayExeption($e), $e->getCode());
}