| 1 | <?php |
|---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
|---|
| 3 | # |
|---|
| 4 | # This file is part of Dotclear 2. |
|---|
| 5 | # |
|---|
| 6 | # Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear |
|---|
| 7 | # Licensed under the GPL version 2.0 license. |
|---|
| 8 | # See LICENSE file or |
|---|
| 9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
|---|
| 10 | # |
|---|
| 11 | # -- END LICENSE BLOCK ----------------------------------------- |
|---|
| 12 | |
|---|
| 13 | require dirname(__FILE__).'/../inc/admin/prepend.php'; |
|---|
| 14 | |
|---|
| 15 | dcPage::check('usage,contentadmin'); |
|---|
| 16 | |
|---|
| 17 | $page_title = __('My preferences'); |
|---|
| 18 | |
|---|
| 19 | $user_name = $core->auth->getInfo('user_name'); |
|---|
| 20 | $user_firstname = $core->auth->getInfo('user_firstname'); |
|---|
| 21 | $user_displayname = $core->auth->getInfo('user_displayname'); |
|---|
| 22 | $user_email = $core->auth->getInfo('user_email'); |
|---|
| 23 | $user_url = $core->auth->getInfo('user_url'); |
|---|
| 24 | $user_lang = $core->auth->getInfo('user_lang'); |
|---|
| 25 | $user_tz = $core->auth->getInfo('user_tz'); |
|---|
| 26 | $user_post_status = $core->auth->getInfo('user_post_status'); |
|---|
| 27 | |
|---|
| 28 | $user_options = $core->auth->getOptions(); |
|---|
| 29 | |
|---|
| 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 | |
|---|
| 35 | $core->auth->user_prefs->addWorkspace('accessibility'); |
|---|
| 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; |
|---|
| 40 | if ($core->auth->isSuperAdmin()) { |
|---|
| 41 | $user_ui_hide_std_favicon = $core->auth->user_prefs->interface->hide_std_favicon; |
|---|
| 42 | } |
|---|
| 43 | $user_ui_iconset = @$core->auth->user_prefs->interface->iconset; |
|---|
| 44 | $user_ui_nofavmenu = $core->auth->user_prefs->interface->nofavmenu; |
|---|
| 45 | |
|---|
| 46 | $default_tab = !empty($_GET['tab']) ? html::escapeHTML($_GET['tab']) : 'user-profile'; |
|---|
| 47 | |
|---|
| 48 | if (!empty($_GET['append']) || !empty($_GET['removed']) || !empty($_GET['neworder']) || |
|---|
| 49 | !empty($_GET['replaced']) || !empty($_POST['appendaction']) || !empty($_POST['removeaction'])) { |
|---|
| 50 | $default_tab = 'user-favorites'; |
|---|
| 51 | } elseif (!empty($_GET['updated'])) { |
|---|
| 52 | $default_tab = 'user-options'; |
|---|
| 53 | } |
|---|
| 54 | if (($default_tab != 'user-profile') && ($default_tab != 'user-options') && ($default_tab != 'user-favorites')) { |
|---|
| 55 | $default_tab = 'user-profile'; |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 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 | |
|---|
| 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 | |
|---|
| 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']; |
|---|
| 105 | |
|---|
| 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 |
|---|
| 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 |
|---|
| 139 | if (isset($_POST['user_post_format'])) |
|---|
| 140 | { |
|---|
| 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 | |
|---|
| 164 | # --BEHAVIOR-- adminBeforeUserOptionsUpdate |
|---|
| 165 | $core->callBehavior('adminBeforeUserOptionsUpdate',$cur,$core->auth->userID()); |
|---|
| 166 | |
|---|
| 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'); |
|---|
| 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'); |
|---|
| 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 | } |
|---|
| 177 | $core->auth->user_prefs->interface->put('iconset',(!empty($_POST['user_ui_iconset']) ? $_POST['user_ui_iconset'] : '')); |
|---|
| 178 | $core->auth->user_prefs->interface->put('nofavmenu',!empty($_POST['user_ui_nofavmenu']),'boolean'); |
|---|
| 179 | |
|---|
| 180 | # Udate user |
|---|
| 181 | $core->updUser($core->auth->userID(),$cur); |
|---|
| 182 | |
|---|
| 183 | # --BEHAVIOR-- adminAfterUserOptionsUpdate |
|---|
| 184 | $core->callBehavior('adminAfterUserOptionsUpdate',$cur,$core->auth->userID()); |
|---|
| 185 | |
|---|
| 186 | http::redirect('preferences.php?updated=1'); |
|---|
| 187 | } |
|---|
| 188 | catch (Exception $e) |
|---|
| 189 | { |
|---|
| 190 | $core->error->add($e->getMessage()); |
|---|
| 191 | } |
|---|
| 192 | } |
|---|
| 193 | |
|---|
| 194 | # Add selected favorites |
|---|
| 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 |
|---|
| 256 | try { |
|---|
| 257 | $user_favs = $ws->DumpLocalPrefs(); |
|---|
| 258 | $core->auth->user_prefs->favorites->dropAll(); |
|---|
| 259 | $count = 0; |
|---|
| 260 | foreach ($user_favs as $k => $v) |
|---|
| 261 | { |
|---|
| 262 | $uid = sprintf("u%03s",$count); |
|---|
| 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']); |
|---|
| 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 | |
|---|
| 273 | if (!$core->error->flag()) { |
|---|
| 274 | http::redirect('preferences.php?removed=1'); |
|---|
| 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 { |
|---|
| 294 | $ws = $core->auth->user_prefs->addWorkspace('favorites'); |
|---|
| 295 | $user_favs = $ws->DumpLocalPrefs(); |
|---|
| 296 | $core->auth->user_prefs->favorites->dropAll(); |
|---|
| 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 | |
|---|
| 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(); |
|---|
| 320 | $core->auth->user_prefs->favorites->dropAll(true); |
|---|
| 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 | } |
|---|
| 339 | |
|---|
| 340 | /* DISPLAY |
|---|
| 341 | -------------------------------------------------------- */ |
|---|
| 342 | dcPage::open($page_title, |
|---|
| 343 | dcPage::jsLoad('js/_preferences.js'). |
|---|
| 344 | ($user_acc_nodragdrop ? '' : dcPage::jsLoad('js/_preferences-dragdrop.js')). |
|---|
| 345 | dcPage::jsLoad('js/jquery/jquery-ui.custom.js'). |
|---|
| 346 | dcPage::jsPageTabs($default_tab). |
|---|
| 347 | dcPage::jsConfirmClose('user-form'). |
|---|
| 348 | |
|---|
| 349 | # --BEHAVIOR-- adminPreferencesHeaders |
|---|
| 350 | $core->callBehavior('adminPreferencesHeaders') |
|---|
| 351 | ); |
|---|
| 352 | |
|---|
| 353 | if (!empty($_GET['upd'])) { |
|---|
| 354 | dcPage::message(__('Personal information has been successfully updated.')); |
|---|
| 355 | } |
|---|
| 356 | if (!empty($_GET['updated'])) { |
|---|
| 357 | dcPage::message(__('Personal options has been successfully updated.')); |
|---|
| 358 | } |
|---|
| 359 | if (!empty($_GET['append'])) { |
|---|
| 360 | dcPage::message(__('Favorites have been successfully added.')); |
|---|
| 361 | } |
|---|
| 362 | if (!empty($_GET['neworder'])) { |
|---|
| 363 | dcPage::message(__('Favorites have been successfully updated.')); |
|---|
| 364 | } |
|---|
| 365 | if (!empty($_GET['removed'])) { |
|---|
| 366 | dcPage::message(__('Favorites have been successfully removed.')); |
|---|
| 367 | } |
|---|
| 368 | if (!empty($_GET['replaced'])) { |
|---|
| 369 | dcPage::message(__('Default favorites have been successfully updated.')); |
|---|
| 370 | } |
|---|
| 371 | |
|---|
| 372 | echo '<h2>'.html::escapeHTML($core->blog->name).' › <span class="page-title">'.$page_title.'</span></h2>'; |
|---|
| 373 | |
|---|
| 374 | # User profile |
|---|
| 375 | echo '<div class="multi-part" id="user-profile" title="'.__('My profile').'">'; |
|---|
| 376 | |
|---|
| 377 | echo |
|---|
| 378 | '<form action="preferences.php" method="post" id="user-form">'. |
|---|
| 379 | '<fieldset><legend>'.__('My profile').'</legend>'. |
|---|
| 380 | '<div class="two-cols">'. |
|---|
| 381 | '<div class="col">'. |
|---|
| 382 | '<p><label for="user_name">'.__('Last Name:'). |
|---|
| 383 | form::field('user_name',20,255,html::escapeHTML($user_name)).'</label></p>'. |
|---|
| 384 | |
|---|
| 385 | '<p><label for="user_firstname">'.__('First Name:'). |
|---|
| 386 | form::field('user_firstname',20,255,html::escapeHTML($user_firstname)).'</label></p>'. |
|---|
| 387 | |
|---|
| 388 | '<p><label for="user_displayname">'.__('Display name:'). |
|---|
| 389 | form::field('user_displayname',20,255,html::escapeHTML($user_displayname)).'</label></p>'. |
|---|
| 390 | |
|---|
| 391 | '<p><label for="user_email">'.__('Email:'). |
|---|
| 392 | form::field('user_email',20,255,html::escapeHTML($user_email)).'</label></p>'. |
|---|
| 393 | |
|---|
| 394 | '<p><label for="user_url">'.__('URL:'). |
|---|
| 395 | form::field('user_url',30,255,html::escapeHTML($user_url)).'</label></p>'. |
|---|
| 396 | |
|---|
| 397 | '</div>'. |
|---|
| 398 | |
|---|
| 399 | '<div class="col">'. |
|---|
| 400 | |
|---|
| 401 | '<p><label for="user_lang">'.__('User language:'). |
|---|
| 402 | form::combo('user_lang',$lang_combo,$user_lang,'l10n').'</label></p>'. |
|---|
| 403 | |
|---|
| 404 | '<p><label for="user_tz">'.__('User timezone:'). |
|---|
| 405 | form::combo('user_tz',dt::getZones(true,true),$user_tz).'</label></p>'. |
|---|
| 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 | |
|---|
| 418 | '<p><label for="new_pwd">'.__('New password:'). |
|---|
| 419 | form::password('new_pwd',20,255).'</label></p>'. |
|---|
| 420 | |
|---|
| 421 | '<p><label for="new_pwd_c">'.__('Confirm password:'). |
|---|
| 422 | form::password('new_pwd_c',20,255).'</label></p>'. |
|---|
| 423 | '</fieldset>'. |
|---|
| 424 | |
|---|
| 425 | '<p>'.__('If you have changed this user email or password you must provide your current password to save these modifications.').'</p>'. |
|---|
| 426 | '<p><label for="cur_pwd">'.__('Your password:'). |
|---|
| 427 | form::password('cur_pwd',20,255).'</label></p>'; |
|---|
| 428 | } |
|---|
| 429 | |
|---|
| 430 | echo |
|---|
| 431 | '<p class="clear">'. |
|---|
| 432 | $core->formNonce(). |
|---|
| 433 | '<input type="submit" accesskey="s" value="'.__('Save').'" /></p>'. |
|---|
| 434 | '</form>'; |
|---|
| 435 | |
|---|
| 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 |
|---|
| 442 | '<form action="preferences.php" method="post" id="opts-forms">'. |
|---|
| 443 | '<fieldset><legend>'.__('My options').'</legend>'. |
|---|
| 444 | |
|---|
| 445 | '<p><label for="user_post_format">'.__('Preferred format:'). |
|---|
| 446 | form::combo('user_post_format',$formaters_combo,$user_options['post_format']).'</label></p>'. |
|---|
| 447 | |
|---|
| 448 | '<p><label for="user_post_status">'.__('Default entry status:'). |
|---|
| 449 | form::combo('user_post_status',$status_combo,$user_post_status).'</label></p>'. |
|---|
| 450 | |
|---|
| 451 | '<p><label for="user_edit_size">'.__('Entry edit field height:'). |
|---|
| 452 | form::field('user_edit_size',5,4,(integer) $user_options['edit_size']).'</label></p>'. |
|---|
| 453 | |
|---|
| 454 | '<p><label for="user_wysiwyg" class="classic">'. |
|---|
| 455 | form::checkbox('user_wysiwyg',1,$user_options['enable_wysiwyg']).' '. |
|---|
| 456 | __('Enable WYSIWYG mode').'</label></p>'. |
|---|
| 457 | |
|---|
| 458 | '<p><label for="user_ui_enhanceduploader" class="classic">'. |
|---|
| 459 | form::checkbox('user_ui_enhanceduploader',1,$user_ui_enhanceduploader).' '. |
|---|
| 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>'; |
|---|
| 465 | |
|---|
| 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 | } |
|---|
| 473 | |
|---|
| 474 | if ($core->auth->isSuperAdmin()) { |
|---|
| 475 | echo |
|---|
| 476 | '<p><label for="user_ui_hide_std_favicon" class="classic">'. |
|---|
| 477 | form::checkbox('user_ui_hide_std_favicon',1,$user_ui_hide_std_favicon).' '. |
|---|
| 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 |
|---|
| 483 | '<br class="clear" />'. //Opera sucks |
|---|
| 484 | '</fieldset>'; |
|---|
| 485 | |
|---|
| 486 | echo |
|---|
| 487 | '<fieldset><legend>'.__('Accessibility options').'</legend>'. |
|---|
| 488 | |
|---|
| 489 | '<p><label for="user_acc_nodragdrop" class="classic">'. |
|---|
| 490 | form::checkbox('user_acc_nodragdrop',1,$user_acc_nodragdrop).' '. |
|---|
| 491 | __('Disable javascript powered drag and drop for ordering items').'</label></p>'. |
|---|
| 492 | |
|---|
| 493 | '<p class="clear form-note info">'.__('Numeric fields will allow to type the elements\' ordering number.').'</p>'. |
|---|
| 494 | '</fieldset>'; |
|---|
| 495 | |
|---|
| 496 | echo |
|---|
| 497 | '<fieldset><legend>'.__('Dashboard modules').'</legend>'. |
|---|
| 498 | |
|---|
| 499 | '<p><label for="user_dm_doclinks" class="classic">'. |
|---|
| 500 | form::checkbox('user_dm_doclinks',1,$user_dm_doclinks).' '. |
|---|
| 501 | __('Display documentation links').'</label></p>'. |
|---|
| 502 | |
|---|
| 503 | '<p><label for="user_dm_dcnews" class="classic">'. |
|---|
| 504 | form::checkbox('user_dm_dcnews',1,$user_dm_dcnews).' '. |
|---|
| 505 | __('Display Dotclear news').'</label></p>'. |
|---|
| 506 | |
|---|
| 507 | '<p><label for="user_dm_quickentry" class="classic">'. |
|---|
| 508 | form::checkbox('user_dm_quickentry',1,$user_dm_quickentry).' '. |
|---|
| 509 | __('Display quick entry form').'</label></p>'. |
|---|
| 510 | |
|---|
| 511 | '<br class="clear" />'. //Opera sucks |
|---|
| 512 | '</fieldset>'; |
|---|
| 513 | |
|---|
| 514 | # --BEHAVIOR-- adminPreferencesForm |
|---|
| 515 | $core->callBehavior('adminPreferencesForm',$core); |
|---|
| 516 | |
|---|
| 517 | echo |
|---|
| 518 | '<p class="clear">'. |
|---|
| 519 | $core->formNonce(). |
|---|
| 520 | '<input type="submit" accesskey="s" value="'.__('Save').'" /></p>'. |
|---|
| 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>'; |
|---|
| 532 | |
|---|
| 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.'">'. |
|---|
| 542 | '<img src="'.dc_admin_icon_url($fav['large-icon']).'" alt="" /> '. |
|---|
| 543 | form::field(array('order['.$k.']'),2,3,$count,'position','',false,'title="'.sprintf(__('position of %s'),$fav['title']).'"'). |
|---|
| 544 | form::hidden(array('dynorder[]','dynorder-'.$k.''),$k). |
|---|
| 545 | '<label for="fuk-'.$k.'">'.form::checkbox(array('remove[]','fuk-'.$k),$k).__($fav['title']).'</label>'. |
|---|
| 546 | '</li>'; |
|---|
| 547 | } |
|---|
| 548 | } |
|---|
| 549 | } |
|---|
| 550 | if ($count > 0) echo '</ul>'; |
|---|
| 551 | if ($count > 0) { |
|---|
| 552 | echo |
|---|
| 553 | '<div class="clear">'. |
|---|
| 554 | '<p>'.form::hidden('favs_order',''). |
|---|
| 555 | $core->formNonce(). |
|---|
| 556 | '<input type="submit" name="saveorder" value="'.__('Save order').'" /> '. |
|---|
| 557 | |
|---|
| 558 | '<input type="submit" class="delete" name="removeaction" '. |
|---|
| 559 | 'value="'.__('Delete selected favorites').'" '. |
|---|
| 560 | 'onclick="return window.confirm(\''.html::escapeJS( |
|---|
| 561 | __('Are you sure you want to remove selected favorites?')).'\');" /></p>'. |
|---|
| 562 | |
|---|
| 563 | ($core->auth->isSuperAdmin() ? |
|---|
| 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>'. |
|---|
| 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>'; |
|---|
| 578 | echo '<p class="form-note info clear">'.__('Those favorites are displayed when My Favorites list is empty.').'</p>'; |
|---|
| 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.'">'. |
|---|
| 588 | '<img src="'.dc_admin_icon_url($fav['small-icon']).'" alt="" /> '.__($fav['title']).'</li>'; |
|---|
| 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) { |
|---|
| 601 | if (__($a[1]) == __($b[1])) { |
|---|
| 602 | return 0; |
|---|
| 603 | } |
|---|
| 604 | return (__($a[1]) < __($b[1])) ? -1 : 1; |
|---|
| 605 | } |
|---|
| 606 | $array=$array->getArrayCopy(); |
|---|
| 607 | uasort($array,'cmp'); |
|---|
| 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].'">'. |
|---|
| 613 | form::checkbox(array('append[]','fak-'.$fav[0]),$k). |
|---|
| 614 | '<img src="'.dc_admin_icon_url($fav[3]).'" alt="" /> '.'<span class="zoom"><img src="'.dc_admin_icon_url($fav[4]).'" alt="" /></span>'. |
|---|
| 615 | __($fav[1]).'</label>'.'</li>'; |
|---|
| 616 | } |
|---|
| 617 | } |
|---|
| 618 | if ($count > 0) echo '</ul>'; |
|---|
| 619 | echo |
|---|
| 620 | '<p>'. |
|---|
| 621 | $core->formNonce(). |
|---|
| 622 | '<input type="submit" name="appendaction" value="'.__('Add to my favorites').'" /></p>'; |
|---|
| 623 | echo '</fieldset>'; |
|---|
| 624 | echo '</div>'; |
|---|
| 625 | echo '</div>'; # Two-cols |
|---|
| 626 | echo '</form>'; |
|---|
| 627 | echo '</div>'; # user-favorites |
|---|
| 628 | |
|---|
| 629 | dcPage::helpBlock('core_user_pref'); |
|---|
| 630 | dcPage::close(); |
|---|
| 631 | ?> |
|---|