err-helper.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /**
  3. * Copyright 2021, 2024 5 Mode
  4. *
  5. * This file is part of 5 Cube.
  6. *
  7. * 5 Cube is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * 5 Cube is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with 5 Cube. If not, see <https://www.gnu.org/licenses/>.
  19. *
  20. * err-helper.php
  21. *
  22. * JS Error helper.
  23. *
  24. * @author Daniele Bonini <my25mb@aol.com>
  25. * @copyrights (c) 2016, 2024, 5 Mode
  26. */
  27. require "../../Private/core/init.inc";
  28. use OpenGallery\OpenGallery\Err;
  29. header("Content-Type: text/javascript");
  30. // PARAMETERS VALIDATION AND NORMALIZATION
  31. ?>
  32. var ERR_NO = "<?php echo ERR_NO; ?>";
  33. var ERR_KEY = "<?php echo ERR_KEY; ?>";
  34. var ERR_MSG = "<?php echo ERR_MSG; ?>";
  35. var ERR_SCRIPT = "<?php echo ERR_SCRIPT; ?>";
  36. var ERR_LINE = "<?php echo ERR_LINE; ?>";
  37. var ERR_STACK = "<?php echo ERR_STACK; ?>";
  38. var A_ERR_NO = {
  39. <?php
  40. $start=true;
  41. foreach (Err::$A_ERR_NO as $key => $value) {
  42. if (!$start) {
  43. echo ",\n";
  44. } else {
  45. $start=false;
  46. }
  47. echo "'$key':\"$value\"";
  48. }
  49. echo "\n";
  50. ?>
  51. };
  52. var A_ERR_MSG = {
  53. <?php
  54. $start=true;
  55. foreach (Err::$A_ERR_MSG as $key => $value) {
  56. if (!$start) {
  57. echo ",\n";
  58. } else {
  59. $start=false;
  60. }
  61. echo "'$key':\"$value\"";
  62. }
  63. echo "\n";
  64. ?>
  65. };
  66. var A_ERR_EXTDES_MSG = {
  67. <?php
  68. $start=true;
  69. foreach (Err::$A_ERR_EXTDES_MSG as $key => $value) {
  70. if (!$start) {
  71. echo ",\n";
  72. } else {
  73. $start=false;
  74. }
  75. echo "'$key':\"$value\"";
  76. }
  77. echo "\n";
  78. ?>
  79. };
  80. function clearErrors() {
  81. $(".form-error").each(function(index, Element) {
  82. $(this).hide();
  83. });
  84. $(".form-error-adapt").each(function(index, Element) {
  85. $(this).hide();
  86. });
  87. }