From eae0b9a52672fe9830eb0c12fa06be5f31273e70 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 Feb 2007 14:36:01 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20Nettoyage=20des=20variables=20de=20subst?= =?UTF-8?q?itution=20du=20module=20adh=E9rent.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/adherents/adherent.class.php | 140 ++++++++++++++-------------- htdocs/admin/adherent.php | 4 + htdocs/master.inc.php | 8 +- mysql/data/data.sql | 24 ++--- 4 files changed, 88 insertions(+), 88 deletions(-) diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index 68158abadd9..22d03731697 100644 --- a/htdocs/adherents/adherent.class.php +++ b/htdocs/adherents/adherent.class.php @@ -125,8 +125,7 @@ class Adherent '/%PRENOM%/', '/%NOM%/', '/%INFOS%/', - '/%INFO%/', - '/%SERVEUR%/', + '/%DOL_MAIN_URL_ROOT%/', '/%SOCIETE%/', '/%ADRESSE%/', '/%CP%/', @@ -136,7 +135,7 @@ class Adherent '/%NAISS%/', '/%PHOTO%/', '/%LOGIN%/', - '/%PASS%/' + '/%PASSWORD%/' ); $infos.= $langs->trans("Lastname").": $this->nom\n"; $infos = $langs->trans("Firstname").": $this->prenom\n"; @@ -156,7 +155,6 @@ class Adherent $this->prenom, $this->nom, $infos, - $infos, DOL_MAIN_URL_ROOT, $this->societe, $this->adresse, @@ -1402,18 +1400,16 @@ class Adherent $patterns = array ( '/%LISTE%/', '/%EMAIL%/', - '/%PASS%/', - '/%ADMINPW%/', - '/%SERVER%/' + '/%PASSWORD%/', + '/%MAILMAN_ADMINPW%/' ); $replace = array ( $list, $this->email, $this->pass, - ADHERENT_MAILMAN_ADMINPW, - ADHERENT_MAILMAN_SERVER + $conf->global->ADHERENT_MAILMAN_ADMINPW ); - $curl_url = preg_replace ($patterns, $replace, ADHERENT_MAILMAN_URL); + $curl_url = preg_replace ($patterns, $replace, $conf->global->ADHERENT_MAILMAN_URL); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"$curl_url"); @@ -1448,72 +1444,72 @@ class Adherent } /** - \brief fonction qui désinscrit l'utilisateur de toutes les mailing list mailman - \ remarks utilie lors de la résiliation d'adhésion + \brief Fonction qui désinscrit l'utilisateur de toutes les mailing list mailman + \remarks Utilise lors de la résiliation d'adhésion */ function del_to_mailman($listes='') { - if (defined("ADHERENT_MAILMAN_UNSUB_URL") && ADHERENT_MAILMAN_UNSUB_URL != '' && defined("ADHERENT_MAILMAN_LISTS") && ADHERENT_MAILMAN_LISTS != '') - { - if ($listes==''){ - $lists=explode(',',ADHERENT_MAILMAN_LISTS); - if (defined("ADHERENT_MAILMAN_LISTS_COTISANT") && ADHERENT_MAILMAN_LISTS_COTISANT !=''){ - $lists=array_merge ($lists,explode(',',ADHERENT_MAILMAN_LISTS_COTISANT)); - } - }else{ - $lists=explode(',',$listes); + global $conf; + + if (defined("ADHERENT_MAILMAN_UNSUB_URL") && ADHERENT_MAILMAN_UNSUB_URL != '' && defined("ADHERENT_MAILMAN_LISTS") && ADHERENT_MAILMAN_LISTS != '') + { + if ($listes==''){ + $lists=explode(',',ADHERENT_MAILMAN_LISTS); + if (defined("ADHERENT_MAILMAN_LISTS_COTISANT") && ADHERENT_MAILMAN_LISTS_COTISANT !=''){ + $lists=array_merge ($lists,explode(',',ADHERENT_MAILMAN_LISTS_COTISANT)); + } + }else{ + $lists=explode(',',$listes); + } + foreach ($lists as $list) + { + // on remplace dans l'url le nom de la liste ainsi + // que l'email et le mot de passe + $patterns = array ( + '/%LISTE%/', + '/%EMAIL%/', + '/%PASSWORD%/', + '/%MAILMAN_ADMINPW%/' + ); + $replace = array ( + $list, + $this->email, + $this->pass, + $conf->global->ADHERENT_MAILMAN_ADMINPW + ); + $curl_url = preg_replace ($patterns, $replace, $conf->global->ADHERENT_MAILMAN_UNSUB_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); + dolibarr_syslog($result); + //--- End buffering and clean output + //ob_end_clean(); + if (curl_error($ch) > 0) + { + // error + return 0; + } + curl_close ($ch); + + } + return 1; + } + else + { + $this->error="Constantes de connection non definies"; + return 0; + } } - foreach ($lists as $list) - { - // on remplace dans l'url le nom de la liste ainsi - // que l'email et le mot de passe - $patterns = array ( - '/%LISTE%/', - '/%EMAIL%/', - '/%PASS%/', - '/%ADMINPW%/', - '/%SERVER%/' - ); - $replace = array ( - $list, - $this->email, - $this->pass, - ADHERENT_MAILMAN_ADMINPW, - ADHERENT_MAILMAN_SERVER - ); - $curl_url = preg_replace ($patterns, $replace, ADHERENT_MAILMAN_UNSUB_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); - dolibarr_syslog($result); - //--- End buffering and clean output - //ob_end_clean(); - if (curl_error($ch) > 0) - { - // error - return 0; - } - curl_close ($ch); - - } - return 1; - } - else - { - $this->error="Constantes de connection non definies"; - return 0; - } - } /** * \brief Retourne le nom complet de l'adhérent diff --git a/htdocs/admin/adherent.php b/htdocs/admin/adherent.php index 119418a2d55..ae5d5f81aab 100644 --- a/htdocs/admin/adherent.php +++ b/htdocs/admin/adherent.php @@ -252,6 +252,10 @@ $constantes=array( 'ADHERENT_ETIQUETTE_TYPE' ); print_fiche_titre("Autres variables globales"); + +print $langs->trans("FollowingVariablesCanBeUsed").'
'; +print '%DOL_MAIN_URL_ROOT%, %ID%, %PRENOM%, %NOM%, %LOGIN%, %PASSWORD%, %SOCIETE%, %ADRESSE%, %CP%, %VILLE%, %PAYS%, %EMAIL%, %NAISS%, %PHOTO%, %TYPE%
'; + form_constantes($constantes); diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 95108c97002..a0a360cd123 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -72,13 +72,13 @@ if (! $dolibarr_main_data_root) { $dolibarr_main_data_root=ereg_replace("/htdocs","",$dolibarr_main_document_root); $dolibarr_main_data_root.="/documents"; } -define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); -define('DOL_DATA_ROOT', $dolibarr_main_data_root); -define('DOL_MAIN_URL_ROOT', $dolibarr_main_url_root); +define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem pages php (htdocs) +define('DOL_DATA_ROOT', $dolibarr_main_data_root); // Filesystem donnes (documents) +define('DOL_MAIN_URL_ROOT', $dolibarr_main_url_root); // URL racine absolue $uri=eregi_replace('^http(s?)://','',$dolibarr_main_url_root); $pos = strstr ($uri, '/'); // $pos contient alors url sans nom domaine if ($pos == '/') $pos = ''; // si $pos vaut /, on le met a '' -define('DOL_URL_ROOT', $pos); +define('DOL_URL_ROOT', $pos); // URL racine relative /* diff --git a/mysql/data/data.sql b/mysql/data/data.sql index aad6176562b..e9fc6494207 100644 --- a/mysql/data/data.sql +++ b/mysql/data/data.sql @@ -103,16 +103,16 @@ insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_TRA -- insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_REQUIRED','1','yesno','Le mail est obligatoire pour créer un adhérent',0); insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_FROM','adherents@domain.com','chaine','From des mails adherents',0); -insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_RESIL','Votre adhesion sur %SERVEUR% vient d\'etre resilie.\r\nNous esperons vous revoir tres bientot','texte','Mail de Resiliation',0); -insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_VALID','Votre adhesion vient d\'etre validee. \r\nVoici le rappel de vos coordonnees (toute information erronee entrainera la non validation de votre inscription) :\r\n\r\n%INFO%\r\n\r\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l\'adresse suivante : \r\n%SERVEUR%public/adherents/','texte','Mail de validation',0); -insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_EDIT','Voici le rappel des coordonnees que vous avez modifiees (toute information erronee entrainera la non validation de votre inscription) :\r\n\r\n%INFO%\r\n\r\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l\'adresse suivante :\r\n%SERVEUR%public/adherents/','texte','Mail d\'edition',0); -insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_NEW','Merci de votre inscription. Votre adhesion devrait etre rapidement validee.\r\nVoici le rappel des coordonnees que vous avez rentrees (toute information erronee entrainera la non validation de votre inscription) :\r\n\r\n%INFO%\r\n\r\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l\'adresse suivante :\r\n%SERVEUR%public/adherents/','texte','Mail de nouvel inscription',0); -insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_COTIS','Bonjour %PRENOM%,\r\nMerci de votre inscription.\r\nCet email confirme que votre cotisation a ete recue et enregistree.\r\n\r\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l\'adresse suivante :\r\n%SERVEUR%public/adherents/','texte','Mail de validation de cotisation',0); -insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_VALID_SUBJECT','Votre adhésion a ete validée sur %SERVEUR%','chaine','sujet du mail de validation',0); -insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_RESIL_SUBJECT','Resiliation de votre adhesion sur %SERVEUR%','chaine','sujet du mail de resiliation',0); +insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_RESIL','Votre adhesion vient d\'etre resiliee.\r\nNous esperons vous revoir tres bientot','texte','Mail de Resiliation',0); +insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_VALID','Votre adhesion vient d\'etre validee. \r\nVoici le rappel de vos coordonnees (toute information erronee entrainera la non validation de votre inscription) :\r\n\r\n%INFOS%\r\n\r\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l\'adresse suivante : \r\n%DOL_MAIN_URL_ROOT%/public/adherents/','texte','Mail de validation',0); +insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_EDIT','Voici le rappel des coordonnees que vous avez modifiees (toute information erronee entrainera la non validation de votre inscription) :\r\n\r\n%INFOS%\r\n\r\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l\'adresse suivante :\r\n%DOL_MAIN_URL_ROOT%/public/adherents/','texte','Mail d\'edition',0); +insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_NEW','Merci de votre inscription. Votre adhesion devrait etre rapidement validee.\r\nVoici le rappel des coordonnees que vous avez rentrees (toute information erronee entrainera la non validation de votre inscription) :\r\n\r\n%INFOS%\r\n\r\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l\'adresse suivante :\r\n%DOL_MAIN_URL_ROOT%/public/adherents/','texte','Mail de nouvel inscription',0); +insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_COTIS','Bonjour %PRENOM%,\r\nMerci de votre inscription.\r\nCet email confirme que votre cotisation a ete recue et enregistree.\r\n\r\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l\'adresse suivante :\r\n%DOL_MAIN_URL_ROOT%/public/adherents/','texte','Mail de validation de cotisation',0); +insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_VALID_SUBJECT','Votre adhésion a ete validée','chaine','sujet du mail de validation',0); +insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_RESIL_SUBJECT','Resiliation de votre adhesion','chaine','sujet du mail de resiliation',0); insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_COTIS_SUBJECT','Recu de votre cotisation','chaine','sujet du mail de validation de cotisation',0); -insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_NEW_SUBJECT','Bienvenue sur %SERVEUR%','chaine','Sujet du mail de nouvelle adhesion',0); -insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_EDIT_SUBJECT','Votre fiche a ete editee sur %SERVEUR%','chaine','Sujet du mail d\'edition',0); +insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_NEW_SUBJECT','Bienvenue','chaine','Sujet du mail de nouvelle adhesion',0); +insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_EDIT_SUBJECT','Votre fiche a ete editee','chaine','Sujet du mail d\'edition',0); -- @@ -124,8 +124,8 @@ insert into llx_const (name, value, type, note, visible) values ('MAILING_EMAIL_ -- Mailman -- insert into llx_const (name, value, type, note, visible) values ('ADHERENT_USE_MAILMAN','0','yesno','Utilisation de Mailman',0); -insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAILMAN_UNSUB_URL','http://%SERVER%/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%ADMINPW%&user=%EMAIL%','chaine','Url de desinscription aux listes mailman',0); -insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAILMAN_URL','http://%SERVER%/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%ADMINPW%&send_welcome_msg_to_this_batch=1&subscribees=%EMAIL%','chaine','url pour les inscriptions mailman',0); +insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAILMAN_UNSUB_URL','http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&user=%EMAIL%','chaine','Url de desinscription aux listes mailman',0); +insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAILMAN_URL','http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&send_welcome_msg_to_this_batch=1&subscribees=%EMAIL%','chaine','url pour les inscriptions mailman',0); insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAILMAN_LISTS','test-test,test-test2','chaine','Listes auxquelles inscrire les nouveaux adherents',0); insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAILMAN_ADMINPW','','chaine','Mot de passe Admin des liste mailman',0); insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAILMAN_SERVER','lists.domain.com','chaine','Serveur hebergeant les interfaces d\'Admin des listes mailman',0); @@ -152,7 +152,7 @@ insert into llx_const (name, value, type, note, visible) values ('ADHERENT_SPIP_ -- insert into llx_const (name, value, type, note, visible) values ('ADHERENT_TEXT_NEW_ADH','','texte','Texte d\'entete du formaulaire d\'adhesion en ligne',0); insert into llx_const (name, value, type, note, visible) values ('ADHERENT_CARD_HEADER_TEXT','%ANNEE%','chaine','Texte imprime sur le haut de la carte adherent',0); -insert into llx_const (name, value, type, note, visible) values ('ADHERENT_CARD_FOOTER_TEXT','Association FreeLUG http://www.freelug.org/','chaine','Texte imprime sur le bas de la carte adherent',0); +insert into llx_const (name, value, type, note, visible) values ('ADHERENT_CARD_FOOTER_TEXT','Association AZERTY','chaine','Texte imprime sur le bas de la carte adherent',0); insert into llx_const (name, value, type, note, visible) values ('ADHERENT_CARD_TEXT','%TYPE% n° %ID%\r\n%PRENOM% %NOM%\r\n<%EMAIL%>\r\n%ADRESSE%\r\n%CP% %VILLE%\r\n%PAYS%','texte','Texte imprime sur la carte adherent',0); --