index.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. use function Hestiacp\quoteshellarg\quoteshellarg;
  3. $TAB = 'DNS';
  4. // Main include
  5. include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
  6. // Data & Render page
  7. if (empty($_GET['domain'])){
  8. exec (HESTIA_CMD."v-list-dns-domains ".$user." 'json'", $output, $return_var);
  9. $data = json_decode(implode('', $output), true);
  10. if($_SESSION['userSortOrder'] == 'name'){
  11. ksort($data);
  12. }else{
  13. $data = array_reverse($data,true);
  14. }
  15. unset($output);
  16. render_page($user, $TAB, 'list_dns');
  17. } else if (!empty($_GET['action'])){
  18. exec (HESTIA_CMD."v-list-dnssec-public-key ".$user." ".quoteshellarg($_GET['domain'])." 'json'", $output, $return_var);
  19. $data = json_decode(implode('', $output), true);
  20. $domain=$_GET['domain'];
  21. switch ($data[$domain]['FLAG']) {
  22. case 257:
  23. $flag="KSK (257)";
  24. break;
  25. case 256:
  26. $flag="ZSK (256)";
  27. break;
  28. }
  29. switch ($data[$domain]['ALGORITHM']) {
  30. case 3:
  31. $algorithm="3 - DSA";
  32. break;
  33. case 5:
  34. $algorithm="5 - RSA/SHA1";
  35. break;
  36. case 6:
  37. $algorithm="6 - DSA-NSEC3-SHA1";
  38. break;
  39. case 7:
  40. $algorithm="7 - RSA/SHA1-NSEC3-SHA1";
  41. break;
  42. case 8:
  43. $algorithm="8 - RSA/SHA256";
  44. break;
  45. case 10:
  46. $algorithm="10 - RSA/SHA512";
  47. break;
  48. case 12:
  49. $algorithm="12 - ECC-GOST";
  50. break;
  51. case 13:
  52. $algorithm="13 - ECDSAP256/SHA256";
  53. break;
  54. case 14:
  55. $algorithm="14 - ECDSAP384/SHA384";
  56. break;
  57. case 15:
  58. $algorithm="15 - ED25519/SHA512";
  59. break;
  60. case 16:
  61. $algorithm="16 - ED448/SHA912";
  62. break;
  63. default:
  64. $algorithm="Unknown";
  65. }
  66. unset($output);
  67. render_page($user, $TAB, 'list_dns_public');
  68. }else {
  69. exec (HESTIA_CMD."v-list-dns-records ".$user." ".quoteshellarg($_GET['domain'])." 'json'", $output, $return_var);
  70. $data = json_decode(implode('', $output), true);
  71. if($_SESSION['userSortOrder'] == 'name'){
  72. ksort($data);
  73. }else{
  74. $data = array_reverse($data,true);
  75. }
  76. unset($output);
  77. render_page($user, $TAB, 'list_dns_rec');
  78. }
  79. // Back uri
  80. $_SESSION['back'] = $_SERVER['REQUEST_URI'];