migrate getlogo
[platal.git] / htdocs.net / groupe / edit.php
1 <?php
2
3 require 'xnet.inc.php';
4 new_groupadmin_page('xnet/groupe/edit.tpl');
5
6 if (Post::has('submit')) {
7 if (has_perms()) {
8 if (Post::get('mail_domain') != "" && (strstr(Post::get('mail_domain'), '.') === false)) {
9 $page->trig_run("le domaine doit ĂȘtre un FQDN (aucune modif effectuĂ©e) !!!");
10 }
11 $globals->xdb->execute(
12 "UPDATE groupex.asso
13 SET nom={?}, diminutif={?}, cat={?}, dom={?}, descr={?}, site={?}, mail={?}, resp={?}, forum={?}, mail_domain={?}, ax={?}, pub={?}, sub_url={?}, inscriptible={?}
14 WHERE id={?}",
15 Post::get('nom'), Post::get('diminutif'), Post::get('cat'), Post::getInt('dom'),
16 Post::get('descr'), Post::get('site'), Post::get('mail'), Post::get('resp'),
17 Post::get('forum'), Post::get('mail_domain'), Post::has('ax'), Post::has('pub')?'private':'public', Post::get('sub_url'), Post::get('inscriptible'),
18 $globals->asso('id'));
19 if (Post::get('mail_domain')) {
20 $globals->xdb->execute('INSERT INTO virtual_domains (domain) VALUES({?})', Post::get('mail_domain'));
21 }
22 } else {
23 $globals->xdb->execute(
24 "UPDATE groupex.asso
25 SET descr={?}, site={?}, mail={?}, resp={?}, forum={?}, ax={?}, pub= {?}, sub_url={?}
26 WHERE id={?}",
27 Post::get('descr'), Post::get('site'), Post::get('mail'), Post::get('resp'),
28 Post::get('forum'), Post::has('ax'), Post::has('pub')?'private':'public', Post::get('sub_url'), $globals->asso('id'));
29 }
30
31 if ($_FILES['logo']['name']) {
32 $logo = file_get_contents($_FILES['logo']['tmp_name']);
33 $mime = $_FILES['logo']['type'];
34 $globals->xdb->execute('UPDATE groupex.asso SET logo={?}, logo_mime={?} WHERE id={?}', $logo, $mime, $globals->asso('id'));
35 }
36
37 redirect('../'.Post::get('diminutif', $globals->asso('diminutif')).'/edit.php');
38 }
39
40 if (has_perms()) {
41 $dom = $globals->xdb->iterator('SELECT * FROM groupex.dom ORDER BY nom');
42 $page->assign('dom', $dom);
43 $page->assign('super', true);
44 }
45 $page->run();
46
47 ?>