dolibarr 24.0.0-beta
index.php
Go to the documentation of this file.
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 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26if (!defined('NOREQUIREMENU')) {
27 define('NOREQUIREMENU', '1');
28}
29if (!defined('NOLOGIN')) {
30 define('NOLOGIN', '1'); // If this page is public (can be called outside logged session)
31}
32if (!defined('NOIPCHECK')) {
33 define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
34}
35if (!defined('NOBROWSERNOTIF')) {
36 define('NOBROWSERNOTIF', '1');
37}
38
39// For MultiCompany module
40// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
41// Because 2 entities can have the same ref.
42$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
43if (is_numeric($entity)) {
44 define("DOLENTITY", $entity);
45}
46
47// Load Dolibarr environment
48require '../../main.inc.php';
56require_once DOL_DOCUMENT_ROOT.'/ticket/class/actions_ticket.class.php';
57require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
58require_once DOL_DOCUMENT_ROOT.'/core/class/html.formticket.class.php';
59require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php';
60require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
61require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
62require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
63
64// Load translation files required by the page
65$langs->loadLangs(array('companies', 'other', 'ticket', 'errors'));
66
67// Get parameters
68$track_id = GETPOST('track_id', 'alpha');
69$action = GETPOST('action', 'aZ09');
70$suffix = "";
71
72// Check access to Module(s)
73if (!isModEnabled('ticket')) {
74 httponly_accessforbidden('Module Ticket is not enabled');
75}
76
77$object = new Ticket($db);
78
79
80/*
81 * View
82 */
83
84if (!getDolGlobalString('TICKET_ENABLE_PUBLIC_INTERFACE')) {
85 print $langs->trans('TicketPublicInterfaceForbidden');
86 exit;
87}
88
89$arrayofjs = array();
90$arrayofcss = array(getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', '/public/ticket/').'css/styles.css.php');
91
92llxHeaderTicket($langs->trans('Tickets'), "", 0, 0, $arrayofjs, $arrayofcss);
93
94print '<div class="ticketpublicarea ticketlargemargin">';
95
96print '<p style="text-align: center">'.(getDolGlobalString("TICKET_PUBLIC_TEXT_HOME", '<span class="opacitymedium">'.$langs->trans("TicketPublicDesc")).'</span></p>').'</p>';
97print '<br>';
98
99$baseurl = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', DOL_URL_ROOT.'/public/ticket/');
100
101print '<div class="ticketform">';
102print '<a href="'.$baseurl . '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>';
103print '<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>';
104print '<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>';
105print '<div class="clearboth"></div>';
106print '</div>'; // ends '<div class="ticketform">';
107print '</div>'; // ends '<div class="ticketpublicarea ticketlargemargin">';
108
109if (getDolGlobalInt('TICKET_SHOW_COMPANY_FOOTER')) {
110 // End of page
111 htmlPrintOnlineFooter($mysoc, $langs, 0, $suffix, $object);
112}
113
114llxFooter('', 'public');
115
116$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
htmlPrintOnlineFooter($fromcompany, $langs, $addformmessage=0, $suffix='', $object=null)
Show footer of company in HTML public pages.
global $mysoc
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
Class to generate the form for creating a new ticket.
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.
llxHeaderTicket($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs=[], $arrayofcss=[])
Show http header, open body tag and show HTML header banner for public pages for tickets.