* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: step4.php,v 1.1 2004-09-06 09:58:59 x2000habouzit Exp $
+ $Id: step4.php,v 1.2 2004-10-10 13:51:13 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
}
- /****************** inscription à la liste promo ****************/
-// $inspromo = inscription_liste_promo($uid,$promo);
- /****************** inscription à la newsletter ****************/
-// $insnewsletter = inscription_newsletter($uid);
- /****************** inscription à la newsletter ****************/
-// $insforumpromo = inscription_forum_promo($uid,$promo);
- /****************** inscription à la newsletter ****************/
-// $insforums = inscription_forums($uid);
+ /****************** inscription à la liste promo +nl ****************/
+ $inspromo = inscription_listes_base($uid,$password,$promo);
+ /****************** inscription aux forums de base ****************/
+ $insforumpromo = inscription_forum_promo($uid,$promo);
+ $insforums = inscription_forums($uid);
// effacer la pré-inscription devenue
$globals->db->query("update en_cours set loginbis='INSCRIT' WHERE username='$forlife'");
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: index.php,v 1.6 2004-09-25 16:30:25 x2000habouzit Exp $
+ $Id: index.php,v 1.7 2004-10-10 13:51:15 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
$client->subscribe('polytechnique.org',"promo$promo");
}
}
+if(!empty($_GET['nl_unsub'])) $client->unsubscribe_nl();
+if(!empty($_GET['nl_sub'])) $client->subscribe_nl();
$listes = $client->get_lists('polytechnique.org');
+$nl = $client->get_nl_state();
$page->assign_by_ref('listes',$listes);
+$page->assign('nl',$nl);
$page->run();
?>
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: inscription_listes_base.inc.php,v 1.2 2004-08-31 11:16:48 x2000habouzit Exp $
+ $Id: inscription_listes_base.inc.php,v 1.3 2004-10-10 13:51:17 x2000habouzit Exp $
***************************************************************************/
-
-
+include('xml-rpc-client.inc.php');
/** inscrit l'uid donnée à la promo
* @param $uid UID
* @see admin/RegisterNewUser.php
* @see step4.php
*/
-function inscription_liste_promo($uid,$promo) {
+function inscription_listes_base($uid,$pass,$promo) {
global $globals;
// récupération de l'id de la liste promo
- $result=$globals->db->query("select id from aliases where alias = 'promo$promo' and type = 'liste'");
- if (!list($Lid)=mysql_fetch_row($result)) { // pas de liste promo, il faut la créer
- $mymail = new TplMailer('listes.promo.tpl');
- $mymail->assign('promo', $promo);
- $mymail->send();
- $Lid=false;
- }
- mysql_free_result($result);
- if ($Lid) {
- $globals->db->query("insert into listes_ins set idl=$Lid, idu=$uid");
- $res = !($globals->db->err());
- } else $res = false;
- return $res;
-}
-
-
-
-/** inscription à la newsletter
- * @param $uid UID
- * @return reponse MySQL
- * @see admin/RegisterNewUser.php
- * @see step4.php
- */
-function inscription_newsletter($uid) {
- global $globals;
- $result=$globals->db->query("select id from aliases where alias = 'newsletter' and type = 'liste'");
- if (list($Lid)=mysql_fetch_row($result)) {
- $globals->db->query("insert into listes_ins set idl=$Lid, idu=$uid");
- $res = !($globals->db->err());
- } else $res = false;
- mysql_free_result($result);
- return $res;
+ $client = new xmlrpc_client("http://$uid:$pass@localhost:4949");
+ $client->subscribe('polytechnique.org',"promo$promo");
+ $client->subscribe_nl();
}
?>
#* Foundation, Inc., *
#* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
#***************************************************************************
-# $Id: mailman-rpc.py,v 1.52 2004-10-10 08:47:47 x2000habouzit Exp $
+# $Id: mailman-rpc.py,v 1.53 2004-10-10 13:51:20 x2000habouzit Exp $
#***************************************************************************
import base64, MySQLdb, os, getopt, sys, MySQLdb.converters, sha
names.sort()
result = []
for name in names:
- if not name.startswith(prefix):
+ if not name.startswith(prefix) or name == mm_cfg.MAIN_NEWSLETTER:
continue
try:
mlist = MailList.MailList(name,lock=0)
mlist.Unlock()
return 0
+def subscribe_nl((userdesc,perms)):
+ try:
+ mlist = MailList.MailList(mm_cfg.MAIN_NEWSLETTER)
+ except:
+ return 0
+ try:
+ mlist.ApprovedAddMember(userdesc)
+ mlist.Save()
+ mlist.Unlock()
+ return 1
+ except:
+ mlist.Unlock()
+ return 0
+
+def unsubscribe_nl((userdesc,perms)):
+ try:
+ mlist = MailList.MailList(mm_cfg.MAIN_NEWSLETTER)
+ except:
+ return 0
+ try:
+ mlist.ApprovedDeleteMember(userdesc.address)
+ mlist.Save()
+ mlist.Unlock()
+ return 1
+ except:
+ mlist.Unlock()
+ return 0
+
+def get_nl_state((userdesc,perms)):
+ try:
+ mlist = MailList.MailList(mm_cfg.MAIN_NEWSLETTER,lock=0)
+ except:
+ return 0
+ try:
+ return ( userdesc.address in mlist.getRegularMemberKeys() )
+ except:
+ return 0
+
+
#-------------------------------------------------------------------------------
# users procedures for [ index.php ]
#
server.register_function(get_lists)
server.register_function(subscribe)
server.register_function(unsubscribe)
+server.register_function(subscribe_nl)
+server.register_function(unsubscribe_nl)
+server.register_function(get_nl_state)
# members.php
server.register_function(get_members)
# trombi.php
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: index.tpl,v 1.11 2004-10-09 12:49:38 x2000habouzit Exp $
+ $Id: index.tpl,v 1.12 2004-10-10 13:51:22 x2000habouzit Exp $
***************************************************************************}
<div class="rubrique">
{dynamic}
<div class="rubrique">
+ Lettre mensuelle de Polytechnique.org
+</div>
+
+{if $nl}
+<p>
+Tu es actuellement inscrit à la lettre mensuelle de Polytechnique.org !
+</p>
+<p>
+Pour te désinscrire suis le lien :
+</p>
+<div class='center'>
+ [<a href='?nl_unsub=1'>me désinscrire</a>]
+</div>
+{else}
+<p>
+Tu n'es actuellement pas inscrit à la lettre mensuelle de Polytechnique.org.
+</p>
+<p>
+Pour t'y abonner suis le lien :
+</p>
+<div class='center'>
+ [<a href='?nl_sub=1'>m'inscrire</a>]
+</div>
+{/if}
+
+<div class="rubrique">
Listes de diffusion publiques
</div>