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