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