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/**
20 *       \file       htdocs/public/ticket/index.php
21 *       \ingroup    ticket
22 *       \brief      Public page to add and manage ticket
23 */
24
25if (!defined('NOCSRFCHECK')) {
26	define('NOCSRFCHECK', '1');
27}
28if (!defined('NOREQUIREMENU')) {
29	define('NOREQUIREMENU', '1');
30}
31if (!defined("NOLOGIN")) {
32	define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
33}
34if (!defined('NOIPCHECK')) {
35	define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
36}
37if (!defined('NOBROWSERNOTIF')) {
38	define('NOBROWSERNOTIF', '1');
39}
40
41// For MultiCompany module.
42// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
43// TODO This should be useless. Because entity must be retrieve from object ref and not from url.
44$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
45if (is_numeric($entity)) {
46	define("DOLENTITY", $entity);
47}
48
49require '../../main.inc.php';
50require_once DOL_DOCUMENT_ROOT.'/ticket/class/actions_ticket.class.php';
51require_once DOL_DOCUMENT_ROOT.'/core/class/html.formticket.class.php';
52require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php';
53require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
54require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
55require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
56
57// Load translation files required by the page
58$langs->loadLangs(array('companies', 'other', 'ticket', 'errors'));
59
60// Get parameters
61$track_id = GETPOST('track_id', 'alpha');
62$action = GETPOST('action', 'aZ09');
63
64
65/*
66 * View
67 */
68
69$form = new Form($db);
70$formticket = new FormTicket($db);
71
72if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
73	print $langs->trans('TicketPublicInterfaceForbidden');
74	exit;
75}
76
77$arrayofjs = array();
78$arrayofcss = array('/ticket/css/styles.css.php');
79
80llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss);
81
82print '<div class="ticketpublicarea">';
83print '<p style="text-align: center">'.($conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans("TicketPublicDesc")).'</p>';
84print '<div class="ticketform">';
85print '<a href="create_ticket.php" rel="nofollow noopener" class="butAction marginbottomonly"><div class="index_create bigrounded"><span class="fa fa-15x fa-plus-circle valignmiddle btnTitle-icon"></span><br>'.dol_escape_htmltag($langs->trans("CreateTicket")).'</div></a>';
86print '<a href="list.php" rel="nofollow noopener" class="butAction marginbottomonly"><div class="index_display bigrounded"><span class="fa fa-15x fa-list-alt valignmiddle btnTitle-icon"></span><br>'.dol_escape_htmltag($langs->trans("ViewMyTicketList")).'</div></a>';
87print '<a href="view.php" rel="nofollow noopener" class="butAction marginbottomonly"><div class="index_display bigrounded">'.img_picto('', 'ticket', 'class="fa-15x"').'<br>'.dol_escape_htmltag($langs->trans("ShowTicketWithTrackId")).'</div></a>';
88print '<div style="clear:both;"></div>';
89print '</div>';
90print '</div>';
91
92// End of page
93htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix, $object);
94
95llxFooter('', 'public');
96
97$db->close();
98