git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-604
--- /dev/null
+<?php
+ require 'xnet.inc.php';
+ new_admin_page('xnet/admin.tpl');
+ $page->useMenu();
+
+ if (Get::has('del')) {
+ $res = $globals->xdb->query('SELECT id, nom, mail_domain FROM groupex.asso WHERE diminutif={?}', Get::get('del'));
+ list($id, $nom, $domain) = $res->fetchOneRow();
+ $page->assign('nom', $nom);
+ if ($id && Post::has('del')) {
+ $globals->xdb->query('DELETE FROM groupex.membres WHERE asso_id={?}', $id);
+ $page->trig('membres supprimés');
+
+ if ($domain) {
+ $globals->xdb->query('DELETE FROM virtual_domains WHERE domain={?}', $domain);
+ $globals->xdb->query('DELETE FROM virtual, virtual_redirect
+ USING virtual INNER JOIN virtual_redirect USING (vid)
+ WHERE alias LIKE {?}', '%@'.$domain);
+ $page->trig('suppression des alias mails');
+
+ require_once('lists.inc.php');
+ $client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'), $domain);
+ if ($listes = $client->get_lists()) {
+ foreach ($listes as $l) {
+ $client->delete_list($l['list'], true);
+ }
+ $page->trig('mail lists surpprimées');
+ }
+ }
+
+ $globals->xdb->query('DELETE FROM groupex.asso WHERE id={?}', $id);
+ $page->trig("Groupe $nom supprimé");
+ Get::kill('del');
+ }
+ if (!$id) {
+ Get::kill('del');
+ }
+ }
+
+ if (Post::has('diminutif')) {
+ $globals->xdb->query('INSERT INTO groupex.asso (id,diminutif) VALUES(NULL,{?})', Post::get('diminutif'));
+ header('Location: '.Post::get('diminutif').'/edit.php');
+ }
+
+ $res = $globals->xdb->query('SELECT nom,diminutif FROM groupex.asso ORDER by NOM');
+ $page->assign('assos', $res->fetchAllAssoc());
+
+ $page->run();
+?>
Post::get('nom'), Post::get('diminutif'), Post::get('cat'), Post::getInt('dom'),
Post::get('descr'), Post::get('site'), Post::get('mail'), Post::get('resp'),
Post::get('forum'), Post::get('mail_domain'), Post::has('ax'), $globals->asso('id'));
+ $globals->xdb->execute('INSERT INTO virtual_domains (domain) VALUES({?})', Post::get('mail_domain'));
} else {
$globals->xdb->execute(
"UPDATE groupex.asso
$sub['accueil'] = 'index.php';
$sub['liste des groupes'] = 'plan.php';
if (logged()) {
+ if (has_perms()) {
+ $sub['admin X.net'] = 'admin.php';
+ }
$sub['déconnexion'] = 'deconnexion.php';
}
$menu["Menu Principal"] = $sub;
if (logged() && (is_member() || may_update())) {
$sub = array();
$dim = $globals->asso('diminutif');
- $sub['accueil'] = "$dim/asso.php";
+ $sub['présentation'] = "$dim/asso.php";
$sub['annuaire du groupe'] = "$dim/annuaire.php";
if ($globals->asso('mail_domain')) {
$sub['listes de diffusion'] = "$dim/listes.php";
if (logged() && may_update()) {
$sub = array();
$sub['modifier l\'acceuil'] = "$dim/edit.php";
- $sub['envoyer un mail'] = "$dim/mail.php";
- $sub['créer une liste'] = "$dim/listes-create.php";
- $sub['créer un alias'] = "$dim/alias-create.php";
-
+ if ($globals->asso('mail_domain')) {
+ $sub['envoyer un mail'] = "$dim/mail.php";
+ $sub['créer une liste'] = "$dim/listes-create.php";
+ $sub['créer un alias'] = "$dim/alias-create.php";
+ }
$menu['Administrer Groupe'] = $sub;
}
--- /dev/null
+{***************************************************************************
+ * Copyright (C) 2003-2004 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * 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, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************}
+
+{if $smarty.get.del}
+
+<h1>Suppression du groupe {$nom}</h1>
+
+<form action="?del={$smarty.request.del}" method="post">
+ <div class="center">
+ <input type="submit" name="del" value="Oui, je veux supprimer ce groupe" />
+ </div>
+</form>
+
+{else}
+
+<h1>Ajouter un groupe</h1>
+
+<form action="{$smarty.server.PHP_SELF}" method="post">
+ <p class="descr">
+ Pour ajouter un groupe, choisir ici le diminutif qu'il va utiliser,
+ tu seras ensuite redirigé vers une page te permettant d'éditer le groupe :
+ </p>
+ <div class="center">
+ <input type="text" name="diminutif" value="{$smarty.request.diminutif}" />
+ <input type="submit" name="del" value="Ajouter" />
+ </div>
+</form>
+
+
+<h1>Administration des groupes X.net</h1>
+
+<table cellspacing="0" cellpadding="0">
+ {foreach from=$assos item=a key=i name=all}
+ {if $i is even}<tr>{/if}
+ <td><a href='?del={$a.diminutif}'><img src='{rel}/images/del.png' alt='delete' /></a></td>
+ <td><a href='{rel}/{$a.diminutif}/edit.php'>{$a.nom}</a></td>
+ {if $i is odd || $smarty.foreach.all.last}</tr>{/if}
+ {/foreach}
+</table>
+
+{/if}
+
+{* vim:set et sw=2 sts=2 sws=2: *}
update groupex.asso set nom=replace(nom, '<small>', '');
update groupex.asso set nom=replace(nom, '</small>', '');
+
alter table groupex.asso drop column m_list;
+alter table groupex.asso change column nom nom CHAR(255) not null;
+alter table groupex.asso change column diminutif diminutif CHAR(64) not null;
+alter table groupex.asso change column site site CHAR(255) not null;
+alter table groupex.asso change column mail mail CHAR(255) not null;
+alter table groupex.asso change column resp resp CHAR(255) not null;
+alter table groupex.asso change column forum forum CHAR(255) not null;
+alter table groupex.asso change column mail_domain mail_domain CHAR(255) not null;
+alter table groupex.asso add unique index (diminutif);
+
+alter table groupex.membres change column uid uid int not null;
+