indentation du code
This commit is contained in:
parent
731743c6c9
commit
39d7ceb739
@ -51,15 +51,15 @@ class Adherent
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Function Adherent($DB, $id='')
|
Function Adherent($DB, $id='')
|
||||||
{
|
{
|
||||||
$this->db = $DB ;
|
$this->db = $DB ;
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->statut = -1;
|
$this->statut = -1;
|
||||||
// l'adherent n'est pas public par defaut
|
// l'adherent n'est pas public par defaut
|
||||||
$this->public = 0;
|
$this->public = 0;
|
||||||
// les champs optionnels sont vides
|
// les champs optionnels sont vides
|
||||||
$this->array_options=array();
|
$this->array_options=array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* function envoyant un email au destinataire (recipient) avec le text fourni en parametre.
|
* function envoyant un email au destinataire (recipient) avec le text fourni en parametre.
|
||||||
@ -72,55 +72,58 @@ class Adherent
|
|||||||
* ...
|
* ...
|
||||||
*/
|
*/
|
||||||
Function send_an_email($recipients,$text,$subject="Vos coordonnees sur %SERVEUR%")
|
Function send_an_email($recipients,$text,$subject="Vos coordonnees sur %SERVEUR%")
|
||||||
{
|
{
|
||||||
$patterns = array (
|
$patterns = array (
|
||||||
'/%PRENOM%/',
|
'/%PRENOM%/',
|
||||||
'/%NOM%/',
|
'/%NOM%/',
|
||||||
'/%INFOS%/',
|
'/%INFOS%/',
|
||||||
'/%INFO%/',
|
'/%INFO%/',
|
||||||
'/%SERVEUR%/',
|
'/%SERVEUR%/',
|
||||||
'/%SOCIETE%/',
|
'/%SOCIETE%/',
|
||||||
'/%ADRESSE%/',
|
'/%ADRESSE%/',
|
||||||
'/%CP%/',
|
'/%CP%/',
|
||||||
'/%VILLE%/',
|
'/%VILLE%/',
|
||||||
'/%PAYS%/',
|
'/%PAYS%/',
|
||||||
'/%EMAIL%/',
|
'/%EMAIL%/',
|
||||||
'/%NAISS%/',
|
'/%NAISS%/',
|
||||||
'/%PHOTO%/',
|
'/%PHOTO%/',
|
||||||
'/%LOGIN%/',
|
'/%LOGIN%/',
|
||||||
'/%PASS%/'
|
'/%PASS%/'
|
||||||
);
|
);
|
||||||
$infos = "Prenom : $this->prenom\nNom : $this->nom\nSociete : $this->societe\nAdresse : $this->adresse\nCP : $this->cp\nVille : $this->ville\nPays : $this->pays\nEmail : $this->email\nLogin : $this->login\nPassword : $this->pass\nDate de naissance : $this->naiss\nPhoto : $this->photo\n";
|
$infos = "Prenom : $this->prenom\nNom : $this->nom\nSociete : $this->societe\nAdresse : $this->adresse\nCP : $this->cp\nVille : $this->ville\nPays : $this->pays\nEmail : $this->email\nLogin : $this->login\nPassword : $this->pass\nDate de naissance : $this->naiss\nPhoto : $this->photo\n";
|
||||||
if ($this->public == 1){
|
if ($this->public == 1)
|
||||||
|
{
|
||||||
$infos.="Fiche Publique : Oui\n";
|
$infos.="Fiche Publique : Oui\n";
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$infos.="Fiche Publique : Non\n";
|
$infos.="Fiche Publique : Non\n";
|
||||||
}
|
}
|
||||||
$replace = array (
|
$replace = array (
|
||||||
$this->prenom,
|
$this->prenom,
|
||||||
$this->nom,
|
$this->nom,
|
||||||
$infos,
|
$infos,
|
||||||
$infos,
|
$infos,
|
||||||
"http://".$_SERVER["SERVER_NAME"]."/",
|
"http://".$_SERVER["SERVER_NAME"]."/",
|
||||||
$this->societe,
|
$this->societe,
|
||||||
$this->adresse,
|
$this->adresse,
|
||||||
$this->cp,
|
$this->cp,
|
||||||
$this->ville,
|
$this->ville,
|
||||||
$this->pays,
|
$this->pays,
|
||||||
$this->email,
|
$this->email,
|
||||||
$this->naiss,
|
$this->naiss,
|
||||||
$this->photo,
|
$this->photo,
|
||||||
$this->login,
|
$this->login,
|
||||||
$this->pass
|
$this->pass
|
||||||
);
|
);
|
||||||
$texttosend = preg_replace ($patterns, $replace, $text);
|
$texttosend = preg_replace ($patterns, $replace, $text);
|
||||||
$subjectosend = preg_replace ($patterns, $replace, $subject);
|
$subjectosend = preg_replace ($patterns, $replace, $subject);
|
||||||
if (defined('MAIN_MAIL_FROM') && MAIN_MAIL_FROM != ''){
|
if (defined('MAIN_MAIL_FROM') && MAIN_MAIL_FROM != ''){
|
||||||
return mail($recipients,$subjectosend,$texttosend,"From: ".MAIN_MAIL_FROM."\nReply-To: ".MAIN_MAIL_FROM."\nX-Mailer: PHP/" . phpversion());
|
return mail($recipients,$subjectosend,$texttosend,"From: ".MAIN_MAIL_FROM."\nReply-To: ".MAIN_MAIL_FROM."\nX-Mailer: PHP/" . phpversion());
|
||||||
}else{
|
}else{
|
||||||
return mail($recipients,$subjectosend,$texttosend);
|
return mail($recipients,$subjectosend,$texttosend);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -272,23 +275,22 @@ class Adherent
|
|||||||
Function update()
|
Function update()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
$sql = "UPDATE llx_adherent SET ";
|
$sql = "UPDATE llx_adherent SET ";
|
||||||
$sql .= "prenom = '".$this->prenom ."'";
|
$sql .= "prenom = '".$this->prenom ."'";
|
||||||
$sql .= ",nom='".$this->nom."'";
|
$sql .= ",nom='" .$this->nom."'";
|
||||||
$sql .= ",societe='".$this->societe."'";
|
$sql .= ",societe='".$this->societe."'";
|
||||||
$sql .= ",adresse='".$this->adresse."'";
|
$sql .= ",adresse='".$this->adresse."'";
|
||||||
$sql .= ",cp='".$this->cp."'";
|
$sql .= ",cp='" .$this->cp."'";
|
||||||
$sql .= ",ville='".$this->ville."'";
|
$sql .= ",ville='" .$this->ville."'";
|
||||||
$sql .= ",pays='".$this->pays."'";
|
$sql .= ",pays='" .$this->pays."'";
|
||||||
$sql .= ",note='".$this->commentaire."'";
|
$sql .= ",note='" .$this->commentaire."'";
|
||||||
$sql .= ",email='".$this->email."'";
|
$sql .= ",email='" .$this->email."'";
|
||||||
$sql .= ",login='".$this->login."'";
|
$sql .= ",login='" .$this->login."'";
|
||||||
$sql .= ",pass='".$this->pass."'";
|
$sql .= ",pass='" .$this->pass."'";
|
||||||
$sql .= ",naiss='".$this->naiss."'";
|
$sql .= ",naiss='" .$this->naiss."'";
|
||||||
$sql .= ",photo='".$this->photo."'";
|
$sql .= ",photo='" .$this->photo."'";
|
||||||
$sql .= ",public='".$this->public."'";
|
$sql .= ",public='" .$this->public."'";
|
||||||
$sql .= ",statut=".$this->statut;
|
$sql .= ",statut=" .$this->statut;
|
||||||
$sql .= ",fk_adherent_type=".$this->typeid;
|
$sql .= ",fk_adherent_type=".$this->typeid;
|
||||||
$sql .= ",morphy='".$this->morphy."'";
|
$sql .= ",morphy='".$this->morphy."'";
|
||||||
|
|
||||||
@ -299,18 +301,21 @@ class Adherent
|
|||||||
if (!$result)
|
if (!$result)
|
||||||
{
|
{
|
||||||
print $this->db->error();
|
print $this->db->error();
|
||||||
print "<h2><br>$sql<br></h2>";
|
print "<br>$sql<br>";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(sizeof($this->array_options) > 0 ){
|
|
||||||
$sql = "REPLACE INTO llx_adherent_options SET adhid = $this->id";
|
if (sizeof($this->array_options) > 0 )
|
||||||
foreach($this->array_options as $key => $value){
|
{
|
||||||
// recupere le nom de l'attribut
|
$sql = "REPLACE INTO llx_adherent_options SET adhid = $this->id";
|
||||||
$attr=substr($key,8);
|
foreach($this->array_options as $key => $value)
|
||||||
$sql.=",$attr = '".$this->array_options[$key]."'";
|
{
|
||||||
|
// recupere le nom de l'attribut
|
||||||
|
$attr=substr($key,8);
|
||||||
|
$sql.=",$attr = '".$this->array_options[$key]."'";
|
||||||
|
}
|
||||||
|
$result = $this->db->query($sql);
|
||||||
}
|
}
|
||||||
$result = $this->db->query($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
@ -371,16 +376,21 @@ class Adherent
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/* Fetch adherent corresponding to login passed in argument */
|
/* Fetch adherent corresponding to login passed in argument */
|
||||||
Function fetch_login($login){
|
Function fetch_login($login)
|
||||||
|
{
|
||||||
$sql = "SELECT rowid FROM llx_adherent WHERE login='$login' LIMIT 1";
|
$sql = "SELECT rowid FROM llx_adherent WHERE login='$login' LIMIT 1";
|
||||||
if ( $this->db->query( $sql) ){
|
if ( $this->db->query( $sql) )
|
||||||
if ($this->db->num_rows()){
|
{
|
||||||
$obj = $this->db->fetch_object(0);
|
if ($this->db->num_rows())
|
||||||
$this->fetch($obj->rowid);
|
{
|
||||||
|
$obj = $this->db->fetch_object(0);
|
||||||
|
$this->fetch($obj->rowid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $this->db->error();
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
print $this->db->error();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* Fetch adherent corresponding to rowid passed in argument */
|
/* Fetch adherent corresponding to rowid passed in argument */
|
||||||
Function fetch($rowid)
|
Function fetch($rowid)
|
||||||
@ -592,10 +602,12 @@ class Adherent
|
|||||||
// mailman
|
// mailman
|
||||||
if (defined("MAIN_USE_MAILMAN") && MAIN_USE_MAILMAN == 1)
|
if (defined("MAIN_USE_MAILMAN") && MAIN_USE_MAILMAN == 1)
|
||||||
{
|
{
|
||||||
if(!$this->add_to_mailman()){
|
if(!$this->add_to_mailman())
|
||||||
$err+=1;
|
{
|
||||||
}
|
$err+=1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($adht->vote == 'yes' &&
|
if ($adht->vote == 'yes' &&
|
||||||
defined("MAIN_USE_GLASNOST") && MAIN_USE_GLASNOST ==1 &&
|
defined("MAIN_USE_GLASNOST") && MAIN_USE_GLASNOST ==1 &&
|
||||||
defined("MAIN_USE_GLASNOST_AUTO") && MAIN_USE_GLASNOST_AUTO ==1
|
defined("MAIN_USE_GLASNOST_AUTO") && MAIN_USE_GLASNOST_AUTO ==1
|
||||||
@ -994,105 +1006,112 @@ class Adherent
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Function add_to_mailman()
|
Function add_to_mailman()
|
||||||
{
|
{
|
||||||
if (defined("MAIN_MAILMAN_URL") && MAIN_MAILMAN_URL != '' && defined("MAIN_MAILMAN_LISTS") && MAIN_MAILMAN_LISTS != '')
|
if (defined("MAIN_MAILMAN_URL") && MAIN_MAILMAN_URL != '' && defined("MAIN_MAILMAN_LISTS") && MAIN_MAILMAN_LISTS != '')
|
||||||
{
|
{
|
||||||
$lists=explode(',',MAIN_MAILMAN_LISTS);
|
$lists=explode(',',MAIN_MAILMAN_LISTS);
|
||||||
foreach ($lists as $list)
|
foreach ($lists as $list)
|
||||||
{
|
{
|
||||||
// on remplace dans l'url le nom de la liste ainsi
|
// on remplace dans l'url le nom de la liste ainsi
|
||||||
// que l'email et le mot de passe
|
// que l'email et le mot de passe
|
||||||
$patterns = array (
|
$patterns = array (
|
||||||
'/%LISTE%/',
|
'/%LISTE%/',
|
||||||
'/%EMAIL%/',
|
'/%EMAIL%/',
|
||||||
'/%PASS%/'
|
'/%PASS%/'
|
||||||
);
|
);
|
||||||
$replace = array (
|
$replace = array (
|
||||||
$list,
|
$list,
|
||||||
$this->email,
|
$this->email,
|
||||||
$this->pass
|
$this->pass
|
||||||
);
|
);
|
||||||
$curl_url = preg_replace ($patterns, $replace, MAIN_MAILMAN_URL);
|
$curl_url = preg_replace ($patterns, $replace, MAIN_MAILMAN_URL);
|
||||||
|
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_URL,"$curl_url");
|
||||||
|
//curl_setopt($ch, CURLOPT_URL,"http://www.j1b.org/");
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
||||||
|
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
|
||||||
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||||
|
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
||||||
|
//curl_setopt($ch, CURLOPT_POST, 0);
|
||||||
|
//curl_setopt($ch, CURLOPT_POSTFIELDS, "a=3&b=5");
|
||||||
|
//--- Start buffering
|
||||||
|
//ob_start();
|
||||||
|
$result=curl_exec ($ch);
|
||||||
|
logfile($result);
|
||||||
|
//--- End buffering and clean output
|
||||||
|
//ob_end_clean();
|
||||||
|
if (curl_error($ch) > 0)
|
||||||
|
{
|
||||||
|
// error
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
curl_close ($ch);
|
||||||
|
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errorstr="Constantes de connection non definies";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$ch = curl_init();
|
|
||||||
curl_setopt($ch, CURLOPT_URL,"$curl_url");
|
|
||||||
//curl_setopt($ch, CURLOPT_URL,"http://www.j1b.org/");
|
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
|
||||||
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
|
|
||||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
|
||||||
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
|
||||||
//curl_setopt($ch, CURLOPT_POST, 0);
|
|
||||||
//curl_setopt($ch, CURLOPT_POSTFIELDS, "a=3&b=5");
|
|
||||||
//--- Start buffering
|
|
||||||
//ob_start();
|
|
||||||
$result=curl_exec ($ch);
|
|
||||||
logfile($result);
|
|
||||||
//--- End buffering and clean output
|
|
||||||
//ob_end_clean();
|
|
||||||
if (curl_error($ch) > 0)
|
|
||||||
{
|
|
||||||
// error
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
curl_close ($ch);
|
|
||||||
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}else{
|
|
||||||
$this->errorstr="Constantes de connection non definies";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Function del_to_mailman()
|
Function del_to_mailman()
|
||||||
{
|
{
|
||||||
if (defined("MAIN_MAILMAN_UNSUB_URL") && MAIN_MAILMAN_UNSUB_URL != '' && defined("MAIN_MAILMAN_LISTS") && MAIN_MAILMAN_LISTS != '')
|
if (defined("MAIN_MAILMAN_UNSUB_URL") && MAIN_MAILMAN_UNSUB_URL != '' && defined("MAIN_MAILMAN_LISTS") && MAIN_MAILMAN_LISTS != '')
|
||||||
{
|
{
|
||||||
$lists=explode(',',MAIN_MAILMAN_LISTS);
|
$lists=explode(',',MAIN_MAILMAN_LISTS);
|
||||||
foreach ($lists as $list)
|
foreach ($lists as $list)
|
||||||
{
|
{
|
||||||
// on remplace dans l'url le nom de la liste ainsi
|
// on remplace dans l'url le nom de la liste ainsi
|
||||||
// que l'email et le mot de passe
|
// que l'email et le mot de passe
|
||||||
$patterns = array (
|
$patterns = array (
|
||||||
'/%LISTE%/',
|
'/%LISTE%/',
|
||||||
'/%EMAIL%/',
|
'/%EMAIL%/',
|
||||||
'/%PASS%/'
|
'/%PASS%/'
|
||||||
);
|
);
|
||||||
$replace = array (
|
$replace = array (
|
||||||
$list,
|
$list,
|
||||||
$this->email,
|
$this->email,
|
||||||
$this->pass
|
$this->pass
|
||||||
);
|
);
|
||||||
$curl_url = preg_replace ($patterns, $replace, MAIN_MAILMAN_UNSUB_URL);
|
$curl_url = preg_replace ($patterns, $replace, MAIN_MAILMAN_UNSUB_URL);
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL,"$curl_url");
|
curl_setopt($ch, CURLOPT_URL,"$curl_url");
|
||||||
//curl_setopt($ch, CURLOPT_URL,"http://www.j1b.org/");
|
//curl_setopt($ch, CURLOPT_URL,"http://www.j1b.org/");
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
||||||
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
|
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
|
||||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||||
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
||||||
//curl_setopt($ch, CURLOPT_POST, 0);
|
//curl_setopt($ch, CURLOPT_POST, 0);
|
||||||
//curl_setopt($ch, CURLOPT_POSTFIELDS, "a=3&b=5");
|
//curl_setopt($ch, CURLOPT_POSTFIELDS, "a=3&b=5");
|
||||||
//--- Start buffering
|
//--- Start buffering
|
||||||
//ob_start();
|
//ob_start();
|
||||||
$result=curl_exec ($ch);
|
$result=curl_exec ($ch);
|
||||||
logfile($result);
|
logfile($result);
|
||||||
//--- End buffering and clean output
|
//--- End buffering and clean output
|
||||||
//ob_end_clean();
|
//ob_end_clean();
|
||||||
if (curl_error($ch) > 0)
|
if (curl_error($ch) > 0)
|
||||||
{
|
{
|
||||||
// error
|
// error
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
curl_close ($ch);
|
curl_close ($ch);
|
||||||
|
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errorstr="Constantes de connection non definies";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}else{
|
|
||||||
$this->errorstr="Constantes de connection non definies";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user