dolibarr 23.0.3
ajaxdirpreview.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
5 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
6 * Copyright (C) 2010 Pierre Morin <pierre.morin@auguria.net>
7 * Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
8 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
9 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
10 * Copyright (C) 2025 Joachim Kueter <git-jk@bloxera.com>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <https://www.gnu.org/licenses/>.
24 */
25
33if (!defined('NOTOKENRENEWAL')) {
34 define('NOTOKENRENEWAL', 1); // Disables token renewal
35}
36if (!defined('NOREQUIREMENU')) {
37 define('NOREQUIREMENU', '1');
38}
39if (!defined('NOREQUIREHTML')) {
40 define('NOREQUIREHTML', '1');
41}
42if (!defined('NOREQUIREAJAX')) {
43 define('NOREQUIREAJAX', '1');
44}
45
59if (!isset($mode) || $mode != 'noajax') { // For ajax call
60 require_once '../../main.inc.php';
61 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
62 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
63 require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
64
65 $action = GETPOST('action', 'aZ09');
66 $file = urldecode(GETPOST('file', 'alpha'));
67 $section = GETPOST("section", 'alpha');
68 $module = GETPOST("module", 'alpha');
69 $urlsource = GETPOST("urlsource", 'alpha');
70 $search_doc_ref = GETPOST('search_doc_ref', 'alpha');
71
72 $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
73 $sortfield = GETPOST("sortfield", 'aZ09comma');
74 $sortorder = GETPOST("sortorder", 'aZ09comma');
75 $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
76 $showonrightsize = '';
77
78 if (empty($page) || $page == -1) {
79 $page = 0;
80 } // If $page is not defined, or '' or -1
81 $offset = $limit * $page;
82 $pageprev = $page - 1;
83 $pagenext = $page + 1;
84 if (!$sortorder) {
85 $sortorder = "ASC";
86 }
87 if (!$sortfield) {
88 $sortfield = "name";
89 }
90
91 $rootdirfordoc = $conf->ecm->dir_output;
92
93 $upload_dir = dirname(str_replace("../", "/", $rootdirfordoc.'/'.$file));
94
95 $ecmdir = new EcmDirectory($db);
96 if ($section > 0) {
97 $result = $ecmdir->fetch((int) $section);
98 //if (!($result > 0)) {
99 //dol_print_error($db,$ecmdir->error);
100 //exit;
101 //}
102 }
103} else {
104 // When no an ajax call (include from other file)
108 '
109 @phan-var-force int $section
110 @phan-var-force string $module
111 @phan-var-force string $showonrightsize
112 ';
113
114 $rootdirfordoc = $conf->ecm->dir_output;
115
116 $ecmdir = new EcmDirectory($db);
117 $relativepath = '';
118 if ($section > 0) {
119 $result = $ecmdir->fetch($section);
120 if (!($result > 0)) {
121 dol_print_error($db, $ecmdir->error);
122 exit;
123 }
124
125 $relativepath = $ecmdir->getRelativePath(); // Example 'mydir/'
126 } elseif (GETPOST('section_dir')) {
127 $relativepath = GETPOST('section_dir');
128 }
129 //var_dump($section.'-'.GETPOST('section_dir').'-'.$relativepath);
130
131 $upload_dir = $rootdirfordoc.'/'.$relativepath;
132}
133
134if (empty($url)) { // autoset $url but it is better to have it defined before into filemanager.tpl.php (not possible when in auto tree)
135 if (!empty($module) && $module == 'medias' && !GETPOST('website')) {
136 $url = DOL_URL_ROOT.'/ecm/index_medias.php';
137 } elseif (GETPOSTISSET('website')) {
138 $url = DOL_URL_ROOT.'/website/index.php';
139 } else {
140 $url = DOL_URL_ROOT.'/ecm/index.php';
141 }
142}
143
144// Load translation files required by the page
145$langs->loadLangs(array("ecm", "companies", "other"));
146
147if (empty($modulepart)) {
148 $modulepart = $module;
149}
150
151// Security check
152if ($user->socid > 0) {
153 $socid = $user->socid;
154}
155// On interdit les remontees de repertoire ainsi que les pipe dans les noms de fichiers.
156if (preg_match('/\.\./', $upload_dir) || preg_match('/[<>|]/', $upload_dir)) {
157 dol_syslog("Refused to deliver file ".$upload_dir);
158 // Do no show plain path in shown error message
159 dol_print_error(null, $langs->trans("ErrorFileNameInvalid", $upload_dir));
160 exit;
161}
162// Check permissions
163if ($modulepart == 'ecm') {
164 if (!$user->hasRight('ecm', 'read')) {
166 }
167} elseif ($modulepart == 'medias' || $modulepart == 'website') {
168 // Always allowed
169} else {
171}
172
173
174/*
175 * Action
176 */
177
178// None
179
180
181
182/*
183 * View
184 */
185
186if (!isset($mode) || $mode != 'noajax') {
187 // Ajout directives pour resoudre bug IE
188 header('Cache-Control: Public, must-revalidate');
189 header('Pragma: public');
190
191 top_httphead();
192}
193
194$type = 'directory';
195
196// This test if file exists should be useless. We keep it to find bug more easily
197if (!dol_is_dir($upload_dir)) {
198 //dol_mkdir($upload_dir);
199 /*$langs->load("install");
200 dol_print_error(0,$langs->trans("ErrorDirDoesNotExists",$upload_dir));
201 exit;*/
202}
203
204print '<!-- ajaxdirpreview mode='.$mode.' type='.$type.' module='.$module.' modulepart='.$modulepart.'-->'."\n";
205//print '<!-- Page called with mode='.dol_escape_htmltag(isset($mode)?$mode:'').' type='.dol_escape_htmltag($type).' module='.dol_escape_htmltag($module).' url='.dol_escape_htmltag($url).' '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
206
207$param = ($sortfield ? '&sortfield='.urlencode($sortfield) : '').($sortorder ? '&sortorder='.urlencode($sortorder) : '');
208if (!empty($websitekey)) {
209 $param .= '&website='.urlencode($websitekey);
210}
211if (!empty($pageid)) {
212 $param .= '&pageid='.((int) $pageid);
213}
214
215
216// Dir scan
217if ($type == 'directory') {
218 $formfile = new FormFile($db);
219
220 $maxlengthname = 40;
221 $excludefiles = array('^SPECIMEN\.pdf$', '^\.', '(\.meta|_preview.*\.png)$', '^temp$', '^payments$', '^CVS$', '^thumbs$');
222 $sorting = (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC);
223
224 // Right area. If module is defined here, we are in automatic ecm.
225 $automodules = array(
226 'company',
227 'invoice',
228 'invoice_supplier',
229 'propal',
230 'supplier_proposal',
231 'order',
232 'order_supplier',
233 'contract',
234 'product',
235 'tax',
236 'tax-vat',
237 'salaries',
238 'project',
239 'project_task',
240 'fichinter',
241 'user',
242 'expensereport',
243 'holiday',
244 'recruitment-recruitmentcandidature',
245 'banque',
246 'bank-statement',
247 'chequereceipt',
248 'mrp-mo'
249 );
250
251 $parameters = array('modulepart' => $module);
252 $reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
253 if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) {
254 if (is_array($hookmanager->resArray['module'])) {
255 $automodules = array_merge($automodules, $hookmanager->resArray['module']);
256 } else {
257 $automodules[] = $hookmanager->resArray['module'];
258 }
259 }
260
261 // TODO change for multicompany sharing
262 if ($module == 'company') {
263 $upload_dir = $conf->societe->dir_output;
264 $excludefiles[] = '^contact$'; // The subdir 'contact' contains files of contacts.
265 } elseif ($module == 'invoice') {
266 $upload_dir = $conf->invoice->dir_output;
267 } elseif ($module == 'invoice_supplier') {
268 $upload_dir = $conf->fournisseur->facture->dir_output;
269 } elseif ($module == 'propal') {
270 $upload_dir = $conf->propal->dir_output;
271 } elseif ($module == 'supplier_proposal') {
272 $upload_dir = $conf->supplier_proposal->dir_output;
273 } elseif ($module == 'order') {
274 $upload_dir = $conf->order->dir_output;
275 } elseif ($module == 'order_supplier') {
276 $upload_dir = $conf->fournisseur->commande->dir_output;
277 } elseif ($module == 'contract') {
278 $upload_dir = $conf->contract->dir_output;
279 } elseif ($module == 'product') {
280 $upload_dir = $conf->product->dir_output;
281 } elseif ($module == 'tax') {
282 $upload_dir = $conf->tax->dir_output;
283 $excludefiles[] = '^vat$'; // The subdir 'vat' contains files of vats.
284 } elseif ($module == 'tax-vat') {
285 $upload_dir = $conf->tax->dir_output.'/vat';
286 } elseif ($module == 'salaries') {
287 $upload_dir = $conf->salaries->dir_output;
288 } elseif ($module == 'project') {
289 $upload_dir = $conf->project->dir_output;
290 } elseif ($module == 'project_task') {
291 $upload_dir = $conf->project->dir_output;
292 } elseif ($module == 'fichinter') {
293 $upload_dir = $conf->ficheinter->dir_output;
294 } elseif ($module == 'user') {
295 $upload_dir = $conf->user->dir_output;
296 } elseif ($module == 'expensereport') {
297 $upload_dir = $conf->expensereport->dir_output;
298 } elseif ($module == 'holiday') {
299 $upload_dir = $conf->holiday->dir_output;
300 } elseif ($module == 'recruitment-recruitmentcandidature') {
301 $upload_dir = $conf->recruitment->dir_output.'/recruitmentcandidature';
302 } elseif ($module == 'banque') {
303 $upload_dir = $conf->bank->dir_output;
304 } elseif ($module == 'bank-statement') {
305 $upload_dir = $conf->bank->dir_output.'/*/statement';
306 } elseif ($module == 'chequereceipt') {
307 $upload_dir = $conf->bank->dir_output.'/checkdeposits';
308 } elseif ($module == 'mrp-mo') {
309 $upload_dir = $conf->mrp->dir_output;
310 } else {
311 $parameters = array('modulepart' => $module);
312 $reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
313 if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) {
314 $upload_dir = $hookmanager->resArray['directory'];
315 }
316 }
317
318 // Automatic list
319 if (in_array($module, $automodules)) {
320 $param .= '&module='.urlencode($module);
321 if (isset($search_doc_ref) && $search_doc_ref != '') {
322 $param .= '&search_doc_ref='.urlencode($search_doc_ref);
323 }
324
325 $textifempty = ($section ? $langs->trans("NoFileFound") : ($showonrightsize == 'featurenotyetavailable' ? $langs->trans("FeatureNotYetAvailable") : $langs->trans("NoFileFound")));
326
327 $filter = preg_quote((string) $search_doc_ref, '/');
328 $filearray = dol_dir_list($upload_dir, "files", 1, $filter, $excludefiles, $sortfield, $sorting, 1);
329 //var_dump($filearray);
330
331 // To allow external users,we must restrict $filearray to entries the user is a thirdparty.
332 // This can be done by filtering on entries found into llx_ecm
333 if ($user->socid > 0) {
334 $filearrayallowedtoexternal = array(); // 'fullpath' => array(...)
335
336 // Search files in ECM with select filepath.filename where src_object_type = $module and src_object_type EXISTS in (select rowid from $objecttablename WERE fk_soc = '.$user->socid.' and entity in getEntity($objecttbalename)
337 // TODO
338
339 // Now clean $filearray to keep only record also found into $filearrayallowedtoexternal.
340 foreach ($filearray as $key => $val) {
341 if (!in_array($upload_dir.'/'.$val['relativename'], $filearrayallowedtoexternal)) {
342 unset($filearray[$key]);
343 }
344 }
345 }
346
347 $perm = $user->hasRight('ecm', 'upload');
348
349 // Print list of files
350 $formfile->list_of_autoecmfiles($upload_dir, $filearray, $module, $param, 1, '', $perm, 1, $textifempty, $maxlengthname, $url, 1);
351 } else {
352 // Manual list
353 if ($module == 'medias') {
354 /*
355 $_POST is array like
356 'token' => string '062380e11b7dcd009d07318b57b71750' (length=32)
357 'action' => string 'file_manager' (length=12)
358 'website' => string 'template' (length=8)
359 'pageid' => string '124' (length=3)
360 'section_dir' => string 'mydir/' (length=3)
361 'section_id' => string '0' (length=1)
362 'max_file_size' => string '2097152' (length=7)
363 'sendit' => string 'Envoyer fichier' (length=15)
364 */
365 $relativepath = GETPOST('file', 'alpha') ? GETPOST('file', 'alpha') : GETPOST('section_dir', 'alpha');
366 if ($relativepath && $relativepath != '/') {
367 $relativepath .= '/';
368 }
369 $upload_dir = $dolibarr_main_data_root.'/'.$module.'/'.$relativepath;
370 if (GETPOSTISSET('website') || GETPOSTISSET('file_manager')) {
371 $param .= '&file_manager=1';
372 if (!preg_match('/website=/', $param) && GETPOST('website', 'alpha')) {
373 $param .= '&website='.urlencode(GETPOST('website', 'alpha'));
374 }
375 if (!preg_match('/pageid=/', $param)) {
376 $param .= '&pageid='.GETPOSTINT('pageid');
377 }
378 //if (!preg_match('/backtopage=/',$param)) $param.='&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid);
379 }
380 } else {
381 $relativepath = $ecmdir->getRelativePath();
382 $upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
383 }
384
385 // If $section defined with value 0
386 if (($section === '0' || empty($section)) && ($module != 'medias')) {
387 $filearray = array();
388 } else {
389 $filearray = dol_dir_list($upload_dir, "files", 0, '', array('^\.', '(\.meta|_preview.*\.png)$', '^temp$', '^CVS$'), $sortfield, $sorting, 1);
390 }
391
392 if ($section) {
393 $param .= '&section='.$section;
394 if (isset($search_doc_ref) && $search_doc_ref != '') {
395 $param .= '&search_doc_ref='.urlencode($search_doc_ref);
396 }
397
398 $textifempty = $langs->trans('NoFileFound');
399 } elseif ($section === '0') {
400 if ($module == 'ecm') {
401 $textifempty = '<br><div class="center"><span class="warning">'.$langs->trans("DirNotSynchronizedSyncFirst").'</span></div><br>';
402 } else {
403 $textifempty = $langs->trans('NoFileFound');
404 }
405 } else {
406 $textifempty = ($showonrightsize == 'featurenotyetavailable' ? $langs->trans("FeatureNotYetAvailable") : $langs->trans("ECMSelectASection"));
407 }
408
409 $useinecm = 0;
410 if ($module == 'medias') {
411 $useinecm = 6;
412 $modulepart = 'medias';
413 $perm = ($user->hasRight("website", "write") || $user->hasRight("emailing", "creer"));
414 $title = 'none';
415 } elseif ($module == 'ecm') { // DMS/ECM -> manual structure
416 if ($user->hasRight("ecm", "read")) {
417 // Buttons: Preview
418 $useinecm = 2;
419 }
420
421 if ($user->hasRight("ecm", "upload")) {
422 // Buttons: Preview + Delete
423 $useinecm = 4;
424 }
425
426 if ($user->hasRight("ecm", "setup")) {
427 // Buttons: Preview + Delete + Edit
428 $useinecm = 5;
429 }
430
431 $perm = $user->hasRight("ecm", "upload");
432 $modulepart = 'ecm';
433 $title = ''; // Use default
434 } else {
435 $useinecm = 5;
436 $modulepart = 'ecm';
437 $perm = $user->hasRight("ecm", "upload");
438 $title = ''; // Use default
439 }
440
441 // When we show list of files for ECM files, $filearray contains file list, and directory is defined with modulepart + section into $param
442 // When we show list of files for a directory, $filearray ciontains file list, and directory is defined with modulepart + $relativepath
443 //var_dump("section=".$section." title=".$title." modulepart=".$modulepart." useinecm=".$useinecm." perm(permtoeditline)=".$perm." relativepath=".$relativepath." upload_dir=".$upload_dir." param=".$param." url=".$url);
444
445 $formfile->list_of_documents($filearray, null, $modulepart, $param, 1, $relativepath, $perm, $useinecm, $textifempty, $maxlengthname, $title, $url, 0, $perm, $upload_dir, $sortfield, $sortorder);
446 }
447}
448
449
450
451// Bottom of page
452$useajax = 1;
453if (!empty($conf->dol_use_jmobile)) {
454 $useajax = 0;
455}
456if (empty($conf->use_javascript_ajax)) {
457 $useajax = 0;
458}
459if (getDolGlobalString('MAIN_ECM_DISABLE_JS')) {
460 $useajax = 0;
461}
462
463//$param.=($param?'?':'').(preg_replace('/^&/','',$param));
464
465if ($useajax || $action == 'deletefile') {
466 $urlfile = '';
467 if ($action == 'deletefile') {
468 $urlfile = GETPOST('urlfile', 'alpha');
469 }
470
471 if (empty($section_dir)) {
472 $section_dir = GETPOST("file", "alpha");
473 }
474 $section_id = $section;
475
476 require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
477
478 $form = new Form($db);
479 $formquestion = array();
480 $formquestion['urlfile'] = array('type' => 'hidden', 'value' => $urlfile, 'name' => 'urlfile'); // We must always put field, even if empty because it is filled by javascript later
481 $formquestion['section'] = array('type' => 'hidden', 'value' => $section, 'name' => 'section'); // We must always put field, even if empty because it is filled by javascript later
482 $formquestion['section_id'] = array('type' => 'hidden', 'value' => $section_id, 'name' => 'section_id'); // We must always put field, even if empty because it is filled by javascript later
483 $formquestion['section_dir'] = array('type' => 'hidden', 'value' => $section_dir, 'name' => 'section_dir'); // We must always put field, even if empty because it is filled by javascript later
484 $formquestion['sortfield'] = array('type' => 'hidden', 'value' => $sortfield, 'name' => 'sortfield'); // We must always put field, even if empty because it is filled by javascript later
485 $formquestion['sortorder'] = array('type' => 'hidden', 'value' => $sortorder, 'name' => 'sortorder'); // We must always put field, even if empty because it is filled by javascript later
486 if (!empty($action) && $action == 'file_manager') {
487 $formquestion['file_manager'] = array('type' => 'hidden', 'value' => 1, 'name' => 'file_manager');
488 }
489 if (!empty($websitekey)) {
490 $formquestion['website'] = array('type' => 'hidden', 'value' => $websitekey, 'name' => 'website');
491 }
492 if (!empty($pageid) && $pageid > 0) {
493 $formquestion['pageid'] = array('type' => 'hidden', 'value' => $pageid, 'name' => 'pageid');
494 }
495
496 print $form->formconfirm($url, $langs->trans("DeleteFile"), $langs->trans("ConfirmDeleteFile"), 'confirm_deletefile', $formquestion, "no", ($useajax ? 'deletefile' : 0));
497}
498
499if ($useajax) {
500 print '<!-- ajaxdirpreview.php: js to manage preview of doc -->'."\n";
501 print '<script nonce="'.getNonce().'" type="text/javascript">';
502
503 // Enable jquery handlers on new generated HTML objects (same code than into lib_footer.js.php)
504 // Because the content is reloaded by ajax call, we must also redefine/reenable some jquery hooks.
505
506 // Handler to manage document_preview on click on a .documentpreview css class.
507 if ($conf->browser->layout != 'phone') {
508 print "\n/* JS CODE TO ENABLE document_preview */\n";
509 print '
510 jQuery(document).ready(function () {
511 jQuery(".documentpreview").click(function () {
512 console.log("We click on preview for element with href="+$(this).attr(\'href\')+" mime="+$(this).attr(\'mime\'));
513 var titledocpreview = $(this).attr(\'data-title\');
514 if (titledocpreview == undefined || titledocpreview == "") {
515 titledocpreview = \''.dol_escape_js($langs->transnoentities("Preview")).'\'
516 }
517 document_preview($(this).attr(\'href\'), $(this).attr(\'mime\'), titledocpreview);
518 return false;
519 });
520 });
521 ' . "\n";
522 }
523
524 // Enable jquery handlers button to delete files
525 print 'jQuery(document).ready(function() {'."\n";
526 print ' jQuery(".deletefilelink").click(function(e) { '."\n";
527 print ' console.log("We click on button with class deletefilelink, param='.$param.', we set urlfile to "+jQuery(this).attr("rel"));'."\n";
528 print ' jQuery("#urlfile").val(jQuery(this).attr("rel"));'."\n";
529 //print ' jQuery("#section_dir").val(\'aaa\');'."\n";
530 print ' jQuery("#dialog-confirm-deletefile").dialog("open");'."\n";
531 print ' return false;'."\n";
532 print ' });'."\n";
533 print '});'."\n";
534 print '</script>'."\n";
535}
536
537// Close db if mode is not noajax
538if ((!isset($mode) || $mode != 'noajax') && is_object($db)) {
539 $db->close();
540}
Class to manage ECM directories.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
document_preview(file, type, title)
Function to show a document preview popup.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
Definition files.lib.php:64
dol_is_dir($folder)
Test if filename is a directory.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.