From: Stéphane Jacob Date: Tue, 1 Jun 2010 11:09:36 +0000 (+0200) Subject: Forbids empty names and diminutives for groups. X-Git-Tag: xorg/1.0.0~211 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=c3d959ce95385169d0337c5927513f87d9ced493;p=platal.git Forbids empty names and diminutives for groups. Signed-off-by: Stéphane Jacob --- 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: