search.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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 <http://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')) define('NOREQUIREUSER','1');
  25. if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
  26. if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
  27. if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
  28. if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
  29. if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
  30. if (! defined('NOLOGIN')) define('NOLOGIN',1);
  31. if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
  32. require_once '../main.inc.php';
  33. /*
  34. * Actions
  35. */
  36. if (GETPOST('search_proposal') != '')
  37. {
  38. header("Location: ".DOL_URL_ROOT.'/comm/propal/list.php?sall='.urlencode(GETPOST('search_proposal')));
  39. exit;
  40. }
  41. if (GETPOST('search_customer_order') != '')
  42. {
  43. header("Location: ".DOL_URL_ROOT.'/commande/list.php?sall='.urlencode(GETPOST('search_customer_order')));
  44. exit;
  45. }
  46. if (GETPOST('search_supplier_order') != '')
  47. {
  48. header("Location: ".DOL_URL_ROOT.'/fourn/commande/list.php?search_all='.urlencode(GETPOST('search_supplier_order')));
  49. exit;
  50. }
  51. if (GETPOST('search_intervention') != '')
  52. {
  53. header("Location: ".DOL_URL_ROOT.'/fichinter/list.php?sall='.urlencode(GETPOST('search_intervention')));
  54. exit;
  55. }
  56. if (GETPOST('search_contract') != '')
  57. {
  58. header("Location: ".DOL_URL_ROOT.'/contrat/list.php?sall='.urlencode(GETPOST('search_contract')));
  59. exit;
  60. }
  61. if (GETPOST('search_invoice') != '')
  62. {
  63. header("Location: ".DOL_URL_ROOT.'/compta/facture/list.php?sall='.urlencode(GETPOST('search_invoice')));
  64. exit;
  65. }
  66. if (GETPOST('search_supplier_invoice') != '')
  67. {
  68. header("Location: ".DOL_URL_ROOT.'/fourn/facture/list.php?sall='.urlencode(GETPOST('search_supplier_invoice')));
  69. exit;
  70. }
  71. if (GETPOST('search_supplier_proposal') != '')
  72. {
  73. header("Location: ".DOL_URL_ROOT.'/supplier_proposal/list.php?sall='.urlencode(GETPOST('search_supplier_proposal')));
  74. exit;
  75. }
  76. if (GETPOST('search_donation') != '')
  77. {
  78. header("Location: ".DOL_URL_ROOT.'/don/list.php?sall='.urlencode(GETPOST('search_donation')));
  79. exit;
  80. }
  81. if (GETPOST('search_product') != '')
  82. {
  83. header("Location: ".DOL_URL_ROOT.'/product/list.php?sall='.urlencode(GETPOST('search_product')));
  84. exit;
  85. }
  86. if (GETPOST('search_thirdparty') != '')
  87. {
  88. header("Location: ".DOL_URL_ROOT.'/societe/list.php?mode=search&sall='.urlencode(GETPOST('search_thirdparty')));
  89. exit;
  90. }
  91. if (GETPOST('search_contact') != '')
  92. {
  93. header("Location: ".DOL_URL_ROOT.'/contact/list.php?mode=search&sall='.urlencode(GETPOST('search_contact')));
  94. exit;
  95. }
  96. if (GETPOST('search_deplacement') != '')
  97. {
  98. header("Location: ".DOL_URL_ROOT.'/compta/deplacement/list.php?mode=search&sall='.urlencode(GETPOST('search_deplacement')));
  99. exit;
  100. }
  101. if (GETPOST('search_expensereport') != '')
  102. {
  103. header("Location: ".DOL_URL_ROOT.'/expensereport/list.php?mode=search&sall='.urlencode(GETPOST('search_expensereport')));
  104. exit;
  105. }
  106. if (GETPOST('search_holiday') != '')
  107. {
  108. header("Location: ".DOL_URL_ROOT.'/holiday/list.php?mode=search&sall='.urlencode(GETPOST('search_holiday')));
  109. exit;
  110. }
  111. if (GETPOST('search_member') != '')
  112. {
  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. {
  118. header("Location: ".DOL_URL_ROOT.'/projet/list.php?mode=search&search_all='.urlencode(GETPOST('search_project')));
  119. exit;
  120. }
  121. if (GETPOST('search_task') != '')
  122. {
  123. header("Location: ".DOL_URL_ROOT.'/projet/tasks/list.php?mode=search&search_all='.urlencode(GETPOST('search_task')));
  124. exit;
  125. }
  126. if (GETPOST('search_user') != '')
  127. {
  128. header("Location: ".DOL_URL_ROOT.'/user/list.php?mode=search&sall='.urlencode(GETPOST('search_user')));
  129. exit;
  130. }
  131. if (GETPOST('search_group') != '')
  132. {
  133. header("Location: ".DOL_URL_ROOT.'/user/group/list.php?mode=search&sall='.urlencode(GETPOST('search_group')));
  134. exit;
  135. }
  136. // If we are here, search was called with no supported criteria
  137. if (! empty($_SERVER['HTTP_REFERER']))
  138. {
  139. header("Location: ".$_SERVER['HTTP_REFERER']);
  140. exit;
  141. }
  142. else
  143. {
  144. print 'The wrapper search.php was called without any search criteria';
  145. }