search.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <?php
  2. /* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
  3. *
  4. * This file is a modified version of datepicker.php from phpBSM to fix some
  5. * bugs, to add new features and to dramatically increase speed.
  6. *
  7. * This program 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. * This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
  19. */
  20. /**
  21. * \file htdocs/core/search.php
  22. * \brief Wrapper that receive any search. Depending on input field, make a redirect to correct URL.
  23. */
  24. if (!defined('NOREQUIREUSER')) {
  25. define('NOREQUIREUSER', '1');
  26. }
  27. if (!defined('NOREQUIREDB')) {
  28. define('NOREQUIREDB', '1');
  29. }
  30. if (!defined('NOREQUIRESOC')) {
  31. define('NOREQUIRESOC', '1');
  32. }
  33. if (!defined('NOREQUIRETRAN')) {
  34. define('NOREQUIRETRAN', '1');
  35. }
  36. if (!defined('NOCSRFCHECK')) {
  37. define('NOCSRFCHECK', 1);
  38. }
  39. if (!defined('NOTOKENRENEWAL')) {
  40. define('NOTOKENRENEWAL', 1);
  41. }
  42. if (!defined('NOLOGIN')) {
  43. define('NOLOGIN', 1);
  44. }
  45. if (!defined('NOREQUIREMENU')) {
  46. define('NOREQUIREMENU', 1);
  47. }
  48. require_once '../main.inc.php';
  49. /*
  50. * Actions
  51. */
  52. if (GETPOST('search_proposal') != '') {
  53. header("Location: ".DOL_URL_ROOT.'/comm/propal/list.php?sall='.urlencode(GETPOST('search_proposal')));
  54. exit;
  55. }
  56. if (GETPOST('search_customer_order') != '') {
  57. header("Location: ".DOL_URL_ROOT.'/commande/list.php?sall='.urlencode(GETPOST('search_customer_order')));
  58. exit;
  59. }
  60. if (GETPOST('search_supplier_order') != '') {
  61. header("Location: ".DOL_URL_ROOT.'/fourn/commande/list.php?search_all='.urlencode(GETPOST('search_supplier_order')));
  62. exit;
  63. }
  64. if (GETPOST('search_intervention') != '') {
  65. header("Location: ".DOL_URL_ROOT.'/fichinter/list.php?sall='.urlencode(GETPOST('search_intervention')));
  66. exit;
  67. }
  68. if (GETPOST('search_contract') != '') {
  69. header("Location: ".DOL_URL_ROOT.'/contrat/list.php?sall='.urlencode(GETPOST('search_contract')));
  70. exit;
  71. }
  72. if (GETPOST('search_invoice') != '') {
  73. header("Location: ".DOL_URL_ROOT.'/compta/facture/list.php?sall='.urlencode(GETPOST('search_invoice')));
  74. exit;
  75. }
  76. if (GETPOST('search_supplier_invoice') != '') {
  77. header("Location: ".DOL_URL_ROOT.'/fourn/facture/list.php?sall='.urlencode(GETPOST('search_supplier_invoice')));
  78. exit;
  79. }
  80. if (GETPOST('search_supplier_proposal') != '') {
  81. header("Location: ".DOL_URL_ROOT.'/supplier_proposal/list.php?sall='.urlencode(GETPOST('search_supplier_proposal')));
  82. exit;
  83. }
  84. if (GETPOST('search_donation') != '') {
  85. header("Location: ".DOL_URL_ROOT.'/don/list.php?sall='.urlencode(GETPOST('search_donation')));
  86. exit;
  87. }
  88. if (GETPOST('search_product') != '') {
  89. header("Location: ".DOL_URL_ROOT.'/product/list.php?sall='.urlencode(GETPOST('search_product')));
  90. exit;
  91. }
  92. if (GETPOST('search_thirdparty') != '') {
  93. header("Location: ".DOL_URL_ROOT.'/societe/list.php?mode=search&sall='.urlencode(GETPOST('search_thirdparty')));
  94. exit;
  95. }
  96. if (GETPOST('search_contact') != '') {
  97. header("Location: ".DOL_URL_ROOT.'/contact/list.php?mode=search&sall='.urlencode(GETPOST('search_contact')));
  98. exit;
  99. }
  100. if (GETPOST('search_deplacement') != '') {
  101. header("Location: ".DOL_URL_ROOT.'/compta/deplacement/list.php?mode=search&sall='.urlencode(GETPOST('search_deplacement')));
  102. exit;
  103. }
  104. if (GETPOST('search_expensereport') != '') {
  105. header("Location: ".DOL_URL_ROOT.'/expensereport/list.php?mode=search&sall='.urlencode(GETPOST('search_expensereport')));
  106. exit;
  107. }
  108. if (GETPOST('search_holiday') != '') {
  109. header("Location: ".DOL_URL_ROOT.'/holiday/list.php?mode=search&sall='.urlencode(GETPOST('search_holiday')));
  110. exit;
  111. }
  112. if (GETPOST('search_member') != '') {
  113. header("Location: ".DOL_URL_ROOT.'/adherents/list.php?mode=search&sall='.urlencode(GETPOST('search_member')));
  114. exit;
  115. }
  116. if (GETPOST('search_project') != '') {
  117. header("Location: ".DOL_URL_ROOT.'/projet/list.php?mode=search&search_all='.urlencode(GETPOST('search_project')));
  118. exit;
  119. }
  120. if (GETPOST('search_task') != '') {
  121. header("Location: ".DOL_URL_ROOT.'/projet/tasks/list.php?mode=search&search_all='.urlencode(GETPOST('search_task')));
  122. exit;
  123. }
  124. if (GETPOST('search_user') != '') {
  125. header("Location: ".DOL_URL_ROOT.'/user/list.php?mode=search&sall='.urlencode(GETPOST('search_user')));
  126. exit;
  127. }
  128. if (GETPOST('search_group') != '') {
  129. header("Location: ".DOL_URL_ROOT.'/user/group/list.php?mode=search&sall='.urlencode(GETPOST('search_group')));
  130. exit;
  131. }
  132. // If we are here, search was called with no supported criteria
  133. if (!empty($_SERVER['HTTP_REFERER'])) {
  134. header("Location: ".$_SERVER['HTTP_REFERER']);
  135. exit;
  136. } else {
  137. print 'The wrapper search.php was called without any search criteria';
  138. }