Commit | Line | Data |
---|---|---|
f525ba66 FB |
1 | <?php |
2 | ||
3 | class xorgBlogOwnerWidget { | |
3b8da081 | 4 | public static function behavior_adminBlogPreferencesForm($core) { |
f525ba66 | 5 | if ($core->auth->isSuperAdmin()) { |
6e7207b1 FB |
6 | if (isset($_GET['id'])) { |
7 | $settings = new dcSettings($core, $_GET['id']); | |
8 | } else { | |
9 | $settings =& $core->blog->settings; | |
10 | } | |
f525ba66 FB |
11 | $types = array('user' => array('text' => 'Blog d\'utilisateur', |
12 | 'selected' => false), | |
99c51f8f JPAMA |
13 | 'connected' => array('text' => 'Blog de groupe, édition par toute personne connectée', |
14 | 'selected' => false), | |
f525ba66 FB |
15 | 'group-member' => array('text' => 'Blog de groupe, édition par les membres', |
16 | 'selected' => false), | |
17 | 'group-admin' => array('text' => 'Blog de groupe, édition par les administrateurs', | |
18 | 'selected' => false)); | |
9921376e | 19 | $type = $settings->xorgauth->get('xorg_blog_type'); |
f525ba66 FB |
20 | if (!$type) { |
21 | $type = 'user'; | |
22 | } | |
23 | $types[$type]['selected'] = true; | |
6e7207b1 FB |
24 | ?> |
25 | <fieldset> | |
26 | <legend>Authentification X.org</legend> | |
27 | <div class="two-cols"> | |
28 | <div class="col"> | |
29 | <p> | |
30 | <label> | |
31 | Type de blog : | |
32 | <select name="xorg_blog_type"> | |
33 | <?php | |
f525ba66 FB |
34 | foreach ($types as $key => $fields) { |
35 | echo '<option value="' . $key . '"' . ($fields['selected'] ? ' selected="selected"' : '') . '>' | |
36 | . $fields['text'] . '</option>'; | |
37 | } | |
6e7207b1 FB |
38 | ?> |
39 | </select> | |
40 | </label> | |
41 | </p> | |
42 | </div> | |
43 | <div class="col"> | |
44 | <p> | |
45 | <label> | |
46 | Propriétaire du blog (*) : | |
9921376e | 47 | <input type="text" name="xorg_blog_owner" value="<?php echo $settings->xorgauth->get('xorg_blog_owner'); ?> " /> |
6e7207b1 FB |
48 | </label> |
49 | </p> | |
50 | <p> | |
51 | <label> | |
52 | (*) Dans le cas d'un blog de groupe, le propriétaire est le diminutif X.net du groupe<br /> | |
53 | (*) Dans le cas d'un blog d'utilisateur, le propriétaire est le forlife de l'utilisateur | |
54 | </label> | |
55 | </p> | |
56 | </div> | |
57 | </div> | |
58 | </fieldset> | |
59 | <?php | |
f525ba66 FB |
60 | } |
61 | } | |
62 | ||
3b8da081 | 63 | public static function behavior_adminBeforeBlogSettingsUpdate($settings) { |
5322432c FB |
64 | self::setXorgOwner($settings, $_POST['xorg_blog_type'], $_POST['xorg_blog_owner']); |
65 | } | |
66 | ||
3b8da081 | 67 | public static function setXorgOwner($settings, $type, $owner) { |
f525ba66 FB |
68 | global $core; |
69 | if ($core->auth->isSuperAdmin()) { | |
9921376e RB |
70 | $settings->xorgauth->put('xorg_blog_type', $type, 'string', 'Type de blog X.org'); |
71 | $settings->xorgauth->put('xorg_blog_owner', $owner, 'string', 'Propriétaire X.org du blog'); | |
f525ba66 FB |
72 | } |
73 | } | |
5322432c | 74 | |
f525ba66 FB |
75 | } |
76 | ||
77 | ?> |