home-js.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?PHP
  2. /**
  3. * Copyright 2016, 2024 5 Mode
  4. * All Rights Reserved.
  5. *
  6. * This file is part of Simplicity.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions are met:
  10. * * Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * * Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * * Neither 5 Mode nor the names of its contributors
  16. * may be used to endorse or promote products derived from this software
  17. * without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  20. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  21. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  22. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY
  23. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  24. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  25. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  26. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  28. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. *
  30. * index-js.php
  31. *
  32. * Simplicity index file js.
  33. *
  34. * @author Daniele Bonini <my25mb@aol.com>
  35. * @copyrights (c) 2016, 2024 5 Mode
  36. */
  37. require "../../Private/core/init.inc";
  38. header("Content-Type: text/javascript");
  39. // PARAMETERS AND VARIABLES INIT
  40. $lang = APP_DEF_LANG;
  41. $lang1 = substr(filter_input(INPUT_GET, "hl")??"", 0, 5);
  42. $lang1= strip_tags($lang1);
  43. if ($lang1 !== PHP_STR) {
  44. $lang = $lang1;
  45. }
  46. $shortLang = getShortLang($lang);
  47. $CURRENT_VIEW=filter_input(INPUT_GET, "cv")??"";
  48. $CURRENT_VIEW= strip_tags($CURRENT_VIEW);
  49. ?>
  50. function startApp() {
  51. hidePassword();
  52. }
  53. function hidePassword() {
  54. $("#passworddisplay").css("visibility","hidden");
  55. }
  56. /*
  57. * call to startApp
  58. *
  59. * @returns void
  60. */
  61. function _startApp() {
  62. setTimeout("startApp()", 1000);
  63. }
  64. /*
  65. * Display the current hash for the config file
  66. *
  67. * @returns void
  68. */
  69. function showEncodedPassword() {
  70. if ($("#Password").val() === "") {
  71. $("#Password").addClass("emptyfield");
  72. return;
  73. }
  74. //if ($("#Salt").val() === "") {
  75. // $("#Salt").addClass("emptyfield");
  76. // return;
  77. //}
  78. passw = encryptSha2( $("#Password").val() + $("#Salt").val());
  79. msg = "<?PHP echo(getResource0("Please set your hash in the config file with this value", $lang, "/js/home-js.php"));?>:";
  80. alert(msg + "\n\n" + passw);
  81. }
  82. function passwordSubmit() {
  83. $("#_group").val("");
  84. frmSim.submit();
  85. }
  86. $("input#Password").on("keydown",function(e){
  87. key = e.which;
  88. if (key===13) {
  89. e.preventDefault();
  90. passwordSubmit();
  91. }
  92. });
  93. window.addEventListener("load", function() {
  94. setTimeout("_startApp()", 10000);
  95. });