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