/DEV/LIB/common.functions.php
PHP | 7552 lines | 4863 code | 1106 blank | 1583 comment | 1286 complexity | 3fb67c2dde3df8b70cd34cfe9e5886d9 MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- <?php
- $test = include('/data/apache/CONF_URL/conf.php');
- if (!$test)
- require('/data/apache/CONF_URL/prod.conf.php');
- //bandeaux personnalisables
- //include(realpath(dirname(__FILE__) . "/../DATA/bandeaux/libelles_bandeaux.php"));
- global $_global;
- //##############################################################################
- //# Définition des constantes fonctionnelles
- // Répertoire dans lequel les fichiers generes par les scripts des crons sont enregistres
- define('URL_DATA', '/data/apache/DATA/');
- // Appel depuis un script => Pas de DOCUMENT_ROOT !!!
- //$display = rtrim($_SERVER['DOCUMENT_ROOT'],'/');
- $display = realpath(dirname(__FILE__) . '/../DISPLAY');
- $root = dirname($display);
- // Gérer les document root de Orange (et autres), qui ont DISPLAY
- // directement à la racine !!
- if (substr($root, -4) == '/DEV')
- $root = dirname($root);
- define('ROOT_PATH', $root); // ex: /data/apache/www/www.logic-immo.com
- define('DISPLAY_PATH', $display); // ex: /data/apache/www/www.logic-immo.com/DEV/DISPLAY
- // Répertoire dans lequel les librairies (fonctions, classes) sont enregistrees
- $current_lib_dir = dirname(__FILE__);
- // PB : Si la constante a déjà été définie dans une autre page !!
- if (defined('URL_LIB')) {
- // Simuler une erreur fatale pour qu'on recoive un mail en cas de problème
- error_log("FATAL ERROR - La constante URL_LIB a deja ete definie ! (VALEUR:" . URL_LIB . ")");
- // Enregistrer le backtrace dans le fichier de log
- ob_start() or exit();
- debug_print_backtrace();
- $content = ob_get_contents();
- error_log($content);
- ob_end_clean();
- } else {
- define('URL_LIB', $current_lib_dir); // ex: /data/apache/www/www.logic-immo.com/DEV/LIB
- }
- //##############################################################################
- //# Chargement de la configuration par environnement
- // Récupérer le chemin du fichier de conf
- $conf_file = ROOT_PATH . '/CONF/conf.php';
- $test = include($conf_file);
- // Gestion en cas de configuration introuvable
- if (!$test) {
- // Utiliser la configuration de production
- $test = include(ROOT_PATH . '/CONF/prodA.conf.php');
- if (!$test) {
- // Simuler une erreur fatale pour qu'on recoive un mail en cas de problème
- error_log("FATAL ERROR - Le fichier de configuration `{$conf_file}` n\'a pas ete trouve. (DOCUMENT_ROOT:{$_SERVER['DOCUMENT_ROOT']})");
- // Enregistrer le backtrace dans le fichier de log
- ob_start() or exit();
- debug_print_backtrace();
- $content = ob_get_contents();
- error_log($content);
- ob_end_clean();
- // Ne pas plus faire de traitement avec des constantes manquantes !
- exit();
- }
- }
- //##############################################################################
- //# Inclure les librairies relatives à MMF
- include_once(URL_LIB . '/mmf.constants.php');
- include_once(URL_LIB . '/mmf.functions.php');
- //##############################################################################
- //##
- //## direct_hit($ip) -- returns true if url hits a frontal server
- //## add_parameters($url, $site = "", $lang = "", $univers = "") -- returns an url along with the environment parameters
- //## add_parameter($url, $parameter, $value) -- returns an url along with a parameter and value
- //## del_parameter($url, $parameter) -- returns an url without a parameter
- //## get_all_summary_cz($data) -- returns an array of human readable values, translated from search criteria (CZ)
- //## get_all_summary($data,$showIfAllChecked) -- returns an array of human readable values, translated from search criteria
- //## get_adv_summary($data,$extended,$showIfAllChecked) -- return an array of human readable values from advanced criterias
- //## get_summary($data, $parameters, $item, $label_all, $label_unit) -- turns a search criterion to a human readable value
- //## get_property_type_label($id) -- returns property type label depending on the code
- //## n_f($value) -- number_format shortcut
- //## currency_format($value, $from, $to, $add_currency_name = true) -- currency conversion
- //## sosex($input, $partial = false) -- Function so sex, par le so sexy oxman, da crazy man !
- //## str_limit($value, $limit) -- returns a truncated string
- //## remove_returns($value) -- returns a clean string
- //## resize_image($img, $max_width, $max_height) -- returns html height and width properties, determining the size of an image to fit required width and height
- //## spacer($height, $width) -- returns html code for a spacer
- //## set_html_title($value) -- returns html alt and title
- //##
- //## get_ad_data($page, $value, $has_premium = 0, $url = "", $idx = -1) -- returns ad and agency data
- //## get_ag_data($page, $value) -- returns agency data
- //## get_pub_data($value, $key) -- returns pub data
- //## get_mmf_type($label) -- returns mmf type index
- //##
- //## format_phone($value, $country = "FR") -- returns formatted number
- //## get_parameter_index($name, $value) -- returns parameter index
- //## is_guid($value) -- returns true if value is a guid
- //## back_to_list($page) -- returns "back to list" url
- //## build_search_url($page, $parameters) -- returns a search url
- //## from_page($previous_url, $page) -- returns true if page comes from Mars
- //## is_external() -- returns true if is external
- //## is_ref_page($page) -- returns true if is a ref page
- //## get_zip_code($data, $mode) -- returns szip / lzip
- //## writeLockFile($sLockFileName, $sLockFileDescription) --
- //## getLockFile($sLockFileName) --
- //## checkLockFile($sLockFileName) -- xx
- //## removeLockFile($sLockFileName) --
- //## truncate($chaine, $length = 50) -- Tronque un texte (mais pas les mots !) si trop long et rajoute des points de suspension
- //## loc2xiti($k1,$n1,$k2,$n2) --
- //## format_footer_link($str) --
- //## generateMd5MaintenanceString($iOperationCode, $sPreSharedKey) --
- //## checkSha1MaintenanceString($sPreSharedKey, $iOperationCode, $aOperationArray, $sKeyString) --
- //## redirection($url) -- Gere la presence des headers
- //## verif_cookie_prehome -- Gestion de la revisite Belge (modifiable pour les autres Pays)
- //## pub_relais_neuf_cookie($val_relais) -- Verification les nombres de refresh
- //## Verif_Url_BE() -- verifier la syntax de l'URL pour le site BE
- //## Get_Lockey_By_Name_Level($name, $level=1, $site="xx", $lang="xx") -- Retrouve le Loc_key en fonction d'un name et d'un level
- //## Get_Trad_Locname ($lockey, $lang) -- Retrouve la traduction d'un nom de Locname en fonction d'un LCT_ID et d'une Langue
- //## TextNoAccent($string) -- Supprime les accents d'une chaine
- //## => Déprécié : Regarder la fonction prepareToUrl($string)
- //##
- //## check_detail_exist -- Vérifie si il existe des détail spécifique sur une annonce
- //## create_block_nosearch($title)
- //## no_magic_quote() -- pour eviter les injection S-K-UL
- //## uc_strtoupper_fr($chaine) -- Amélioration du strtoupper de PHP pour gérer les accents
- //##
- //## getLocalityLabel($search_parameters,$num) -- Renvoyer la localite selon le level ("tous codes" ...)
- //## stringToHexa($string,$size) -- Convertir la chaine de 0 et 1 en hexa
- //## hexaToString($string,$size) -- Convertir la chaine hexa en 0 et 1
- //##
- //## searchPropertyTypeIdOrig($id_orig,$get_group) -- Récupérer le groupe ou la chaine de 40bits (par défaut)
- //## searchPropertyTypeIdOrigAdv($id_orig,$get_group) -- Récupérer le groupe ou la chaine de 40bits (par défaut)
- //## => Utilise les nouveaux groupes (plus nombreux et quasi unitaires)
- //##
- //##############################################################################
- //
- //
- // 20080820-XI $ad["default_sector"] should not be displayed if $ad["default_town"]==$ad["default_sector"]
- // 20090401-1-XI, Retrieving xxx_locality_2_agency field (mantis 5342)
- // 20090407-1-XI, Setting agc loc of ads to 0 if id_presto='CMM-PT-BDL-EXPRESSO'
- // 20090410-1-XI, Retrieving xxx_tel2_agency
- // 20090610-1-XI, NOT Setting agc loc of ads to 0 if id_presto='CMM-PT-BDL-EXPRESSO', mantis 5865
- //
- //##############################################################################
- function open_file(&$filepath, $requestType = '', $mode = 'a', $backupFolder = TRAPPED_WRITE_ERROR) {
- // Enregistrer la statistique dans le csv
- $fp = @fopen($filepath, 'a');
- if ($fp === false) {
- error_log('FATAL ERROR - Could not open file `' . $filepath . '` to save "' . $requestType . '" request !');
- // Utiliser le dossier de secours pour ne pas perdre les demandes
- $filepath = $backupFolder . $requestType . '/' . basename($filepath);
- // Enregistrer la statistique dans le csv
- $fp = @fopen($filepath, 'a');
- if ($fp === false) {
- error_log('FATAL ERROR - Could not open file `' . $filepath . '` to save "' . $requestType . '" request !');
- }
- }
- return $fp;
- }
- /**
- * Returns true if url hits a frontal server
- *
- * @param unknown_type $ip
- * @return unknown
- */
- function direct_hit($ip) {
- global $_prodServers;
- return in_array($ip, $_prodServers);
- }
- /**
- * Returns an url along with the environment parameters
- *
- * @param unknown_type $url
- * @param unknown_type $site
- * @param unknown_type $lang
- * @param unknown_type $univers
- * @return unknown
- */
- function add_parameters($url, $site = "", $lang = "", $univers = "") {
- global $_global;
- // default values
- $site = ($site == "" ? $_global["site"] : $site);
- $lang = ($lang == "" ? $_global["lang"] : $lang);
- $univers = ($univers == "" ? $_global["univers"] : $univers);
- // sets url parameters into an array
- $tmp = explode("?", $url);
- parse_str($tmp[1], $url_parameters);
- // adds site parameter
- if (!array_key_exists("site", $url_parameters)) {
- $add_parameters["site"] = $site;
- } else {
- $url_parameters["site"] = $site;
- }
- // adds universe parameter
- if (!array_key_exists("univers", $url_parameters)) {
- $add_parameters["univers"] = $univers;
- } else {
- $url_parameters["univers"] = $univers;
- }
- // adds language parameter
- if (!array_key_exists("lang", $url_parameters)) {
- $add_parameters["lang"] = $lang;
- } else {
- $url_parameters["lang"] = $lang;
- }
- // merges parameters
- if (is_array($add_parameters)) {
- $url_parameters = array_merge($add_parameters, $url_parameters);
- }
- // concatenates
- $url = $tmp[0] . "?" . http_build_query($url_parameters);
- switch ($_global["site"]) {
- case "be":
- if (strpos($url, "http:") === false) {
- $url = "/" . $lang . "/" . $url;
- $url = str_replace("//", "/", $url);
- }
- break;
- default:
- break;
- }
- // returns
- return $url;
- }
- /**
- * Returns an url along with a parameter and value
- *
- * @param unknown_type $url
- * @param unknown_type $parameter
- * @param unknown_type $value
- * @return unknown
- */
- function add_parameter($url, $parameter, $value) {
- // sets url parameters into an array
- $tmp = explode("?", $url);
- parse_str($tmp[1], $url_parameters);
- if (!array_key_exists($parameter, $url_parameters)) {
- $url_parameters[$parameter] = $value;
- // concatenates
- $url = $tmp[0] . "?" . http_build_query($url_parameters);
- }
- // returns
- return $url;
- }
- /**
- * Returns an url without a parameter
- *
- * @param unknown_type $url
- * @param unknown_type $parameter
- * @return unknown
- */
- function del_parameter($url, $parameter) {
- // sets url parameters into an array
- $tmp = explode("?", $url);
- parse_str($tmp[1], $url_parameters);
- if (array_key_exists($parameter, $url_parameters)) {
- unset($url_parameters[$parameter]);
- // concatenates
- $url = $tmp[0] . "?" . http_build_query($url_parameters);
- }
- // returns
- return $url;
- }
- /**
- * Returns an array of human readable values, translated from search criteria
- *
- * @param Array $data
- * @param Boolean $showIfAllChecked List all values (1,2,...) if all checked ?
- * @param Boolean $useAdvancedGroups Utiliser les groupes de types de bien avancés (plus nombreux)
- * @return unknown
- */
- function get_all_summary($data, $showIfAllChecked = true, $useAdvancedGroups = false) {
- global $_global;
- // summary table
- $summary = array();
- // vacances
- if ($_global["univers"] == 13) {
- // globals
- global $_LI_BEDROOMS;
- global $_LI_PEOPLE;
- // load values
- $parameters = array();
- $parameters["nb_bedrooms"] = $_LI_BEDROOMS;
- $parameters["nb_people"] = $_LI_PEOPLE;
- // univers
- $summary["univers"] = LABEL_COMMON_UNIVERSE_13;
- // localisation
- $summary["loc_name"] = $data["loc_name"];
- // property types
- if ($data["property_type"] == "" || $data["property_type"][0] == -1 || count($data["property_type"]) == 8) {
- $summary["property_type"] = LABEL_ALL_PROPERTY_TYPE;
- } else {
- for ($i = 0; $i < count($data["property_type"]); $i++) {
- $data["property_type"][$i] = constant("LABEL_COMMON_PROPERTY_" . $data["property_type"][$i]);
- }
- $summary["property_type"] = implode(", ", $data["property_type"]);
- }
- // bedrooms
- $summary["nb_bedrooms"] = get_summary($data, $parameters["nb_bedrooms"], "nb_bedrooms", LABEL_ALL_BEDROOMS, LABEL_COMMON_BEDROOMS_UNIT);
- // people
- $summary["nb_people"] = get_summary($data, $parameters["nb_people"], "nb_people", LABEL_ALL_PEOPLE, LABEL_COMMON_PEOPLE_UNIT);
- } else {
- // globals
- global $_LI_PRICERANGE;
- global $_LI_ADSURFACE;
- global $_LI_ROOMS;
- // load values
- $parameters = array();
- $parameters["area"] = $_LI_ADSURFACE;
- $parameters["price"] = $_LI_PRICERANGE;
- $parameters["nb_rooms"] = $_LI_ROOMS;
- // univers
- if ($data["univers"] == 2) { // location
- $summary["univers"] = LABEL_COMMON_UNIVERSE_2;
- } else if ($data["univers"] == 8) { // colocation
- $summary["univers"] = LABEL_COMMON_UNIVERSE_8;
- } else { // vente
- $summary["univers"] = LABEL_COMMON_UNIVERSE_1;
- }
- $loc_names = array();
- if (isset($data['is_from_cookie'])) {
- for ($i = 1; $i < 4; $i++) {
- if (isset($data['loc_name' . $i]) && ($locname = $data['loc_name' . $i]) != '' && $locname != LABEL_DEFAULT_LOCALITY) {
- $loc_names[] = ucwords2(strtolower($data['loc_name1']));
- }
- $locname = implode(', ', $loc_names);
- }
- } else {
- // localisation
- $loc_name = getLocalityLabel($data, 0);
- if ($loc_name != LABEL_DEFAULT_LOCALITY)
- $loc_names[] = ucwords2(strtolower($loc_name));
- $loc_name = getLocalityLabel($data, 1);
- if ($loc_name != LABEL_DEFAULT_LOCALITY)
- $loc_names[] = ucwords2(strtolower($loc_name));
- $loc_name = getLocalityLabel($data, 2);
- if ($loc_name != LABEL_DEFAULT_LOCALITY)
- $loc_names[] = ucwords2(strtolower($loc_name));
- if ($loc_names == array()) {
- $locname = ucwords2(strtolower($data["loc_name"]));
- // Ajouter manuellement les parentheses autour des codes postaux
- // En veillant à ne pas les doubler si déjà présentes
- $locname = preg_replace('`\(?([0-9]{3,})\)?`', '($1)', $locname);
- }
- else
- $locname = implode(', ', $loc_names);
- // Remplacer les -+_ par un espace
- $locname = strtr($locname, array('-' => ' ', '+' => ' ', '_' => ' '));
- // Mettre la chaine tous codes postaux entre parentheses
- $locname = str_ireplace('TOUS CODES POSTAUX', '(Tous codes postaux)', $locname);
- // Séparer les parentheses avec une virgule
- $locname = str_replace(') ', '), ', $locname);
- // Ajouter les apostrophes devant les L et le D
- $locname = preg_replace('`\b(L|D) `i', '$1\'', $locname);
- }
- // Ajout la valeur de localité
- if ($locname != '')
- $summary["loc_name"] = $locname;
- // property types
- if (isset($data["ck_property_type"])) {
- $property_type = $data['ck_property_type'];
- // Si champ vide, ou aucun coché
- if (empty($property_type) || strpos($property_type, '1') === false) {
- $summary["property_type"] = LABEL_ALL_PROPERTY_TYPE;
- // Sinon on liste tous les types de biens
- } elseif (SUMMARY_LIST_PROPERTY_TYPES) {
- $size = strlen($property_type);
- $str_property_type = '';
- /*
- for($i=0; $i<$size; $i++) {
- if( $property_type[$i]=='1' ) $str_property_type .= ', '.constant("LABEL_COMMON_PROPERTY_ID_".($i+1));
- }
- */
- $pos = -1;
- while (($pos = strpos($string, '1', $pos + 1)) !== false) {
- $str_property_type .= ', ' . constant("LABEL_COMMON_PROPERTY_ID_" . ($pos + 1));
- }
- $summary["property_type"] = substr($str_property_type, 2);
- // Sinon on liste les groupes de biens
- } else {
- if ($useAdvancedGroups) {
- global $_ADVANCED_SEARCH_TYPES, $_MASK_REALESTATETYPES_ALL_CHECKED;
- $checkedLabels = getCheckedFields($_ADVANCED_SEARCH_TYPES, $property_type, $_MASK_REALESTATETYPES_ALL_CHECKED, true);
- } else {
- global $_LI_REALESTATEGROUPS, $_MASK_REALESTATETYPES_ALL_CHECKED;
- $checkedLabels = getCheckedFields($_LI_REALESTATEGROUPS, $property_type, $_MASK_REALESTATETYPES_ALL_CHECKED, true);
- }
- // Si ce n'est pas un tableau ou qu'il est vide, c'est "Tous types de bien"
- if (!is_array($checkedLabels) || $checkedLabels == array())
- $summary["property_type"] = LABEL_ALL_PROPERTY_TYPE;
- else
- $summary["property_type"] = implode(', ', $checkedLabels);
- }
- }
- else {
- global $_LI_REALESTATETYPES;
- if ($data["property_type"] == "" || $data["property_type"][0] == -1 || count($data["property_type"]) == count($_LI_REALESTATETYPES)) {
- $summary["property_type"] = LABEL_ALL_PROPERTY_TYPE;
- } else {
- for ($i = 0; $i < count($data["property_type"]); $i++) {
- $data["property_type"][$i] = $_LI_REALESTATETYPES[$data["property_type"][$i]];
- }
- $summary["property_type"] = implode(", ", $data["property_type"]);
- }
- }
- // surface
- $summary["area"] = get_summary($data, $parameters["area"], "area", LABEL_ALL_AREA, LABEL_COMMON_AREA_UNIT);
- // price
- $summary["price"] = get_summary($data, $parameters["price"], "price", LABEL_ALL_BUDGET, LABEL_COMMON_PRICE_UNIT);
- // rooms
- // NB: pour la coloc., le nombre de pièces est en fait le nombre de chambres !
- if (isset($data['ck_nb_rooms'])) {
- global $_MASK_NB_ROOMS_ALL_CHECKED;
- $nb_rooms = $data['ck_nb_rooms'];
- // Convertir le tableau en chaine
- if (is_array($nb_rooms)) {
- $str_nb_rooms = str_repeat('0', 8); // 8 nombre de pieces possibles (2 octets)
- foreach ($nb_rooms as $nb_room) {
- $str_nb_rooms[intval($nb_room)] = 1;
- }
- $nb_rooms = $str_nb_rooms;
- }
- // Si champ vide, ou aucun coché ou tous cochés
- $all_checked = matchMask($nb_rooms, $_MASK_NB_ROOMS_ALL_CHECKED);
- if (empty($nb_rooms) || strpos($nb_rooms, '1') === false || $all_checked) {
- if ($showIfAllChecked)
- $summary["nb_rooms"] = ($data["univers"] == 8 ? LABEL_ALL_BEDROOMS : LABEL_ALL_ROOMS);
- }
- else {
- // Gérer le cas où seul le premier est coché (singulier)
- if (strpos($nb_rooms, '1', 1) === false && strpos($nb_rooms, '1') === 0) {
- $summary["nb_rooms"] = $_LI_ROOMS[0];
- } else {
- $limit = count($_LI_ROOMS) - 1;
- $str_nb_rooms = '';
- for ($i = 0; $i < $limit; $i++) {
- if ($nb_rooms[$i] == '1')
- $str_nb_rooms .= ', ' . ($i + 1);
- }
- // Ajouter le 'Et plus' sur le dernier si coché
- if ($nb_rooms[$i] == '1') {
- //$str_nb_rooms .= ', '.($i+1).' ';
- //$summary["nb_rooms"] = substr($str_nb_rooms,2).' '.LABEL_COMMON_ROOMS_UNIT.' '.LABEL_AND_MORE;
- if ($str_nb_rooms == '')
- $summary["nb_rooms"] = $_LI_ROOMS[$i];
- else
- $summary["nb_rooms"] = substr($str_nb_rooms, 2) . ', ' . $_LI_ROOMS[$i];
- }
- else {
- $summary["nb_rooms"] = substr($str_nb_rooms, 2) . ' ' . ($data["univers"] == 8 ? LABEL_COMMON_BEDROOMS_UNITS : LABEL_COMMON_ROOMS_UNITS);
- }
- }
- }
- } else {
- $summary["nb_rooms"] = get_summary($data, $parameters["nb_rooms"], "nb_rooms", ($data["univers"] == 8 ? LABEL_ALL_BEDROOMS : LABEL_ALL_ROOMS), ($data["univers"] == 8 ? LABEL_COMMON_BEDROOMS_UNITS : LABEL_COMMON_ROOMS_UNITS));
- }
- // bedrooms
- if (isset($data['ck_nb_bedrooms'])) {
- global $_MASK_NB_BEDROOMS_ALL_CHECKED, $_LI_BEDROOMS;
- $nb_bedrooms = $data['ck_nb_bedrooms'];
- // Convertir le tableau en chaine
- if (is_array($nb_bedrooms)) {
- $str_nb_bedrooms = str_repeat('0', 8); // 8 nombre de pieces possibles (2 octets)
- foreach ($nb_bedrooms as $nb_bedroom) {
- $str_nb_bedrooms[intval($nb_bedroom)] = 1;
- }
- $nb_bedrooms = $str_nb_bedrooms;
- }
- // Si champ vide, ou aucun coché ou tous cochés
- $all_checked = matchMask($nb_bedrooms, $_MASK_NB_BEDROOMS_ALL_CHECKED);
- if (empty($nb_bedrooms) || strpos($nb_bedrooms, '1') === false || $all_checked) {
- if ($showIfAllChecked)
- $summary["nb_bedrooms"] = 'Tous nb de chambres';
- }
- else {
- // Gérer le cas où seul le premier est coché (singulier)
- if (strpos($nb_bedrooms, '1', 1) === false && strpos($nb_bedrooms, '1') === 0) {
- $summary["nb_bedrooms"] = $_LI_BEDROOMS[0];
- } else {
- $limit = count($_LI_BEDROOMS) - 1;
- $str_nb_bedrooms = '';
- for ($i = 0; $i < $limit; $i++) {
- if ($nb_bedrooms[$i] == '1')
- $str_nb_bedrooms .= ', ' . ($i + 1);
- }
- // Ajouter le 'Et plus' sur le dernier si coché
- if ($nb_bedrooms[$i] == '1') {
- if ($str_nb_bedrooms == '')
- $summary["nb_bedrooms"] = $_LI_BEDROOMS[$i];
- else
- $summary["nb_bedrooms"] = substr($str_nb_bedrooms, 2) . ', ' . $_LI_BEDROOMS[$i];
- }
- else {
- $summary["nb_bedrooms"] = substr($str_nb_bedrooms, 2) . ' chambres';
- }
- }
- }
- }
- }
- return $summary;
- }
- /**
- * Convertit chaque critère par une valeur lisible par l'internaute
- * @param Array $data Tableau indexé des valeurs sélectionnées par l'internaute
- * @param Boolean $extended Afficher les "ou" entre parentheses [ex: chauffage (gaz,fioul) ]
- * @param Boolean $showIfAllChecked
- * @return Array Tableau indexé contenant uniquement les valeurs converties
- */
- function get_adv_summary($data, $extended = false, $showIfAllChecked = true) {
- global $_ADVANCED_SEARCH_CAT;
- $summary = array();
- // Critères avancés du bien (equipement, chauffage, fiche technique, etc.)
- if (isset($data['ck_advanced']) && strpos($data['ck_advanced'], '1') !== false) {
- $advanced = $data['ck_advanced'];
- // Récupérer la liste des critères sans les catégories
- // => Plus simple à interroger
- $advanced_search = array();
- foreach ($_ADVANCED_SEARCH_CAT as $SUB_CAT) {
- $advanced_search += $SUB_CAT;
- }
- $str_advanced = '';
- $length = strlen($advanced);
- if ($extended) {
- global $_MASK_ADV_OR;
- foreach ($_MASK_ADV_OR as $label => $mask_or) {
- $mask_value = $advanced & $mask_or;
- // Ajouter la clause OU
- if ($mask_value > 0) {
- // Equivalent d'un NON + compléter avec des 1 pour le ET ci-dessous
- $remove_mask = str_pad(strtr($mask_value, '01', '10'), $length, 1);
- // Effacer les critères de chauffage du masque principal
- $advanced = $advanced & $remove_mask;
- $pos = -1;
- $tmp_str_advanced = '';
- while (($pos = strpos($mask_value, '1', $pos + 1)) !== false) {
- $tmp_str_advanced .= ', ' . $advanced_search[$pos];
- }
- $tmp_str_advanced = substr($tmp_str_advanced, 2);
- $str_advanced .= ", $label ($tmp_str_advanced)";
- }
- }
- }
- $pos = -1;
- while (($pos = strpos($advanced, '1', $pos + 1)) !== false) {
- $str_advanced .= ', ' . $advanced_search[$pos];
- }
- $summary["advanced"] = substr($str_advanced, 2);
- }
- /*
- * *************************************************************************
- * TRAITEMENTS A ACTIVER SI UTILISES
- * (Surface du terrain, DPE, Fraicheur des annonces)
- * *************************************************************************
- *
- // Surface du terrain min / max
- $surf_min = isset($data['surf_min']) ? (int)$data['surf_min'] : 0;
- $surf_max = isset($data['surf_max']) ? (int)$data['surf_max'] : 0;
- if($surf_max>0) {
- $summary['surf'] = "Terrain entre {$surf_min} et {$surf_max} m²";
- } elseif($surf_min>0) {
- $summary['surf'] = "Terrain de plus de {$surf_min} m²";
- }
- // Consommation énergétique
- if(isset($data['dpe']) && strpos($data['dpe'],'1')!==false) {
- $ref_dpe = 'ABCDEFGH';
- $result = '';
- for($i=0, $max=strlen($data['dpe']); $i<$max; $i++) {
- if($data['dpe'][$i]==1) $result .= ', '.$ref_dpe[$i];
- }
- $summary['dpe'] = 'Energie '.substr($result,2);
- }
- // Fraicheur des annonces
- if(isset($data['fresh']) && ($fresh = (int)$data['fresh'])!==0) {
- switch(substr($data['fresh'],-1)) {
- case 'h': $unit = $fresh==1 ? 'heure' : 'heures'; break;
- case 'j': $unit = $fresh==1 ? 'jour' : 'jours'; break;
- case 's': $unit = $fresh==1 ? 'semaine' : 'semaines'; break;
- case 'm': $unit = 'mois'; break;
- case 'a': $unit = $fresh==1 ? 'an' : 'ans'; break;
- }
- if(isset($unit)) {
- $summary['fresh'] = "Annonces de moins de {$fresh} {$unit}";
- }
- }
- */
- return $summary;
- }
- /**
- * Turns a search criterion to a human readable value
- *
- * @param unknown_type $data
- * @param unknown_type $parameters
- * @param unknown_type $item
- * @param unknown_type $label_all
- * @param unknown_type $label_unit
- * @return unknown
- */
- function get_summary($data, $parameters, $item, $label_all, $label_unit) {
- // patch
- if ($data[$item] == -1) {
- $data[$item] = "";
- }
- // rooms
- if (in_array($item, array("nb_rooms", "nb_bedrooms", "nb_people"))) {
- if ($data[$item] == "" && $data[$item . "_min"] == "" && $data[$item . "_max"] == "") {
- $summary = $label_all;
- } else {
- if ($data[$item] != "") {
- $summary = $parameters[$data[$item]];
- } else {
- if ($data[$item . "_min"] != "" && $data[$item . "_max"] != "") {
- $summary = LABEL_FROM . " " . $data[$item . "_min"] . " " . LABEL_TO . " " . $data[$item . "_max"] . " " . $label_unit;
- } elseif ($data[$item . "_min"] != "" && $data[$item . "_max"] == "") {
- $summary = LABEL_MORE_THAN . " " . $data[$item . "_min"] . " " . $label_unit;
- } else {
- $summary = LABEL_LESS_THAN . " " . $data[$item . "_max"] . " " . $label_unit;
- }
- }
- }
- }
- // price, surface
- else {
- if (!is_numeric($data[$item . "_min"]))
- $data[$item . "_min"] = '';
- if (!is_numeric($data[$item . "_max"]))
- $data[$item . "_max"] = '';
- if ($data[$item] == "" && $data[$item . "_min"] == "" && $data[$item . "_max"] == "") {
- $summary = $label_all;
- } else {
- if ($data[$item] != "") {
- $value = $parameters[$data[$item]];
- if ($value["from"] == 0) {
- $summary = LABEL_LESS_THAN . " " . $value["to"] . " " . $label_unit;
- } elseif ($value["to"] == 999999999) {
- $summary = LABEL_MORE_THAN . " " . $value["from"] . " " . $label_unit;
- } else {
- $summary = LABEL_FROM . " " . $value["from"] . " " . LABEL_TO . " " . $value["to"] . " " . $label_unit;
- }
- } else {
- if ($data[$item . "_min"] != "" && $data[$item . "_max"] != "") {
- $summary = LABEL_FROM . " " . n_f($data[$item . "_min"]) . " " . LABEL_TO . " " . n_f($data[$item . "_max"]) . " " . $label_unit;
- } elseif ($data[$item . "_min"] != "" && $data[$item . "_max"] == "") {
- $summary = LABEL_MORE_THAN . " " . n_f($data[$item . "_min"]) . " " . $label_unit;
- } else {
- $summary = LABEL_LESS_THAN . " " . n_f($data[$item . "_max"]) . " " . $label_unit;
- }
- }
- }
- }
- return $summary;
- }
- /**
- * Returns property type label depending on the code
- *
- * @param unknown_type $id
- * @return unknown
- */
- function get_property_type_label($id) {
- global $_LI_REALESTATETYPES;
- foreach ($_LI_REALESTATETYPES as $property_type) {
- if ($property_type["value"] == $id) {
- return $property_type["label"];
- }
- }
- }
- /**
- * number_format shortcut
- *
- * @param unknown_type $value
- * @return unknown
- */
- function n_f($value) {
- return number_format($value, 0, "", " ");
- }
- /**
- * Currency conversion
- *
- * @param unknown_type $value
- * @param unknown_type $from
- * @param unknown_type $to
- * @param unknown_type $add_currency_name
- * @return unknown
- */
- function currency_format($value, $from, $to, $add_currency_name = true) {
- global $_global;
- global $_rates;
- if ($_rates[$from][$to] > 0) {
- $price = n_f($value * $_rates[$from][$to]);
- if ($add_currency_name) {
- switch ($_global["current_currency"]) {
- case "CZK" :
- $price = $price . " " . LABEL_COMMON_PRICE_UNIT_CZ;
- break;
- case "EUR" :
- $price = $price . " " . LABEL_COMMON_PRICE_UNIT;
- break;
- case "CHF" :
- $price = $price . " " . LABEL_COMMON_PRICE_UNIT_CH;
- break;
- default :
- $price = $price . " " . LABEL_COMMON_PRICE_UNIT;
- break;
- }
- }
- return $price;
- }
- }
- /**
- * Function so sex, par le so sexy oxman, da crazy man !
- *
- * @param unknown_type $input
- * @param unknown_type $partial
- * @return unknown
- */
- function sosex($input, $partial = false) {
- // Partial mode, the word isn't complete, typically when you're doing an ajax completion
- $input = str_replace('è', 'ai', $input);
- $input = str_replace('ê', 'ai', $input);
- $input = str_replace('é', 'ai', $input);
- $input = strtoupper($input);
- // START - Nettoiement de la recherche, suppressions de tous les caracteres parasites
- $input = preg_replace('/(.)\\1{1,}/', '\\1', $input); // 1. Suppression des lettres en doubles (exemple: pelle, femme)
- $input = preg_replace('/[-,\/;.\']/', ' ', $input); // 2. Sérateur de mot : , / ; . -
- $input = preg_replace('/(?=\b)[^ ](?=\b)/', '', $input); // 28. Suppression des caractères isolées (résultant d'un D', L', etc)
- $input = ' ' . $input . ' ';
- $input = preg_replace('/(?=\b)ST(?=\b)/', 'SAINT', $input); // 3. Attention avant la 4
- $input = preg_replace('/(?=\b)[LD]ES(?=\b)/', '', $input); // 4. Suppression des dérminants (exemple: nos, mes, du, les, la)
- $input = preg_replace('/(?=\b)SUR(?=\b)/', '', $input); // 4. Suppression des dérminants (exemple: nos, mes, du, les, la)
- $input = preg_replace('/(?=\b)SOUS(?=\b)/', '', $input); // 4. Suppression des dérminants (exemple: nos, mes, du, les, la)
- $input = preg_replace('/(?=\b)L[EA](?=\b)/', '', $input); // 4. Suppression des dérminants (exemple: nos, mes, du, les, la)
- $input = preg_replace('/(?=\b)D[EU](?=\b)/', '', $input); // 4. Suppression des dérminants (exemple: nos, mes, du, les, la)
- $input = preg_replace('/(?=\b)E[TN](?=\b)/', '', $input); // 4. Suppression des dérminants (exemple: nos, mes, du, les, la)
- $input = str_replace('ET', 'AIT', $input); // 25. Son : AI (exemple: jouet, essai), avant la regle de suppressions des lettres muettes (n°20)
- $input = preg_replace('/ES(?!\b)/', 'AIS', $input); // 26. Son : AI (exemple: jouet, essai, mais pas lourdes), avant la regle de suppressions des lettres muettes (n°20)
- $input = preg_replace('/[AE][NM](?![AEIOUY])/', 'AN', $input); // 5. Son : AN (exemple: femme, enfant), avant lettres muettes
- $input = preg_replace('/OM(?![AEIOUY])/', 'ON', $input); // 14. Son : ON (exemple: pantalom, pomtom), avant lettres muettes
- $input = preg_replace('/(?<![CSP]|\b)H/', '\\1', $input); // 6. Son muet H si il n'y a ni C,S,P devant (hyè, mammouth, pharaon), avant lettres muettes
- $input = preg_replace('/P[HF]/', 'F', $input); // 19. Son : F (exemple: PF ou PH donne le son F), avant lettres muettes
- $input = str_replace('Y', 'I', $input); // 29. Son : I, avant lettres muettes
- $input = preg_replace('/X(?=\b)/', '', $input); // 30. Son : X muet à la fin de mot
- if (!$partial) {
- $input = preg_replace('/(?!E)T(?![AEIOUYR$])/', '', $input); // 13. Son muet T si en fin de mot, où suivis d'une consonne, pas muet si c'est suivit d'un R : TRIMARAN, pas muet si précédé d'un E, car fait le son AI
- $input = preg_replace('/(?<![AEIOUY]|\b)[GLSXP](?![AEIOUY])/', '', $input); // 20. Son muet G ou, H ou L etc.. si en fin de mot, où suivis d'une consonne, et précédé d'une consonne
- $input = preg_replace('/E(?=\b)/', '', $input); // 20. Son muet E etc.. si en fin de mot, où suivis d'une voyelle, et précédé d'une voyelle
- $input = preg_replace('/ES(?=\b)/', '', $input); // 27. Son ES en fin de mot muet
- }
- // END
- $input = str_replace('EU', 'E', $input); // 25. Son : E, après la regle de suppressions des lettres muettes (n°20)
- $input = preg_replace('/E?AU/', 'O', $input); // 7. Son O : veau, pot, l'horizon
- $input = str_replace('SH', 'CH', $input); // 9. Son : CH
- $input = preg_replace('/C[CK]/', 'K', $input); // 18. Son : K (exemple: CC ou CK donne le son K)
- $input = str_replace('QU', 'K', $input); // 10. Son : K (exemple: quand, bouquet, plaque)
- $input = str_replace('KS', 'X', $input); // 28. Son : X (exemple: luksiol)
- $input = preg_replace('/C(?=[UAO]|\b)/', 'K', $input); // 16. Son : K (exemple: cutalion, carole, mais pas celine, ciboulette, candiac)
- $input = preg_replace('/C(?=[IEY])/', 'S', $input); // 17. Son : S (exemple: celine, ciboulette, cy..., mais pas cutalion, carole)
- $input = preg_replace('/G(?=[IEYL]|\b)/', 'J', $input); // 24. Son : J (exemple: gille, vregille, mais pas vrigne, zigliara)
- $input = str_replace('Z', 'S', $input); // 15. Son : Z S
- $input = preg_replace("/(.)\\1{1,}/", "\\1", $input); // 12. Suppression des lettres en doubles cré aprètransformation (tout à a fin)
- return trim($input);
- }
- /**
- * Replace only the first occurence of a string
- *
- * @param unknown_type $needle
- * @param unknown_type $replace
- * @param unknown_type $haystack
- * @return unknown
- */
- function str_replace_once($needle, $replace, $haystack) {
- // Looks for the first occurence of $needle in $haystack
- // and replaces it with $replace.
- $pos = strpos($haystack, $needle);
- if ($pos === false) {
- // Nothing found
- return $haystack;
- }
- return substr_replace($haystack, $replace, $pos, strlen($needle));
- }
- /**
- * Returns a truncated string
- *
- * @param unknown_type $value
- * @param unknown_type $limit
- * @return unknown
- */
- function str_limit($value, $limit) {
- if (strlen($value) == 0) {
- return "";
- } else {
- if (strlen($value) <= $limit) {
- return $value;
- } else {
- $tmp = explode(" ", $value);
- if (count($tmp) > 0) {
- $valV = $valVold = "";
- foreach ($tmp as $v) {
- if (strlen($valV) > $limit) {
- $value = substr($valVold, 0, -1) . "...";
- break;
- }
- else
- $valVold = $valV;
- $valV .= $v . " ";
- }
- }
- return $value;
- }
- }
- }
- /**
- * Returns html city name with arrondissement correctly written in french
- * ex: Marseille 1er => Marseille 1<sup>er</sup>, Paris 2e => Paris 2<sup>ème</sup>
- *
- * @param unknown_type $cityname_arrond
- * @return unknown
- */
- function cityname_arrond($cityname_arrond, $short_form = false) {
- $str_cityname_arrond = "";
- $arr_cityname_arrond = explode(" ", $cityname_arrond);
- $str_cityname = $arr_cityname_arrond[0];
- $str_arrond = $arr_cityname_arrond[1];
- if (strpos($str_arrond, "er") !== FALSE) {
- $str_cityname_arrond = $str_cityname . " " . str_replace("er", "<sup>er</sup>", $str_arrond);
- } else if (strpos($str_arrond, "e") !== FALSE) {
- if ($short_form) {
- $str_cityname_arrond = $str_cityname . " " . str_replace("e", "<sup>è</sup>", $str_arrond);
- } else {
- $str_cityname_arrond = $str_cityname . " " . str_replace("e", "<sup>ème</sup>", $str_arrond);
- }
- }
- return $str_cityname_arrond;
- }
- /**
- * Returns html city name without arrondissement at the end, if present
- * ex: Marseille 1er => Marseille, Paris 2e => Paris, Cannes => Cannes
- *
- * @param unknown_type $cityname_arrond
- * @return unknown
- */
- function cityname_without_arrond($cityname_arrond) {
- $str_cityname_arrond = $cityname_arrond;
- $str_cityname_arrond = preg_replace('/(\w+) (\d+)er/i', '${1}', $str_cityname_arrond);
- $str_cityname_arrond = preg_replace('/(\w+) (\d+)e/i', '${1}', $str_cityname_arrond);
- return $str_cityname_arrond;
- }
- /**
- * Returns true if the lct_id is the one of the arrondissement of a city (Paris, Lyon, Marseille)
- * ex: 36102 => true (Marseille 2è), 33109 => false (Toulon)
- *
- * @param int $lct_id
- * @return bool
- */
- function is_lct_id_arrond_of_city($lct_id) {
- if (!isset($lct_id) || empty($lct_id)) {
- return array(false, "");
- }
- $lct_ids_arrronds_paris = array(23599, 23601, 23602, 23603, 23604, 23605, 23606, 23607, 23609, 23589, 23590, 23591, 23592, 23593, 23594, 23595, 23596, 23597, 23598, 23600);
- if (in_array($lct_id, $lct_ids_arrronds_paris)) {
- return array(true, "paris");
- }
- $lct_ids_arrronds_marseille = array(36102, 36104, 36105, 36106, 36107, 36108, 36109, 36110, 36111, 36112, 36113, 36114, 36115, 36116, 36117, 36118);
- if (in_array($lct_id, $lct_ids_arrronds_marseille)) {
- return array(true, "marseille");
- }
- $lct_ids_arrronds_lyon = array(36119, 36120, 36121, 36122, 36123, 36124, 36125, 36126, 36127);
- if (in_array($lct_id, $lct_ids_arrronds_lyon)) {
- return array(true, "lyon");
- }
- return array(false, "");
- }
- /**
- * Returns true if the loc_key is the one of city with arrondissements (Paris, Lyon, Marseille)
- * ex: 421_99 => true (Marseille), 33109_2 => false (Toulon)
- *
- * @param int $lct_id
- * @return bool
- */
- function is_loc_key_city_with_arronds($loc_key) {
- if (!isset($loc_key) || empty($loc_key)) {
- return array(false, "");
- }
- $loc_key_paris = '100_1';
- if ($loc_key == $loc_key_paris) {
- return array(true, "paris");
- }
- $loc_key_marseille = '421_99';
- if ($loc_key == $loc_key_marseille) {
- return array(true, "marseille");
- }
- $loc_key_lyon = '422_99';
- if ($loc_key == $loc_key_lyon) {
- return array(true, "lyon");
- }
- return array(false, "");
- }
- /**
- * Returns a clean string
- *
- * @param unknown_type $value
- * @return unknown
- */
- function remove_returns($value) {
- $value = str_replace("\r\n", "", $value);
- $value = str_replace("\n\r", "", $value);
- $value = str_replace("\n", "", $value);
- $value = str_replace("\r", "", $value);
- return $value;
- }
- /**
- * Returns a "clean" html, without css MS Office classes
- *
- * @param unknown_type $value
- * @return unknown
- */
- function strip_mso_css_class($value) {
- $value = str_replace(" class=\"MsoPlainText\"", "", $value);
- return $value;
- }
- /**
- * Returns in a html string li tags par a dot char
- *
- * @param unknown_type $value
- * @return unknown
- */
- function replace_li_tag_dot_char($value) {
- $value = str_replace("<li>", "• ", $value);
- $value = str_replace("</li>", "<br>", $value);
- $value = str_replace("<ul>", "", $value);
- $value = str_replace("</ul>", "", $value);
- return $value;
- }
- /**
- * Returns html height and width properties, determining the size of an image to fit required width and height
- *
- * @param unknown_type $img
- * @param unknown_type $max_width
- * @param unknown_type $max_height
- * @return unknown
- */
- function resize_image($img, $max_width, $max_height) {
- $img_details = @getimagesize($img);
- $img_width = $img_details[0];
- $img_height = $img_details[1];
- if ($img_width == "" || $img_height == "") {
- return "";
- }
- $img_wratio = round($img_height / $img_width, 2);
- $img_hratio = round($img_width / $img_height, 2);
- if ($img_width > $max_width || $img_height > $max_height) {
- if ($img_width > $img_height) {
- $img_width = $max_width;
- $img_height = $img_width * $img_wratio;
- if ($img_height > $max_height) {
- $img_height = $max_height;
- $img_width = $img_height * $img_hratio;
- }
- } else {
- $img_height = $max_height;
- $img_width = $img_height * $img_hratio;
- if ($img_width > $max_width) {
- $img_width = $max_width;
- $img_height = $img_width * $img_wratio;
- }
- }
- }
- return "width=\"" . $img_width . "\" height=\"" . $img_height . "\"";
- }
- /**
- * Returns html code for a spacer
- *
- * @param unknown_type $height
- * @param unknown_type $width
- * @return unknown
- */
- function spacer($height, $width) {
- return "<img src=\"" . get_urlmmf('/spacer.gif') . "\" height=\"" . $height . "\" width=\"" . $width . "\" />";
- }
- /**
- * Returns html alt and title
- *
- * @param unknown_type $value
- * @return unknown
- */
- function set_html_title($value) {
- return "alt=\"" . $value . "\" title=\"" . $value . "\"";
- }
- /**
- * Returns ad and agency data
- *
- * @param unknown_type $page
- * @param unknown_type $value
- * @param unknown_type $has_premium
- * @param unknown_type $url
- * @param Integer $idx
- * @param Boolean $is_exclusive Annonce à afficher en haut de la page des annonces
- * @return unknown
- */
- function get_ad_data($page, $value, $has_premium = 0, $url = "", $idx = -1, $is_exclusive = false) {
-
- global $_global;
- global $_LI_REALESTATETYPES;
- global $_REF_ROOMS;
- global $_LI_BANDEAU_PERSO_FR;
- $prefix_table = '';
-
- if ( 9 != $_global['univers'] ) {
- $prefix_table = $_global["table_prefix"] . '_';
- }
-
- // arrays
- $ad = array();
- $ag = array();
- //echo '<pre>'; var_dump($value); echo '</pre>';
- $ad["idx"] = $idx;
- $ad["id"] = $value["id_annonce"];
- $ad["univers"] = $value["univers"];
- $ad["reference"] = $value[$prefix_table . "reference"];
- $ad["num_mandat"] = $value[$prefix_table . "num_mandat"];
- // ad premium
- $ad["premium"] = $value[$prefix_table . "is_premium"];
- // ad features
- $ad["type_transaction"] = $value[$prefix_table . "type_transaction"];
- $ad["id_bien"] = $value["id_bien"];
- $ad["id_bien_programme"] = $value["id_bien_programme"];
- $ad["prg_title"] = $value["prg_title"];
- $ad["property_type_id"] = $value[$prefix_table . "property_type_id"];
- $ad["property_type_id_orig"] = $value[$prefix_table . "property_type_id_orig"];
- $ad["property_type"] = html_entity_decode($value[$prefix_table . "property_type"], ENT_QUOTES, "UTF-8");
- if ($ad["type_transaction"] == "4")
- $ad["property_type"] .= LABEL_AD_LIFE_ANNUITY;
- $ad["agency_rent_fees"] = $value["rnt_agency_rent_fees"];
- $ad["rnt_property_charges"] = $value["rnt_property_charges"];
- $ad["guarantee_deposit"] = $value[$prefix_table . "guarantee_deposit"];
- //ad currency
- $ad["currency"] = $value[$prefix_table . "currency"];
- //SUSPENSION DES CHARGES
- $ad["real_price"] = $value[$prefix_table . "price"];
- $ad["price"] = ($ad["real_price"] >= AD_PRICE_LIMIT ? $ad["real_price"] : n_f($ad["real_price"]));
- if ($ad["property_type"] == "") {
- $ad["property_type"] = ($ad["property_type_id_orig"] != "" ? constant("LABEL_COMMON_PROPERTY_ID_" . $ad["property_type_id_orig"]) : "");
- }
- $ad["area"] = $value[$prefix_table . "area"];
- $ad["price"] = ($ad["real_price"] >= AD_PRICE_LIMIT ? $ad["real_price"] : n_f($ad["real_price"]));
- $ad["nb_rooms"] = $value[$prefix_table . "nb_rooms"];
- // Advanced : dependances, chauffage, amenagement, confort
- $ad["advanced_set"] = $value[$prefix_table . 'advanced_set'];
- // First online date
- $ad["first_online_date"] = $value[$prefix_table . 'first_online_date'];
- //Colocation
- if ($_global["univers"] == 8) {
- $ad["nb_bedrooms"] = $value["rnt_nb_bedrooms"];
- }
- $ad["default_text"] = str_replace("[[n]]", " ", $value[$prefix_table . "default_text"]);
- if ($_global["self"] == "resultats_refnat.php") {
- $ad["default_intro"] = strtolower(strip_tags(str_limit($ad["default_text"], 90)));
- } else {
- $ad["default_intro"] = preg_replace('`(\<[a-zA-Z]*)\.\.\.$`', '', str_limit($ad["default_text"], 200));
- }
- // vacances
- if ($_global["univers"] == 13) {
- $ad["nb_bedrooms"] = $value["rnt_nb_bedrooms"];
- $ad["nb_people"] = $value["rnt_nb_people"];
- if ($value["rnt_site_agency"] != "") {
- if (substr($value["rnt_site_agency"], 0, 7) != "http://") {
- $value["rnt_site_agency"] = "http://" . $value["rnt_site_agency"];
- }
- $ad["partner_url"] = $value["rnt_site_agency"];
- }
- $ad["external"] = ($value["id_presto"] == "CMM-PT-VACANCES" ? true : false);
- }
- if ($_global["univers"] == 13) {
- $ad["features"] = $ad["property_type"] . ($ad["area"] > 0 ? " - " . $ad["area"] . " " . LABEL_COMMON_AREA_UNIT . " " . LABEL_RESULTS_ABOUT : "") . ($ad["nb_bedrooms"] > 0 ? " - " . $ad["nb_bedrooms"] . " " . LABEL_COMMON_BEDROOMS_UNIT : "");
- } else {
- if ($ad["nb_rooms"] == 1) {
- $s_piece = LABEL_COMMON_ROOM_UNIT;
- } else {
- $s_piece = LABEL_COMMON_ROOMS_UNITS;
- }
- if ($_global["self"] == "resultats_refnat.php") {
- $ad["features"] = ($ad["area"] > 0 ? $ad["area"] . " " . LABEL_COMMON_AREA_UNIT . " " . LABEL_RESULTS_ABOUT : "") . ($ad["area"] > 0 && $ad["nb_rooms"] > 0 ? " - " : "") . ($ad["nb_rooms"] > 0 ? $ad["nb_rooms"] . " " . $s_piece : "");
- } else {
- $ad["features"] = $ad["property_type"] . ($ad["area"] > 0 ? " - " . $ad["area"] . " " . LABEL_COMMON_AREA_UNIT . " " . LABEL_RESULTS_ABOUT : "") . ($ad["nb_rooms"] > 0 ? " - " . $ad["nb_rooms"] . " " . $s_piece : "");
- }
- /** Suppression du label "OU PLUS" Mathieu 25/01
- if ($ad["nb_rooms"] == 6) {
- $ad["features"] .= " " . LABEL_COMMON_OR_MORE;
- }
- *
- */
- }
- $ad…
Large files files are truncated, but you can click here to view the full file