14 if (!defined(
'IN_PEEL')) {
37 $sql_profil =
"SELECT id, name_".$_SESSION[
'session_langue'].
" AS name, priv
41 $res_profil =
query($sql_profil);
43 $output .=
'<option value="' .
String::str_form_value($tab_profil[
'priv']) .
'" ' .
frmvalide($selected_priv == $tab_profil[
'priv'],
' selected="selected"') .
'>' . $tab_profil[
'name'] .
'</option>';
63 function a_priv($requested_priv, $demo_allowed =
false, $site_configuration_modification =
false, $user_id = null)
67 $user_priv =
$_SESSION[
'session_utilisateur'][
'priv'];
71 $user_priv =
vb($user_infos[
'priv']);
73 if (!empty($user_priv)) {
74 if($site_configuration_modification && !empty(
$GLOBALS[
'site_parameters'][
'admin_configuration_only_by_user_ids']) && !in_array(
vn(
$_SESSION[
'session_utilisateur'][
'id_utilisateur']),
$GLOBALS[
'site_parameters'][
'admin_configuration_only_by_user_ids'])) {
78 if (strpos($requested_priv,
',') !==
false) {
80 $requested_priv_array = explode(
',', $requested_priv);
82 foreach($requested_priv_array as $this_requested_priv) {
83 if (
a_priv(trim($this_requested_priv), $demo_allowed)) {
88 }
elseif (strpos($requested_priv,
'+') !==
false) {
90 $requested_priv_array = explode(
'+', $requested_priv);
92 foreach($requested_priv_array as $this_requested_priv) {
93 if (!
a_priv(trim($this_requested_priv), $demo_allowed)) {
99 $user_priv_array = explode(
'+', $user_priv);
100 foreach($user_priv_array as $this_user_priv) {
101 if (substr($requested_priv, 0, 5) ==
'admin' && $this_user_priv ==
'admin') {
104 }
elseif ($demo_allowed && $this_user_priv ==
'demo') {
108 if (strpos($requested_priv,
'*') !==
false) {
110 if (strpos($requested_priv, substr($this_user_priv, 0, strpos($requested_priv,
'*'))) === 0) {
113 }
elseif ($this_user_priv == $requested_priv) {
134 function insere_utilisateur(&
$frm, $password_already_encoded =
false, $send_user_confirmation =
false, $warn_admin_if_template_active =
true, $skip_existing_account_tests =
false)
136 $sql_condition_array = array();
139 $user_low_priviledges_array =
vb(
$GLOBALS[
'site_parameters'][
'user_low_priviledges_array'], array(
'load',
'newsletter'));
141 $manual_validation_registration =
vb(
$GLOBALS[
'site_parameters'][
'manual_validation_registration'], array());
143 if (!empty(
$frm[
'priv'])) {
144 if(is_array(
$frm[
'priv'])) {
145 $frm[
'priv'] = implode(
'+',
$frm[
'priv']);
148 if(!empty(
$GLOBALS[
'site_parameters'][
'user_creation_default_profile'])) {
150 $allowed_profil = array();
154 $allowed_profil[] =
$result[
'priv'];
156 if (in_array(
$GLOBALS[
'site_parameters'][
'user_creation_default_profile'], $allowed_profil)) {
157 $frm[
'priv'] =
$GLOBALS[
'site_parameters'][
'user_creation_default_profile'];
160 $frm[
'priv'] =
'util';
164 $frm[
'priv'] =
'util';
167 if (!empty(
$frm[
'email'])) {
170 if (empty(
$GLOBALS[
'site_parameters'][
'pseudo_is_not_used']) && !empty(
$frm[
'pseudo'])) {
173 if (!empty($sql_condition_array)) {
174 if (!empty(
$frm[
'priv']) && !in_array(
$frm[
'priv'], $user_low_priviledges_array)) {
177 $sql =
"SELECT id_utilisateur, priv
178 FROM peel_utilisateurs
179 WHERE (" . implode(
' OR ', $sql_condition_array).
") AND priv IN ('" . implode(
"', '",
real_escape_string($user_low_priviledges_array)) .
"') AND " .
get_filter_site_cond(
'utilisateurs') .
'';
182 query(
"DELETE FROM peel_utilisateurs
183 WHERE id_utilisateur='" . intval($user_already_exists_infos[
'id_utilisateur']) .
"' AND " .
get_filter_site_cond(
'utilisateurs') .
"");
186 if (!$skip_existing_account_tests) {
189 $sql =
"SELECT id_utilisateur
190 FROM peel_utilisateurs
191 WHERE (" . implode(
' OR ', $sql_condition_array).
") AND " .
get_filter_site_cond(
'utilisateurs') .
"";
195 return $user_already_exists_infos[
'id_utilisateur'];
199 if (!isset(
$frm[
'remise_percent'])) {
202 $remise_percent = (float)
$frm[
'remise_percent'];
204 if (!empty(
$frm[
'mot_passe']) && $password_already_encoded) {
205 $password_hash = trim(
$frm[
'mot_passe']);
208 }
elseif(empty(
$frm[
'mot_passe']) && !empty(
$GLOBALS[
'site_parameters'][
'register_during_order_process'])) {
216 if (!empty(
$frm[
'date_insert'])) {
217 $date_insert =
$frm[
'date_insert'];
219 $date_insert = date(
'Y-m-d H:i:s', time());
221 if (!empty(
$frm[
'date_update'])) {
222 $date_update =
$frm[
'date_update'];
224 $date_update = date(
'Y-m-d H:i:s', time());
226 if (isset(
$frm[
'points'])) {
227 $points =
$frm[
'points'];
232 if (in_array(
$frm[
'priv'], $manual_validation_registration)) {
239 if(defined(
'IN_REGISTER')) {
240 $form_usage =
'user';
242 $form_usage =
'reseller';
244 if(!empty($form_usage)) {
248 if(empty(
$frm[
'lang'])) {
251 if(!isset(
$frm[
'site_id'])) {
254 if(!defined(
'PEEL_ADMIN')) {
258 if(!empty(
$GLOBALS[
'site_parameters'][
'site_country_forced_by_user']) && !empty(
$GLOBALS[
'site_parameters'][
'site_country_allowed_array'])) {
259 if(in_array(strval(
vb(
$frm[
'pays'])),
$GLOBALS[
'site_parameters'][
'site_country_allowed_array'])) {
260 $frm[
'site_country'] =
$frm[
'pays'];
266 $sql =
"INSERT INTO peel_utilisateurs (
289 , intracom_for_billing
310 " . (!empty(
$frm[
'id_categories'])?
', id_categories':
'') .
"
311 " . (!empty(
$frm[
'id_cat_1'])?
', id_cat_1':
'') .
"
312 " . (!empty(
$frm[
'id_cat_2'])?
', id_cat_2':
'') .
"
313 " . (!empty(
$frm[
'id_cat_3'])?
', id_cat_3':
'') .
"
320 , project_product_proposed
321 , project_date_forecasted
322 , commercial_contact_id
329 " . (!empty(
$frm[
'id_utilisateur'])?
', id_utilisateur':
'') .
"
330 " . (!empty(
$frm[
'control_plus'])?
', control_plus':
'') .
"
331 " . (!empty(
$frm[
'note_administrateur'])?
', note_administrateur':
'') .
"
332 " . (isset(
$frm[
'logo'])?
', logo':
'') .
"
333 " . (isset(
$frm[
'devise'])?
", devise":
'') .
"
334 " . (isset(
$frm[
'site_country'])?
", site_country":
'') .
"
335 , description_document
336 " . (!empty(
$frm[
'document'])?
", document " :
"") .
"
340 , address_bill_default
341 , address_ship_default
358 , '" . intval(
vn(
$frm[
'pays'])) .
"'
359 , '" . intval(
vn(
$frm[
'newsletter'])) .
"'
360 , '" . intval(
vn(
$frm[
'commercial'])) .
"'
362 , '" . intval(
vb($points)) .
"'
383 , '" . intval(
vn(
$frm[
'on_vacances'])) .
"'
386 " . (!empty(
$frm[
'id_categories'])?
",'" . implode(
"','",
$frm[
'id_categories']) :
"") .
"
387 " . (!empty(
$frm[
'id_cat_1'])?
', ' . intval(
vn(
$frm[
'id_cat_1'])):
'') .
"
388 " . (!empty(
$frm[
'id_cat_2'])?
', ' . intval(
vn(
$frm[
'id_cat_2'])):
'') .
"
389 " . (!empty(
$frm[
'id_cat_3'])?
', ' . intval(
vn(
$frm[
'id_cat_3'])):
'') .
"
398 , '" . intval(
vn(
$frm[
'commercial_contact_id'])) .
"'
400 , '" . intval(
vn(
$frm[
'on_client_module'])) .
"'
401 , '" . intval(
vn(
$frm[
'on_photodesk'])) .
"'
404 , '" . intval(
$frm[
'etat']) .
"'
405 " . (!empty(
$frm[
'id_utilisateur'])?
', ' . intval(
$frm[
'id_utilisateur']):
'') .
"
406 " . (!empty(
$frm[
'control_plus'])?
', ' . intval(
$frm[
'control_plus']):
'') .
"
407 " . (!empty(
$frm[
'note_administrateur'])?
', ' . intval(
$frm[
'note_administrateur']):
'') .
"
413 " . (!empty(
$frm[
'specific_field_values'])?
", '" . implode(
"','",
real_escape_string(
$frm[
'specific_field_values'])) .
"'" :
"") .
"
422 $code_client =
"CLT" . date(
"Y") .
$frm[
'id'];
424 query(
"UPDATE peel_utilisateurs
428 if ($send_user_confirmation) {
432 if ($warn_admin_if_template_active) {
439 $custom_template_tags[
'PRIV'] = $qid[
'name'];
440 $custom_template_tags[
'CIVILITE'] =
$frm[
'civilite'];
441 $custom_template_tags[
'PRENOM'] =
$frm[
'prenom'];
442 $custom_template_tags[
'NOM_FAMILLE'] =
$frm[
'nom_famille'];
443 $custom_template_tags[
'EMAIL'] =
$frm[
'email'];
445 $custom_template_tags[
'SOCIETE'] =
$frm[
'societe'];
446 $custom_template_tags[
'TELEPHONE'] =
$frm[
'telephone'];
447 $custom_template_tags[
'ADMIN_URL'] =
$GLOBALS[
'administrer_url'] .
'/utilisateurs.php?mode=modif&id_utilisateur=' .
$frm[
'id'] .
'&start=0';
449 if (
$frm[
'priv'] ==
'stop') {
450 $template_technical_code =
'warn_admin_reve_subscription';
452 $template_technical_code =
'warn_admin_user_subscription';
454 send_email(
$GLOBALS[
'support_sav_client'],
'',
'', $template_technical_code, $custom_template_tags, null,
$GLOBALS[
'support_sav_client']);
469 if (empty(
$frm[
'id_utilisateur'])) {
472 if (isset(
$frm[
'priv'])) {
473 if(is_array(
$frm[
'priv'])) {
479 if(!$update_current_session && !
a_priv(
'admin',
false,
true)) {
480 if(
a_priv(
'admin*',
false,
false,
$frm[
'id_utilisateur'])) {
488 $form_usage =
'reseller';
490 $form_usage =
'user';
494 if(empty(
$frm[
'lang'])) {
497 if(!isset(
$frm[
'site_id'])) {
500 if (empty($this_user) || $this_user[
'site_id']>0) {
506 $sql =
"UPDATE peel_utilisateurs SET
519 , pays = '" . intval(
$frm[
'pays']) .
"'
520 , newsletter = '" . intval(
vn(
$frm[
'newsletter'])) .
"'
521 , commercial = '" . intval(
vn(
$frm[
'commercial'])) .
"'
523 , date_update = '" . date(
'Y-m-d H:i:s', time()) .
"'
525 " . (!empty(
$frm[
'email'])?
", email_bounce = ''":
"") .
"
529 " . (isset(
$frm[
'note_administrateur'])?
", note_administrateur = '" . intval(
$frm[
'note_administrateur']) .
"'":
"") .
"
530 " . (isset(
$frm[
'control_plus'])?
", control_plus = '" . intval(
$frm[
'control_plus']) .
"'":
"") .
"
535 " . (isset(
$frm[
'points'])?
", points = '" . intval(
$frm[
'points']) .
"'":
"") .
"
550 , on_vacances = '" . intval(
vn(
$frm[
'on_vacances'])) .
"'
551 " . (isset(
$frm[
'id_groupe'])?
", id_groupe = '" . intval(
vn(
$frm[
'id_groupe'])) .
"'":
"") .
"
570 " . (isset(
$frm[
'commercial_contact_id'])?
", commercial_contact_id = '" . intval(
vn(
$frm[
'commercial_contact_id'])) .
"'":
"") .
"
571 , on_client_module = '" . intval(
vn(
$frm[
'on_client_module'])) .
"'
572 , on_photodesk = '" . intval(
vn(
$frm[
'on_photodesk'])) .
"'
580 " . (!empty(
$frm[
'specific_field_sql_set'])?
"," . implode(
',',
$frm[
'specific_field_sql_set']) :
"") .
"
581 WHERE id_utilisateur = '" . intval(
$frm[
'id_utilisateur']) .
"'";
584 if ($update_current_session) {
587 FROM peel_utilisateurs
589 $qid =
query($requete);
591 $_SESSION[
'session_utilisateur'][
'pays'] = $user_infos[
'pays'];
592 $_SESSION[
'session_utilisateur'][
'civilite'] =
vb($user_infos[
'civilite']);
593 $_SESSION[
'session_utilisateur'][
'prenom'] = $user_infos[
'prenom'];
594 $_SESSION[
'session_utilisateur'][
'pseudo'] = $user_infos[
'pseudo'];
595 $_SESSION[
'session_utilisateur'][
'nom_famille'] = $user_infos[
'nom_famille'];
596 $_SESSION[
'session_utilisateur'][
'societe'] = $user_infos[
'societe'];
598 $_SESSION[
'session_utilisateur'][
'telephone'] = $user_infos[
'telephone'];
599 $_SESSION[
'session_utilisateur'][
'fax'] = $user_infos[
'fax'];
600 $_SESSION[
'session_utilisateur'][
'portable'] = $user_infos[
'portable'];
601 $_SESSION[
'session_utilisateur'][
'adresse'] = $user_infos[
'adresse'];
602 $_SESSION[
'session_utilisateur'][
'code_postal'] = $user_infos[
'code_postal'];
603 $_SESSION[
'session_utilisateur'][
'ville'] = $user_infos[
'ville'];
604 $_SESSION[
'session_utilisateur'][
'newsletter'] = intval(
vn($user_infos[
'newsletter']));
605 $_SESSION[
'session_utilisateur'][
'commercial'] = intval(
vn($user_infos[
'commercial']));
606 $_SESSION[
'session_utilisateur'][
'format'] =
vb(
$GLOBALS[
'site_parameters'][
'email_sending_format_default'],
'html');
609 if (!empty(
$frm[
'email'])) {
611 include_once(
$GLOBALS[
'dirroot'] .
"/modules/bounces/bounce_driver.php");
612 resolve_bounce(
$frm[
'id_utilisateur'],
$frm[
'email']);
615 if (!empty(
$frm[
'comments'])) {
634 query(
"DELETE FROM peel_utilisateurs
648 $qid =
query(
"SELECT id_utilisateur, mot_passe
649 FROM peel_utilisateurs
654 $hash = sha256($email . $timestamp . $utilisateur[
'id_utilisateur'] . $utilisateur[
'mot_passe']);
656 $custom_template_tags[
'LINK'] = get_url(
'/utilisateurs/oubli_mot_passe.php', array(
'hash' => $hash,
'time' => $timestamp,
'email' => $email));
657 $custom_template_tags[
'SITE'] =
$GLOBALS[
'site'];
658 $result =
send_email($email,
'',
'',
'initialise_mot_passe', $custom_template_tags, null,
$GLOBALS[
'support_sav_client']);
674 query(
"UPDATE peel_utilisateurs
675 SET mot_passe = '" .
get_user_password_hash($nouveau_mot_passe) .
"', date_update='" . date(
'Y-m-d H:i:s', time()) .
"'
676 WHERE id_utilisateur = '" . intval($user_id) .
"' AND " .
get_filter_site_cond(
'utilisateurs') .
"");
694 function user_login_now($email_or_pseudo, $mot_passe, $check_password =
true, $password_given_as_first_password_hash =
false, $password_length_if_given_as_first_password_hash = null)
696 if (empty(
$_SESSION[
'session_login_tried'])) {
700 if (
$_SESSION[
'session_login_tried'] < 30) {
702 $utilisateur =
verifier_authentification(trim($email_or_pseudo), trim($mot_passe), null, $check_password, $password_given_as_first_password_hash, $password_length_if_given_as_first_password_hash);
705 unset(
$_SESSION[
'session_update_account']);
707 $_SESSION[
'session_utilisateur'] = $utilisateur;
708 $_SESSION[
'session_ip'] =
vb($_SERVER[
'REMOTE_ADDR']);
709 $_SESSION[
'session_url'] = $_SERVER[
'HTTP_HOST'];
710 if (!empty(
$_SESSION[
'session_caddie'])) {
713 if (!empty(
$_SESSION[
'session_utilisateur'][
'pays'])) {
715 $sqlUserZone =
'SELECT zone
719 $resUserZone =
query($sqlUserZone);
721 $_SESSION[
'session_utilisateur'][
'zoneId'] = $Zone[
'zone'];
726 $_SESSION[
'session_utilisateur'][
'site_id'] = 0;
728 if (!empty(
$_SESSION[
'session_utilisateur'][
'devise'])) {
731 if (!empty(
$_SESSION[
'session_utilisateur'][
'site_country'])) {
733 $_SESSION[
'session_site_country'] = intval(
$_SESSION[
'session_utilisateur'][
'site_country']);
740 $custom_template_tags[
'USER'] = $email_or_pseudo;
741 $custom_template_tags[
'REVERSE_DNS'] = gethostbyaddr(
vb($_SERVER[
'REMOTE_ADDR']));
742 send_email(
$GLOBALS[
'support_sav_client'],
'',
'',
'admin_login', $custom_template_tags, null,
$GLOBALS[
'support'],
true,
false,
true,
$GLOBALS[
'support']);
745 if (!empty(
$_SESSION[
'session_utilisateur'][
'pseudo'])) {
746 $user_pseudo =
$_SESSION[
'session_utilisateur'][
'pseudo'];
748 $user_pseudo =
$_SESSION[
'session_utilisateur'][
'email'];
751 query(
'INSERT INTO peel_utilisateur_connexions (user_id, user_login, user_ip, date, site_id)
756 if (!empty(
$GLOBALS[
'site_parameters'][
'redirect_user_after_login_by_priv'][$utilisateur[
'priv']])) {
779 function verifier_authentification($email_or_pseudo, $mot_passe, $user_id = null, $check_password =
true, $password_given_as_first_password_hash =
false, $password_length_if_given_as_first_password_hash = null)
782 if (!in_array(
'site_id', $get_table_field_names)) {
783 $GLOBALS[
'site_parameters'][
'multisite_disable'] =
true;
784 $skip_state_test =
true;
788 FROM peel_utilisateurs
789 WHERE " . (empty($skip_state_test)?
"etat=1":
"") .
" AND " .
get_filter_site_cond(
'utilisateurs') .
" AND priv NOT IN ('".implode(
"','",
$GLOBALS[
'disable_login_by_privilege']).
"') AND ";
790 if (!empty($email_or_pseudo)) {
793 $requete .=
"id_utilisateur='" . intval($user_id) .
"'";
795 $qid =
query($requete);
797 if (!empty($user_infos) && (!$check_password ||
get_user_password_hash($mot_passe, $user_infos[
'mot_passe'], $password_given_as_first_password_hash, $password_length_if_given_as_first_password_hash))) {
798 if(!$check_password &&
String::strpos($user_infos[
'priv'],
'admin') === 0) {
800 $user_infos[
'priv'] =
'util';
817 function get_user_password_hash($password, $tested_hash = null, $password_given_as_first_password_hash =
false, $password_length_if_given_as_first_password_hash = null)
819 if ($tested_hash == md5($password)) {
825 if (!$password_given_as_first_password_hash) {
827 $first_password_hash = sha256(
vb(
$GLOBALS[
'site_parameters'][
'sha256_encoding_salt']) . $password);
831 $first_password_hash = $password;
832 $salt_start = $password_length_if_given_as_first_password_hash;
835 if ($tested_hash == null) {
836 $salt_hash =
String::substr(sha256(
vb(
$GLOBALS[
'site_parameters'][
'sha256_encoding_salt']) . uniqid(mt_rand(),
true)), 0, 6);
841 if ($salt_start > 0 && $salt_start <
String::strlen($salt_hash)) {
842 $first_password_hash_start =
String::substr($first_password_hash, 0, $salt_start);
843 $first_password_hash_end =
String::substr($first_password_hash, $salt_start, strlen($salt_hash));
844 $hash_rough = sha256(
vb(
$GLOBALS[
'site_parameters'][
'sha256_encoding_salt']) . $first_password_hash_end . $salt_hash . $first_password_hash_start);
845 }
elseif ($salt_start > (strlen($salt_hash) - 1)) {
846 $hash_rough = sha256(
vb(
$GLOBALS[
'site_parameters'][
'sha256_encoding_salt']) . $first_password_hash . $salt_hash);
848 $hash_rough = sha256(
vb(
$GLOBALS[
'site_parameters'][
'sha256_encoding_salt']) . $salt_hash . $first_password_hash);
852 if (empty($tested_hash) || $tested_hash == $password_hash) {
853 return $password_hash;
869 $custom_template_tags[
'EMAIL'] = $email;
870 $custom_template_tags[
'MOT_PASSE'] = $mot_passe;
874 if (!empty($template_infos) && (!empty($template_infos[
'subject']) || !empty($template_infos[
'text']))) {
876 send_email($email, $template_infos[
'subject'], $template_infos[
'text'],
"", $custom_template_tags, null,
$GLOBALS[
'support_sav_client']);
880 $result =
send_email($email,
"",
"",
'send_mail_for_account_creation', $custom_template_tags, null,
$GLOBALS[
'support_sav_client']);
893 return $user_infos[
'prenom'] .
' ' . $user_infos[
'nom_famille'];
908 static $result_array;
911 $user_id =
$_SESSION[
'session_utilisateur'][
'id_utilisateur'];
914 $sql_cond .=
" AND priv NOT LIKE '%admin%' AND priv NOT LIKE '%reve%'";
916 $cache_id = md5($user_id.$sql_cond.($get_full_infos?
'full':
''));
917 if (!empty($user_id)) {
918 if (!isset($result_array[$cache_id])) {
919 $qid =
query(
"SELECT *
920 FROM peel_utilisateurs
921 WHERE id_utilisateur = '" . intval($user_id) .
"' AND " .
get_filter_site_cond(
'utilisateurs') .
"" . $sql_cond);
923 if(!empty($result_array[$cache_id]) && $get_full_infos) {
924 $hook_result =
call_module_hook(
'user_get_information_full', array(
'id' => $user_id,
'etat' => $result_array[$cache_id][
'etat']),
'array');
925 $result_array[$cache_id] = array_merge_recursive($result_array[$cache_id],
$hook_result);
928 return $result_array[$cache_id];
941 if(empty(
$_SESSION[
'session_utilisateur'][
'calculated_promotion_percentage'])) {
943 $user_specific_discount =
vn(
$_SESSION[
'session_utilisateur'][
'remise_percent']);
944 if(!empty(
$GLOBALS[
'site_parameters'][
'group_and_user_discount_cumulate_disable'])) {
945 $_SESSION[
'session_utilisateur'][
'calculated_promotion_percentage'] = max($user_specific_discount, $hook_result_percent);
947 $_SESSION[
'session_utilisateur'][
'calculated_promotion_percentage'] = (1 - (1 - $user_specific_discount / 100) * (1 - $hook_result_percent / 100)) * 100;
950 return $_SESSION[
'session_utilisateur'][
'calculated_promotion_percentage'];
962 $user_id =
$_SESSION[
'session_utilisateur'][
'id_utilisateur'];
964 if (!empty($user_id)) {
986 $resProfil =
query(
"SELECT *, name_".
$_SESSION[
'session_langue'].
" AS name
989 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'priv_options.tpl');
994 'value' => $Profil[
'priv'],
995 'issel' => ($Profil[
'priv'] == $preselectionne),
996 'name' => $Profil[
'name']
1020 $q =
query(
'SELECT id_utilisateur
1021 FROM peel_utilisateurs
1024 return $user[
'id_utilisateur'];
1041 if (!empty($_SERVER[
'HTTP_USER_AGENT'])) {
1042 return base_convert(
String::substr(md5($_SERVER[
'HTTP_USER_AGENT']), 9, 8), 16, 10);
1058 function get_trader_select_options($selected_trader_name = null, $selected_trader_id = null, $option_value =
'name', $is_admin_mode =
false, $display_inactive_trader =
false)
1060 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'trader_select_options.tpl');
1061 $tpl->assign(
'STR_NOT_ATTRIBUED',
$GLOBALS[
'STR_NOT_ATTRIBUED']);
1062 $tpl->assign(
'is_admin_mode', $is_admin_mode);
1063 $sql_condition =
'';
1064 if (empty($selected_trader_name) && empty($selected_trader_id)) {
1065 $selected_country_id = 0;
1067 if (!$display_inactive_trader) {
1068 $sql_condition .=
' AND u.etat = "1"';
1070 $sql_trader =
'SELECT u.id_utilisateur, u.nom_famille , u.prenom
1071 FROM peel_utilisateurs u
1072 WHERE u.priv LIKE "admin%" AND ' .
get_filter_site_cond(
'utilisateurs',
'u') .
' ' . $sql_condition .
'
1073 ORDER BY u.id_utilisateur';
1074 $res_trader =
query($sql_trader);
1077 if ($option_value ==
'name') {
1078 $value = $tab_trader[
'prenom'] .
' ' . $tab_trader[
'nom_famille'];
1079 }
elseif ($option_value ==
'id') {
1080 $value = $tab_trader[
'id_utilisateur'];
1082 $trader_name = $tab_trader[
'prenom'] .
' ' . $tab_trader[
'nom_famille'];
1085 'issel' => (
vb($selected_trader_name) == $trader_name ||
vb($selected_trader_id) == $tab_trader[
'id_utilisateur']),
1086 'name' => $trader_name
1090 return $tpl->fetch();
1099 if ((!isset(
$_SESSION[
'session_update_account']) ||
$_SESSION[
'session_update_account'] < time()) || defined(
'IN_MESSAGING')) {
1102 $_SESSION[
'session_update_account'] = time() +
vb(
$GLOBALS[
'site_parameters'][
'account_update_interval'], 60);
1120 $sql =
'SELECT id, nom
1122 WHERE id_utilisateur="' . intval(
$id_utilisateur) .
'" AND address_type IN ("","'.real_escape_string($address_type).
'")';
1125 <select class="form-control" onchange="if(this.value){this.form.submit()}" name="personal_address_' .
String::str_form_value($address_type) .
'" style="' . $css_style.
'">
1126 <option value="">' .
$GLOBALS[
'STR_ADDRESS'] .
'....</option>
1127 <option value="original_address"' .
frmvalide($selected ==
'original_address',
' selected="selected"') .
'>' .
$GLOBALS[
'STR_DEFAULT_ADDRESS'] .
'</option>';
1130 <option value="' . intval(
$result[
'id']) .
'"' .
frmvalide($selected ==
$result[
'id'],
' selected="selected"') .
'>' .
$result[
'nom'] .
'</option>';
1132 if($add_manage_choice) {
1134 <option value="">-----</option>
1135 <option value="manage">' .
$GLOBALS[
'STR_ADDRESS_TEXT'] .
'</option>';
1152 if(empty(
$_SESSION[
'session_utilisateur'][
'id_utilisateur'])) {
1155 if(!empty(
$frm[
'portable'])) {
1156 $tel =
$frm[
'portable'];
1158 $tel =
$frm[
'contact1'];
1174 , pays = '" . intval(
$frm[
'pays']) .
"'
1175 , id_utilisateur = '" . intval(
$_SESSION[
'session_utilisateur'][
'id_utilisateur']) .
"'";
1176 if (!empty(
$frm[
'id'])) {
1177 return query(
"UPDATE peel_adresses SET
1179 WHERE id = '" . intval(
vn(
$frm[
'id'])) .
"'");
1181 return query(
"INSERT INTO peel_adresses SET
get_profil_select_options($selected_priv=null)
get_profil_select_options()
static strtoupper($string)
Returns string with all alphabetic characters converted to uppercase.
getUserAgentHash()
Renvoie une trace du navigateur utilisé par un utilisateur pour faciliter les rapprochements entre co...
if(!empty($GLOBALS['site_parameters']['order_specific_field_titles'])) if(check_if_module_active('socolissimo')&&!empty($_REQUEST)&&!empty($_REQUEST['PUDOFOID'])&&!empty($_REQUEST['CEEMAIL'])&&!empty($_REQUEST['SIGNATURE'])&&!empty($_REQUEST['ORDERID'])) elseif(!empty($_POST)) elseif(check_if_module_active('socolissimo')&&!empty($_SESSION['session_commande']['is_socolissimo_order'])) foreach(array('bill'=> 1, 'ship'=> 2) as $address_type=> $session_commande_address_id) $frm['societe1']
get_trader_select_options($selected_trader_name=null, $selected_trader_id=null, $option_value= 'name', $is_admin_mode=false, $display_inactive_trader=false)
get_trader_select_options()
get_user_information($user_id=null, $get_full_infos=false)
Chargement des détails de l'utilisateur.
get_personal_address_form($id_utilisateur, $address_type= 'bill', $selected=null, $add_manage_choice=true, $css_style=null)
Retourne le menu déroulant avec la lsite des adresses disponibles par utilisateur.
static strpos($haystack, $needle, $offset=0)
Returns the numeric position of the first occurrence of needle in the haystack string.
is_user_tva_intracom_for_no_vat($user_id=null)
is_user_tva_intracom_for_no_vat()
get_priv_options($preselectionne, $return_mode=false)
get_priv_options()
initialise_mot_passe($email)
Initialise le renouvellement de mot de passe.
insere_utilisateur(&$frm, $password_already_encoded=false, $send_user_confirmation=false, $warn_admin_if_template_active=true, $skip_existing_account_tests=false)
Ajout d'un utilisateur.
redirect_and_die($url, $permanent_redirection=false, $avoid_loop=false)
Redirige vers l'URL demandée et arrête le programme.
handle_specific_fields(&$frm, $form_usage= 'user')
Traite la réception de champs spécifiques venant d'un formulaire, et l'identification de tous les cha...
affected_rows($database_object=null)
affected_rows()
word_real_escape_string($value)
Applique real_escape_string dans le cas où on n'insère qu'un seul mot, de moins de 30 caractères...
efface_utilisateur($id_utilisateur)
efface_utilisateur()
insert_id($database_object=null)
insert_id()
static strlen($string)
Returns the length of the given string.
nohtml_real_escape_string($value, $allowed_tags=null)
Protège les données pour insertion dans MySQL ET supprime les tags HTML pour protéger de toute sorte ...
if(!empty($_GET['id'])) if(isset($_POST['form_name'], $_POST['form_subject'], $_POST['form_text'], $_POST['form_lang'])&&empty($_GET['id'])) if(empty($_GET['id'])) $tpl
get_current_user_promotion_percentage()
Calcule la réduction générale applicable à un utilisateur et garde la valeur en session pour accélére...
real_escape_string($value)
real_escape_string()
get_filter_site_cond($table_technical_code, $table_alias=null, $use_strict_rights_if_in_admin=false, $specific_site_id=null, $exclude_public_items=false, $admin_force_multisite_if_allowed=false)
Retourne la condition SQL permettant de filtrer les données pour une table.
get_user_id_from_email($email)
Fonction de recherche d'id utilisateur par l'email.
query($query, $die_if_error=false, $database_object=null, $silent_if_error=false, $security_sql_filter=true)
The query() function is meant to be called anywhere you want to make a query.
if(!defined('IN_PEEL')) est_identifie()
Retourne true si l'utilisateur est identifié
static str_form_value($value, $flags=ENT_COMPAT)
Encode une chaine de caractères pour affichage dans un value="".
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))
get_user_password_hash($password, $tested_hash=null, $password_given_as_first_password_hash=false, $password_length_if_given_as_first_password_hash=null)
get_user_password_hash()
num_rows($query_result)
num_rows()
EmailOK($email)
Vérification du format d'adresse email trouvée sur http://www.phpinfo.net/?p=trucs&rub=astuces.
if(!defined('IN_PEEL')) send_email($to, $mail_subject= '', $mail_content= '', $template_technical_code=null, $template_tags=null, $format=null, $sender=null, $html_add_structure=true, $html_correct_conformity=false, $html_convert_url_to_links=true, $reply_to=null, $attached_files_infos_array=null, $lang=null, $additional_infos_array=array(), $attachment_not_sent_by_email=false)
Envoi d'un email à un utilisateur.
get_table_field_names($table_name, $link_identifier=null, $silent_if_error=false)
get_table_field_names()
updateTelContactNotClosed()
updateTelContactNotClosed()
fetch_assoc($query_result)
fetch_assoc()
call_module_hook($hook, $params, $mode= 'boolean')
Appelle la fonction correspondant au $hook pour chaque module installé La fonction doit s'appeler : [...
create_or_update_comments($frm)
set_current_devise($currency_id_or_code, $reference_country_id=null)
set_current_devise()
$GLOBALS['page_columns_count']
get_all_sites_name_array($admin_force_multisite_if_allowed=false, $allow_null_site_id=false, $skip_rights_check=false)
Retourne un tableau des noms des sites configurés en fonction des droits de l'administrateur.
getTextAndTitleFromEmailTemplateLang($template_technical_code, $template_lang, $template_technical_id=null)
getTextAndTitleFromEmailTemplateLang()
send_mail_for_account_creation($email, $mot_passe, $priv)
Envoi d'email lors de la création d'un utilisateur.
account_update()
Met à jour les informations de l'utilisateur connecté, telles que pour de la messagerie interne...
getUsername($user_id)
getUsername()
get_site_id_sql_set_value($site_ids)
Retourne la valeur SQL d'un champ INT ou SET suivant que ce soit un entier ou un tableau.
a_priv($requested_priv, $demo_allowed=false, $site_configuration_modification=false, $user_id=null)
Renvoie true si l'utilisateur de la session a le privilège $requested_priv ou un droit supérieur Des ...
maj_utilisateur(&$frm, $update_current_session=false)
Mise à jour d'un enregistrement d'utilisateur.
MDP($chrs=8)
Fonction utilisée pour générer un mot aléatoire (sert par exemple pour le renommage des fichiers imag...
verifier_authentification($email_or_pseudo, $mot_passe, $user_id=null, $check_password=true, $password_given_as_first_password_hash=false, $password_length_if_given_as_first_password_hash=null)
On renvoie un tableau contenant les informations utilisateur si l'email et le mot de passe sont bons...
user_login_now($email_or_pseudo, $mot_passe, $check_password=true, $password_given_as_first_password_hash=false, $password_length_if_given_as_first_password_hash=null)
user_login_now()
static substr($string, $start, $length=null)
Returns the portion of string specified by the start and length parameters.
maj_mot_passe($user_id, $nouveau_mot_passe)
Enregistre le nouveau mot de passe.
check_if_module_active($module_name, $specific_file_name=null)
Renvoie si un module est présent et activé ou non - Peut être appelé avant ou après le chargement d'u...
insert_or_update_address($frm)
Met à jour l'adresse en base de données.
if(defined('IN_PEEL_ADMIN')||IN_INSTALLATION) $_SESSION['session_langue']