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