示例#1
0
 public function showAesKey($ID)
 {
     global $DB;
     $this->h->getFromDB($ID);
     Session::initNavigateListItems("PluginAccountsAesKey", __('Hash', 'accounts') . " = " . $this->h->fields["name"]);
     $candelete = $this->h->can($ID, 'w');
     $query = "SELECT *\n      FROM `glpi_plugin_accounts_aeskeys`\n      WHERE `plugin_accounts_hashes_id` = '{$ID}' ";
     $result = $DB->query($query);
     $rand = mt_rand();
     echo "<div class='center'>";
     echo "<form method='post' name='show_aeskey{$rand}' id='show_aeskey{$rand}' action=\"./aeskey.form.php\">";
     echo "<input type='hidden' name='plugin_accounts_hashes_id' value='" . $ID . "'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='5'>" . __('Encryption key', 'accounts') . "</th></tr>";
     echo "<tr><th>&nbsp;</th>";
     echo "<th class='left'>" . __('Name') . "</th>";
     echo "</tr>";
     if ($DB->numrows($result) > 0) {
         while ($data = $DB->fetch_array($result)) {
             Session::addToNavigateListItems("PluginAccountsAesKey", $data['id']);
             echo "<input type='hidden' name='item[" . $data["id"] . "]' value='" . $ID . "'>";
             echo "<tr class='tab_bg_1 center'>";
             echo "<td width='10'>";
             if ($candelete) {
                 echo "<input type='checkbox' name='check[" . $data["id"] . "]'";
                 if (isset($_POST['check']) && $_POST['check'] == 'all') {
                     echo " checked ";
                 }
                 echo ">";
             }
             echo "</td>";
             $link = Toolbox::getItemTypeFormURL("PluginAccountsAesKey");
             echo "<td class='left'><a href='" . $link . "?id=" . $data["id"] . "&plugin_accounts_hashes_id=" . $ID . "'>";
             echo __('Encryption key', 'accounts') . "</a></td>";
             echo "</tr>";
         }
         echo "</table>";
         if ($candelete) {
             Html::openArrowMassives("show_aeskey{$rand}", true);
             Html::closeArrowMassives(array('delete' => __('Delete permanently')));
         }
     } else {
         echo "</table>";
     }
     Html::closeForm();
     echo "</div>";
 }