search.php 5.2 KB

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