Fix virtual card feature

This commit is contained in:
Laurent Destailleur 2023-01-07 12:36:53 +01:00
parent 93f5c69b1c
commit 75d9793145
11 changed files with 286 additions and 226 deletions

View File

@ -1731,11 +1731,13 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
* @param string $url Relative Url to open. For example '/project/card.php' * @param string $url Relative Url to open. For example '/project/card.php'
* @param string $disabled Disabled text * @param string $disabled Disabled text
* @param string $morecss More CSS * @param string $morecss More CSS
* @param string $jsonopen Some JS code to execute on click/open of popup
* @param string $backtopagejsfields The back to page must be managed using javascript instead of a redirect. * @param string $backtopagejsfields The back to page must be managed using javascript instead of a redirect.
* Value is 'keyforpopupid:Name_of_html_component_to_set_with id,Name_of_html_component_to_set_with_label' * Value is 'keyforpopupid:Name_of_html_component_to_set_with id,Name_of_html_component_to_set_with_label'
* @param string $accesskey A key to use shortcut
* @return string HTML component with button * @return string HTML component with button
*/ */
function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled = '', $morecss = 'classlink button bordertransp', $backtopagejsfields = '') function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled = '', $morecss = 'classlink button bordertransp', $jsonopen = '', $backtopagejsfields = '', $accesskey = '')
{ {
global $conf; global $conf;
@ -1763,9 +1765,11 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di
//print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="file_manager">'; //print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="file_manager">';
$out .= '<!-- a link for button to open url into a dialog popup with backtopagejsfields = '.$backtopagejsfields.' -->'; $out .= '<!-- a link for button to open url into a dialog popup with backtopagejsfields = '.$backtopagejsfields.' -->';
$out .= '<a class="cursorpointer button_'.$name.($morecss ? ' '.$morecss : '').'"'.$disabled.' title="'.dol_escape_htmltag($label).'"'; $out .= '<a '.($accesskey ? ' accesskey="'.$accesskey.'"' : '').' class="cursorpointer button_'.$name.($morecss ? ' '.$morecss : '').'"'.$disabled.' title="'.dol_escape_htmltag($label).'"';
if (empty($conf->use_javascript_ajax)) { if (empty($conf->use_javascript_ajax)) {
$out .= ' href="'.DOL_URL_ROOT.$url.'" target="_blank"'; $out .= ' href="'.DOL_URL_ROOT.$url.'" target="_blank"';
} elseif ($jsonopen) {
$out .= ' onclick="javascript:'.$jsonopen.'"';
} }
$out .= '>'.$buttonstring.'</a>'; $out .= '>'.$buttonstring.'</a>';
@ -2324,7 +2328,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
// Add alias for thirdparty // Add alias for thirdparty
if (!empty($object->name_alias)) { if (!empty($object->name_alias)) {
$morehtmlref .= '<div class="refidno opacitymedium">'.$object->name_alias.'</div>'; $morehtmlref .= '<div class="refidno opacitymedium">'.dol_escape_htmltag($object->name_alias).'</div>';
} }
// Add label // Add label
@ -2346,7 +2350,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && ($conf->global->MAIN_SHOW_TECHNICAL_ID == '1' || preg_match('/'.preg_quote($object->element, '/').'/i', $conf->global->MAIN_SHOW_TECHNICAL_ID)) && !empty($object->id)) { if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && ($conf->global->MAIN_SHOW_TECHNICAL_ID == '1' || preg_match('/'.preg_quote($object->element, '/').'/i', $conf->global->MAIN_SHOW_TECHNICAL_ID)) && !empty($object->id)) {
$morehtmlref .= '<div style="clear: both;"></div>'; $morehtmlref .= '<div style="clear: both;"></div>';
$morehtmlref .= '<div class="refidno opacitymedium">'; $morehtmlref .= '<div class="refidno opacitymedium">';
$morehtmlref .= $langs->trans("TechnicalID").': '.$object->id; $morehtmlref .= $langs->trans("TechnicalID").': '.((int) $object->id);
$morehtmlref .= '</div>'; $morehtmlref .= '</div>';
} }
@ -3166,11 +3170,10 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
if (!empty($type)) { if (!empty($type)) {
$htmllink = '<div class="divsocialnetwork inline-block valignmiddle">'; $htmllink = '<div class="divsocialnetwork inline-block valignmiddle">';
// Use dictionary definition for picto $dictsocialnetworks[$type]['icon'] // Use dictionary definition for picto $dictsocialnetworks[$type]['icon']
$htmllink .= '<span class="fa paddingright '.($dictsocialnetworks[$type]['icon'] ? $dictsocialnetworks[$type]['icon'] : 'fa-link').'"></span>'; $htmllink .= '<span class="fa paddingright pictofixedwidth '.($dictsocialnetworks[$type]['icon'] ? $dictsocialnetworks[$type]['icon'] : 'fa-link').'"></span>';
if ($type == 'skype') { if ($type == 'skype') {
$htmllink .= dol_escape_htmltag($value); $htmllink .= dol_escape_htmltag($value);
$htmllink .= '&nbsp;'; $htmllink .= '&nbsp; <a href="skype:';
$htmllink .= '<a href="skype:';
$htmllink .= dol_string_nospecial($value, '_', '', array('@')); $htmllink .= dol_string_nospecial($value, '_', '', array('@'));
$htmllink .= '?call" alt="'.$langs->trans("Call").'&nbsp;'.$value.'" title="'.dol_escape_htmltag($langs->trans("Call").' '.$value).'">'; $htmllink .= '?call" alt="'.$langs->trans("Call").'&nbsp;'.$value.'" title="'.dol_escape_htmltag($langs->trans("Call").' '.$value).'">';
$htmllink .= '<img src="'.DOL_URL_ROOT.'/theme/common/skype_callbutton.png" border="0">'; $htmllink .= '<img src="'.DOL_URL_ROOT.'/theme/common/skype_callbutton.png" border="0">';
@ -3208,9 +3211,9 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
} }
$link = str_replace('{socialid}', $value, $dictsocialnetworks[$type]['url']); $link = str_replace('{socialid}', $value, $dictsocialnetworks[$type]['url']);
if (preg_match('/^https?:\/\//i', $link)) { if (preg_match('/^https?:\/\//i', $link)) {
$htmllink .= '&nbsp;<a href="'.dol_sanitizeUrl($link, 0).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>'; $htmllink .= '<a href="'.dol_sanitizeUrl($link, 0).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
} else { } else {
$htmllink .= '&nbsp;<a href="'.dol_sanitizeUrl($link, 1).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>'; $htmllink .= '<a href="'.dol_sanitizeUrl($link, 1).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
} }
} else { } else {
$htmllink .= dol_escape_htmltag($value); $htmllink .= dol_escape_htmltag($value);
@ -3263,7 +3266,7 @@ function dol_print_profids($profID, $profIDtype, $countrycode = '', $addcpButton
* @param string $countrycode Country code to use for formatting * @param string $countrycode Country code to use for formatting
* @param int $cid Id of contact if known * @param int $cid Id of contact if known
* @param int $socid Id of third party if known * @param int $socid Id of third party if known
* @param string $addlink ''=no link to create action, 'AC_TEL'=add link to clicktodial (if module enabled) and add link to create event (if conf->global->AGENDA_ADDACTIONFORPHONE set) * @param string $addlink ''=no link to create action, 'AC_TEL'=add link to clicktodial (if module enabled) and add link to create event (if conf->global->AGENDA_ADDACTIONFORPHONE set), 'tel'=Force "tel:..." link
* @param string $separ Separation between numbers for a better visibility example : xx.xx.xx.xx.xx * @param string $separ Separation between numbers for a better visibility example : xx.xx.xx.xx.xx
* @param string $withpicto Show picto ('fax', 'phone', 'mobile') * @param string $withpicto Show picto ('fax', 'phone', 'mobile')
* @param string $titlealt Text to show on alt * @param string $titlealt Text to show on alt
@ -3471,7 +3474,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
} }
} }
if (!empty($addlink)) { // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set) if (!empty($addlink)) { // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set)
if ($conf->browser->layout == 'phone' || (isModEnabled('clicktodial') && !empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) { // If phone or option for, we use link of phone if ($addlink == 'tel' || $conf->browser->layout == 'phone' || (isModEnabled('clicktodial') && !empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) { // If phone or option for, we use link of phone
$newphoneform = $newphone; $newphoneform = $newphone;
$newphone = '<a href="tel:'.$phone.'"'; $newphone = '<a href="tel:'.$phone.'"';
$newphone .= '>'.$newphoneform.'</a>'; $newphone .= '>'.$newphoneform.'</a>';

View File

@ -226,6 +226,7 @@ NoUserGroupDefined=No user group defined
Password=Password Password=Password
PasswordRetype=Repeat your password PasswordRetype=Repeat your password
NoteSomeFeaturesAreDisabled=Note that a lot of features/modules are disabled in this demonstration. NoteSomeFeaturesAreDisabled=Note that a lot of features/modules are disabled in this demonstration.
YourUserFile=Your user file
Name=Name Name=Name
NameSlashCompany=Name / Company NameSlashCompany=Name / Company
Person=Person Person=Person
@ -1213,4 +1214,5 @@ InternalUser=Internal user
ExternalUser=External user ExternalUser=External user
NoSpecificContactAddress=No specific contact or address NoSpecificContactAddress=No specific contact or address
NoSpecificContactAddressBis=This tab is dedicated to force specific contacts or addresses for the current object. Use it only if you want to define one or several specific contacts or addresses for the object when the information on the thirdparty is not enough or not accurate. NoSpecificContactAddressBis=This tab is dedicated to force specific contacts or addresses for the current object. Use it only if you want to define one or several specific contacts or addresses for the object when the information on the thirdparty is not enough or not accurate.
HideOnVCard=Hide %s
AddToContacts=Add address to my contacts

View File

@ -2280,12 +2280,14 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
if (empty($urllogout)) { if (empty($urllogout)) {
$urllogout = DOL_URL_ROOT.'/user/logout.php?token='.newToken(); $urllogout = DOL_URL_ROOT.'/user/logout.php?token='.newToken();
} }
$logoutLink = '<a accesskey="l" href="'.$urllogout.'" class="button-top-menu-dropdown" ><i class="fa fa-sign-out-alt"></i> '.$langs->trans("Logout").'</a>';
$profilLink = '<a accesskey="l" href="'.DOL_URL_ROOT.'/user/card.php?id='.$user->id.'" class="button-top-menu-dropdown" ><i class="fa fa-user"></i> '.$langs->trans("Card").'</a>';
// Defined the links for bottom of card
$profilLink = '<a accesskey="c" href="'.DOL_URL_ROOT.'/user/card.php?id='.$user->id.'" class="button-top-menu-dropdown" title="'.dol_escape_htmltag($langs->trans("YourUserFile")).'"><i class="fa fa-user"></i> '.$langs->trans("Card").'</a>';
$urltovirtualcard = '/user/virtualcard.php?id='.((int) $user->id);
$virtuelcardLink = dolButtonToOpenUrlInDialogPopup('publicvirtualcardmenu', $langs->trans("PublicVirtualCardUrl"), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', ''), $urltovirtualcard, '', 'button-top-menu-dropdown marginleftonly nohover', "closeTopMenuLoginDropdown()", '', 'v');
$logoutLink = '<a accesskey="l" href="'.$urllogout.'" class="button-top-menu-dropdown" title="'.dol_escape_htmltag($langs->trans("Logout")).'"><i class="fa fa-sign-out-alt"></i> '.$langs->trans("Logout").'</a>';
$profilName = $user->getFullName($langs).' ('.$user->login.')'; $profilName = $user->getFullName($langs).' ('.$user->login.')';
if (!empty($user->admin)) { if (!empty($user->admin)) {
$profilName = '<i class="far fa-star classfortooltip" title="'.$langs->trans("Administrator").'" ></i> '.$profilName; $profilName = '<i class="far fa-star classfortooltip" title="'.$langs->trans("Administrator").'" ></i> '.$profilName;
} }
@ -2341,6 +2343,9 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
<div class="pull-left"> <div class="pull-left">
'.$profilLink.' '.$profilLink.'
</div> </div>
<div class="pull-left">
'.$virtuelcardLink.'
</div>
<div class="pull-right"> <div class="pull-right">
'.$logoutLink.' '.$logoutLink.'
</div> </div>
@ -2363,12 +2368,15 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
$btnUser .= ' $btnUser .= '
<!-- Code to show/hide the user drop-down --> <!-- Code to show/hide the user drop-down -->
<script> <script>
function closeTopMenuLoginDropdown() {
//console.log("close login dropdown"); // This is call at each click on page, so we disable the log
// Hide the menus.
jQuery("#topmenu-login-dropdown").removeClass("open");
}
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery(document).on("click", function(event) { jQuery(document).on("click", function(event) {
if (!$(event.target).closest("#topmenu-login-dropdown").length) { if (!$(event.target).closest("#topmenu-login-dropdown").length) {
//console.log("close login dropdown"); closeTopMenuLoginDropdown();
// Hide the menus.
jQuery("#topmenu-login-dropdown").removeClass("open");
} }
}); });
'; ';

View File

@ -699,7 +699,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
// TODO @LDR Implement this // TODO @LDR Implement this
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
$tmpbacktopagejsfields = 'addthirdparty:socid,search_socid'; $tmpbacktopagejsfields = 'addthirdparty:socid,search_socid';
print dolButtonToOpenUrlInDialogPopup('addthirdparty', $langs->transnoentitiesnoconv('AddThirdParty'), $newbutton, $url, '', '', $tmpbacktopagejsfields); print dolButtonToOpenUrlInDialogPopup('addthirdparty', $langs->transnoentitiesnoconv('AddThirdParty'), $newbutton, $url, '', '', '', $tmpbacktopagejsfields);
} else { } else {
print ' <a href="'.DOL_URL_ROOT.$url.'">'.$newbutton.'</a>'; print ' <a href="'.DOL_URL_ROOT.$url.'">'.$newbutton.'</a>';
} }

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2020-2022 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -45,6 +45,7 @@ $langs->loadLangs(array("companies", "other", "recruitment"));
// Get parameters // Get parameters
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$mode = GETPOST('mode', 'aZ09');
$cancel = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
$backtopage = ''; $backtopage = '';
@ -64,7 +65,11 @@ $urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than curren
global $dolibarr_main_instance_unique_id; global $dolibarr_main_instance_unique_id;
$encodedsecurekey = dol_hash($dolibarr_main_instance_unique_id.'uservirtualcard'.$object->id.'-'.$object->login, 'md5'); $encodedsecurekey = dol_hash($dolibarr_main_instance_unique_id.'uservirtualcard'.$object->id.'-'.$object->login, 'md5');
if ($encodedsecurekey != $securekey) { if ($encodedsecurekey != $securekey) {
httponly_accessforbidden('User profile page not found or not allowed'); httponly_accessforbidden('Bad value for securitykey or public profile not enabled');
}
if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) {
httponly_accessforbidden('Bad value for securitykey or public profile not enabled');
} }
@ -80,52 +85,6 @@ if ($cancel) {
$action = 'view'; $action = 'view';
} }
/*
if ($action == "view" || $action == "presend" || $action == "dosubmit") {
$error = 0;
$display_ticket = false;
if (!strlen($ref)) {
$error++;
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Ref")));
$action = '';
}
if (!strlen($email)) {
$error++;
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Email")));
$action = '';
} else {
if (!isValidEmail($email)) {
$error++;
array_push($object->errors, $langs->trans("ErrorEmailInvalid"));
$action = '';
}
}
if (!$error) {
$ret = $object->fetch('', $ref);
}
if ($error || $errors) {
setEventMessages($object->error, $object->errors, 'errors');
if ($action == "dosubmit") {
$action = 'presend';
} else {
$action = '';
}
}
}
*/
//var_dump($action);
//$object->doActions($action);
// Actions to send emails (for ticket, we need to manage the addfile and removefile only)
/*$triggersendname = 'USER_SENTBYMAIL';
$paramname = 'id';
$autocopy = 'MAIN_MAIL_AUTOCOPY_USER_TO'; // used to know the automatic BCC to add
$trackid = 'use'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
*/
/* /*
* View * View
@ -134,7 +93,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
$form = new Form($db); $form = new Form($db);
$company = $mysoc; $company = $mysoc;
if ($action == 'vcard') { if ($mode == 'vcard') {
// We create VCard // We create VCard
$v = new vCard(); $v = new vCard();
$output = $v->buildVCardString($object, $company, $langs); $output = $v->buildVCardString($object, $company, $langs);
@ -219,16 +178,16 @@ if (!empty($logosmall) && is_readable($conf->user->dir_output.'/'.$logosmall)) {
print '<div class="backgreypublicpayment">'; print '<div class="backgreypublicpayment">';
print '<div class="logopublicpayment">'; print '<div class="logopublicpayment">';
// Show photo // Name
if ($urllogo) { print '<div class="double colortext">'.$object->getFullName($langs).'</div>';
/*if (!empty($mysoc->url)) { // User position
print '<a href="'.$mysoc->url.'" target="_blank" rel="noopener">'; if ($object->job && !getDolUserInt('USER_PUBLIC_HIDE_JOBPOSITION', 0, $object)) {
}*/ print '<div class="">';
print '<img id="dolpaymentlogo" src="'.$urllogofull.'">'; print dol_escape_htmltag($object->job);
/*if (!empty($mysoc->url)) { print '</div>';
print '</a>';
}*/
} }
print '</div>'; print '</div>';
/*if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { /*if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
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>'; 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>';
@ -242,22 +201,28 @@ if (!empty($conf->global->USER_IMAGE_PUBLIC_INTERFACE)) {
print '</div>'; print '</div>';
} }
$urlforqrcode = $_SERVER["PHP_SELF"].'?action=vcard&id='.((int) $object->id).'&securekey='.urlencode($securekey); $urlforqrcode = $object->getOnlineVirtualCardUrl('vcard');
$socialnetworksdict = getArrayOfSocialNetworks();
// Show barcode // Show barcode
$showbarcode = GETPOST('nobarcode') ? 0 : 1; $showbarcode = GETPOST('nobarcode') ? 0 : 1;
if ($showbarcode) { if ($showbarcode) {
print '<br>'; print '<br>';
print '<div class="floatleft inline-block valignmiddle divphotoref">'; print '<div class="floatleft inline-block valignmiddle divphotoref">';
print 'QRCODE...<br>'; print '<img src="'.$dolibarr_main_url_root.'/viewimage.php?modulepart=barcode&entity='.((int) $conf->entity).'&generator=tcpdfbarcode&encoding=QRCODE&code='.urlencode($urlforqrcode).'">';
print $urlforqrcode;
print '</div>'; print '</div>';
print '<br>'; print '<br>';
print '<br>';
} }
print '<div class="opacitymedium">'.$langs->trans("Me").'</div>'."\n"; // Me
// Show photo
if ($urllogo) {
print '<img class="userphotopublicvcard" id="dolpaymentlogo" src="'.$urllogofull.'">';
}
print '<table id="dolpaymenttable" summary="Job position offer" class="center">'."\n"; print '<table id="dolpaymenttable" summary="Job position offer" class="center">'."\n";
// Output payment summary form // Output payment summary form
@ -265,12 +230,45 @@ print '<tr><td class="left">';
print '<div class="nowidthimp" id="tablepublicpayment">'; print '<div class="nowidthimp" id="tablepublicpayment">';
print '<br>'; // User email
if ($object->email && !getDolUserInt('USER_PUBLIC_HIDE_EMAIL', 0, $object)) {
print '<div class="flexitemsmall">';
print dol_print_email($object->email, 0, 0, 1, 0, 1, 1);
print '</div>';
}
// Add contact info // User url
print '...'; if ($object->url && !getDolUserInt('USER_PUBLIC_HIDE_URL', 0, $object)) {
print '<div class="flexitemsmall">';
print img_picto('', 'globe', 'class="pictofixedwidth"');
print dol_print_url($object->url, '_blank', 0, 0, '');
print '</div>';
}
print '<br>'; // User phone
if ($object->office_phone && !getDolUserInt('USER_PUBLIC_HIDE_OFFICE_PHONE', 0, $object)) {
print '<div class="flexitemsmall">';
print img_picto('', 'phone', 'class="pictofixedwidth"');
print dol_print_phone($object->office_phone, $object->country_code, 0, $mysoc->id, 'tel', ' ', 0, '');
print '<div>';
}
if ($object->user_mobile && !getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object)) {
print '<div class="flexitemsmall">';
print img_picto('', 'phone', 'class="pictofixedwidth"');
print dol_print_phone($object->user_mobile, $object->country_code, 0, $mysoc->id, 'tel', ' ', 0, '');
print '<div>';
}
// Social networks
if (!empty($object->socialnetworks) && is_array($object->socialnetworks) && count($object->socialnetworks) > 0) {
if (!getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object)) {
foreach ($object->socialnetworks as $key => $value) {
if ($value) {
print '<div class="flexitemsmall">'.dol_print_socialnetworks($value, 0, $mysoc->id, $key, $socialnetworksdict).'</div>';
}
}
}
}
print '</div>'."\n"; print '</div>'."\n";
@ -282,22 +280,43 @@ print '</table>'."\n";
if (!getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) {
$companysection = '';
print '<div class="opacitymedium">'.$langs->trans("MyCompany").'</div>'."\n"; if ($mysoc->email) {
print '<table id="dolpaymenttable" summary="Job position offer" class="center">'."\n"; $companysection .= '<div class="flexitemsmall">';
$companysection .= img_picto('', 'email', 'class="pictofixedwidth"');
$companysection .= dol_print_email($mysoc->email, 0, 0, 1);
$companysection .= '<div>';
}
// Output payment summary form if ($mysoc->url) {
print '<tr><td class="left">'; $companysection .= '<div class="flexitemsmall">';
$companysection .= img_picto('', 'globe', 'class="pictofixedwidth"');
$companysection .= dol_print_url($mysoc->url, '_blank', 0, 0, '');
$companysection .= '</div>';
}
print '<div class="nowidthimp" id="tablepublicpayment">'; if ($mysoc->phone) {
$companysection .= '<div class="flexitemsmall">';
// Add company info $companysection .= img_picto('', 'phone', 'class="pictofixedwidth"');
$companysection .= dol_print_phone($mysoc->phone, $mysoc->country_code, 0, $mysoc->id, 'tel', ' ', 0, '');
$companysection .= '<div>';
}
// Social networks
if (!empty($mysoc->socialnetworks) && is_array($mysoc->socialnetworks) && count($mysoc->socialnetworks) > 0) {
foreach ($mysoc->socialnetworks as $key => $value) {
if ($value) {
$companysection .= '<div class="flexitemsmall">'.dol_print_socialnetworks($value, 0, $mysoc->id, $key, $socialnetworksdict).'</div>';
}
}
}
// 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) // 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)
// Define logo and logosmall // Define logo and logosmall
$logosmall = $mysoc->logo_small; $logosmall = $mysoc->logo_squarred_small ? $mysoc->logo_squarred_small : $mysoc->logo_small;
$logo = $mysoc->logo; $logo = $mysoc->logo_squarred ? $mysoc->logo_squarred : $mysoc->logo;
$paramlogo = 'ONLINE_USER_LOGO_'.$suffix; $paramlogo = 'ONLINE_USER_LOGO_'.$suffix;
if (!empty($conf->global->$paramlogo)) { if (!empty($conf->global->$paramlogo)) {
$logosmall = $conf->global->$paramlogo; $logosmall = $conf->global->$paramlogo;
@ -317,32 +336,32 @@ if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumb
} }
// Output html code for logo // Output html code for logo
if ($urllogo) { if ($urllogo) {
print '<div class="logopublicpayment">'; print '<div class="logopublicpayment center">';
if (!empty($mysoc->url)) { if (!empty($mysoc->url)) {
print '<a href="'.$mysoc->url.'" target="_blank" rel="noopener">'; print '<a href="'.$mysoc->url.'" target="_blank" rel="noopener">';
} }
print '<img id="dolpaymentlogo" src="'.$urllogofull.'">'; print '<img class="userphotopublicvcard" id="dolpaymentlogo" src="'.$urllogofull.'">';
if (!empty($mysoc->url)) { if (!empty($mysoc->url)) {
print '</a>'; print '</a>';
} }
print '</div>'; print '</div>';
} }
print '<table id="dolpaymenttable" summary="Job position offer" class="center">'."\n";
// Output payment summary form
print '<tr><td class="left">';
if ($mysoc->email) { print '<div class="nowidthimp" id="tablepublicpayment">';
print '<br>';
print img_picto('', 'email', 'class="pictofixedwidth"').dol_print_email($mysoc->email, 0, 0, 1); // Add company info
print '<br>'; if ($mysoc->name) {
} print '<div class="center bold">';
print $mysoc->name;
if ($mysoc->url) { print '</div>';
print '<br>';
print img_picto('', 'globe', 'class="pictofixedwidth"');
//print 'rr';
print dol_print_url($mysoc->url, '_blank', 0, 0, '');
print '<br>'; print '<br>';
} }
print $companysection;
print '</div>'."\n"; print '</div>'."\n";
print "\n"; print "\n";
@ -350,7 +369,7 @@ print "\n";
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '</table>'."\n"; print '</table>'."\n";
}
// Description // Description
@ -368,8 +387,8 @@ print '<br>';
print '<div class="backgreypublicpayment">'; print '<div class="backgreypublicpayment">';
print '<div class="center">'; print '<div class="center">';
print '<a href="'.$urlforqrcode.'">'; print '<a href="'.$urlforqrcode.'">';
print img_picto($langs->trans("AddTocontacts"), 'add').' '; print img_picto($langs->trans("AddToContacts"), 'add').' ';
print $langs->trans("AddTocontacts"); print $langs->trans("AddToContacts");
print '</a>'; print '</a>';
print '</div>'; print '</div>';
//print '<div>'; //print '<div>';

View File

@ -3110,6 +3110,17 @@ img.userphotosmall { /* size for user photo in lists */
vertical-align: middle; vertical-align: middle;
background-color: #FFF; background-color: #FFF;
} }
img.userphotopublicvcard {
width: 60px;
height: 60px;
border-radius: 50%;
background-size: contain;
border: 1px solid;
border-color: rgba(128, 128, 128, 0.5);
position: relative;
top: 25px;
left: -110px;
}
img.userphoto[alt="Gravatar avatar"], img.photouserphoto.dropdown-user-image[alt="Gravatar avatar"] { img.userphoto[alt="Gravatar avatar"], img.photouserphoto.dropdown-user-image[alt="Gravatar avatar"] {
background: #fff; background: #fff;
} }
@ -7814,6 +7825,12 @@ div.clipboardCPValue.hidewithsize {
.lilevel1 span.paddingright { .lilevel1 span.paddingright {
padding-right: 4px; padding-right: 4px;
} }
img.userphotopublicvcard {
left: unset;
top: unset;
margin-top: 30px;
}
} }
@media only screen and (max-width: 320px) @media only screen and (max-width: 320px)

