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