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