@co-author
  @copyright Copyright (c) 2010-2015 FusionInventory team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      http://www.fusioninventory.org/
  @link      http://forge.fusioninventory.org/projects/fusioninventory-for-glpi/
  @since     2010

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Html::header(__('FusionInventory', 'fusioninventory'), $_SERVER["PHP_SELF"], "plugins", "fusioninventory", "agentmodules");
Session::checkRight('plugin_fusioninventory_agent', READ);
$agentmodule = new PluginFusioninventoryAgentmodule();
if (isset($_POST["agent_add"])) {
    $agentmodule->getFromDB($_POST['id']);
    $a_agentList = importArrayFromDB($agentmodule->fields['exceptions']);
    $a_agentList[] = $_POST['agent_to_add'][0];
    $input = array();
    $input['exceptions'] = exportArrayToDB($a_agentList);
    $input['id'] = $_POST['id'];
    $agentmodule->update($input);
    Html::back();
} else {
    if (isset($_POST["agent_delete"])) {
        $agentmodule->getFromDB($_POST['id']);
        $a_agentList = importArrayFromDB($agentmodule->fields['exceptions']);
        foreach ($a_agentList as $key => $value) {
            if ($value == $_POST['agent_to_delete'][0]) {
                unset($a_agentList[$key]);
            }