[0] | 1 | <?php |
---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
| 3 | # |
---|
| 4 | # This file is part of Dotclear 2. |
---|
| 5 | # |
---|
[270] | 6 | # Copyright (c) 2003-2011 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'). |
---|
[3] | 346 | dcPage::jsPageTabs($default_tab). |
---|
[0] | 347 | dcPage::jsConfirmClose('user-form'). |
---|
| 348 | |
---|
| 349 | # --BEHAVIOR-- adminPreferencesHeaders |
---|
| 350 | $core->callBehavior('adminPreferencesHeaders') |
---|
| 351 | ); |
---|
| 352 | |
---|
| 353 | if (!empty($_GET['upd'])) { |
---|
[907] | 354 | dcPage::message(__('Personal information has been successfully updated.')); |
---|
[0] | 355 | } |
---|
[13] | 356 | if (!empty($_GET['updated'])) { |
---|
[907] | 357 | dcPage::message(__('Personal options has been successfully updated.')); |
---|
[13] | 358 | } |
---|
[3] | 359 | if (!empty($_GET['append'])) { |
---|
[907] | 360 | dcPage::message(__('Favorites have been successfully added.')); |
---|
[3] | 361 | } |
---|
| 362 | if (!empty($_GET['neworder'])) { |
---|
[907] | 363 | dcPage::message(__('Favorites have been successfully updated.')); |
---|
[3] | 364 | } |
---|
| 365 | if (!empty($_GET['removed'])) { |
---|
[907] | 366 | dcPage::message(__('Favorites have been successfully removed.')); |
---|
[3] | 367 | } |
---|
[30] | 368 | if (!empty($_GET['replaced'])) { |
---|
[907] | 369 | dcPage::message(__('Default favorites have been successfully updated.')); |
---|
[30] | 370 | } |
---|
[3] | 371 | |
---|
[745] | 372 | echo '<h2>'.html::escapeHTML($core->blog->name).' › <span class="page-title">'.$page_title.'</span></h2>'; |
---|
[13] | 373 | |
---|
[3] | 374 | # User profile |
---|
| 375 | echo '<div class="multi-part" id="user-profile" title="'.__('My profile').'">'; |
---|
[0] | 376 | |
---|
| 377 | echo |
---|
| 378 | '<form action="preferences.php" method="post" id="user-form">'. |
---|
[3] | 379 | '<fieldset><legend>'.__('My profile').'</legend>'. |
---|
[0] | 380 | '<div class="two-cols">'. |
---|
| 381 | '<div class="col">'. |
---|
[11] | 382 | '<p><label for="user_name">'.__('Last Name:'). |
---|
[454] | 383 | form::field('user_name',20,255,html::escapeHTML($user_name)).'</label></p>'. |
---|
[0] | 384 | |
---|
[3] | 385 | '<p><label for="user_firstname">'.__('First Name:'). |
---|
[454] | 386 | form::field('user_firstname',20,255,html::escapeHTML($user_firstname)).'</label></p>'. |
---|
[0] | 387 | |
---|
[3] | 388 | '<p><label for="user_displayname">'.__('Display name:'). |
---|
[454] | 389 | form::field('user_displayname',20,255,html::escapeHTML($user_displayname)).'</label></p>'. |
---|
[0] | 390 | |
---|
[3] | 391 | '<p><label for="user_email">'.__('Email:'). |
---|
[454] | 392 | form::field('user_email',20,255,html::escapeHTML($user_email)).'</label></p>'. |
---|
[0] | 393 | |
---|
[3] | 394 | '<p><label for="user_url">'.__('URL:'). |
---|
[454] | 395 | form::field('user_url',30,255,html::escapeHTML($user_url)).'</label></p>'. |
---|
[0] | 396 | |
---|
| 397 | '</div>'. |
---|
| 398 | |
---|
| 399 | '<div class="col">'. |
---|
| 400 | |
---|
[3] | 401 | '<p><label for="user_lang">'.__('User language:'). |
---|
[454] | 402 | form::combo('user_lang',$lang_combo,$user_lang,'l10n').'</label></p>'. |
---|
[0] | 403 | |
---|
[3] | 404 | '<p><label for="user_tz">'.__('User timezone:'). |
---|
[454] | 405 | form::combo('user_tz',dt::getZones(true,true),$user_tz).'</label></p>'. |
---|
[0] | 406 | |
---|
| 407 | '</div>'. |
---|
| 408 | '</div>'. |
---|
| 409 | '<br class="clear" />'. //Opera sucks |
---|
| 410 | '</fieldset>'; |
---|
| 411 | |
---|
| 412 | if ($core->auth->allowPassChange()) |
---|
| 413 | { |
---|
| 414 | echo |
---|
| 415 | '<fieldset>'. |
---|
| 416 | '<legend>'.__('Change your password').'</legend>'. |
---|
| 417 | |
---|
[3] | 418 | '<p><label for="new_pwd">'.__('New password:'). |
---|
[454] | 419 | form::password('new_pwd',20,255).'</label></p>'. |
---|
[0] | 420 | |
---|
[3] | 421 | '<p><label for="new_pwd_c">'.__('Confirm password:'). |
---|
[454] | 422 | form::password('new_pwd_c',20,255).'</label></p>'. |
---|
[0] | 423 | '</fieldset>'. |
---|
| 424 | |
---|
[536] | 425 | '<p>'.__('If you have changed this user email or password you must provide your current password to save these modifications.').'</p>'. |
---|
[3] | 426 | '<p><label for="cur_pwd">'.__('Your password:'). |
---|
[536] | 427 | form::password('cur_pwd',20,255).'</label></p>'; |
---|
[0] | 428 | } |
---|
| 429 | |
---|
| 430 | echo |
---|
| 431 | '<p class="clear">'. |
---|
| 432 | $core->formNonce(). |
---|
[454] | 433 | '<input type="submit" accesskey="s" value="'.__('Save').'" /></p>'. |
---|
[0] | 434 | '</form>'; |
---|
| 435 | |
---|
[3] | 436 | echo '</div>'; |
---|
| 437 | |
---|
| 438 | # User options : some from actual user profile, dashboard modules, ... |
---|
| 439 | echo '<div class="multi-part" id="user-options" title="'.__('My options').'">'; |
---|
| 440 | |
---|
| 441 | echo |
---|
[114] | 442 | '<form action="preferences.php" method="post" id="opts-forms">'. |
---|
[3] | 443 | '<fieldset><legend>'.__('My options').'</legend>'. |
---|
| 444 | |
---|
| 445 | '<p><label for="user_post_format">'.__('Preferred format:'). |
---|
[454] | 446 | form::combo('user_post_format',$formaters_combo,$user_options['post_format']).'</label></p>'. |
---|
[3] | 447 | |
---|
| 448 | '<p><label for="user_post_status">'.__('Default entry status:'). |
---|
[454] | 449 | form::combo('user_post_status',$status_combo,$user_post_status).'</label></p>'. |
---|
[3] | 450 | |
---|
| 451 | '<p><label for="user_edit_size">'.__('Entry edit field height:'). |
---|
[454] | 452 | form::field('user_edit_size',5,4,(integer) $user_options['edit_size']).'</label></p>'. |
---|
[3] | 453 | |
---|
| 454 | '<p><label for="user_wysiwyg" class="classic">'. |
---|
[454] | 455 | form::checkbox('user_wysiwyg',1,$user_options['enable_wysiwyg']).' '. |
---|
[3] | 456 | __('Enable WYSIWYG mode').'</label></p>'. |
---|
[240] | 457 | |
---|
| 458 | '<p><label for="user_ui_enhanceduploader" class="classic">'. |
---|
[454] | 459 | form::checkbox('user_ui_enhanceduploader',1,$user_ui_enhanceduploader).' '. |
---|
[821] | 460 | __('Activate enhanced uploader in media manager').'</label></p>'. |
---|
| 461 | |
---|
| 462 | '<p><label for="user_ui_nofavmenu" class="classic">'. |
---|
| 463 | form::checkbox('user_ui_nofavmenu',1,$user_ui_nofavmenu).' '. |
---|
| 464 | __('Hide My favorites menu').'</label></p>'; |
---|
[692] | 465 | |
---|
[712] | 466 | if (count($iconsets_combo) > 1) { |
---|
| 467 | echo |
---|
| 468 | '<p><label for="user_ui_iconset">'.__('Iconset:'). |
---|
| 469 | form::combo('user_ui_iconset',$iconsets_combo,$user_ui_iconset).'</label></p>'; |
---|
| 470 | } else { |
---|
| 471 | form::hidden('user_ui_iconset',''); |
---|
| 472 | } |
---|
[240] | 473 | |
---|
[244] | 474 | if ($core->auth->isSuperAdmin()) { |
---|
| 475 | echo |
---|
| 476 | '<p><label for="user_ui_hide_std_favicon" class="classic">'. |
---|
[454] | 477 | form::checkbox('user_ui_hide_std_favicon',1,$user_ui_hide_std_favicon).' '. |
---|
[244] | 478 | __('Do not use standard favicon').'</label></p>'. |
---|
| 479 | '<p class="clear form-note info">'.__('This will be applied for all users').'</p>'; |
---|
| 480 | } |
---|
| 481 | |
---|
| 482 | echo |
---|
[3] | 483 | '<br class="clear" />'. //Opera sucks |
---|
| 484 | '</fieldset>'; |
---|
| 485 | |
---|
[13] | 486 | echo |
---|
[160] | 487 | '<fieldset><legend>'.__('Accessibility options').'</legend>'. |
---|
| 488 | |
---|
[240] | 489 | '<p><label for="user_acc_nodragdrop" class="classic">'. |
---|
[454] | 490 | form::checkbox('user_acc_nodragdrop',1,$user_acc_nodragdrop).' '. |
---|
[160] | 491 | __('Disable javascript powered drag and drop for ordering items').'</label></p>'. |
---|
| 492 | |
---|
[190] | 493 | '<p class="clear form-note info">'.__('Numeric fields will allow to type the elements\' ordering number.').'</p>'. |
---|
[160] | 494 | '</fieldset>'; |
---|
| 495 | |
---|
| 496 | echo |
---|
[13] | 497 | '<fieldset><legend>'.__('Dashboard modules').'</legend>'. |
---|
| 498 | |
---|
| 499 | '<p><label for="user_dm_doclinks" class="classic">'. |
---|
[454] | 500 | form::checkbox('user_dm_doclinks',1,$user_dm_doclinks).' '. |
---|
[13] | 501 | __('Display documentation links').'</label></p>'. |
---|
| 502 | |
---|
| 503 | '<p><label for="user_dm_dcnews" class="classic">'. |
---|
[454] | 504 | form::checkbox('user_dm_dcnews',1,$user_dm_dcnews).' '. |
---|
[13] | 505 | __('Display Dotclear news').'</label></p>'. |
---|
| 506 | |
---|
| 507 | '<p><label for="user_dm_quickentry" class="classic">'. |
---|
[454] | 508 | form::checkbox('user_dm_quickentry',1,$user_dm_quickentry).' '. |
---|
[13] | 509 | __('Display quick entry form').'</label></p>'. |
---|
| 510 | |
---|
| 511 | '<br class="clear" />'. //Opera sucks |
---|
| 512 | '</fieldset>'; |
---|
| 513 | |
---|
[3] | 514 | # --BEHAVIOR-- adminPreferencesForm |
---|
| 515 | $core->callBehavior('adminPreferencesForm',$core); |
---|
| 516 | |
---|
| 517 | echo |
---|
| 518 | '<p class="clear">'. |
---|
| 519 | $core->formNonce(). |
---|
[454] | 520 | '<input type="submit" accesskey="s" value="'.__('Save').'" /></p>'. |
---|
[3] | 521 | '</form>'; |
---|
| 522 | |
---|
| 523 | echo '</div>'; |
---|
| 524 | |
---|
| 525 | # User favorites |
---|
| 526 | echo '<div class="multi-part" id="user-favorites" title="'.__('My favorites').'">'; |
---|
| 527 | $ws = $core->auth->user_prefs->addWorkspace('favorites'); |
---|
| 528 | echo '<form action="preferences.php" method="post" id="favs-form">'; |
---|
| 529 | echo '<div class="two-cols">'; |
---|
| 530 | echo '<div class="col70">'; |
---|
| 531 | echo '<fieldset id="my-favs"><legend>'.__('My favorites').'</legend>'; |
---|
[32] | 532 | |
---|
[3] | 533 | $count = 0; |
---|
| 534 | foreach ($ws->dumpPrefs() as $k => $v) { |
---|
| 535 | // User favorites only |
---|
| 536 | if (!$v['global']) { |
---|
| 537 | $fav = unserialize($v['value']); |
---|
| 538 | if (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)) { |
---|
| 539 | if ($count == 0) echo '<ul>'; |
---|
| 540 | $count++; |
---|
| 541 | echo '<li id="fu-'.$k.'">'. |
---|
[691] | 542 | '<img src="'.dc_admin_icon_url($fav['large-icon']).'" alt="" /> '. |
---|
[35] | 543 | form::field(array('order['.$k.']'),2,3,$count,'position','',false,'title="'.sprintf(__('position of %s'),$fav['title']).'"'). |
---|
[114] | 544 | form::hidden(array('dynorder[]','dynorder-'.$k.''),$k). |
---|
[324] | 545 | '<label for="fuk-'.$k.'">'.form::checkbox(array('remove[]','fuk-'.$k),$k).__($fav['title']).'</label>'. |
---|
[3] | 546 | '</li>'; |
---|
| 547 | } |
---|
| 548 | } |
---|
| 549 | } |
---|
| 550 | if ($count > 0) echo '</ul>'; |
---|
| 551 | if ($count > 0) { |
---|
| 552 | echo |
---|
| 553 | '<div class="clear">'. |
---|
[82] | 554 | '<p>'.form::hidden('favs_order',''). |
---|
[3] | 555 | $core->formNonce(). |
---|
[114] | 556 | '<input type="submit" name="saveorder" value="'.__('Save order').'" /> '. |
---|
| 557 | |
---|
| 558 | '<input type="submit" class="delete" name="removeaction" '. |
---|
[3] | 559 | 'value="'.__('Delete selected favorites').'" '. |
---|
| 560 | 'onclick="return window.confirm(\''.html::escapeJS( |
---|
| 561 | __('Are you sure you want to remove selected favorites?')).'\');" /></p>'. |
---|
[82] | 562 | |
---|
| 563 | ($core->auth->isSuperAdmin() ? |
---|
[114] | 564 | '<hr />'. |
---|
| 565 | '<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>'. |
---|
| 566 | '<p><input class="reset" type="submit" name="replace" value="'.__('Define as default favorites').'" />' : |
---|
| 567 | ''). |
---|
| 568 | '</p>'. |
---|
[3] | 569 | '</div>'; |
---|
| 570 | } else { |
---|
| 571 | echo |
---|
| 572 | '<p>'.__('Currently no personal favorites.').'</p>'; |
---|
| 573 | } |
---|
| 574 | |
---|
| 575 | echo '</fieldset>'; |
---|
| 576 | |
---|
| 577 | echo '<div id="default-favs"><h3>'.__('Default favorites').'</h3>'; |
---|
[133] | 578 | echo '<p class="form-note info clear">'.__('Those favorites are displayed when My Favorites list is empty.').'</p>'; |
---|
[3] | 579 | $count = 0; |
---|
| 580 | foreach ($ws->dumpPrefs() as $k => $v) { |
---|
| 581 | // Global favorites only |
---|
| 582 | if ($v['global']) { |
---|
| 583 | $fav = unserialize($v['value']); |
---|
| 584 | if (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)) { |
---|
| 585 | if ($count == 0) echo '<ul class="fav-list">'; |
---|
| 586 | $count++; |
---|
| 587 | echo '<li id="fd-'.$k.'">'. |
---|
[691] | 588 | '<img src="'.dc_admin_icon_url($fav['small-icon']).'" alt="" /> '.__($fav['title']).'</li>'; |
---|
[3] | 589 | } |
---|
| 590 | } |
---|
| 591 | } |
---|
| 592 | if ($count > 0) echo '</ul>'; |
---|
| 593 | echo '</div>'; |
---|
| 594 | echo '</div>'; |
---|
| 595 | echo '<div class="col30" id="available-favs">'; |
---|
| 596 | # Available favorites |
---|
| 597 | echo '<fieldset><legend>'.__('Available favorites').'</legend>'; |
---|
| 598 | $count = 0; |
---|
| 599 | $array = $_fav; |
---|
| 600 | function cmp($a,$b) { |
---|
[371] | 601 | if (__($a[1]) == __($b[1])) { |
---|
[3] | 602 | return 0; |
---|
| 603 | } |
---|
[371] | 604 | return (__($a[1]) < __($b[1])) ? -1 : 1; |
---|
[3] | 605 | } |
---|
[162] | 606 | $array=$array->getArrayCopy(); |
---|
| 607 | uasort($array,'cmp'); |
---|
[3] | 608 | foreach ($array as $k => $fav) { |
---|
| 609 | if (($fav[5] == '*') || $core->auth->check($fav[5],$core->blog->id)) { |
---|
| 610 | if ($count == 0) echo '<ul class="fav-list">'; |
---|
| 611 | $count++; |
---|
| 612 | echo '<li id="fa-'.$fav[0].'">'.'<label for="fak-'.$fav[0].'">'. |
---|
[11] | 613 | form::checkbox(array('append[]','fak-'.$fav[0]),$k). |
---|
[691] | 614 | '<img src="'.dc_admin_icon_url($fav[3]).'" alt="" /> '.'<span class="zoom"><img src="'.dc_admin_icon_url($fav[4]).'" alt="" /></span>'. |
---|
[324] | 615 | __($fav[1]).'</label>'.'</li>'; |
---|
[3] | 616 | } |
---|
| 617 | } |
---|
| 618 | if ($count > 0) echo '</ul>'; |
---|
| 619 | echo |
---|
| 620 | '<p>'. |
---|
| 621 | $core->formNonce(). |
---|
[114] | 622 | '<input type="submit" name="appendaction" value="'.__('Add to my favorites').'" /></p>'; |
---|
| 623 | echo '</fieldset>'; |
---|
[3] | 624 | echo '</div>'; |
---|
| 625 | echo '</div>'; # Two-cols |
---|
| 626 | echo '</form>'; |
---|
| 627 | echo '</div>'; # user-favorites |
---|
| 628 | |
---|
[0] | 629 | dcPage::helpBlock('core_user_pref'); |
---|
| 630 | dcPage::close(); |
---|
[821] | 631 | ?> |
---|