14 if (!defined(
'IN_PEEL')) {
39 return substr(sha256(
$GLOBALS[
'site_parameters'][
'sha256_encoding_salt'] . mt_rand(0, 9999999)), 0, 32);
49 function MDP($chrs = 8)
54 $chr = chr(mt_rand(0, 255));
56 if (preg_match(
"/^[a-hj-km-np-zA-HJ-KM-NP-Z2-9]$/i", $chr)) {
72 if ($use_existing_token && !empty(
$_SESSION[
'token_' . $name])) {
73 $_SESSION[
'token_time_' . $name] = time();
76 $_SESSION[
'token_' . $name] = md5(uniqid(mt_rand()));
77 $_SESSION[
'token_time_' . $name] = time();
79 $_SESSION[
'token_referer_' . $name] =
'http://' . $_SERVER[
'HTTP_HOST'] . $_SERVER[
'REQUEST_URI'];
80 if (!empty($_SERVER[
'HTTPS']) && $_SERVER[
'HTTPS'] !=
'off') {
81 $_SESSION[
'token_referer_' . $name] = str_replace(
'http://',
'https://',
$_SESSION[
'token_referer_' . $name]);
97 if ($return_as_input_form) {
118 function verify_token($name =
'general', $delay_in_minutes = 60, $check_referer_if_set_by_server =
true, $cancel_token =
true, $minimum_wait_in_seconds_before_use = 0)
120 if (!empty($_POST[
'token'])) {
121 $user_token = $_POST[
'token'];
122 }
elseif (!empty($_GET[
'token'])) {
123 $user_token = $_GET[
'token'];
127 if (isset(
$_SESSION[
'token_' . $name]) && isset(
$_SESSION[
'token_time_' . $name]) && !empty($user_token)) {
128 if (
$_SESSION[
'token_' . $name] == $user_token &&
$_SESSION[
'token_time_' . $name] + $delay_in_minutes * 60 >= time() &&
$_SESSION[
'token_time_' . $name] + $minimum_wait_in_seconds_before_use <= time()) {
129 if (!$check_referer_if_set_by_server || !isset($_SERVER[
'HTTP_REFERER']) || $_SERVER[
'HTTP_REFERER'] ==
$_SESSION[
'token_referer_' . $name]) {
151 static $studied_cats_array;
152 $hash = md5(serialize($all_parents_with_ordered_direct_sons_array));
153 if(!count($ids_array)) {
155 unset($studied_cats_array[$hash]);
157 if(empty($studied_cats_array[$hash][
$catid])) {
158 $studied_cats_array[$hash][
$catid] =
true;
159 foreach ($all_parents_with_ordered_direct_sons_array[$catid] as $son_catid) {
160 $ids_array[] = $son_catid;
161 if (!empty($all_parents_with_ordered_direct_sons_array[$son_catid])) {
162 $ids_array =
get_sons_cat($all_parents_with_ordered_direct_sons_array, $son_catid, $ids_array);
178 $cache_id =
'calcul_nbprod_parcat_' .
$catid .
'_' .
$GLOBALS[
'site_parameters'][
'category_count_method'] .
'_' .
$GLOBALS[
'site_id'];
179 if (!empty($all_parents_with_ordered_direct_sons_array) && !empty($all_parents_with_ordered_direct_sons_array[
$catid])) {
180 $cache_id .=
'_' . md5(serialize($all_parents_with_ordered_direct_sons_array[$catid]));
182 $this_cache_object =
new Cache($cache_id, array(
'group' =>
'data'));
183 if ($this_cache_object->testTime(900,
true)) {
184 $results_count = $this_cache_object->get();
186 if (
$GLOBALS[
'site_parameters'][
'category_count_method'] ==
'global' && !empty($all_parents_with_ordered_direct_sons_array) && !empty($all_parents_with_ordered_direct_sons_array[$catid])) {
188 $ids_array =
get_sons_cat($all_parents_with_ordered_direct_sons_array, $catid);
190 if(empty($ids_array)) {
192 $ids_array = array($catid);
194 $sql =
"SELECT COUNT(*) AS this_count
196 INNER JOIN peel_produits_categories pc ON pc.produit_id = p.id
200 $results_count = $this_count[
'this_count'];
202 $results_count = null;
204 $this_cache_object->save($results_count);
206 unset($this_cache_object);
207 return $results_count;
218 $resCount =
query(
"SELECT COUNT(*) AS this_count
220 INNER JOIN peel_articles_rubriques pa ON pa.article_id = p.id
221 WHERE pa.rubrique_id = '" . intval($rub) .
"' AND p.etat='1' AND " .
get_filter_site_cond(
'articles',
'p') .
"");
223 return $count[
'this_count'];
242 function fprix($price, $display_currency =
false, $currency_code_or_default = null, $convertion_needed_into_currency =
true,
$currency_rate = null, $display_iso_currency_code =
false, $format =
true, $force_format_separator = null, $add_rdfa_properties =
false, $round_even_if_no_format =
false)
244 static $currency_infos_by_code;
249 if (!empty($currency_code_or_default)) {
250 if (!isset($currency_infos_by_code[$currency_code_or_default])) {
252 $req =
"SELECT code, conversion, symbole, symbole_place
256 $currency_infos_by_code[$currency_code_or_default] =
fetch_assoc($res);
258 if (!empty($currency_infos_by_code[$currency_code_or_default])) {
259 $currency_code = $currency_infos_by_code[$currency_code_or_default][
'code'];
260 $currency_symbole =
String::html_entity_decode(str_replace(
'€',
'€', $currency_infos_by_code[$currency_code_or_default][
'symbole']));
261 $currency_rate_item = $currency_infos_by_code[$currency_code_or_default][
'conversion'];
262 $symbole_place = $currency_infos_by_code[$currency_code_or_default][
'symbole_place'];
265 if (empty($currency_symbole)) {
267 $currency_code =
$_SESSION[
'session_devise'][
'code'];
268 $currency_symbole =
$_SESSION[
'session_devise'][
'symbole'];
269 $currency_rate_item =
$_SESSION[
'session_devise'][
'conversion'];
270 $symbole_place =
$_SESSION[
'session_devise'][
'symbole_place'];
276 if (!empty($convertion_needed_into_currency)) {
278 $price_displayed = $price * $currency_rate_item;
281 $price_displayed = $price;
283 if(!empty(
$GLOBALS[
'site_parameters'][
'prices_precision']) && is_array(
$GLOBALS[
'site_parameters'][
'prices_precision']) && isset(
$GLOBALS[
'site_parameters'][
'prices_precision'][$currency_code])) {
284 $prices_precision =
$GLOBALS[
'site_parameters'][
'prices_precision'][$currency_code];
286 $prices_precision =
vb(
$GLOBALS[
'site_parameters'][
'prices_precision'], 2);
288 if($force_format_separator) {
289 $prices_decimal_separator = $force_format_separator;
291 if(!empty(
$GLOBALS[
'site_parameters'][
'prices_decimal_separator']) && is_array(
$GLOBALS[
'site_parameters'][
'prices_decimal_separator']) && isset(
$GLOBALS[
'site_parameters'][
'prices_decimal_separator'][$currency_code])) {
292 $prices_decimal_separator =
$GLOBALS[
'site_parameters'][
'prices_decimal_separator'][$currency_code];
294 $prices_decimal_separator =
vb(
$GLOBALS[
'site_parameters'][
'prices_decimal_separator'],
',');
297 if(!empty(
$GLOBALS[
'site_parameters'][
'prices_thousands_separator']) && is_array(
$GLOBALS[
'site_parameters'][
'prices_thousands_separator']) && isset(
$GLOBALS[
'site_parameters'][
'prices_thousands_separator'][$currency_code])) {
298 $prices_thousands_separator =
$GLOBALS[
'site_parameters'][
'prices_thousands_separator'][$currency_code];
300 $prices_thousands_separator =
vb(
$GLOBALS[
'site_parameters'][
'prices_thousands_separator'],
' ');
303 if (round($price_displayed, $prices_precision) == 0 && $price_displayed < 0) {
305 $price_displayed = 0;
310 if (is_numeric($price_displayed)) {
311 if(!empty(
$GLOBALS[
'site_parameters'][
'prices_show_rounded_if_possible']) && round($price_displayed) == round($price_displayed, $prices_precision)) {
312 $prices_precision = 0;
314 $price_displayed = number_format($price_displayed, $prices_precision, $prices_decimal_separator, $prices_thousands_separator);
316 if($add_rdfa_properties) {
317 $price_displayed =
'<span property="price">'.$price_displayed.
'</span>';
319 if ($display_iso_currency_code) {
320 if($add_rdfa_properties) {
321 $currency_code =
'<span property="priceCurrency">'.$currency_code.
'</span>';
323 $price_displayed .=
' ' . $currency_code;
324 }
elseif ($display_currency) {
326 if ($symbole_place == 1) {
327 $price_displayed .=
$GLOBALS[
'STR_BEFORE_TWO_POINTS'] . $currency_symbole;
329 $price_displayed = $currency_symbole .
' ' . $price_displayed;
335 }
elseif($round_even_if_no_format) {
336 $price_displayed = round($price_displayed, $prices_precision);
340 if(abs($price_displayed-round($price_displayed, $prices_precision))<0.0001 == $price_displayed) {
341 $price_displayed = number_format($price_displayed, $prices_precision,
'.',
'');
344 return $price_displayed;
358 $_SESSION[
'session_curr'][
'FRF'] = 6.55957;
373 if (count(
$_SESSION[
'session_curr']) > 30) {
380 if (isset($rate) && is_numeric($rate)) {
398 ,a.surtitre_" .
$_SESSION[
'session_langue'] .
" AS surtitre
399 ,a.titre_" .
$_SESSION[
'session_langue'] .
" AS titre
401 ,a.texte_" .
$_SESSION[
'session_langue'] .
" AS texte
402 ,a.chapo_" .
$_SESSION[
'session_langue'] .
" AS chapo
408 INNER JOIN peel_articles_rubriques ar ON a.id = ar.article_id
409 WHERE a.id='" . intval(
$id) .
"' AND " .
get_filter_site_cond(
'articles',
'a') .
" " . ($show_all_etat_if_admin &&
a_priv(
"admin_content",
false) ?
'' :
"AND a.etat = '1' AND (a.titre_" .
$_SESSION[
'session_langue'] .
"!='' OR a.texte_" .
$_SESSION[
'session_langue'] .
"!='' OR a.chapo_" .
$_SESSION[
'session_langue'] .
"!='' OR a.surtitre_" .
$_SESSION[
'session_langue'] .
"!='')") .
"");
423 $remise_displayed = array();
424 $remise_valeur = floatval($remise_valeur);
425 $remise_percent = floatval($remise_percent);
426 if (!empty($remise_valeur)) {
427 $remise_displayed[] =
fprix($remise_valeur,
true,
$GLOBALS[
'site_parameters'][
'code'],
false);
429 if (!empty($remise_percent)) {
430 $remise_displayed[] = sprintf(
"%0.2f", $remise_percent) .
'% ' . ($is_remise_valeur_including_taxe ?
$GLOBALS[
'STR_TTC'] :
$GLOBALS[
'STR_HT']);
433 return implode(
' / ', $remise_displayed);
443 if (!empty(
$GLOBALS[
'site_parameters'][
'tag_analytics'])) {
444 if (!empty(
$GLOBALS[
'site_parameters'][
'no_display_tag_analytics_for_ip'])) {
445 foreach(explode(
',', str_replace(array(
' ',
';'), array(
',',
','),
$GLOBALS[
'site_parameters'][
'no_display_tag_analytics_for_ip'])) as $this_ip_part) {
446 if (!empty($this_ip_part) && ($this_ip_part ==
'*' || strpos($_SERVER[
'REMOTE_ADDR'], $this_ip_part) === 0)) {
452 return $GLOBALS[
'site_parameters'][
'tag_analytics'];
469 function get_modules_array($only_active =
false, $location = null, $technical_code = null, $force_update_cache_information =
false, $specific_site_id = null, $exclude_public_items =
false)
471 static $modules_array;
474 $static_hash .=
'only_active';
477 $static_hash .= $location .
'_' . $technical_code .
'_' .
vb(
$GLOBALS[
'page_columns_count']).
'_' .
vb(
$GLOBALS[
'wwwroot']);
478 if (!isset($modules_array[$static_hash]) || $force_update_cache_information) {
484 WHERE ' .
get_filter_site_cond(
'modules', null, defined(
'IN_PEEL_ADMIN'), $specific_site_id, $exclude_public_items) .
' AND ' . ($location ==
'header' &&
vn(
$GLOBALS[
'page_columns_count']) == 2 ?
'(':
'') .
'(1' . ($technical_code ?
' AND technical_code="' .
nohtml_real_escape_string($technical_code) .
'"' :
'') . ($location ?
' AND location="' .
nohtml_real_escape_string($location) .
'"' :
'') .
')' . ($location ==
'header' &&
vn(
$GLOBALS[
'page_columns_count']) == 2 ?
' OR (technical_code="caddie" AND location="below_middle")' :
'') . ($location ==
'header' &&
vn(
$GLOBALS[
'page_columns_count']) == 2 ?
')':
'') . ($only_active ?
' AND etat="1"' :
'') .
'
485 ORDER BY position, id';
488 if(!empty(
$GLOBALS[
'site_parameters'][
'modules_disabled_array']) && in_array($this_module[
'technical_code'],
$GLOBALS[
'site_parameters'][
'modules_disabled_array'])) {
492 if(!empty(
$GLOBALS[
'site_parameters'][
'modules_only_if_constant_defined']) && !empty(
$GLOBALS[
'site_parameters'][
'modules_only_if_constant_defined'][$this_module[
'technical_code']])) {
494 foreach(explode(
',',
$GLOBALS[
'site_parameters'][
'modules_only_if_constant_defined'][$this_module[
'technical_code']]) as $this_constant) {
495 if(defined(trim($this_constant))) {
506 if ($this_module[
'location'] ==
'below_middle' &&
vn(
$GLOBALS[
'page_columns_count']) == 2 && $this_module[
'technical_code'] ==
'caddie') {
508 if ((empty($location) || $location ==
'header') && empty(
$GLOBALS[
'site_parameters'][
'bootstrap_enabled'])) {
509 $this_module[
'location'] =
'header';
510 $this_module[
'display_mode'] =
'';
515 $this_module[
'location'] = str_replace(array(
'left_annonce',
'right_annonce'), array(
'left',
'right'), $this_module[
'location']);
519 if (empty($this_module[
'in_home']) || (!empty($this_module[
'in_home']) && defined(
'IN_HOME'))) {
520 $modules[$this_module[
'id']] = $this_module;
523 $modules_array[$static_hash] = $modules;
526 return $modules_array[$static_hash];
543 function get_modules($location, $return_mode =
false, $technical_code = null, $id_categorie = null, $this_annonce_number = 0, $return_array_with_raw_information =
false, $criterias = null)
545 if (empty($criterias)) {
549 $allowing_cache_modules_technical_codes = array(
'annonces' => 4500,
'tagcloud' => 120);
552 $output_array = array();
556 foreach ($modules_array as $this_module) {
558 $this_block_style =
'';
559 $this_module_output =
'';
560 if (!empty($id_categorie)) {
561 $display_catalog_allowed = extra_catalogue_condition($id_categorie);
563 $display_catalog_allowed =
true;
565 if (!empty($allowing_cache_modules_technical_codes[$this_module[
'technical_code']]) && !
a_priv(
'admin*')) {
566 $cache_id = $this_module[
'technical_code'] .
'_' .
$_SESSION[
'session_langue'] .
'_' .
vn($criterias[
'catid']) .
'_' .
$GLOBALS[
'site_id'] .
'_' .
vn(
$_SESSION[
'session_admin_multisite']);
567 $this_module_output_cache_object =
new Cache($cache_id, array(
'group' =>
'html_block'));
568 if ($this_module_output_cache_object->testTime($allowing_cache_modules_technical_codes[$this_module[
'technical_code']],
true)) {
569 $this_module_output = $this_module_output_cache_object->get();
570 $load_module =
false;
574 if ($this_module[
'technical_code'] ==
'catalogue') {
575 if($display_catalog_allowed) {
576 if (function_exists(
'affiche_menu_catalogue')) {
578 $this_module_output = affiche_menu_catalogue($this_module[
'location'],
true,
true);
580 $this_module_output = get_categories_output($this_module[
'location'],
'categories',
vn($_GET[
'catid']), ($this_module[
'location']==
'footer'?
'div':
''), null);
582 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'menu_catalogue.tpl');
583 $tpl->assign(
'menu', $this_module_output);
584 $tpl->assign(
'add_ul_if_result',
true);
585 $this_module_output =
$tpl->fetch();
589 }
elseif ($this_module[
'technical_code'] ==
'search') {
590 if(!empty($this_module[
'technical_code'])){
591 $this_module_output = affiche_menu_recherche(
true, $this_module[
'location']);
593 }
elseif ($this_module[
'technical_code'] ==
'guide') {
594 $this_module_output = affiche_guide($this_module[
'location'],
true,
true);
595 }
elseif ($this_module[
'technical_code'] ==
'guide_simplified') {
596 $this_module_output = affiche_guide($this_module[
'location'],
true,
false);
597 }
elseif ($this_module[
'technical_code'] ==
'caddie') {
599 $this_module_output = affiche_mini_caddie($this_module[
'location'] !=
'header',
true);
600 }
elseif ($this_module[
'technical_code'] ==
'account') {
601 $this_module_output = affiche_compte(
true, $this_module[
'location']);
602 }
elseif ($this_module[
'technical_code'] ==
'best_seller') {
607 }
elseif ($this_module[
'technical_code'] ==
'brand') {
609 $this_module_output = get_brand_link_html(null,
true,
true, $this_module[
'location']);
610 }
elseif ($this_module[
'technical_code'] ==
'last_views') {
614 }
elseif ($this_module[
'technical_code'] ==
'quick_access') {
615 if (function_exists(
'get_quick_access')) {
616 $this_module_output = get_quick_access($this_module[
'location'],
true);
618 }
elseif ($this_module[
'technical_code'] ==
'news' || $this_module[
'technical_code'] ==
'articles_rollover') {
620 if($this_module[
'technical_code'] ==
'news') {
625 if (
vn(
$GLOBALS[
'site_parameters'][
'type_rollover']) == 1) {
654 if (defined(
'IN_HOME')) {
655 $page_type =
'home_page';
656 }
elseif ((defined(
'IN_CATALOGUE') || defined(
'IN_CATALOGUE_ANNONCE')) && (empty($criterias[
'page']) || $criterias[
'page'] ===
'0' || $criterias[
'page'] == 1)) {
657 $page_type =
'first_page_category';
658 }
elseif ((defined(
'IN_CATALOGUE') || defined(
'IN_CATALOGUE_ANNONCE')) && $criterias[
'page'] > 1) {
659 $page_type =
'other_page_category';
660 }
elseif (defined(
'IN_CATALOGUE_ANNONCE_DETAILS')) {
661 $page_type =
'ad_page_details';
662 }
elseif (defined(
'IN_SEARCH')) {
663 $page_type =
'search_engine_page';
664 }
elseif (defined(
'IN_AD_CREATION')) {
665 $page_type =
'ad_creation_page';
667 $page_type =
'other_page';
669 if (!empty($keywords_array)) {
672 $this_module_output =
affiche_banner(
String::substr($this_module[
'technical_code'], strlen(
'advertising')),
true, (isset($criterias[
'page'])?$criterias[
'page']:null), $id_categorie, $this_annonce_number, $page_type, (isset($criterias[
'search'])?explode(
' ', $criterias[
'search']):null),
$_SESSION[
'session_langue'], $return_array_with_raw_information, (isset($criterias[
'ref'])?$criterias[
'ref']:null),
vn(
$GLOBALS[
'page_related_to_user_id']));
673 }
elseif ($this_module[
'technical_code'] ==
'menu') {
674 $this_block_style =
' ';
675 foreach ($modules_array as $this_module2) {
676 if ($this_module2[
'technical_code'] ==
'caddie' && $this_module[
'location'] ==
'header' && empty(
$GLOBALS[
'site_parameters'][
'bootstrap_enabled'])) {
677 $this_block_style =
' style="width:80%"';
680 $this_module_output = get_menu(
vb(
$GLOBALS[
'main_div_id']));
681 }
elseif ($this_module[
'technical_code'] ==
'ariane') {
682 $this_module_output = affiche_ariane(
true);
683 }
elseif ($this_module[
'technical_code'] ==
'paiement_secu') {
684 $this_module_output = get_modules_paiement_secu();
685 }
elseif ($this_module[
'technical_code'] ==
'newsletter_in_column') {
687 }
elseif ($this_module[
'technical_code'] ==
'subscribe_newsletter') {
688 $this_module_output = get_newsletter_form($this_module[
'location'],
true);
689 }
elseif ($this_module[
'technical_code'] ==
'contact') {
690 $this_module_output = get_contact_sideblock($this_module[
'location'],
true);
692 $this_module_output = affiche_menu_annonce($this_module[
'location'],
true,
true);
694 $this_module_output = get_verified_sideblock_link($this_module[
'location'],
true);
696 $this_module_output = getVerifiedAdsList();
698 $this_module_output = get_annonces_in_box(
'search_by_list', $this_module[
'location'],
true);
699 $this_module[
'sliding_mode'] =
false;
700 }
elseif ($this_module[
'technical_code'] ==
'product_new') {
702 $this_module_output = get_annonces_in_box(
'last', $this_module[
'location'],
true);
703 $this_module[
'sliding_mode'] =
false;
705 $this_module_output = get_product_new_list($this_module[
'location'],
true);
708 $this_module_output = getForumLastMessages(
$_SESSION[
'session_langue']);
710 $this_module_output = get_new_members_list();
712 $this_module_output = get_birthday_members_list();
714 $this_module_output = display_agenda();
715 }
elseif ($this_module[
'technical_code'] ==
'get_search_product_form' ) {
716 $this_module_output = get_search_form($_GET,
vb($_GET[
'search']),
vb($_GET[
'match']), null,
'module_products');
717 }
elseif ($this_module[
'technical_code'] ==
'get_search_ads_form' ) {
718 $this_module_output = get_search_form($_GET,
vb($_GET[
'search']),
vb($_GET[
'match']), null,
'module_ads');
720 $this_module_output = get_search_user_form(
"module");
722 $this_module_output = get_next_product_flash();
724 $this_module_output = Carrousel::display(
'references',
true);
726 $this_module_output = Carrousel::display(
'partenaires',
true);
727 }
elseif ($this_module[
'technical_code'] ==
'forum_rss') {
728 $this_module_output =
get_xml_value(
$GLOBALS[
'site_parameters'][
'forum_rss_url'],
$GLOBALS[
'site_parameters'][
'forum_rss_filter_string'], 9, 90);
729 }
elseif (function_exists(
'get_'.$this_module[
'technical_code'].
'_module')) {
730 $this_module_output = call_user_func(
'get_'.$this_module[
'technical_code'].
'_module');
732 if (!empty($this_module_output_cache_object)) {
734 $this_module_output_cache_object->save($this_module_output);
737 unset($this_module_output_cache_object);
739 if (!empty($this_module_output)) {
742 if (!empty($return_array_with_raw_information)) {
743 $output_array[] = $this_module_output;
745 $block_class = $this_module[
'display_mode'] .
'_' . $this_module[
'technical_code'];
746 if(!empty(
$GLOBALS[
'site_parameters'][
'modules_block_class_by_technical_code_array']) && !empty(
$GLOBALS[
'site_parameters'][
'modules_block_class_by_technical_code_array'][$this_module[
'technical_code']])) {
747 $block_class .=
' ' .
$GLOBALS[
'site_parameters'][
'modules_block_class_by_technical_code_array'][$this_module[
'technical_code']];
748 }
elseif(!empty(
$GLOBALS[
'site_parameters'][
'modules_block_class_by_display_mode_array']) && !empty(
$GLOBALS[
'site_parameters'][
'modules_block_class_by_display_mode_array'][$this_module[
'display_mode']])) {
749 $block_class .=
' ' .
$GLOBALS[
'site_parameters'][
'modules_block_class_by_display_mode_array'][$this_module[
'display_mode']];
750 }
elseif(in_array($this_module[
'location'],
vb(
$GLOBALS[
'site_parameters'][
'modules_no_class_location_array'], array(
'left',
'right',
'left_annonce',
'right_annonce')))) {
752 }
elseif(isset($width_class)) {
753 $block_class .=
' ' . $width_class;
755 $block_class .=
' col-md-4';
757 if ($this_module[
'display_mode'] ==
'sideblocktitle' && $this_module[
'location'] !=
'header' && $this_module[
'location'] !=
'footer' && $this_module[
'location'] !=
'middle') {
758 $output .= affiche_sideblocktitle(
vb($this_module[
'title_' .
$_SESSION[
'session_langue']]), $this_module_output, $block_class,
true);
759 }
elseif ($this_module[
'display_mode'] ==
'sideblock' && $this_module[
'location'] !=
'header' && $this_module[
'location'] !=
'footer' && $this_module[
'location'] !=
'middle') {
760 $output .= affiche_sideblock(
vb($this_module[
'title_' .
$_SESSION[
'session_langue']]), $this_module_output, $block_class,
true);
762 if (!empty($this_module[
'sliding_mode'])) {
763 $output .= affiche_block($this_module[
'display_mode'], $this_module[
'location'], $this_module[
'technical_code'],
vb($this_module[
'title_' .
$_SESSION[
'session_langue']]), $this_module_output, $this_module[
'display_mode'] .
'_' . $this_module[
'technical_code'], $this_block_style,
true,
true);
765 $block_class .=
' ' . $this_module[
'display_mode'] .
' ' . $this_module[
'location'] .
'_basicblock ' . $this_module[
'location'] .
'_' . $this_module[
'technical_code'] .
' ' . $this_module[
'technical_code'] .
'_' .
$_SESSION[
'session_langue'];
766 if (($this_module[
'display_mode'] ==
'sideblocktitle' || $this_module[
'display_mode'] ==
'sideblock') && $this_module[
'location'] ==
'footer') {
769 $extra_class =
false;
771 $output .= affiche_block($this_module[
'display_mode'], $this_module[
'location'], $this_module[
'technical_code'],
vb($this_module[
'title_' .
$_SESSION[
'session_langue']]), $this_module_output, $block_class, $this_block_style,
true,
true,
true,
vb($extra_class));
776 if ($location ==
'center_middle_home') {
778 $output .=
'<div class="clearfix"></div>';
781 if ($this_module[
'display_mode'] !=
'banner_up') {
787 if ($return_array_with_raw_information) {
788 return $output_array;
811 $recipient_email =
$GLOBALS[
'site_parameters'][
'email_emergency'];
813 $recipient_email =
$GLOBALS[
'support_sav_client'];
815 if (!empty($recipient_email)) {
816 unset($custom_template_tags);
818 $custom_template_tags[
'NOM_FAMILLE'] =
vb(
$frm[
'nom']);
819 $custom_template_tags[
'SOCIETE'] =
vb(
$frm[
'societe']);
820 $custom_template_tags[
'TELEPHONE'] =
vb(
$frm[
'telephone']);
821 $custom_template_tags[
'ADRESSE'] =
vb(
$frm[
'adresse']) .
' ' .
vb(
$frm[
'code_postal']) .
' ' .
vb(
$frm[
'ville']) .
' ' .
vb(
$frm[
'pays']);
822 $custom_template_tags[
'EMAIL'] =
vb(
$frm[
'email']);
823 $custom_template_tags[
'DISPO'] =
vb(
$frm[
'dispo']);
824 $custom_template_tags[
'TEXTE'] =
vb(
$frm[
'texte']);
825 $custom_template_tags[
'SUJET'] = ((!empty(
$frm[
'commande_id'])) ?
"[" .
$GLOBALS[
'STR_ORDER_NAME'] .
" " .
$frm[
'commande_id'] .
"] " :
"") .
vb($frm[
'sujet']);
826 $custom_template_tags[
'PRENOM'] =
vb($frm[
'prenom']);
827 send_email($recipient_email,
'',
'',
'insere_ticket', $custom_template_tags, null,
$GLOBALS[
'support'],
true,
false,
false,
vb($frm[
'email']));
842 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'FlashBannerHTML.tpl');
844 $tpl->assign(
'width', $width);
845 $tpl->assign(
'height', $height);
846 $tpl->assign(
'mode_transparent', $mode_transparent);
847 return $tpl->fetch();
858 if(strpos(
$id,
',') !==
false) {
859 $site_country_array = array();
860 foreach(explode(
',',
$id) as $this_id) {
863 return implode(
', ', $site_country_array);
873 WHERE id="' . intval(
$id) .
'"';
914 $sql =
'SELECT nom_' .
$_SESSION[
'session_langue'] .
' AS name
915 FROM peel_categories c
935 static $result_array;
936 static $first_depth_results_array;
937 if(empty($first_depth_results_array[
$mode][$table_to_use])) {
938 if (
$mode ==
'sons') {
939 $select_field =
'id';
940 $condition_field =
'parent_id';
942 $select_field =
'parent_id AS id';
943 $condition_field =
'id';
949 if ($table_to_use ==
'rubriques') {
950 $table =
'peel_rubriques';
952 }
elseif ($table_to_use ==
'categories') {
953 $table =
'peel_categories';
955 }
elseif ($table_to_use ==
'annonces') {
956 $table =
'peel_categories_annonces';
961 $sql =
'SELECT id, parent_id
963 WHERE etat=1 '.$site_cond.
'
964 ORDER BY position ASC';
967 $first_depth_results_array[
$mode][$table_to_use][$cat[$condition_field]][] = $cat[$select_field];
970 if (is_array($id_or_ids_array)) {
971 $ids_list = implode(
',', $id_or_ids_array);
973 $ids_list = $id_or_ids_array;
975 if (empty($result_array[
$mode][$table_to_use][$ids_list])) {
976 if (is_array($id_or_ids_array)) {
977 $result_array[
$mode][$table_to_use][$ids_list] = $id_or_ids_array;
979 $result_array[
$mode][$table_to_use][$ids_list][] = $id_or_ids_array;
981 foreach(explode(
',', $ids_list) as $this_condition_id) {
982 if(!empty($first_depth_results_array[
$mode][$table_to_use][$this_condition_id])) {
983 foreach($first_depth_results_array[
$mode][$table_to_use][$this_condition_id] as $this_found_id) {
989 return $result_array[
$mode][$table_to_use][$ids_list];
1005 function get_country_select_options($selected_country_name = null, $selected_country_id = null, $option_value =
'name', $display_inactive_country =
false, $allowed_zone_id = null, $preselect_shop_country_if_none_selected =
true, $selected_country_lang = null, $allowed_ids = null)
1008 $sql_condition =
'';
1009 if ($preselect_shop_country_if_none_selected && empty($selected_country_name) && empty($selected_country_id)) {
1010 if(!empty(
$_SESSION[
'session_country_detected'])) {
1011 $selected_country_id =
vn(
$_SESSION[
'session_country_detected']);
1013 $selected_country_id =
vn(
$GLOBALS[
'site_parameters'][
'default_country_id']);
1016 if (empty($selected_country_lang)) {
1017 $sql_select_add_fields =
'';
1018 $selected_country_lang =
$_SESSION[
'session_langue'];
1020 $sql_select_add_fields =
', pays_' . $selected_country_lang;
1022 if (!$display_inactive_country) {
1023 $sql_condition .=
' AND etat = "1"';
1025 if (!empty($allowed_zone_id)) {
1026 $sql_condition .=
' AND zone = "' . intval($allowed_zone_id) .
'"';
1028 if (!empty($allowed_ids)) {
1029 $sql_condition .=
' AND id IN ("' . implode(
'","',
real_escape_string($allowed_ids)) .
'")';
1031 $sql_pays =
'SELECT id, pays_' .
$_SESSION[
'session_langue'] .
' ' . $sql_select_add_fields .
'
1034 ORDER BY position, pays_' .
$_SESSION[
'session_langue'];
1036 $res_pays =
query($sql_pays);
1037 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'select_options.tpl');
1040 if ($option_value ==
'name') {
1041 $value = $tab_pays[
'pays_' . $selected_country_lang];
1042 }
elseif ($option_value ==
'id') {
1043 $value = $tab_pays[
'id'];
1047 'name' => $tab_pays[
'pays_' .
$_SESSION[
'session_langue']],
1048 'issel' => (
vb($selected_country_name) == $tab_pays[
'pays_' . $selected_country_lang] ||
vb($selected_country_id) == $tab_pays[
'id'])
1063 function get_all_site_countries_array($admin_force_multisite_if_allowed =
false, $exclude_public_items =
false, $show_only_site_country_allowed_array =
false) {
1064 $sites_name_array = array();
1066 if($show_only_site_country_allowed_array) {
1067 $sql_where .=
' AND id IN ("' . implode(
'","',
vb(
$GLOBALS[
'site_parameters'][
'site_country_allowed_array'])) .
'")';
1069 $sql_pays =
'SELECT id, pays_' .
$_SESSION[
'session_langue'] .
' AS name
1071 WHERE etat=1 ' . $sql_where .
' AND ' .
get_filter_site_cond(
'pays', null,
false, null, $exclude_public_items, $admin_force_multisite_if_allowed) .
'
1072 ORDER BY position, pays_' .
$_SESSION[
'session_langue'];
1073 $res_pays =
query($sql_pays);
1075 $sites_name_array[
$result[
'id']] = $result[
'name'];
1077 return $sites_name_array;
1089 return implode(
',', array_keys($result_array));
1091 return implode(
',', $result_array);
1113 $sql_type =
"SELECT id, nom_" .
$_SESSION[
'session_langue'] .
", site_id
1115 WHERE etat = 1 AND " .
get_filter_site_cond(
'types') .
" AND (nom_" .
$_SESSION[
'session_langue'] .
"!=''".(!empty($selected_delivery_type_id_or_name)?
" OR id='" .
real_escape_string($selected_delivery_type_id_or_name) .
"'":
"").
")
1116 ORDER BY position ASC, nom_" .
$_SESSION[
'session_langue'] .
" ASC";
1117 $res_type =
query($sql_type);
1119 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'delivery_type_options.tpl');
1123 'value' => intval($tab_type[
'id']),
1125 'issel' => ($tab_type[
'id'] == $selected_delivery_type_id_or_name || $tab_type[
'nom_' . $_SESSION[
'session_langue']] === $selected_delivery_type_id_or_name)
1142 $sql_type =
"SELECT without_delivery_address
1144 WHERE id='" . intval($selected_delivery_type_id) .
"' AND " .
get_filter_site_cond(
'types') .
"";
1145 $res_type =
query($sql_type);
1148 return (!$type[
'without_delivery_address']);
1162 if (!empty(
$frm[
'payment_technical_code'])) {
1163 $sql =
"SELECT nom_" .
$_SESSION[
'session_langue'] .
" as paiement, tarif, tarif_percent, tva
1168 $frm[
'tarif_paiement_ht'] =
$frm[
'sub_total_ht'] * ($obj->tarif_percent / 100) + $obj->tarif;
1169 $frm[
'tarif_paiement'] =
$frm[
'sub_total'] * ($obj->tarif_percent / 100) + $obj->tarif;
1170 $frm[
'tva_tarif_paiement'] =
$frm[
'tarif_paiement'] -
$frm[
'tarif_paiement_ht'];
1173 $frm[
'tarif_paiement'] = 0;
1174 $frm[
'tarif_paiement_ht'] = 0;
1175 $frm[
'tva_tarif_paiement'] = 0;
1187 function get_payment_select($selected_payment_technical_code = null, $show_selected_even_if_not_available =
false, $show_site_info_if_needed =
false)
1190 $where =
'WHERE ' .
get_filter_site_cond(
'paiement',
'p') .
' AND (totalmin<=' . floatval(
$_SESSION[
'session_caddie']->total) .
' OR totalmin=0) AND (totalmax>=' . floatval(
$_SESSION[
'session_caddie']->total) .
' OR totalmax=0)';
1193 $where = payment_by_product_condition();
1196 $sql_paiement =
'SELECT p.*
1197 FROM peel_paiement p
1199 ORDER BY p.position';
1200 $res_paiement =
query($sql_paiement);
1201 $results_count =
num_rows($res_paiement);
1202 while ($tab_paiement =
fetch_assoc($res_paiement)) {
1203 $payment_complement_informations =
'';
1204 if((empty($tab_paiement[
'etat']) || empty($tab_paiement[
'nom_' .
$_SESSION[
'session_langue']])) && (!$show_selected_even_if_not_available || $tab_paiement[
'technical_code'] != $selected_payment_technical_code)){
1209 if (($tab_paiement[
'technical_code'] ==
'kwixo' && ($_SESSION[
'session_caddie']->zone_technical_code !=
'france_mainland' && $_SESSION[
'session_caddie']->zone_technical_code !=
'france_and_overseas')) || $tab_paiement[
'technical_code'] ==
'kwixo_credit' && ($_SESSION[
'session_caddie']->montant >= 150 && $_SESSION[
'session_caddie']->montant <= 4000)) {
1214 if (!defined(
'IN_PEEL_ADMIN') && !empty(
$GLOBALS[
'site_parameters'][
'payment_disable_display_on_payment_select_page']) && in_array($tab_paiement[
'technical_code'],
$GLOBALS[
'site_parameters'][
'payment_disable_display_on_payment_select_page'])) {
1218 if (($tab_paiement[
'technical_code'] !=
'paypal' || !empty(
$GLOBALS[
'site_parameters'][
'email_paypal'])) && ($tab_paiement[
'technical_code'] !=
'moneybookers' || !empty(
$GLOBALS[
'site_parameters'][
'email_moneybookers']))) {
1219 if (
String::strpos($tab_paiement[
'technical_code'],
'kwixo') !==
false) {
1220 if ($tab_paiement[
'technical_code'] ==
'kwixo_credit') {
1222 $payment_complement_informations .=
'<a onclick="popuprnp3x();return false;" href="#" title="kwixo3x">';
1223 }
elseif($tab_paiement[
'technical_code'] ==
'kwixo') {
1224 $payment_complement_informations .=
'<a onclick="popuprnp1xrnp();return false;" href="#" title="kwixo1x">';
1226 if(file_exists(
$GLOBALS[
'dirroot'].
'/modules/fianet/images/' . $tab_paiement[
'technical_code'] .
'_mini.png')) {
1227 $payment_complement_informations .=
'
1228 <img src="'.$GLOBALS[
'wwwroot'].
'/modules/fianet/images/' . $tab_paiement[
'technical_code'] .
'_mini.png" alt="'.
String::str_form_value($tab_paiement[
'nom_' . $_SESSION[
'session_langue']]).
'" />
1231 $payment_complement_informations .=
$GLOBALS[
'STR_MORE_DETAILS'] .
'</a></td>';
1233 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'payment_select.tpl');
1234 $tpl->assign(
'technical_code', $tab_paiement[
'technical_code']);
1235 $tpl->assign(
'nom', ($show_site_info_if_needed?
get_site_info($tab_paiement):
'') . $tab_paiement[
'nom_' . $_SESSION[
'session_langue']]);
1236 $tpl->assign(
'issel', (
vb($selected_payment_technical_code) == $tab_paiement[
'technical_code'] || $results_count == 1));
1237 if ($tab_paiement[
'tarif'] != 0) {
1238 $tpl->assign(
'fprix_tarif',
fprix($tab_paiement[
'tarif'],
true));
1240 if ($tab_paiement[
'tarif_percent'] != 0) {
1241 $tpl->assign(
'tarif_percent', $tab_paiement[
'tarif_percent']);
1243 $tpl->assign(
'isempty_moneybookers_payment_methods', empty($_SESSION[
'session_commande'][
'moneybookers_payment_methods']));
1244 $tpl->assign(
'moneybookers_payment_methods',
vb($_SESSION[
'session_commande'][
'moneybookers_payment_methods']));
1245 $tpl->assign(
'isempty_email_moneybookers', empty(
$GLOBALS[
'site_parameters'][
'email_moneybookers']));
1246 if (!empty($payment_complement_informations)) {
1247 $tpl->assign(
'payment_complement_informations', $payment_complement_informations);
1249 $tpl->assign(
'STR_BEFORE_TWO_POINTS',
$GLOBALS[
'STR_BEFORE_TWO_POINTS']);
1250 $tpl->assign(
'STR_TRANSFER',
$GLOBALS[
'STR_TRANSFER']);
1275 function get_javascript_output($async =
false, $minify =
false, $output_only_script_loading =
false, $js_filenames_array = array(
'js_files',
'js_files_pageonly',
'js_files_nominify',
'js_files_noasync',
'js_files_nominify_noasync'))
1277 static $already_loaded =
false;
1278 if($already_loaded) {
1282 $already_loaded =
true;
1285 if(!empty(
$GLOBALS[
'site_parameters'][
'load_site_specific_js_files'])) {
1289 $GLOBALS[
'js_files'] = array_merge(
vb(
$GLOBALS[
'js_files'], array()),
$GLOBALS[
'site_parameters'][
'load_site_specific_js_files']);
1291 if(!empty(
$GLOBALS[
'site_parameters'][
'load_site_specific_js_content_array'])) {
1292 $GLOBALS[
'js_content_array'] = array_merge(
vb(
$GLOBALS[
'js_content_array'], array()),
$GLOBALS[
'site_parameters'][
'load_site_specific_js_content_array']);
1294 if(!empty(
$GLOBALS[
'site_parameters'][
'load_site_specific_js_ready_content_array'])) {
1295 $GLOBALS[
'js_ready_content_array'] = array_merge(
vb(
$GLOBALS[
'js_ready_content_array'], array()),
$GLOBALS[
'site_parameters'][
'load_site_specific_js_ready_content_array']);
1297 foreach($js_filenames_array as $this_js_array_name) {
1298 if(!empty(
$GLOBALS[$this_js_array_name])) {
1299 ksort(
$GLOBALS[$this_js_array_name]);
1300 if(count(
$GLOBALS[$this_js_array_name])>1 && $minify &&
String::strpos($this_js_array_name,
'nominify') ===
false) {
1302 }
elseif(!empty($_GET[
'update']) && $_GET[
'update'] == 1) {
1303 foreach(
$GLOBALS[$this_js_array_name] as $this_key => $this_js_file) {
1304 $GLOBALS[$this_js_array_name][$this_key] = $this_js_file . (
String::strpos($this_js_file,
'?')!==
false?
'&':
'?') . time();
1309 if(!empty(
$GLOBALS[
'js_ready_content_array'])) {
1313 $(document).ready(function() {
1314 ' . implode(
"\n",
$GLOBALS[
'js_ready_content_array']) .
'
1322 ' . implode(
"\n",
$GLOBALS[
'js_ready_content_array']) .
'
1327 if(!empty(
$GLOBALS[
'js_content_array'])) {
1328 $js_content .= implode(
"\n",
$GLOBALS[
'js_content_array']);
1331 $noasync_js_filenames_array = $js_filenames_array;
1333 foreach($js_filenames_array as $this_key => $this_js_array_name) {
1335 $noasync_js_filenames_array[] = $this_js_array_name;
1336 unset($js_filenames_array[$this_key]);
1340 if(!empty($noasync_js_filenames_array)) {
1341 foreach($noasync_js_filenames_array as $this_js_array_name) {
1342 if(!empty(
$GLOBALS[$this_js_array_name])) {
1343 ksort(
$GLOBALS[$this_js_array_name]);
1344 foreach(
$GLOBALS[$this_js_array_name] as $js_href) {
1349 if($output_only_script_loading) {
1350 $GLOBALS[$this_js_array_name] = array();
1355 if($output_only_script_loading) {
1360 krsort($js_filenames_array);
1361 foreach($js_filenames_array as $this_js_array_name) {
1362 if(!empty(
$GLOBALS[$this_js_array_name])) {
1363 krsort(
$GLOBALS[$this_js_array_name]);
1364 foreach(
$GLOBALS[$this_js_array_name] as $this_filename) {
1368 if(strpos(
$GLOBALS[
'wwwroot'],
'https') === 0) {
1369 $this_filename =
'https:'.$this_filename;
1371 $this_filename =
'http:'.$this_filename;
1375 loadScript("'.String::html_entity_decode($this_filename).
'", function(){
1383 function loadScript(url,callback){
1384 var script = document.createElement("script");
1385 if(typeof document.attachEvent === "object"){
1387 script.onreadystatechange = function(){
1388 //once the script is loaded, run the callback
1389 if (script.readyState === "loaded" || script.readyState=="complete"){
1390 script.onreadystatechange = null;
1391 if (callback){callback()};
1395 // All other browsers
1396 script.onload = function(){
1397 //once the script is loaded, run the callback
1398 script.onload = null;
1399 if (callback){callback()};
1403 document.getElementsByTagName("head")[0].appendChild(script);
1405 function downloadJSAtOnload() {
1406 if(async_launched) {
1409 async_launched = true;
1412 // Different browsers
1413 var async_launched = false;
1414 if(document.addEventListener) document.addEventListener("DOMContentLoaded", downloadJSAtOnload, false);
1415 else if (window.addEventListener) window.addEventListener("load", downloadJSAtOnload, false);
1416 else if (window.attachEvent) window.attachEvent("onload", downloadJSAtOnload);
1417 else window.onload = downloadJSAtOnload;
1418 // Si onload trop retardé par chargement d\'un site extérieur
1419 setTimeout(downloadJSAtOnload, 10000);
1422 if(!empty($js_content)) {
1424 <script><!--//--><![CDATA[//><!--
1429 foreach($js_filenames_array as $this_js_array_name) {
1430 $GLOBALS[$this_js_array_name] = array();
1432 $GLOBALS[
'js_content_array'] = array();
1433 $GLOBALS[
'js_ready_content_array'] = array();
1445 $datepicker_format = str_replace(array(
'%d',
'%m',
'%Y',
'%y'), array(
'dd',
'mm',
'yy',
'y'),
$GLOBALS[
'date_format_short']);
1447 $(".datepicker").datepicker({
1448 dateFormat: "' . $datepicker_format .
'",
1451 yearRange: "1902:2037",
1452 beforeShow: function() {
1453 setTimeout(function(){
1454 $(".ui-datepicker").css("z-index", 9999999);
1458 $(".datepicker").attr("placeholder","'.str_replace(array(
'd',
'm',
'y'), array(
String::substr(
String::strtolower(
$GLOBALS[
'strDays']), 0, 1),
String::substr(
String::strtolower(
$GLOBALS[
'strMonths']), 0, 1),
String::substr(
String::strtolower(
$GLOBALS[
'strYears']), 0, 1)), str_replace(
'y',
'yy', $datepicker_format)).
'");
1460 if(!empty($_SERVER[
'HTTP_USER_AGENT']) && (strstr($_SERVER[
'HTTP_USER_AGENT'],
'iPhone') || strstr($_SERVER[
'HTTP_USER_AGENT'],
'iPod') || strstr($_SERVER[
'HTTP_USER_AGENT'],
'iPad'))) {
1462 $GLOBALS[
'js_ready_content_array'][] =
'
1463 $(".datepicker").prop("readonly", true);
1464 $(".datepicker").css("background-color", "white");
1467 if(!empty($load_timepicker)) {
1468 $GLOBALS[
'js_files'][] =
$GLOBALS[
'wwwroot_in_admin'] .
'/lib/js/jquery-ui-timepicker-addon.js';
1469 if(file_exists(
$GLOBALS[
'dirroot'] .
'/lib/js/jquery-ui-timepicker-'.
$_SESSION[
'session_langue'].
'.js')) {
1471 $GLOBALS[
'js_files'][] =
$GLOBALS[
'wwwroot_in_admin'] .
'/lib/js/jquery-ui-timepicker-'.$_SESSION[
'session_langue'].
'.js';
1473 $datepicker_time_format = str_replace(array(
'h',
'%H',
'%M',
'%S'), array(
"'h'",
'HH',
'mm',
'ss'),
$GLOBALS[
'time_format_long']);
1474 $GLOBALS[
'js_ready_content_array'][] =
'
1475 load_timepicker = true;
1476 $(".datetimepicker").datetimepicker({
1477 dateFormat: "'.$datepicker_format.
'",
1480 showTimePicker: true,
1482 timeFormat: "'.$datepicker_time_format.
'",
1483 yearRange: "2012:2037"
1485 $(".datetimepicker").attr("placeholder","'.str_replace(array(
'HH',
'MM',
'ss',
'd',
'm',
'y',
"'"), array(
'00',
'00',
'00',
String::substr(
String::strtolower(
$GLOBALS[
'strDays']), 0, 1),
String::substr(
String::strtolower(
$GLOBALS[
'strMonths']), 0, 1),
String::substr(
String::strtolower(
$GLOBALS[
'strYears']), 0, 1),
""), str_replace(
'y',
'yy', $datepicker_format .
' ' . str_replace(
'mm',
'MM', $datepicker_time_format))).
'");
1487 if(!empty($_SERVER[
'HTTP_USER_AGENT']) && (strstr($_SERVER[
'HTTP_USER_AGENT'],
'iPhone') || strstr($_SERVER[
'HTTP_USER_AGENT'],
'iPod') || strstr($_SERVER[
'HTTP_USER_AGENT'],
'iPad'))) {
1489 $GLOBALS[
'js_ready_content_array'][] =
'
1490 $(".datetimepicker").prop("readonly", true);
1491 $(".datetimepicker").css("background-color", "white");
1511 }
elseif(!empty($_GET[
'update']) && $_GET[
'update'] == 1) {
1512 foreach(
$GLOBALS[
'css_files'] as $this_key => $this_css_file) {
1513 $GLOBALS[
'css_files'][$this_key] = $this_css_file . (
String::strpos($this_css_file,
'?')!==
false?
'&':
'?') . time();
1533 if (!empty($_SERVER[
'HTTP_USER_AGENT']) && strpos($_SERVER[
'HTTP_USER_AGENT'],
'MSIE')!==
false) {
1535 header(
'X-UA-Compatible: IE=edge,chrome=1');
1537 if(!empty($cache_duration_in_seconds)) {
1538 header(
'Pragma: public');
1539 header(
'Cache-Control: public, max-age=' . $cache_duration_in_seconds .
', must-revalidate');
1556 header(
"Location: " .
$url);
1557 if ($permanent_redirection) {
1558 header(
String::substr(
vb($_SERVER[
'SERVER_PROTOCOL'],
'HTTP/1.0'), 0 , 10) .
" 301 Moved Permanently");
1560 header(
'Connection: close');
1577 if (!
a_priv(
$priv, $demo_allowed, $configuration_modification)) {
1613 if (!empty($_GET[
'langue']) &&
String::strlen($_GET[
'langue']) == 2) {
1619 foreach ($langs_array as $this_lang) {
1620 if ((!empty(
$GLOBALS[
'get_lang_rewrited_wwwroot'][$this_lang]) &&
$GLOBALS[
'get_lang_rewrited_wwwroot'][$this_lang] ==
$GLOBALS[
'detected_wwwroot']) || (!empty(
$GLOBALS[
'get_lang_rewrited_wwwroot']) && !in_array(
$GLOBALS[
'detected_wwwroot'],
$GLOBALS[
'get_lang_rewrited_wwwroot']) && substr_count(str_replace(array(
'http://',
'https://',
'www.'),
'',
$GLOBALS[
'detected_wwwroot']),
'.') <= 1 + substr_count(str_replace(array(
'http://',
'https://',
'www.'),
'',
$GLOBALS[
'get_lang_rewrited_wwwroot'][$this_lang]),
'.') && strpos(str_replace(array(
'http://',
'https://',
'www.'),
'',
$GLOBALS[
'detected_wwwroot']), str_replace(array(
'http://',
'https://',
'www.'),
'',
$GLOBALS[
'get_lang_rewrited_wwwroot'][$this_lang])) !==
false)) {
1621 $return_lang = $this_lang;
1626 if (empty($return_lang) && !empty($_SESSION[
'session_langue'])) {
1629 $return_lang = $_SESSION[
'session_langue'];
1630 }
elseif (empty($return_lang) && !empty($langs_array)) {
1632 $temp = explode(
',',
vb($_SERVER[
'HTTP_ACCEPT_LANGUAGE']));
1634 if(!in_array($return_lang, $langs_array)) {
1636 $return_lang =
'en';
1638 if(!in_array($return_lang, $langs_array)) {
1640 $return_lang = $langs_array[0];
1642 }
elseif (empty($return_lang)) {
1644 $return_lang =
'en';
1659 if (!in_array($this_lang, $langs_array) || empty(
$GLOBALS[
'lang_etat'][$this_lang]) || !file_exists(
$GLOBALS[
'dirroot'] .
"/lib/lang/" . $this_lang .
".php")) {
1662 foreach ($langs_array as $this_new_lang) {
1668 $this_lang = current($langs_array);
1682 $this_url_lang = $_SERVER[
'REQUEST_URI'];
1683 if (!empty($_GET[
'langue'])) {
1684 $original_lang = $_GET[
'langue'];
1685 $this_url_lang = str_replace(array(
'&langue=' . $_GET[
'langue'],
'?langue=' . $_GET[
'langue'].
'&',
'?langue=' . $_GET[
'langue'],
'langue=' . $_GET[
'langue']), array(
'',
'?',
'',
''), $this_url_lang);
1687 $original_lang =
$_SESSION[
'session_langue'];
1689 $original_lang = $this_lang;
1692 $original_lang = strtolower($original_lang);
1694 if (!
check_if_module_active(
'url_rewriting') || (!empty(
$GLOBALS[
'get_lang_rewrited_wwwroot'][$this_lang]) && !empty(
$GLOBALS[
'langs_array_by_wwwroot'][
$GLOBALS[
'get_lang_rewrited_wwwroot'][$this_lang]]) && count(
$GLOBALS[
'langs_array_by_wwwroot'][
$GLOBALS[
'get_lang_rewrited_wwwroot'][$this_lang]]) > 1)) {
1698 $this_url_lang .=
'?';
1700 $this_url_lang .=
'&';
1702 $this_url_lang .=
'langue=' . $this_lang;
1704 if (defined(
'IN_404_ERROR_PAGE')) {
1706 $this_url_lang =
'/';
1708 if (!empty($_SERVER[
'HTTPS']) && $_SERVER[
'HTTPS'] !=
'off') {
1709 $this_url_lang =
'https://' . $_SERVER[
'HTTP_HOST'] . $this_url_lang;
1711 $this_url_lang =
'http://' . $_SERVER[
'HTTP_HOST'] . $this_url_lang;
1713 $this_url_lang = str_replace(
$GLOBALS[
'wwwroot'],
$GLOBALS[
'wwwroot_main'], $this_url_lang);
1714 if (!empty(
$GLOBALS[
'get_lang_rewrited_wwwroot'][$original_lang])) {
1715 $this_url_lang = str_replace(
$GLOBALS[
'get_lang_rewrited_wwwroot'][$original_lang],
$GLOBALS[
'wwwroot_main'], $this_url_lang);
1717 $this_url_lang = str_replace(
$GLOBALS[
'wwwroot_main'] .
'/' . $original_lang,
$GLOBALS[
'wwwroot_main'], $this_url_lang);
1719 if (defined(
'USER_SUBDOMAIN') &&
$GLOBALS[
'detected_wwwroot'] !=
$GLOBALS[
'wwwroot']) {
1721 $subdomain_array = explode(
'.', $_SERVER[
'HTTP_HOST']);
1722 $subdomain = $subdomain_array[0];
1723 $this_url_lang = str_replace(array(
'http://' . $_SERVER[
'HTTP_HOST'],
'https://' . $_SERVER[
'HTTP_HOST']),
$GLOBALS[
'wwwroot_main'], $this_url_lang);
1725 if (!empty(
$GLOBALS[
'get_lang_rewrited_wwwroot'][$this_lang])) {
1726 $this_url_lang = str_replace(
$GLOBALS[
'wwwroot_main'],
$GLOBALS[
'get_lang_rewrited_wwwroot'][$this_lang], $this_url_lang);
1728 if (!empty($subdomain) && $subdomain !=
'www' && $subdomain != $original_lang) {
1730 $this_url_lang = str_replace(array(
'://',
'www.'), array(
'://' . $subdomain .
'.',
''), $this_url_lang);
1732 return $this_url_lang;
1743 function get_current_url($with_get =
true, $get_short_url =
false, $take_away_get_args_array = null)
1745 if(defined(
'IN_CRON')) {
1750 if (!$get_short_url) {
1751 if (!empty($_SERVER[
'HTTPS']) && $_SERVER[
'HTTPS'] !=
'off') {
1756 $url .= $_SERVER[
'HTTP_HOST'];
1758 $url .= $_SERVER[
'REQUEST_URI'];
1761 }
elseif(!empty($take_away_get_args_array)) {
1763 $entities = array(
'%21',
'%2A',
'%27',
'%28',
'%29',
'%3B',
'%3A',
'%40',
'%26',
'%3D',
'%2B',
'%24',
'%2C',
'%2F',
'%3F',
'%25',
'%23',
'%5B',
'%5D');
1764 $replacements = array(
'!',
'*',
"'",
"(",
")",
";",
":",
"@",
"&",
"=",
"+",
"$",
",",
"/",
"?",
"%",
"#",
"[",
"]");
1765 foreach($take_away_get_args_array as $key) {
1766 if (!empty($_GET[$key])) {
1767 $this_value = $_GET[$key];
1768 if(is_array($this_value)) {
1771 $url = str_replace(array(urlencode($key).
'='.urlencode($this_value), urlencode($key).
'='.str_replace($entities, $replacements, urlencode($this_value)), $key.
'='.$this_value),
'',
$url);
1772 $url = str_replace(array(
'?&',
'&&'), array(
'?',
'&'),
$url);
1792 $cache_key = md5(serialize($params));
1793 if (empty($uri_array[$cache_key])) {
1794 $queryString = array();
1796 $excluded_get[] =
'page';
1797 $excluded_get[] =
'multipage';
1798 $excluded_get[] =
'nombre';
1799 $excluded_get[] =
'update';
1800 if(!empty($params[
'type']) && $params[
'type']==
'error404') {
1801 $excluded_get[] =
'type';
1806 if (strpos($_SERVER[
'PHP_SELF'],
'lire/index.php') !==
false) {
1807 $excluded_get[] =
'rubid';
1808 }
elseif (strpos($_SERVER[
'PHP_SELF'],
'lire/article_details.php') !==
false) {
1809 $excluded_get[] =
'id';
1810 $excluded_get[] =
'rubid';
1811 }
elseif (strpos($_SERVER[
'PHP_SELF'],
'achat/index.php') !==
false) {
1812 $excluded_get[] =
'catid';
1813 }
elseif (strpos($_SERVER[
'PHP_SELF'],
'achat/produit_details.php') !==
false) {
1814 $excluded_get[] =
'id';
1815 $excluded_get[] =
'catid';
1819 $excluded_get[] =
'catid';
1826 $uri .=
'[PAGE].html';
1832 $excluded_get[] =
'bt';
1835 $uri = str_replace(
'/'.
$GLOBALS[
'STR_MODULE_ANNONCES_URL_VITRINE'],
'/'.
$GLOBALS[
'STR_MODULE_ANNONCES_URL_VITRINE'].
'-[PAGE]', $uri);
1838 $excluded_get[] =
'bt';
1841 $excluded_get[] =
'search';
1842 $uri = str_replace(
'.html',
'-[PAGE].html', $uri);
1844 $excluded_get[] =
'search';
1848 $excluded_get[] =
'country';
1851 foreach(array(
'/' .
$GLOBALS[
'STR_MODULE_ANNONCES_URL_BUY'] .
'/'.
$GLOBALS[
'STR_MODULE_PREMIUM_URL_ADS_BY_KEYWORD'].
'-',
'/kopen/supplier-research-',
'/kaufen/supplier-research-',
'/buy/supplier-research-',
'/buy/supplier-research-',
'/acheter/recherche-fournisseur-',
'/comprar/busqueda-proveedor-') as $this_url_rewriting_main_expression) {
1854 $excluded_get[] =
'search';
1858 $uri = str_replace($this_url_rewriting_main_expression,
'/' . $GLOBALS[
'STR_MODULE_ANNONCES_URL_BUY'] .
'/'.$GLOBALS[
'STR_MODULE_PREMIUM_URL_ADS_BY_KEYWORD'].
'-', str_replace(array(
'-' .
String::rawurlencode(
vn($_GET[
'page'])) .
'-' .
String::rawurlencode(
vb($_GET[
'search'])) .
'.html',
'-' .
vn($_GET[
'page']) .
'-' .
vb($_GET[
'search']) .
'.html',
'-' .
vn($_GET[
'page']) .
'-' . urlencode(
vb($_GET[
'search'])) .
'.html'),
'-[PAGE]-' .
String::rawurlencode(
vb($_GET[
'search'])) .
'.html', $uri));
1864 $excluded_get[] =
'subdomain';
1865 $excluded_get[] =
'pageNum_rs1';
1867 foreach ($params as $key => $value) {
1868 if (!in_array($key, $excluded_get) && (!empty($value) || $value===
'0')) {
1869 if(is_array($value)){
1870 foreach($value as $this_key => $this_value){
1871 $queryString[] = $key .
'[' . $this_key .
']=' . urlencode($this_value);
1874 $queryString[] = $key .
'=' . urlencode($value);
1878 if (count($queryString) > 0) {
1879 $uri .=
'?' . implode(
'&', $queryString);
1881 $uri_array[$cache_key] = $uri;
1883 return $uri_array[$cache_key];
1900 $return = $size[
'nom_' .
$_SESSION[
'session_langue']];
1917 FROM peel_couleurs c
1922 $couleur = $this_color[
'nom_' .
$_SESSION[
'session_langue']];
1941 function set_lang_configuration_and_texts(
$lang, $load_default_lang_files_before_main_lang_array = null, $general_setup =
true, $load_modules_files =
true, $load_general_admin_files =
true, $exclude_empty_string =
true, $skip_load_files =
false)
1947 if($general_setup) {
1950 if(!empty(
$GLOBALS[
'site_parameters'][
'avoid_lang_folders_in_minified_css']) && !empty(
$GLOBALS[
'lang_url_rewriting'][
$_SESSION[
'session_langue']]) && strpos(
$GLOBALS[
'lang_url_rewriting'][$_SESSION[
'session_langue']],
'//') ===
false && strpos(
$GLOBALS[
'lang_url_rewriting'][$_SESSION[
'session_langue']],
'.') ===
false) {
1952 $GLOBALS[
'apparent_folder'] =
$GLOBALS[
'apparent_folder_main'] .
$GLOBALS[
'lang_url_rewriting'][$_SESSION[
'session_langue']];
1955 if (!empty(
$GLOBALS[
'site_parameters'][
'admin_force_ssl']) || (defined(
'IN_PEEL_ADMIN') && (!empty($_SERVER[
'HTTPS']) && $_SERVER[
'HTTPS'] !=
'off'))) {
1957 $GLOBALS[
'wwwroot_in_admin'] = str_replace(
'http://',
'https://',
$GLOBALS[
'wwwroot']);
1961 $GLOBALS[
'administrer_url'] =
$GLOBALS[
'wwwroot_in_admin'] .
"/" .
vb(
$GLOBALS[
'site_parameters'][
'backoffice_directory_name']);
1969 $main_langs = array(
'en' =>
'en_US',
'fr' =>
'fr_FR',
'de' =>
'de_DE',
'es' =>
'es_ES',
'it' =>
'it_IT',
'pt' =>
'pt_PT',
'ar' =>
'ar_SA',
'el' =>
'el',
'fi' =>
'fi',
1970 'hu' =>
'hu',
'bg' =>
'bg',
'zh' =>
'zh_cn',
'no' =>
'no_no');
1971 if (empty($main_langs[
$lang])) {
1980 $variations_langs = array(
'en' =>
'english',
'fr' =>
'french',
'de' =>
'german',
'es' =>
'spanish',
'pt' =>
'portuguese',
'it' =>
'italian',
'zh' =>
'chinese-simplified',
1981 'ja' =>
'japanese',
'ru' =>
'russian',
'nl' =>
'dutch');
1982 $variations_langs2 = array(
'zh' =>
'chi');
1983 setlocale(LC_TIME, $main_langs[$lang] .
'.UTF8',
String::strtolower($lang) .
'.UTF8',
vb($variations_langs[$lang],
String::strtolower($lang)) .
'.utf8',
vb($variations_langs2[$lang],
String::strtolower($lang)) .
'.utf8', $main_langs[$lang],
String::strtolower($lang),
vb($variations_langs[$lang],
String::strtolower($lang)),
vb($variations_langs2[$lang],
String::strtolower($lang)));
1990 if(!$skip_load_files) {
1991 if(!empty($load_default_lang_files_before_main_lang_array)){
1992 $successive_loads = $load_default_lang_files_before_main_lang_array;
1994 $successive_loads[] =
$lang;
1995 foreach(array_unique($successive_loads) as $this_lang) {
1996 if($exclude_empty_string && count($successive_loads)>1 && $this_lang != $successive_loads[0]){
1997 foreach(
$GLOBALS as $this_global => $this_value) {
1999 if($this_value !==
'' && substr($this_global, 0, 4) ==
'STR_') {
2001 $temp_globals[$this_global] = $this_value;
2005 if($general_setup) {
2006 if(file_exists(
$GLOBALS[
'dirroot'] .
"/lib/lang/datetime_" . $this_lang .
".php")) {
2007 include(
$GLOBALS[
'dirroot'] .
"/lib/lang/datetime_" . $this_lang .
".php");
2009 if(file_exists(
$GLOBALS[
'dirroot'] .
"/lib/lang/" . $this_lang .
".php")) {
2010 include(
$GLOBALS[
'dirroot'] .
"/lib/lang/" . $this_lang .
".php");
2012 if(file_exists(
$GLOBALS[
'dirroot'] .
"/lib/lang/meta_" . $this_lang .
".php")) {
2013 include(
$GLOBALS[
'dirroot'] .
"/lib/lang/meta_" . $this_lang .
".php");
2016 if($load_general_admin_files) {
2017 if(file_exists(
$GLOBALS[
'dirroot'] .
"/lib/lang/admin_" . $this_lang .
".php")) {
2018 include(
$GLOBALS[
'dirroot'] .
"/lib/lang/admin_" . $this_lang .
".php");
2022 include(
$GLOBALS[
'dirroot'] .
"/lib/lang/admin_install_" . $this_lang .
".php");
2024 if($load_modules_files && !empty(
$GLOBALS[
'modules_lang_folders_to_load_array'])){
2027 $default_lang_if_file_not_found =
'en';
2028 ksort(
$GLOBALS[
'modules_lang_folders_to_load_array']);
2029 foreach(
$GLOBALS[
'modules_lang_folders_to_load_array'] as $this_directory) {
2031 $this_directory =
$GLOBALS[
'dirroot'] . $this_directory;
2033 if(file_exists($this_directory . $this_lang .
".php")) {
2034 include($this_directory . $this_lang .
".php");
2035 }
elseif(file_exists($this_directory . $default_lang_if_file_not_found .
".php")) {
2036 include($this_directory . $default_lang_if_file_not_found .
".php");
2040 if($exclude_empty_string && count($successive_loads)>1 && $this_lang != $successive_loads[0]) {
2041 foreach(
$GLOBALS as $this_global => $this_value) {
2044 if($this_value ===
'' && substr($this_global, 0, 4) ==
'STR_' && !empty($temp_globals[$this_global]) && $this_global !=
'STR_BEFORE_TWO_POINTS') {
2046 $GLOBALS[$this_global] = $temp_globals[$this_global];
2056 foreach(
$GLOBALS as $this_global => $this_value) {
2057 if(substr($this_global, 0, 4) ==
'STR_') {
2058 if(strpos($this_global,
'_URL_') ===
false) {
2059 $this_config =
'replace_words_in_lang_files';
2061 $this_config =
'replace_url_words_in_lang_files';
2063 if(!empty(
$GLOBALS[
'site_parameters'][$this_config]) && is_array(
$GLOBALS[
'site_parameters'][$this_config])) {
2065 foreach(
$GLOBALS[
'site_parameters'][$this_config] as $replaced=>$new) {
2066 if(strpos($this_value, $replaced) !==
false) {
2067 $GLOBALS[
'before_replace_words_in_lang_files'][$this_global] = $this_value;
2068 $this_value = str_replace($replaced, $new, $this_value);
2069 $this_value = str_replace(
'/'.$new,
'/'.$replaced, $this_value);
2070 $GLOBALS[$this_global] = $this_value;
2075 $GLOBALS[
'LANG'][$this_global] = $this_value;
2081 while (isset(
$GLOBALS[
'STR_USER_ORIGIN_OPTIONS_' . (
$i+1)])) {
2085 if(!isset(
$GLOBALS[
'site_parameters'][
'user_mandatory_fields'])) {
2086 $GLOBALS[
'site_parameters'][
'user_mandatory_fields'] = array(
2087 'prenom' =>
'STR_ERR_FIRSTNAME',
2088 'nom_famille' =>
'STR_ERR_NAME',
2089 'adresse' =>
'STR_ERR_ADDRESS',
2090 'code_postal' =>
'STR_ERR_ZIP',
2091 'ville' =>
'STR_ERR_TOWN',
2092 'pays' =>
'STR_ERR_COUNTRY',
2093 'telephone' =>
'STR_ERR_TEL',
2094 'email' =>
'STR_ERR_EMAIL',
2095 'pseudo' =>
'STR_ERR_PSEUDO',
2096 'token' =>
'STR_INVALID_TOKEN');
2098 if(
vb(
$GLOBALS[
'site_parameters'][
'type_affichage_user_favorite_id_categories']) ==
'checkbox') {
2099 $GLOBALS[
'site_parameters'][
'user_mandatory_fields'][
'id_categories'] =
'STR_ERR_FIRST_CHOICE';
2100 }
elseif (
vb(
$GLOBALS[
'site_parameters'][
'type_affichage_user_favorite_id_categories']) ==
'select') {
2101 $GLOBALS[
'site_parameters'][
'user_mandatory_fields'][
'id_cat_1'] =
'STR_ERR_FIRST_CHOICE';
2103 $GLOBALS[
'site_parameters'][
'user_mandatory_fields'][
'cgv_confirm'] =
'STR_ERR_CGV';
2104 $GLOBALS[
'site_parameters'][
'user_mandatory_fields'][
'mot_passe_confirm'] =
'STR_ERR_PASS_CONFIRM';
2106 if(!empty(
$GLOBALS[
'site_parameters'][
'add_b2b_form_inputs'])) {
2107 $GLOBALS[
'site_parameters'][
'user_mandatory_fields'][
'societe'] =
'STR_ERR_SOCIETY';
2108 $GLOBALS[
'site_parameters'][
'user_mandatory_fields'][
'type'] =
'STR_ERR_YOU_ARE';
2109 $GLOBALS[
'site_parameters'][
'user_mandatory_fields'][
'activity'] =
'STR_ERR_ACTIVITY';
2110 $GLOBALS[
'site_parameters'][
'user_mandatory_fields'][
'siret'] =
'STR_ERR_SIREN';
2113 if (preg_match(
'/msie 6./i', $_SERVER[
'HTTP_USER_AGENT']) || preg_match(
'/msie 7./i', $_SERVER[
'HTTP_USER_AGENT']) || preg_match(
'/msie 8./i', $_SERVER[
'HTTP_USER_AGENT'])) {
2115 $GLOBALS[
'site_parameters'][
'used_uploader'] =
'html';
2117 if (preg_match(
'/msie 6./i', $_SERVER[
'HTTP_USER_AGENT']) || preg_match(
'/msie 7./i', $_SERVER[
'HTTP_USER_AGENT'])) {
2119 $GLOBALS[
'site_parameters'][
'chart_product'] =
'flash';
2133 static $loaded_once;
2137 if(!empty($site_id)) {
2140 if(defined(
'IN_PEEL_ADMIN')) {
2145 $select .=
", ".(!empty($site_id)?
"IF(etat=1 AND NOT (" .
get_filter_site_cond(
'langues') .
"), -1, etat)":
"etat") .
" AS etat, IF(NOT (".
get_filter_site_cond(
'langues', null,
true).
"), 1, 0) AS admin_disallowed";
2147 if(empty($sql_or_array)) {
2148 $sql_or_array[] =
"1";
2151 $sql_or_array[] = 1;
2153 $sqlLng =
"SELECT * ".$select.
"
2155 WHERE (" . implode(
" OR ", $sql_or_array) .
")";
2156 if (!empty(
$GLOBALS[
'site_parameters'][
'restricted_languages_array'])) {
2159 $sqlLng .=
" AND (lang IN ('" . implode(
"','",
$GLOBALS[
'site_parameters'][
'restricted_languages_array']) .
"'))";
2162 ORDER BY IF(etat = '1'". (!empty($_GET[
'langue'])?
" OR lang='" .
word_real_escape_string($_GET[
'langue']) .
"'":
'') .
", 1, 0) DESC, position ASC";
2163 $resLng =
query($sqlLng);
2166 if($lng[
'etat'] == 1 || (!empty($_GET[
'langue']) && $lng[
'lang'] == $_GET[
'langue'])) {
2167 $GLOBALS[
'lang_codes'][] = $lng[
'lang'];
2168 $GLOBALS[
'admin_lang_codes'][] = $lng[
'lang'];
2169 if(empty($lng[
'admin_disallowed'])) {
2170 $GLOBALS[
'admin_lang_codes_with_modify_rights'][] = $lng[
'lang'];
2172 }
elseif($lng[
'etat'] == -1) {
2174 $GLOBALS[
'admin_lang_codes'][] = $lng[
'lang'];
2175 if(empty($lng[
'admin_disallowed'])) {
2176 $GLOBALS[
'admin_lang_codes_with_modify_rights'][] = $lng[
'lang'];
2179 if(!isset(
$GLOBALS[
'lang_etat'][$lng[
'lang']])) {
2180 $GLOBALS[
'lang_flags'][$lng[
'lang']] = $lng[
'flag'];
2181 $GLOBALS[
'lang_names'][$lng[
'lang']] = $lng[
"nom_" . $lng[
'lang']];
2182 $GLOBALS[
'lang_etat'][$lng[
'lang']] = $lng[
'etat'];
2183 $GLOBALS[
'lang_url_rewriting'][$lng[
'lang']] = $lng[
"url_rewriting"];
2185 if(!empty($lng[
'load_default_lang_files_before_main_lang'])) {
2186 $GLOBALS[
'load_default_lang_files_before_main_lang_array_by_lang'][$lng[
'lang']] = explode(
',', $lng[
'load_default_lang_files_before_main_lang']);
2195 $GLOBALS[
'lang_flags'][
'en'] =
'/images/en.png';
2196 $GLOBALS[
'lang_names'][
'en'] =
'English';
2198 $GLOBALS[
'lang_url_rewriting'][
'en'] =
'';
2201 if(empty(
$GLOBALS[
'admin_lang_codes'])){
2207 if(!empty(
$GLOBALS[
'admin_lang_codes_with_modify_rights'])) {
2208 $GLOBALS[
'admin_lang_codes_with_modify_rights'] = array_unique(
$GLOBALS[
'admin_lang_codes_with_modify_rights']);
2211 foreach(
$GLOBALS[
'lang_codes'] as $this_lang) {
2212 $GLOBALS[
'get_lang_rewrited_wwwroot'][$this_lang] = get_lang_rewrited_wwwroot($this_lang);
2213 $GLOBALS[
'langs_array_by_wwwroot'][
$GLOBALS[
'get_lang_rewrited_wwwroot'][$this_lang]][] = $this_lang;
2215 }
elseif(empty($loaded_once)) {
2217 $lang_dir =
$GLOBALS[
'dirroot'] .
"/lib/lang";
2218 if ($handle = opendir($lang_dir)) {
2219 while ($file = readdir($handle)) {
2220 if ($file !=
"." && $file !=
".." && is_file($lang_dir .
'/' . $file) && strtolower($file) == $file) {
2221 if (substr($file, 0, strlen(
'admin_install_')) ==
'admin_install_' && substr($file, strlen(
'admin_install_')+2) ==
'.php') {
2222 $lng = substr($file, strlen(
'admin_install_'), 2);
2225 if(!empty(
$GLOBALS[
'langs_flags_correspondance'][$lng])){
2226 $GLOBALS[
'lang_flags'][$lng] =
$GLOBALS[
'langs_flags_correspondance'][$lng];
2228 $GLOBALS[
'lang_flags'][$lng] =
'/images/'.$lng.
'.png';
2230 if(file_exists(
$GLOBALS[
'dirroot'] .
'/lib/lang/database_langues_'.$lng.
'.php')) {
2231 include(
$GLOBALS[
'dirroot'] .
'/lib/lang/database_langues_'.$lng.
'.php');
2233 include(
$GLOBALS[
'dirroot'] .
'/lib/lang/database_langues_en.php');
2239 $GLOBALS[
'lang_names'][$lng] = $lng;
2242 $GLOBALS[
'lang_etat'][$lng] = 1;
2243 $GLOBALS[
'lang_url_rewriting'][$lng] =
'';
2244 }
elseif (substr($file, 2) ==
'.php') {
2245 $lng = substr($file, 0, 2);
2247 $GLOBALS[
'available_languages'][] = $lng;
2252 ksort(
$GLOBALS[
'admin_lang_codes']);
2254 foreach(
$GLOBALS[
'lang_codes'] as $this_lang) {
2256 if(file_exists(
$GLOBALS[
'dirroot'] .
'/images/'.$this_lang.
'_large.png')) {
2257 $GLOBALS[
'lang_flags_big'][$this_lang] =
vb(
$GLOBALS[
'wwwroot']) .
'/images/'.$this_lang.
'_large.png';
2260 $loaded_once =
true;
2269 $formatted_dirroot = str_replace(
'\\',
'/',
$GLOBALS[
'dirroot']);
2270 $file_called_real_path = str_replace(
'\\',
'/', @realpath(
'./'));
2271 if (!empty($_SERVER[
'SCRIPT_FILENAME']) && (empty($file_called_real_path) || (strpos($file_called_real_path, $formatted_dirroot) ===
false && strpos(str_replace(
'\\',
'/', dirname($_SERVER[
'SCRIPT_FILENAME'])), $formatted_dirroot) !==
false))) {
2273 $file_called_real_path = str_replace(
'\\',
'/', dirname($_SERVER[
'SCRIPT_FILENAME']));
2275 if (strpos($file_called_real_path,
'public_html') ===
false && strpos($formatted_dirroot,
'public_html') !==
false) {
2276 $file_called_real_path = str_replace(
'private_html/',
'public_html/', $file_called_real_path);
2278 if (!empty($file_called_real_path) && strpos($file_called_real_path, $formatted_dirroot) !==
false) {
2280 if ($formatted_dirroot == $file_called_real_path) {
2281 $peel_subfolder =
'';
2285 $peel_subfolder = substr($file_called_real_path, strpos($file_called_real_path, $formatted_dirroot) + strlen($formatted_dirroot));
2290 $peel_subfolder =
'';
2292 $file_called_relative_path = str_replace(
'\\',
'/', dirname($_SERVER[
'PHP_SELF']));
2293 $apparent_folder = substr($file_called_relative_path, 0, strlen($file_called_relative_path) - strlen($peel_subfolder));
2294 if (empty($apparent_folder) || substr($apparent_folder, strlen($apparent_folder) - 1) !=
'/') {
2295 $apparent_folder .=
'/';
2297 if (substr($apparent_folder, 0, 1) !=
'/') {
2299 $apparent_folder =
'/' . $apparent_folder;
2301 return $apparent_folder;
2311 if(!empty(
$GLOBALS[
'site_parameters'][
'cdn_specific_domains_array']) && !empty(
$GLOBALS[
'site_parameters'][
'cdn_specific_domains_array'][$subject])) {
2312 return $GLOBALS[
'site_parameters'][
'cdn_specific_domains_array'][$subject];
2313 }
else if(!empty(
$GLOBALS[
'site_parameters'][
'cdn_generic_domain'])) {
2314 return $GLOBALS[
'site_parameters'][
'cdn_generic_domain'];
2327 if (strval(floatval(
'1000.1')) !=
'1000.1') {
2329 @setlocale(LC_NUMERIC,
'C');
2331 @ini_set(
'scream.enabled',
false);
2332 @ini_set(
'default_socket_timeout', 4);
2333 @ini_set(
'display_errors', 1);
2334 @ini_set(
"gd.jpeg_ignore_warning", 1);
2337 @ini_set(
'xdebug.var_display_max_depth',
'-1');
2338 @ini_set(
'xdebug.var_display_max_children',
'-1');
2339 @ini_set(
'xdebug.var_display_max_data',
'-1');
2341 if (function_exists(
'mb_internal_encoding')) {
2342 @mb_internal_encoding(GENERAL_ENCODING);
2344 if (function_exists(
'mb_detect_order')) {
2345 @mb_detect_order(GENERAL_ENCODING);
2347 if (function_exists(
'mb_http_input')) {
2348 @mb_http_input(GENERAL_ENCODING);
2350 if (function_exists(
'mb_http_output')) {
2351 @mb_http_output(GENERAL_ENCODING);
2354 @ini_set(
'mbstring.internal_encoding', GENERAL_ENCODING);
2355 @ini_set(
'mbstring.detect_order', GENERAL_ENCODING);
2356 @ini_set(
'mbstring.http_input', GENERAL_ENCODING);
2357 @ini_set(
'mbstring.http_output', GENERAL_ENCODING);
2358 @ini_set(
'mbstring.http_output', GENERAL_ENCODING);
2360 @ini_set(
'default_charset', GENERAL_ENCODING);
2363 if (version_compare(PHP_VERSION,
'5.1.0',
'>=')) {
2365 @date_default_timezone_set(@date_default_timezone_get());
2367 @set_magic_quotes_runtime(0);
2377 if(!empty($_SERVER[
'RAW_HTTP_COOKIE'])){
2379 foreach(explode(
';', $_SERVER[
'RAW_HTTP_COOKIE']) as $this_cookie){
2380 if(strpos($this_cookie,
'=') !==
false){
2381 list($key,$value) = explode(
'=', $this_cookie, 2);
2382 $key = rawurldecode(trim($key));
2383 if(!array_key_exists($key, $_COOKIE)){
2384 $_COOKIE[$key] = rawurldecode(trim($value));
2389 if (!function_exists(
'ini_get') || @ini_get(
'register_globals')) {
2392 foreach (array(
'_POST',
'_GET',
'_COOKIE',
'_REQUEST',
'_SERVER',
'_ENV',
'_FILES') as $array_name) {
2393 foreach ($$array_name as $key => $value) {
2416 include(
$GLOBALS[
'dirroot'] .
"/lib/templateEngines/EngineTpl.php");
2418 if(!in_array(
vb(
$GLOBALS[
'site_parameters'][
'template_engine']), array(
'smarty',
'twig'))) {
2419 $GLOBALS[
'site_parameters'][
'template_engine'] =
'smarty';
2421 if(
$GLOBALS[
'site_parameters'][
'template_engine'] ==
'twig') {
2422 require
$GLOBALS[
'dirroot'] .
'/lib/templateEngines/twig/Autoloader.php';
2425 $GLOBALS[
'tplEngine'] =
EngineTpl::create(
$GLOBALS[
'site_parameters'][
'template_engine'],
$GLOBALS[
'repertoire_modele'] .
'/' .
$GLOBALS[
'site_parameters'][
'template_engine'] .
'/', $templates_force_compile, defined(
'DEBUG_TEMPLATES') && DEBUG_TEMPLATES);
2434 if(!empty(
$GLOBALS[
'site_parameters'][
'site_suspended'])) {
2435 if (!empty(
$GLOBALS[
'site_parameters'][
'site_suspended_excluded_ips'])) {
2436 if(
$GLOBALS[
'site_parameters'][
'site_suspended_excluded_ips'] ==
'display_errors_for_ips') {
2437 $GLOBALS[
'site_parameters'][
'site_suspended_excluded_ips'] =
$GLOBALS[
'site_parameters'][
'display_errors_for_ips'];
2439 foreach(explode(
',', str_replace(array(
' ',
';'), array(
',',
','),
$GLOBALS[
'site_parameters'][
'site_suspended_excluded_ips'])) as $this_ip_part) {
2440 if (!empty($this_ip_part) && ($this_ip_part ==
'*' || strpos($_SERVER[
'REMOTE_ADDR'], $this_ip_part) === 0)) {
2441 $allow_access_if_suspended =
true;
2446 if (!
IN_INSTALLATION && !defined(
'IN_PATHFILE') && !defined(
'IN_IPN') && !defined(
'IN_PEEL_ADMIN') && !defined(
'IN_ACCES_ACCOUNT') && !defined(
'IN_GET_PASSWORD') && !
a_priv(
'admin*',
true) && empty($allow_access_if_suspended)) {
2447 header(
String::substr(
vb($_SERVER[
'SERVER_PROTOCOL'],
'HTTP/1.0'), 0 , 10) .
" 503 Service Unavailable",
true, 503);
2448 header(
'Status: 503 Service Unavailable');
2449 header(
'Retry-After: 7200');
2450 echo
'<div style="text-align:center; font-size:20px; font-family: Arial,Helvetica Neue,Helvetica,sans-serif; "><br /><br /><b>' .
$GLOBALS[
'STR_UPDATE_WEBSITE'] .
'</b><br /><br /><img src="' .
$GLOBALS[
'wwwroot'] .
'/modeles/' .
$GLOBALS[
'site_parameters'][
'template_directory'] .
'/images/site_under_work.jpg" style="max-width:100%" /><br /><br />' .
$GLOBALS[
'STR_THANKS_UNDERSTANDING'] .
'</div>';
2464 static $tags_handled;
2465 if (!empty(
$GLOBALS[
'site_parameters'][
'redirections'])) {
2466 if(empty($tags_handled)) {
2468 $tags_handled =
true;
2472 foreach(
$GLOBALS[
'site_parameters'][
'redirections'] as $url_from => $url_to) {
2473 $temp = explode(
',', $url_to, 2);
2474 if(!empty($temp[0]) && !empty($url_from) && $temp[0] != $url_from) {
2476 $new_url = str_replace($url_from, $temp[0],
$url);
2477 if($new_url !=
$url) {
2478 if(
$mode ==
'redirect') {
2502 $GLOBALS[
'session_cookie_name'] =
vb(
$GLOBALS[
'site_parameters'][
'session_cookie_basename']) . substr(md5(
vb(
$GLOBALS[
'site_parameters'][
'session_cookie_unique_part'],
$GLOBALS[
'wwwroot_main'])), 0, 8);
2503 $user_agent_salt =
vb(
$GLOBALS[
'site_parameters'][
'session_user_agent_salt'],
'GcFsD5EOvgSvQFtL4nIy');
2504 if (!empty(
$GLOBALS[
'site_parameters'][
'sessions_duration'])) {
2505 @ini_set(
'session.gc_maxlifetime', 60 *
$GLOBALS[
'site_parameters'][
'sessions_duration']);
2506 @ini_set(
'session.cache_expire',
$GLOBALS[
'site_parameters'][
'sessions_duration']);
2508 @ini_set(
'session.use_cookies',
'1');
2509 @ini_set(
'session.use_only_cookies',
'1');
2510 @ini_set(
'session.use_trans_sid',
'0');
2511 @ini_set(
'session.hash_function',
'1');
2512 @ini_set(
'url_rewriter.tags',
'');
2513 @ini_set(
'session.name',
$GLOBALS[
'session_cookie_name']);
2514 if (!empty(
$GLOBALS[
'site_parameters'][
'session_save_path'])) {
2515 @ini_set(
'session.save_path',
$GLOBALS[
'site_parameters'][
'session_save_path']);
2517 if (
vb(
$GLOBALS[
'site_parameters'][
'force_sessions_for_subdomains']) &&
get_site_domain(
true) && strpos(
$GLOBALS[
'wwwroot'],
'://127.0.0.1') ===
false && strpos(
$GLOBALS[
'wwwroot'],
'://localhost') ===
false) {
2523 if (!isset(
$_SESSION[
'session_initiated']) && isset($_COOKIE[
$GLOBALS[
'session_cookie_name']])) {
2526 @session_regenerate_id();
2533 if (!isset($_SERVER[
'HTTP_USER_AGENT'])) {
2534 $_SERVER[
'HTTP_USER_AGENT'] =
'';
2536 if (empty($GLOBALS[
'site_parameters'][
'disable_session_user_agent_check']) && isset(
$_SESSION[
'session_user_agent'])) {
2537 if (
$_SESSION[
'session_user_agent'] != sha1($user_agent_salt . $_SERVER[
'HTTP_USER_AGENT'])) {
2541 @session_regenerate_id(
true);
2545 $_SESSION[
'session_user_agent'] = sha1($user_agent_salt . $_SERVER[
'HTTP_USER_AGENT']);
2549 $_SESSION[
'session_user_agent'] = sha1($user_agent_salt . $_SERVER[
'HTTP_USER_AGENT']);
2569 $parameter_needing_full_rights_prefix = array(
'multisite_');
2573 $sql =
"SELECT c.site_id, c.string
2574 FROM peel_configuration c
2575 LEFT JOIN peel_langues l ON l.etat = '1' AND l.url_rewriting LIKE '%.%' AND " .
get_filter_site_cond(
'langues',
'l',
false, $forced_site_id) .
"
2576 WHERE c.technical_code='wwwroot' AND ";
2577 if ($forced_site_id === null) {
2583 ORDER BY IF(c.technical_code='wwwroot',1,0) DESC, l.position ASC
2594 if($forced_site_id!==0 && empty(
$GLOBALS[
'site_id'])) {
2596 $sql =
"SELECT count(*) AS this_count
2597 FROM peel_configuration c
2598 WHERE c.technical_code='wwwroot'";
2602 $this_count_wwwroot =
$result[
'this_count'];
2605 if ($this_count_wwwroot <=1) {
2608 }
elseif ($this_count_wwwroot > 1) {
2611 $sql =
"SELECT string
2612 FROM peel_configuration c
2613 WHERE c.technical_code='site_id_showed_by_default_if_domain_not_found' AND site_id=0";
2619 die(
'Site configuration not detected');
2624 if ($this_count_wwwroot > 0) {
2626 $sql =
"SELECT string
2627 FROM peel_configuration c
2628 WHERE c.technical_code='wwwroot' AND ".get_filter_site_cond(
'configuration',
'c').
"
2629 ORDER BY site_id DESC
2636 die(
'Site configuration not detected');
2642 if (!defined(
'IN_PEEL_ADMIN') && !empty($_SERVER[
'HTTPS']) && $_SERVER[
'HTTPS'] !=
'off') {
2644 $GLOBALS[
'wwwroot_main'] = str_replace(
'http://',
'https://',
$GLOBALS[
'wwwroot_main']);
2649 FROM peel_configuration
2650 WHERE etat='1' AND ";
2651 if ($forced_site_id === null) {
2657 $sql .=
"lang='' AND technical_code NOT LIKE 'STR_%'";
2662 ORDER BY IF(site_id='0', 0, 1) ASC, IF(lang='', 0, 1) ASC, technical_code ASC";
2666 $skip_parameter =
false;
2667 foreach($parameter_needing_full_rights_prefix as $this_parameter_begin) {
2668 if(strpos(
$result[
'technical_code'], $this_parameter_begin) === 0 && !empty(
$result[
'site_id'])) {
2669 $skip_parameter =
true;
2672 if($skip_parameter) {
2676 if(strpos(
$result[
'technical_code'],
'chmod') !==
false) {
2677 if(
$result[
'type'] ==
'integer') {
2680 if(strpos(
$result[
'technical_code'],
'file') !==
false) {
2683 $result[
'string'] = str_replace(array(
'1',
'3',
'5',
'7'), array(
'0',
'2',
'4',
'6'),
$result[
'string']);
2686 if(
$result[
'type'] ==
'boolean'){
2702 $result[
'string'] = str_replace(array(
'{$GLOBALS[\'repertoire_images\']}',
'{$GLOBALS[\'wwwroot\']}',
'{$GLOBALS[\'dirroot\']}', ), array(
vb(
$GLOBALS[
'repertoire_images']),
vb(
$GLOBALS[
'wwwroot']),
$GLOBALS[
'dirroot']),
$result[
'string']);
2713 if(substr(
$result[
'string'], 0, 1) !=
'/') {
2720 $GLOBALS[
'site_parameters'][
$result[
'technical_code']] = $result[
'string'];
2723 if(!$skip_loading_currency_infos) {
2724 $query_devises =
query(
"SELECT pd.devise, pd.conversion, pd.symbole, pd.symbole_place, pd.code
2725 FROM peel_devises pd
2727 if($result_devises =
fetch_assoc($query_devises)) {
2730 foreach($result_devises as $this_key => $this_value) {
2731 if(!isset(
$GLOBALS[
'site_parameters'][$this_key])) {
2732 $GLOBALS[
'site_parameters'][$this_key] = $this_value;
2737 if ((defined(
'IN_PEEL_ADMIN') ||
IN_INSTALLATION) && !empty(
$GLOBALS[
'site_parameters'][
'template_directory_forced_in_admin'])) {
2738 $GLOBALS[
'site_parameters'][
'template_directory'] =
$GLOBALS[
'site_parameters'][
'template_directory_forced_in_admin'];
2741 if(!empty(
$GLOBALS[
'site_parameters'][
'mysql_sql_mode_force'])) {
2743 query(
"SET @@session.sql_mode='" .
vb(
$GLOBALS[
'site_parameters'][
'mysql_sql_mode_force'],
'MYSQL40') .
"'");
2746 if(!isset(
$GLOBALS[
'site_parameters'][
'template_directory']) || !file_exists(
$GLOBALS[
'dirroot'] .
"/modeles/" .
$GLOBALS[
'site_parameters'][
'template_directory'])) {
2747 if(empty($GLOBALS[
'site_parameters'][
'peel_database_version'])) {
2750 $GLOBALS[
'site_parameters'][
'template_directory'] =
'peel7';
2752 $modeles_dir = $GLOBALS[
'dirroot'] .
"/modeles";
2753 if ($handle = opendir($modeles_dir)) {
2754 while (
false !== ($file = readdir($handle))) {
2755 if ($file !=
"." && $file !=
".." && is_dir($modeles_dir .
'/' . $file)) {
2756 if(empty($GLOBALS[
'repertoire_modele']) || substr($GLOBALS[
'repertoire_modele'], 0, 4)!=
'peel') {
2758 $GLOBALS[
'site_parameters'][
'template_directory'] = $file;
2765 if(!empty($GLOBALS[
'site_parameters'][
'mysql_sql_mode_force'])) {
2767 query(
"SET @@session.sql_mode='" .
vb($GLOBALS[
'site_parameters'][
'mysql_sql_mode_force'],
'MYSQL40') .
"'");
2778 return array_sum(explode(
' ', microtime()));
2798 function params_affiche_produits($condition_value1, $unused, $type, $nb_par_page,
$mode =
'general', $reference_id = 0, $nb_colonnes, $always_show_multipage_footer =
true, $additional_sql_inner = null, $additional_sql_cond = null, $additionnal_sql_having = null, $use_index_sql = null)
2800 $sql_cond_array = array();
2802 $affiche_filtre =
'';
2804 $params_list = array();
2805 if (!empty($nb_colonnes) && ($nb_par_page % $nb_colonnes > 0)) {
2806 $nb_par_page = $nb_par_page + ($nb_colonnes - ($nb_par_page % $nb_colonnes));
2808 if ($type ==
'associated_product') {
2809 $params_list[
'small_width'] = 160;
2810 $params_list[
'small_height'] = 160;
2812 $params_list[
'small_width'] =
vn(
$GLOBALS[
'site_parameters'][
'small_width']);
2813 $params_list[
'small_height'] =
vn(
$GLOBALS[
'site_parameters'][
'small_height']);
2815 $params_list[
'cartridge_product_css_class'] =
'item-column product_per_line_' . $nb_colonnes;
2816 $display_multipage_template_name = null;
2817 if ($type ==
'catalogue') {
2818 $sql_cond_array[] =
"p.id_marque='" . intval($condition_value1) .
"'";
2819 }
elseif ($type ==
'nouveaute') {
2820 $sql_cond_array[] =
"p.on_new='1'";
2821 $params_list[
'affiche_filtre'] = affiche_filtre(null,
true);
2822 $titre =
$GLOBALS[
'STR_NOUVEAUTES'];
2823 }
elseif ($type ==
'promotion') {
2825 if (
vn(
$GLOBALS[
'site_parameters'][
'auto_promo']) == 1) {
2827 $this_sql_cond =
"p.promotion>0";
2829 if (is_flash_active_on_site()) {
2830 $this_sql_cond .=
" OR (p.on_flash='1' AND '" . date(
'Y-m-d H:i:s', time()) .
"' BETWEEN p.flash_start AND p.flash_end)";
2834 $sql_inner .=
" LEFT JOIN peel_marques pm ON pm.id = p.id_marque AND " .
get_filter_site_cond(
'marques',
'pm');
2835 $this_sql_cond .=
" OR pm.promotion_percent>0 OR pm.promotion_devises>0 ";
2839 $this_sql_cond .=
" OR c.promotion_percent>0 OR c.promotion_devises>0";
2841 $sql_cond_array[] = $this_sql_cond;
2843 $sql_cond_array[] =
"p.on_promo='1'";
2845 $titre =
$GLOBALS[
'STR_PROMOTIONS'];
2846 }
elseif ($type ==
'special') {
2847 $sql_cond_array[] =
"p.on_special='1'";
2849 }
elseif ($type ==
'suggest') {
2851 $titre =
$GLOBALS[
'STR_OUR_SUGGEST'];
2852 }
elseif ($type ==
'top') {
2853 $sql_cond_array[] =
"p.on_top='1'";
2855 }
elseif ($type ==
'category') {
2856 $params_list[
'affiche_filtre'] = affiche_filtre($condition_value1,
true);
2857 if (
vb(
$GLOBALS[
'site_parameters'][
'category_count_method']) ==
'global') {
2860 $catid_array = array($condition_value1);
2862 $sql_cond_array[] =
"pc.categorie_id IN ('" . implode(
"','",
real_escape_string($catid_array)) .
"')";
2863 $titre =
$GLOBALS[
'STR_LIST_PRODUCT'];
2864 }
elseif ($type ==
'flash') {
2865 $sql_cond_array[] =
"p.on_flash='1' AND '" . date(
'Y-m-d', time()) .
"' BETWEEN p.flash_start AND p.flash_end";
2867 }
elseif ($type ==
'flash_passed') {
2868 $sql_cond_array[] =
"p.on_flash='1' AND '" . date(
'Y-m-d', time()) .
"' > flash_end";
2869 $titre =
$GLOBALS[
'STR_FLASH_PASSED'];
2870 }
elseif ($type ==
'user_flash_passed') {
2871 $sql_cond_array[] =
"p.on_flash='1' AND '" . date(
'Y-m-d', time()) .
"' > flash_end AND id_utilisateur = " . intval($reference_id);
2872 $titre =
$GLOBALS[
'STR_FLASH_PASSED'];
2873 }
elseif ($type ==
'coming_product_flash') {
2874 $sql_cond_array[] =
"p.on_flash='1' AND '" . date(
'Y-m-d', time()) .
"' < flash_start";
2875 $titre =
$GLOBALS[
'STR_COMING_PRODUCT_FLASH'];
2876 }
elseif ($type ==
'user_coming_product_flash') {
2877 $sql_cond_array[] =
"p.on_flash='1' AND '" . date(
'Y-m-d', time()) .
"' <= flash_start AND id_utilisateur = " . intval($reference_id);
2878 $titre =
$GLOBALS[
'STR_COMING_PRODUCT_FLASH'];
2879 }
elseif ($type ==
'check') {
2880 $sql_cond_array[] =
"p.on_check='1'";
2881 $titre =
$GLOBALS[
'STR_CHEQUE_CADEAU'];
2882 }
elseif ($type ==
'associated_product') {
2885 $commande_id_array = array();
2887 $sql =
query(
'SELECT on_ref_produit, nb_ref_produits
2891 if (!empty($infos)) {
2893 $sql =
'SELECT commande_id
2894 FROM peel_commandes_articles
2895 WHERE produit_id = "' . intval($reference_id) .
'" AND ' .
get_filter_site_cond(
'commandes_articles');
2898 $commande_id_array[] =
$result[
'commande_id'];
2901 if ($infos[
'on_ref_produit'] == 1 && $infos[
'nb_ref_produits'] > 0 && count($commande_id_array) > 0) {
2902 $sql_inner .=
" INNER JOIN peel_commandes_articles pca ON pca.produit_id = p.id AND " .
get_filter_site_cond(
'commandes_articles',
'pca') .
"";
2904 $sql_cond_array[] =
"p.id!=" . intval($reference_id);
2905 $nb_par_page = intval($infos[
'nb_ref_produits']);
2908 $sql_cond_array[] =
"pr.produit_id = '" . intval($reference_id) .
"'";
2909 if(empty(
$GLOBALS[
'site_parameters'][
'product_references_display_limit']) && empty(
$GLOBALS[
'site_parameters'][
'product_references_order_by'])) {
2910 $sql_inner .=
" INNER JOIN peel_produits_references pr ON p.id = pr.reference_id";
2912 $sql_inner .=
" INNER JOIN (SELECT * FROM peel_produits_references WHERE produit_id='" . intval($reference_id) .
"' ORDER BY ".real_escape_string(
vb(
$GLOBALS[
'site_parameters'][
'product_references_order_by'],
'reference_id ASC')).
" LIMIT ".intval(
vn(
$GLOBALS[
'site_parameters'][
'product_references_display_limit'], 10)).
") pr ON p.id = pr.reference_id";
2916 $titre =
$GLOBALS[
'STR_ASSOCIATED_PRODUCT'];
2917 }
elseif ($type ==
'save_cart') {
2918 $sql_inner .=
" INNER JOIN peel_save_cart sc ON sc.produit_id = p.id ";
2919 $sql_cond_array[] =
"sc.id_utilisateur = '" . intval($condition_value1) .
"'";
2920 if (!empty(
$GLOBALS[
'site_parameters'][
'quick_add_product_from_search_page'])) {
2922 $sql_cond_array[] =
"sc.products_list_name = ''";
2924 }
elseif ($type ==
'convert_gift_points') {
2925 $titre =
$GLOBALS[
'STR_VOIR_LISTE_CADEAU'];
2926 $sql_cond_array[] =
"p.on_gift=1 AND on_gift_points<='".intval(
$_SESSION[
'session_utilisateur'][
'points']).
"'";
2927 }
elseif ($type ==
'show_draft') {
2928 $titre =
$GLOBALS[
'STR_MODULE_CREATE_PRODUCT_IN_FRONT_OFFICE_SORTIE_SAVE_DRAFT'];
2929 $params_list[
'show_draft'] =
true;
2930 $sql_cond_array[] =
"p.etat=0 AND id_utilisateur = '".intval(
$_SESSION[
'session_utilisateur'][
'id_utilisateur']).
"'";
2933 $sql_cond_array[] =
'p.on_gift = "0"';
2935 if (!empty($additional_sql_cond)) {
2937 $sql_cond_array[] = $additional_sql_cond;
2939 if (!empty($additional_sql_inner)) {
2941 $sql_inner .= $additional_sql_inner;
2944 $join_categories = ($type !=
'check');
2945 $join_categories_for_count = ($join_categories && (empty(
$GLOBALS[
'site_parameters'][
'allow_products_without_category']) ||
String::strpos(implode(
'', $sql_cond_array),
'c.') !==
false));
2947 $sql =
"SELECT p.*, p.nom_".(!empty(
$GLOBALS[
'site_parameters'][
'product_name_forced_lang'])?
$GLOBALS[
'site_parameters'][
'product_name_forced_lang']:
$_SESSION[
'session_langue']).
" AS name " . ($join_categories?
', IF(c.id IS NOT NULL, c.id, 0) AS categorie_id, IF(c.nom_' .
$_SESSION[
'session_langue'] .
' IS NOT NULL, c.nom_' .
$_SESSION[
'session_langue'] .
', 0) AS categorie':
'');
2948 if (($type ==
'save_cart')) {
2949 $sql .=
', sc.id as save_cart_id, sc.couleur_id as saved_couleur_id, sc.taille_id as saved_taille_id, sc.id_attribut as saved_attributs_list, sc.quantite as saved_quantity ';
2952 FROM peel_produits p '.$use_index_sql.
'
2954 $sql_join_categories = ($join_categories?(!empty(
$GLOBALS[
'site_parameters'][
'allow_products_without_category']) ?
'LEFT' :
'INNER') .
' JOIN peel_produits_categories pc ON pc.produit_id = p.id':
'') .
'
2956 $sql_main2 = ($join_categories?(!empty(
$GLOBALS[
'site_parameters'][
'allow_products_without_category']) ?
'LEFT' :
'INNER') .
' JOIN peel_categories c ON pc.categorie_id = c.id AND c.etat=1 AND ' .
get_filter_site_cond(
'categories',
'c'):
'');
2959 WHERE '.($type !=
'show_draft'?
'p.etat = "1" AND ':
'').
' ' .
get_filter_site_cond(
'produits',
'p') .
' AND p.nom_'.(!empty(
$GLOBALS[
'site_parameters'][
'product_name_forced_lang'])?
$GLOBALS[
'site_parameters'][
'product_name_forced_lang']:$_SESSION[
'session_langue']).
' != ""';
2961 if (!empty($sql_cond_array)) {
2962 $sql_main3 .=
' AND (' . implode(
') AND (', array_unique($sql_cond_array)) .
')';
2964 $sql .= $sql_main . $sql_join_categories . $sql_main2 . $sql_main3;
2965 if ($type !=
'save_cart') {
2966 if($join_categories && empty(
$GLOBALS[
'site_parameters'][
'allow_products_multiple_results_if_multiple_categories'])) {
2967 $sql .=
' GROUP BY p.id';
2969 if($join_categories_for_count && empty(
$GLOBALS[
'site_parameters'][
'allow_products_multiple_results_if_multiple_categories'])) {
2970 $sql_manual_count =
'SELECT COUNT(DISTINCT p.id) AS rows_count ' . $sql_main . $sql_join_categories . $sql_main3;
2971 }
elseif($join_categories_for_count) {
2972 $sql_manual_count =
'SELECT COUNT(*) AS rows_count ' . $sql_main. $sql_join_categories . $sql_main3;
2974 $sql_manual_count =
'SELECT COUNT(*) AS rows_count ' . $sql_main. $sql_main3;
2977 $sql .=
' GROUP BY save_cart_id';
2978 $sql_manual_count =
'SELECT COUNT(DISTINCT p.save_cart_id) AS rows_count ' . $sql_main. $sql_main3;
2980 if (!empty($additionnal_sql_having)) {
2981 $sql .=
' ' . $additionnal_sql_having;
2983 $GLOBALS[
'multipage_avoid_redirect_if_page_over_limit'] =
true;
2984 if ($type ==
'special') {
2986 }
elseif ($type ==
'associated_product') {
2987 $Links =
new Multipage(
$sql,
'affiche_produits_reference', $nb_par_page, 7, 0, $always_show_multipage_footer);
2989 $Links =
new Multipage(
$sql,
'affiche_produits', $nb_par_page, 7, 0, $always_show_multipage_footer, $display_multipage_template_name);
2991 if (!empty($_GET[
'tri']) && !in_array($_GET[
'tri'], array(
'nom_' . $_SESSION[
'session_langue'],
'prix'))) {
2993 $_GET[
'tri'] =
'p.nom_'.(!empty(
$GLOBALS[
'site_parameters'][
'product_name_forced_lang'])?
$GLOBALS[
'site_parameters'][
'product_name_forced_lang']:$_SESSION[
'session_langue']);
2995 if(!empty(
$GLOBALS[
'site_parameters'][
'sql_count_avoid_found_rows'])) {
2996 $Links->sql_count = $sql_manual_count;
2999 $Links->sort_get_variable =
'sort';
3000 $Links->OrderDefault =
'position';
3001 $Links->SortDefault =
'ASC';
3004 $Links->forced_before_first_order_by_string = null;
3005 if ($type ==
'category' &&
vb(
$GLOBALS[
'site_parameters'][
'category_count_method']) ==
'global' && $join_categories && !empty($condition_value1)) {
3006 $Links->forced_before_first_order_by_string .=
'IF(pc.categorie_id="'.intval($condition_value1).
'", 1, 0) DESC';
3008 if ($type ==
'save_cart') {
3009 if(!empty(
$Links->forced_before_first_order_by_string)) {
3010 $Links->forced_before_first_order_by_string .=
', ';
3012 $Links->forced_before_first_order_by_string .=
'save_cart_id DESC';
3014 $params_list[
'nb_colonnes'] = $nb_colonnes;
3015 $params_list[
'Links'] =
$Links;
3016 $params_list[
'titre'] = $titre;
3017 $params_list[
'mode'] =
$mode;
3019 return $params_list;
3022 if (!function_exists(
'ipGet')) {
3032 if (isset($_SERVER[
'HTTP_X_FORWARDED_FOR']) && isPublicIP($_SERVER[
'HTTP_X_FORWARDED_FOR'])) {
3033 $ip = $_SERVER[
'HTTP_X_FORWARDED_FOR'];
3034 }
elseif (isset($_SERVER[
'HTTP_CLIENT_IP']) && isPublicIP($_SERVER[
'HTTP_CLIENT_IP'])) {
3035 $ip = $_SERVER[
'HTTP_CLIENT_IP'];
3036 }
elseif (isset($_SERVER[
'REMOTE_ADDR'])) {
3037 $ip = $_SERVER[
'REMOTE_ADDR'];
3041 if (strpos($ip,
',') !==
false) {
3042 $ip_array = explode(
',', $ip);
3049 if (!function_exists(
'isPublicIP')) {
3056 function isPublicIP($ip_to_test)
3058 if (preg_match(
'/^([0-9]{1,3}.){3,3}[0-9]{1,3}$/', $ip_to_test)) {
3059 $ip_as_array = explode(
'.', $ip_to_test);
3060 if (count($ip_as_array) == 4 && !empty($ip_as_array[3])) {
3062 $test1 = $ip_as_array[0] != 10 && $ip_as_array[0] != 127;
3063 $test2 = $ip_as_array[0] != 172 || $ip_as_array[1] < 16 || $ip_as_array[1] > 31;
3064 $test3 = $ip_as_array[0] != 192 || $ip_as_array[1] != 168;
3065 $test4 = $ip_as_array[0] != 192 || $ip_as_array[1] != 88 || $ip_as_array[2] != 99;
3066 $test5 = $ip_as_array[0] != 169 || $ip_as_array[1] != 254;
3067 if ($test1 && $test2 && $test3 && $test4 && $test5) {
3087 $ip =
vb($_SERVER[
'REMOTE_ADDR']);
3089 if($user_agent === null) {
3090 $user_agent =
vb($_SERVER[
'HTTP_USER_AGENT']);
3096 if(!empty($user_agent)) {
3097 foreach(array(
'mediapartners-google',
'googlebot',
'google page speed',
'feedfetcher',
'slurp',
'bingbot',
'msnbot',
'voilabot',
'baiduspider',
'genieo',
'sindup',
'ahrefsbot',
'yandex',
'spider',
'robot',
'/bot',
'crawler',
'netvibes') as $this_name) {
3104 $good_bots = array(
'62.119.21.157',
3106 '64.4.8.',
'64.62.0.',
'64.68.82.',
'64.68.84.',
'64.68.85.',
3107 '64.241.242.177',
'64.241.243.65',
3108 '65.54.164.',
'65.54.165.',
'65.54.188.',
'65.55.208.',
'65.55.209.',
'65.55.213.',
3109 '65.55.214.',
'65.55.215.',
'65.55.233.',
'65.55.246.',
3110 '65.214.36.',
'65.214.38.10',
'65.214.44.',
3111 '66.154.103.146',
'66.196.72.',
'66.196.90.',
3113 '66.249.64.',
'66.249.65.',
'66.249.66.',
'66.249.67.',
'66.249.68.',
'66.249.69.',
3114 '66.249.70.',
'66.249.71.',
'66.249.72.',
'66.249.73.',
3115 '72.30.61.',
'72.30.110.',
'72.30.133.',
'72.30.179.',
'72.30.215.',
'72.30.216.',
'72.30.226.',
3116 '72.30.215.',
'72.30.216.',
'72.30.226.',
'72.30.252.',
3117 '74.6.19.',
'74.6.20.',
'74.6.24.',
'74.6.25.',
'74.6.27.',
'74.6.28.',
3118 '74.6.64.',
'74.6.65.',
'74.6.66.',
'74.6.67.',
'74.6.68.',
'74.6.69.',
'74.6.70.',
3119 '74.6.71.',
'74.6.72.',
'74.6.73.',
'74.6.74.',
'74.6.85.',
'74.6.86.',
'74.6.87.',
3122 '195.93.102.',
'195.101.94.',
3124 '207.46.89.',
'207.68.146.',
'207.68.157.',
3125 '209.249.67.1 ',
'209.73.164.50',
3127 '212.127.141.180',
'212.78.206.',
3129 '216.39.48.58',
'216.39.48.82',
'216.39.48.164',
'216.39.50.',
'216.239.46.',
'216.243.113.1',
3132 foreach($good_bots as $bot_ip) {
3133 if (strpos($ip, $bot_ip) === 0) {
3156 $valid_titre = array();
3159 $parser = xml_parser_create();
3160 xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
3161 xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
3162 xml_parse_into_struct($parser,
$data, $values, $tags);
3163 xml_parser_free($parser);
3165 $filter_array = explode(
'|', $filter_string);
3166 if(!empty($tags[
'title'])) {
3167 foreach ($tags[
'title'] as $tag_key => $value_key) {
3174 if(!empty($last_time) && strtotime($values[$tags[
'pubDate'][$tag_key-1]][
'value'])>$last_time) {
3175 unset($titles_array);
3177 $titles_array[$tag_key] = $values[$value_key][
'value'];
3178 if(!empty($tags[
'pubDate'])) {
3179 $last_time = strtotime($values[$tags[
'pubDate'][$tag_key-1]][
'value']);
3183 if(!empty($tags[
'link'])) {
3184 foreach ($tags[
'link'] as $tag_key => $value_key) {
3185 $links_array[$tag_key] = $values[$value_key][
'value'];
3188 if (!empty($titles_array)) {
3189 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'xml_value.tpl');
3190 $tpl_links = array();
3193 foreach ($titles_array as $key => $this_title) {
3195 foreach ($filter_array as $this_filter) {
3196 if (stripos($this_title, $this_filter) !==
false) {
3204 $tpl_links[] = array(
3205 'href' => $links_array[$key],
3206 'label' => $titles_array[$key]
3209 if (
$i >= $items_count_max) {
3213 $tpl->assign(
'links', $tpl_links);
3214 $tpl->assign(
'line_length_max', $line_length_max);
3229 $string = preg_replace(
'/[-]{2,}/',
"-", $string);
3248 if ($file_infos ==
"none") {
3250 }
elseif (!empty($file_infos[
'error'])) {
3253 }
elseif ($file_infos[
'size'] >
$GLOBALS[
'site_parameters'][
'uploaded_file_max_size']) {
3254 $error = sprintf(
$GLOBALS[
"STR_UPLOAD_ERROR_FILE_IS_TOO_BIG"], round(
$GLOBALS[
'site_parameters'][
'uploaded_file_max_size'] / 1024));
3255 }
elseif (!is_uploaded_file($file_infos[
'tmp_name'])) {
3257 }
elseif (
$GLOBALS[
'site_parameters'][
'check_allowed_types'] && !isset(
$GLOBALS[
'site_parameters'][
'allowed_types'][$file_infos[
'type']])) {
3259 $error = sprintf(
$GLOBALS[
"STR_UPLOAD_ERROR_FILE_NOT_ALLOWED"], $file_infos[
'type']);
3263 }
elseif (!empty(
$GLOBALS[
'site_parameters'][
'extensions_valides_image']) && in_array(
$extension,
$GLOBALS[
'site_parameters'][
'extensions_valides_image'])) {
3265 if (!empty(
$GLOBALS[
'site_parameters'][
'upload_oversized_images_forbidden'])) {
3268 list($width, $height, $type, $attr) = getimagesize($file_infos[
'tmp_name']);
3269 if ($width >
$GLOBALS[
'site_parameters'][
'image_max_width']) {
3270 $error .= sprintf(
$GLOBALS[
"STR_UPLOAD_ERROR_IMAGE_MUST_NOT_BE_LARGER_THAN"],
$GLOBALS[
'site_parameters'][
'image_max_width']);
3272 if ($height >
$GLOBALS[
'site_parameters'][
'image_max_height']) {
3274 $error .= sprintf(
$GLOBALS[
"STR_UPLOAD_ERROR_IMAGE_MUST_NOT_BE_HIGHER_THAN"],
$GLOBALS[
'site_parameters'][
'image_max_height']);
3280 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'upload_errors_text.tpl');
3281 $tpl->assign(
'allowed_types',
$GLOBALS[
'site_parameters'][
'allowed_types']);
3283 return $tpl->fetch();
3302 function upload($field_name,
$rename_file =
true,
$file_kind = null, $image_max_width = null, $image_max_height = null, $path = null, $new_file_name_without_extension = null, $default_return_value = null)
3305 $path =
$GLOBALS[
'uploaddir'] .
'/';
3307 if (is_array($field_name)) {
3309 if (!empty($field_name)) {
3311 $file_infos = $field_name;
3314 return $default_return_value;
3316 }
elseif (!empty($_REQUEST[$field_name])) {
3318 if(strpos($_REQUEST[$field_name],
'/' .
$GLOBALS[
'site_parameters'][
'cache_folder'] .
'/') === 0) {
3320 $file_infos[
'name'] = basename($_REQUEST[$field_name]);
3321 $format_filename_base_disabled =
true;
3324 return $_REQUEST[$field_name];
3326 }
elseif (empty($_FILES[$field_name][
'name'])) {
3328 return $default_return_value;
3331 $file_infos = $_FILES[$field_name];
3335 if (empty(
$error) && !empty($file_infos[
'name'])) {
3339 if (empty($new_file_name_without_extension)) {
3340 if(!empty($format_filename_base_disabled)) {
3349 if(!isset($file_infos[
'tmp_name'])) {
3357 return $default_return_value;
3362 if(!empty(
$GLOBALS[
'site_parameters'][
'chmod_new_files'])) {
3363 @chmod ($path . $the_new_file_name,
$GLOBALS[
'site_parameters'][
'chmod_new_files']);
3365 if (!empty(
$GLOBALS[
'site_parameters'][
'extensions_valides_image']) && in_array(
$extension,
$GLOBALS[
'site_parameters'][
'extensions_valides_image']) && !empty($image_max_width) && !empty($image_max_height)) {
3367 $the_new_jpg_name = $new_file_name_without_extension .
'.jpg';
3370 $result =
image_resize($path . $the_new_file_name, $path . $the_new_jpg_name, $image_max_width, $image_max_height,
false,
true,
$GLOBALS[
'site_parameters'][
'filesize_limit_keep_origin_file'],
$GLOBALS[
'site_parameters'][
'jpeg_quality']);
3374 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'global_error.tpl');
3375 $tpl->assign(
'message',
$GLOBALS[
'STR_ERROR_DECOD_PICTURE']);
3382 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'global_error.tpl');
3383 $tpl->assign(
'message',
$GLOBALS[
'STR_ERROR_SOMETHING_PICTURE'] .
' ' .$path);
3389 return $default_return_value;
3401 if (
$rename_file || (function_exists(
'is_filtered') && is_filtered($original_name))) {
3402 $new_file_name_without_extension = strftime(
"%d%m%y_%H%M%S") .
"_PEEL_" .
MDP(4);
3405 $modified_old_name_without_extension = preg_replace(
'/([^.a-z0-9]+)/i',
'-',
String::strtolower(
String::convert_accents(str_replace(array(
'%2520',
'%20',
';',
',',
' ',
'^',
'$',
'#',
'<',
'>',
'[',
']',
'{',
'}',
'(',
')',
"'",
'"'), array(
'-',
'-',
'-',
'-',
'-',
'-',
'-',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
''), basename($original_name,
'.' .
$extension)))));
3406 $new_file_name_without_extension =
String::strtolower(
String::substr(str_replace(array(
'-----',
'----',
'---',
'--'), array(
'-',
'-',
'-',
'-'), $modified_old_name_without_extension), 0, 33) .
'-' .
MDP(6));
3408 return $new_file_name_without_extension;
3426 $thumbs_array = @glob(
$GLOBALS[
'uploaddir'] .
'/thumbs/' . $nom .
"-????.jpg");
3427 if (!empty($thumbs_array)) {
3428 foreach ($thumbs_array as $this_thumb) {
3429 unlink($this_thumb);
3450 function http_download_and_die($filename_with_realpath, $serve_download_with_php =
true, $file_content_given = null, $file_name_given = null, $force_download =
true)
3452 if (!$serve_download_with_php) {
3456 switch (strrchr(basename($filename_with_realpath),
".")) {
3458 $type =
"application/x-gzip";
3461 $type =
"application/x-gzip";
3464 $type =
"application/zip";
3467 $type =
"application/pdf";
3470 $type =
"image/png";
3473 $type =
"image/gif";
3476 $type =
"image/jpeg";
3479 $type =
"text/plain";
3482 $type =
"text/html";
3485 $type =
"text/html";
3488 $type =
"audio/mpeg";
3491 $type =
"audio/ogg";
3494 $type =
"audio/wav";
3497 $type =
"audio/x-ms-wma";
3500 $type =
"application/octet-stream";
3503 @ignore_user_abort(
true);
3505 if (!empty($file_content_given)) {
3506 $content_length = strlen($file_content_given);
3508 $content_length = filesize($filename_with_realpath);
3510 if(empty($file_name_given)) {
3511 $file_name_given = basename($filename_with_realpath);
3513 if($force_download) {
3514 header(
'Content-Description: File Transfer');
3516 header(
"Pragma: no-cache");
3517 header(
"Cache-Control: must-revalidate, post-check=0, pre-check=0");
3518 header(
'Expires: Sat, 26 Jul 1997 05:00:00 GMT');
3519 header(
'Last-Modified: '.gmdate(
'D, d M Y H:i:s').
' GMT');
3520 if($force_download) {
3523 if(!empty(
$GLOBALS[
'site_parameters'][
'donwload_headers_force_download_skip'])) {
3524 header(
'Content-Type: application/force-download');
3525 header(
'Content-Type: application/octet-stream',
false);
3526 header(
'Content-Type: application/download',
false);
3528 $content_disposition =
'attachment';
3530 $content_disposition =
'inline';
3532 header(
"Content-Type: " . $type .
"",
false);
3533 header(
"Content-disposition: " . $content_disposition .
"; filename=\"" . rawurlencode($file_name_given) .
"\"");
3534 header(
"Content-Transfer-Encoding: binary");
3535 header(
"Content-Length: " . intval($content_length));
3538 if (!empty($file_content_given)) {
3539 echo $file_content_given;
3541 readfile($filename_with_realpath);
3574 if(in_array($ext, array(
'gif',
'jpg',
'jpeg',
'png'))) {
3591 return '<a href="' .
get_url_from_uploaded_filename(
$filename) .
'" onclick="return(window.open(this.href)?false:true);"><img src="' .
$GLOBALS[
'repertoire_upload'] .
'/thumbs/' .
thumbs(
$filename, $width, $height,
'fit') .
'" alt="" style="max-width: ' . $width .
'px; max-height: ' . $height .
'px" /></a>';
3603 if(empty($field_name)) {
3607 $div_id = $field_name .
'_' . substr(md5(rand()),0,6);
3608 $result = array(
'name' => basename($file),
3609 'div_id' => $div_id,
3610 'form_name' => $field_name,
3611 'form_value' => $file,
3612 'drop_src' =>
$GLOBALS[
'administrer_url'] .
'/images/b_drop.png',
3613 'drop_href' => str_replace(array(
'[DIV_ID]',
"'".$field_name.
"'",
'"'.$field_name.
'"'),array($div_id,
"'".$div_id.
"'",
'"'.$div_id.
'"'), $delete_url),
3615 'type' => $file_type,
3616 'STR_DELETE_THIS_FILE' =>
$GLOBALS[
'STR_DELETE_THIS_FILE']
3618 if($file_type !=
'image') {
3619 $result[
'file_logo_src'] =
$GLOBALS[
'repertoire_upload'] .
'/thumbs/' .
thumbs($file, $logo_width, $logo_height,
'fit');
3632 function get_site_domain($return_only_domains =
false, $domain = null, $strip_subdomain =
true)
3634 if(strpos(
$GLOBALS[
'wwwroot'],
'://127.0.0.1')!==
false) {
3635 return $_SERVER[
"HTTP_HOST"];
3636 }
elseif (empty($domain)) {
3637 $domain = $_SERVER[
"HTTP_HOST"];
3639 $domain = str_replace(array(
'http://',
'https://',
'://',
'//'),
'', $domain);
3640 $temp = explode(
'/', $domain, 2);
3643 $temp = explode(
'.', $domain);
3644 if(count($temp)>1 && (count($temp)!=4 || !is_numeric(str_replace(
'.',
'',$domain)))) {
3646 if(in_array($temp[count($temp)-2], array(
'com',
'org',
'co'))) {
3648 $temp[count($temp)-2] = $temp[count($temp)-2] .
'.' . $temp[count($temp)-1];
3649 unset($temp[count($temp)-1]);
3651 if ($strip_subdomain) {
3652 return $temp[count($temp)-2].
'.'.$temp[count($temp)-1];
3654 return $temp[count($temp)-3].
'.'.$temp[count($temp)-2].
'.'.$temp[count($temp)-1];
3656 }
elseif(!$return_only_domains) {
3678 $quote_terms = array();
3682 if ($match_method == 3) {
3688 preg_match_all(
'/-*".*?"/',
$search, $matched_terms_array);
3690 $quote_terms = preg_replace(
'/"/',
'', $matched_terms_array[0]);
3693 $terms = preg_split(
"/\s+/",
$search, 0, PREG_SPLIT_NO_EMPTY);
3698 return array_unique(array_merge(
$terms, $quote_terms));
3716 if (empty(
$terms) || empty($fields)) {
3719 if ($match_method == 2) {
3720 $compare_type =
'OR';
3722 $compare_type =
'AND';
3725 $conditions_array = array();
3726 foreach (
$terms as $term) {
3735 $this_term_conditions_array = array();
3736 foreach ($fields as $val) {
3744 $conditions_array[] =
'(' . implode((empty($notmod)?
' OR ':
' AND '), $this_term_conditions_array) .
')';
3746 $where_clause =
'( ' . implode(
' ' . $compare_type .
' ', $conditions_array) .
' )';
3748 return $where_clause;
3758 query(
'UPDATE peel_admins_actions
3759 SET remarque="Clotûre a posteriori car pas de fin déclarée par l\'administrateur",
3760 data=DATE_ADD(date, INTERVAL 10 MINUTE)
3761 WHERE ((action = "PHONE_EMITTED") OR (action = "PHONE_RECEIVED")) AND data="NOT_ENDED_CALL" AND ' .
get_filter_site_cond(
'admins_actions') .
'
3765 if (!function_exists(
'desinscription_newsletter')) {
3772 function desinscription_newsletter($mail)
3774 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'desinscription_newsletter.tpl');
3775 $q =
query(
'SELECT id_utilisateur
3776 FROM peel_utilisateurs
3779 query(
'UPDATE peel_utilisateurs
3780 SET newsletter = "0"
3782 $tpl->assign(
'msg',
$GLOBALS[
'STR_DESINSCRIPTION_NEWSLETTER_OK']);
3786 $tpl->assign(
'STR_DESINSCRIPTION_NEWSLETTER',
$GLOBALS[
'STR_DESINSCRIPTION_NEWSLETTER']);
3787 return $tpl->fetch();
3805 if(!empty(
$GLOBALS[
'site_parameters'][
'force_systematic_user_session_reload']) &&
est_identifie()) {
3808 FROM peel_utilisateurs
3813 unset(
$_SESSION[
'session_utilisateur']);
3817 if (mt_rand(1, 10000) == 5000) {
3820 if (mt_rand(1, 10000) == 5000) {
3823 if (mt_rand(1, 10000) == 5000) {
3826 if (mt_rand(1, 10000) == 5000) {
3830 if ($html_page && defined(
'PEEL_DEBUG') && PEEL_DEBUG) {
3836 if(!$html_page && !empty(
$GLOBALS[
'site_parameters'][
'google_analytics_site_code_for_nohtml_pages']) && !
is_user_bot()) {
3838 $var_cookie=10000000+(hexdec(session_id())%89999999);
3839 $var_random=rand(1000000000,2147483647);
3841 $visitorId =
'0x' . substr (md5(
vb($_SERVER[
'REMOTE_ADDR'])),0,16);
3843 if(!empty($_COOKIE[
'__utma'])) {
3844 $utma = $_COOKIE[
'__utma'];
3845 $temp = explode(
'.', $utma);
3846 $var_cookie = $temp[0];
3848 $utma =
''.$var_cookie.
'.'.$var_random.
'.'.$var_today.
'.'.$var_today.
'.'.$var_today.
'.2';
3850 if(!empty($_COOKIE[
'__utmb'])) {
3851 $utmb = $_COOKIE[
'__utmb'];
3853 $utmb = $var_cookie;
3855 if(!empty($_COOKIE[
'__utmc'])) {
3856 $utmc = $_COOKIE[
'__utmc'];
3858 $utmc = $var_cookie;
3860 if(!empty($_COOKIE[
'__utmz'])) {
3861 $utmz = $_COOKIE[
'__utmz'];
3863 $utmz =
''.$var_cookie.
'.'.$var_today.
'.2.2.utmccn%3D(direct)%7Cutmcsr%3D(direct)%7Cutmcmd%3D(none)';
3865 if(!empty($_COOKIE[
'__utmv'])) {
3866 $utmv = $_COOKIE[
'__utmv'];
3868 $utmv = $var_cookie.
'.'.$var_uservar;
3870 $utm_get[] =
"utmwv=" . urlencode(isset($_COOKIE[
'__utmwv'])?$_COOKIE[
'__utmwv']:
'1');
3871 $utm_get[] =
"utmn=" . urlencode(rand(1000000000,9999999999));
3873 $utm_get[] =
"utmr=" . urlencode(
vb($_SERVER[
'HTTP_REFERER']));
3874 $utm_get[] =
"utmp=" . urlencode($_SERVER[
'REQUEST_URI']);
3875 $utm_get[] =
"utmac=" . urlencode(str_replace(
'UA-',
'MO-',
$GLOBALS[
'site_parameters'][
'google_analytics_site_code_for_nohtml_pages']));
3876 $utm_get[] =
"utmcc=__utma%3D" . urlencode($utma) .
'%3B%2B__utmb%3D' . urlencode($utmb) .
'%3B%2B__utmc%3D' . urlencode($utmc) .
'%3B%2B__utmz%3D' . $utmz .
'%3B%2B__utmv%3D' . urlencode($utmv) .
"%3B";
3877 $utm_get[] =
"utmvid=" . urlencode(isset($_COOKIE[
'__utmvid'])?$_COOKIE[
'__utmvid']:$visitorId);
3878 $utm_get[] =
"utmip=" . urlencode(substr(
vb($_SERVER[
"REMOTE_ADDR"]), 0, strrpos(
vb($_SERVER[
"REMOTE_ADDR"]),
'.')).
'.0');
3879 $utm_get[] =
"utmsr=" . urlencode(isset($_COOKIE[
'__utmsr'])?$_COOKIE[
'__utmsr']:
'-');
3880 $utm_get[] =
"utmsc=" . urlencode(isset($_COOKIE[
'__utmsc'])?$_COOKIE[
'__utmsc']:
'-');
3881 $utm_get[] =
"utmul=" . urlencode(isset($_COOKIE[
'__utmul'])?$_COOKIE[
'__utmul']:
'-');
3882 $utm_get[] =
"utmje=" . urlencode(isset($_COOKIE[
'__utmje'])?$_COOKIE[
'__utmje']:
'0');
3883 $utm_get[] =
"utmfl=" . urlencode(isset($_COOKIE[
'__utmfl'])?$_COOKIE[
'__utmfl']:
'-');
3884 $utm_get[] =
"guid=on";
3885 $utm_get[] =
"utmdt=" . urlencode(isset(
$GLOBALS[
'meta_title'])?
$GLOBALS[
'meta_title']:
'-');
3886 $handle = fopen (
'http://www.google-analytics.com/__utm.gif?'.implode(
'&', $utm_get),
"r");
3887 $test = fgets($handle);
3900 $GLOBALS[
'contentMail'] .=
'Optimisation des tables : ';
3904 query(
'OPTIMIZE TABLE `' . $row[0] .
'`');
3907 $GLOBALS[
'contentMail'] .=
'Ok' .
"\r\n\r\n";
3919 $files_deleted =
nettoyer_dir(
$GLOBALS[
'dirroot'] .
'/' .
$GLOBALS[
'site_parameters'][
'cache_folder'], 3600 * 24 * $days_max, $filename_beginning);
3920 if(!empty($GLOBALS[
'contentMail'])) {
3921 $GLOBALS[
'contentMail'] .=
'Suppression des fichiers de plus de ' . $days_max .
' jours dans le dossier ' . $dir .
'/ : ';
3922 $GLOBALS[
'contentMail'] .=
'Ok - ' . $files_deleted .
' fichiers supprimés' .
"\r\n\r\n";
3934 function nettoyer_dir($dir, $older_than_seconds = 3, $filename_beginning = null, $create_files_array_found_instead_of_delete =
false)
3943 if ($dir !=
$GLOBALS[
'dirroot'] && is_dir($dir) && ($dossier = opendir($dir))) {
3944 while (
false !== ($file = readdir($dossier))) {
3945 if ($file !=
'.' && $file !=
'..' && $file[0] !=
'.' && filemtime($dir .
'/' . $file) < time() - $older_than_seconds && is_file($dir .
'/' . $file) && (empty($filename_beginning) || strpos($file, $filename_beginning) === 0)) {
3947 if($create_files_array_found_instead_of_delete) {
3948 $GLOBALS[
'files_found_in_folder'][] = $file;
3950 unlink($dir .
'/' . $file);
3953 }
elseif ($file !=
'.' && $file !=
'..' && is_dir($dir .
'/' . $file)) {
3955 $files_deleted +=
nettoyer_dir($dir .
'/' . $file, $older_than_seconds, $filename_beginning);
3959 return $files_deleted;
3971 $max_reduce_size =
false;
3972 if ($max_reduce_size) {
3973 $days_max2 = 365 + 30;
3975 $GLOBALS[
'contentMail'] .=
'Suppression des infos de connexion utilisateurs de plus de ' . $days_max2 .
' jours dans la BDD : ';
3976 $q =
query(
'SELECT *, MAX(date) AS max_date, MIN(date) AS min_date
3977 FROM peel_utilisateur_connexions uc
3979 HAVING max_date>"' . date(
'Y-m-d H:i:s', time() - $days_max2 * 24 * 3600) .
'" AND min_date<"' . date(
'Y-m-d H:i:s', time() - $days_max2 * 24 * 3600) .
'"');
3980 $users_ids_array = array();
3982 $users_ids_array[] =
$result[
'user_id'];
3984 if (!empty($users_ids_array)) {
3985 query(
'DELETE FROM peel_utilisateur_connexions
3986 WHERE date<="' . date(
'Y-m-d H:i:s', time() - $days_max2 * 24 * 3600) .
'" AND user_id IN ("' . implode(
'","',
nohtml_real_escape_string($users_ids_array)) .
'")');
3988 $GLOBALS[
'contentMail'] .=
'Ok - ' . count($users_ids_array) .
' utilisateurs concernés' .
"\r\n\r\n";
3991 $GLOBALS[
'contentMail'] .=
'Suppression des infos de connexion utilisateurs de plus de ' . $days_max .
' jours dans la BDD : ';
3993 query(
'DELETE FROM peel_utilisateur_connexions
3994 WHERE date<="' . date(
'Y-m-d H:i:s', time() - $days_max * 24 * 3600) .
'"');
4007 $GLOBALS[
'contentMail'] .=
'Suppression des actions administrateur de plus de ' . $days_max .
' jours dans la BDD : ';
4009 query(
'DELETE FROM peel_admins_actions
4010 WHERE date<="' . date(
'Y-m-d H:i:s', time() - $days_max * 24 * 3600) .
'"');
4024 function formSelect ($name, $tab, $preselected_value = null, $addOne = 0, $get = 0)
4027 foreach ($tab as $k => $v) {
4028 $k = ($addOne) ? $k + 1 : $k;
4030 if (!empty($preselected_value)) {
4031 $s = (($preselected_value == $k)) ? (
' selected="selected"') : (
'');
4033 $s = (isset($_POST[
'form_' . $name .
'']) && $_POST[
'form_' . $name .
''] == $k) ? (
' selected="selected"') : (
'');
4035 $s = (isset($_GET[$name]) && urldecode($_GET[
'' . $name .
'']) == $k) ?
' selected="selected"' :
'';
4055 function getTextEditor($instance_name, $width, $height, $default_text, $default_path = null, $type_html_editor = 0, $compter_char_max_if_enabled = 255, $placeholder =
'')
4058 if (is_numeric($width)) {
4059 $width_css = $width .
'px';
4060 $cols = $width / 12;
4062 $width_css = $width;
4065 if (!empty($type_html_editor)) {
4067 $this_html_editor =
vb($type_html_editor);
4070 $this_html_editor =
vn(
$GLOBALS[
'site_parameters'][
'html_editor']);
4073 $css_files = array();
4074 if(!empty(
$GLOBALS[
'site_parameters'][
'bootstrap_enabled'])) {
4075 $css_files[] = get_url(
'/lib/css/bootstrap.css');
4077 if(!empty(
$GLOBALS[
'site_parameters'][
'css'])) {
4079 if(file_exists(
$GLOBALS[
'repertoire_modele'] .
'/css/' . trim($this_css_filename))) {
4080 $css_files[] =
$GLOBALS[
'repertoire_css'] .
'/' . trim($this_css_filename);
4084 if ($this_html_editor ==
'1') {
4086 if(empty(
$GLOBALS[
'html_editor_loaded'])) {
4087 $GLOBALS[
'html_editor_loaded'] =
true;
4088 $GLOBALS[
'js_files_pageonly'][] = get_url(
'/lib/nicEditor/nicEdit.js');
4090 $GLOBALS[
'js_ready_content_array'][] =
'
4091 bkLib.onDomLoaded(function() {
4092 new nicEditor({iconsPath : \'' .
$GLOBALS[
'wwwroot'] .
'/lib/nicEditor/nicEditorIcons.gif\',fullPanel : true}).panelInstance(\'' . $instance_name .
'\');
4096 <div style=
"width:' . $width . '; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;">
4097 <div style=
"min-width:200px">
4098 <textarea name=
"' . $instance_name . '" id=
"' . $instance_name . '" style=
"width:' . $width_css . '; height:' . $height . 'px" rows=
"' . ($height / 12) . '" cols=
"' . $cols . '">
' . String::htmlentities($default_text) . '</textarea>
4102 } elseif ($this_html_editor == '0
') {
4103 $default_text = String::nl2br_if_needed($default_text);
4104 // Editeur FCKeditor
4105 include_once($GLOBALS['dirroot
'] . "/lib/FCKeditor/fckeditor.php");
4106 $oFCKeditor = new FCKeditor($instance_name);
4107 if(empty($default_path)) {
4108 $default_path = get_url('/
');
4110 $oFCKeditor->BasePath = $default_path . 'lib/
FCKeditor/
';
4111 $oFCKeditor->Value = String::htmlspecialchars_decode($default_text, ENT_QUOTES);
4112 $oFCKeditor->Height = $height;
4113 $oFCKeditor->Width = $width;
4114 $oFCKeditor->Config = array('EditorAreaCSS
' => implode(',
', $css_files));
4116 <div style=
"width:' . $width . '; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;">
4117 <div style=
"min-width:550px">
4118 '.$oFCKeditor->CreateHtml().'
4122 } elseif ($this_html_editor == '3
') {
4123 $default_text = String::nl2br_if_needed($default_text);
4125 include_once($GLOBALS['dirroot
'] . "/lib/ckeditor/ckeditor.php");
4126 $config = array('width
' => $width, 'height
' => $height, 'contentsCss
' => $css_files);
4127 $CKEditor = new CKEditor($GLOBALS['wwwroot
'] . '/lib/ckeditor/
');
4128 $CKEditor->returnOutput = true;
4130 <div style=
"width:' . $width . '; max-width: 100%; height:' . $height . 'px; overflow-x: auto; -webkit-overflow-scrolling: touch;">
4131 <div style=
"min-width:270px">
4132 '.$CKEditor->editor($instance_name, String::htmlspecialchars_decode($default_text, ENT_QUOTES), $config).'
4136 } elseif ($this_html_editor == '4
') {
4137 $default_text = String::nl2br_if_needed($default_text);
4139 if(empty($GLOBALS['html_editor_loaded
'])) {
4140 $GLOBALS['html_editor_loaded
'] = true;
4141 $GLOBALS['js_files_pageonly
'][] = get_url('/lib/tiny_mce/jquery.tinymce.js
');
4142 $GLOBALS['js_ready_content_array
'][] = '
4143 $(
"textarea.tinymce").tinymce({
4145 script_url :
"' . $GLOBALS['wwwroot'] . '/lib/tiny_mce/tiny_mce.js",
4149 plugins :
"pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
4150 entity_encoding :
"raw",
4153 theme_advanced_buttons1 :
"save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
4154 theme_advanced_buttons2 :
"cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
4155 theme_advanced_buttons3 :
"tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
4156 theme_advanced_buttons4 :
"insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
4157 theme_advanced_toolbar_location :
"top",
4158 theme_advanced_toolbar_align :
"left",
4159 theme_advanced_statusbar_location :
"bottom",
4160 theme_advanced_resizing :
true,
4161 width: \
''.$width.
'\',
4162 height: \
''.$height.
'\',
4165 content_css :
"'.implode(',', $css_files).'",
4170 <div style=
"width:' . $width . '; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;">
4171 <div style=
"min-width:600px">
4172 <textarea
class=
"tinymce" name=
"' . $instance_name . '" id=
"' . $instance_name . '" style=
"width:' . $width_css . '; height:' . $height . 'px" rows=
"' . ($height / 12) . '" cols=
"' . $cols . '">
' . String::htmlentities($default_text) . '</textarea>
4176 } elseif($this_html_editor == '5
') {
4177 // Champ textarea de base + Compteur de caractères
4179 <textarea
class=
"form-control" placeholder=
"'. $placeholder.'" name=
"' . $instance_name . '" cols=
"' . $cols . '" rows=
"' . ($height / 12) . '" onfocus=
"Compter(this,'.$compter_char_max_if_enabled.',compteur, true)" onkeypress=
"Compter(this,'.$compter_char_max_if_enabled.',compteur, true)" onkeyup=
"Compter(this,'.$compter_char_max_if_enabled.',compteur, true)" onblur=
"Compter(this,'.$compter_char_max_if_enabled.',compteur, true)">
' . String::htmlentities($default_text) . '</textarea><br />
4180 <div
class=
"compteur_contener"><span style=
"margin:5px;">
'.$GLOBALS['STR_REMINDING_CHAR
'].'</span><input
class=
"form-control compteur" type=
"number" name=
"compteur" size=
"4" onfocus=
"blur()" value=
"0" /></div>
4183 // Champ textarea de base
4185 <textarea name=
"' . $instance_name . '" id=
"' . $instance_name . '" style=
"width:' . $width_css . '; height:' . $height . 'px" rows=
"' . ($height / 12) . '" cols=
"' . $cols . '">
' . String::htmlentities($default_text) . '</textarea>
4199 function set_configuration_variable($frm, $update_if_technical_code_exists = false, $allow_create = true)
4201 if(!isset($frm['etat
'])) {
4204 if(!isset($frm['site_id
'])) {
4205 if(defined('IN_PEEL_ADMIN') && isset($_SESSION['session_admin_multisite
'])) {
4206 // Par défaut, s'applique au site en cours d
'utilisation
4207 $frm['site_id
'] = $_SESSION['session_admin_multisite
'];
4209 $frm['site_id
'] = $GLOBALS['site_id
'];
4212 if($update_if_technical_code_exists && !empty($frm['technical_code
'])) {
4213 // On récupère la ligne si elle existe pour ce site_id et pas un autre
4215 FROM peel_configuration
4216 WHERE technical_code = '" . real_escape_string($frm['technical_code']) . "' AND " . get_filter_site_cond('configuration
', null, false, vb($frm['site_id
']), true);
4218 if ($select = fetch_assoc($qid)) {
4219 // Elément déjà existant, qu'on met à jour
4226 if(in_array(
$frm[
'string'], array(
'true',
'false'))) {
4227 $frm[
'type'] =
'boolean';
4229 $frm[
'type'] =
'string';
4231 if(is_array(
$frm[
'string'])) {
4233 $frm[
'type'] =
'array';
4236 $sql_items[] =
"etat = '" . intval(
$frm[
'etat']) .
"'";
4241 FROM peel_configuration
4242 WHERE " . implode(
' AND ', $sql_items) .
" AND " .
get_filter_site_cond(
'configuration', null,
false, 0,
true);
4246 $sql_items[] =
"`last_update` = '" . date(
'Y-m-d H:i:s', time()) .
"'";
4250 if(
$frm[
'type'] ==
'array') {
4253 $GLOBALS[
'site_parameters'][
$frm[
'technical_code']] = $frm[
'string'];
4256 $sql =
"INSERT INTO peel_configuration
4275 if(isset(
$frm[
'string']) && is_array(
$frm[
'string'])) {
4280 unset(
$GLOBALS[
'site_parameters'][
$frm[
'technical_code']]);
4282 $sql =
"DELETE FROM peel_configuration
4286 if(isset(
$frm[
'string'])) {
4287 if(
vb(
$frm[
'type']) ==
'array') {
4290 $GLOBALS[
'site_parameters'][
$frm[
'technical_code']] = $frm[
'string'];
4294 $sql =
"UPDATE peel_configuration
4295 SET etat = '" . intval(
$frm[
'etat']) .
"'
4299 , last_update = '" . date(
'Y-m-d H:i:s', time()) .
"'
4306 if(is_numeric($id_or_technical_code)) {
4307 $sql .=
"id = '" . intval($id_or_technical_code) .
"'";
4325 if($files_type ==
'css') {
4329 $this_wwwroot =
$GLOBALS[
'wwwroot'];
4331 if($files_type ==
'js') {
4333 $excluded_files =
vb(
$GLOBALS[
'site_parameters'][
'minify_js_exclude_array'], array());
4334 $excluded_files[] =
'prototype.js';
4335 $excluded_files[] =
'controls.js';
4336 $excluded_files[] =
'effects.js';
4337 $included_files = array(
'datepicker');
4338 }
elseif($files_type ==
'css') {
4339 if(!empty(
$GLOBALS[
'site_parameters'][
'minify_css_exclude_array'])) {
4340 $excluded_files =
$GLOBALS[
'site_parameters'][
'minify_css_exclude_array'];
4343 $original_files_array = $files_array;
4344 foreach($files_array as $this_key => $this_file) {
4347 $this_file =
'http:' . $this_file;
4350 $this_file = $this_wwwroot . $this_file;
4353 $this_file =
$GLOBALS[
'repertoire_css'] .
'/' . $this_file;
4355 if(
$GLOBALS[
'wwwroot'] != $this_wwwroot) {
4356 $this_file = str_replace(
$GLOBALS[
'wwwroot'], $this_wwwroot, $this_file);
4360 if(!empty($excluded_files)) {
4361 foreach($excluded_files as $this_excluded_file) {
4362 if(strpos($this_file, $this_excluded_file) !==
false) {
4363 $avoid_skip =
false;
4364 if(!empty($included_files)) {
4365 foreach($included_files as $this_included_file) {
4366 if(strpos($this_file, $this_included_file) !==
false) {
4379 $files_to_minify_array[$this_key] = $this_file;
4380 unset($files_array[$this_key]);
4383 if(!empty($_GET[
'update']) && $_GET[
'update'] == 1 && empty(
$GLOBALS[
'already_updated_minify_id_increment'])) {
4384 $GLOBALS[
'site_parameters'][
'minify_id_increment'] = intval(
$GLOBALS[
'site_parameters'][
'minify_id_increment'])+1;
4385 $GLOBALS[
'already_updated_minify_id_increment'] =
true;
4387 $cache_id = md5(implode(
',', $files_to_minify_array) .
','.
vb(
$GLOBALS[
'site_parameters'][
'minify_id_increment']));
4388 $file_name = $files_type .
'_minified_' . substr($cache_id, 0, 8).
'.'.$files_type;
4389 $minified_doc_root =
$GLOBALS[
'dirroot'] .
'/'.$GLOBALS[
'site_parameters'][
'cache_folder'].
'/';
4390 $file_path = $minified_doc_root . $file_name;
4391 if (file_exists(
$file_path) ===
false || (($filemtime = @filemtime(
$file_path)) < time() - $lifetime) || (!empty($_GET[
'update']) && $_GET[
'update'] == 1)) {
4392 if(!empty($_GET[
'update']) && $_GET[
'update'] == 1) {
4394 }
elseif(!empty($filemtime)) {
4395 foreach($files_to_minify_array as $this_key => $this_file) {
4397 if(strpos($this_file,
'//') ===
false || strpos($this_file,
$GLOBALS[
'wwwroot']) !==
false) {
4399 $this_local_path = str_replace(
$GLOBALS[
'wwwroot'],
$GLOBALS[
'dirroot'], $this_file);
4400 $this_mtime = @filemtime($this_local_path);
4401 if(empty($this_mtime) && !file_exists($this_local_path)) {
4403 unset($files_to_minify_array[$this_key]);
4405 if($this_mtime < $filemtime) {
4409 }
elseif(strpos($this_file, $this_wwwroot) !==
false) {
4412 }
elseif(strpos($this_file,
'googleapis') !==
false) {
4413 if($filemtime < time() - min($lifetime*24, 3600*24)) {
4418 if($filemtime < time() - min($lifetime*24, 3600*24)) {
4428 if(!empty($generate)) {
4430 if($files_type ==
'css') {
4431 require_once(
$GLOBALS[
'dirroot'] .
'/lib/class/Minify_CSS.php');
4432 }
elseif($files_type ==
'js') {
4433 if(!version_compare(PHP_VERSION,
'5.3.0',
'<')) {
4435 require_once(
$GLOBALS[
'dirroot'] .
'/lib/class/JShrink.php');
4438 foreach($files_to_minify_array as $this_key => $this_file) {
4439 if($files_type ==
'css') {
4440 $symlinks = array();
4444 if(empty(
$GLOBALS[
'site_parameters'][
'avoid_lang_folders_in_minified_css']) && !empty(
$GLOBALS[
'lang_url_rewriting'][
$_SESSION[
'session_langue']]) && strpos(
$GLOBALS[
'lang_url_rewriting'][$_SESSION[
'session_langue']],
'//') ===
false && strpos(
$GLOBALS[
'lang_url_rewriting'][$_SESSION[
'session_langue']],
'.') ===
false) {
4450 $this_http_main_path = $this_wwwroot;
4452 $options = array(
'currentDir' => str_replace($this_http_main_path,
$GLOBALS[
'dirroot'], dirname($this_file)),
'docRoot' => $docroot,
'symlinks' => $symlinks);
4454 if(!empty($css_content) && strlen(trim($css_content))>5) {
4455 if(
String::strpos(str_replace(
'@import url(http://fonts.googleapis.com',
'', $css_content),
'@import')!==
false) {
4457 $GLOBALS[
'site_parameters'][
'minify_css_exclude_array'][] = $this_file;
4461 if(strlen($css_content)/max(1,substr_count($css_content,
"\n"))>50) {
4464 $options[
'do_compress'] =
false;
4466 $output .=
"\n\n\n".Minify_CSS::minify($css_content, $options);
4468 trigger_error(
'Minify CSS impossible - File load problem : '.str_replace($this_wwwroot,
$GLOBALS[
'dirroot'], $this_file), E_USER_NOTICE);
4473 $write_result =
true;
4479 return $original_files_array;
4482 }
elseif($files_type ==
'js') {
4484 if(!empty($js_content) && strlen(trim($js_content))>5) {
4486 if(strlen($js_content)/max(1,substr_count($js_content,
"\n"))>50 || version_compare(PHP_VERSION,
'5.3.0',
'<')) {
4488 $output .=
"\n\n\n" . $js_content;
4494 $output .=
"\n\n\n".String::file_get_contents_utf8(str_replace($this_wwwroot,
$GLOBALS[
'dirroot'], $this_file));
4500 @flock(
$fp, LOCK_EX);
4503 @flock(
$fp, LOCK_UN);
4505 set_configuration_variable(array(
'technical_code' =>
'minify_id_increment',
'string' =>
$GLOBALS[
'site_parameters'][
'minify_id_increment'],
'type' =>
'integer',
'origin' =>
'auto '.date(
'Y-m-d'),
'site_id' =>
$GLOBALS[
'site_id']),
true);
4507 if(!$write_result) {
4508 return $files_array;
4516 $files_array[key($files_to_minify_array)] = str_replace(
$GLOBALS[
'dirroot'], $this_wwwroot,
$file_path);
4517 return $files_array;
4529 if(empty($sdk_loaded)) {
4532 <div id="fb-root"></div>
4534 $GLOBALS[
'js_content_array'][
'facebook_sdk'] =
'
4535 (function(d, s, id) {
4536 var js, fjs = d.getElementsByTagName(s)[0];
4537 if (d.getElementById(id)) return;
4538 js = d.createElement(s); js.id = id;
4539 js.src = "//connect.facebook.net/fr_FR/all.js#xfbml=1'.(!empty($facebook_api_id)?
'&appId='.$facebook_api_id:
'').
'";
4540 fjs.parentNode.insertBefore(js, fjs);
4541 }(document, \'script\', \'facebook-jssdk\'));';
4556 $queries_results_array = array();
4557 if(
$mode==
'products'){
4558 $sql_additional_cond =
'';
4559 $sql_additional_join =
'';
4560 if(!empty(
$GLOBALS[
'site_parameters'][
'quick_search_results_main_search_field'])) {
4561 $name_field =
$GLOBALS[
'site_parameters'][
'quick_search_results_main_search_field'];
4563 $name_field =
"nom_".(!empty(
$GLOBALS[
'site_parameters'][
'product_name_forced_lang'])?
$GLOBALS[
'site_parameters'][
'product_name_forced_lang']:
$_SESSION[
'session_langue']).
"";
4567 $sql_additional_cond .=
" AND etat='1'";
4571 FROM peel_produits p
4577 $sql_additional_join .=
'INNER JOIN peel_produits_categories pc ON pc.produit_id=p.id';
4580 FROM peel_produits p
4581 ".$sql_additional_join.
"
4585 FROM peel_produits p
4586 ".$sql_additional_join.
"
4589 if(empty(
$GLOBALS[
'site_parameters'][
'autocomplete_fast_partial_search'])) {
4591 FROM peel_produits p
4592 ".$sql_additional_join.
"
4596 foreach($queries_sql_array as $this_query_sql) {
4598 $this_query_sql .=
' LIMIT '.intval(
$maxRows);
4604 if(count($queries_results_array) >=
$maxRows) {
4609 if(!empty(
$GLOBALS[
'site_parameters'][
'user_offers_table_enable'])) {
4612 WHERE num_offre LIKE "'.nohtml_real_escape_string(
$search).
'%"
4621 FROM peel_utilisateurs
4629 return $queries_results_array;
4643 function 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) {
4644 if($table_technical_code ==
'') {
4651 if(is_array($specific_site_id)) {
4652 $specific_site_id = current($specific_site_id);
4654 if(in_array($table_technical_code, array(
'continents'))) {
4658 if(!empty(
$GLOBALS[
'site_parameters'][
'multisite_disable']) || !empty(
$GLOBALS[
'site_parameters'][
'multisite_disable_' . $table_technical_code])) {
4661 }
elseif(defined(
'IN_IPN') && !empty(
$GLOBALS[
'site_parameters'][
'multisite_disable_in_ipn'])) {
4665 if(!empty($table_alias)) {
4668 }
elseif($table_alias === null) {
4674 if ($specific_site_id !== null) {
4676 $site_id = $specific_site_id;
4678 if(empty(
$GLOBALS[
'site_id']) && defined(
'IN_CRON') && $use_strict_rights_if_in_admin ===
false && $exclude_public_items ===
false) {
4686 if (defined(
'IN_PEEL_ADMIN')) {
4687 if(isset(
$_SESSION[
'session_utilisateur'][
'site_id']) &&
$_SESSION[
'session_utilisateur'][
'site_id'] == 0) {
4689 if($admin_force_multisite_if_allowed) {
4692 }
elseif(isset(
$_SESSION[
'session_admin_multisite']) && $specific_site_id === null) {
4693 if(intval(
$_SESSION[
'session_admin_multisite'])==0) {
4698 $site_id = intval(
$_SESSION[
'session_admin_multisite']);
4699 if($use_strict_rights_if_in_admin) {
4700 $exclude_public_items =
true;
4704 }
elseif($specific_site_id === null) {
4706 if($use_strict_rights_if_in_admin) {
4707 $exclude_public_items =
true;
4714 }
elseif(!empty($site_id) && !empty(
$_SESSION[
'session_utilisateur'][
'site_id']) && $site_id !=
$_SESSION[
'session_utilisateur'][
'site_id'] && $site_id !=
vn(
$GLOBALS[
'site_id']) && empty(
$GLOBALS[
'site_parameters'][
'multisite_disable_utilisateurs'])) {
4717 }
elseif(isset(
$_SESSION[
'session_site_country']) && !empty(
$GLOBALS[
'site_parameters'][
'site_country_allowed_array']) && in_array($table_technical_code, array(
'articles',
'marques',
'html',
'produits',
'vignettes_carrousels'))) {
4723 if($exclude_public_items) {
4725 if(empty(
$GLOBALS[
'site_parameters'][
'multisite_using_array_for_site_id'])) {
4726 $cond_array[] = $prefix.word_real_escape_string($field).
"='".intval($site_id).
"'";
4728 $cond_array[] =
"FIND_IN_SET('" . intval($site_id) .
"', " . $prefix.word_real_escape_string($field) .
")";
4731 if(empty(
$GLOBALS[
'site_parameters'][
'multisite_using_array_for_site_id'])) {
4733 $cond_array[] = $prefix.word_real_escape_string($field).
" IN (0,'" . intval($site_id) .
"')";
4735 $cond_array[] =
"(FIND_IN_SET('0', " . $prefix.word_real_escape_string($field) .
") OR FIND_IN_SET('" . intval($site_id) .
"', " . $prefix.word_real_escape_string($field) .
"))";
4738 return implode(
' AND ', $cond_array);
4749 if(!is_array($site_ids)) {
4750 $site_ids = array($site_ids);
4752 $output =
"" . implode(
",", $site_ids) .
"";
4764 static $all_sites_name_array;
4765 $output_array = array();
4766 if(!is_array($site_ids)) {
4767 $site_ids = explode(
',', $site_ids);
4769 foreach($site_ids as $this_site_id) {
4770 if($this_site_id == 0) {
4771 $output_array[] =
vb(
$GLOBALS[
'STR_ADMIN_ALL_SITES'],
'*');
4773 if(!isset($all_sites_name_array)) {
4776 if(isset($all_sites_name_array[$this_site_id])) {
4777 $output_array[] = $all_sites_name_array[$this_site_id];
4781 return implode(
', ', $output_array);
4792 function get_all_sites_name_array($admin_force_multisite_if_allowed =
false, $allow_null_site_id =
false, $skip_rights_check =
false) {
4793 $all_sites_name_array = array();
4796 $sql =
'SELECT site_id
4797 FROM peel_configuration
4798 WHERE ' . (!$allow_null_site_id?
'site_id!="0" ':
'') .
' ' . (!$skip_rights_check?
'AND '.
get_filter_site_cond(
'configuration', null,
true, null,
false, $admin_force_multisite_if_allowed):
'') .
'
4803 $query_name =
query(
'SELECT string
4804 FROM peel_configuration
4808 if (!empty($result_name[
'string'])) {
4809 $all_sites_name_array[
$result[
'site_id']] = $result_name[
'string'];
4812 $query_wwwroot =
query(
'SELECT string
4813 FROM peel_configuration
4817 $all_sites_name_array[
$result[
'site_id']] = str_replace(array(
'http://' ,
'https://'),
'', $result_wwwroot[
'string']);
4820 return $all_sites_name_array;
4831 if (!empty(
$GLOBALS[
'site_parameters'][
'user_job_array'])) {
4833 foreach(
$GLOBALS[
'site_parameters'][
'user_job_array'] as $this_job_code=>$this_job) {
4838 $output .=
'<option value="'.String::str_form_value($this_job_code).
'" ' .
frmvalide($selected_fonction_name == $this_job_code,
' selected="selected"') .
'>'.$this_job.
'</option>';
4852 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'generic_options.tpl');
4854 foreach ($values_array as $tab_type) {
4857 'name' => $tab_type[
'name'],
4858 'issel' => ($tab_type[
'id'] == $selected_values)
4877 if(!empty($site_id)) {
4878 $sql =
"SELECT c.string, l.url_rewriting
4879 FROM peel_configuration c
4881 WHERE c.technical_code = 'wwwroot' AND " .
get_filter_site_cond(
'configuration',
'c',
false, $site_id) .
" AND c.etat=1
4889 $output[$site_id.
'_'.
$lang] = get_lang_rewrited_wwwroot($lang);
4903 include(
$GLOBALS[
'dirroot'] .
"/lib/fonctions/display_user_forms.php");
4905 include(
$GLOBALS[
'fonctionsphotodesk']);
4910 if (!empty(
$frm) && empty($_GET[
'prodid'])) {
4911 if (!empty(
$frm[
'phone'])) {
4919 if (!empty(
$GLOBALS[
'site_parameters'][
'contact_form_short_mode'])) {
4921 array(
'nom' =>
$GLOBALS[
'STR_ERR_NAME'],
4922 'email' =>
$GLOBALS[
'STR_ERR_EMAIL'],
4923 'texte' =>
$GLOBALS[
'STR_ERR_MESSAGE'],
4927 array(
'nom' =>
$GLOBALS[
'STR_ERR_NAME'],
4928 'telephone' =>
$GLOBALS[
'STR_ERR_TEL'],
4929 'email' =>
$GLOBALS[
'STR_ERR_EMAIL'],
4930 'texte' =>
$GLOBALS[
'STR_ERR_MESSAGE'],
4931 'sujet' =>
$GLOBALS[
'STR_ERR_SUBJECT'],
4935 $frm[
'email'] = trim(
$frm[
'email']);
4945 if (empty(
$frm[
'code'])) {
4953 unset(
$frm[
'code']);
4958 if (!
verify_token(
'user_contact', 120,
false,
true, 5)) {
4968 if(empty($_SERVER[
'HTTP_USER_AGENT']) || $_SERVER[
'REQUEST_METHOD'] !=
"POST" ||
is_user_bot()) {
4973 if (empty(
$_SESSION[
'session_form_contact_sent'])) {
4974 $_SESSION[
'session_form_contact_sent'] = 0;
4976 if (
$_SESSION[
'session_form_contact_sent'] <
vb(
$GLOBALS[
'site_parameters'][
'contact_form_max_sent_by_session'], 8)) {
4977 if(
$_SESSION[
'session_form_contact_sent']>0) {
4978 sleep(
$_SESSION[
'session_form_contact_sent']);
4980 $mail_spam_points = floor(
$_SESSION[
'session_form_contact_sent']*10/
vb(
$GLOBALS[
'site_parameters'][
'contact_form_max_sent_by_session'], 8));
4982 $mail_spam_points += getSpamPoints(
$frm[
'texte'],
$frm[
'email']);
4984 if($mail_spam_points <=
vb(
$GLOBALS[
'site_parameters'][
'contact_form_max_spam_points_allowed'], 20)) {
4987 $_SESSION[
'session_form_contact_sent']++;
4990 $frm[
'is_ok'] =
true;
4993 $form_validated =
true;
4995 }
elseif (!empty($_GET[
'prodid'])) {
4998 if (!empty(
$frm[
'critere'])) {
5000 $criteres = explode(
"|",
$frm[
'critere']);
5001 $couleur_id = intval(
vn($criteres[0]));
5002 $taille_id = intval(
vn($criteres[1]));
5004 $couleur_id = intval(
vn(
$frm[
'couleur']));
5005 $taille_id = intval(
vn(
$frm[
'taille']));
5008 $_SESSION[
'session_taille_id'] = $taille_id;
5015 $frm[
'texte'] =
$GLOBALS[
'STR_PRODUCT'] .
$GLOBALS[
'STR_BEFORE_TWO_POINTS'] .
": " .$product_object->name.
5016 (!empty($color)?
"\r\n" .
$GLOBALS[
'STR_COLOR'] .
$GLOBALS[
'STR_BEFORE_TWO_POINTS'] .
": " . $color :
'' ).
5017 (!empty($size)?
"\r\n" .
$GLOBALS[
'STR_SIZE'] .
$GLOBALS[
'STR_BEFORE_TWO_POINTS'] .
": " . $size :
'' ).
5018 (!empty(
$product_object->configuration_attributs_list) ?
"\r\n" . str_replace(
'<br />',
"\r\n",
$product_object->configuration_attributs_description) :
'');
5021 if(empty($form_validated)) {
5027 $frm[
'telephone'] =
vb(
$_SESSION[
'session_utilisateur'][
'telephone']);
5033 $frm[
'code_postal'] =
vb(
$_SESSION[
'session_utilisateur'][
'code_postal']);
5034 if(isset(
$_SESSION[
'session_utilisateur'][
'pays'])) {
5051 $qid =
query(
"SELECT *
5052 FROM peel_codes_promos
5057 if (empty(
$frm[
"date_debut"])) {
5060 if (empty(
$frm[
"date_fin"])) {
5061 $frm[
"date_fin"] =
get_formatted_date(date(
"Y-m-d", mktime(0, 0, 0, date(
'm'), date(
'd') + 30, date(
'Y'))));
5063 if (empty(
$frm[
'on_type'])) {
5064 $frm[
'on_type'] = 2;
5066 if (empty(
$frm[
'source'])) {
5067 $frm[
'source'] =
'CHQ';
5069 if (!isset(
$frm[
'nombre_prevue'])) {
5070 $frm[
'nombre_prevue'] = 1;
5072 if (!isset(
$frm[
'nb_used_per_client'])) {
5073 $frm[
'nb_used_per_client'] = 1;
5076 $sql =
"INSERT INTO peel_codes_promos (
5093 , nb_used_per_client
5095 , cat_not_apply_code_promo
5104 , '" . intval(
$frm[
'on_type']) .
"'
5105 , '" . intval(
vb(
$frm[
'on_check'])) .
"'
5107 , '" . intval(
vn(
$frm[
'etat'])) .
"'
5109 , '" . intval(
vb(
$frm[
'id_utilisateur'])) .
"'
5111 , '" . intval(
vb(
$frm[
'id_categorie'])) .
"'
5112 , '" . intval(
vb(
$frm[
'nombre_prevue'])) .
"'
5113 , '" . intval(
vb(
$frm[
'nb_used_per_client'])) .
"'
5133 return $result[
'default_vat'];
5151 $specific_fields = array();
5152 $field_types_with_single_value_array = array(
'datepicker',
'hidden',
'password',
'separator',
'text',
'textarea',
'html',
'upload');
5154 $specific_field_prefix = $form_usage;
5155 if (in_array($form_usage, array(
'reseller',
'user'))) {
5156 $mandatory_field_prefix =
'user';
5158 $mandatory_field_prefix = $specific_field_prefix;
5162 $specific_field_types =
vb(
$GLOBALS[
'site_parameters'][$specific_field_prefix .
'_specific_field_types']);
5163 $specific_field_names =
vb(
$GLOBALS[
'site_parameters'][$specific_field_prefix .
'_specific_field_names']);
5164 $specific_field_values =
vb(
$GLOBALS[
'site_parameters'][$specific_field_prefix .
'_specific_field_values']);
5165 $specific_field_positions =
vb(
$GLOBALS[
'site_parameters'][$specific_field_prefix .
'_specific_field_positions']);
5166 $specific_field_steps =
vb(
$GLOBALS[
'site_parameters'][$specific_field_prefix .
'_specific_field_steps']);
5169 if(!empty($specific_field_titles)) {
5170 foreach($specific_field_titles as $this_field => $this_title) {
5172 if (!empty($specific_field_steps) && is_numeric($step) && !empty($specific_field_steps[$step]) && !in_array($this_field,
get_array_from_string($specific_field_steps[$step]))) {
5180 $this_title =
$GLOBALS[$this_title];
5182 if (defined(
'IN_CHANGE_PARAMS') && !empty(
$GLOBALS[
'site_parameters'][
'disable_user_specific_field_on_change_params_page']) && in_array($this_field,
$GLOBALS[
'site_parameters'][
'disable_user_specific_field_on_change_params_page'])) {
5186 $this_position =
vb($specific_field_positions[$this_field]);
5187 $field_type =
vb($specific_field_types[$this_field],
'text');
5190 if (empty($specific_field_values[$this_field]) && in_array($specific_field_types[$this_field], array(
'radio',
'hidden',
'checkbox'))) {
5195 if ($field_type ==
'checkbox') {
5196 if (isset(
$frm[$this_field])) {
5197 if (is_array(
$frm[$this_field])) {
5199 $frm_this_field_values_array =
$frm[$this_field];
5202 $frm_this_field_values_array = explode(
',',
$frm[$this_field]);
5207 $frm_this_field_values_array = array(
vb(
$frm[$this_field]));
5209 if (empty($frm_this_field_values_array[0])) {
5211 if (defined(
'IN_PEEL_ADMIN')) {
5213 $frm_this_field_values_array = array(
vb(
$GLOBALS[
'site_parameters'][
'funding_admin_form_default_values'][$this_field]));
5216 $frm_this_field_values_array = array(
vb(
$GLOBALS[
'site_parameters'][
'funding_form_default_values'][$this_field]));
5219 $this_field_infos = array(
'field_type' => $field_type,
5220 'field_name' => $this_field,
5221 'field_title' => $this_title,
5222 'field_position' => $this_position,
5225 'STR_CHOOSE' =>
$GLOBALS[
'STR_CHOOSE']
5227 if (in_array($field_type, $field_types_with_single_value_array) || empty($field_type) || empty($specific_field_names[$this_field])) {
5228 if (!empty($frm_this_field_values_array[0])) {
5230 $this_value = $frm_this_field_values_array[0];
5234 if($field_type ==
'html') {
5235 $this_field_infos[
'text_editor_html'] =
getTextEditor($this_field,
'100%', 300, $this_value, null, 3);
5237 if ($field_type ==
'datepicker') {
5240 $this_field_infos[
'field_value'] = $this_value;
5246 foreach($this_field_values as $this_key => $this_value) {
5249 $this_field_values[$this_key] =
$GLOBALS[$this_value];
5254 foreach($this_field_values as $this_key => $this_value) {
5255 if ($this_field==
"ad_closed") {
5257 $issel = (
vb(
$frm[
'date_insertion']) ==
"0000-00-00 00:00:00");
5259 $issel = in_array($this_value, $frm_this_field_values_array);
5261 $this_field_infos[
'options'][] = array(
'value' => $this_value,
5263 'name' => $this_field_names[$this_key]
5267 if($field_type ==
'upload' && !empty($this_value)) {
5269 $delete_link =
'javascript:reinit_upload_field("'.$this_field.
'");';
5272 $specific_fields[] = $this_field_infos;
5275 return $specific_fields;
5287 $table_correspondance = array(
'user' =>
'utilisateurs',
'order' =>
'commandes',
'ad' =>
'lot_vente');
5288 $adresses_potentiel_fields_array = array(
'prenom',
'nom',
'adresse',
'code_postal',
'ville',
'pays',
'email',
'contact');
5289 if(empty($table_correspondance[$form_usage])) {
5292 $specific_fields_titles =
vb(
$GLOBALS[
'site_parameters'][$form_usage .
'_specific_field_titles'], array());
5293 $specific_field_types =
vb(
$GLOBALS[
'site_parameters'][$form_usage .
'_specific_field_types'], array());
5298 foreach($this_table_field_names as $this_field) {
5300 if(in_array($this_field, $adresses_potentiel_fields_array)) {
5301 $frm[
'adresses_fields_array'][$this_field] = $this_field;
5305 if (empty($specific_fields_titles) || empty($specific_fields_titles[$this_field])) {
5310 if ($form_usage ==
'user' && (defined(
'IN_REGISTER') || defined(
'IN_RETAILER')) && !empty(
$GLOBALS[
'site_parameters'][
'disable_user_specific_field_on_register_page']) && in_array($this_field,
$GLOBALS[
'site_parameters'][
'disable_user_specific_field_on_register_page'])) {
5313 }
elseif (
vb($specific_field_types[$this_field]) ==
'upload') {
5314 $frm[$this_field] =
upload($this_field,
false,
'image',
$GLOBALS[
'site_parameters'][
'image_max_width'],
$GLOBALS[
'site_parameters'][
'image_max_height'], null, null,
vb(
$frm[$this_field]));
5316 if (isset(
$frm[$this_field])) {
5317 if (
vb($specific_field_types[$this_field]) ==
'datepicker') {
5321 $frm[$this_field] = implode(
',',
$frm[$this_field]);
5322 }
elseif(!is_array(
$frm[$this_field]) && (strpos(
vb($this_table_field_types[$this_field]),
'int(') !==
false || strpos(
vb($this_table_field_types[$this_field]),
'float(') !==
false)) {
5324 if(strpos(
vb($this_table_field_types[$this_field]),
'int(') !==
false) {
5325 $frm[$this_field] = round(
$frm[$this_field]);
5328 $frm[
'specific_field_values'][$this_field] =
$frm[$this_field];
5343 foreach($specific_field_infos_array as $specific_fields) {
5344 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'specific_field.tpl');
5345 $tpl->assign(
'f', $specific_fields);
5346 if(!empty($specific_fields[
'error_text'])) {
5347 $error_on_page =
true;
5349 if(!empty($specific_fields[
'field_title']) || !in_array($specific_fields[
'field_type'], array(
'hidden',
'separator',
'textarea',
'html'))) {
5350 if($display_mode ==
'div') {
5352 <div class="row" style="margin-bottom:10px">
5353 <div class="col-sm-6 col-md-5 col-lg-4">'.(!empty($specific_fields[
'field_title'])?$specific_fields[
'field_title'].
''. (!empty($specific_fields[
'mandatory']) ?
' <span class="etoile">*</span>':
'') .
$GLOBALS[
'STR_BEFORE_TWO_POINTS'] .
':':
'') .
'</div>
5354 <div class="col-sm-6 col-md-7 col-lg-8">' .
$tpl->fetch() .
vb($specific_fields[
'error_text']) .
'</div>
5360 <td>'.$specific_fields[
'field_title'].
''. (!empty($specific_fields[
'mandatory']) ?
' <span class="etoile">*</span>':
'') .
$GLOBALS[
'STR_BEFORE_TWO_POINTS'] .
':</td>
5361 <td>' .
$tpl->fetch() .
vb($specific_fields[
'error_text']) .
'</td>
5365 if($display_mode ==
'div') {
5367 <div style="margin-bottom:10px">
5368 ' .
$tpl->fetch() .
'
5374 <td>' .
$tpl->fetch() .
vb($specific_fields[
'error_text']) .
'</td>
5379 if(!empty($error_on_page)) {
5389 if(defined(
'IN_PEEL_ADMIN')) {
5390 $wwwroot =
$GLOBALS[
'wwwroot_in_admin'];
5394 $GLOBALS[
'js_files'][] = $wwwroot .
'/lib/js/jquery-fineuploader.js';
5395 $GLOBALS[
'css_files'][] = $wwwroot .
'/lib/css/fineuploader.css';
5397 window.init_fineuploader = function(object) {
5398 object.fineUploader({
5401 endpoint: "' . $wwwroot .
'/fine_uploader.php?origin=' . urlencode($_SERVER[
'SCRIPT_FILENAME']) .
'",
5402 inputName: object.attr("id")
5404 failedUploadTextDisplay: {
5414 }).on("complete", function(event, id, fileName, responseJSON) {
5415 if (responseJSON.success) {
5416 object.replaceWith(responseJSON.html);
5420 window.reinit_upload_field = function(input_name) {
5421 $("#"+input_name).replaceWith("<div class=\"uploader\" id=\""+input_name+"\"></div>");
5422 init_fineuploader($("#"+input_name));
5425 $GLOBALS[
'js_ready_content_array'][] =
'
5426 $("input[type=file]").each(function () {
5427 $(this).replaceWith("<div class=\"uploader\" id=\""+$(this).attr("name")+"\"></div>");
5429 $(".uploader").each(function () {
5430 init_fineuploader($(this));
5447 if(!isset(
$GLOBALS[
'nbprod_update'])) {
5449 $GLOBALS[
'nbprod_update_null'] = 0;
5451 $GLOBALS[
'nbprod_categorie_insert'] = 0;
5454 if (!empty($field_values[
'site_id'])) {
5455 $site_id = $field_values[
'site_id'];
5460 if (!empty($field_values[
'id_marque'])) {
5461 if(!is_array($field_values[
'id_marque'])) {
5462 $field_values[
'id_marque'] = array($field_values[
'id_marque']);
5464 foreach($field_values[
'id_marque'] as $this_key => $this_field_value) {
5473 $this_brand_id_array = $brand[
'id'];
5475 $sql_select_brand =
'SELECT id
5478 $query_brand =
query($sql_select_brand);
5480 $this_brand_id_array = $brand[
'id'];
5481 }
elseif(!empty($this_field_value) && !is_numeric($this_field_value)) {
5483 $q =
query(
'INSERT INTO peel_marques
5487 $output .=
$GLOBALS[
'tplEngine']->createTemplate(
'global_success.tpl', array(
'message' => sprintf(
$GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_MSG_BRAND_CREATED'],
$GLOBALS[
'line_number'], $field_values[
'id_marque'])))->fetch();
5494 $field_values[
'id_marque'] = end($this_brand_id_array);
5498 foreach($field_values as $this_field_name => $this_value) {
5499 if (!empty($this_field_name) && !in_array($this_field_name,
$columns_skipped)) {
5501 if((empty(
$product_field_names) || in_array($this_field_name,
$product_field_names)) && !in_array($this_field_name, array(
'id',
'Categorie',
'categorie_id')) && in_array($this_field_name, $product_table_field_names)) {
5503 if(
String::strpos($this_field_name,
'nom_') === 0 &&
String::strlen($this_field_name) == 6 && !empty(
$GLOBALS[
'site_parameters'][
'product_name_forced_lang']) && $this_field_name !=
'nom_' .
$GLOBALS[
'site_parameters'][
'product_name_forced_lang']) {
5507 if(
String::strpos($this_field_name,
'description_') === 0 &&
String::strlen($this_field_name) == 14 && !empty(
$GLOBALS[
'site_parameters'][
'product_description_forced_lang']) && $this_field_name !=
'description_' .
$GLOBALS[
'site_parameters'][
'product_description_forced_lang']) {
5515 unset($field_values[$this_field_name]);
5519 if (!empty($field_values[
'id'])) {
5521 if (!empty($set_sql_fields)) {
5522 $sql =
"UPDATE peel_produits
5523 SET " . implode(
', ', $set_sql_fields) .
"
5524 WHERE id='" . intval($field_values[
'id']) .
"' AND " .
get_filter_site_cond(
'produits', null,
true) .
"";
5540 WHERE id='" . intval($field_values[
'id']) .
"' AND " .
get_filter_site_cond(
'produits', null,
true));
5547 $set_sql_fields[
'id'] =
"id='" . intval($field_values[
'id']) .
"'";
5551 if (!isset(
$product_id) && !empty($set_sql_fields)) {
5553 $sql =
"INSERT INTO peel_produits
5554 SET " . implode(
', ', $set_sql_fields);
5565 $output .=
'Problem empty product_id';
5570 foreach($field_values as $this_field_name => $this_field_value) {
5571 if($admin_mode && $this_field_name ==
$GLOBALS[
'STR_ADMIN_EXPORT_PRODUCTS_COLORS']) {
5573 query(
'DELETE FROM peel_produits_couleurs
5575 $this_list_color = explode(
",", $this_field_value);
5576 foreach($this_list_color as $this_id => $this_value){
5578 if(!is_numeric($this_value)) {
5579 $sql_select_color =
'SELECT *
5582 $query_color =
query($sql_select_color);
5584 $this_value = $color[
'id'];
5586 $sql_insert_color =
'INSERT INTO peel_couleurs (nom_'.$_SESSION[
'session_langue'].
', site_id)
5588 query($sql_insert_color);
5592 $sql_select_product_color =
'SELECT *
5593 FROM peel_produits_couleurs
5594 WHERE produit_id = "' . intval(
$product_id) .
'" AND couleur_id = "' . intval($this_value) .
'"';
5595 $query_select_product_color =
query($sql_select_product_color);
5597 $sql_match_product_color =
'INSERT INTO peel_produits_couleurs(produit_id,couleur_id)
5598 VALUES ("' . intval(
$product_id) .
'","' . intval($this_value) .
'")';
5599 query($sql_match_product_color);
5603 }
elseif($admin_mode && $this_field_name ==
$GLOBALS[
'STR_ADMIN_EXPORT_PRODUCTS_SIZES']){
5605 query(
'DELETE FROM peel_produits_tailles
5607 $this_list_size = explode(
",", $this_field_value);
5608 foreach($this_list_size as $this_id => $this_value){
5609 $this_list_size_and_price = explode(
"§", $this_value);
5610 $size_name = $this_list_size_and_price[0];
5612 $size_price =
vn($this_list_size_and_price[1]);
5613 $size_price_reseller =
vn($this_list_size_and_price[2]);
5616 $sql_size =
'SELECT *
5619 $query_size =
query($sql_size);
5622 query(
'UPDATE peel_tailles
5627 query(
'UPDATE peel_tailles
5631 $this_size_id = $size[
'id'];
5633 $sql_insert_size =
'INSERT INTO peel_tailles (nom_'.$_SESSION[
'session_langue'].
', prix, prix_revendeur, site_id)
5635 query($sql_insert_size);
5638 $select_size_product =
'SELECT *
5639 FROM peel_produits_tailles
5640 WHERE produit_id = "' . intval(
$product_id) .
'" AND taille_id = "' . intval($this_size_id) .
'"';
5641 $query_size_product =
query($select_size_product);
5643 $sql_match_product_size =
'INSERT INTO peel_produits_tailles (produit_id, taille_id)
5644 VALUES ("' . intval(
$product_id) .
'", "' . intval($this_size_id) .
'")';
5645 query($sql_match_product_size);
5649 }
elseif (strpos($this_field_name,
"§") !==
false) {
5652 $this_bulk_discount = explode(
"§", $this_field_name);
5653 $this_quantity = $this_bulk_discount[0];
5654 $this_price_standard = $this_bulk_discount[1];
5655 $this_price_reseller = $this_bulk_discount[2];
5657 if(!empty($this_field_value)){
5658 $this_package_price = explode(
"§", $this_field_value);
5659 $quantity = $this_package_price[0];
5660 $price_standard = $this_package_price[1];
5661 $price_reseller = $this_package_price[2];
5663 $sql_prix_lot =
'SELECT *
5666 $query_prix_lot =
query($sql_prix_lot);
5668 $sql_update =
'UPDATE peel_quantites
5669 SET quantite = "'.intval($quantity).
'"';
5670 if(isset($this_price_standard) && isset($price_standard)) {
5671 $sql_update.=
', prix ="'.nohtml_real_escape_string($price_standard).
'"';
5673 if(isset($this_price_reseller) && isset($price_reseller)) {
5674 $sql_update.=
', prix_revendeur ="'.nohtml_real_escape_string($price_reseller).
'"';
5677 WHERE produit_id="' . intval(
$product_id) .
'" AND quantite = "'.intval($quantity).
'"';
5680 $output .=
$GLOBALS[
'tplEngine']->createTemplate(
'global_success.tpl', array(
'message' => sprintf(
$GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_MSG_TARIF_UPDATED'],
vb($price_standard),
vb($price_reseller),
vb($quantity),
$product_id)))->fetch();
5683 if(isset($quantity) && $quantity > 0) {
5684 $q =
'INSERT INTO peel_quantites
5686 $q.=
', quantite ="'.intval($quantity).
'"
5688 if(isset($this_price_standard) && isset($price_standard)){
5689 $q.=
', prix ="'.nohtml_real_escape_string($price_standard).
'"';
5691 if(isset($this_price_reseller) && isset($price_reseller)){
5692 $q.=
', prix_revendeur ="'.nohtml_real_escape_string($price_reseller).
'"';
5696 $output .=
$GLOBALS[
'tplEngine']->createTemplate(
'global_success.tpl', array(
'message' => sprintf(
$GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_MSG_TARIF_CREATED'],
vb($price_standard),
vb($price_reseller),
vb($quantity),
$product_id)))->fetch();
5710 unset($this_categories_array);
5711 if (!empty($field_values[
'categorie_id']) && !is_numeric($field_values[
'categorie_id']) && empty($field_values[
'Categorie'])) {
5713 $field_values[
'Categorie'] = $field_values[
'categorie_id'];
5714 unset($field_values[
'categorie_id']);
5716 if (!empty($field_values[
'Categorie'])) {
5718 foreach(explode(
',', $field_values[
'Categorie']) as $this_category) {
5719 if (is_numeric($this_category)) {
5721 $this_categorie_id = intval($this_category);
5725 FROM peel_categories
5729 $this_categorie_id = $categorie[
'id'];
5732 $q =
query(
'INSERT INTO peel_categories
5736 $output .=
$GLOBALS[
'tplEngine']->createTemplate(
'global_success.tpl', array(
'message' => sprintf(
$GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_MSG_CATEGORY_CREATED'], $this_category, $this_categorie_id)))->fetch();
5740 $this_categories_array[] = $this_categorie_id;
5743 if (!empty($field_values[
'categorie_id'])) {
5747 $this_categories_array[] = $field_values[
'categorie_id'];
5750 $output .=
$GLOBALS[
'tplEngine']->createTemplate(
'global_error.tpl', array(
'message' => sprintf(
$GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_ERR_REFERENCE_DOES_NOT_EXIST'], $field_values[
'categorie_id'])))->fetch();
5754 if (!empty($this_categories_array)) {
5755 if(empty(
$GLOBALS[
'site_parameters'][
'products_import_reset_category_associations_disable'])) {
5757 query(
'DELETE FROM peel_produits_categories
5760 foreach($this_categories_array as $this_categorie_id) {
5761 if (!empty($this_categorie_id)) {
5763 $q =
query(
'SELECT produit_id, categorie_id
5764 FROM peel_produits_categories
5765 WHERE produit_id="' . intval(
$product_id) .
'" AND categorie_id="' . intval($this_categorie_id) .
'"');
5767 query(
'INSERT INTO peel_produits_categories
5769 categorie_id="' . intval($this_categorie_id) .
'"');
5770 $GLOBALS[
'nbprod_categorie_insert']++;
5779 $this_list_stock = explode(
",", $field_values[
"Stock"]);
5780 $stock_frm = array();
5781 foreach($this_list_stock as $this_id => $this_value){
5782 $this_list_infos = explode(
"§", $this_value);
5784 $stock_frm[
"stock"][$this_id] = $this_list_infos[0];
5785 $this_value =
vb($this_list_infos[1]);
5786 if(is_numeric($this_value)) {
5787 $stock_frm[
"couleur_id"][$this_id] = $this_value;
5788 }
elseif(!empty($this_value) && !is_numeric($this_value)) {
5789 $sql_select_color =
'SELECT *
5792 $query_color =
query($sql_select_color);
5794 $stock_frm[
"couleur_id"][$this_id] = $color[
'id'];
5797 if(!empty($this_list_infos[2])) {
5799 $sql_size =
'SELECT *
5802 $query_size =
query($sql_size);
5804 $stock_frm[
"taille_id"][$this_id] = $size[
'id'];
5808 $output .= insere_stock_produit($stock_frm);
5810 if (
check_if_module_active(
'stock_advanced') && !empty($field_values[
'on_stock']) && $field_values[
'on_stock'] == 1) {
5812 insert_product_in_stock_table_if_not_exist(
$product_id, 1);
5825 $pos1 =
vb($arg1[
'position'], 999999);
5826 $pos2 =
vb($arg2[
'position'], 999999);
5827 if ($pos1 < $pos2) {
5829 }
elseif ($pos1 == $pos2) {
set_lang_configuration_and_texts($lang, $load_default_lang_files_before_main_lang_array=null, $general_setup=true, $load_modules_files=true, $load_general_admin_files=true, $exclude_empty_string=true, $skip_load_files=false)
On charge les variables de langue, en complétant éventuellement avec la langue de référence...
foreach(array('date1', 'date2', 'type', 'renewals', 'width') as $item) $data
static strtoupper($string)
Returns string with all alphabetic characters converted to uppercase.
get_site_name($site_ids, $skip_rights_check=false)
Retourne le nom d'un ou de plusieurs sites à partir de l'id.
handle_contact_form($frm, $skip_introduction_text=false)
Gère l'affichage du formulaire de contact, avec les erreurs et le message de confirmation d'envoi...
get_quick_search_results($search, $maxRows, $active_only=false, $search_category=null, $mode= 'products')
get_quick_search_results()
if(!function_exists('desinscription_newsletter')) close_page_generation($html_page=true)
Fonction à appeler à la fin de la génération d'une page, afin d'exécuter certaines requêtes SQL qui n...
if(isset($_GET['catid'])&&empty($_GET['catid'])) if(empty($_GET['catid'])&&!empty($GLOBALS['site_parameters']['disallow_main_category'])&&empty($_GET['convert_gift_points'])) $catid
load_site_parameters($lang=null, $skip_loading_currency_infos=false, $forced_site_id=null)
On charge les variables de configuration On récupère d'abord les données valables pour tous les sites...
handle_site_suspended()
Affiche ou non le fait que le site est suspendu.
fetch_row($query_result)
fetch_row()
getTextEditor($instance_name, $width, $height, $default_text, $default_path=null, $type_html_editor=0, $compter_char_max_if_enabled=255, $placeholder= '')
getTextEditor()
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_discount_text($remise_valeur, $remise_percent, $is_remise_valeur_including_taxe)
Retourne la remise d'un code promotionnel (en % dans le cas d'une remise en pourcentage ou dans le fo...
check_language($this_lang, $langs_array)
Vérification de l'existance de la langue, et redirection si nécessaire ou nouvelle langue définie...
clean_Cache($days_max=15, $filename_beginning=null)
Suppression des anciens fichiers de cache.
if(!defined('IN_PEEL')) affiche_tagcloud($return_mode=false)
affiche_tagcloud()
build_terms_clause($terms, $fields, $match_method)
builds the sql statement's where clause this will build the sql based on the given information Valeur...
static strpos($haystack, $needle, $offset=0)
Returns the numeric position of the first occurrence of needle in the haystack string.
get_current_url($with_get=true, $get_short_url=false, $take_away_get_args_array=null)
get_current_url()
charge_article($id, $show_all_etat_if_admin=true)
charge_article()
static rawurldecode($string, $avoid_slash=false)
Returns rawurldecode.
is_user_tva_intracom_for_no_vat($user_id=null)
is_user_tva_intracom_for_no_vat()
get_wwwroot_cdn($subject)
Renvoyer un CDN si défini, ou à défaut wwwroot.
handle_register_globals()
Empêche les effets de register_globals.
upload($field_name, $rename_file=true, $file_kind=null, $image_max_width=null, $image_max_height=null, $path=null, $new_file_name_without_extension=null, $default_return_value=null)
Fonction d'upload de fichiers.
output_general_http_header($page_encoding=null, $cache_duration_in_seconds=null)
Envoie les headers avant l'envoi du HTML.
get_document_image_html($filename, $width=100, $height=100)
Renvoie une image correspondant au type de fichier.
attributes_create_or_update($this_field_name, $this_field_value, $product_id, $site_id, $admin_mode=false)
Insertion d'une liste d'attributs en base de données pour un produit donné
while($attrib=fetch_assoc($q_nom_attrib)) $columns_skipped
get_minified_src($files_array, $files_type= 'css', $lifetime=3600)
get_minified_src()
handle_template_engine_init($templates_force_compile=false)
Appelle le moteur de template pour définir $GLOBALS['tplEngine'].
get_currency_rate($currency)
Récupère le taux de change avec l'euro d'une devise à partir de son code à 3 lettres.
check_captcha($code, $id)
get_tag_analytics()
get_tag_analytics()
static fopen_utf8($filename, $mode, $force_filename_in_iso_8859=false, $try_filename_in_iso_8859_if_file_not_found=true)
Ouvre un fichier.
redirect_and_die($url, $permanent_redirection=false, $avoid_loop=false)
Redirige vers l'URL demandée et arrête le programme.
build_search_terms($search, $match_method)
Découpe la chaine recherchée en éléments distincts suivant le mode $match_method Valeurs de $match_me...
formSelect($name, $tab, $preselected_value=null, $addOne=0, $get=0)
formSelect()
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...
unique_id()
Création d'un mot de passe crypté
static html_entity_decode_if_needed($string)
String::html_entity_decode_if_needed()
affected_rows($database_object=null)
affected_rows()
delete_captcha($form_object_id)
params_affiche_produits($condition_value1, $unused, $type, $nb_par_page, $mode= 'general', $reference_id=0, $nb_colonnes, $always_show_multipage_footer=true, $additional_sql_inner=null, $additional_sql_cond=null, $additionnal_sql_having=null, $use_index_sql=null)
params_affiche_produits()
if(!select_db($_SESSION['session_install_choixbase'], $GLOBALS['database_object'], true)) $error
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...
get_color_name($color_id)
Renvoie le nom d'une couleur.
insert_id($database_object=null)
insert_id()
http_download_and_die($filename_with_realpath, $serve_download_with_php=true, $file_content_given=null, $file_name_given=null, $force_download=true)
Envoie les entêtes HTTP puis le contenu pris dans un fichier ou dans l'argument $file_content_given s...
static strtolower($string)
Returns string with all alphabetic characters converted to lowercase.
insere_ticket(&$frm)
Envoi un message de contact au support du site Limitation pour éviter spam : utiliser session_form_co...
static file_get_contents_utf8($filename, $force_filename_in_iso_8859=false, $try_filename_in_iso_8859_if_file_not_found=true)
Renvoie le contenu d'un fichier.
generate_token($name= 'general', $use_existing_token=true)
Génère un token en session qui permettra ensuite de vérifier l'authenticité de la requête de l'utilis...
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 ...
get_current_generic_url()
get_current_generic_url()
get_upload_errors_text($file_infos, $file_kind= 'image')
Fonction de contrôle pour l'upload de fichier.
static create($type, $templadeDir, $forceCompile=false, $debugging=false)
Creates EngineTpl adapter of specified type.
get_category_name($id)
Renvoie le nom d'une catégorie de produits.
create_or_update_product($field_values, $columns_skipped=array(), $product_field_names=array(), $specific_fields_array=array(), $admin_mode=false)
Import d'un produit : mise à jour ou création du produit.
get_default_vat()
Retourne le taux de TVA le plus élevé, que l'on considère comme le taux de tva par défaut...
affiche_last_views($location)
Affiche la liste des produits déjà consultés par le client en cours.
get_sons_cat($all_parents_with_ordered_direct_sons_array, $catid, $ids_array=array())
Récupère la liste des fils d'une catégorie à partir d'une liste ordonnée.
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
if(!function_exists('ipGet')) if(!function_exists('isPublicIP')) is_user_bot($ip=null, $user_agent=null)
Renvoie si le visiteur est un robot ou non.
if(!defined('IN_PEEL')) $GLOBALS['page_types_array']
if(empty($_GET['id'])) if(!empty($GLOBALS['site_parameters']['allow_multiple_product_url_with_category'])) $product_object
microtime_float()
microtime_float()
if(empty($new_file_name_without_extension)) $the_new_file_name
if(!defined('IN_PEEL')) thumbs($source_filename, $width, $height, $method= 'fit', $source_folder=null, $thumb_folder=null, $thumb_rename=true, $return_absolute_path=false)
Charge l'image dont le nom est $source_filename dans le répertoire d'upload, et crée une vignette pou...
real_escape_string($value)
real_escape_string()
if(isset($_POST['pays_zone'])) elseif(empty($_SESSION['session_caddie']->zoneId)&&!empty($GLOBALS['site_parameters']['default_delivery_zone_id'])) if(isset($_POST['type'])) elseif(empty($_SESSION['session_caddie']->typeId)&&!empty($GLOBALS['site_parameters']['default_delivery_type_id'])) if(!empty($_POST['code_promo'])) if(!empty($_GET['code_promo'])&&$_GET['code_promo']== 'delete') $form_error_object
get_identified_lang($langs_array=array())
On identifie la langue utilisée, et on redirige si cette langue n'est pas activée Pour qu'une langue ...
handle_setup_redirections($url, $mode= 'redirect')
Gère les redirections définies dans $GLOBALS['site_parameters']['redirections'].
get_javascript_output($async=false, $minify=false, $output_only_script_loading=false, $js_filenames_array=array('js_files', 'js_files_pageonly', 'js_files_nominify', 'js_files_noasync', 'js_files_nominify_noasync'))
Chargement du chargement des scripts.
getFlashBannerHTML($url, $width=680, $height=250, $mode_transparent=false)
Renvoie le HTML d'un tag corespondant à l'URL du fichier flash transmis en paramètre.
if(!defined('IN_PEEL')) affiche_best_seller_produit_colonne($return_mode=false, $location=null, $nb_col_sm=3, $nb_col_md=4)
Affiche la liste des catégories qui sont spéciales.
get_user_job_options($selected_fonction_name=null)
get_specific_field_infos($frm, $form_error_object=null, $form_usage="user", $step=null)
Permet de définir de nouveaux champs dans le formulaire d'inscription / modification d'utilisateur de...
necessite_priv($priv, $demo_allowed=true, $configuration_modification=false)
Cette fonction vérifie si l'utilisateur a les privilèges de $priv.
get_modules($location, $return_mode=false, $technical_code=null, $id_categorie=null, $this_annonce_number=0, $return_array_with_raw_information=false, $criterias=null)
Récupère le contenu HTML des modules en fonction des contraintes données en paramètre Il est possible...
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.
static register($prepend=false)
Registers Twig_Autoloader as an SPL autoloader.
format_filename_base($original_name, $rename_file=true)
A partir d'un nom de fichier, on génère un nouveau nom unique pour éviter d'utiliser un nom déjà exis...
get_category_tree_and_itself($id_or_ids_array, $mode= 'sons', $table_to_use= 'categories')
get_category_tree_and_itself()
if(!defined('IN_PEEL')) display_prices_with_taxes_active()
display_prices_with_taxes_active()
if(!defined("IN_PEEL")) $peel_langues["nom"]
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.
optimize_Tables()
optimize_Tables()
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="".
clean_utilisateur_connexions($days_max=730)
Suppression des anciennes infos de connexion utilisateurs Fonction associée à une notion de nettoyage...
get_table_field_types($table_name, $link_identifier=null, $silent_if_error=false)
get_table_field_types()
get_country_select_options($selected_country_name=null, $selected_country_id=null, $option_value= 'name', $display_inactive_country=false, $allowed_zone_id=null, $preselect_shop_country_if_none_selected=true, $selected_country_lang=null, $allowed_ids=null)
get_country_select_options()
get_uploaded_file_infos($field_name, $file, $delete_url, $logo_width=100, $logo_height=100)
Remplit un tableau d'informations pour le template d'upload HTML.
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))
necessite_identification()
Si l'utilisateur n'est pas connecté à un compte, on affiche une page d'identification et arrête le sc...
handle_sessions()
Gère les sessions PHP et des protections contre des vols de session.
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_generic_options($values_array, $selected_values=null)
handle_php_default_setup()
Définit les paramètres de base de PHP.
get_modules_array($only_active=false, $location=null, $technical_code=null, $force_update_cache_information=false, $specific_site_id=null, $exclude_public_items=false)
Retourne les modules sous forme de tableau.
delete_uploaded_file_and_thumbs($filename)
delete_uploaded_file_and_thumbs()
get_table_field_names($table_name, $link_identifier=null, $silent_if_error=false)
get_table_field_names()
updateTelContactNotClosed()
updateTelContactNotClosed()
fetch_object($query_result)
fetch_object()
if(!defined('IN_PEEL')) image_resize($origin_filename_with_path, $new_filename_with_path, $destinationW=null, $destinationH=null, $resize_even_if_smaller=false, $allow_keep_origin_file_if_resize_not_needed=true, $filesize_limit_keep_origin_file=102400, $jpeg_quality=85, $gammacorrect=1.0)
On redimensionne l'image pour qu'elle ne dépasse pas la taille de destination Le ratio largeur / haut...
get_tag_function_countries_titles_list()
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 : [...
data_position_sort($arg1, $arg2)
Comparer l'ordre de deux tableaux qui contiennent un élément "position" pour trier des tableaux de do...
get_file_type($filename)
get_file_type()
is_delivery_address_necessary_for_delivery_type($selected_delivery_type_id=null)
is_delivery_address_necessary_for_delivery_type()
get_all_site_countries_array($admin_force_multisite_if_allowed=false, $exclude_public_items=false, $show_only_site_country_allowed_array=false)
Retourne un tableau des noms des pays.
insere_code_promo($frm)
Créer un code promo pour l'administration et la création de chèque cadeaux lors du paiement d'une com...
get_tag_function_countries_values_list($mode= 'id')
Fonction permettant de récupérer les noms des pays, sous forme de liste séparée par des virgules...
update_configuration_variable($id_or_technical_code, $frm, $delete=false)
update_configuration_variable()
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.
if(!check_if_module_active('search')) $page_encoding
set_paiement(&$frm)
Traitement du moyen de paiement.
static minify($js, $options=array())
Takes a string containing javascript and removes unneeded characters in order to shrink the code with...
get_delivery_type_options($selected_delivery_type_id_or_name=null)
get_delivery_type_options()
get_form_token_input($name= 'general', $use_existing_token=true, $return_as_input_form=true)
get_form_token_input()
calcul_nbprod_parcat($catid, $all_parents_with_ordered_direct_sons_array)
calcul_nbprod_parcat()
get_site_wwwroot($site_id, $lang=null)
Renvoie l'URL d'un site donné
load_active_languages_list($site_id=null)
On charge les variables de listes de langues.
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.
get_css_files_to_load($minify=false)
get_css_files_to_load()
get_attribut_list_from_post_data(&$product_object, &$frm, $keep_free_attributs_only=false, $keep_costly_attributs_only=false)
Traite les informations relatives aux attributs dans le post d'un formulaire produit.
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 ...
nettoyer_dir($dir, $older_than_seconds=3, $filename_beginning=null, $create_files_array_found_instead_of_delete=false)
Effacement des fichiers trouvés répondant aux critères en argument, en effaçant récusivement le conte...
static html_entity_decode($string, $quote_style=ENT_COMPAT, $charset=GENERAL_ENCODING)
String::html_entity_decode()
get_current_url_in_other_language($this_lang)
Ce module de gestion des URL dans d'autres langues doit être compatible avec l'URL Rewriting si activ...
set_configuration_variable($frm, $update_if_technical_code_exists=false, $allow_create=true)
Ajoute la zone HTML dans la table peel_configuration.
verify_token($name= 'general', $delay_in_minutes=60, $check_referer_if_set_by_server=true, $cancel_token=true, $minimum_wait_in_seconds_before_use=0)
Vérification de la validité d'un token Par défaut, un token est valide 1h, et utilisable 1 seule fois...
MDP($chrs=8)
Fonction utilisée pour générer un mot aléatoire (sert par exemple pour le renommage des fichiers imag...
get_url_from_uploaded_filename($filename)
get_url_from_uploaded_filename()
affiche_banner($position=null, $return_mode=false, $page=null, $cat_id=null, $this_annonce_number=0, $page_type=null, $keywords_array=null, $lang=null, $return_array_with_raw_information=false, $ad_id=null, $page_related_to_user_id=null, $disable_cache=false)
affiche_banner()
get_xml_value($filename, $filter_string, $items_count_max=8, $line_length_max=50)
get_xml_value()
fprix($price, $display_currency=false, $currency_code_or_default=null, $convertion_needed_into_currency=true, $currency_rate=null, $display_iso_currency_code=false, $format=true, $force_format_separator=null, $add_rdfa_properties=false, $round_even_if_no_format=false)
fprix formatte le prix donné en le convertissant si nécessaire au préalable et en ajoutant éventuelle...
display_specific_field_form($specific_field_infos_array, $display_mode= 'table')
Traiter l'affichage de champs spécifiques.
clean_admins_actions($days_max=1460)
Suppression des anciennes actions administrateur Fonction associée à une notion de nettoyage automati...
save_mail_db($frm)
Cette fonction permet de sauvegarder les emails du formulaire de contact du site en base de données d...
get_payment_select($selected_payment_technical_code=null, $show_selected_even_if_not_available=false, $show_site_info_if_needed=false)
get_payment_select()
db_close($database_object=null)
db_close()
static convert_accents($string, $convert_umlaut=false, $strip_umlaut=true)
convert_accents()
static substr($string, $start, $length=null)
Returns the portion of string specified by the start and length parameters.
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...
clean_str($string)
Filtre une chaine de caractères.
get_site_info($array)
get_site_info()
get_site_domain($return_only_domains=false, $domain=null, $strip_subdomain=true)
Récupère le nom de domaine du site sans http:// et sans sous-domaine.
get_apparent_folder()
Renvoyer le répertoire racine apparent de l'URL courante.
get_country_id($country_name)
get_country_id()
get_size_name($size_id)
Renvoie le nom d'une taille.
get_load_facebook_sdk_script($facebook_api_id=null)
get_load_facebook_sdk_script()
get_datepicker_javascript($load_timepicker=false)
get_datepicker_javascript()
init_fineuploader_interface()
Définit les variables javascript nécessaires pour initialiser fineuploader.
calcul_nbarti_parrub($rub)
calcul_nbrub()
if(defined('IN_PEEL_ADMIN')||IN_INSTALLATION) $_SESSION['session_langue']
static rawurlencode($string, $avoid_slash=true)
Returns string compatible with Apache without the AllowEncodedSlashes directive ON => avoids systemat...
get_country_name($id)
Renvoie le nom d'un pays.