From c3d959ce95385169d0337c5927513f87d9ced493 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Tue, 1 Jun 2010 13:09:36 +0200 Subject: [PATCH] Forbids empty names and diminutives for groups. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- modules/xnetgrp.php | 16 ++++++++++------ upgrade/account/06_groups.sql | 3 +++ 2 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 upgrade/account/06_groups.sql diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index 5ce2c22..aacc262 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -164,10 +164,20 @@ class XnetGrpModule extends PLModule $site = ""; } if (S::has_perms()) { + $dom = XDB::iterator('SELECT * + FROM group_dom + ORDER BY nom'); + $page->assign('dom', $dom); + $page->assign('super', true); + if (Post::v('mail_domain') && (strstr(Post::v('mail_domain'), '.') === false)) { $page->trigError('Le domaine doit être un FQDN (aucune modification effectuée) !!!'); return; } + if (Post::t('nom') == '' || Post::t('diminutif') == '') { + $page->trigError('Ni le nom ni le diminutif du groupe ne peuvent être vide.'); + return; + } XDB::execute( "UPDATE groups SET nom={?}, diminutif={?}, cat={?}, dom={?}, @@ -218,12 +228,6 @@ class XnetGrpModule extends PLModule pl_redirect('../'.Post::v('diminutif', $globals->asso('diminutif')).'/edit'); } - - if (S::admin()) { - $dom = XDB::iterator('SELECT * FROM group_dom ORDER BY nom'); - $page->assign('dom', $dom); - $page->assign('super', true); - } } function handler_mail(&$page) diff --git a/upgrade/account/06_groups.sql b/upgrade/account/06_groups.sql new file mode 100644 index 0000000..6c1d558 --- /dev/null +++ b/upgrade/account/06_groups.sql @@ -0,0 +1,3 @@ +DELETE FROM groups WHERE nom = '' OR diminutif = ''; + +# vim:set syntax=mysql: -- 2.1.4