コード例 #1
0
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 ocsinventoryng. If not, see <http://www.gnu.org/licenses/>.
-------------------------------------------------------------------------- */
include '../../../inc/includes.php';
Session::checkRight("plugin_ocsinventoryng", UPDATE);
$ocs = new PluginOcsinventoryngOcsServer();
if (!isset($_GET["id"]) || $_GET["id"] == -1) {
    $_GET["id"] = "";
}
Html::header('OCS Inventory NG', '', "tools", "pluginocsinventoryngmenu", "ocsserver");
//Delete template or server
if (isset($_POST["purge"])) {
    $ocs->check($_POST['id'], PURGE);
    $ocs->delete($_POST);
    $ocs->redirectToList();
    //Update server
} else {
    if (isset($_POST["update"])) {
        $ocs->check($_POST['id'], UPDATE);
        $ocs->update($_POST);
        Html::back();
        //Add new server
    } else {
        if (isset($_POST["add"])) {
            $ocs->check(-1, CREATE, $_POST);
            $newID = $ocs->add($_POST);
            if ($_SESSION['glpibackcreated']) {
                Html::redirect($ocs->getFormURL() . "?id=" . $newID);