index.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. /* Copyright (C) - 2013-2016 Jean-François FERRY <hello@librethic.io>
  3. * Copyright (C) - 2019 Laurent Destailleur <eldy@users.sourceforge.net>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file htdocs/public/ticket/index.php
  20. * \ingroup ticket
  21. * \brief Public page to add and manage tickets
  22. */
  23. if (!defined('NOREQUIREMENU')) {
  24. define('NOREQUIREMENU', '1');
  25. }
  26. if (!defined('NOLOGIN')) {
  27. define('NOLOGIN', '1'); // If this page is public (can be called outside logged session)
  28. }
  29. if (!defined('NOIPCHECK')) {
  30. define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
  31. }
  32. if (!defined('NOBROWSERNOTIF')) {
  33. define('NOBROWSERNOTIF', '1');
  34. }
  35. // For MultiCompany module
  36. // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
  37. $entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
  38. if (is_numeric($entity)) {
  39. define("DOLENTITY", $entity);
  40. }
  41. // Load Dolibarr environment
  42. require '../../main.inc.php';
  43. require_once DOL_DOCUMENT_ROOT.'/ticket/class/actions_ticket.class.php';
  44. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formticket.class.php';
  45. require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php';
  46. require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
  47. require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
  48. require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
  49. // Load translation files required by the page
  50. $langs->loadLangs(array('companies', 'other', 'ticket', 'errors'));
  51. // Get parameters
  52. $track_id = GETPOST('track_id', 'alpha');
  53. $action = GETPOST('action', 'aZ09');
  54. $suffix = "";
  55. // Check access to Module(s)
  56. if (!isModEnabled('ticket')) {
  57. httponly_accessforbidden('Module Ticket is not enabled');
  58. }
  59. /*
  60. * View
  61. */
  62. $form = new Form($db);
  63. $formticket = new FormTicket($db);
  64. if (!getDolGlobalString('TICKET_ENABLE_PUBLIC_INTERFACE')) {
  65. print $langs->trans('TicketPublicInterfaceForbidden');
  66. exit;
  67. }
  68. $arrayofjs = array();
  69. $arrayofcss = array('/ticket/css/styles.css.php');
  70. llxHeaderTicket($langs->trans('Tickets'), "", 0, 0, $arrayofjs, $arrayofcss);
  71. print '<div class="ticketpublicarea ticketlargemargin centpercent">';
  72. print '<p style="text-align: center">'.(getDolGlobalString("TICKET_PUBLIC_TEXT_HOME", '<span class="opacitymedium">'.$langs->trans("TicketPublicDesc")).'</span></p>').'</p>';
  73. print '<br>';
  74. print '<div class="ticketform">';
  75. print '<a href="'.DOL_URL_ROOT.'/public/ticket/create_ticket.php?action=create'.(!empty($entity) && isModEnabled('multicompany') ? '&entity='.$entity : '').'&token='.newToken().'" rel="nofollow noopener" class="butAction marginbottomonly"><div class="index_create bigrounded"><span class="fa fa-15 fa-plus-circle valignmiddle btnTitle-icon"></span><br>'.dol_escape_htmltag($langs->trans("CreateTicket")).'</div></a>';
  76. print '<a href="list.php'.(!empty($entity) && isModEnabled('multicompany') ? '?entity='.$entity : '').'" rel="nofollow noopener" class="butAction marginbottomonly"><div class="index_display bigrounded"><span class="fa fa-15 fa-list-alt valignmiddle btnTitle-icon"></span><br>'.dol_escape_htmltag($langs->trans("ViewMyTicketList")).'</div></a>';
  77. print '<a href="view.php'.(!empty($entity) && isModEnabled('multicompany') ? '?entity='.$entity : '').'" rel="nofollow noopener" class="butAction marginbottomonly"><div class="index_display bigrounded">'.img_picto('', 'ticket', 'class="fa-15"').'<br>'.dol_escape_htmltag($langs->trans("ShowTicketWithTrackId")).'</div></a>';
  78. print '<div class="clearboth"></div>';
  79. print '</div>'; // ends '<div class="ticketform">';
  80. print '</div>'; // ends '<div class="ticketpublicarea ticketlargemargin centpercent">';
  81. if (getDolGlobalInt('TICKET_SHOW_COMPANY_FOOTER')) {
  82. // End of page
  83. htmlPrintOnlineFooter($mysoc, $langs, 0, $suffix, $object);
  84. }
  85. llxFooter('', 'public');
  86. $db->close();