View File

@ -3232,6 +3232,17 @@ img.userphotosmall { /* size for user photo in lists */
img.userphoto[alt="Gravatar avatar"], img.photouserphoto.dropdown-user-image[alt="Gravatar avatar"] { img.userphoto[alt="Gravatar avatar"], img.photouserphoto.dropdown-user-image[alt="Gravatar avatar"] {
background: #fff; background: #fff;
} }
img.userphotopublicvcard {
width: 60px;
height: 60px;
border-radius: 50%;
background-size: contain;
border: 1px solid;
border-color: rgba(128, 128, 128, 0.5);
position: relative;
top: 25px;
left: -110px;
}
form[name="addtime"] img.userphoto { form[name="addtime"] img.userphoto {
border: 1px solid #444; border: 1px solid #444;
} }
@ -7639,6 +7650,12 @@ div.clipboardCPValue.hidewithsize {
.lilevel1 span.paddingright { .lilevel1 span.paddingright {
padding-right: 3px; padding-right: 3px;
} }
img.userphotopublicvcard {
left: unset;
top: unset;
margin-top: 30px;
}
} }

View File

@ -1433,12 +1433,10 @@ if ($action == 'create' || $action == 'adduserldap') {
print dol_get_fiche_head($head, 'user', $title, -1, 'user'); print dol_get_fiche_head($head, 'user', $title, -1, 'user');
$morehtmlref = '<a href="'.DOL_URL_ROOT.'/user/vcard.php?id='.$object->id.'" class="refid" rel="noopener">'; $morehtmlref = '<a href="'.DOL_URL_ROOT.'/user/vcard.php?id='.$object->id.'" class="refid" rel="noopener">';
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard").' ('.$langs->trans("AddToContacts").')', 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
$morehtmlref .= '</a>'; $morehtmlref .= '</a>';
//$urltovirtualcard = $object->getOnlineVirtualCardUrl();
$urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id);
$morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl"), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl"), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover');
/*$morehtmlref .= '<a href="'.$urltovirtualcard.'" class="refid" target="_blank" rel="noopener">'; /*$morehtmlref .= '<a href="'.$urltovirtualcard.'" class="refid" target="_blank" rel="noopener">';
$morehtmlref .= img_picto($langs->trans("PublicVirtualCardUrl"), 'id-card', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= img_picto($langs->trans("PublicVirtualCardUrl"), 'id-card', 'class="valignmiddle marginleftonly paddingrightonly"');

View File

@ -3789,9 +3789,10 @@ class User extends CommonObject
/** /**
* Return string with full Url to virtual card * Return string with full Url to virtual card
* *
* @return string Url string * @param string $mode Mode for link
* @return string Url string link
*/ */
public function getOnlineVirtualCardUrl() public function getOnlineVirtualCardUrl($mode = '')
{ {
global $dolibarr_main_instance_unique_id, $dolibarr_main_url_root; global $dolibarr_main_instance_unique_id, $dolibarr_main_url_root;
global $conf; global $conf;
@ -3807,7 +3808,7 @@ class User extends CommonObject
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
return $urlwithroot.'/public/users/view.php?id='.$this->id.'&securekey='.$encodedsecurekey.$entity_qr; return $urlwithroot.'/public/users/view.php?id='.$this->id.'&securekey='.$encodedsecurekey.$entity_qr.($mode ? '&mode='.urlencode($mode) : '');
} }
/** /**

View File

@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
// Load translation files required by page // Load translation files required by page
$langs->load("users"); $langs->loadLangs(array("users", "companies"));
// Security check // Security check
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
@ -62,11 +62,12 @@ if (($object->id != $user->id) && empty($user->rights->user->user->lire)) {
if ($action == 'update') { if ($action == 'update') {
$tmparray = array(); $tmparray = array();
$tmparray['USER_PUBLIC_COMPANY_NAME'] = (GETPOST('USER_PUBLIC_COMPANY_NAME') ? 1 : 0); $tmparray['USER_PUBLIC_HIDE_JOBPOSITION'] = (GETPOST('USER_PUBLIC_HIDE_JOBPOSITION') ? 1 : 0);
$tmparray['USER_PUBLIC_JOBPOSITION'] = (GETPOST('USER_PUBLIC_JOBPOSITION') ? 1 : 0); $tmparray['USER_PUBLIC_HIDE_EMAIL'] = (GETPOST('USER_PUBLIC_HIDE_EMAIL') ? 1 : 0);
$tmparray['USER_PUBLIC_EMAIL'] = (GETPOST('USER_PUBLIC_EMAIL') ? 1 : 0); $tmparray['USER_PUBLIC_HIDE_OFFICE_PHONE'] = (GETPOST('USER_PUBLIC_HIDE_OFFICE_PHONE') ? 1 : 0);
$tmparray['USER_PUBLIC_PHONE'] = (GETPOST('USER_PUBLIC_PHONE') ? 1 : 0); $tmparray['USER_PUBLIC_HIDE_USER_MOBILE'] = (GETPOST('USER_PUBLIC_HIDE_USER_MOBILE') ? 1 : 0);
$tmparray['USER_PUBLIC_SOCIALNETWORKS'] = (GETPOST('USER_PUBLIC_SOCIALNETWORKS') ? 1 : 0); $tmparray['USER_PUBLIC_HIDE_SOCIALNETWORKS'] = (GETPOST('USER_PUBLIC_HIDE_SOCIALNETWORKS') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_COMPANY'] = (GETPOST('USER_PUBLIC_HIDE_COMPANY') ? 1 : 0);
$tmparray['USER_PUBLIC_MORE'] = (GETPOST('USER_PUBLIC_MORE') ? GETPOST('USER_PUBLIC_MORE') : ''); $tmparray['USER_PUBLIC_MORE'] = (GETPOST('USER_PUBLIC_MORE') ? GETPOST('USER_PUBLIC_MORE') : '');
dol_set_user_param($db, $conf, $object, $tmparray); dol_set_user_param($db, $conf, $object, $tmparray);
@ -133,6 +134,7 @@ print '<br>';
print '<span class="opacitymedium">'.$langs->trans("UserPublicPageDesc").'</span><br><br>'; print '<span class="opacitymedium">'.$langs->trans("UserPublicPageDesc").'</span><br><br>';
$param = '&id='.((int) $object->id); $param = '&id='.((int) $object->id);
$param .= '&dol_openinpopup=1';
$enabledisablehtml = $langs->trans("EnablePublicVirtualCard").' '; $enabledisablehtml = $langs->trans("EnablePublicVirtualCard").' ';
if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) {
@ -179,40 +181,46 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) {
print '<td>'.$langs->trans("Value").'</td>'; print '<td>'.$langs->trans("Value").'</td>';
print "</tr>\n"; print "</tr>\n";
// Company name
print '<tr class="oddeven" id="tramount"><td>';
print $langs->trans("Company");
print '</td><td>';
//print '<input type="text" class="maxwidth300" id="USER_PUBLIC_COMPANY_NAME" name="USER_PUBLIC_COMPANY_NAME" value="'.(getDolUserString('USER_PUBLIC_COMPANY_NAME', $mysoc->name, $object) ? getDolUserString('USER_PUBLIC_COMPANY_NAME', $mysoc->name, $object) : 0).'">';
print $form->selectyesno("USER_PUBLIC_COMPANY_NAME", (getDolUserInt('USER_PUBLIC_COMPANY_NAME', 0, $object) ? getDolUserInt('USER_PUBLIC_COMPANY_NAME', 0, $object) : 0), 1);
print "</td></tr>\n";
// Job position // Job position
print '<tr class="oddeven" id="tredit"><td>'; print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("PostOrFunction"); print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("PostOrFunction"));
print '</td><td>'; print '</td><td>';
print $form->selectyesno("USER_PUBLIC_JOBPOSITION", (getDolUserInt('USER_PUBLIC_JOBPOSITION', 0, $object) ? getDolUserInt('USER_PUBLIC_JOBPOSITION', 0, $object) : 0), 1); print $form->selectyesno("USER_PUBLIC_HIDE_JOBPOSITION", (getDolUserInt('USER_PUBLIC_HIDE_JOBPOSITION', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_JOBPOSITION', 0, $object) : 0), 1);
print "</td></tr>\n"; print "</td></tr>\n";
// Email // Email
print '<tr class="oddeven" id="tredit"><td>'; print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("Email"); print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Email"));
print '</td><td>'; print '</td><td>';
print $form->selectyesno("USER_PUBLIC_EMAIL", (getDolUserInt('USER_PUBLIC_EMAIL', 0, $object) ? getDolUserInt('USER_PUBLIC_EMAIL', 0, $object) : 0), 1); print $form->selectyesno("USER_PUBLIC_HIDE_EMAIL", (getDolUserInt('USER_PUBLIC_HIDE_EMAIL', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_EMAIL', 0, $object) : 0), 1);
print "</td></tr>\n"; print "</td></tr>\n";
// Phone // Office phone
print '<tr class="oddeven" id="tredit"><td>'; print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("Phone"); print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("OfficePhone"));
print '</td><td>'; print '</td><td>';
print $form->selectyesno("USER_PUBLIC_PHONE", (getDolUserInt('USER_PUBLIC_PHONE', 0, $object) ? getDolUserInt('USER_PUBLIC_PHONE', 0, $object) : 0), 1); print $form->selectyesno("USER_PUBLIC_HIDE_OFFICE_PHONE", (getDolUserInt('USER_PUBLIC_HIDE_OFFICE_PHONE', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_OFFICE_PHONE', 0, $object) : 0), 1);
print "</td></tr>\n";
// Office phone
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("UserMobile"));
print '</td><td>';
print $form->selectyesno("USER_PUBLIC_HIDE_USER_MOBILE", (getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object) : 0), 1);
print "</td></tr>\n"; print "</td></tr>\n";
// Social networks // Social networks
print '<tr class="oddeven" id="tredit"><td>'; print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("SocialNetworks"); print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("SocialNetworks"));
print '</td><td>'; print '</td><td>';
print $form->selectyesno("USER_PUBLIC_SOCIALNETWORKS", (getDolUserInt('USER_PUBLIC_SOCIALNETWORKS', 0, $object) ? getDolUserInt('USER_PUBLIC_SOCIALNETWORKS', 0, $object) : 0), 1); print $form->selectyesno("USER_PUBLIC_HIDE_SOCIALNETWORKS", (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object) : 0), 1);
print "</td></tr>\n";
// Company name
print '<tr class="oddeven" id="tramount"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("CompanySection"));
print '</td><td>';
print $form->selectyesno("USER_PUBLIC_HIDE_COMPANY", (getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object) : 0), 1);
print "</td></tr>\n"; print "</td></tr>\n";
// More // More

View File

@ -52,44 +52,31 @@ if (!defined('NOREQUIREAJAX')) {
// Some value of modulepart can be used to get resources that are public so no login are required. // Some value of modulepart can be used to get resources that are public so no login are required.
// Note that only directory logo is free to access without login. // Note that only directory logo is free to access without login.
if (isset($_GET["modulepart"]) && $_GET["modulepart"] == 'mycompany' && preg_match('/^\/?logos\//', $_GET['file'])) { $needlogin = 1;
if (!defined("NOLOGIN")) { if (isset($_GET["modulepart"])) {
define("NOLOGIN", 1); // For logo of company
if ($_GET["modulepart"] == 'mycompany' && preg_match('/^\/?logos\//', $_GET['file'])) {
$needlogin = 0;
} }
if (!defined("NOCSRFCHECK")) { // For barcode live generation
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. if ($_GET["modulepart"] == 'barcode') {
$needlogin = 0;
} }
if (!defined("NOIPCHECK")) { // Some value of modulepart can be used to get resources that are public so no login are required.
define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip if ($_GET["modulepart"] == 'medias') {
$needlogin = 0;
}
// Used by TakePOS Auto Order
if ($_GET["modulepart"] == 'product' && isset($_GET["publictakepos"])) {
$needlogin = 0;
} }
} }
// For direct external download link, we don't need to load/check we are into a login session // For direct external download link, we don't need to load/check we are into a login session
if (isset($_GET["hashp"]) && !defined("NOLOGIN")) { if (isset($_GET["hashp"])) {
if (!defined("NOLOGIN")) { $needlogin = 0;
define("NOLOGIN", 1);
} }
if (!defined("NOCSRFCHECK")) { // If nologin required
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. if (!$needlogin) {
}
if (!defined("NOIPCHECK")) {
define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip
}
}
// Some value of modulepart can be used to get resources that are public so no login are required.
if (isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias') {
if (!defined("NOLOGIN")) {
define("NOLOGIN", 1);
}
if (!defined("NOCSRFCHECK")) {
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
}
if (!defined("NOIPCHECK")) {
define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip
}
}
// Used by TakePOS Auto Order
if (isset($_GET["modulepart"]) && $_GET["modulepart"] == 'product' && isset($_GET["publictakepos"])) {
if (!defined("NOLOGIN")) { if (!defined("NOLOGIN")) {
define("NOLOGIN", 1); define("NOLOGIN", 1);
} }
@ -131,10 +118,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$original_file = GETPOST('file', 'alphanohtml'); // Do not use urldecode here ($_GET are already decoded by PHP). $original_file = GETPOST('file', 'alphanohtml'); // Do not use urldecode here ($_GET are already decoded by PHP).
$hashp = GETPOST('hashp', 'aZ09'); $hashp = GETPOST('hashp', 'aZ09', 1); // Must be read only by GET
$modulepart = GETPOST('modulepart', 'alpha'); $modulepart = GETPOST('modulepart', 'alpha', 1); // Must be read only by GET
$urlsource = GETPOST('urlsource', 'alpha'); $urlsource = GETPOST('urlsource', 'alpha');
$entity = GETPOST('entity', 'int') ?GETPOST('entity', 'int') : $conf->entity; $entity = (GETPOST('entity', 'int') ? GETPOST('entity', 'int') : $conf->entity);
// Security check // Security check
if (empty($modulepart) && empty($hashp)) { if (empty($modulepart) && empty($hashp)) {