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