dolibarr 19.0.4
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 *
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
25if (!defined('NOREQUIREMENU')) {
26 define('NOREQUIREMENU', '1');
27}
28
29if (!defined('NOLOGIN')) {
30 define('NOLOGIN', '1'); // If this page is public (can be called outside logged session)
31}
32
33if (!defined('NOIPCHECK')) {
34 define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
35}
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$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
44if (is_numeric($entity)) {
45 define("DOLENTITY", $entity);
46}
47
48// Load Dolibarr environment
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$suffix = "";
64
65// Check access to Module(s)
66if (!isModEnabled('ticket')) {
67 httponly_accessforbidden('Module Ticket is not enabled');
68}
69
70
71/*
72 * View
73 */
74
75$form = new Form($db);
76$formticket = new FormTicket($db);
77
78if (!getDolGlobalString('TICKET_ENABLE_PUBLIC_INTERFACE')) {
79 print $langs->trans('TicketPublicInterfaceForbidden');
80 exit;
81}
82
83$arrayofjs = array();
84$arrayofcss = array(getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', '/ticket/').'css/styles.css.php');
85
86llxHeaderTicket($langs->trans('Tickets'), "", 0, 0, $arrayofjs, $arrayofcss);
87
88print '<div class="ticketpublicarea ticketlargemargin centpercent">';
89
90print '<p style="text-align: center">'.(getDolGlobalString("TICKET_PUBLIC_TEXT_HOME", '<span class="opacitymedium">'.$langs->trans("TicketPublicDesc")).'</span></p>').'</p>';
91print '<br>';
92
93$baseurl = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', DOL_URL_ROOT.'/public/ticket/');
94
95print '<div class="ticketform">';
96print '<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>';
97print '<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>';
98print '<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>';
99print '<div class="clearboth"></div>';
100print '</div>'; // ends '<div class="ticketform">';
101print '</div>'; // ends '<div class="ticketpublicarea ticketlargemargin centpercent">';
102
103if (getDolGlobalInt('TICKET_SHOW_COMPANY_FOOTER')) {
104 // End of page
105 htmlPrintOnlineFooter($mysoc, $langs, 0, $suffix, $object);
106}
107
108llxFooter('', 'public');
109
110$db->close();
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage generation of HTML components Only common components must be here.
htmlPrintOnlineFooter($fromcompany, $langs, $addformmessage=0, $suffix='', $object=null)
Show footer of company in HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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 dolibarr global constant string value.
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...
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.