[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 |
---|
[1609] | 395 | '<h3 class="hidden-if-js">'.__('My profile').'</h3>'. |
---|
[0] | 396 | '<form action="preferences.php" method="post" id="user-form">'. |
---|
[1609] | 397 | |
---|
[1399] | 398 | '<p><label for="user_name">'.__('Last Name:').'</label>'. |
---|
| 399 | form::field('user_name',20,255,html::escapeHTML($user_name)).'</p>'. |
---|
[0] | 400 | |
---|
[1399] | 401 | '<p><label for="user_firstname">'.__('First Name:').'</label>'. |
---|
| 402 | form::field('user_firstname',20,255,html::escapeHTML($user_firstname)).'</p>'. |
---|
[0] | 403 | |
---|
[1399] | 404 | '<p><label for="user_displayname">'.__('Display name:').'</label>'. |
---|
| 405 | form::field('user_displayname',20,255,html::escapeHTML($user_displayname)).'</p>'. |
---|
[0] | 406 | |
---|
[1399] | 407 | '<p><label for="user_email">'.__('Email:').'</label>'. |
---|
| 408 | form::field('user_email',20,255,html::escapeHTML($user_email)).'</p>'. |
---|
[0] | 409 | |
---|
[1399] | 410 | '<p><label for="user_url">'.__('URL:').'</label>'. |
---|
[1609] | 411 | form::field('user_url',30,255,html::escapeHTML($user_url)).'</p>'; |
---|
[0] | 412 | |
---|
| 413 | if ($core->auth->allowPassChange()) |
---|
| 414 | { |
---|
| 415 | echo |
---|
[1609] | 416 | '<h4 class="vertical-separator">'.__('Change my password').'</h4>'. |
---|
[0] | 417 | |
---|
[1375] | 418 | '<div class="pw-table">'. |
---|
| 419 | '<p class="pw-cell"><label for="new_pwd">'.__('New password:').'</label>'. |
---|
| 420 | form::password('new_pwd',20,255,'','','',false,' data-indicator="pwindicator" ').'</p>'. |
---|
[1468] | 421 | '<div id="pwindicator">'. |
---|
| 422 | ' <div class="bar"></div>'. |
---|
| 423 | ' <p class="label no-margin"></p>'. |
---|
| 424 | '</div>'. |
---|
| 425 | '</div>'. |
---|
[0] | 426 | |
---|
[1474] | 427 | '<p><label for="new_pwd_c">'.__('Confirm new password:').'</label>'. |
---|
[1375] | 428 | form::password('new_pwd_c',20,255).'</p>'. |
---|
[0] | 429 | |
---|
[1609] | 430 | '<p><label for="cur_pwd">'.__('Your current password:').'</label>'. |
---|
[1607] | 431 | form::password('cur_pwd',20,255).'</p>'. |
---|
[1609] | 432 | '<p class="form-note warn">'. |
---|
| 433 | __('If you have changed your email or password you must provide your current password to save these modifications.'). |
---|
| 434 | '</p>'; |
---|
[0] | 435 | } |
---|
| 436 | |
---|
| 437 | echo |
---|
[1609] | 438 | '<p class="clear vertical-separator">'. |
---|
[0] | 439 | $core->formNonce(). |
---|
[1609] | 440 | '<input type="submit" accesskey="s" value="'.__('Update my profile').'" /></p>'. |
---|
| 441 | '</form>'. |
---|
[0] | 442 | |
---|
[1609] | 443 | '</div>'; |
---|
[3] | 444 | |
---|
| 445 | # User options : some from actual user profile, dashboard modules, ... |
---|
| 446 | echo '<div class="multi-part" id="user-options" title="'.__('My options').'">'; |
---|
| 447 | |
---|
| 448 | echo |
---|
[114] | 449 | '<form action="preferences.php" method="post" id="opts-forms">'. |
---|
[1609] | 450 | '<h3 class="hidden-if-js">'.__('My options').'</h3>'; |
---|
[3] | 451 | |
---|
[1609] | 452 | echo |
---|
| 453 | '<div class="two-cols">'. |
---|
| 454 | |
---|
| 455 | '<div class="col">'. |
---|
| 456 | '<h4>'.__('Interface').'</h4>'. |
---|
| 457 | |
---|
| 458 | '<p><label for="user_lang">'.__('Language for my interface:').'</label>'. |
---|
| 459 | form::combo('user_lang',$lang_combo,$user_lang,'l10n').'</p>'. |
---|
| 460 | |
---|
| 461 | '<p><label for="user_tz">'.__('My timezone:').'</label>'. |
---|
| 462 | form::combo('user_tz',dt::getZones(true,true),$user_tz).'</p>'. |
---|
| 463 | |
---|
| 464 | '<p><label for="user_ui_enhanceduploader" class="classic">'. |
---|
| 465 | form::checkbox('user_ui_enhanceduploader',1,$user_ui_enhanceduploader).' '. |
---|
| 466 | __('Activate enhanced uploader in media manager').'</label></p>'; |
---|
| 467 | |
---|
| 468 | if ($core->auth->isSuperAdmin()) { |
---|
| 469 | echo |
---|
| 470 | '<p><label for="user_ui_hide_std_favicon" class="classic">'. |
---|
| 471 | form::checkbox('user_ui_hide_std_favicon',1,$user_ui_hide_std_favicon).' '. |
---|
| 472 | __('Do not use standard favicon').'</label></p>'. |
---|
| 473 | '<p class="clear form-note warn">'.__('This will be applied for all users').'.'. |
---|
| 474 | '</p>';//Opera sucks; |
---|
| 475 | } |
---|
| 476 | |
---|
| 477 | echo |
---|
| 478 | '<h5>'.__('Accessibility').'</h5>'. |
---|
| 479 | |
---|
| 480 | '<p><label for="user_acc_nodragdrop" class="classic">'. |
---|
| 481 | form::checkbox('user_acc_nodragdrop',1,$user_acc_nodragdrop).' '. |
---|
| 482 | __('Disable javascript powered drag and drop for ordering items').'</label></p>'. |
---|
| 483 | |
---|
| 484 | '<p class="clear form-note">'.__('If checked, numeric fields will allow to type the elements\' ordering number.').'</p>'; |
---|
| 485 | |
---|
| 486 | echo |
---|
| 487 | '<h4 class="border-top">'.__('Edition').'</h4>'. |
---|
| 488 | |
---|
| 489 | '<p><label for="user_post_format">'.__('Preferred format:').'</label>'. |
---|
[1399] | 490 | form::combo('user_post_format',$formaters_combo,$user_options['post_format']).'</p>'. |
---|
[3] | 491 | |
---|
[1609] | 492 | '<p><label for="user_post_status">'.__('Default entry status:').'</label>'. |
---|
[1399] | 493 | form::combo('user_post_status',$status_combo,$user_post_status).'</p>'. |
---|
[3] | 494 | |
---|
[1609] | 495 | '<p><label for="user_edit_size">'.__('Entry edit field height:').'</label>'. |
---|
[1399] | 496 | form::field('user_edit_size',5,4,(integer) $user_options['edit_size']).'</p>'. |
---|
[3] | 497 | |
---|
| 498 | '<p><label for="user_wysiwyg" class="classic">'. |
---|
[454] | 499 | form::checkbox('user_wysiwyg',1,$user_options['enable_wysiwyg']).' '. |
---|
[1609] | 500 | __('Enable WYSIWYG mode').'</label></p>'; |
---|
[240] | 501 | |
---|
[1609] | 502 | echo |
---|
| 503 | '<h4 class="border-top">'.__('Other options').'</h4>'; |
---|
| 504 | |
---|
| 505 | # --BEHAVIOR-- adminPreferencesForm |
---|
| 506 | $core->callBehavior('adminPreferencesForm',$core); |
---|
| 507 | |
---|
| 508 | echo |
---|
| 509 | '</div>'. |
---|
| 510 | |
---|
| 511 | '<div class="col">'. |
---|
| 512 | '<h4>'.__('Dashboard and menu').'</h4>'. |
---|
[821] | 513 | |
---|
| 514 | '<p><label for="user_ui_nofavmenu" class="classic">'. |
---|
| 515 | form::checkbox('user_ui_nofavmenu',1,$user_ui_nofavmenu).' '. |
---|
| 516 | __('Hide My favorites menu').'</label></p>'; |
---|
[692] | 517 | |
---|
[712] | 518 | if (count($iconsets_combo) > 1) { |
---|
| 519 | echo |
---|
[1609] | 520 | '<p><label for="user_ui_iconset" class="classic">'.__('Iconset:').'</label> '. |
---|
[1399] | 521 | form::combo('user_ui_iconset',$iconsets_combo,$user_ui_iconset).'</p>'; |
---|
[712] | 522 | } else { |
---|
| 523 | form::hidden('user_ui_iconset',''); |
---|
| 524 | } |
---|
[240] | 525 | |
---|
[13] | 526 | echo |
---|
[1609] | 527 | '<h5>'.('Dashboard modules').'</h5>'. |
---|
[13] | 528 | |
---|
| 529 | '<p><label for="user_dm_doclinks" class="classic">'. |
---|
[454] | 530 | form::checkbox('user_dm_doclinks',1,$user_dm_doclinks).' '. |
---|
[13] | 531 | __('Display documentation links').'</label></p>'. |
---|
| 532 | |
---|
| 533 | '<p><label for="user_dm_dcnews" class="classic">'. |
---|
[454] | 534 | form::checkbox('user_dm_dcnews',1,$user_dm_dcnews).' '. |
---|
[13] | 535 | __('Display Dotclear news').'</label></p>'. |
---|
| 536 | |
---|
| 537 | '<p><label for="user_dm_quickentry" class="classic">'. |
---|
[454] | 538 | form::checkbox('user_dm_quickentry',1,$user_dm_quickentry).' '. |
---|
[1474] | 539 | __('Display quick entry form').'</label><br class="clear" />'. //Opera sucks |
---|
[1609] | 540 | '</p>'; |
---|
[3] | 541 | |
---|
| 542 | echo |
---|
[1609] | 543 | '</div>'. |
---|
| 544 | '</div>'; |
---|
| 545 | |
---|
| 546 | echo |
---|
| 547 | '<p class="clear border-top">'. |
---|
[3] | 548 | $core->formNonce(). |
---|
[1609] | 549 | '<input type="submit" accesskey="s" value="'.__('Save my options').'" /></p>'. |
---|
[3] | 550 | '</form>'; |
---|
| 551 | |
---|
| 552 | echo '</div>'; |
---|
| 553 | |
---|
| 554 | # User favorites |
---|
| 555 | echo '<div class="multi-part" id="user-favorites" title="'.__('My favorites').'">'; |
---|
| 556 | $ws = $core->auth->user_prefs->addWorkspace('favorites'); |
---|
| 557 | echo '<form action="preferences.php" method="post" id="favs-form">'; |
---|
| 558 | echo '<div class="two-cols">'; |
---|
[1609] | 559 | |
---|
[3] | 560 | echo '<div class="col70">'; |
---|
[1607] | 561 | echo '<div id="my-favs" class="fieldset"><h3>'.__('My favorites').'</h3>'; |
---|
[32] | 562 | |
---|
[3] | 563 | $count = 0; |
---|
| 564 | foreach ($ws->dumpPrefs() as $k => $v) { |
---|
| 565 | // User favorites only |
---|
| 566 | if (!$v['global']) { |
---|
| 567 | $fav = unserialize($v['value']); |
---|
| 568 | if (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)) { |
---|
| 569 | if ($count == 0) echo '<ul>'; |
---|
| 570 | $count++; |
---|
| 571 | echo '<li id="fu-'.$k.'">'. |
---|
[691] | 572 | '<img src="'.dc_admin_icon_url($fav['large-icon']).'" alt="" /> '. |
---|
[35] | 573 | form::field(array('order['.$k.']'),2,3,$count,'position','',false,'title="'.sprintf(__('position of %s'),$fav['title']).'"'). |
---|
[114] | 574 | form::hidden(array('dynorder[]','dynorder-'.$k.''),$k). |
---|
[324] | 575 | '<label for="fuk-'.$k.'">'.form::checkbox(array('remove[]','fuk-'.$k),$k).__($fav['title']).'</label>'. |
---|
[3] | 576 | '</li>'; |
---|
| 577 | } |
---|
| 578 | } |
---|
| 579 | } |
---|
| 580 | if ($count > 0) echo '</ul>'; |
---|
| 581 | if ($count > 0) { |
---|
| 582 | echo |
---|
| 583 | '<div class="clear">'. |
---|
[82] | 584 | '<p>'.form::hidden('favs_order',''). |
---|
[3] | 585 | $core->formNonce(). |
---|
[114] | 586 | '<input type="submit" name="saveorder" value="'.__('Save order').'" /> '. |
---|
| 587 | |
---|
| 588 | '<input type="submit" class="delete" name="removeaction" '. |
---|
[3] | 589 | 'value="'.__('Delete selected favorites').'" '. |
---|
| 590 | 'onclick="return window.confirm(\''.html::escapeJS( |
---|
| 591 | __('Are you sure you want to remove selected favorites?')).'\');" /></p>'. |
---|
[82] | 592 | |
---|
| 593 | ($core->auth->isSuperAdmin() ? |
---|
[114] | 594 | '<hr />'. |
---|
| 595 | '<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>'. |
---|
| 596 | '<p><input class="reset" type="submit" name="replace" value="'.__('Define as default favorites').'" />' : |
---|
| 597 | ''). |
---|
| 598 | '</p>'. |
---|
[3] | 599 | '</div>'; |
---|
| 600 | } else { |
---|
| 601 | echo |
---|
| 602 | '<p>'.__('Currently no personal favorites.').'</p>'; |
---|
| 603 | } |
---|
| 604 | |
---|
[1607] | 605 | echo '</div>'; |
---|
[3] | 606 | |
---|
| 607 | echo '<div id="default-favs"><h3>'.__('Default favorites').'</h3>'; |
---|
[1609] | 608 | echo '<p>'.__('Those favorites are displayed when My Favorites list is empty.').'</p>'; |
---|
[3] | 609 | $count = 0; |
---|
| 610 | foreach ($ws->dumpPrefs() as $k => $v) { |
---|
| 611 | // Global favorites only |
---|
| 612 | if ($v['global']) { |
---|
| 613 | $fav = unserialize($v['value']); |
---|
| 614 | if (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)) { |
---|
| 615 | if ($count == 0) echo '<ul class="fav-list">'; |
---|
| 616 | $count++; |
---|
| 617 | echo '<li id="fd-'.$k.'">'. |
---|
[691] | 618 | '<img src="'.dc_admin_icon_url($fav['small-icon']).'" alt="" /> '.__($fav['title']).'</li>'; |
---|
[3] | 619 | } |
---|
| 620 | } |
---|
| 621 | } |
---|
| 622 | if ($count > 0) echo '</ul>'; |
---|
| 623 | echo '</div>'; |
---|
| 624 | echo '</div>'; |
---|
[1609] | 625 | |
---|
| 626 | |
---|
[1607] | 627 | echo '<div class="col30 fieldset" id="available-favs">'; |
---|
[3] | 628 | # Available favorites |
---|
[1607] | 629 | echo '<h3>'.__('Available favorites').'</h3>'; |
---|
[3] | 630 | $count = 0; |
---|
| 631 | $array = $_fav; |
---|
| 632 | function cmp($a,$b) { |
---|
[371] | 633 | if (__($a[1]) == __($b[1])) { |
---|
[3] | 634 | return 0; |
---|
| 635 | } |
---|
[371] | 636 | return (__($a[1]) < __($b[1])) ? -1 : 1; |
---|
[3] | 637 | } |
---|
[162] | 638 | $array=$array->getArrayCopy(); |
---|
| 639 | uasort($array,'cmp'); |
---|
[3] | 640 | foreach ($array as $k => $fav) { |
---|
| 641 | if (($fav[5] == '*') || $core->auth->check($fav[5],$core->blog->id)) { |
---|
| 642 | if ($count == 0) echo '<ul class="fav-list">'; |
---|
| 643 | $count++; |
---|
| 644 | echo '<li id="fa-'.$fav[0].'">'.'<label for="fak-'.$fav[0].'">'. |
---|
[11] | 645 | form::checkbox(array('append[]','fak-'.$fav[0]),$k). |
---|
[691] | 646 | '<img src="'.dc_admin_icon_url($fav[3]).'" alt="" /> '.'<span class="zoom"><img src="'.dc_admin_icon_url($fav[4]).'" alt="" /></span>'. |
---|
[324] | 647 | __($fav[1]).'</label>'.'</li>'; |
---|
[3] | 648 | } |
---|
| 649 | } |
---|
| 650 | if ($count > 0) echo '</ul>'; |
---|
| 651 | echo |
---|
| 652 | '<p>'. |
---|
| 653 | $core->formNonce(). |
---|
[114] | 654 | '<input type="submit" name="appendaction" value="'.__('Add to my favorites').'" /></p>'; |
---|
[3] | 655 | echo '</div>'; |
---|
[1609] | 656 | |
---|
| 657 | |
---|
[3] | 658 | echo '</div>'; # Two-cols |
---|
| 659 | echo '</form>'; |
---|
| 660 | echo '</div>'; # user-favorites |
---|
| 661 | |
---|
[0] | 662 | dcPage::helpBlock('core_user_pref'); |
---|
| 663 | dcPage::close(); |
---|
[1468] | 664 | ?> |
---|