예제 #1
0
	static function send($destinataire) {
		$expediteur = CBdd::select_one("SELECT email FROM user WHERE type = 2", "email");
		$id_texte	= CConfiguration::get_valeur('WELCOME_TEXT_ID');
		
		$sql_texte_select = "SELECT * FROM texte WHERE id = " . $id_texte;
		$texte = CBdd::select_row($sql_texte_select);
		
		$sql_user = "******" . $destinataire . "'";
		$user = CBdd::select_row($sql_user);
		
		$message = str_replace('$NOM', $user['nom'], $texte['text']);
		$message = str_replace('$PRENOM', $user['prenom'], $message);
		
		//echo $message;
		
		$sujet = $texte['nom'];
		
		$sql_unicite_message = "SELECT id FROM email WHERE destinataire = '" . addslashes($destinataire) . "' AND nom = '" . addslashes($sujet) . "'";
		// echo $sql_unicite_message;
		if(CBdd::select_one($sql_unicite_message, 'id')) {
			return 1;
		}
		
		$sql_email_insert = "INSERT INTO email(expediteur, destinataire, nom, text, etat) VALUES ('" . addslashes($expediteur) . "', '" . addslashes($destinataire) . "', '" . addslashes($sujet) . "', '" . addslashes($message) . "', '2')";
		
		
		CBdd::insert($sql_email_insert);
		
		return CMail::send_mail($destinataire, CFonction::force_stripslashes($sujet), CFonction::force_stripslashes($message), $expediteur, array(), 'Bcc: ' . $expediteur);
	}
예제 #2
0
파일: CMeta.php 프로젝트: rakotobe/Rakotobe
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;
}
예제 #3
0
파일: CUrl.php 프로젝트: rakotobe/Rakotobe
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;
}
예제 #4
0
파일: save.php 프로젝트: rakotobe/Rakotobe
	. 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 {
		// Estexiste