36define(
'MAIN_SECURITY_FORCECSP',
"default-src 'none'");
40if (!defined(
'NOTOKENRENEWAL')) {
41 define(
'NOTOKENRENEWAL',
'1');
43if (!defined(
'NOREQUIREMENU')) {
44 define(
'NOREQUIREMENU',
'1');
46if (!defined(
'NOREQUIREHTML')) {
47 define(
'NOREQUIREHTML',
'1');
49if (!defined(
'NOREQUIREAJAX')) {
50 define(
'NOREQUIREAJAX',
'1');
53if (!defined(
"NOLOGIN")) {
56if (!defined(
"NOCSRFCHECK")) {
57 define(
"NOCSRFCHECK", 1);
59if (!defined(
"NOIPCHECK")) {
60 define(
"NOIPCHECK", 1);
86function llxHeader($head =
'', $title =
'', $help_url =
'', $target =
'', $disablejs = 0, $disablehead = 0, $arrayofjs =
'', $arrayofcss =
'', $morequerystring =
'', $morecssonbody =
'', $replacemainareaby =
'', $disablenofollow = 0, $disablenoindex = 0)
101function llxFooter($comment =
'', $zone =
'private', $disabledoutputofmessages = 0)
105require
'../../main.inc.php';
113require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
114require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
115require_once DOL_DOCUMENT_ROOT.
'/ticket/class/ticket.class.php';
118$original_file =
GETPOST(
'file',
'alphanohtml');
119$modulepart =
'ticket';
120$entity = GETPOSTISSET(
'entity') ?
GETPOSTINT(
'entity') :
$conf->entity;
124if ($user->socid > 0) {
125 $socid = $user->socid;
134 print $langs->trans(
'TicketPublicInterfaceForbidden');
138global $dolibarr_main_instance_unique_id;
139$calcsecurekey =
dol_hash(
'dolibarr-'.$original_file.
'-'.$dolibarr_main_instance_unique_id,
'sha256');
141$securekey =
GETPOST(
'securekey');
143if (!hash_equals($calcsecurekey, $securekey)) {
165if (preg_match(
'/\.(html|htm)$/i', $original_file)) {
168if (isset($_GET[
"attachment"])) {
169 $attachment =
GETPOST(
"attachment",
'alpha') ? true :
false;
176$type =
'application/octet-stream';
178 $type =
GETPOST(
'type',
'alpha');
180 $type = dol_mimetype($original_file);
185if (!in_array($type, array(
'text/x-javascript')) && !dolIsAllowedForPreview($original_file)) {
186 $type =
'application/octet-stream';
190$original_file = preg_replace(
'/\.\.+/',
'..', $original_file);
191$original_file = str_replace(
'../',
'/', $original_file);
192$original_file = str_replace(
'..\\',
'/', $original_file);
195if (empty($modulepart)) {
231$fullpath_original_file =
getMultidirOutput($object,
'ticket').
'/'.$original_file;
236if (!$accessallowed) {
242if (preg_match(
'/\.\./', $fullpath_original_file) || preg_match(
'/[<>|]/', $fullpath_original_file)) {
243 dol_syslog(
"Refused to deliver file ".$fullpath_original_file);
244 print
"ErrorFileNameInvalid: ".dol_escape_htmltag($original_file);
251$filename = basename($fullpath_original_file);
252$filename = preg_replace(
'/\.noexe$/i',
'', $filename);
255dol_syslog(
"document.php download $fullpath_original_file filename=$filename content-type=$type");
256$fullpath_original_file_osencoded =
dol_osencode($fullpath_original_file);
259if (!file_exists($fullpath_original_file_osencoded)) {
260 dol_syslog(
"ErrorFileDoesNotExists: ".$fullpath_original_file);
261 print $langs->trans(
"ErrorFileDoesNotExists") .
' : ' .
dol_escape_htmltag($original_file);
271header(
'Content-Description: File Transfer');
273 header(
'Content-Encoding: '.$encoding);
277if ($attachment > 0) {
278 header(
'Content-Disposition: attachment; filename="'.$filename.
'"');
279} elseif (empty($attachment)) {
280 header(
'Content-Disposition: inline; filename="'.$filename.
'"');
283header(
'Cache-Control: Public, must-revalidate');
284header(
'Pragma: public');
293 header(
'Content-Length: '.
dol_filesize($fullpath_original_file));
295 readfileLowMemory($fullpath_original_file_osencoded);
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
dol_filesize($pathoffile)
Return size of a file.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
getMultidirOutput($object, $module='', $forobject=0, $mode='output')
Return the full path of the directory where a module (or an object of a module) stores its files.
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_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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...
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
dol_hash($chain, $type='0', $nosalt=0, $mode=0)
Returns a hash (non reversible encryption) of a string.