24if (!defined(
'NOLOGIN')) {
 
   27if (!defined(
'NOCSRFCHECK')) {
 
   28  define(
"NOCSRFCHECK", 1); 
 
   30if (!defined(
'NOIPCHECK')) {
 
   31  define(
'NOIPCHECK', 
'1'); 
 
   33if (!defined(
'NOBROWSERNOTIF')) {
 
   34  define(
'NOBROWSERNOTIF', 
'1');
 
   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';
 
   44$langs->loadLangs(array(
"companies", 
"other", 
"recruitment"));
 
   47$action   = 
GETPOST(
'action', 
'aZ09');
 
   49$cancel   = 
GETPOST(
'cancel', 
'alpha');
 
   53$securekey = 
GETPOST(
'securekey', 
'alpha');
 
   56$object = 
new User($db);
 
   57$object->fetch($id, 
'', 
'', 1);
 
   62$urlwithroot = DOL_MAIN_URL_ROOT; 
 
   66$encodedsecurekey = 
dol_hash($conf->file->instance_unique_id.
'uservirtualcard'.$object->id.
'-'.$object->login, 
'md5');
 
   67if ($encodedsecurekey != $securekey) {
 
   81  if (!empty($backtopage)) {
 
   82    header(
"Location: ".$backtopage);
 
   98$modulepart = 
'userphotopublic';
 
   99$dir = $conf->user->dir_output;
 
  105if (!empty($object->photo)) {
 
  108    $logo = 
get_exdir(0, 0, 0, 0, $object, 
'user').
'photos/'.$object->photo;
 
  116if (!empty($logosmall) && is_readable($dir.
'/'.$logosmall)) {
 
  117  $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart='.$modulepart.($conf->entity > 1 ? 
'&entity='.$conf->entity : 
'').
'&securekey='.urlencode($securekey).
'&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 ? 
'&entity='.$conf->entity : 
'').
'&securekey='.urlencode($securekey).
'&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);
 
  131if (
getDolUserInt(
'USER_PUBLIC_HIDE_JOBPOSITION', 0, $object)) {
 
  140if (
getDolUserInt(
'USER_PUBLIC_HIDE_OFFICE_PHONE', 0, $object)) {
 
  141  $object->office_phone = 
'';
 
  143if (
getDolUserInt(
'USER_PUBLIC_HIDE_OFFICE_FAX', 0, $object)) {
 
  144  $object->office_fax = 
'';
 
  146if (
getDolUserInt(
'USER_PUBLIC_HIDE_USER_MOBILE', 0, $object)) {
 
  147  $object->user_mobile = 
'';
 
  149if (
getDolUserInt(
'USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object)) {
 
  150  $object->socialnetworks = 
'';
 
  154  $object->birth = 
null;
 
  157  $object->address = 
'';
 
  161  $object->country = 
'';
 
  169if ($mode == 
'vcard') {
 
  171  $output = $v->buildVCardString($object, $company, $langs, $urllogofull);
 
  173  $filename = trim(urldecode($v->getFileName())); 
 
  179  header(
"Content-Disposition: attachment; filename=\"".$filename.
"\"");
 
  180  header(
"Content-Length: ".
dol_strlen($output));
 
  181  header(
"Connection: close");
 
  192  $head = 
'<link rel="stylesheet" type="text/css" href="' . 
getDolGlobalString(
'MAIN_USER_PROFILE_CSS_URL').
'?lang='.$langs->defaultlang.
'">'.
"\n";
 
  195$conf->dol_hide_topmenu = 1;
 
  196$conf->dol_hide_leftmenu = 1;
 
  199  $langs->load(
"errors");
 
  200  print 
'<div class="error">'.$langs->trans(
'ErrorPublicInterfaceNotEnabled').
'</div>';
 
  206$arrayofcss = array();
 
  208$replacemainarea = (empty($conf->dol_hide_leftmenu) ? 
'<div>' : 
'').
'<div>';
 
  209llxHeader($head, $object->getFullName($langs).
' - '.$langs->trans(
"PublicVirtualCard"), 
'', 
'', 0, 0, 
'', 
'', 
'', 
'onlinepaymentbody'.(GETPOST(
'mode')==
'preview' ? 
' scalepreview cursorpointer virtualcardpreview' : 
''), $replacemainarea, 1, 1);
 
  213@media (prefers-color-scheme: dark) { 
  215    background-color: #CCC !important; 
  221print 
'<span id="dolpaymentspan"></span>'.
"\n";
 
  222print 
'<div class="center">'.
"\n";
 
  224print 
'<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
 
  225print 
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
 
  226print 
'<input type="hidden" name="action" value="dosubmit">'.
"\n";
 
  227print 
'<input type="hidden" name="securekey" value="'.$securekey.
'">'.
"\n";
 
  228print 
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
 
  232print 
'<div class="backgreypublicpayment">';
 
  233print 
'<div class="logopublicpayment">';
 
  236print 
'<div class="double colortext">'.$object->getFullName($langs).
'</div>';
 
  238if ($object->job && !
getDolUserInt(
'USER_PUBLIC_HIDE_JOBPOSITION', 0, $object)) {
 
  239  print 
'<div class="">';
 
  244  print 
'<div class="bold">';
 
  259  print 
'<div class="backimagepublicrecruitment">';
 
  260  print 
'<img id="idUSER_IMAGE_PUBLIC_INTERFACE" src="' . 
getDolGlobalString(
'USER_IMAGE_PUBLIC_INTERFACE').
'">';
 
  264$urlforqrcode = $object->getOnlineVirtualCardUrl(
'vcard');
 
  271$showbarcode = 
GETPOST(
'nobarcode') ? 0 : 1;
 
  273  $qrcodecontent = $output = $v->buildVCardString($object, $company, $langs);
 
  276  print 
'<div class="floatleft inline-block valignmiddle paddingleft paddingright">';
 
  277  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).
'">';
 
  288if ($object->email && !
getDolUserInt(
'USER_PUBLIC_HIDE_EMAIL', 0, $object)) {
 
  289  $usersection .= 
'<div class="flexitemsmall">';
 
  291  $usersection .= 
'</div>';
 
  295if ($object->url && !
getDolUserInt(
'USER_PUBLIC_HIDE_URL', 0, $object)) {
 
  296  $usersection .= 
'<div class="flexitemsmall">';
 
  297  $usersection .= 
img_picto(
'', 
'globe', 
'class="pictofixedwidth"');
 
  298  $usersection .= 
dol_print_url($object->url, 
'_blank', 0, 0, 
'');
 
  299  $usersection .= 
'</div>';
 
  303if ($object->office_phone && !
getDolUserInt(
'USER_PUBLIC_HIDE_OFFICE_PHONE', 0, $object)) {
 
  304  $usersection .= 
'<div class="flexitemsmall">';
 
  305  $usersection .= 
img_picto(
'', 
'phone', 
'class="pictofixedwidth"');
 
  306  $usersection .= 
dol_print_phone($object->office_phone, $object->country_code, 0, $mysoc->id, 
'tel', 
' ', 0, 
'');
 
  307  $usersection .= 
'</div>';
 
  309if ($object->office_fax && !
getDolUserInt(
'USER_PUBLIC_HIDE_OFFICE_FAX', 0, $object)) {
 
  310  $usersection .= 
'<div class="flexitemsmall">';
 
  311  $usersection .= 
img_picto(
'', 
'phoning_fax', 
'class="pictofixedwidth"');
 
  312  $usersection .= 
dol_print_phone($object->office_fax, $object->country_code, 0, $mysoc->id, 
'fax', 
' ', 0, 
'');
 
  313  $usersection .= 
'</div>';
 
  315if ($object->user_mobile && !
getDolUserInt(
'USER_PUBLIC_HIDE_USER_MOBILE', 0, $object)) {
 
  316  $usersection .= 
'<div class="flexitemsmall">';
 
  317  $usersection .= 
img_picto(
'', 
'phone', 
'class="pictofixedwidth"');
 
  318  $usersection .= 
dol_print_phone($object->user_mobile, $object->country_code, 0, $mysoc->id, 
'tel', 
' ', 0, 
'');
 
  319  $usersection .= 
'</div>';
 
  321if (
getDolUserInt(
'USER_PUBLIC_SHOW_BIRTH', 0, $object) && !is_null($object->birth)) {
 
  322  $usersection .= 
'<div class="flexitemsmall">';
 
  323  $usersection .= 
img_picto(
'', 
'calendar', 
'class="pictofixedwidth"');
 
  325  $usersection .= 
'</div>';
 
  327if (
getDolUserInt(
'USER_PUBLIC_SHOW_ADDRESS', 0, $object) && $object->address) {
 
  328  $usersection .= 
'<div class="flexitemsmall">';
 
  329  $usersection .= 
img_picto(
'', 
'state', 
'class="pictofixedwidth"');
 
  331  $usersection .= 
'</div>';
 
  335if (!empty($object->socialnetworks) && is_array($object->socialnetworks) && count($object->socialnetworks) > 0) {
 
  336  if (!
getDolUserInt(
'USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object)) {
 
  337    foreach ($object->socialnetworks as $key => $value) {
 
  339        $usersection .= 
'<div class="flexitemsmall">'.dol_print_socialnetworks($value, 0, $mysoc->id, $key, $socialnetworksdict).
'</div>';
 
  348    print 
'<img class="userphotopublicvcard" id="dolpaymentlogo" src="'.$urllogofull.
'">';
 
  351  print 
'<table id="dolpaymenttable" summary="Job position offer" class="center">'.
"\n";
 
  354  print 
'<tr><td class="left">';
 
  356  print 
'<div class="nowidthimp nopaddingtoponsmartphone" id="tablepublicpayment">';
 
  363  print 
'</td></tr>'.
"\n";
 
  365  print 
'</table>'.
"\n";
 
  369    print 
'<br><center><img class="userphotopublicvcard" style="position: unset !important;" id="dolpaymentlogo" src="'.$urllogofull.
'"></center>';
 
  375  $companysection = 
'';
 
  378    $companysection .= 
'<div class="flexitemsmall">';
 
  379    $companysection .= 
img_picto(
'', 
'email', 
'class="pictofixedwidth"');
 
  381    $companysection .= 
'</div>';
 
  385    $companysection .= 
'<div class="flexitemsmall">';
 
  386    $companysection .= 
img_picto(
'', 
'globe', 
'class="pictofixedwidth"');
 
  387    $companysection .= 
dol_print_url($mysoc->url, 
'_blank', 0, 0, 
'');
 
  388    $companysection .= 
'</div>';
 
  392    $companysection .= 
'<div class="flexitemsmall">';
 
  393    $companysection .= 
img_picto(
'', 
'phone', 
'class="pictofixedwidth"');
 
  394    $companysection .= 
dol_print_phone($mysoc->phone, $mysoc->country_code, 0, $mysoc->id, 
'tel', 
' ', 0, 
'');
 
  395    $companysection .= 
'</div>';
 
  398    $companysection .= 
'<div class="flexitemsmall">';
 
  399    $companysection .= 
img_picto(
'', 
'phoning_fax', 
'class="pictofixedwidth"');
 
  400    $companysection .= 
dol_print_phone($mysoc->fax, $mysoc->country_code, 0, $mysoc->id, 
'fax', 
' ', 0, 
'');
 
  401    $companysection .= 
'</div>';
 
  405  if (!empty($mysoc->socialnetworks) && is_array($mysoc->socialnetworks) && count($mysoc->socialnetworks) > 0) {
 
  406    foreach ($mysoc->socialnetworks as $key => $value) {
 
  408        $companysection .= 
'<div class="flexitemsmall">'.dol_print_socialnetworks($value, 0, $mysoc->id, $key, $socialnetworksdict).
'</div>';
 
  415  $logosmall = $mysoc->logo_squarred_small ? $mysoc->logo_squarred_small : $mysoc->logo_small;
 
  416  $logo = $mysoc->logo_squarred ? $mysoc->logo_squarred : $mysoc->logo;
 
  417  $paramlogo = 
'ONLINE_USER_LOGO_'.$suffix;
 
  427  if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.
'/logos/thumbs/'.$logosmall)) {
 
  428    $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany'.($conf->entity > 1 ? 
'&entity='.$conf->entity : 
'').
'&file='.urlencode(
'logos/thumbs/'.$logosmall);
 
  429    $urllogofull = $dolibarr_main_url_root.
'/viewimage.php?modulepart=mycompany'.($conf->entity > 1 ? 
'&entity='.$conf->entity : 
'').
'&file='.urlencode(
'logos/thumbs/'.$logosmall);
 
  430  } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.
'/logos/'.$logo)) {
 
  431    $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany'.($conf->entity > 1 ? 
'&entity='.$conf->entity : 
'').
'&file='.urlencode(
'logos/'.$logo);
 
  432    $urllogofull = $dolibarr_main_url_root.
'/viewimage.php?modulepart=mycompany'.($conf->entity > 1 ? 
'&entity='.$conf->entity : 
'').
'&file='.urlencode(
'logos/'.$logo);
 
  436    print 
'<div class="logopublicpayment center">';
 
  437    if (!empty($mysoc->url)) {
 
  438      print 
'<a href="'.$mysoc->url.
'" target="_blank" rel="noopener">';
 
  440    print 
'<img class="userphotopublicvcard" id="dolpaymentlogo" src="'.$urllogofull.
'">';
 
  441    if (!empty($mysoc->url)) {
 
  446  print 
'<table id="dolpaymenttable" summary="Job position offer" class="center">'.
"\n";
 
  449  print 
'<tr><td class="left">';
 
  451  print 
'<div class="nowidthimp nopaddingtoponsmartphone" id="tablepublicpayment">';
 
  455    print 
'<div class="center bold">';
 
  461  print $companysection;
 
  466  print 
'</td></tr>'.
"\n";
 
  468  print 
'</table>'.
"\n";
 
  482print 
'<div class="backgreypublicpayment">';
 
  483print 
'<div class="center">';
 
  484print 
'<a href="'.$urlforqrcode.
'">';
 
  486print 
img_picto($langs->trans(
"Download").
' VCF', 
'add').
' ';
 
  487print $langs->trans(
"Download").
' VCF';
 
  494$fullexternaleurltovirtualcard = $object->getOnlineVirtualCardUrl(
'', 
'external');
 
  495$fullinternalurltovirtualcard = $object->getOnlineVirtualCardUrl(
'', 
'internal');
 
  498print 
'jQuery(document).ready(function() { 
  499  jQuery(".virtualcardpreview").click(function(event) { 
  500    event.preventDefault(); 
  501    console.log("We click on the card"); 
  502    window.open("'.$fullexternaleurltovirtualcard.
'"); 
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage Dolibarr users.
Class to buld vCard files.
getDolUserInt($key, $default=0, $tmpuser=null)
Return Dolibarr user constant int value.
dol_format_address($object, $withcountry=0, $sep="\n", $outputlangs='', $mode=0, $extralangcode='')
Return a formated address (part address/zip/town/state) according to country rules.
dol_print_url($url, $target='_blank', $max=32, $withpicto=0, $morecss='')
Show Url link.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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=" ", $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_address($address, $htmlid, $element, $id, $noprint=0, $charfornl='')
Format address string.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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', $nosalt=0)
Returns a hash (non reversible encryption) of a string.