1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
3 | # |
---|
4 | # This file is part of Dotclear 2. |
---|
5 | # |
---|
6 | # Copyright (c) 2003-2014 Olivier Meunier & Association Dotclear |
---|
7 | # Licensed under the GPL version 2.0 license. |
---|
8 | # See LICENSE file or |
---|
9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
10 | # |
---|
11 | # -- END LICENSE BLOCK ----------------------------------------- |
---|
12 | |
---|
13 | require dirname(__FILE__).'/../inc/admin/prepend.php'; |
---|
14 | |
---|
15 | dcPage::check('usage,contentadmin'); |
---|
16 | |
---|
17 | $page_title = __('My preferences'); |
---|
18 | |
---|
19 | $user_name = $core->auth->getInfo('user_name'); |
---|
20 | $user_firstname = $core->auth->getInfo('user_firstname'); |
---|
21 | $user_displayname = $core->auth->getInfo('user_displayname'); |
---|
22 | $user_email = $core->auth->getInfo('user_email'); |
---|
23 | $user_url = $core->auth->getInfo('user_url'); |
---|
24 | $user_lang = $core->auth->getInfo('user_lang'); |
---|
25 | $user_tz = $core->auth->getInfo('user_tz'); |
---|
26 | $user_post_status = $core->auth->getInfo('user_post_status'); |
---|
27 | |
---|
28 | $user_options = $core->auth->getOptions(); |
---|
29 | if (empty($user_options['editor']) || !is_array($user_options['editor'])) { |
---|
30 | $user_options['editor'] = array(); |
---|
31 | } |
---|
32 | |
---|
33 | $core->auth->user_prefs->addWorkspace('dashboard'); |
---|
34 | $user_dm_doclinks = $core->auth->user_prefs->dashboard->doclinks; |
---|
35 | $user_dm_dcnews = $core->auth->user_prefs->dashboard->dcnews; |
---|
36 | $user_dm_quickentry = $core->auth->user_prefs->dashboard->quickentry; |
---|
37 | $user_dm_nofavicons = $core->auth->user_prefs->dashboard->nofavicons; |
---|
38 | |
---|
39 | $core->auth->user_prefs->addWorkspace('accessibility'); |
---|
40 | $user_acc_nodragdrop = $core->auth->user_prefs->accessibility->nodragdrop; |
---|
41 | |
---|
42 | $core->auth->user_prefs->addWorkspace('interface'); |
---|
43 | $user_ui_enhanceduploader = $core->auth->user_prefs->interface->enhanceduploader; |
---|
44 | if ($core->auth->isSuperAdmin()) { |
---|
45 | $user_ui_hide_std_favicon = $core->auth->user_prefs->interface->hide_std_favicon; |
---|
46 | } |
---|
47 | $user_ui_iconset = @$core->auth->user_prefs->interface->iconset; |
---|
48 | $user_ui_nofavmenu = $core->auth->user_prefs->interface->nofavmenu; |
---|
49 | $user_ui_media_by_page = ($core->auth->user_prefs->interface->media_by_page ? $core->auth->user_prefs->interface->media_by_page : 30); |
---|
50 | $user_ui_media_nb_last_dirs = $core->auth->user_prefs->interface->media_nb_last_dirs; |
---|
51 | |
---|
52 | $default_tab = !empty($_GET['tab']) ? html::escapeHTML($_GET['tab']) : 'user-profile'; |
---|
53 | |
---|
54 | if (!empty($_GET['append']) || !empty($_GET['removed']) || !empty($_GET['neworder']) || |
---|
55 | !empty($_GET['replaced']) || !empty($_POST['appendaction']) || !empty($_POST['removeaction']) || |
---|
56 | !empty($_GET['db-updated'])) { |
---|
57 | $default_tab = 'user-favorites'; |
---|
58 | } elseif (!empty($_GET['updated'])) { |
---|
59 | $default_tab = 'user-options'; |
---|
60 | } |
---|
61 | if (($default_tab != 'user-profile') && ($default_tab != 'user-options') && ($default_tab != 'user-favorites')) { |
---|
62 | $default_tab = 'user-profile'; |
---|
63 | } |
---|
64 | |
---|
65 | # Editors combo |
---|
66 | $editors_combo = dcAdminCombos::getEditorsCombo(); |
---|
67 | $editors = array_keys($editors_combo); |
---|
68 | |
---|
69 | # Format by editors |
---|
70 | $formaters = $core->getFormaters(); |
---|
71 | $format_by_editors = array(); |
---|
72 | foreach ($formaters as $editor => $formats) { |
---|
73 | foreach ($formats as $format) { |
---|
74 | $format_by_editors[$format][$editor] = $editor; |
---|
75 | } |
---|
76 | } |
---|
77 | $available_formats = array('' => ''); |
---|
78 | foreach (array_keys($format_by_editors) as $format) { |
---|
79 | $available_formats[$format] = $format; |
---|
80 | if (!isset($user_options['editor'][$format])) { |
---|
81 | $user_options['editor'][$format] = ''; |
---|
82 | } |
---|
83 | } |
---|
84 | $status_combo = dcAdminCombos::getPostStatusescombo(); |
---|
85 | |
---|
86 | $iconsets_combo = array(__('Default') => ''); |
---|
87 | $iconsets_root = dirname(__FILE__).'/images/iconset/'; |
---|
88 | if (is_dir($iconsets_root) && is_readable($iconsets_root)) { |
---|
89 | if (($d = @dir($iconsets_root)) !== false) { |
---|
90 | while (($entry = $d->read()) !== false) { |
---|
91 | if ($entry != '.' && $entry != '..' && substr($entry, 0, 1) != '.' && is_dir($iconsets_root.'/'.$entry)) { |
---|
92 | $iconsets_combo[$entry] = $entry; |
---|
93 | } |
---|
94 | } |
---|
95 | } |
---|
96 | } |
---|
97 | |
---|
98 | # Language codes |
---|
99 | $lang_combo = dcAdminCombos::getAdminLangsCombo(); |
---|
100 | |
---|
101 | # Get 3rd parts xhtml editor flags |
---|
102 | $rte = array( |
---|
103 | 'blog_descr' => array(true,__('Blog description (in blog parameters)')), |
---|
104 | 'cat_descr' => array(true,__('Category description')) |
---|
105 | ); |
---|
106 | $rte = new ArrayObject($rte); |
---|
107 | $core->callBehavior('adminRteFlags',$core,$rte); |
---|
108 | # Load user settings |
---|
109 | $rte_flags = @$core->auth->user_prefs->interface->rte_flags; |
---|
110 | if (is_array($rte_flags)) { |
---|
111 | foreach ($rte_flags as $fk => $fv) { |
---|
112 | if (isset($rte[$fk])) { |
---|
113 | $rte[$fk][0] = $fv; |
---|
114 | } |
---|
115 | } |
---|
116 | } |
---|
117 | |
---|
118 | # Get default colums (admin lists) |
---|
119 | $cols = array( |
---|
120 | 'posts' => array(__('Posts'), array( |
---|
121 | 'date' => array(true,__('Date')), |
---|
122 | 'category' => array(true,__('Category')), |
---|
123 | 'author' => array(true,__('Author')), |
---|
124 | 'comments' => array(true,__('Comments')), |
---|
125 | 'trackbacks' => array(true,__('Trackbacks')) |
---|
126 | )) |
---|
127 | ); |
---|
128 | $cols = new arrayObject($cols); |
---|
129 | $core->callBehavior('adminColumnsLists',$core,$cols); |
---|
130 | # Load user settings |
---|
131 | $cols_user = @$core->auth->user_prefs->interface->cols; |
---|
132 | if (is_array($cols_user)) { |
---|
133 | foreach ($cols_user as $ct => $cv) { |
---|
134 | foreach ($cv as $cn => $cd) { |
---|
135 | if (isset($cols[$ct][1][$cn])) { |
---|
136 | $cols[$ct][1][$cn][0] = $cd; |
---|
137 | } |
---|
138 | } |
---|
139 | } |
---|
140 | } |
---|
141 | |
---|
142 | # Add or update user |
---|
143 | if (isset($_POST['user_name'])) |
---|
144 | { |
---|
145 | try |
---|
146 | { |
---|
147 | $pwd_check = !empty($_POST['cur_pwd']) && $core->auth->checkPassword($core->auth->crypt($_POST['cur_pwd'])); |
---|
148 | |
---|
149 | if ($core->auth->allowPassChange() && !$pwd_check && $user_email != $_POST['user_email']) { |
---|
150 | throw new Exception(__('If you want to change your email or password you must provide your current password.')); |
---|
151 | } |
---|
152 | |
---|
153 | $cur = $core->con->openCursor($core->prefix.'user'); |
---|
154 | |
---|
155 | $cur->user_name = $user_name = $_POST['user_name']; |
---|
156 | $cur->user_firstname = $user_firstname = $_POST['user_firstname']; |
---|
157 | $cur->user_displayname = $user_displayname = $_POST['user_displayname']; |
---|
158 | $cur->user_email = $user_email = $_POST['user_email']; |
---|
159 | $cur->user_url = $user_url = $_POST['user_url']; |
---|
160 | $cur->user_lang = $user_lang = $_POST['user_lang']; |
---|
161 | $cur->user_tz = $user_tz = $_POST['user_tz']; |
---|
162 | |
---|
163 | $cur->user_options = new ArrayObject($user_options); |
---|
164 | |
---|
165 | if ($core->auth->allowPassChange() && !empty($_POST['new_pwd'])) |
---|
166 | { |
---|
167 | if (!$pwd_check) { |
---|
168 | throw new Exception(__('If you want to change your email or password you must provide your current password.')); |
---|
169 | } |
---|
170 | |
---|
171 | if ($_POST['new_pwd'] != $_POST['new_pwd_c']) { |
---|
172 | throw new Exception(__("Passwords don't match")); |
---|
173 | } |
---|
174 | |
---|
175 | $cur->user_pwd = $_POST['new_pwd']; |
---|
176 | } |
---|
177 | |
---|
178 | # --BEHAVIOR-- adminBeforeUserUpdate |
---|
179 | $core->callBehavior('adminBeforeUserProfileUpdate',$cur,$core->auth->userID()); |
---|
180 | |
---|
181 | # Udate user |
---|
182 | $core->updUser($core->auth->userID(),$cur); |
---|
183 | |
---|
184 | # --BEHAVIOR-- adminAfterUserUpdate |
---|
185 | $core->callBehavior('adminAfterUserProfileUpdate',$cur,$core->auth->userID()); |
---|
186 | |
---|
187 | dcPage::addSuccessNotice(__('Personal information has been successfully updated.')); |
---|
188 | |
---|
189 | $core->adminurl->redirect("admin.user.preferences"); |
---|
190 | } |
---|
191 | catch (Exception $e) |
---|
192 | { |
---|
193 | $core->error->add($e->getMessage()); |
---|
194 | } |
---|
195 | } |
---|
196 | |
---|
197 | # Update user options |
---|
198 | if (isset($_POST['user_editor'])) |
---|
199 | { |
---|
200 | try |
---|
201 | { |
---|
202 | $cur = $core->con->openCursor($core->prefix.'user'); |
---|
203 | |
---|
204 | $cur->user_name = $user_name; |
---|
205 | $cur->user_firstname = $user_firstname; |
---|
206 | $cur->user_displayname = $user_displayname; |
---|
207 | $cur->user_email = $user_email; |
---|
208 | $cur->user_url = $user_url; |
---|
209 | $cur->user_lang = $user_lang; |
---|
210 | $cur->user_tz = $user_tz; |
---|
211 | |
---|
212 | $cur->user_post_status = $user_post_status = $_POST['user_post_status']; |
---|
213 | |
---|
214 | $user_options['edit_size'] = (integer) $_POST['user_edit_size']; |
---|
215 | if ($user_options['edit_size'] < 1) { |
---|
216 | $user_options['edit_size'] = 10; |
---|
217 | } |
---|
218 | $user_options['post_format'] = $_POST['user_post_format']; |
---|
219 | $user_options['editor'] = $_POST['user_editor']; |
---|
220 | $user_options['enable_wysiwyg'] = !empty($_POST['user_wysiwyg']); |
---|
221 | $user_options['toolbar_bottom'] = !empty($_POST['user_toolbar_bottom']); |
---|
222 | |
---|
223 | $cur->user_options = new ArrayObject($user_options); |
---|
224 | |
---|
225 | # --BEHAVIOR-- adminBeforeUserOptionsUpdate |
---|
226 | $core->callBehavior('adminBeforeUserOptionsUpdate',$cur,$core->auth->userID()); |
---|
227 | |
---|
228 | # Update user prefs |
---|
229 | $core->auth->user_prefs->accessibility->put('nodragdrop',!empty($_POST['user_acc_nodragdrop']),'boolean'); |
---|
230 | $core->auth->user_prefs->interface->put('enhanceduploader',!empty($_POST['user_ui_enhanceduploader']),'boolean'); |
---|
231 | if ($core->auth->isSuperAdmin()) { |
---|
232 | # Applied to all users |
---|
233 | $core->auth->user_prefs->interface->put('hide_std_favicon',!empty($_POST['user_ui_hide_std_favicon']),'boolean',null,true,true); |
---|
234 | } |
---|
235 | $core->auth->user_prefs->interface->put('media_by_page',(integer)$_POST['user_ui_media_by_page'],'integer'); |
---|
236 | $core->auth->user_prefs->interface->put('media_nb_last_dirs',(integer)$_POST['user_ui_media_nb_last_dirs'],'integer'); |
---|
237 | $core->auth->user_prefs->interface->put('media_last_dirs',array(),'array',null,false); |
---|
238 | $core->auth->user_prefs->interface->put('media_fav_dirs',array(),'array',null,false); |
---|
239 | |
---|
240 | # Update user columns (lists) |
---|
241 | $cu = array(); |
---|
242 | foreach ($cols as $col_type => $cols_list) { |
---|
243 | $ct = array(); |
---|
244 | foreach ($cols_list[1] as $col_name => $col_data) { |
---|
245 | $ct[$col_name] = isset($_POST['cols_'.$col_type]) && in_array($col_name,$_POST['cols_'.$col_type],true) ? true : false; |
---|
246 | } |
---|
247 | if (count($ct)) { |
---|
248 | $cu[$col_type] = $ct; |
---|
249 | } |
---|
250 | } |
---|
251 | $core->auth->user_prefs->interface->put('cols',$cu,'array'); |
---|
252 | |
---|
253 | # Update user xhtml editor flags |
---|
254 | $rf = array(); |
---|
255 | foreach ($rte as $rk => $rv) { |
---|
256 | $rf[$rk] = isset($_POST['rte_flags']) && in_array($rk,$_POST['rte_flags'],true) ? true : false; |
---|
257 | } |
---|
258 | $core->auth->user_prefs->interface->put('rte_flags',$rf,'array'); |
---|
259 | |
---|
260 | # Update user |
---|
261 | $core->updUser($core->auth->userID(),$cur); |
---|
262 | |
---|
263 | # --BEHAVIOR-- adminAfterUserOptionsUpdate |
---|
264 | $core->callBehavior('adminAfterUserOptionsUpdate',$cur,$core->auth->userID()); |
---|
265 | |
---|
266 | dcPage::addSuccessNotice(__('Personal options has been successfully updated.')); |
---|
267 | $core->adminurl->redirect("admin.user.preferences",array(),'#user-options'); |
---|
268 | } |
---|
269 | catch (Exception $e) |
---|
270 | { |
---|
271 | $core->error->add($e->getMessage()); |
---|
272 | } |
---|
273 | } |
---|
274 | |
---|
275 | # Dashboard options |
---|
276 | if (isset($_POST['db-options'])) { |
---|
277 | try |
---|
278 | { |
---|
279 | # --BEHAVIOR-- adminBeforeUserOptionsUpdate |
---|
280 | $core->callBehavior('adminBeforeDashboardOptionsUpdate',$core->auth->userID()); |
---|
281 | |
---|
282 | # Update user prefs |
---|
283 | $core->auth->user_prefs->dashboard->put('doclinks',!empty($_POST['user_dm_doclinks']),'boolean'); |
---|
284 | $core->auth->user_prefs->dashboard->put('dcnews',!empty($_POST['user_dm_dcnews']),'boolean'); |
---|
285 | $core->auth->user_prefs->dashboard->put('quickentry',!empty($_POST['user_dm_quickentry']),'boolean'); |
---|
286 | $core->auth->user_prefs->dashboard->put('nofavicons',empty($_POST['user_dm_nofavicons']),'boolean'); |
---|
287 | $core->auth->user_prefs->interface->put('iconset',(!empty($_POST['user_ui_iconset']) ? $_POST['user_ui_iconset'] : '')); |
---|
288 | $core->auth->user_prefs->interface->put('nofavmenu',empty($_POST['user_ui_nofavmenu']),'boolean'); |
---|
289 | |
---|
290 | # --BEHAVIOR-- adminAfterUserOptionsUpdate |
---|
291 | $core->callBehavior('adminAfterDashboardOptionsUpdate',$core->auth->userID()); |
---|
292 | |
---|
293 | dcPage::addSuccessNotice(__('Dashboard options has been successfully updated.')); |
---|
294 | $core->adminurl->redirect("admin.user.preferences",array(),'#user-favorites'); |
---|
295 | } |
---|
296 | catch (Exception $e) |
---|
297 | { |
---|
298 | $core->error->add($e->getMessage()); |
---|
299 | } |
---|
300 | } |
---|
301 | |
---|
302 | # Add selected favorites |
---|
303 | if (!empty($_POST['appendaction'])) |
---|
304 | { |
---|
305 | try { |
---|
306 | if (empty($_POST['append'])) { |
---|
307 | throw new Exception(__('No favorite selected')); |
---|
308 | } |
---|
309 | $user_favs = $core->favs->getFavoriteIDs(false); |
---|
310 | foreach ($_POST['append'] as $k => $v) |
---|
311 | { |
---|
312 | if ($core->favs->exists($v)) { |
---|
313 | $user_favs[] = $v; |
---|
314 | } |
---|
315 | } |
---|
316 | $core->favs->setFavoriteIDs($user_favs,false); |
---|
317 | |
---|
318 | if (!$core->error->flag()) { |
---|
319 | dcPage::addSuccessNotice(__('Favorites have been successfully added.')); |
---|
320 | $core->adminurl->redirect("admin.user.preferences",array(),'#user-favorites'); |
---|
321 | } |
---|
322 | } catch (Exception $e) { |
---|
323 | $core->error->add($e->getMessage()); |
---|
324 | } |
---|
325 | } |
---|
326 | |
---|
327 | # Delete selected favorites |
---|
328 | if (!empty($_POST['removeaction'])) |
---|
329 | { |
---|
330 | try { |
---|
331 | if (empty($_POST['remove'])) { |
---|
332 | throw new Exception(__('No favorite selected')); |
---|
333 | } |
---|
334 | $user_fav_ids = array(); |
---|
335 | foreach ($core->favs->getFavoriteIDs(false) as $v) { |
---|
336 | $user_fav_ids[$v]=true; |
---|
337 | } |
---|
338 | foreach ($_POST['remove'] as $v) |
---|
339 | { |
---|
340 | if (isset($user_fav_ids[$v])) { |
---|
341 | unset($user_fav_ids[$v]); |
---|
342 | } |
---|
343 | } |
---|
344 | $core->favs->setFavoriteIDs(array_keys($user_fav_ids),false); |
---|
345 | if (!$core->error->flag()) { |
---|
346 | dcPage::addSuccessNotice(__('Favorites have been successfully removed.')); |
---|
347 | $core->adminurl->redirect("admin.user.preferences",array(),'#user-favorites'); |
---|
348 | } |
---|
349 | } catch (Exception $e) { |
---|
350 | $core->error->add($e->getMessage()); |
---|
351 | } |
---|
352 | } |
---|
353 | |
---|
354 | # Order favs |
---|
355 | $order = array(); |
---|
356 | if (empty($_POST['favs_order']) && !empty($_POST['order'])) { |
---|
357 | $order = $_POST['order']; |
---|
358 | asort($order); |
---|
359 | $order = array_keys($order); |
---|
360 | } elseif (!empty($_POST['favs_order'])) { |
---|
361 | $order = explode(',',$_POST['favs_order']); |
---|
362 | } |
---|
363 | |
---|
364 | if (!empty($_POST['saveorder']) && !empty($order)) |
---|
365 | { |
---|
366 | foreach ($order as $k => $v) { |
---|
367 | if (!$core->favs->exists($v)) { |
---|
368 | unset($order[$k]); |
---|
369 | } |
---|
370 | } |
---|
371 | $core->favs->setFavoriteIDs($order,false); |
---|
372 | if (!$core->error->flag()) { |
---|
373 | dcPage::addSuccessNotice(__('Favorites have been successfully updated.')); |
---|
374 | $core->adminurl->redirect("admin.user.preferences",array(),'#user-favorites'); |
---|
375 | } |
---|
376 | } |
---|
377 | |
---|
378 | # Replace default favorites by current set (super admin only) |
---|
379 | if (!empty($_POST['replace']) && $core->auth->isSuperAdmin()) { |
---|
380 | $user_favs = $core->favs->getFavoriteIDs(false); |
---|
381 | $core->favs->setFavoriteIDs($user_favs,true); |
---|
382 | |
---|
383 | if (!$core->error->flag()) { |
---|
384 | dcPage::addSuccessNotice(__('Default favorites have been successfully updated.')); |
---|
385 | $core->adminurl->redirect("admin.user.preferences",array(),'#user-favorites'); |
---|
386 | } |
---|
387 | } |
---|
388 | |
---|
389 | /* DISPLAY |
---|
390 | -------------------------------------------------------- */ |
---|
391 | dcPage::open($page_title, |
---|
392 | dcPage::jsLoad('js/_preferences.js'). |
---|
393 | ($user_acc_nodragdrop ? '' : dcPage::jsLoad('js/_preferences-dragdrop.js')). |
---|
394 | dcPage::jsLoad('js/jquery/jquery-ui.custom.js'). |
---|
395 | dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js'). |
---|
396 | dcPage::jsLoad('js/jquery/jquery.pwstrength.js'). |
---|
397 | '<script type="text/javascript">'."\n". |
---|
398 | "//<![CDATA[\n". |
---|
399 | "\$(function() {\n". |
---|
400 | " \$('#new_pwd').pwstrength({texts: ['". |
---|
401 | sprintf(__('Password strength: %s'),__('very weak'))."', '". |
---|
402 | sprintf(__('Password strength: %s'),__('weak'))."', '". |
---|
403 | sprintf(__('Password strength: %s'),__('mediocre'))."', '". |
---|
404 | sprintf(__('Password strength: %s'),__('strong'))."', '". |
---|
405 | sprintf(__('Password strength: %s'),__('very strong'))."']});\n". |
---|
406 | "});". |
---|
407 | "\n//]]>\n". |
---|
408 | "</script>\n". |
---|
409 | dcPage::jsPageTabs($default_tab). |
---|
410 | dcPage::jsConfirmClose('user-form'). |
---|
411 | |
---|
412 | # --BEHAVIOR-- adminPreferencesHeaders |
---|
413 | $core->callBehavior('adminPreferencesHeaders'), |
---|
414 | |
---|
415 | dcPage::breadcrumb( |
---|
416 | array( |
---|
417 | html::escapeHTML($core->auth->userID()) => '', |
---|
418 | $page_title => '' |
---|
419 | )) |
---|
420 | ); |
---|
421 | |
---|
422 | # User profile |
---|
423 | echo '<div class="multi-part" id="user-profile" title="'.__('My profile').'">'; |
---|
424 | |
---|
425 | echo |
---|
426 | '<h3>'.__('My profile').'</h3>'. |
---|
427 | '<form action="'.$core->adminurl->get("admin.user.preferences").'" method="post" id="user-form">'. |
---|
428 | |
---|
429 | '<p><label for="user_name">'.__('Last Name:').'</label>'. |
---|
430 | form::field('user_name',20,255,html::escapeHTML($user_name)).'</p>'. |
---|
431 | |
---|
432 | '<p><label for="user_firstname">'.__('First Name:').'</label>'. |
---|
433 | form::field('user_firstname',20,255,html::escapeHTML($user_firstname)).'</p>'. |
---|
434 | |
---|
435 | '<p><label for="user_displayname">'.__('Display name:').'</label>'. |
---|
436 | form::field('user_displayname',20,255,html::escapeHTML($user_displayname)).'</p>'. |
---|
437 | |
---|
438 | '<p><label for="user_email">'.__('Email:').'</label>'. |
---|
439 | form::field('user_email',20,255,html::escapeHTML($user_email)).'</p>'. |
---|
440 | |
---|
441 | '<p><label for="user_url">'.__('URL:').'</label>'. |
---|
442 | form::field('user_url',30,255,html::escapeHTML($user_url)).'</p>'. |
---|
443 | |
---|
444 | '<p><label for="user_lang">'.__('Language for my interface:').'</label>'. |
---|
445 | form::combo('user_lang',$lang_combo,$user_lang,'l10n').'</p>'. |
---|
446 | |
---|
447 | '<p><label for="user_tz">'.__('My timezone:').'</label>'. |
---|
448 | form::combo('user_tz',dt::getZones(true,true),$user_tz).'</p>'; |
---|
449 | |
---|
450 | |
---|
451 | if ($core->auth->allowPassChange()) |
---|
452 | { |
---|
453 | echo |
---|
454 | '<h4 class="vertical-separator pretty-title">'.__('Change my password').'</h4>'. |
---|
455 | |
---|
456 | '<div class="pw-table">'. |
---|
457 | '<p class="pw-cell"><label for="new_pwd">'.__('New password:').'</label>'. |
---|
458 | form::password('new_pwd',20,255,'','','',false,' data-indicator="pwindicator" ').'</p>'. |
---|
459 | '<div id="pwindicator">'. |
---|
460 | ' <div class="bar"></div>'. |
---|
461 | ' <p class="label no-margin"></p>'. |
---|
462 | '</div>'. |
---|
463 | '</div>'. |
---|
464 | |
---|
465 | '<p><label for="new_pwd_c">'.__('Confirm new password:').'</label>'. |
---|
466 | form::password('new_pwd_c',20,255).'</p>'. |
---|
467 | |
---|
468 | '<p><label for="cur_pwd">'.__('Your current password:').'</label>'. |
---|
469 | form::password('cur_pwd',20,255).'</p>'. |
---|
470 | '<p class="form-note warn">'. |
---|
471 | __('If you have changed your email or password you must provide your current password to save these modifications.'). |
---|
472 | '</p>'; |
---|
473 | } |
---|
474 | |
---|
475 | echo |
---|
476 | '<p class="clear vertical-separator">'. |
---|
477 | $core->formNonce(). |
---|
478 | '<input type="submit" accesskey="s" value="'.__('Update my profile').'" /></p>'. |
---|
479 | '</form>'. |
---|
480 | |
---|
481 | '</div>'; |
---|
482 | |
---|
483 | # User options : some from actual user profile, dashboard modules, ... |
---|
484 | echo '<div class="multi-part" id="user-options" title="'.__('My options').'">'; |
---|
485 | |
---|
486 | echo |
---|
487 | '<form action="'.$core->adminurl->get("admin.user.preferences").'#user-options" method="post" id="opts-forms">'. |
---|
488 | '<h3>'.__('My options').'</h3>'; |
---|
489 | |
---|
490 | echo |
---|
491 | '<div class="fieldset">'. |
---|
492 | '<h4>'.__('Interface').'</h4>'. |
---|
493 | |
---|
494 | '<p><label for="user_ui_enhanceduploader" class="classic">'. |
---|
495 | form::checkbox('user_ui_enhanceduploader',1,$user_ui_enhanceduploader).' '. |
---|
496 | __('Activate enhanced uploader in media manager').'</label></p>'. |
---|
497 | |
---|
498 | '<p><label for="user_acc_nodragdrop" class="classic">'. |
---|
499 | form::checkbox('user_acc_nodragdrop',1,$user_acc_nodragdrop).' '. |
---|
500 | __('Disable javascript powered drag and drop for ordering items').'</label></p>'. |
---|
501 | '<p class="clear form-note">'.__('If checked, numeric fields will allow to type the elements\' ordering number.').'</p>'; |
---|
502 | |
---|
503 | echo |
---|
504 | '<p><label for="user_ui_media_by_page" class="classic">'.__('Number of elements displayed per page in media manager:').'</label> '. |
---|
505 | form::field('user_ui_media_by_page',5,3,(integer) $user_ui_media_by_page).'</p>'; |
---|
506 | |
---|
507 | echo |
---|
508 | '<p><label for="user_ui_media_nb_last_dirs" class="classic">'.__('Number of recent folders proposed in media manager:').'</label> '. |
---|
509 | form::field('user_ui_media_nb_last_dirs',5,3,(integer) $user_ui_media_nb_last_dirs).'</p>'. |
---|
510 | '<p class="clear form-note">'.__('Leave empty to ignore, displayed only if Javascript is enabled in your browser.').'</p>'; |
---|
511 | |
---|
512 | if ($core->auth->isSuperAdmin()) { |
---|
513 | echo |
---|
514 | '<p><label for="user_ui_hide_std_favicon" class="classic">'. |
---|
515 | form::checkbox('user_ui_hide_std_favicon',1,$user_ui_hide_std_favicon).' '. |
---|
516 | __('Do not use standard favicon').'</label> '. |
---|
517 | '<span class="clear form-note warn">'.__('This will be applied for all users').'.</span>'. |
---|
518 | '</p>';//Opera sucks; |
---|
519 | } |
---|
520 | |
---|
521 | echo |
---|
522 | '</div>'; |
---|
523 | |
---|
524 | echo |
---|
525 | '<div class="fieldset">'. |
---|
526 | '<h4>'.__('Optional columns displayed in lists').'</h4>'; |
---|
527 | $odd = true; |
---|
528 | foreach ($cols as $col_type => $col_list) { |
---|
529 | echo '<div class="two-boxes '.($odd ? 'odd' : 'even').'">'; |
---|
530 | echo '<h5>'.$col_list[0].'</h5>'; |
---|
531 | foreach ($col_list[1] as $col_name => $col_data) { |
---|
532 | echo |
---|
533 | '<p><label for="cols_'.$col_type.'-'.$col_name.'" class="classic">'. |
---|
534 | form::checkbox(array('cols_'.$col_type.'[]','cols_'.$col_type.'-'.$col_name),$col_name,$col_data[0]).$col_data[1].'</label>'; |
---|
535 | } |
---|
536 | echo '</div>'; |
---|
537 | $odd = !$odd; |
---|
538 | } |
---|
539 | echo '</div>'; |
---|
540 | |
---|
541 | echo |
---|
542 | '<div class="fieldset">'. |
---|
543 | '<h4>'.__('Edition').'</h4>'; |
---|
544 | |
---|
545 | echo '<div class="two-boxes odd">'; |
---|
546 | foreach ($format_by_editors as $format => $editors) { |
---|
547 | echo |
---|
548 | '<p class="field"><label for="user_editor_'.$format.'">'.sprintf(__('Preferred editor for %s:'),$format).'</label>'. |
---|
549 | form::combo( |
---|
550 | array('user_editor['.$format.']', 'user_editor_'.$format), |
---|
551 | array_merge(array(__('Choose an editor') => ''),$editors), |
---|
552 | $user_options['editor'][$format] |
---|
553 | ).'</p>'; |
---|
554 | } |
---|
555 | echo |
---|
556 | '<p class="field"><label for="user_post_format">'.__('Preferred format:').'</label>'. |
---|
557 | form::combo('user_post_format',$available_formats,$user_options['post_format']).'</p>'; |
---|
558 | |
---|
559 | echo |
---|
560 | '<p class="field"><label for="user_post_status">'.__('Default entry status:').'</label>'. |
---|
561 | form::combo('user_post_status',$status_combo,$user_post_status).'</p>'. |
---|
562 | |
---|
563 | '<p class="field"><label for="user_edit_size">'.__('Entry edit field height:').'</label>'. |
---|
564 | form::field('user_edit_size',5,4,(integer) $user_options['edit_size']).'</p>'. |
---|
565 | |
---|
566 | '<p><label for="user_wysiwyg" class="classic">'. |
---|
567 | form::checkbox('user_wysiwyg',1,$user_options['enable_wysiwyg']).' '. |
---|
568 | __('Enable WYSIWYG mode').'</label></p>'. |
---|
569 | |
---|
570 | '<p><label for="user_toolbar_bottom" class="classic">'. |
---|
571 | form::checkbox('user_toolbar_bottom',1,$user_options['toolbar_bottom']).' '. |
---|
572 | __('Display editor\'s toolbar at bottom of textarea (if possible)').'</label></p>'. |
---|
573 | |
---|
574 | '</div>'; |
---|
575 | |
---|
576 | echo '<div class="two-boxes even">'; |
---|
577 | echo '<h5>'.__('Use xhtml editor for:').'</h5>'; |
---|
578 | foreach ($rte as $rk => $rv) { |
---|
579 | echo |
---|
580 | '<p><label for="rte_'.$rk.'" class="classic">'. |
---|
581 | form::checkbox(array('rte_flags[]','rte_'.$rk),$rk,$rv[0]).$rv[1].'</label>'; |
---|
582 | } |
---|
583 | echo '</div>'; |
---|
584 | |
---|
585 | echo '</div>'; // fieldset |
---|
586 | |
---|
587 | echo |
---|
588 | '<h4 class="pretty-title">'.__('Other options').'</h4>'; |
---|
589 | |
---|
590 | # --BEHAVIOR-- adminPreferencesForm |
---|
591 | $core->callBehavior('adminPreferencesForm',$core); |
---|
592 | |
---|
593 | echo |
---|
594 | '<p class="clear vertical-separator">'. |
---|
595 | $core->formNonce(). |
---|
596 | '<input type="submit" accesskey="s" value="'.__('Save my options').'" /></p>'. |
---|
597 | '</form>'; |
---|
598 | |
---|
599 | echo '</div>'; |
---|
600 | |
---|
601 | # My dashboard |
---|
602 | echo '<div class="multi-part" id="user-favorites" title="'.__('My dashboard').'">'; |
---|
603 | $ws = $core->auth->user_prefs->addWorkspace('favorites'); |
---|
604 | echo '<h3>'.__('My dashboard').'</h3>'; |
---|
605 | |
---|
606 | echo '<form action="'.$core->adminurl->get("admin.user.preferences").'" method="post" id="favs-form" class="two-boxes odd">'; |
---|
607 | |
---|
608 | echo '<div id="my-favs" class="fieldset"><h4>'.__('My favorites').'</h4>'; |
---|
609 | |
---|
610 | $count = 0; |
---|
611 | $user_fav = $core->favs->getFavoriteIDs(false); |
---|
612 | foreach ($user_fav as $id) { |
---|
613 | $fav = $core->favs->getFavorite($id); |
---|
614 | if ($fav != false) { |
---|
615 | // User favorites only |
---|
616 | if ($count == 0) echo '<ul class="fav-list">'; |
---|
617 | $count++; |
---|
618 | echo '<li id="fu-'.$id.'">'.'<label for="fuk-'.$id.'">'. |
---|
619 | '<img src="'.dc_admin_icon_url($fav['small-icon']).'" alt="" /> '.'<span class="zoom"><img src="'.dc_admin_icon_url($fav['large-icon']).'" alt="" /></span>'. |
---|
620 | form::field(array('order['.$id.']'),2,3,$count,'position','',false,'title="'.sprintf(__('position of %s'),$fav['title']).'"'). |
---|
621 | form::hidden(array('dynorder[]','dynorder-'.$id.''),$id). |
---|
622 | form::checkbox(array('remove[]','fuk-'.$id),$id).__($fav['title']).'</label>'. |
---|
623 | '</li>'; |
---|
624 | } |
---|
625 | } |
---|
626 | if ($count > 0) echo '</ul>'; |
---|
627 | if ($count > 0) { |
---|
628 | echo |
---|
629 | '<div class="clear">'. |
---|
630 | '<p>'.form::hidden('favs_order',''). |
---|
631 | $core->formNonce(). |
---|
632 | '<input type="submit" name="saveorder" value="'.__('Save order').'" /> '. |
---|
633 | |
---|
634 | '<input type="submit" class="delete" name="removeaction" '. |
---|
635 | 'value="'.__('Delete selected favorites').'" '. |
---|
636 | 'onclick="return window.confirm(\''.html::escapeJS( |
---|
637 | __('Are you sure you want to remove selected favorites?')).'\');" /></p>'. |
---|
638 | |
---|
639 | ($core->auth->isSuperAdmin() ? |
---|
640 | '<div class="info">'. |
---|
641 | '<p>'.__('If you are a super administrator, you may define this set of favorites to be used by default on all blogs of this installation.').'</p>'. |
---|
642 | '<p><input class="reset" type="submit" name="replace" value="'.__('Define as default favorites').'" />'.'</p>'. |
---|
643 | '</div>' |
---|
644 | : |
---|
645 | ''). |
---|
646 | |
---|
647 | '</div>'; |
---|
648 | } else { |
---|
649 | echo |
---|
650 | '<p>'.__('Currently no personal favorites.').'</p>'; |
---|
651 | } |
---|
652 | |
---|
653 | $avail_fav = $core->favs->getFavorites($core->favs->getAvailableFavoritesIDs()); |
---|
654 | $default_fav_ids = array(); |
---|
655 | foreach($core->favs->getFavoriteIDs(true) as $v) { |
---|
656 | $default_fav_ids[$v]=true; |
---|
657 | } |
---|
658 | echo '</div>'; # /box my-fav |
---|
659 | |
---|
660 | echo '<div class="fieldset" id="available-favs">'; |
---|
661 | # Available favorites |
---|
662 | echo '<h5 class="pretty-title">'.__('Other available favorites').'</h5>'; |
---|
663 | $count = 0; |
---|
664 | function cmp($a,$b) { |
---|
665 | if ($a['title'] == $b['title']) { |
---|
666 | return 0; |
---|
667 | } |
---|
668 | return ($a['title'] < $b['title']) ? -1 : 1; |
---|
669 | } |
---|
670 | uasort($avail_fav,'cmp'); |
---|
671 | |
---|
672 | foreach ($avail_fav as $k => $v) { |
---|
673 | if (in_array($k,$user_fav)) { |
---|
674 | unset($avail_fav[$k]); |
---|
675 | } |
---|
676 | } |
---|
677 | foreach ($avail_fav as $k=>$fav) { |
---|
678 | if ($count == 0) echo '<ul class="fav-list">'; |
---|
679 | $count++; |
---|
680 | echo '<li id="fa-'.$k.'">'.'<label for="fak-'.$k.'">'. |
---|
681 | '<img src="'.dc_admin_icon_url($fav['small-icon']).'" alt="" /> '. |
---|
682 | '<span class="zoom"><img src="'.dc_admin_icon_url($fav['large-icon']).'" alt="" /></span>'. |
---|
683 | form::checkbox(array('append[]','fak-'.$k),$k). |
---|
684 | $fav['title'].'</label>'. |
---|
685 | (isset($default_fav_ids[$k]) ? ' <span class="default-fav"><img src="images/selected.png" alt="'.__('(default favorite)').'" /></span>' : ''). |
---|
686 | '</li>'; |
---|
687 | } |
---|
688 | if ($count > 0) echo '</ul>'; |
---|
689 | echo |
---|
690 | '<p>'. |
---|
691 | $core->formNonce(). |
---|
692 | '<input type="submit" name="appendaction" value="'.__('Add to my favorites').'" /></p>'; |
---|
693 | echo '</div>'; # /available favorites |
---|
694 | |
---|
695 | echo '</form>'; |
---|
696 | |
---|
697 | echo |
---|
698 | '<form action="'.$core->adminurl->get("admin.user.preferences").'" method="post" id="db-forms" class="two-boxes even">'. |
---|
699 | |
---|
700 | '<div class="fieldset">'. |
---|
701 | '<h4>'.__('Menu').'</h4>'. |
---|
702 | '<p><label for="user_ui_nofavmenu" class="classic">'. |
---|
703 | form::checkbox('user_ui_nofavmenu',1,!$user_ui_nofavmenu).' '. |
---|
704 | __('Display favorites at the top of the menu').'</label></p></div>'; |
---|
705 | |
---|
706 | echo |
---|
707 | '<div class="fieldset">'. |
---|
708 | '<h4>'.__('Dashboard icons').'</h4>'. |
---|
709 | '<p><label for="user_dm_nofavicons" class="classic">'. |
---|
710 | form::checkbox('user_dm_nofavicons',1,!$user_dm_nofavicons).' '. |
---|
711 | __('Display dashboard icons').'</label></p>'; |
---|
712 | |
---|
713 | if (count($iconsets_combo) > 1) { |
---|
714 | echo |
---|
715 | '<p><label for="user_ui_iconset" class="classic">'.__('Iconset:').'</label> '. |
---|
716 | form::combo('user_ui_iconset',$iconsets_combo,$user_ui_iconset).'</p>'; |
---|
717 | } else { |
---|
718 | echo '<p class="hidden">'.form::hidden('user_ui_iconset','').'</p>'; |
---|
719 | } |
---|
720 | echo |
---|
721 | '</div>'; |
---|
722 | |
---|
723 | echo |
---|
724 | '<div class="fieldset">'. |
---|
725 | '<h4>'.__('Dashboard modules').'</h4>'. |
---|
726 | |
---|
727 | '<p><label for="user_dm_doclinks" class="classic">'. |
---|
728 | form::checkbox('user_dm_doclinks',1,$user_dm_doclinks).' '. |
---|
729 | __('Display documentation links').'</label></p>'. |
---|
730 | |
---|
731 | '<p><label for="user_dm_dcnews" class="classic">'. |
---|
732 | form::checkbox('user_dm_dcnews',1,$user_dm_dcnews).' '. |
---|
733 | __('Display Dotclear news').'</label></p>'. |
---|
734 | |
---|
735 | '<p><label for="user_dm_quickentry" class="classic">'. |
---|
736 | form::checkbox('user_dm_quickentry',1,$user_dm_quickentry).' '. |
---|
737 | __('Display quick entry form').'</label><br class="clear" />'. //Opera sucks |
---|
738 | '</p>'; |
---|
739 | echo '</div>'; |
---|
740 | |
---|
741 | # --BEHAVIOR-- adminDashboardOptionsForm |
---|
742 | $core->callBehavior('adminDashboardOptionsForm',$core); |
---|
743 | |
---|
744 | echo |
---|
745 | '<p>'. |
---|
746 | form::hidden('db-options','-'). |
---|
747 | $core->formNonce(). |
---|
748 | '<input type="submit" accesskey="s" value="'.__('Save my dashboard options').'" /></p>'. |
---|
749 | '</form>'; |
---|
750 | |
---|
751 | echo '</div>'; # /multipart-user-favorites |
---|
752 | |
---|
753 | dcPage::helpBlock('core_user_pref'); |
---|
754 | dcPage::close(); |
---|