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