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