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