dolibarr 18.0.6
view.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2020-2022 Laurent Destailleur <eldy@users.sourceforge.net>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
24if (!defined('NOLOGIN')) {
25 define("NOLOGIN", 1); // This means this output page does not require to be logged.
26}
27if (!defined('NOCSRFCHECK')) {
28 define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
29}
30if (!defined('NOIPCHECK')) {
31 define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
32}
33if (!defined('NOBROWSERNOTIF')) {
34 define('NOBROWSERNOTIF', '1');
35}
36
37// Load Dolibarr environment
38require '../../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
40require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
41require_once DOL_DOCUMENT_ROOT.'/core/class/vcard.class.php';
42
43// Load translation files required by the page
44$langs->loadLangs(array("companies", "other", "recruitment"));
45
46// Get parameters
47$action = GETPOST('action', 'aZ09');
48$mode = GETPOST('mode', 'aZ09');
49$cancel = GETPOST('cancel', 'alpha');
50$backtopage = '';
51
52$id = GETPOST('id', 'int');
53$securekey = GETPOST('securekey', 'alpha');
54$suffix = GETPOST('suffix');
55
56$object = new User($db);
57$object->fetch($id, '', '', 1);
58
59// Define $urlwithroot
60//$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
61//$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
62$urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost.
63
64// Security check
65global $conf;
66$encodedsecurekey = dol_hash($conf->file->instance_unique_id.'uservirtualcard'.$object->id.'-'.$object->login, 'md5');
67if ($encodedsecurekey != $securekey) {
68 httponly_accessforbidden('Bad value for securitykey or public profile not enabled');
69}
70
71if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) {
72 httponly_accessforbidden('Bad value for securitykey or public profile not enabled');
73}
74
75
76/*
77 * Actions
78 */
79
80if ($cancel) {
81 if (!empty($backtopage)) {
82 header("Location: ".$backtopage);
83 exit;
84 }
85 $action = 'view';
86}
87
88
89/*
90 * View
91 */
92
93$form = new Form($db);
94$v = new vCard();
95
96$company = $mysoc;
97
98$modulepart = 'userphotopublic';
99$dir = $conf->user->dir_output;
100
101// Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo)
102// Define logo and logosmall
103$logo = '';
104$logosmall = '';
105if (!empty($object->photo)) {
106 if (dolIsAllowedForPreview($object->photo)) {
107 $logosmall = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small');
108 $logo = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;
109 //$originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;
110 }
111}
112//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
113// Define urllogo
114$urllogo = '';
115$urllogofull = '';
116if (!empty($logosmall) && is_readable($dir.'/'.$logosmall)) {
117 $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.($conf->entity > 1 ? '&amp;entity='.$conf->entity : '').'&amp;securekey='.urlencode($securekey).'&amp;file='.urlencode($logosmall);
118 $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&securekey='.urlencode($securekey).'&file='.urlencode($logosmall);
119} elseif (!empty($logo) && is_readable($dir.'/'.$logo)) {
120 $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.($conf->entity > 1 ? '&amp;entity='.$conf->entity : '').'&amp;securekey='.urlencode($securekey).'&amp;file='.urlencode($logo);
121 $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&securekey='.urlencode($securekey).'&file='.urlencode($logo);
122}
123
124// Clean data we don't want on public page
125if (getDolUserInt('USER_PUBLIC_HIDE_PHOTO', 0, $object)) {
126 $logo = '';
127 $logosmall = '';
128 $urllogo = '';
129 $urllogofull = '';
130}
131if (getDolUserInt('USER_PUBLIC_HIDE_JOBPOSITION', 0, $object)) {
132 $object->job = '';
133}
134if (getDolUserInt('USER_PUBLIC_HIDE_EMAIL', 0, $object)) {
135 $object->email = '';
136}
137if (getDolUserInt('USER_PUBLIC_HIDE_EMAIL', 0, $object)) {
138 $object->job = '';
139}
140if (getDolUserInt('USER_PUBLIC_HIDE_OFFICE_PHONE', 0, $object)) {
141 $object->office_phone = '';
142}
143if (getDolUserInt('USER_PUBLIC_HIDE_OFFICE_FAX', 0, $object)) {
144 $object->office_fax = '';
145}
146if (getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object)) {
147 $object->user_mobile = '';
148}
149if (getDolUserInt('USER_PUBLIC_HIDE_BIRTH', 0, $object)) {
150 $object->birth = '';
151}
152if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object)) {
153 $object->socialnetworks = '';
154}
155if (getDolUserInt('USER_PUBLIC_HIDE_ADDRESS', 0, $object)) {
156 $object->address = '';
157 $object->town = '';
158 $object->zip = '';
159 $object->state = '';
160 $object->country = '';
161}
162if (getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) {
163 $company = null;
164}
165
166
167// Output vcard
168if ($mode == 'vcard') {
169 // We create VCard
170 $output = $v->buildVCardString($object, $company, $langs, $urllogofull);
171
172 $filename = trim(urldecode($v->getFileName())); // "Nom prenom.vcf"
173 $filenameurlencoded = dol_sanitizeFileName(urlencode($filename));
174 //$filename = dol_sanitizeFileName($filename);
175
176 top_httphead('text/vcard; name="'.$filename.'"');
177
178 header("Content-Disposition: attachment; filename=\"".$filename."\"");
179 header("Content-Length: ".dol_strlen($output));
180 header("Connection: close");
181
182 print $output;
183
184 $db->close();
185
186 exit;
187}
188
189$head = '';
190if (!empty($conf->global->MAIN_USER_PROFILE_CSS_URL)) {
191 $head = '<link rel="stylesheet" type="text/css" href="'.$conf->global->MAIN_USER_PROFILE_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
192}
193
194$conf->dol_hide_topmenu = 1;
195$conf->dol_hide_leftmenu = 1;
196
197if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) {
198 $langs->load("errors");
199 print '<div class="error">'.$langs->trans('ErrorPublicInterfaceNotEnabled').'</div>';
200 $db->close();
201 exit();
202}
203
204$arrayofjs = array();
205$arrayofcss = array();
206
207$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '<div>' : '').'<div>';
208llxHeader($head, $object->getFullName($langs).' - '.$langs->trans("PublicVirtualCard"), '', '', 0, 0, '', '', '', 'onlinepaymentbody'.(GETPOST('mode')=='preview' ? ' scalepreview cursorpointer virtualcardpreview' : ''), $replacemainarea, 1, 1);
209
210print '
211<style>
212@media (prefers-color-scheme: dark) {
213 form {
214 background-color: #CCC !important;
215 }
216}
217</style>
218';
219
220print '<span id="dolpaymentspan"></span>'."\n";
221print '<div class="center">'."\n";
222
223print '<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
224print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
225print '<input type="hidden" name="action" value="dosubmit">'."\n";
226print '<input type="hidden" name="securekey" value="'.$securekey.'">'."\n";
227print '<input type="hidden" name="entity" value="'.$entity.'" />';
228print "\n";
229
230// Output html code for logo
231print '<div class="backgreypublicpayment">';
232print '<div class="logopublicpayment">';
233
234// Name
235print '<div class="double colortext">'.$object->getFullName($langs).'</div>';
236// User position
237if ($object->job && !getDolUserInt('USER_PUBLIC_HIDE_JOBPOSITION', 0, $object)) {
238 print '<div class="">';
239 print dol_escape_htmltag($object->job);
240 print '</div>';
241}
242if (!getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) {
243 print '<div class="bold">';
244 print dol_escape_htmltag($mysoc->name);
245 print '</div>';
246}
247
248
249
250print '</div>';
251/*if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
252 print '<div class="poweredbypublicpayment opacitymedium right"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">'.$langs->trans("PoweredBy").'<br><img class="poweredbyimg" src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.svg" width="80px"></a></div>';
253}*/
254print '</div>';
255
256
257if (!empty($conf->global->USER_IMAGE_PUBLIC_INTERFACE)) {
258 print '<div class="backimagepublicrecruitment">';
259 print '<img id="idUSER_IMAGE_PUBLIC_INTERFACE" src="'.$conf->global->USER_IMAGE_PUBLIC_INTERFACE.'">';
260 print '</div>';
261}
262
263$urlforqrcode = $object->getOnlineVirtualCardUrl('vcard');
264
265$socialnetworksdict = getArrayOfSocialNetworks();
266
267
268
269// Show barcode
270$showbarcode = GETPOST('nobarcode') ? 0 : 1;
271if ($showbarcode) {
272 $qrcodecontent = $output = $v->buildVCardString($object, $company, $langs);
273
274 print '<br>';
275 print '<div class="floatleft inline-block valignmiddle paddingleft paddingright">';
276 print '<img style="max-width: 100%" src="'.$dolibarr_main_url_root.'/viewimage.php?modulepart=barcode&entity='.((int) $conf->entity).'&generator=tcpdfbarcode&encoding=QRCODE&code='.urlencode($qrcodecontent).'">';
277 print '</div>';
278 print '<br>';
279}
280
281
282// Me section
283
284$usersection = '';
285
286// User email
287if ($object->email && !getDolUserInt('USER_PUBLIC_HIDE_EMAIL', 0, $object)) {
288 $usersection .= '<div class="flexitemsmall">';
289 $usersection .= dol_print_email($object->email, 0, 0, 1, 0, 1, 1);
290 $usersection .= '</div>';
291}
292
293// User url
294if ($object->url && !getDolUserInt('USER_PUBLIC_HIDE_URL', 0, $object)) {
295 $usersection .= '<div class="flexitemsmall">';
296 $usersection .= img_picto('', 'globe', 'class="pictofixedwidth"');
297 $usersection .= dol_print_url($object->url, '_blank', 0, 0, '');
298 $usersection .= '</div>';
299}
300
301// User phone
302if ($object->office_phone && !getDolUserInt('USER_PUBLIC_HIDE_OFFICE_PHONE', 0, $object)) {
303 $usersection .= '<div class="flexitemsmall">';
304 $usersection .= img_picto('', 'phone', 'class="pictofixedwidth"');
305 $usersection .= dol_print_phone($object->office_phone, $object->country_code, 0, $mysoc->id, 'tel', ' ', 0, '');
306 $usersection .= '</div>';
307}
308if ($object->office_fax && !getDolUserInt('USER_PUBLIC_HIDE_OFFICE_FAX', 0, $object)) {
309 $usersection .= '<div class="flexitemsmall">';
310 $usersection .= img_picto('', 'phoning_fax', 'class="pictofixedwidth"');
311 $usersection .= dol_print_phone($object->office_fax, $object->country_code, 0, $mysoc->id, 'fax', ' ', 0, '');
312 $usersection .= '</div>';
313}
314if ($object->user_mobile && !getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object)) {
315 $usersection .= '<div class="flexitemsmall">';
316 $usersection .= img_picto('', 'phone', 'class="pictofixedwidth"');
317 $usersection .= dol_print_phone($object->user_mobile, $object->country_code, 0, $mysoc->id, 'tel', ' ', 0, '');
318 $usersection .= '</div>';
319}
320
321// Social networks
322if (!empty($object->socialnetworks) && is_array($object->socialnetworks) && count($object->socialnetworks) > 0) {
323 if (!getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object)) {
324 foreach ($object->socialnetworks as $key => $value) {
325 if ($value) {
326 $usersection .= '<div class="flexitemsmall">'.dol_print_socialnetworks($value, 0, $mysoc->id, $key, $socialnetworksdict).'</div>';
327 }
328 }
329 }
330}
331
332if ($usersection) {
333 // Show photo
334 if ($urllogo) {
335 print '<img class="userphotopublicvcard" id="dolpaymentlogo" src="'.$urllogofull.'">';
336 }
337
338 print '<table id="dolpaymenttable" summary="Job position offer" class="center">'."\n";
339
340 // Output payment summary form
341 print '<tr><td class="left">';
342
343 print '<div class="nowidthimp nopaddingtoponsmartphone" id="tablepublicpayment">';
344
345 print $usersection;
346
347 print '</div>'."\n";
348 print "\n";
349
350 print '</td></tr>'."\n";
351
352 print '</table>'."\n";
353} else {
354 // Show photo
355 if ($urllogo) {
356 print '<br><center><img class="userphotopublicvcard" style="position: unset !important;" id="dolpaymentlogo" src="'.$urllogofull.'"></center>';
357 }
358}
359
360
361if (!getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) {
362 $companysection = '';
363
364 if ($mysoc->email) {
365 $companysection .= '<div class="flexitemsmall">';
366 $companysection .= img_picto('', 'email', 'class="pictofixedwidth"');
367 $companysection .= dol_print_email($mysoc->email, 0, 0, 1);
368 $companysection .= '</div>';
369 }
370
371 if ($mysoc->url) {
372 $companysection .= '<div class="flexitemsmall">';
373 $companysection .= img_picto('', 'globe', 'class="pictofixedwidth"');
374 $companysection .= dol_print_url($mysoc->url, '_blank', 0, 0, '');
375 $companysection .= '</div>';
376 }
377
378 if ($mysoc->phone) {
379 $companysection .= '<div class="flexitemsmall">';
380 $companysection .= img_picto('', 'phone', 'class="pictofixedwidth"');
381 $companysection .= dol_print_phone($mysoc->phone, $mysoc->country_code, 0, $mysoc->id, 'tel', ' ', 0, '');
382 $companysection .= '</div>';
383 }
384 if ($mysoc->fax) {
385 $companysection .= '<div class="flexitemsmall">';
386 $companysection .= img_picto('', 'phoning_fax', 'class="pictofixedwidth"');
387 $companysection .= dol_print_phone($mysoc->fax, $mysoc->country_code, 0, $mysoc->id, 'fax', ' ', 0, '');
388 $companysection .= '</div>';
389 }
390
391 // Social networks
392 if (!empty($mysoc->socialnetworks) && is_array($mysoc->socialnetworks) && count($mysoc->socialnetworks) > 0) {
393 foreach ($mysoc->socialnetworks as $key => $value) {
394 if ($value) {
395 $companysection .= '<div class="flexitemsmall">'.dol_print_socialnetworks($value, 0, $mysoc->id, $key, $socialnetworksdict).'</div>';
396 }
397 }
398 }
399
400 // Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo)
401 // Define logo and logosmall
402 $logosmall = $mysoc->logo_squarred_small ? $mysoc->logo_squarred_small : $mysoc->logo_small;
403 $logo = $mysoc->logo_squarred ? $mysoc->logo_squarred : $mysoc->logo;
404 $paramlogo = 'ONLINE_USER_LOGO_'.$suffix;
405 if (!empty($conf->global->$paramlogo)) {
406 $logosmall = $conf->global->$paramlogo;
407 } elseif (!empty($conf->global->ONLINE_USER_LOGO)) {
408 $logosmall = $conf->global->ONLINE_USER_LOGO;
409 }
410 //print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
411 // Define urllogo
412 $urllogo = '';
413 $urllogofull = '';
414 if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) {
415 $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany'.($conf->entity > 1 ? '&amp;entity='.$conf->entity : '').'&amp;file='.urlencode('logos/thumbs/'.$logosmall);
416 $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany'.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&file='.urlencode('logos/thumbs/'.$logosmall);
417 } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) {
418 $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany'.($conf->entity > 1 ? '&amp;entity='.$conf->entity : '').'&amp;file='.urlencode('logos/'.$logo);
419 $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany'.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&file='.urlencode('logos/'.$logo);
420 }
421 // Output html code for logo
422 if ($urllogo) {
423 print '<div class="logopublicpayment center">';
424 if (!empty($mysoc->url)) {
425 print '<a href="'.$mysoc->url.'" target="_blank" rel="noopener">';
426 }
427 print '<img class="userphotopublicvcard" id="dolpaymentlogo" src="'.$urllogofull.'">';
428 if (!empty($mysoc->url)) {
429 print '</a>';
430 }
431 print '</div>';
432 }
433 print '<table id="dolpaymenttable" summary="Job position offer" class="center">'."\n";
434
435 // Output payment summary form
436 print '<tr><td class="left">';
437
438 print '<div class="nowidthimp nopaddingtoponsmartphone" id="tablepublicpayment">';
439
440 // Add company info
441 if ($mysoc->name) {
442 print '<div class="center bold">';
443 print dol_escape_htmltag($mysoc->name);
444 print '</div>';
445 print '<br>';
446 }
447
448 print $companysection;
449
450 print '</div>'."\n";
451 print "\n";
452
453 print '</td></tr>'."\n";
454
455 print '</table>'."\n";
456}
457
458
459// Description
460$text = getDolUserString('USER_PUBLIC_MORE', '', $object);
461print $text;
462
463
464print '</form>'."\n";
465print '</div>'."\n";
466print '<br>';
467
468
469print '<div class="backgreypublicpayment">';
470print '<div class="center">';
471print '<a href="'.$urlforqrcode.'">';
472// Download / AddToContacts
473print img_picto($langs->trans("Download").' VCF', 'add').' ';
474print $langs->trans("Download").' VCF';
475print '</a>';
476print '</div>';
477//print '<div>';
478//print '</div>';
479print '</div>';
480
481$fullexternaleurltovirtualcard = $object->getOnlineVirtualCardUrl('', 'external');
482$fullinternalurltovirtualcard = $object->getOnlineVirtualCardUrl('', 'internal');
483
484print '<script>';
485print 'jQuery(document).ready(function() {
486 jQuery(".virtualcardpreview").click(function(event) {
487 event.preventDefault();
488 console.log("We click on the card");
489 window.open("'.$fullexternaleurltovirtualcard.'");
490 });
491});';
492print '</script>';
493
494llxFooter('', 'public');
495
496$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:56
llxFooter()
Empty footer.
Definition wrapper.php:70
Class to manage generation of HTML components Only common components must be here.
Class to manage Dolibarr users.
Class to buld vCard files.
getDolUserInt($key, $default=0, $tmpuser=null)
Return Dolibarr user constant int value.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolUserString($key, $default='', $tmpuser=null)
Return Dolibarr user constant string value.
dol_print_email($email, $cid=0, $socid=0, $addlink=0, $max=64, $showinvalid=1, $withpicto=0)
Show EMail link formatted for HTML output.
dol_print_phone($phone, $countrycode='', $cid=0, $socid=0, $addlink='', $separ="&nbsp;", $withpicto='', $titlealt='', $adddivfloat=0)
Format phone numbers according to country.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
getImageFileNameForSize($file, $extName, $extImgTarget='')
Return the filename of file to get the thumbs.
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dolIsAllowedForPreview($file)
Return if a file is qualified for preview.
dol_print_url($url, $target='_blank', $max=32, $withpicto=0, $morecss='float')
Show Url link.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
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.
httponly_accessforbidden($message=1, $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.
dol_hash($chain, $type='0')
Returns a hash (non reversible encryption) of a string.