Copyright (C) 2003-2013 by the archires Development Team. https://forge.indepnet.net/projects/archires ------------------------------------------------------------------------- LICENSE This file is part of archires. Archires is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Archires 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 Archires. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ include "../../../inc/includes.php"; Session::checkRight("profile", "r"); $prof = new PluginArchiresProfile(); //Save profile if (isset($_POST['update'])) { $prof->update($_POST); Html::back(); }
function plugin_archires_install() { global $DB; include_once GLPI_ROOT . "/plugins/archires/inc/profile.class.php"; $update = false; if (!TableExists("glpi_plugin_archires_config") && !TableExists("glpi_plugin_archires_views")) { $DB->runFile(GLPI_ROOT . "/plugins/archires/sql/empty-2.1.0.sql"); } else { $update = true; // update to 1.3 if (TableExists("glpi_plugin_archires_display") && !FieldExists("glpi_plugin_archires_display", "display_ports")) { $migration = new Migration(13); $migration->addField("glpi_plugin_archires_display", "display_ports", "ENUM('1', '0') NOT NULL DEFAULT '0'"); $migration->executeMigration(); } // update to 1.4 if (TableExists("glpi_plugin_archires_display") && !TableExists("glpi_plugin_archires_profiles")) { plugin_archires_updateTo14(); } // update to 1.5 if (TableExists("glpi_plugin_archires_display") && !TableExists("glpi_plugin_archires_image_device")) { plugin_archires_updateTo15(); } // update to 1.7.0 if (TableExists("glpi_plugin_archires_profiles") && FieldExists("glpi_plugin_archires_profiles", "interface")) { plugin_archires_updateTo170(); } // update to 1.7.2 if (TableExists("glpi_plugin_archires_config") && FieldExists("glpi_plugin_archires_config", "system")) { $migration = new Migration(172); $migration->dropField("glpi_plugin_archires_config", "system"); $migration->executeMigration(); } // update to 1.8.0 if (!TableExists("glpi_plugin_archires_views")) { plugin_archires_updateTo180(); } // update to 2.1.0 if (TableExists("glpi_plugin_archires_appliancequeries") && !FieldExists("glpi_plugin_archires_appliancequeries", "plugin_appliances_appliances_id")) { plugin_archires_updateTo210(); } } if ($update) { $table = "glpi_plugin_archires_statecolors"; $index = "state"; if (isIndex($table, $index)) { $query = "ALTER TABLE `{$table}` DROP INDEX `{$index}`;"; $result = $DB->query($query); } $query_ = "SELECT *\n FROM `glpi_plugin_archires_profiles` "; $result_ = $DB->query($query_); if ($DB->numrows($result_) > 0) { while ($data = $DB->fetch_array($result_)) { $query = "UPDATE `glpi_plugin_archires_profiles`\n SET `profiles_id` = '" . $data["id"] . "'\n WHERE `id` = '" . $data["id"] . "';"; $result = $DB->query($query); } } if (FieldExists("glpi_plugin_archires_profiles", "name")) { $query = "ALTER TABLE `glpi_plugin_archires_profiles`\n DROP `name`"; } $result = $DB->query($query); Plugin::migrateItemType(array(3000 => 'PluginArchiresLocationQuery', 3001 => 'PluginArchiresNetworkEquipmentQuery', 3002 => 'PluginArchiresApplianceQuery', 3003 => 'PluginArchiresView'), array("glpi_bookmarks", "glpi_bookmarks_users", "glpi_displaypreferences", "glpi_documents_items", "glpi_infocoms", "glpi_logs", "glpi_tickets"), array("glpi_plugin_archires_querytypes", "glpi_plugin_archires_imageitems")); } $rep_files_archires = realpath(GLPI_PLUGIN_DOC_DIR) . "/archires"; if (!is_dir($rep_files_archires) && !mkdir($rep_files_archires)) { die(sprintf(__('Failed to create the directory %s. Verify that you have the correct permission'), $rep_files_archires)); } PluginArchiresProfile::createFirstAccess($_SESSION['glpiactiveprofile']['id']); return true; }