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