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