Qual: Enhance mailmanspip module.
New: When a member is validated, we can subscribe to mailing-lists according to its type.
This commit is contained in:
parent
b7abad95d8
commit
98676ddaa1
@ -16,6 +16,8 @@ For users:
|
|||||||
- New: Enhance default style.
|
- New: Enhance default style.
|
||||||
- New: Can edit and resiliate member status from list.
|
- New: Can edit and resiliate member status from list.
|
||||||
- New: Can insert links into elements lines. Also reported into PDF.
|
- New: Can insert links into elements lines. Also reported into PDF.
|
||||||
|
- New: When a member is validated, we can subscribe to mailing-lists
|
||||||
|
according to its type.
|
||||||
- Fix: No images into product description lines as PDF generation does
|
- Fix: No images into product description lines as PDF generation does
|
||||||
not work with this.
|
not work with this.
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/mailmanspip.lib.php");
|
|||||||
|
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
$langs->load("members");
|
$langs->load("members");
|
||||||
|
$langs->load("mailmanspip");
|
||||||
|
|
||||||
if (! $user->admin) accessforbidden();
|
if (! $user->admin) accessforbidden();
|
||||||
|
|
||||||
@ -40,7 +41,8 @@ if (! $user->admin) accessforbidden();
|
|||||||
$type=array('yesno','texte','chaine');
|
$type=array('yesno','texte','chaine');
|
||||||
|
|
||||||
$action = GETPOST("action");
|
$action = GETPOST("action");
|
||||||
|
$testsubscribeemail = GETPOST("testsubscribeemail");
|
||||||
|
$testunsubscribeemail = GETPOST("testunsubscribeemail");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -51,16 +53,7 @@ if ($action == 'update' || $action == 'add')
|
|||||||
{
|
{
|
||||||
$constname=GETPOST("constname");
|
$constname=GETPOST("constname");
|
||||||
$constvalue=GETPOST("constvalue");
|
$constvalue=GETPOST("constvalue");
|
||||||
|
$consttype=GETPOST("consttype");
|
||||||
if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE') && $constvalue == -1) $constvalue='';
|
|
||||||
if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
|
|
||||||
{
|
|
||||||
if ($constvalue) $constvalue=0;
|
|
||||||
else $constvalue=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (in_array($constname,array('ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL'))) $constvalue=$_POST["constvalue".$constname];
|
|
||||||
$consttype=$_POST["consttype"];
|
|
||||||
$constnote=GETPOST("constnote");
|
$constnote=GETPOST("constnote");
|
||||||
$res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
|
$res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
|
||||||
|
|
||||||
@ -79,7 +72,7 @@ if ($action == 'update' || $action == 'add')
|
|||||||
// Action activation d'un sous module du module adherent
|
// Action activation d'un sous module du module adherent
|
||||||
if ($action == 'set')
|
if ($action == 'set')
|
||||||
{
|
{
|
||||||
$result=dolibarr_set_const($db, $_GET["name"],$_GET["value"],'',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, $_GET["name"], $_GET["value"], '', 0, '', $conf->entity);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
@ -89,13 +82,60 @@ if ($action == 'set')
|
|||||||
// Action desactivation d'un sous module du module adherent
|
// Action desactivation d'un sous module du module adherent
|
||||||
if ($action == 'unset')
|
if ($action == 'unset')
|
||||||
{
|
{
|
||||||
$result=dolibarr_del_const($db,$_GET["name"],$conf->entity);
|
$result=dolibarr_del_const($db, $_GET["name"], $conf->entity);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (($action == 'testsubscribe' || $action == 'testunsubscribe') && ! empty($conf->global->ADHERENT_USE_MAILMAN))
|
||||||
|
{
|
||||||
|
$email=GETPOST($action.'email');
|
||||||
|
if (! isValidEmail($email))
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
$mesg='<div class="error">'.$langs->trans("ErrorBadEMail",$email).'</div>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
include_once(DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php');
|
||||||
|
$mailmanspip=new MailmanSpip($db);
|
||||||
|
|
||||||
|
$object=new stdClass();
|
||||||
|
$object->email=$email;
|
||||||
|
$object->pass=$email;
|
||||||
|
/*$object->element='member';
|
||||||
|
$object->type='Preferred Partners'; */
|
||||||
|
|
||||||
|
if ($action == 'testsubscribe')
|
||||||
|
{
|
||||||
|
$result=$mailmanspip->add_to_mailman($object);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$mesg='<div class="error">'.$mailmanspip->error.'</div>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg='MailmanCreationSuccess';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($action == 'testunsubscribe')
|
||||||
|
{
|
||||||
|
$result=$mailmanspip->del_to_mailman($object);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$mesg='<div class="error">'.$mailmanspip->error.'</div>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg='MailmanDeletionSuccess';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -125,8 +165,11 @@ dol_htmloutput_mesg($mesg);
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
if ($conf->global->ADHERENT_USE_MAILMAN)
|
if ($conf->global->ADHERENT_USE_MAILMAN)
|
||||||
{
|
{
|
||||||
$lien=img_picto($langs->trans("Active"),'tick').' ';
|
//$lien=img_picto($langs->trans("Active"),'tick').' ';
|
||||||
$lien.='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">'.$langs->trans("Disable").'</a>';
|
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">';
|
||||||
|
//$lien.=$langs->trans("Disable");
|
||||||
|
$lien.=img_picto($langs->trans("Activated"),'switch_on');
|
||||||
|
$lien.='</a>';
|
||||||
// Edition des varibales globales
|
// Edition des varibales globales
|
||||||
$constantes=array(
|
$constantes=array(
|
||||||
'ADHERENT_MAILMAN_ADMINPW',
|
'ADHERENT_MAILMAN_ADMINPW',
|
||||||
@ -162,13 +205,30 @@ if ($conf->global->ADHERENT_USE_MAILMAN)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">'.$langs->trans("Activate").'</a>';
|
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">';
|
||||||
|
//$lien.=img_$langs->trans("Activate")
|
||||||
|
$lien.=img_picto($langs->trans("Disabled"),'switch_off');
|
||||||
|
$lien.='</a>';
|
||||||
print_fiche_titre("Mailman mailing list system",$lien,'');
|
print_fiche_titre("Mailman mailing list system",$lien,'');
|
||||||
print "<hr>\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
if ($conf->global->ADHERENT_USE_MAILMAN)
|
||||||
|
{
|
||||||
|
print '<form action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
print '<input type="hidden" name="action" value="testsubscribe">';
|
||||||
|
print $langs->trans("TestSubscribe").'<br>';
|
||||||
|
print $langs->trans("EMail").' <input type="text" name="testsubscribeemail" value="'.GETPOST('testsubscribeemail').'"> <input class="button" type="submit" value="'.$langs->trans("Test").'"><br>';
|
||||||
|
print '</form>';
|
||||||
|
print '<form action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
print '<input type="hidden" name="action" value="testunsubscribe">';
|
||||||
|
print $langs->trans("TestUnSubscribe").'<br>';
|
||||||
|
print $langs->trans("EMail").' <input type="text" name="testunsubscribeemail" value="'.GETPOST('testunsubscribeemail').'"> <input class="button" type="submit" value="'.$langs->trans("Test").'"><br>';
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -124,8 +124,11 @@ dol_htmloutput_mesg($mesg);
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
if ($conf->global->ADHERENT_USE_SPIP)
|
if ($conf->global->ADHERENT_USE_SPIP)
|
||||||
{
|
{
|
||||||
$lien=img_picto($langs->trans("Active"),'tick').' ';
|
//$lien=img_picto($langs->trans("Active"),'tick').' ';
|
||||||
$lien.='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">'.$langs->trans("Disable").'</a>';
|
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">';
|
||||||
|
//$lien.=$langs->trans("Disable");
|
||||||
|
$lien.=img_picto($langs->trans("Activated"),'switch_on');
|
||||||
|
$lien.='</a>';
|
||||||
// Edition des varibales globales
|
// Edition des varibales globales
|
||||||
$constantes=array(
|
$constantes=array(
|
||||||
'ADHERENT_SPIP_SERVEUR',
|
'ADHERENT_SPIP_SERVEUR',
|
||||||
@ -140,9 +143,11 @@ if ($conf->global->ADHERENT_USE_SPIP)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">'.$langs->trans("Activate").'</a>';
|
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">';
|
||||||
|
//$lien.=$langs->trans("Activate");
|
||||||
|
$lien.=img_picto($langs->trans("Disabled"),'switch_off');
|
||||||
|
$lien.='</a>';
|
||||||
print_fiche_titre("SPIP - CMS",$lien,'');
|
print_fiche_titre("SPIP - CMS",$lien,'');
|
||||||
print "<hr>\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1347,8 +1347,8 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fonction qui ajoute l'adherent au abonnements automatiques
|
* Fonction qui ajoute l'adherent au abonnements automatiques mailing-list, spip, etc.
|
||||||
* mailing-list, spip, etc.
|
* TODO Move this into member creation trigger (trigger of mailmanspip module)
|
||||||
*
|
*
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
@ -1356,12 +1356,15 @@ class Adherent extends CommonObject
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
include_once(DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php');
|
||||||
|
$mailmanspip=new MailmanSpip($db);
|
||||||
|
|
||||||
$err=0;
|
$err=0;
|
||||||
|
|
||||||
// mailman
|
// mailman
|
||||||
if (! empty($conf->global->ADHERENT_USE_MAILMAN))
|
if (! empty($conf->global->ADHERENT_USE_MAILMAN))
|
||||||
{
|
{
|
||||||
$result=$this->add_to_mailman();
|
$result=$mailmanspip->add_to_mailman($this);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$err+=1;
|
$err+=1;
|
||||||
@ -1371,7 +1374,7 @@ class Adherent extends CommonObject
|
|||||||
// spip
|
// spip
|
||||||
if ($conf->global->ADHERENT_USE_SPIP && $conf->mailmanspip->enabled)
|
if ($conf->global->ADHERENT_USE_SPIP && $conf->mailmanspip->enabled)
|
||||||
{
|
{
|
||||||
$result=$this->add_to_spip();
|
$result=$mailmanspip->add_to_spip($this);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$err+=1;
|
$err+=1;
|
||||||
@ -1390,8 +1393,8 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fonction qui supprime l'adherent des abonnements automatiques
|
* Fonction qui supprime l'adherent des abonnements automatiques mailing-list, spip, etc.
|
||||||
* mailing-list, spip, etc.
|
* TODO Move this into member deletion trigger (trigger of mailmanspip module)
|
||||||
*
|
*
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
@ -1399,11 +1402,15 @@ class Adherent extends CommonObject
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
include_once(DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php');
|
||||||
|
$mailmanspip=new MailmanSpip($db);
|
||||||
|
|
||||||
$err=0;
|
$err=0;
|
||||||
|
|
||||||
// mailman
|
// mailman
|
||||||
if (! empty($conf->global->ADHERENT_USE_MAILMAN))
|
if (! empty($conf->global->ADHERENT_USE_MAILMAN))
|
||||||
{
|
{
|
||||||
$result=$this->del_to_mailman();
|
$result=$mailmanspip->del_to_mailman($this);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$err+=1;
|
$err+=1;
|
||||||
@ -1412,7 +1419,7 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
if ($conf->global->ADHERENT_USE_SPIP && $conf->mailmanspip->enabled)
|
if ($conf->global->ADHERENT_USE_SPIP && $conf->mailmanspip->enabled)
|
||||||
{
|
{
|
||||||
$result=$this->del_to_spip();
|
$result=$mailmanspip->del_to_spip($this);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$err+=1;
|
$err+=1;
|
||||||
@ -1430,281 +1437,6 @@ class Adherent extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fonction qui donne les droits redacteurs dans spip
|
|
||||||
*
|
|
||||||
* @return int =0 if KO, >0 if OK
|
|
||||||
*/
|
|
||||||
function add_to_spip()
|
|
||||||
{
|
|
||||||
dol_syslog(get_class($this)."::add_to_spip");
|
|
||||||
|
|
||||||
if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 &&
|
|
||||||
defined('ADHERENT_SPIP_SERVEUR') && ADHERENT_SPIP_SERVEUR != '' &&
|
|
||||||
defined('ADHERENT_SPIP_USER') && ADHERENT_SPIP_USER != '' &&
|
|
||||||
defined('ADHERENT_SPIP_PASS') && ADHERENT_SPIP_PASS != '' &&
|
|
||||||
defined('ADHERENT_SPIP_DB') && ADHERENT_SPIP_DB != ''
|
|
||||||
)
|
|
||||||
{
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/security2.lib.php");
|
|
||||||
$mdpass=dol_hash($this->pass);
|
|
||||||
$htpass=crypt($this->pass,makesalt());
|
|
||||||
$query = "INSERT INTO spip_auteurs (nom, email, login, pass, htpass, alea_futur, statut) VALUES(\"".$this->firstname." ".$this->lastname."\",\"".$this->email."\",\"".$this->login."\",\"$mdpass\",\"$htpass\",FLOOR(32000*RAND()),\"1comite\")";
|
|
||||||
|
|
||||||
$mydb=getDoliDBInstance('mysql',ADHERENT_SPIP_SERVEUR,ADHERENT_SPIP_USER,ADHERENT_SPIP_PASS,ADHERENT_SPIP_DB,ADHERENT_SPIP_PORT);
|
|
||||||
|
|
||||||
if (! $mydb->ok)
|
|
||||||
{
|
|
||||||
$this->error=$mydb->lasterror();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $mydb->query($query);
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$mydb->close();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$mydb->lasterror();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fonction qui enleve les droits redacteurs dans spip
|
|
||||||
*
|
|
||||||
* @return int =0 if KO, >0 if OK
|
|
||||||
*/
|
|
||||||
function del_to_spip()
|
|
||||||
{
|
|
||||||
if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 &&
|
|
||||||
defined('ADHERENT_SPIP_SERVEUR') && ADHERENT_SPIP_SERVEUR != '' &&
|
|
||||||
defined('ADHERENT_SPIP_USER') && ADHERENT_SPIP_USER != '' &&
|
|
||||||
defined('ADHERENT_SPIP_PASS') && ADHERENT_SPIP_PASS != '' &&
|
|
||||||
defined('ADHERENT_SPIP_DB') && ADHERENT_SPIP_DB != ''
|
|
||||||
)
|
|
||||||
{
|
|
||||||
$query = "DELETE FROM spip_auteurs WHERE login='".$this->login."'";
|
|
||||||
|
|
||||||
$mydb=getDoliDBInstance('mysql',ADHERENT_SPIP_SERVEUR,ADHERENT_SPIP_USER,ADHERENT_SPIP_PASS,ADHERENT_SPIP_DB,ADHERENT_SPIP_PORT);
|
|
||||||
|
|
||||||
$result = $mydb->query($query);
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$mydb->close();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$mydb->error();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fonction qui dit si cet utilisateur est un redacteur existant dans spip
|
|
||||||
*
|
|
||||||
* @return int 1=exists, 0=does not exists, -1=error
|
|
||||||
*/
|
|
||||||
function is_in_spip()
|
|
||||||
{
|
|
||||||
if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 &&
|
|
||||||
defined('ADHERENT_SPIP_SERVEUR') && ADHERENT_SPIP_SERVEUR != '' &&
|
|
||||||
defined('ADHERENT_SPIP_USER') && ADHERENT_SPIP_USER != '' &&
|
|
||||||
defined('ADHERENT_SPIP_PASS') && ADHERENT_SPIP_PASS != '' &&
|
|
||||||
defined('ADHERENT_SPIP_DB') && ADHERENT_SPIP_DB != '')
|
|
||||||
{
|
|
||||||
$query = "SELECT login FROM spip_auteurs WHERE login='".$this->login."'";
|
|
||||||
|
|
||||||
$mydb=getDoliDBInstance('mysql',ADHERENT_SPIP_SERVEUR,ADHERENT_SPIP_USER,ADHERENT_SPIP_PASS,ADHERENT_SPIP_DB,ADHERENT_SPIP_PORT);
|
|
||||||
|
|
||||||
if ($mydb->ok)
|
|
||||||
{
|
|
||||||
$result = $mydb->query($query);
|
|
||||||
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
if ($mydb->num_rows($result))
|
|
||||||
{
|
|
||||||
// nous avons au moins une reponse
|
|
||||||
$mydb->close($result);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// nous n'avons pas de reponse => n'existe pas
|
|
||||||
$mydb->close($result);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$mydb->error();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error="Echec de connexion avec les identifiants ".ADHERENT_SPIP_SERVEUR." ".ADHERENT_SPIP_USER." ".ADHERENT_SPIP_PASS." ".ADHERENT_SPIP_DB;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Subscribe an email to all mailing-lists
|
|
||||||
*
|
|
||||||
* @param array $listes To force mailing-list (string separated with ,)
|
|
||||||
* @return int <=0 if KO, >0 if OK
|
|
||||||
*/
|
|
||||||
function add_to_mailman($listes='')
|
|
||||||
{
|
|
||||||
global $conf,$langs,$user;
|
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::add_to_mailman");
|
|
||||||
|
|
||||||
if (! function_exists("curl_init"))
|
|
||||||
{
|
|
||||||
$langs->load("errors");
|
|
||||||
$this->error=$langs->trans("ErrorFunctionNotAvailableInPHP","curl_init");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($conf->global->ADHERENT_MAILMAN_URL))
|
|
||||||
{
|
|
||||||
if ($listes == '' && ! empty($conf->global->ADHERENT_MAILMAN_LISTS))
|
|
||||||
{
|
|
||||||
$lists=explode(',',$conf->global->ADHERENT_MAILMAN_LISTS);
|
|
||||||
}
|
|
||||||
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_URL);
|
|
||||||
|
|
||||||
dol_syslog("Call URL to subscribe : ".$curl_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
|
|
||||||
$result=curl_exec($ch);
|
|
||||||
dol_syslog($result);
|
|
||||||
//--- End buffering and clean output
|
|
||||||
if (curl_error($ch) > 0)
|
|
||||||
{
|
|
||||||
// error
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
curl_close($ch);
|
|
||||||
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error="ADHERENT_MAILMAN_URL not defined";
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unsubscribe an email from all mailing-lists
|
|
||||||
* Used when a user is resiliated
|
|
||||||
*
|
|
||||||
* @param array $listes To force mailing-list (string separated with ,)
|
|
||||||
* @return int <=0 if KO, >0 if OK
|
|
||||||
*/
|
|
||||||
function del_to_mailman($listes='')
|
|
||||||
{
|
|
||||||
global $conf,$langs,$user;
|
|
||||||
|
|
||||||
if (! empty($conf->global->ADHERENT_MAILMAN_UNSUB_URL))
|
|
||||||
{
|
|
||||||
if ($listes=='' && ! empty($conf->global->ADHERENT_MAILMAN_LISTS))
|
|
||||||
{
|
|
||||||
$lists=explode(',',$conf->global->ADHERENT_MAILMAN_LISTS);
|
|
||||||
}
|
|
||||||
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 (
|
|
||||||
trim($list),
|
|
||||||
$this->email,
|
|
||||||
$this->pass,
|
|
||||||
$conf->global->ADHERENT_MAILMAN_ADMINPW
|
|
||||||
);
|
|
||||||
$curl_url = preg_replace($patterns, $replace, $conf->global->ADHERENT_MAILMAN_UNSUB_URL);
|
|
||||||
|
|
||||||
dol_syslog("Call URL to unsubscribe : ".$curl_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
|
|
||||||
$result=curl_exec($ch);
|
|
||||||
dol_syslog($result);
|
|
||||||
//--- End buffering and clean output
|
|
||||||
$rescode=curl_error($ch);
|
|
||||||
if ($rescode > 0)
|
|
||||||
{
|
|
||||||
dol_syslog("Error using CURL : ".$rescode, LOG_ERR);
|
|
||||||
// error
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
curl_close($ch);
|
|
||||||
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error="ADHERENT_MAILMAN_UNSUB_URL not defined";
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return label of a civility of a contact
|
* Return label of a civility of a contact
|
||||||
*
|
*
|
||||||
@ -1790,10 +1522,10 @@ class Adherent extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne le libelle du statut d'un adherent (brouillon, valide, resilie)
|
* Retourne le libelle du statut d'un adherent (brouillon, valide, resilie)
|
||||||
*
|
*
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
* @return string Label
|
* @return string Label
|
||||||
*/
|
*/
|
||||||
function getLibStatut($mode=0)
|
function getLibStatut($mode=0)
|
||||||
{
|
{
|
||||||
@ -1801,13 +1533,13 @@ class Adherent extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renvoi le libelle d'un statut donne
|
* Renvoi le libelle d'un statut donne
|
||||||
*
|
*
|
||||||
* @param int $statut Id statut
|
* @param int $statut Id statut
|
||||||
* @param int $need_subscription 1 si type adherent avec cotisation, 0 sinon
|
* @param int $need_subscription 1 si type adherent avec cotisation, 0 sinon
|
||||||
* @param timestamp $date_end_subscription Date fin adhesion
|
* @param timestamp $date_end_subscription Date fin adhesion
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
* @return string Label
|
* @return string Label
|
||||||
*/
|
*/
|
||||||
function LibStatut($statut,$need_subscription,$date_end_subscription,$mode=0)
|
function LibStatut($statut,$need_subscription,$date_end_subscription,$mode=0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -604,6 +604,7 @@ if ($user->rights->adherent->supprimer && $action == 'confirm_resign')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SPIP Management
|
||||||
if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $confirm == 'yes')
|
if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
if (! count($object->errors))
|
if (! count($object->errors))
|
||||||
@ -1167,16 +1168,16 @@ if ($rowid && $action != 'edit')
|
|||||||
|
|
||||||
// Cree un tableau formulaire
|
// Cree un tableau formulaire
|
||||||
$formquestion=array();
|
$formquestion=array();
|
||||||
if ($object->email) $formquestion[0]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?true:false));
|
if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?true:false));
|
||||||
$ret=$form->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1);
|
if ($conf->global->ADHERENT_USE_MAILMAN) { $langs->load("mailmanspip"); $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroMailManEnabled"),'value'=>''); }
|
||||||
if ($ret == 'html') print '<br>';
|
if ($conf->global->ADHERENT_USE_SPIP) { $langs->load("mailmanspip"); $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"),'value'=>''); }
|
||||||
|
print $form->formconfirm("fiche.php?rowid=".$rowid,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirm send card by mail
|
// Confirm send card by mail
|
||||||
if ($action == 'sendinfo')
|
if ($action == 'sendinfo')
|
||||||
{
|
{
|
||||||
$ret=$form->form_confirm("fiche.php?rowid=$rowid",$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail",$object->email),"confirm_sendinfo",'',0,1);
|
print $form->formconfirm("fiche.php?rowid=".$rowid,$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail",$object->email),"confirm_sendinfo",'',0,1);
|
||||||
if ($ret == 'html') print '<br>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirm resiliate
|
// Confirm resiliate
|
||||||
@ -1536,7 +1537,10 @@ if ($rowid && $action != 'edit')
|
|||||||
// Action SPIP
|
// Action SPIP
|
||||||
if ($conf->mailmanspip->enabled && $conf->global->ADHERENT_USE_SPIP)
|
if ($conf->mailmanspip->enabled && $conf->global->ADHERENT_USE_SPIP)
|
||||||
{
|
{
|
||||||
$isinspip=$object->is_in_spip();
|
include_once(DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php');
|
||||||
|
$mailmanspip=new MailmanSpip($db);
|
||||||
|
|
||||||
|
$isinspip=$mailmanspip->is_in_spip($object);
|
||||||
if ($isinspip == 1)
|
if ($isinspip == 1)
|
||||||
{
|
{
|
||||||
print "<a class=\"butAction\" href=\"fiche.php?rowid=$object->id&action=del_spip\">".$langs->trans("DeleteIntoSpip")."</a>\n";
|
print "<a class=\"butAction\" href=\"fiche.php?rowid=$object->id&action=del_spip\">".$langs->trans("DeleteIntoSpip")."</a>\n";
|
||||||
|
|||||||
@ -9,7 +9,6 @@
|
|||||||
// START - Lines generated via autotranslator.php tool.
|
// START - Lines generated via autotranslator.php tool.
|
||||||
// Reference language: en_US
|
// Reference language: en_US
|
||||||
CHARSET=UTF-8
|
CHARSET=UTF-8
|
||||||
ErrorBadEMail=البريد الإلكتروني ل ٪ من الخطأ
|
|
||||||
ErrorCompanyNameAlreadyExists=اسم الشركة ل ٪ موجود بالفعل. اختيار آخر.
|
ErrorCompanyNameAlreadyExists=اسم الشركة ل ٪ موجود بالفعل. اختيار آخر.
|
||||||
ErrorPrefixAlreadyExists=بادئة ٪ ق موجود بالفعل. اختيار آخر.
|
ErrorPrefixAlreadyExists=بادئة ٪ ق موجود بالفعل. اختيار آخر.
|
||||||
ErrorSetACountryFirst=المجموعة الأولى في البلد
|
ErrorSetACountryFirst=المجموعة الأولى في البلد
|
||||||
|
|||||||
@ -11,7 +11,6 @@
|
|||||||
// START - Lines generated via autotranslator.php tool.
|
// START - Lines generated via autotranslator.php tool.
|
||||||
// Reference language: en_US
|
// Reference language: en_US
|
||||||
CHARSET=UTF-8
|
CHARSET=UTF-8
|
||||||
ErrorBadEMail=E-Mail %s er forkert
|
|
||||||
ErrorCompanyNameAlreadyExists=Firmanavn %s eksisterer allerede. Vælg en anden.
|
ErrorCompanyNameAlreadyExists=Firmanavn %s eksisterer allerede. Vælg en anden.
|
||||||
ErrorPrefixAlreadyExists=Prefix %s eksisterer allerede. Vælg en anden.
|
ErrorPrefixAlreadyExists=Prefix %s eksisterer allerede. Vælg en anden.
|
||||||
ErrorSetACountryFirst=Indstil land første
|
ErrorSetACountryFirst=Indstil land første
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
|
|
||||||
CHARSET=UTF-8
|
CHARSET=UTF-8
|
||||||
ErrorBadEMail=Email-Adresse %s ist ungültig
|
|
||||||
ErrorCompanyNameAlreadyExists=Firmenname %s bereits vorhanden. Bitte wählen Sie einen anderen.
|
ErrorCompanyNameAlreadyExists=Firmenname %s bereits vorhanden. Bitte wählen Sie einen anderen.
|
||||||
ErrorPrefixAlreadyExists=Präfix %s bereits vorhanden. Bitte wählen Sie einen anderen.
|
ErrorPrefixAlreadyExists=Präfix %s bereits vorhanden. Bitte wählen Sie einen anderen.
|
||||||
ErrorSetACountryFirst=Wählen sie zuerst das Land
|
ErrorSetACountryFirst=Wählen sie zuerst das Land
|
||||||
|
|||||||
8
htdocs/langs/en_US/mailmanspip.lang
Normal file
8
htdocs/langs/en_US/mailmanspip.lang
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Dolibarr language file - fr_FR - mailmanspip
|
||||||
|
CHARSET=UTF-8
|
||||||
|
TestSubscribe=Pour tester l'inscription aux listes mailman
|
||||||
|
TestUnSubscribe=Pour tester la désincritpion aux listes mailman
|
||||||
|
MailmanCreationSuccess=Appel de l'url de création dans mailman avec succès
|
||||||
|
MailmanCreationSuccess=Appel de l'url de suppression de mailman avec succès
|
||||||
|
SynchroMailManEnabled=Une alimentation de Mailman sera réalisée
|
||||||
|
SynchroSpipEnabled=Une alimentation de Spip sera réalisée
|
||||||
@ -9,7 +9,6 @@
|
|||||||
// START - Lines generated via autotranslator.php tool.
|
// START - Lines generated via autotranslator.php tool.
|
||||||
// Reference language: en_US
|
// Reference language: en_US
|
||||||
CHARSET=UTF-8
|
CHARSET=UTF-8
|
||||||
ErrorBadEMail=البريد الإلكتروني ل ٪ من الخطأ
|
|
||||||
ErrorCompanyNameAlreadyExists=اسم الشركة ل ٪ موجود بالفعل. اختيار آخر.
|
ErrorCompanyNameAlreadyExists=اسم الشركة ل ٪ موجود بالفعل. اختيار آخر.
|
||||||
ErrorPrefixAlreadyExists=بادئة ٪ ق موجود بالفعل. اختيار آخر.
|
ErrorPrefixAlreadyExists=بادئة ٪ ق موجود بالفعل. اختيار آخر.
|
||||||
ErrorSetACountryFirst=المجموعة الأولى في البلد
|
ErrorSetACountryFirst=المجموعة الأولى في البلد
|
||||||
|
|||||||
@ -9,7 +9,6 @@
|
|||||||
// START - Lines generated via autotranslator.php tool.
|
// START - Lines generated via autotranslator.php tool.
|
||||||
// Reference language: en_US
|
// Reference language: en_US
|
||||||
CHARSET=UTF-8
|
CHARSET=UTF-8
|
||||||
ErrorBadEMail=EMail %s on väärä
|
|
||||||
ErrorCompanyNameAlreadyExists=Yrityksen nimi %s on jo olemassa. Valitse toinen.
|
ErrorCompanyNameAlreadyExists=Yrityksen nimi %s on jo olemassa. Valitse toinen.
|
||||||
ErrorPrefixAlreadyExists=Etunumero %s on jo olemassa. Valitse toinen.
|
ErrorPrefixAlreadyExists=Etunumero %s on jo olemassa. Valitse toinen.
|
||||||
ErrorSetACountryFirst=Aseta ensin maa
|
ErrorSetACountryFirst=Aseta ensin maa
|
||||||
|
|||||||
8
htdocs/langs/fr_FR/mailmanspip.lang
Normal file
8
htdocs/langs/fr_FR/mailmanspip.lang
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Dolibarr language file - fr_FR - mailmanspip
|
||||||
|
CHARSET=UTF-8
|
||||||
|
TestSubscribe=Pour tester l'inscription aux listes mailman
|
||||||
|
TestUnSubscribe=Pour tester la désincritpion aux listes mailman
|
||||||
|
MailmanCreationSuccess=Appel de l'url de création dans mailman avec succès
|
||||||
|
MailmanCreationSuccess=Appel de l'url de suppression de mailman avec succès
|
||||||
|
SynchroMailManEnabled=Une alimentation de Mailman sera réalisée
|
||||||
|
SynchroSpipEnabled=Une alimentation de Spip sera réalisée
|
||||||
@ -86,7 +86,6 @@ DolibarrLogin =Dolibarr login
|
|||||||
EditCompany =Modifica società
|
EditCompany =Modifica società
|
||||||
EditContact =Modifica contatto/indirizzo
|
EditContact =Modifica contatto/indirizzo
|
||||||
EditDeliveryAddress =Modifica indirizzo di consegna
|
EditDeliveryAddress =Modifica indirizzo di consegna
|
||||||
ErrorBadEMail =L'email %s è sbagliata
|
|
||||||
ErrorCompanyNameAlreadyExists =Il nome %s esiste già. Scegline un altro.
|
ErrorCompanyNameAlreadyExists =Il nome %s esiste già. Scegline un altro.
|
||||||
ErrorPrefixAlreadyExists =Prefisso %s già esistente. Scegline un altro.
|
ErrorPrefixAlreadyExists =Prefisso %s già esistente. Scegline un altro.
|
||||||
ErrorSetACountryFirst =Impostare prima il paese
|
ErrorSetACountryFirst =Impostare prima il paese
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
# Dolibarr language file - no_NB - companies
|
# Dolibarr language file - no_NB - companies
|
||||||
CHARSET=UTF-8
|
CHARSET=UTF-8
|
||||||
ErrorBadEMail=E-post %s er feil
|
|
||||||
ErrorCompanyNameAlreadyExists=Firmanavnet %s finnes allerede. Velg et annet!
|
ErrorCompanyNameAlreadyExists=Firmanavnet %s finnes allerede. Velg et annet!
|
||||||
ErrorPrefixAlreadyExists=Prefix %s finnes allered. Velg et annet!
|
ErrorPrefixAlreadyExists=Prefix %s finnes allered. Velg et annet!
|
||||||
ErrorSetACountryFirst=Angi land først
|
ErrorSetACountryFirst=Angi land først
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
# Dolibarr language file - nl_BE - companies
|
# Dolibarr language file - nl_BE - companies
|
||||||
CHARSET=UTF-8
|
CHARSET=UTF-8
|
||||||
ErrorBadEMail=EMail %s is verkeerd
|
|
||||||
ErrorCompanyNameAlreadyExists=Bedrijfsnaam %s bestaat reeds. Kies een andere naam.
|
ErrorCompanyNameAlreadyExists=Bedrijfsnaam %s bestaat reeds. Kies een andere naam.
|
||||||
ErrorPrefixAlreadyExists=Prefix %s bestaat reeds. Kies een ander prefix.
|
ErrorPrefixAlreadyExists=Prefix %s bestaat reeds. Kies een ander prefix.
|
||||||
ErrorSetACountryFirst=Kies het land eerst
|
ErrorSetACountryFirst=Kies het land eerst
|
||||||
|
|||||||
@ -11,7 +11,6 @@
|
|||||||
// START - Lines generated via autotranslator.php tool.
|
// START - Lines generated via autotranslator.php tool.
|
||||||
// Reference language: en_US
|
// Reference language: en_US
|
||||||
CHARSET=UTF-8
|
CHARSET=UTF-8
|
||||||
ErrorBadEMail=EMail %s jest błędna
|
|
||||||
ErrorCompanyNameAlreadyExists=Nazwa firmy %s już istnieje. Wybierz inną.
|
ErrorCompanyNameAlreadyExists=Nazwa firmy %s już istnieje. Wybierz inną.
|
||||||
ErrorPrefixAlreadyExists=Prefiks %s już istnieje. Wybierz inną.
|
ErrorPrefixAlreadyExists=Prefiks %s już istnieje. Wybierz inną.
|
||||||
ErrorSetACountryFirst=Ustaw kraj pierwszy
|
ErrorSetACountryFirst=Ustaw kraj pierwszy
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
# Dolibarr language file - pt_BR rev. 0.0 - companies
|
# Dolibarr language file - pt_BR rev. 0.0 - companies
|
||||||
CHARSET=UTF-8
|
CHARSET=UTF-8
|
||||||
ErrorBadEMail=e-mail %s não está correto
|
|
||||||
ErrorCompanyNameAlreadyExists=o Nome da emprea %s já existe. Indique outro.
|
ErrorCompanyNameAlreadyExists=o Nome da emprea %s já existe. Indique outro.
|
||||||
ErrorPrefixAlreadyExists=o Prefixooo %s já existe. Indique outro.
|
ErrorPrefixAlreadyExists=o Prefixooo %s já existe. Indique outro.
|
||||||
ErrorSetACountryFirst=Defina em primeiro localização o país
|
ErrorSetACountryFirst=Defina em primeiro localização o país
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
# Dolibarr language file - pt_PT - companies
|
# Dolibarr language file - pt_PT - companies
|
||||||
CHARSET=UTF-8
|
CHARSET=UTF-8
|
||||||
ErrorBadEMail=e-mail %s não está correcto
|
|
||||||
ErrorCompanyNameAlreadyExists=o Nome da emprea %s já existe. Indique outro.
|
ErrorCompanyNameAlreadyExists=o Nome da emprea %s já existe. Indique outro.
|
||||||
ErrorPrefixAlreadyExists=o Prefixo %s já existe. Indique outro.
|
ErrorPrefixAlreadyExists=o Prefixo %s já existe. Indique outro.
|
||||||
ErrorSetACountryFirst=Defina em primeiro localização o país
|
ErrorSetACountryFirst=Defina em primeiro localização o país
|
||||||
|
|||||||
@ -9,7 +9,6 @@
|
|||||||
// START - Lines generated via autotranslator.php tool.
|
// START - Lines generated via autotranslator.php tool.
|
||||||
// Reference language: en_US
|
// Reference language: en_US
|
||||||
CHARSET=UTF-8
|
CHARSET=UTF-8
|
||||||
ErrorBadEMail=Email %s este greşit
|
|
||||||
ErrorCompanyNameAlreadyExists=Numele companiei %s există deja. Alegeţi un altul.
|
ErrorCompanyNameAlreadyExists=Numele companiei %s există deja. Alegeţi un altul.
|
||||||
ErrorPrefixAlreadyExists=Prefix %s există deja. Alegeţi un altul.
|
ErrorPrefixAlreadyExists=Prefix %s există deja. Alegeţi un altul.
|
||||||
ErrorSetACountryFirst=Setaţi prima ţară
|
ErrorSetACountryFirst=Setaţi prima ţară
|
||||||
|
|||||||
@ -9,7 +9,6 @@
|
|||||||
// START - Lines generated via autotranslator.php tool.
|
// START - Lines generated via autotranslator.php tool.
|
||||||
// Reference language: en_US
|
// Reference language: en_US
|
||||||
CHARSET=UTF-8
|
CHARSET=UTF-8
|
||||||
ErrorBadEMail=EMail %s неверен
|
|
||||||
ErrorCompanyNameAlreadyExists=Название компании %s уже существует. Выберите другое.
|
ErrorCompanyNameAlreadyExists=Название компании %s уже существует. Выберите другое.
|
||||||
ErrorPrefixAlreadyExists=Префикс %s уже существует. Выберите другой.
|
ErrorPrefixAlreadyExists=Префикс %s уже существует. Выберите другой.
|
||||||
ErrorSetACountryFirst=Сначала установите страну
|
ErrorSetACountryFirst=Сначала установите страну
|
||||||
|
|||||||
@ -8,7 +8,6 @@
|
|||||||
// START - Lines generated via autotranslator.php tool (2010-03-15 19:05:26).
|
// START - Lines generated via autotranslator.php tool (2010-03-15 19:05:26).
|
||||||
// Reference language: en_US
|
// Reference language: en_US
|
||||||
CHARSET=UTF-8
|
CHARSET=UTF-8
|
||||||
ErrorBadEMail=Yanlış EPosta: %s
|
|
||||||
ErrorBadUrl=Yanlış Url: %s
|
ErrorBadUrl=Yanlış Url: %s
|
||||||
ErrorCompanyNameAlreadyExists=Zaten Firma adı% var. Başka bir tane seçin.
|
ErrorCompanyNameAlreadyExists=Zaten Firma adı% var. Başka bir tane seçin.
|
||||||
ErrorPrefixAlreadyExists=Önek% s zaten var. Başka bir tane seçin.
|
ErrorPrefixAlreadyExists=Önek% s zaten var. Başka bir tane seçin.
|
||||||
|
|||||||
358
htdocs/mailmanspip/class/mailmanspip.class.php
Normal file
358
htdocs/mailmanspip/class/mailmanspip.class.php
Normal file
@ -0,0 +1,358 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
|
* Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/mailmanspip/class/mailmanspip.class.php
|
||||||
|
* \ingroup member
|
||||||
|
* \brief File of class to manage members of a foundation
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to manage mailman and spip
|
||||||
|
*/
|
||||||
|
class MailmanSpip
|
||||||
|
{
|
||||||
|
var $db;
|
||||||
|
var $error;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
*/
|
||||||
|
function __construct($db)
|
||||||
|
{
|
||||||
|
$this->db = $db;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fonction qui donne les droits redacteurs dans spip
|
||||||
|
*
|
||||||
|
* @param Object $object Object with data (->firstname, ->lastname, ->email and ->login)
|
||||||
|
* @return int =0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function add_to_spip($object)
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::add_to_spip");
|
||||||
|
|
||||||
|
if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 &&
|
||||||
|
defined('ADHERENT_SPIP_SERVEUR') && ADHERENT_SPIP_SERVEUR != '' &&
|
||||||
|
defined('ADHERENT_SPIP_USER') && ADHERENT_SPIP_USER != '' &&
|
||||||
|
defined('ADHERENT_SPIP_PASS') && ADHERENT_SPIP_PASS != '' &&
|
||||||
|
defined('ADHERENT_SPIP_DB') && ADHERENT_SPIP_DB != ''
|
||||||
|
)
|
||||||
|
{
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/security2.lib.php");
|
||||||
|
$mdpass=dol_hash($object->pass);
|
||||||
|
$htpass=crypt($object->pass,makesalt());
|
||||||
|
$query = "INSERT INTO spip_auteurs (nom, email, login, pass, htpass, alea_futur, statut) VALUES(\"".$object->firstname." ".$object->lastname."\",\"".$object->email."\",\"".$object->login."\",\"$mdpass\",\"$htpass\",FLOOR(32000*RAND()),\"1comite\")";
|
||||||
|
|
||||||
|
$mydb=getDoliDBInstance('mysql',ADHERENT_SPIP_SERVEUR,ADHERENT_SPIP_USER,ADHERENT_SPIP_PASS,ADHERENT_SPIP_DB,ADHERENT_SPIP_PORT);
|
||||||
|
|
||||||
|
if (! $mydb->ok)
|
||||||
|
{
|
||||||
|
$this->error=$mydb->lasterror();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $mydb->query($query);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$mydb->close();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$mydb->lasterror();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fonction qui enleve les droits redacteurs dans spip
|
||||||
|
*
|
||||||
|
* @param Object $object Object with data (->login)
|
||||||
|
* @return int =0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function del_to_spip($object)
|
||||||
|
{
|
||||||
|
if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 &&
|
||||||
|
defined('ADHERENT_SPIP_SERVEUR') && ADHERENT_SPIP_SERVEUR != '' &&
|
||||||
|
defined('ADHERENT_SPIP_USER') && ADHERENT_SPIP_USER != '' &&
|
||||||
|
defined('ADHERENT_SPIP_PASS') && ADHERENT_SPIP_PASS != '' &&
|
||||||
|
defined('ADHERENT_SPIP_DB') && ADHERENT_SPIP_DB != ''
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$query = "DELETE FROM spip_auteurs WHERE login='".$object->login."'";
|
||||||
|
|
||||||
|
$mydb=getDoliDBInstance('mysql',ADHERENT_SPIP_SERVEUR,ADHERENT_SPIP_USER,ADHERENT_SPIP_PASS,ADHERENT_SPIP_DB,ADHERENT_SPIP_PORT);
|
||||||
|
|
||||||
|
$result = $mydb->query($query);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$mydb->close();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$mydb->lasterror();
|
||||||
|
$mydb->close();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fonction qui dit si cet utilisateur est un redacteur existant dans spip
|
||||||
|
*
|
||||||
|
* @param Object $object Object with data (->login)
|
||||||
|
* @return int 1=exists, 0=does not exists, -1=error
|
||||||
|
*/
|
||||||
|
function is_in_spip($object)
|
||||||
|
{
|
||||||
|
if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 &&
|
||||||
|
defined('ADHERENT_SPIP_SERVEUR') && ADHERENT_SPIP_SERVEUR != '' &&
|
||||||
|
defined('ADHERENT_SPIP_USER') && ADHERENT_SPIP_USER != '' &&
|
||||||
|
defined('ADHERENT_SPIP_PASS') && ADHERENT_SPIP_PASS != '' &&
|
||||||
|
defined('ADHERENT_SPIP_DB') && ADHERENT_SPIP_DB != '')
|
||||||
|
{
|
||||||
|
$query = "SELECT login FROM spip_auteurs WHERE login='".$object->login."'";
|
||||||
|
|
||||||
|
$mydb=getDoliDBInstance('mysql',ADHERENT_SPIP_SERVEUR,ADHERENT_SPIP_USER,ADHERENT_SPIP_PASS,ADHERENT_SPIP_DB,ADHERENT_SPIP_PORT);
|
||||||
|
|
||||||
|
if ($mydb->ok)
|
||||||
|
{
|
||||||
|
$result = $mydb->query($query);
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
if ($mydb->num_rows($result))
|
||||||
|
{
|
||||||
|
// nous avons au moins une reponse
|
||||||
|
$mydb->close($result);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// nous n'avons pas de reponse => n'existe pas
|
||||||
|
$mydb->close($result);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$mydb->lasterror();
|
||||||
|
$mydb->close();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error="Failed to connect ".ADHERENT_SPIP_SERVEUR." ".ADHERENT_SPIP_USER." ".ADHERENT_SPIP_PASS." ".ADHERENT_SPIP_DB;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscribe an email to all mailing-lists
|
||||||
|
*
|
||||||
|
* @param Object $object Object with data (->email, ->pass, ->element, ->type)
|
||||||
|
* @param array $listes To force mailing-list (string separated with ,)
|
||||||
|
* @return int <0 if KO, >=0 if OK
|
||||||
|
*/
|
||||||
|
function add_to_mailman($object,$listes='')
|
||||||
|
{
|
||||||
|
global $conf,$langs,$user;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::add_to_mailman");
|
||||||
|
|
||||||
|
if (! function_exists("curl_init"))
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans("ErrorFunctionNotAvailableInPHP","curl_init");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($conf->global->ADHERENT_MAILMAN_URL))
|
||||||
|
{
|
||||||
|
if ($listes == '' && ! empty($conf->global->ADHERENT_MAILMAN_LISTS))
|
||||||
|
{
|
||||||
|
$lists=explode(',',$conf->global->ADHERENT_MAILMAN_LISTS);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$lists=explode(',',$listes);
|
||||||
|
}
|
||||||
|
foreach ($lists as $list)
|
||||||
|
{
|
||||||
|
// Filter on type something (ADHERENT_MAILMAN_LISTS = "filtervalue:mailinglist1,filtervalue2:mailinglist2,mailinglist3")
|
||||||
|
$tmp=explode(':',$list);
|
||||||
|
if (! empty($tmp[1]))
|
||||||
|
{
|
||||||
|
$list=$tmp[1];
|
||||||
|
if ($object->element == 'member' && $object->type != $tmp[0]) // Filter on member type label
|
||||||
|
{
|
||||||
|
dol_syslog("We ignore list ".$list." because object member type ".$object->type." does not match ".$tmp[0], LOG_DEBUG);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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,
|
||||||
|
$object->email,
|
||||||
|
$object->pass,
|
||||||
|
$conf->global->ADHERENT_MAILMAN_ADMINPW
|
||||||
|
);
|
||||||
|
$curl_url = preg_replace($patterns, $replace, $conf->global->ADHERENT_MAILMAN_URL);
|
||||||
|
|
||||||
|
dol_syslog("Call URL to subscribe : ".$curl_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, true);
|
||||||
|
curl_setopt($ch, CURLOPT_FAILONERROR, true);
|
||||||
|
@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
|
||||||
|
$result=curl_exec($ch);
|
||||||
|
dol_syslog('result curl_exec='.$result);
|
||||||
|
//--- End buffering and clean output
|
||||||
|
if ($result === false || curl_errno($ch) > 0)
|
||||||
|
{
|
||||||
|
// error
|
||||||
|
$this->error=curl_errno($ch).' '.curl_error($ch);
|
||||||
|
dol_syslog('Error using curl '.$this->error, LOG_ERR);
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
curl_close($ch);
|
||||||
|
}
|
||||||
|
return count($lists);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error="ADHERENT_MAILMAN_URL not defined";
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unsubscribe an email from all mailing-lists
|
||||||
|
* Used when a user is resiliated
|
||||||
|
*
|
||||||
|
* @param Object $object Object with data (->email, ->pass, ->element, ->type)
|
||||||
|
* @param array $listes To force mailing-list (string separated with ,)
|
||||||
|
* @return int <0 if KO, >=0 if OK
|
||||||
|
*/
|
||||||
|
function del_to_mailman($object,$listes='')
|
||||||
|
{
|
||||||
|
global $conf,$langs,$user;
|
||||||
|
|
||||||
|
if (! empty($conf->global->ADHERENT_MAILMAN_UNSUB_URL))
|
||||||
|
{
|
||||||
|
if ($listes=='' && ! empty($conf->global->ADHERENT_MAILMAN_LISTS))
|
||||||
|
{
|
||||||
|
$lists=explode(',',$conf->global->ADHERENT_MAILMAN_LISTS);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$lists=explode(',',$listes);
|
||||||
|
}
|
||||||
|
foreach ($lists as $list)
|
||||||
|
{
|
||||||
|
// Filter on type something (ADHERENT_MAILMAN_LISTS = "filtervalue:mailinglist1,filtervalue2:mailinglist2,mailinglist3")
|
||||||
|
$tmp=explode(':',$list);
|
||||||
|
if (! empty($tmp[1]))
|
||||||
|
{
|
||||||
|
if ($object->element == 'member' && $object->type != $tmp[1]) // Filter on member type label
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 (
|
||||||
|
trim($list),
|
||||||
|
$object->email,
|
||||||
|
$object->pass,
|
||||||
|
$conf->global->ADHERENT_MAILMAN_ADMINPW
|
||||||
|
);
|
||||||
|
$curl_url = preg_replace($patterns, $replace, $conf->global->ADHERENT_MAILMAN_UNSUB_URL);
|
||||||
|
|
||||||
|
dol_syslog("Call URL to unsubscribe : ".$curl_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
|
||||||
|
$result=curl_exec($ch);
|
||||||
|
dol_syslog($result);
|
||||||
|
//--- End buffering and clean output
|
||||||
|
if ($result === false || curl_errno($ch) > 0)
|
||||||
|
{
|
||||||
|
$this->error=curl_errno($ch).' '.curl_error($ch);
|
||||||
|
dol_syslog('Error using curl '.$this->error, LOG_ERR);
|
||||||
|
// error
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
curl_close($ch);
|
||||||
|
}
|
||||||
|
return count($lists);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error="ADHERENT_MAILMAN_UNSUB_URL not defined";
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
Loading…
Reference in New Issue
Block a user