[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(); |
---|
[2679] | 29 | if (empty($user_options['editor'])) { |
---|
| 30 | $user_options['editor'] = ''; |
---|
| 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); |
---|
[160] | 49 | |
---|
[247] | 50 | $default_tab = !empty($_GET['tab']) ? html::escapeHTML($_GET['tab']) : 'user-profile'; |
---|
[3] | 51 | |
---|
[2566] | 52 | if (!empty($_GET['append']) || !empty($_GET['removed']) || !empty($_GET['neworder']) || |
---|
| 53 | !empty($_GET['replaced']) || !empty($_POST['appendaction']) || !empty($_POST['removeaction']) || |
---|
[1762] | 54 | !empty($_GET['db-updated'])) { |
---|
[3] | 55 | $default_tab = 'user-favorites'; |
---|
[13] | 56 | } elseif (!empty($_GET['updated'])) { |
---|
| 57 | $default_tab = 'user-options'; |
---|
[3] | 58 | } |
---|
[247] | 59 | if (($default_tab != 'user-profile') && ($default_tab != 'user-options') && ($default_tab != 'user-favorites')) { |
---|
| 60 | $default_tab = 'user-profile'; |
---|
| 61 | } |
---|
[3] | 62 | |
---|
[2679] | 63 | # Editors combo |
---|
| 64 | $editors_combo = dcAdminCombos::getEditorsCombo(); |
---|
| 65 | $editors = array_keys($editors_combo); |
---|
| 66 | |
---|
[1719] | 67 | # Formaters combo |
---|
| 68 | $formaters_combo = dcAdminCombos::getFormatersCombo(); |
---|
[2694] | 69 | $formaters_combo_editor = array(); |
---|
[0] | 70 | |
---|
[2682] | 71 | if (!empty($user_options['editor']) && !empty($formaters_combo[$user_options['editor']])) { |
---|
[2679] | 72 | $formaters_combo_editor = $formaters_combo[$user_options['editor']]; |
---|
| 73 | } elseif (count($editors)!=0) { |
---|
| 74 | $formaters_combo_editor = $formaters_combo[$editors[0]]; |
---|
| 75 | } else { |
---|
| 76 | $formaters_combo = array(); |
---|
| 77 | } |
---|
| 78 | |
---|
[1719] | 79 | $status_combo = dcAdminCombos::getPostStatusescombo(); |
---|
[0] | 80 | |
---|
[692] | 81 | $iconsets_combo = array(__('Default') => ''); |
---|
| 82 | $iconsets_root = dirname(__FILE__).'/images/iconset/'; |
---|
| 83 | if (is_dir($iconsets_root) && is_readable($iconsets_root)) { |
---|
| 84 | if (($d = @dir($iconsets_root)) !== false) { |
---|
| 85 | while (($entry = $d->read()) !== false) { |
---|
[1773] | 86 | if ($entry != '.' && $entry != '..' && substr($entry, 0, 1) != '.' && is_dir($iconsets_root.'/'.$entry)) { |
---|
[692] | 87 | $iconsets_combo[$entry] = $entry; |
---|
| 88 | } |
---|
| 89 | } |
---|
| 90 | } |
---|
| 91 | } |
---|
| 92 | |
---|
[0] | 93 | # Language codes |
---|
[1719] | 94 | $lang_combo = dcAdminCombos::getAdminLangsCombo(); |
---|
[0] | 95 | |
---|
| 96 | # Add or update user |
---|
| 97 | if (isset($_POST['user_name'])) |
---|
| 98 | { |
---|
| 99 | try |
---|
| 100 | { |
---|
| 101 | $pwd_check = !empty($_POST['cur_pwd']) && $core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY,$_POST['cur_pwd'])); |
---|
[2566] | 102 | |
---|
[0] | 103 | if ($core->auth->allowPassChange() && !$pwd_check && $user_email != $_POST['user_email']) { |
---|
| 104 | throw new Exception(__('If you want to change your email or password you must provide your current password.')); |
---|
| 105 | } |
---|
[2566] | 106 | |
---|
[0] | 107 | $cur = $core->con->openCursor($core->prefix.'user'); |
---|
[2566] | 108 | |
---|
[0] | 109 | $cur->user_name = $user_name = $_POST['user_name']; |
---|
| 110 | $cur->user_firstname = $user_firstname = $_POST['user_firstname']; |
---|
| 111 | $cur->user_displayname = $user_displayname = $_POST['user_displayname']; |
---|
| 112 | $cur->user_email = $user_email = $_POST['user_email']; |
---|
| 113 | $cur->user_url = $user_url = $_POST['user_url']; |
---|
| 114 | $cur->user_lang = $user_lang = $_POST['user_lang']; |
---|
| 115 | $cur->user_tz = $user_tz = $_POST['user_tz']; |
---|
[13] | 116 | |
---|
[0] | 117 | $cur->user_options = new ArrayObject($user_options); |
---|
[2566] | 118 | |
---|
[0] | 119 | if ($core->auth->allowPassChange() && !empty($_POST['new_pwd'])) |
---|
| 120 | { |
---|
| 121 | if (!$pwd_check) { |
---|
| 122 | throw new Exception(__('If you want to change your email or password you must provide your current password.')); |
---|
| 123 | } |
---|
[2566] | 124 | |
---|
[0] | 125 | if ($_POST['new_pwd'] != $_POST['new_pwd_c']) { |
---|
| 126 | throw new Exception(__("Passwords don't match")); |
---|
| 127 | } |
---|
[2566] | 128 | |
---|
[0] | 129 | $cur->user_pwd = $_POST['new_pwd']; |
---|
| 130 | } |
---|
[2566] | 131 | |
---|
[0] | 132 | # --BEHAVIOR-- adminBeforeUserUpdate |
---|
[13] | 133 | $core->callBehavior('adminBeforeUserProfileUpdate',$cur,$core->auth->userID()); |
---|
[2566] | 134 | |
---|
[13] | 135 | # Udate user |
---|
| 136 | $core->updUser($core->auth->userID(),$cur); |
---|
[2566] | 137 | |
---|
[13] | 138 | # --BEHAVIOR-- adminAfterUserUpdate |
---|
| 139 | $core->callBehavior('adminAfterUserProfileUpdate',$cur,$core->auth->userID()); |
---|
[2566] | 140 | |
---|
[2256] | 141 | dcPage::addSuccessNotice(__('Personal information has been successfully updated.')); |
---|
| 142 | |
---|
[2720] | 143 | http::redirect($core->adminurl->get("admin.user.preferences")); |
---|
[13] | 144 | } |
---|
| 145 | catch (Exception $e) |
---|
| 146 | { |
---|
| 147 | $core->error->add($e->getMessage()); |
---|
| 148 | } |
---|
| 149 | } |
---|
| 150 | |
---|
| 151 | # Update user options |
---|
[2566] | 152 | if (isset($_POST['user_post_format'])) |
---|
[590] | 153 | { |
---|
[13] | 154 | try |
---|
| 155 | { |
---|
| 156 | $cur = $core->con->openCursor($core->prefix.'user'); |
---|
[2566] | 157 | |
---|
[13] | 158 | $cur->user_name = $user_name; |
---|
| 159 | $cur->user_firstname = $user_firstname; |
---|
| 160 | $cur->user_displayname = $user_displayname; |
---|
| 161 | $cur->user_email = $user_email; |
---|
| 162 | $cur->user_url = $user_url; |
---|
| 163 | $cur->user_lang = $user_lang; |
---|
| 164 | $cur->user_tz = $user_tz; |
---|
| 165 | |
---|
| 166 | $cur->user_post_status = $user_post_status = $_POST['user_post_status']; |
---|
[2566] | 167 | |
---|
[13] | 168 | $user_options['edit_size'] = (integer) $_POST['user_edit_size']; |
---|
| 169 | if ($user_options['edit_size'] < 1) { |
---|
| 170 | $user_options['edit_size'] = 10; |
---|
| 171 | } |
---|
| 172 | $user_options['post_format'] = $_POST['user_post_format']; |
---|
[2679] | 173 | $user_options['editor'] = $_POST['user_editor']; |
---|
[13] | 174 | $user_options['enable_wysiwyg'] = !empty($_POST['user_wysiwyg']); |
---|
[2566] | 175 | |
---|
[13] | 176 | $cur->user_options = new ArrayObject($user_options); |
---|
[2566] | 177 | |
---|
[897] | 178 | # --BEHAVIOR-- adminBeforeUserOptionsUpdate |
---|
| 179 | $core->callBehavior('adminBeforeUserOptionsUpdate',$cur,$core->auth->userID()); |
---|
[2566] | 180 | |
---|
[13] | 181 | # Update user prefs |
---|
[240] | 182 | $core->auth->user_prefs->accessibility->put('nodragdrop',!empty($_POST['user_acc_nodragdrop']),'boolean'); |
---|
| 183 | $core->auth->user_prefs->interface->put('enhanceduploader',!empty($_POST['user_ui_enhanceduploader']),'boolean'); |
---|
[244] | 184 | if ($core->auth->isSuperAdmin()) { |
---|
| 185 | # Applied to all users |
---|
| 186 | $core->auth->user_prefs->interface->put('hide_std_favicon',!empty($_POST['user_ui_hide_std_favicon']),'boolean',null,true,true); |
---|
| 187 | } |
---|
[2021] | 188 | $core->auth->user_prefs->interface->put('media_by_page',(integer)$_POST['user_ui_media_by_page'],'integer'); |
---|
[2566] | 189 | |
---|
[0] | 190 | # Udate user |
---|
| 191 | $core->updUser($core->auth->userID(),$cur); |
---|
[2566] | 192 | |
---|
[897] | 193 | # --BEHAVIOR-- adminAfterUserOptionsUpdate |
---|
| 194 | $core->callBehavior('adminAfterUserOptionsUpdate',$cur,$core->auth->userID()); |
---|
[2566] | 195 | |
---|
[2256] | 196 | dcPage::addSuccessNotice(__('Personal options has been successfully updated.')); |
---|
[2720] | 197 | http::redirect($core->adminurl->get("admin.user.preferences").'#user-options'); |
---|
[0] | 198 | } |
---|
| 199 | catch (Exception $e) |
---|
| 200 | { |
---|
| 201 | $core->error->add($e->getMessage()); |
---|
| 202 | } |
---|
| 203 | } |
---|
| 204 | |
---|
[1762] | 205 | # Dashboard options |
---|
| 206 | if (isset($_POST['db-options'])) { |
---|
| 207 | try |
---|
| 208 | { |
---|
| 209 | # --BEHAVIOR-- adminBeforeUserOptionsUpdate |
---|
| 210 | $core->callBehavior('adminBeforeDashboardOptionsUpdate',$core->auth->userID()); |
---|
[2566] | 211 | |
---|
[1762] | 212 | # Update user prefs |
---|
| 213 | $core->auth->user_prefs->dashboard->put('doclinks',!empty($_POST['user_dm_doclinks']),'boolean'); |
---|
| 214 | $core->auth->user_prefs->dashboard->put('dcnews',!empty($_POST['user_dm_dcnews']),'boolean'); |
---|
| 215 | $core->auth->user_prefs->dashboard->put('quickentry',!empty($_POST['user_dm_quickentry']),'boolean'); |
---|
| 216 | $core->auth->user_prefs->interface->put('iconset',(!empty($_POST['user_ui_iconset']) ? $_POST['user_ui_iconset'] : '')); |
---|
[1763] | 217 | $core->auth->user_prefs->interface->put('nofavmenu',empty($_POST['user_ui_nofavmenu']),'boolean'); |
---|
[2566] | 218 | |
---|
[1762] | 219 | # --BEHAVIOR-- adminAfterUserOptionsUpdate |
---|
| 220 | $core->callBehavior('adminAfterDashboardOptionsUpdate',$core->auth->userID()); |
---|
[2566] | 221 | |
---|
[2256] | 222 | dcPage::addSuccessNotice(__('Dashboard options has been successfully updated.')); |
---|
[2720] | 223 | http::redirect($core->adminurl->get("admin.user.preferences").'#user-favorites'); |
---|
[1762] | 224 | } |
---|
| 225 | catch (Exception $e) |
---|
| 226 | { |
---|
| 227 | $core->error->add($e->getMessage()); |
---|
| 228 | } |
---|
| 229 | } |
---|
| 230 | |
---|
[3] | 231 | # Add selected favorites |
---|
[2566] | 232 | if (!empty($_POST['appendaction'])) |
---|
[590] | 233 | { |
---|
| 234 | try { |
---|
| 235 | if (empty($_POST['append'])) { |
---|
| 236 | throw new Exception(__('No favorite selected')); |
---|
| 237 | } |
---|
[2229] | 238 | $user_favs = $core->favs->getFavoriteIDs(false); |
---|
[590] | 239 | foreach ($_POST['append'] as $k => $v) |
---|
| 240 | { |
---|
[2229] | 241 | if ($core->favs->exists($v)) { |
---|
| 242 | $user_favs[] = $v; |
---|
[590] | 243 | } |
---|
| 244 | } |
---|
[2229] | 245 | $core->favs->setFavoriteIDs($user_favs,false); |
---|
| 246 | |
---|
[590] | 247 | if (!$core->error->flag()) { |
---|
[2256] | 248 | dcPage::addSuccessNotice(__('Favorites have been successfully added.')); |
---|
[2720] | 249 | http::redirect($core->adminurl->get("admin.user.preferences").'#user-favorites'); |
---|
[590] | 250 | } |
---|
| 251 | } catch (Exception $e) { |
---|
| 252 | $core->error->add($e->getMessage()); |
---|
| 253 | } |
---|
| 254 | } |
---|
| 255 | |
---|
| 256 | # Delete selected favorites |
---|
| 257 | if (!empty($_POST['removeaction'])) |
---|
| 258 | { |
---|
| 259 | try { |
---|
| 260 | if (empty($_POST['remove'])) { |
---|
| 261 | throw new Exception(__('No favorite selected')); |
---|
| 262 | } |
---|
[2229] | 263 | $user_fav_ids = array(); |
---|
| 264 | foreach ($core->favs->getFavoriteIDs(false) as $v) { |
---|
| 265 | $user_fav_ids[$v]=true; |
---|
| 266 | } |
---|
| 267 | foreach ($_POST['remove'] as $v) |
---|
[590] | 268 | { |
---|
[2229] | 269 | if (isset($user_fav_ids[$v])) { |
---|
| 270 | unset($user_fav_ids[$v]); |
---|
[590] | 271 | } |
---|
| 272 | } |
---|
[2229] | 273 | $core->favs->setFavoriteIDs(array_keys($user_fav_ids),false); |
---|
[590] | 274 | if (!$core->error->flag()) { |
---|
[2256] | 275 | dcPage::addSuccessNotice(__('Favorites have been successfully removed.')); |
---|
[2720] | 276 | http::redirect($core->adminurl->get("admin.user.preferences").'#user-favorites'); |
---|
[3] | 277 | } |
---|
| 278 | } catch (Exception $e) { |
---|
| 279 | $core->error->add($e->getMessage()); |
---|
| 280 | } |
---|
| 281 | } |
---|
| 282 | |
---|
| 283 | # Order favs |
---|
| 284 | $order = array(); |
---|
| 285 | if (empty($_POST['favs_order']) && !empty($_POST['order'])) { |
---|
| 286 | $order = $_POST['order']; |
---|
| 287 | asort($order); |
---|
| 288 | $order = array_keys($order); |
---|
| 289 | } elseif (!empty($_POST['favs_order'])) { |
---|
| 290 | $order = explode(',',$_POST['favs_order']); |
---|
| 291 | } |
---|
| 292 | |
---|
| 293 | if (!empty($_POST['saveorder']) && !empty($order)) |
---|
| 294 | { |
---|
[2229] | 295 | foreach ($order as $k => $v) { |
---|
| 296 | if (!$core->favs->exists($v)) { |
---|
| 297 | unset($order[$k]); |
---|
[3] | 298 | } |
---|
[2566] | 299 | } |
---|
[2229] | 300 | $core->favs->setFavoriteIDs($order,false); |
---|
[3] | 301 | if (!$core->error->flag()) { |
---|
[2256] | 302 | dcPage::addSuccessNotice(__('Favorites have been successfully updated.')); |
---|
[2720] | 303 | http::redirect($core->adminurl->get("admin.user.preferences").'#user-favorites'); |
---|
[3] | 304 | } |
---|
| 305 | } |
---|
| 306 | |
---|
[30] | 307 | # Replace default favorites by current set (super admin only) |
---|
| 308 | if (!empty($_POST['replace']) && $core->auth->isSuperAdmin()) { |
---|
[2229] | 309 | $user_favs = $core->favs->getFavoriteIDs(false); |
---|
| 310 | $core->favs->setFavoriteIDs($user_favs,true); |
---|
[30] | 311 | |
---|
| 312 | if (!$core->error->flag()) { |
---|
[2256] | 313 | dcPage::addSuccessNotice(__('Default favorites have been successfully updated.')); |
---|
[2720] | 314 | http::redirect($core->adminurl->get("admin.user.preferences").'#user-favorites'); |
---|
[30] | 315 | } |
---|
| 316 | } |
---|
[0] | 317 | |
---|
| 318 | /* DISPLAY |
---|
| 319 | -------------------------------------------------------- */ |
---|
| 320 | dcPage::open($page_title, |
---|
| 321 | dcPage::jsLoad('js/_preferences.js'). |
---|
[240] | 322 | ($user_acc_nodragdrop ? '' : dcPage::jsLoad('js/_preferences-dragdrop.js')). |
---|
[906] | 323 | dcPage::jsLoad('js/jquery/jquery-ui.custom.js'). |
---|
[2495] | 324 | dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js'). |
---|
[1368] | 325 | dcPage::jsLoad('js/jquery/jquery.pwstrength.js'). |
---|
| 326 | '<script type="text/javascript">'."\n". |
---|
| 327 | "//<![CDATA[\n". |
---|
| 328 | "\$(function() {\n". |
---|
[1375] | 329 | " \$('#new_pwd').pwstrength({texts: ['". |
---|
| 330 | sprintf(__('Password strength: %s'),__('very weak'))."', '". |
---|
| 331 | sprintf(__('Password strength: %s'),__('weak'))."', '". |
---|
| 332 | sprintf(__('Password strength: %s'),__('mediocre'))."', '". |
---|
| 333 | sprintf(__('Password strength: %s'),__('strong'))."', '". |
---|
| 334 | sprintf(__('Password strength: %s'),__('very strong'))."']});\n". |
---|
[1368] | 335 | "});\n". |
---|
[2679] | 336 | 'var formats_by_editor = \''.json_encode($formaters_combo).'\';'. |
---|
[1368] | 337 | "\n//]]>\n". |
---|
| 338 | "</script>\n". |
---|
[3] | 339 | dcPage::jsPageTabs($default_tab). |
---|
[0] | 340 | dcPage::jsConfirmClose('user-form'). |
---|
[2566] | 341 | |
---|
[0] | 342 | # --BEHAVIOR-- adminPreferencesHeaders |
---|
[1358] | 343 | $core->callBehavior('adminPreferencesHeaders'), |
---|
| 344 | |
---|
| 345 | dcPage::breadcrumb( |
---|
| 346 | array( |
---|
| 347 | html::escapeHTML($core->auth->userID()) => '', |
---|
[2166] | 348 | $page_title => '' |
---|
[1358] | 349 | )) |
---|
[0] | 350 | ); |
---|
| 351 | |
---|
| 352 | if (!empty($_GET['upd'])) { |
---|
[1553] | 353 | dcPage::success(__('Personal information has been successfully updated.')); |
---|
[0] | 354 | } |
---|
[13] | 355 | if (!empty($_GET['updated'])) { |
---|
[1553] | 356 | dcPage::success(__('Personal options has been successfully updated.')); |
---|
[13] | 357 | } |
---|
[1762] | 358 | if (!empty($_GET['db-updated'])) { |
---|
| 359 | dcPage::success(__('Dashboard options has been successfully updated.')); |
---|
| 360 | } |
---|
[3] | 361 | if (!empty($_GET['append'])) { |
---|
[1553] | 362 | dcPage::success(__('Favorites have been successfully added.')); |
---|
[3] | 363 | } |
---|
| 364 | if (!empty($_GET['neworder'])) { |
---|
[1553] | 365 | dcPage::success(__('Favorites have been successfully updated.')); |
---|
[3] | 366 | } |
---|
| 367 | if (!empty($_GET['removed'])) { |
---|
[1553] | 368 | dcPage::success(__('Favorites have been successfully removed.')); |
---|
[3] | 369 | } |
---|
[30] | 370 | if (!empty($_GET['replaced'])) { |
---|
[1553] | 371 | dcPage::success(__('Default favorites have been successfully updated.')); |
---|
[30] | 372 | } |
---|
[3] | 373 | |
---|
| 374 | # User profile |
---|
| 375 | echo '<div class="multi-part" id="user-profile" title="'.__('My profile').'">'; |
---|
[0] | 376 | |
---|
| 377 | echo |
---|
[1786] | 378 | '<h3>'.__('My profile').'</h3>'. |
---|
[2720] | 379 | '<form action="'.$core->adminurl->get("admin.user.preferences").'" method="post" id="user-form">'. |
---|
[1609] | 380 | |
---|
[1399] | 381 | '<p><label for="user_name">'.__('Last Name:').'</label>'. |
---|
| 382 | form::field('user_name',20,255,html::escapeHTML($user_name)).'</p>'. |
---|
[0] | 383 | |
---|
[1399] | 384 | '<p><label for="user_firstname">'.__('First Name:').'</label>'. |
---|
| 385 | form::field('user_firstname',20,255,html::escapeHTML($user_firstname)).'</p>'. |
---|
[0] | 386 | |
---|
[1399] | 387 | '<p><label for="user_displayname">'.__('Display name:').'</label>'. |
---|
| 388 | form::field('user_displayname',20,255,html::escapeHTML($user_displayname)).'</p>'. |
---|
[0] | 389 | |
---|
[1399] | 390 | '<p><label for="user_email">'.__('Email:').'</label>'. |
---|
| 391 | form::field('user_email',20,255,html::escapeHTML($user_email)).'</p>'. |
---|
[0] | 392 | |
---|
[1399] | 393 | '<p><label for="user_url">'.__('URL:').'</label>'. |
---|
[1726] | 394 | form::field('user_url',30,255,html::escapeHTML($user_url)).'</p>'. |
---|
| 395 | |
---|
| 396 | '<p><label for="user_lang">'.__('Language for my interface:').'</label>'. |
---|
| 397 | form::combo('user_lang',$lang_combo,$user_lang,'l10n').'</p>'. |
---|
| 398 | |
---|
| 399 | '<p><label for="user_tz">'.__('My timezone:').'</label>'. |
---|
| 400 | form::combo('user_tz',dt::getZones(true,true),$user_tz).'</p>'; |
---|
| 401 | |
---|
[0] | 402 | |
---|
| 403 | if ($core->auth->allowPassChange()) |
---|
| 404 | { |
---|
| 405 | echo |
---|
[1786] | 406 | '<h4 class="vertical-separator pretty-title">'.__('Change my password').'</h4>'. |
---|
[2566] | 407 | |
---|
[1375] | 408 | '<div class="pw-table">'. |
---|
| 409 | '<p class="pw-cell"><label for="new_pwd">'.__('New password:').'</label>'. |
---|
| 410 | form::password('new_pwd',20,255,'','','',false,' data-indicator="pwindicator" ').'</p>'. |
---|
[1468] | 411 | '<div id="pwindicator">'. |
---|
| 412 | ' <div class="bar"></div>'. |
---|
| 413 | ' <p class="label no-margin"></p>'. |
---|
| 414 | '</div>'. |
---|
| 415 | '</div>'. |
---|
[2566] | 416 | |
---|
[1474] | 417 | '<p><label for="new_pwd_c">'.__('Confirm new password:').'</label>'. |
---|
[1375] | 418 | form::password('new_pwd_c',20,255).'</p>'. |
---|
[2566] | 419 | |
---|
[1609] | 420 | '<p><label for="cur_pwd">'.__('Your current password:').'</label>'. |
---|
[1607] | 421 | form::password('cur_pwd',20,255).'</p>'. |
---|
[1609] | 422 | '<p class="form-note warn">'. |
---|
| 423 | __('If you have changed your email or password you must provide your current password to save these modifications.'). |
---|
| 424 | '</p>'; |
---|
[0] | 425 | } |
---|
| 426 | |
---|
| 427 | echo |
---|
[1609] | 428 | '<p class="clear vertical-separator">'. |
---|
[0] | 429 | $core->formNonce(). |
---|
[1609] | 430 | '<input type="submit" accesskey="s" value="'.__('Update my profile').'" /></p>'. |
---|
| 431 | '</form>'. |
---|
[0] | 432 | |
---|
[1609] | 433 | '</div>'; |
---|
[3] | 434 | |
---|
| 435 | # User options : some from actual user profile, dashboard modules, ... |
---|
| 436 | echo '<div class="multi-part" id="user-options" title="'.__('My options').'">'; |
---|
| 437 | |
---|
| 438 | echo |
---|
[2720] | 439 | '<form action="'.$core->adminurl->get("admin.user.preferences").'#user-options" method="post" id="opts-forms">'. |
---|
[1786] | 440 | '<h3>'.__('My options').'</h3>'; |
---|
[3] | 441 | |
---|
[1609] | 442 | echo |
---|
[1786] | 443 | '<div class="fieldset">'. |
---|
[1609] | 444 | '<h4>'.__('Interface').'</h4>'. |
---|
| 445 | |
---|
| 446 | '<p><label for="user_ui_enhanceduploader" class="classic">'. |
---|
| 447 | form::checkbox('user_ui_enhanceduploader',1,$user_ui_enhanceduploader).' '. |
---|
[1786] | 448 | __('Activate enhanced uploader in media manager').'</label></p>'. |
---|
| 449 | |
---|
| 450 | '<p><label for="user_acc_nodragdrop" class="classic">'. |
---|
| 451 | form::checkbox('user_acc_nodragdrop',1,$user_acc_nodragdrop).' '. |
---|
| 452 | __('Disable javascript powered drag and drop for ordering items').'</label></p>'. |
---|
| 453 | '<p class="clear form-note">'.__('If checked, numeric fields will allow to type the elements\' ordering number.').'</p>'; |
---|
[1609] | 454 | |
---|
[2021] | 455 | echo |
---|
[2206] | 456 | '<p><label for="user_ui_media_by_page" class="classic">'.__('Number of elements displayed per page in media manager:').'</label> '. |
---|
[2021] | 457 | form::field('user_ui_media_by_page',5,3,(integer) $user_ui_media_by_page).'</p>'; |
---|
| 458 | |
---|
[1609] | 459 | if ($core->auth->isSuperAdmin()) { |
---|
| 460 | echo |
---|
| 461 | '<p><label for="user_ui_hide_std_favicon" class="classic">'. |
---|
| 462 | form::checkbox('user_ui_hide_std_favicon',1,$user_ui_hide_std_favicon).' '. |
---|
[1786] | 463 | __('Do not use standard favicon').'</label> '. |
---|
| 464 | '<span class="clear form-note warn">'.__('This will be applied for all users').'.</span>'. |
---|
[1609] | 465 | '</p>';//Opera sucks; |
---|
| 466 | } |
---|
| 467 | |
---|
| 468 | echo |
---|
[1786] | 469 | '</div>'; |
---|
[1609] | 470 | |
---|
| 471 | echo |
---|
[1786] | 472 | '<div class="fieldset">'. |
---|
| 473 | '<h4>'.__('Edition').'</h4>'. |
---|
[1609] | 474 | |
---|
[2694] | 475 | '<p class="field"><label for="user_editor">'.__('Preferred editor:').'</label>'. |
---|
| 476 | form::combo('user_editor',array_merge(array(__('Choose an editor') => ''),$editors_combo),$user_options['editor']).'</p>'. |
---|
[2679] | 477 | |
---|
[1786] | 478 | '<p class="field"><label for="user_post_format">'.__('Preferred format:').'</label>'. |
---|
[2694] | 479 | form::combo('user_post_format',array_merge(array('' => ''), $formaters_combo_editor),$user_options['post_format']).'</p>'. |
---|
[3] | 480 | |
---|
[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 | |
---|
| 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(); |
---|