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