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