예제 #1
0
  @since     2011

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
PluginMonitoringProfile::checkRight("weathermap", "w");
Html::header(__('Monitoring', 'monitoring'), $_SERVER["PHP_SELF"], "plugins", "monitoring", "weathermaplink");
$pmWeathermaplink = new PluginMonitoringWeathermaplink();
if (isset($_POST["add"])) {
    $split = explode("-", $_POST['linksource']);
    $_POST['plugin_monitoring_weathermapnodes_id_1'] = $split[0];
    $_POST['plugin_monitoring_services_id'] = $split[1];
    $pmWeathermaplink->add($_POST);
    Html::back();
} else {
    if (isset($_POST["update"])) {
        $_POST['id'] = $_POST['id_update'];
        unset($_POST['plugin_monitoring_weathermapnodes_id_1']);
        unset($_POST['plugin_monitoring_weathermapnodes_id_2']);
        $_POST['bandwidth_in'] = $_POST['up_bandwidth_in'];
        $_POST['bandwidth_out'] = $_POST['up_bandwidth_out'];
        $pmWeathermaplink->update($_POST);
        Html::back();
    } else {
        if (isset($_POST["purge"])) {
            $pmWeathermaplink->delete($_POST);
            Html::back();
        }
    }
}
Html::footer();
    if ($_POST['x'] == '') {
        Html::back();
        exit;
    }
    $pmWeathermapnode->add($_POST);
    Html::back();
} else {
    if (isset($_POST["update"])) {
        if ($_POST['x'] == '') {
            Html::back();
            exit;
        }
        unset($_POST['name']);
        $_POST['name'] = $_POST['nameupdate'];
        unset($_POST['itemtype']);
        $_POST['id'] = $_POST['id_update'];
        $pmWeathermapnode->update($_POST);
        Html::back();
    } else {
        if (isset($_POST["purge"])) {
            $pmWeathermaplink = new PluginMonitoringWeathermaplink();
            $a_links = $pmWeathermaplink->find("`plugin_monitoring_weathermapnodes_id_1`='" . $_POST['id'] . "'\n      OR `plugin_monitoring_weathermapnodes_id_2`='" . $_POST['id'] . "'");
            foreach ($a_links as $data) {
                $pmWeathermaplink->delete($data);
            }
            $pmWeathermapnode->delete($_POST);
            Html::back();
        }
    }
}
Html::footer();