[0] | 1 | <?php |
---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
| 3 | # |
---|
| 4 | # This file is part of Dotclear 2. |
---|
| 5 | # |
---|
[2682] | 6 | # Copyright (c) 2003-2014 Olivier Meunier & Association Dotclear |
---|
[0] | 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 | |
---|
[3] | 17 | $page_title = __('My preferences'); |
---|
[0] | 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(); |
---|
[2736] | 29 | if (empty($user_options['editor']) || !is_array($user_options['editor'])) { |
---|
| 30 | $user_options['editor'] = array(); |
---|
[2679] | 31 | } |
---|
[0] | 32 | |
---|
[13] | 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; |
---|
[3238] | 37 | $user_dm_nofavicons = $core->auth->user_prefs->dashboard->nofavicons; |
---|
[13] | 38 | |
---|
[160] | 39 | $core->auth->user_prefs->addWorkspace('accessibility'); |
---|
[240] | 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; |
---|
[244] | 44 | if ($core->auth->isSuperAdmin()) { |
---|
| 45 | $user_ui_hide_std_favicon = $core->auth->user_prefs->interface->hide_std_favicon; |
---|
| 46 | } |
---|
[692] | 47 | $user_ui_iconset = @$core->auth->user_prefs->interface->iconset; |
---|
[821] | 48 | $user_ui_nofavmenu = $core->auth->user_prefs->interface->nofavmenu; |
---|
[2021] | 49 | $user_ui_media_by_page = ($core->auth->user_prefs->interface->media_by_page ? $core->auth->user_prefs->interface->media_by_page : 30); |
---|
[3136] | 50 | $user_ui_media_nb_last_dirs = $core->auth->user_prefs->interface->media_nb_last_dirs; |
---|
[160] | 51 | |
---|
[247] | 52 | $default_tab = !empty($_GET['tab']) ? html::escapeHTML($_GET['tab']) : 'user-profile'; |
---|
[3] | 53 | |
---|
[2566] | 54 | if (!empty($_GET['append']) || !empty($_GET['removed']) || !empty($_GET['neworder']) || |
---|
| 55 | !empty($_GET['replaced']) || !empty($_POST['appendaction']) || !empty($_POST['removeaction']) || |
---|
[1762] | 56 | !empty($_GET['db-updated'])) { |
---|
[3] | 57 | $default_tab = 'user-favorites'; |
---|
[13] | 58 | } elseif (!empty($_GET['updated'])) { |
---|
| 59 | $default_tab = 'user-options'; |
---|
[3] | 60 | } |
---|
[247] | 61 | if (($default_tab != 'user-profile') && ($default_tab != 'user-options') && ($default_tab != 'user-favorites')) { |
---|
| 62 | $default_tab = 'user-profile'; |
---|
| 63 | } |
---|
[3] | 64 | |
---|
[2679] | 65 | # Editors combo |
---|
| 66 | $editors_combo = dcAdminCombos::getEditorsCombo(); |
---|
| 67 | $editors = array_keys($editors_combo); |
---|
| 68 | |
---|
[2736] | 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 | } |
---|
[2679] | 76 | } |
---|
[2736] | 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 | } |
---|
[1719] | 84 | $status_combo = dcAdminCombos::getPostStatusescombo(); |
---|
[0] | 85 | |
---|
[692] | 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) { |
---|
[1773] | 91 | if ($entry != '.' && $entry != '..' && substr($entry, 0, 1) != '.' && is_dir($iconsets_root.'/'.$entry)) { |
---|
[692] | 92 | $iconsets_combo[$entry] = $entry; |
---|
| 93 | } |
---|
| 94 | } |
---|
| 95 | } |
---|
| 96 | } |
---|
| 97 | |
---|
[0] | 98 | # Language codes |
---|
[1719] | 99 | $lang_combo = dcAdminCombos::getAdminLangsCombo(); |
---|
[0] | 100 | |
---|
[3330] | 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 | |
---|
[3265] | 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 | |
---|
[0] | 142 | # Add or update user |
---|
| 143 | if (isset($_POST['user_name'])) |
---|
| 144 | { |
---|
| 145 | try |
---|
| 146 | { |
---|
[3036] | 147 | $pwd_check = !empty($_POST['cur_pwd']) && $core->auth->checkPassword($core->auth->crypt($_POST['cur_pwd'])); |
---|
[2566] | 148 | |
---|
[0] | 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 | } |
---|
[2566] | 152 | |
---|
[0] | 153 | $cur = $core->con->openCursor($core->prefix.'user'); |
---|
[2566] | 154 | |
---|
[0] | 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']; |
---|
[13] | 162 | |
---|
[0] | 163 | $cur->user_options = new ArrayObject($user_options); |
---|
[2566] | 164 | |
---|
[0] | 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 | } |
---|
[2566] | 170 | |
---|
[0] | 171 | if ($_POST['new_pwd'] != $_POST['new_pwd_c']) { |
---|
| 172 | throw new Exception(__("Passwords don't match")); |
---|
| 173 | } |
---|
[2566] | 174 | |
---|
[0] | 175 | $cur->user_pwd = $_POST['new_pwd']; |
---|
| 176 | } |
---|
[2566] | 177 | |
---|
[0] | 178 | # --BEHAVIOR-- adminBeforeUserUpdate |
---|
[13] | 179 | $core->callBehavior('adminBeforeUserProfileUpdate',$cur,$core->auth->userID()); |
---|
[2566] | 180 | |
---|
[13] | 181 | # Udate user |
---|
| 182 | $core->updUser($core->auth->userID(),$cur); |
---|
[2566] | 183 | |
---|
[13] | 184 | # --BEHAVIOR-- adminAfterUserUpdate |
---|
| 185 | $core->callBehavior('adminAfterUserProfileUpdate',$cur,$core->auth->userID()); |
---|
[2566] | 186 | |
---|
[2256] | 187 | dcPage::addSuccessNotice(__('Personal information has been successfully updated.')); |
---|
| 188 | |
---|
[2852] | 189 | $core->adminurl->redirect("admin.user.preferences"); |
---|
[13] | 190 | } |
---|
| 191 | catch (Exception $e) |
---|
| 192 | { |
---|
| 193 | $core->error->add($e->getMessage()); |
---|
| 194 | } |
---|
| 195 | } |
---|
| 196 | |
---|
| 197 | # Update user options |
---|
[2736] | 198 | if (isset($_POST['user_editor'])) |
---|
[590] | 199 | { |
---|
[13] | 200 | try |
---|
| 201 | { |
---|
| 202 | $cur = $core->con->openCursor($core->prefix.'user'); |
---|
[2566] | 203 | |
---|
[13] | 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']; |
---|
[2566] | 213 | |
---|
[13] | 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']; |
---|
[2679] | 219 | $user_options['editor'] = $_POST['user_editor']; |
---|
[13] | 220 | $user_options['enable_wysiwyg'] = !empty($_POST['user_wysiwyg']); |
---|
[3003] | 221 | $user_options['toolbar_bottom'] = !empty($_POST['user_toolbar_bottom']); |
---|
[2566] | 222 | |
---|
[13] | 223 | $cur->user_options = new ArrayObject($user_options); |
---|
[2566] | 224 | |
---|
[897] | 225 | # --BEHAVIOR-- adminBeforeUserOptionsUpdate |
---|
| 226 | $core->callBehavior('adminBeforeUserOptionsUpdate',$cur,$core->auth->userID()); |
---|
[2566] | 227 | |
---|
[13] | 228 | # Update user prefs |
---|
[240] | 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'); |
---|
[244] | 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 | } |
---|
[2021] | 235 | $core->auth->user_prefs->interface->put('media_by_page',(integer)$_POST['user_ui_media_by_page'],'integer'); |
---|
[3136] | 236 | $core->auth->user_prefs->interface->put('media_nb_last_dirs',(integer)$_POST['user_ui_media_nb_last_dirs'],'integer'); |
---|
[3198] | 237 | $core->auth->user_prefs->interface->put('media_last_dirs',array(),'array',null,false); |
---|
[3245] | 238 | $core->auth->user_prefs->interface->put('media_fav_dirs',array(),'array',null,false); |
---|
[2566] | 239 | |
---|
[3265] | 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 | |
---|
[3330] | 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 | |
---|
[3136] | 260 | # Update user |
---|
[0] | 261 | $core->updUser($core->auth->userID(),$cur); |
---|
[2566] | 262 | |
---|
[897] | 263 | # --BEHAVIOR-- adminAfterUserOptionsUpdate |
---|
| 264 | $core->callBehavior('adminAfterUserOptionsUpdate',$cur,$core->auth->userID()); |
---|
[2566] | 265 | |
---|
[2256] | 266 | dcPage::addSuccessNotice(__('Personal options has been successfully updated.')); |
---|
[2853] | 267 | $core->adminurl->redirect("admin.user.preferences",array(),'#user-options'); |
---|
[0] | 268 | } |
---|
| 269 | catch (Exception $e) |
---|
| 270 | { |
---|
| 271 | $core->error->add($e->getMessage()); |
---|
| 272 | } |
---|
| 273 | } |
---|
| 274 | |
---|
[1762] | 275 | # Dashboard options |
---|
| 276 | if (isset($_POST['db-options'])) { |
---|
| 277 | try |
---|
| 278 | { |
---|
| 279 | # --BEHAVIOR-- adminBeforeUserOptionsUpdate |
---|
| 280 | $core->callBehavior('adminBeforeDashboardOptionsUpdate',$core->auth->userID()); |
---|
[2566] | 281 | |
---|
[1762] | 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'); |
---|
[3238] | 286 | $core->auth->user_prefs->dashboard->put('nofavicons',empty($_POST['user_dm_nofavicons']),'boolean'); |
---|
[1762] | 287 | $core->auth->user_prefs->interface->put('iconset',(!empty($_POST['user_ui_iconset']) ? $_POST['user_ui_iconset'] : '')); |
---|
[1763] | 288 | $core->auth->user_prefs->interface->put('nofavmenu',empty($_POST['user_ui_nofavmenu']),'boolean'); |
---|
[2566] | 289 | |
---|
[1762] | 290 | # --BEHAVIOR-- adminAfterUserOptionsUpdate |
---|
| 291 | $core->callBehavior('adminAfterDashboardOptionsUpdate',$core->auth->userID()); |
---|
[2566] | 292 | |
---|
[2256] | 293 | dcPage::addSuccessNotice(__('Dashboard options has been successfully updated.')); |
---|
[2853] | 294 | $core->adminurl->redirect("admin.user.preferences",array(),'#user-favorites'); |
---|
[1762] | 295 | } |
---|
| 296 | catch (Exception $e) |
---|
| 297 | { |
---|
| 298 | $core->error->add($e->getMessage()); |
---|
| 299 | } |
---|
| 300 | } |
---|
| 301 | |
---|
[3] | 302 | # Add selected favorites |
---|
[2566] | 303 | if (!empty($_POST['appendaction'])) |
---|
[590] | 304 | { |
---|
| 305 | try { |
---|
| 306 | if (empty($_POST['append'])) { |
---|
| 307 | throw new Exception(__('No favorite selected')); |
---|
| 308 | } |
---|
[2229] | 309 | $user_favs = $core->favs->getFavoriteIDs(false); |
---|
[590] | 310 | foreach ($_POST['append'] as $k => $v) |
---|
| 311 | { |
---|
[2229] | 312 | if ($core->favs->exists($v)) { |
---|
| 313 | $user_favs[] = $v; |
---|
[590] | 314 | } |
---|
| 315 | } |
---|
[2229] | 316 | $core->favs->setFavoriteIDs($user_favs,false); |
---|
| 317 | |
---|
[590] | 318 | if (!$core->error->flag()) { |
---|
[2256] | 319 | dcPage::addSuccessNotice(__('Favorites have been successfully added.')); |
---|
[2853] | 320 | $core->adminurl->redirect("admin.user.preferences",array(),'#user-favorites'); |
---|
[590] | 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 | } |
---|
[2229] | 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) |
---|
[590] | 339 | { |
---|
[2229] | 340 | if (isset($user_fav_ids[$v])) { |
---|
| 341 | unset($user_fav_ids[$v]); |
---|
[590] | 342 | } |
---|
| 343 | } |
---|
[2229] | 344 | $core->favs->setFavoriteIDs(array_keys($user_fav_ids),false); |
---|
[590] | 345 | if (!$core->error->flag()) { |
---|
[2256] | 346 | dcPage::addSuccessNotice(__('Favorites have been successfully removed.')); |
---|
[2853] | 347 | $core->adminurl->redirect("admin.user.preferences",array(),'#user-favorites'); |
---|
[3] | 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 | { |
---|
[2229] | 366 | foreach ($order as $k => $v) { |
---|
| 367 | if (!$core->favs->exists($v)) { |
---|
| 368 | unset($order[$k]); |
---|
[3] | 369 | } |
---|
[2566] | 370 | } |
---|
[2229] | 371 | $core->favs->setFavoriteIDs($order,false); |
---|
[3] | 372 | if (!$core->error->flag()) { |
---|
[2256] | 373 | dcPage::addSuccessNotice(__('Favorites have been successfully updated.')); |
---|
[2853] | 374 | $core->adminurl->redirect("admin.user.preferences",array(),'#user-favorites'); |
---|
[3] | 375 | } |
---|
| 376 | } |
---|
| 377 | |
---|
[30] | 378 | # Replace default favorites by current set (super admin only) |
---|
| 379 | if (!empty($_POST['replace']) && $core->auth->isSuperAdmin()) { |
---|
[2229] | 380 | $user_favs = $core->favs->getFavoriteIDs(false); |
---|
| 381 | $core->favs->setFavoriteIDs($user_favs,true); |
---|
[30] | 382 | |
---|
| 383 | if (!$core->error->flag()) { |
---|
[2256] | 384 | dcPage::addSuccessNotice(__('Default favorites have been successfully updated.')); |
---|
[2853] | 385 | $core->adminurl->redirect("admin.user.preferences",array(),'#user-favorites'); |
---|
[30] | 386 | } |
---|
| 387 | } |
---|
[0] | 388 | |
---|
| 389 | /* DISPLAY |
---|
| 390 | -------------------------------------------------------- */ |
---|
| 391 | dcPage::open($page_title, |
---|
| 392 | dcPage::jsLoad('js/_preferences.js'). |
---|
[240] | 393 | ($user_acc_nodragdrop ? '' : dcPage::jsLoad('js/_preferences-dragdrop.js')). |
---|
[906] | 394 | dcPage::jsLoad('js/jquery/jquery-ui.custom.js'). |
---|
[2495] | 395 | dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js'). |
---|
[1368] | 396 | dcPage::jsLoad('js/jquery/jquery.pwstrength.js'). |
---|
| 397 | '<script type="text/javascript">'."\n". |
---|
| 398 | "//<![CDATA[\n". |
---|
| 399 | "\$(function() {\n". |
---|
[1375] | 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". |
---|
[2736] | 406 | "});". |
---|
[1368] | 407 | "\n//]]>\n". |
---|
| 408 | "</script>\n". |
---|
[3] | 409 | dcPage::jsPageTabs($default_tab). |
---|
[0] | 410 | dcPage::jsConfirmClose('user-form'). |
---|
[2566] | 411 | |
---|
[0] | 412 | # --BEHAVIOR-- adminPreferencesHeaders |
---|
[1358] | 413 | $core->callBehavior('adminPreferencesHeaders'), |
---|
| 414 | |
---|
| 415 | dcPage::breadcrumb( |
---|
| 416 | array( |
---|
| 417 | html::escapeHTML($core->auth->userID()) => '', |
---|
[2166] | 418 | $page_title => '' |
---|
[1358] | 419 | )) |
---|
[0] | 420 | ); |
---|
| 421 | |
---|
[3] | 422 | # User profile |
---|
| 423 | echo '<div class="multi-part" id="user-profile" title="'.__('My profile').'">'; |
---|
[0] | 424 | |
---|
| 425 | echo |
---|
[1786] | 426 | '<h3>'.__('My profile').'</h3>'. |
---|
[2720] | 427 | '<form action="'.$core->adminurl->get("admin.user.preferences").'" method="post" id="user-form">'. |
---|
[1609] | 428 | |
---|
[1399] | 429 | '<p><label for="user_name">'.__('Last Name:').'</label>'. |
---|
| 430 | form::field('user_name',20,255,html::escapeHTML($user_name)).'</p>'. |
---|
[0] | 431 | |
---|
[1399] | 432 | '<p><label for="user_firstname">'.__('First Name:').'</label>'. |
---|
| 433 | form::field('user_firstname',20,255,html::escapeHTML($user_firstname)).'</p>'. |
---|
[0] | 434 | |
---|
[1399] | 435 | '<p><label for="user_displayname">'.__('Display name:').'</label>'. |
---|
| 436 | form::field('user_displayname',20,255,html::escapeHTML($user_displayname)).'</p>'. |
---|
[0] | 437 | |
---|
[1399] | 438 | '<p><label for="user_email">'.__('Email:').'</label>'. |
---|
| 439 | form::field('user_email',20,255,html::escapeHTML($user_email)).'</p>'. |
---|
[0] | 440 | |
---|
[1399] | 441 | '<p><label for="user_url">'.__('URL:').'</label>'. |
---|
[1726] | 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 | |
---|
[0] | 450 | |
---|
| 451 | if ($core->auth->allowPassChange()) |
---|
| 452 | { |
---|
| 453 | echo |
---|
[1786] | 454 | '<h4 class="vertical-separator pretty-title">'.__('Change my password').'</h4>'. |
---|
[2566] | 455 | |
---|
[1375] | 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>'. |
---|
[1468] | 459 | '<div id="pwindicator">'. |
---|
| 460 | ' <div class="bar"></div>'. |
---|
| 461 | ' <p class="label no-margin"></p>'. |
---|
| 462 | '</div>'. |
---|
| 463 | '</div>'. |
---|
[2566] | 464 | |
---|
[1474] | 465 | '<p><label for="new_pwd_c">'.__('Confirm new password:').'</label>'. |
---|
[1375] | 466 | form::password('new_pwd_c',20,255).'</p>'. |
---|
[2566] | 467 | |
---|
[1609] | 468 | '<p><label for="cur_pwd">'.__('Your current password:').'</label>'. |
---|
[1607] | 469 | form::password('cur_pwd',20,255).'</p>'. |
---|
[1609] | 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>'; |
---|
[0] | 473 | } |
---|
| 474 | |
---|
| 475 | echo |
---|
[1609] | 476 | '<p class="clear vertical-separator">'. |
---|
[0] | 477 | $core->formNonce(). |
---|
[1609] | 478 | '<input type="submit" accesskey="s" value="'.__('Update my profile').'" /></p>'. |
---|
| 479 | '</form>'. |
---|
[0] | 480 | |
---|
[1609] | 481 | '</div>'; |
---|
[3] | 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 |
---|
[2720] | 487 | '<form action="'.$core->adminurl->get("admin.user.preferences").'#user-options" method="post" id="opts-forms">'. |
---|
[1786] | 488 | '<h3>'.__('My options').'</h3>'; |
---|
[3] | 489 | |
---|
[1609] | 490 | echo |
---|
[1786] | 491 | '<div class="fieldset">'. |
---|
[1609] | 492 | '<h4>'.__('Interface').'</h4>'. |
---|
| 493 | |
---|
| 494 | '<p><label for="user_ui_enhanceduploader" class="classic">'. |
---|
| 495 | form::checkbox('user_ui_enhanceduploader',1,$user_ui_enhanceduploader).' '. |
---|
[1786] | 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>'; |
---|
[1609] | 502 | |
---|
[2021] | 503 | echo |
---|
[2206] | 504 | '<p><label for="user_ui_media_by_page" class="classic">'.__('Number of elements displayed per page in media manager:').'</label> '. |
---|
[2021] | 505 | form::field('user_ui_media_by_page',5,3,(integer) $user_ui_media_by_page).'</p>'; |
---|
| 506 | |
---|
[3136] | 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 | |
---|
[1609] | 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).' '. |
---|
[1786] | 516 | __('Do not use standard favicon').'</label> '. |
---|
| 517 | '<span class="clear form-note warn">'.__('This will be applied for all users').'.</span>'. |
---|
[1609] | 518 | '</p>';//Opera sucks; |
---|
| 519 | } |
---|
| 520 | |
---|
| 521 | echo |
---|
[1786] | 522 | '</div>'; |
---|
[1609] | 523 | |
---|
| 524 | echo |
---|
[1786] | 525 | '<div class="fieldset">'. |
---|
[3265] | 526 | '<h4>'.__('Optional columns displayed in lists').'</h4>'; |
---|
[3330] | 527 | $odd = true; |
---|
[3265] | 528 | foreach ($cols as $col_type => $col_list) { |
---|
[3330] | 529 | echo '<div class="two-boxes '.($odd ? 'odd' : 'even').'">'; |
---|
[3265] | 530 | echo '<h5>'.$col_list[0].'</h5>'; |
---|
| 531 | foreach ($col_list[1] as $col_name => $col_data) { |
---|
| 532 | echo |
---|
[3330] | 533 | '<p><label for="cols_'.$col_type.'-'.$col_name.'" class="classic">'. |
---|
[3265] | 534 | form::checkbox(array('cols_'.$col_type.'[]','cols_'.$col_type.'-'.$col_name),$col_name,$col_data[0]).$col_data[1].'</label>'; |
---|
| 535 | } |
---|
[3330] | 536 | echo '</div>'; |
---|
| 537 | $odd = !$odd; |
---|
[3265] | 538 | } |
---|
| 539 | echo '</div>'; |
---|
| 540 | |
---|
| 541 | echo |
---|
| 542 | '<div class="fieldset">'. |
---|
[2736] | 543 | '<h4>'.__('Edition').'</h4>'; |
---|
[1609] | 544 | |
---|
[3330] | 545 | echo '<div class="two-boxes odd">'; |
---|
[2736] | 546 | foreach ($format_by_editors as $format => $editors) { |
---|
| 547 | echo |
---|
[2757] | 548 | '<p class="field"><label for="user_editor_'.$format.'">'.sprintf(__('Preferred editor for %s:'),$format).'</label>'. |
---|
[2736] | 549 | form::combo( |
---|
[2757] | 550 | array('user_editor['.$format.']', 'user_editor_'.$format), |
---|
| 551 | array_merge(array(__('Choose an editor') => ''),$editors), |
---|
| 552 | $user_options['editor'][$format] |
---|
[2736] | 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>'; |
---|
[2679] | 558 | |
---|
[2736] | 559 | echo |
---|
[1786] | 560 | '<p class="field"><label for="user_post_status">'.__('Default entry status:').'</label>'. |
---|
[1399] | 561 | form::combo('user_post_status',$status_combo,$user_post_status).'</p>'. |
---|
[3] | 562 | |
---|
[1786] | 563 | '<p class="field"><label for="user_edit_size">'.__('Entry edit field height:').'</label>'. |
---|
[1399] | 564 | form::field('user_edit_size',5,4,(integer) $user_options['edit_size']).'</p>'. |
---|
[3] | 565 | |
---|
| 566 | '<p><label for="user_wysiwyg" class="classic">'. |
---|
[454] | 567 | form::checkbox('user_wysiwyg',1,$user_options['enable_wysiwyg']).' '. |
---|
[1786] | 568 | __('Enable WYSIWYG mode').'</label></p>'. |
---|
| 569 | |
---|
[3003] | 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 | |
---|
[1786] | 574 | '</div>'; |
---|
[240] | 575 | |
---|
[3330] | 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 | |
---|
[1609] | 587 | echo |
---|
[1786] | 588 | '<h4 class="pretty-title">'.__('Other options').'</h4>'; |
---|
[1609] | 589 | |
---|
| 590 | # --BEHAVIOR-- adminPreferencesForm |
---|
| 591 | $core->callBehavior('adminPreferencesForm',$core); |
---|
| 592 | |
---|
| 593 | echo |
---|
[1786] | 594 | '<p class="clear vertical-separator">'. |
---|
[3] | 595 | $core->formNonce(). |
---|
[1609] | 596 | '<input type="submit" accesskey="s" value="'.__('Save my options').'" /></p>'. |
---|
[3] | 597 | '</form>'; |
---|
| 598 | |
---|
| 599 | echo '</div>'; |
---|
| 600 | |
---|
[1763] | 601 | # My dashboard |
---|
[1762] | 602 | echo '<div class="multi-part" id="user-favorites" title="'.__('My dashboard').'">'; |
---|
[3] | 603 | $ws = $core->auth->user_prefs->addWorkspace('favorites'); |
---|
[1941] | 604 | echo '<h3>'.__('My dashboard').'</h3>'; |
---|
[1609] | 605 | |
---|
[2720] | 606 | echo '<form action="'.$core->adminurl->get("admin.user.preferences").'" method="post" id="favs-form" class="two-boxes odd">'; |
---|
[1763] | 607 | |
---|
| 608 | echo '<div id="my-favs" class="fieldset"><h4>'.__('My favorites').'</h4>'; |
---|
[32] | 609 | |
---|
[3] | 610 | $count = 0; |
---|
[2229] | 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>'; |
---|
[3] | 624 | } |
---|
| 625 | } |
---|
| 626 | if ($count > 0) echo '</ul>'; |
---|
| 627 | if ($count > 0) { |
---|
| 628 | echo |
---|
| 629 | '<div class="clear">'. |
---|
[82] | 630 | '<p>'.form::hidden('favs_order',''). |
---|
[3] | 631 | $core->formNonce(). |
---|
[114] | 632 | '<input type="submit" name="saveorder" value="'.__('Save order').'" /> '. |
---|
| 633 | |
---|
| 634 | '<input type="submit" class="delete" name="removeaction" '. |
---|
[3] | 635 | 'value="'.__('Delete selected favorites').'" '. |
---|
| 636 | 'onclick="return window.confirm(\''.html::escapeJS( |
---|
| 637 | __('Are you sure you want to remove selected favorites?')).'\');" /></p>'. |
---|
[82] | 638 | |
---|
[1924] | 639 | ($core->auth->isSuperAdmin() ? |
---|
[1763] | 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>'. |
---|
[1924] | 642 | '<p><input class="reset" type="submit" name="replace" value="'.__('Define as default favorites').'" />'.'</p>'. |
---|
| 643 | '</div>' |
---|
| 644 | : |
---|
[114] | 645 | ''). |
---|
[1924] | 646 | |
---|
[3] | 647 | '</div>'; |
---|
| 648 | } else { |
---|
| 649 | echo |
---|
| 650 | '<p>'.__('Currently no personal favorites.').'</p>'; |
---|
| 651 | } |
---|
| 652 | |
---|
[2229] | 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; |
---|
[1773] | 657 | } |
---|
[1763] | 658 | echo '</div>'; # /box my-fav |
---|
[1609] | 659 | |
---|
[1763] | 660 | echo '<div class="fieldset" id="available-favs">'; |
---|
[1773] | 661 | # Available favorites |
---|
[1786] | 662 | echo '<h5 class="pretty-title">'.__('Other available favorites').'</h5>'; |
---|
[3] | 663 | $count = 0; |
---|
| 664 | function cmp($a,$b) { |
---|
[2229] | 665 | if ($a['title'] == $b['title']) { |
---|
[3] | 666 | return 0; |
---|
| 667 | } |
---|
[2229] | 668 | return ($a['title'] < $b['title']) ? -1 : 1; |
---|
[3] | 669 | } |
---|
[2229] | 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]); |
---|
[3] | 675 | } |
---|
[1773] | 676 | } |
---|
[2229] | 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 | } |
---|
[3] | 688 | if ($count > 0) echo '</ul>'; |
---|
| 689 | echo |
---|
| 690 | '<p>'. |
---|
| 691 | $core->formNonce(). |
---|
[114] | 692 | '<input type="submit" name="appendaction" value="'.__('Add to my favorites').'" /></p>'; |
---|
[1763] | 693 | echo '</div>'; # /available favorites |
---|
[1609] | 694 | |
---|
[3] | 695 | echo '</form>'; |
---|
[1762] | 696 | |
---|
| 697 | echo |
---|
[2720] | 698 | '<form action="'.$core->adminurl->get("admin.user.preferences").'" method="post" id="db-forms" class="two-boxes even">'. |
---|
[1762] | 699 | |
---|
[1763] | 700 | '<div class="fieldset">'. |
---|
[1786] | 701 | '<h4>'.__('Menu').'</h4>'. |
---|
[1762] | 702 | '<p><label for="user_ui_nofavmenu" class="classic">'. |
---|
[1763] | 703 | form::checkbox('user_ui_nofavmenu',1,!$user_ui_nofavmenu).' '. |
---|
| 704 | __('Display favorites at the top of the menu').'</label></p></div>'; |
---|
[1762] | 705 | |
---|
[3238] | 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 | |
---|
[1762] | 713 | if (count($iconsets_combo) > 1) { |
---|
[2566] | 714 | echo |
---|
[1762] | 715 | '<p><label for="user_ui_iconset" class="classic">'.__('Iconset:').'</label> '. |
---|
[3238] | 716 | form::combo('user_ui_iconset',$iconsets_combo,$user_ui_iconset).'</p>'; |
---|
[1762] | 717 | } else { |
---|
[2449] | 718 | echo '<p class="hidden">'.form::hidden('user_ui_iconset','').'</p>'; |
---|
[1762] | 719 | } |
---|
[3238] | 720 | echo |
---|
| 721 | '</div>'; |
---|
[1762] | 722 | |
---|
| 723 | echo |
---|
[1763] | 724 | '<div class="fieldset">'. |
---|
[1786] | 725 | '<h4>'.__('Dashboard modules').'</h4>'. |
---|
[1762] | 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>'; |
---|
[1764] | 739 | echo '</div>'; |
---|
[1762] | 740 | |
---|
| 741 | # --BEHAVIOR-- adminDashboardOptionsForm |
---|
| 742 | $core->callBehavior('adminDashboardOptionsForm',$core); |
---|
| 743 | |
---|
| 744 | echo |
---|
[1763] | 745 | '<p>'. |
---|
[1762] | 746 | form::hidden('db-options','-'). |
---|
| 747 | $core->formNonce(). |
---|
| 748 | '<input type="submit" accesskey="s" value="'.__('Save my dashboard options').'" /></p>'. |
---|
| 749 | '</form>'; |
---|
| 750 | |
---|
[1763] | 751 | echo '</div>'; # /multipart-user-favorites |
---|
[3] | 752 | |
---|
[0] | 753 | dcPage::helpBlock('core_user_pref'); |
---|
| 754 | dcPage::close(); |
---|