Exemplo n.º 1
0
function formate_to_keywords($string, $weight=1) {
	$string = CFonction::formate_chaine(ereg_replace("<[^>]*>", "", trim(html_entity_decode(strip_tags($string), ENT_NOQUOTES, 'UTF-8'))), ' ', FALSE);
	$string = preg_replace('/ [a-z0-9]{1,3} /', ' ',  $string);
	$string = preg_replace('/ [a-z0-9]{1,3} /', ' ',  $string);
	$words = array();
	$words = explode(" ", $string);
	$uniqWords = array();
	foreach($words as $key=>$word) {
	  $uniqWords[$word] = 0;//hery
	  if(!empty($word)) $uniqWords[$word]++;
	}
	reset($words);
	for($i = 0; $i < count($words); $i++) {
	  if(!empty($words[$i]) && !empty($words[$i + 1])) {
		 $coupleOfWords = $words[$i] . " " . $words[$i + 1];
		 if(isset($uniqWords[$coupleOfWords])) $uniqWords[$coupleOfWords]++;
		 else $uniqWords[$coupleOfWords] = 1;
	  }
	}
	ksort($uniqWords);
	$keywords = '';
	while(list($key, $val) = each($uniqWords)) {
	  if(strlen($key) > 6 && $val > $weight) {
		 $keywords .= $key . ", ";
	  }
	}
	$keywords = trim($keywords);
	$keywords = trim($keywords, ',');
	return $keywords;
}
Exemplo n.º 2
0
function get_href($zone, $id, $cle = '') {
	$zone = $zone[0];
	$url = "index.php?cle=" . CFonction::formate_chaine($cle)."&" . $zone . "=" . $id;
	if(CConfiguration::get_valeur('REWRITE_ENGINE') == 'on') {
		$url = preg_replace('/^(.*)(cle=)(.*)(&)(p|s|m)(=)([0-9]*)$/', '$3_$5$7.html', $url);
	}
	
	return $url;
}
Exemplo n.º 3
0
	. addslashes($prenom) . "', pays = '" 
	. htmlentities(addslashes($pays),ENT_COMPAT ,'UTF-8') . "', telephone = '" 
	. htmlentities(addslashes($telephone),ENT_COMPAT ,'UTF-8') . "' WHERE email = '" 
	. htmlentities(addslashes($expediteur),ENT_COMPAT ,'UTF-8') . "'";
	
	CCom::recupnomCom('commune', 'id_com', 'nom_com', $ville);
	if ($idcom) 
	
	CBdd::update($sql);
	$sql3 = "UPDATE reponse SET iduser = "******" WHERE iduser = 1 AND date = '" . $date . "'";
	CBdd::update($sql3);
	
	CUserGroupe::insert($iduser, $id_groupe);
	
} else {
	$login = CFonction::formate_chaine($nom, '');
	$passe = CFonction::get_password();
	$sql1 = "INSERT INTO user(id, login, passe, nom, prenom, pays, email, telephone) VALUES(NULL, '" . $login . "', '" . $passe . "', '" 
	. addslashes($nom) . "', '" 
	. addslashes($prenom) . "', '" 
	. htmlentities(addslashes($pays),ENT_COMPAT ,'UTF-8') . "', '" 
	. htmlentities(addslashes($expediteur),ENT_COMPAT ,'UTF-8') . "', '" 
	. htmlentities(addslashes($telephone),ENT_COMPAT ,'UTF-8') . "')";
		
	if(!CBdd::insert($sql1)) exit;
	$iduser = mysql_insert_id();
	
	// Commune
	$idcom = CCom::recupnomCom('commune', 'id_com', 'nom_com', $ville);
	if ($idcom) CBdd::update("UPDATE user SET commune_alias=".$idcom." WHERE id=".$iduser."");
	else {