* Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011 Juanjo Menent * * 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 3 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 . */ /** * \file htdocs/admin/mailman.php * \ingroup mailmanspip * \brief Page to setup the module MailmanSpip (Mailman) */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/mailmanspip.lib.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $langs->load("admin"); $langs->load("members"); $langs->load("mailmanspip"); if (! $user->admin) accessforbidden(); $type=array('yesno','texte','chaine'); $action = GETPOST("action"); $testsubscribeemail = GETPOST("testsubscribeemail"); $testunsubscribeemail = GETPOST("testunsubscribeemail"); /* * Actions */ // Action mise a jour ou ajout d'une constante if ($action == 'update' || $action == 'add') { foreach($_POST['constname'] as $key => $val) { $constname=$_POST["constname"][$key]; $constvalue=$_POST["constvalue"][$key]; $consttype=$_POST["consttype"][$key]; $constnote=$_POST["constnote"][$key]; $res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity); if (! $res > 0) $error++; } if (! $error) { $mesg = '
'.$langs->trans("SetupSaved").'
'; } else { $mesg = '
'.$langs->trans("Error").'
'; } } // Action activation d'un sous module du module adherent if ($action == 'set') { $result=dolibarr_set_const($db, $_GET["name"], $_GET["value"], '', 0, '', $conf->entity); if ($result < 0) { dol_print_error($db); } } // Action desactivation d'un sous module du module adherent if ($action == 'unset') { $result=dolibarr_del_const($db, $_GET["name"], $conf->entity); if ($result < 0) { 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='
'.$langs->trans("ErrorBadEMail",$email).'
'; } 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='
'.$mailmanspip->error.'
'; } else { $mesg='MailmanCreationSuccess'; } } if ($action == 'testunsubscribe') { $result=$mailmanspip->del_to_mailman($object); if ($result < 0) { $error++; $mesg='
'.$mailmanspip->error.'
'; } else { $mesg='MailmanDeletionSuccess'; } } } } /* * View */ $help_url=''; llxHeader('',$langs->trans("MailmanSpipSetup"),$help_url); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'setup'); $head = mailmanspip_admin_prepare_head(); dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user'); dol_htmloutput_mesg($mesg); $var=!$var; if (! empty($conf->global->ADHERENT_USE_MAILMAN)) { //$lien=img_picto($langs->trans("Active"),'tick').' '; $lien=''; //$lien.=$langs->trans("Disable"); $lien.=img_picto($langs->trans("Activated"),'switch_on'); $lien.=''; // Edition des varibales globales $constantes=array( 'ADHERENT_MAILMAN_ADMINPW', 'ADHERENT_MAILMAN_URL', 'ADHERENT_MAILMAN_UNSUB_URL', 'ADHERENT_MAILMAN_LISTS' ); print_fiche_titre($langs->trans('MailmanTitle'), $lien,''); print '
'; // JQuery activity print ''; form_constantes($constantes,1); print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'
'; print '%LISTE%, %MAILMAN_ADMINPW%, %EMAIL%
'; } else { $lien=''; //$lien.=img_$langs->trans("Activate") $lien.=img_picto($langs->trans("Disabled"),'switch_off'); $lien.=''; print_fiche_titre($langs->trans('MailmanTitle'), $lien,''); } dol_fiche_end(); if (! empty($conf->global->ADHERENT_USE_MAILMAN)) { print '
'; print ''; print $langs->trans("TestSubscribe").'
'; print $langs->trans("EMail").'
'; print '
'; print '
'; print ''; print $langs->trans("TestUnSubscribe").'
'; print $langs->trans("EMail").'
'; print '
'; } llxFooter(); $db->close(); ?>