require_once("xorg.inc.php");
require_once('validations.inc.php');
+global $globals;
+
$opt = getopt('p:o:h');
if(empty($opt['p']) || empty($opt['o']) || isset($opt['h'])) {
$promo = intval($opt['p']);
$owner = $opt['o'];
-$req = new ListeReq(0, false, "promo$promo", "polytechnique.org", "Liste de la promotion $promo",
+$req = new ListeReq(0, false, "promo$promo", $globals->mail->domain, "Liste de la promotion $promo",
1 /*private*/, 2 /*moderate*/, 0 /*free subscription*/,
array($owner), array());
$req->submit();
protected function handle_editor()
{
+ global $globals;
+
if (Env::has('listname')) {
$this->liste = trim(Env::v('listname'));
}
$this->asso = trim(Env::v('assotype'));
}
if (!$this->asso) {
- $this->domain = "polytechnique.org";
+ $this->domain = $globals->mail->domain;
}
return true;
}
foreach(Array($liste, $liste . "-owner", $liste . "-admin", $liste . "-bounces", $liste . "-unsubscribe") as $l) {
XDB::execute("INSERT INTO aliases (alias,type) VALUES({?}, 'liste')", $l);
}
- } else {
- if ($ret) {
- foreach (Array('', 'owner', 'admin', 'bounces', 'unsubscribe') as $app) {
- $mdir = $app == '' ? '+post' : '+' . $app;
- if (!empty($app)) {
- $app = '-' . $app;
- }
- $red = $this->domain . '_' . $liste;
- XDB::execute('INSERT INTO x4dat.virtual (alias,type)
- VALUES({?},{?})', $liste . $app . '@' . $this->domain, 'list');
- XDB::execute('INSERT INTO x4dat.virtual_redirect (vid,redirect)
- VALUES ({?}, {?})', XDB::insertId(),
- $red . $mdir . '@listes.polytechnique.org');
- $list->mass_subscribe($liste, join(' ', $this->members));
+ } elseif ($ret) {
+ foreach (Array('', 'owner', 'admin', 'bounces', 'unsubscribe') as $app) {
+ $mdir = $app == '' ? '+post' : '+' . $app;
+ if (!empty($app)) {
+ $app = '-' . $app;
}
+ $red = $this->domain . '_' . $liste;
+ XDB::execute('INSERT INTO x4dat.virtual (alias,type)
+ VALUES({?},{?})', $liste . $app . '@' . $this->domain, 'list');
+ XDB::execute('INSERT INTO x4dat.virtual_redirect (vid,redirect)
+ VALUES ({?}, {?})', XDB::insertId(),
+ $red . $mdir . '@listes.polytechnique.org');
+ $list->mass_subscribe($liste, join(' ', $this->members));
}
}
return $ret;
function handler_create(&$page)
{
+ global $globals;
+
$page->changeTpl('lists/create.tpl');
$owners = preg_split("/[\s]+/", Post::v('owners'), -1, PREG_SPLIT_NO_EMPTY);
if (($asso == "binet") || ($asso == "alias")) {
$promo = Post::i('promo');
- $domain = $promo . '.polytechnique.org';
+ $domain = $promo . '.' . $globals->mail->domain;
if (($promo < 1921) || ($promo > date('Y'))) {
$page->trigError('La promotion est mal renseignée, elle doit être du type : 2004.');
$res = XDB::query('SELECT COUNT(*) FROM x4dat.virtual WHERE alias={?}', $new);
} else {
$res = XDB::query("SELECT COUNT(*) FROM aliases WHERE alias={?}", $liste);
- $domain = "polytechnique.org";
+ $domain = $globals->mail->domain;
}
}
$n = $res->fetchOneCell();
if ($n) {
- $page->trigError('Cette «adresse souhaitée» est déjà prise.');
+ $page->trigError('L\'«adresse souhaitée» est déjà prise.');
}
if (!Post::v('desc')) {