$PluginAccountsHash->getFromDB(1); $hash = $PluginAccountsHash->fields["hash"]; $update = 0; if (countElementsInTable("glpi_plugin_accounts_accounts") > 0) { $update = 1; } if (empty($hash)) { if ($plugin->isActivated("environment")) { Html::header(PluginAccountsAccount::getTypeName(2), '', "assets", "pluginenvironmentdisplay", "accounts"); } else { Html::header(PluginAccountsAccount::getTypeName(2), '', "assets", "pluginaccountsmenu", "account"); } if ($_SESSION['glpiactive_entity'] == 0) { if ($update == 1) { echo "<div class='center b'>" . __('Upgrade') . "</div><br><br>"; echo "<div class='center b'>" . __('1. Define the encryption key and create hash', 'accounts') . "</div><br><br>"; $options = array("update" => true, "upgrade" => 1); $PluginAccountsHash->showForm(1, $options); } } else { echo "<div class='center red'>" . __('Go to Root Entity', 'accounts') . "</div>"; } Html::footer(); } } else { Html::header(__('Setup'), '', "config", "plugins"); echo "<div align='center'><br><br>"; echo "<img src=\"" . $CFG_GLPI["root_doc"] . "/pics/warning.png\" alt=\"warning\"><br><br>"; echo "<b>__('Please activate the plugin', 'accounts')</b></div>"; Html::footer(); }
$hash = $hashe["hash"]; } } if (!empty($_POST["aeskeynew"]) && !empty($_POST["aeskey"]) && !empty($hash)) { if ($hash != hash("sha256", hash("sha256", $_POST["aeskey"]))) { Session::addMessageAfterRedirect(__('Wrong encryption key', 'accounts'), true, ERROR); Html::back(); } else { PluginAccountsHash::updateHash($_POST["aeskey"], $_POST["aeskeynew"], $hash_id); Session::addMessageAfterRedirect(__('Encryption key modified', 'accounts'), true); Html::back(); } } else { Session::addMessageAfterRedirect(__('The old or the new encryption key can not be empty', 'accounts'), true, ERROR); Html::back(); } } } else { if ($plugin->isActivated("environment")) { Html::header(PluginAccountsAccount::getTypeName(2), '', "plugins", "environment", "hash"); } else { Html::header(PluginAccountsAccount::getTypeName(2), '', "plugins", "accounts", "hash"); } $options = array("update" => false, "upgrade" => 0); $hashClass->showForm($_GET["id"], $options); Html::footer(); } } } } }