コード例 #1
0
ファイル: hook.php プロジェクト: geldarr/hack-space
function plugin_routetables_install()
{
    global $DB;
    include_once GLPI_ROOT . "/plugins/routetables/inc/profile.class.php";
    $update = false;
    if (!TableExists("glpi_plugin_routetable_profiles") && !TableExists("glpi_plugin_routetables_profiles")) {
        $DB->runFile(GLPI_ROOT . "/plugins/routetables/sql/empty-1.2.0.sql");
    } else {
        if (TableExists("glpi_plugin_routetable_profiles") && FieldExists("glpi_plugin_routetable_profiles", "interface")) {
            $update = true;
            $DB->runFile(GLPI_ROOT . "/plugins/routetables/sql/update-1.1.0.sql");
            $DB->runFile(GLPI_ROOT . "/plugins/routetables/sql/update-1.1.1.sql");
            $DB->runFile(GLPI_ROOT . "/plugins/routetables/sql/update-1.2.0.sql");
        } else {
            if (TableExists("glpi_plugin_routetable") && !FieldExists("glpi_plugin_routetable", "helpdesk_visible")) {
                $update = true;
                $DB->runFile(GLPI_ROOT . "/plugins/routetables/sql/update-1.1.1.sql");
                $DB->runFile(GLPI_ROOT . "/plugins/routetables/sql/update-1.2.0.sql");
            } else {
                if (!TableExists("glpi_plugin_routetables_profiles")) {
                    $update = true;
                    $DB->runFile(GLPI_ROOT . "/plugins/routetables/sql/update-1.2.0.sql");
                }
            }
        }
    }
    if ($update) {
        $query_ = "SELECT *\n            FROM `glpi_plugin_routetables_profiles` ";
        $result_ = $DB->query($query_);
        if ($DB->numrows($result_) > 0) {
            while ($data = $DB->fetch_array($result_)) {
                $query = "UPDATE `glpi_plugin_routetables_profiles`\n                  SET `profiles_id` = '" . $data["id"] . "'\n                  WHERE `id` = '" . $data["id"] . "';";
                $result = $DB->query($query);
            }
        }
        $query = "ALTER TABLE `glpi_plugin_routetables_profiles`\n               DROP `name` ;";
        $result = $DB->query($query);
        Plugin::migrateItemType(array(5100 => 'PluginRoutetablesRoutetable'), array("glpi_bookmarks", "glpi_bookmarks_users", "glpi_displaypreferences", "glpi_documents_items", "glpi_infocoms", "glpi_logs", "glpi_tickets"), array("glpi_plugin_routetables_routetables_items"));
    }
    PluginRoutetablesProfile::createFirstAccess($_SESSION['glpiactiveprofile']['id']);
    return true;
}
コード例 #2
0
ファイル: profile.form.php プロジェクト: geldarr/hack-space
 Copyright (C) 2003-2011 by the Routetables Development Team.

 https://forge.indepnet.net/projects/routetables
 -------------------------------------------------------------------------

 LICENSE

 This file is part of Routetables.

 Routetables 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.

 Routetables 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 Routetables. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
Session::checkRight("profile", "r");
$prof = new PluginRoutetablesProfile();
//Save profile
if (isset($_POST['update'])) {
    $prof->update($_POST);
    Html::back();
}