Commit | Line | Data |
---|---|---|
ee68ddc1 | 1 | #!/usr/bin/php5 -q |
dee55344 | 2 | <?php |
08d7cc45 | 3 | |
50e2ba89 | 4 | require_once dirname(__FILE__) . '/connect.db.inc.php'; |
dee55344 | 5 | |
032b244e SJ |
6 | global $globals; |
7 | ||
dee55344 | 8 | $opt = getopt('p:o:h'); |
9 | ||
10 | if(empty($opt['p']) || empty($opt['o']) || isset($opt['h'])) { | |
11 | echo <<<EOF | |
12 | usage: lists.create_promo.php -p promo -o owner | |
13 | create mailing list for promo "promo" with initial owner "owner" | |
14 | ||
15 | EOF; | |
16 | exit; | |
17 | } | |
18 | ||
5daf68f6 | 19 | // Retrieves list parameters. |
dee55344 | 20 | $promo = intval($opt['p']); |
21 | $owner = $opt['o']; | |
22 | ||
5daf68f6 VZ |
23 | $owner_user = User::getSilent($owner); |
24 | if (!$owner_user) { | |
25 | echo "Supplied owner is not valid, aborting.\n"; | |
b6b26381 | 26 | exit(1); |
5daf68f6 VZ |
27 | } |
28 | ||
29 | // Creates the list. | |
72861a04 | 30 | $req = new ListeReq($owner_user, false, "promo", $promo . '.' . $globals->mail->domain, "Liste de la promotion $promo", |
4d4c2cdf | 31 | 1 /*private*/, 2 /*moderate*/, 0 /*free subscription*/, |
32 | array($owner), array()); | |
dee55344 | 33 | $req->submit(); |
448c8cdc | 34 | // vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8: |
dee55344 | 35 | ?> |