prefs.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php if (!defined('PmWiki')) exit();
  2. /* Copyright 2005-2006 Patrick R. Michaud (pmichaud@pobox.com)
  3. This file is part of PmWiki; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published
  5. by the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version. See pmwiki.php for full details.
  7. This script handles per-browser preferences. Preference settings
  8. are stored in wiki pages as XLPage translations, and a cookie on
  9. the browser tells PmWiki where to find the browser's preferred
  10. settings.
  11. This script looks for a ?setprefs= request parameter (e.g., in
  12. a url); when it finds one it sets a 'setprefs' cookie on the browser
  13. identifying the page to be used to load browser preferences,
  14. and loads the associated preferences.
  15. If there is no ?setprefs= request, then the script uses the
  16. 'setprefs' cookie from the browser to load the preference settings.
  17. */
  18. SDV($PrefsCookie, $CookiePrefix.'setprefs');
  19. SDV($PrefsCookieExpires, $Now + 60 * 60 * 24 * 365);
  20. $LogoutCookies[] = $PrefsCookie;
  21. $sp = '';
  22. if (@$_COOKIE[$PrefsCookie]) $sp = $_COOKIE[$PrefsCookie];
  23. if (isset($_GET['setprefs'])) {
  24. $sp = $_GET['setprefs'];
  25. setcookie($PrefsCookie, $sp, $PrefsCookieExpires, '/');
  26. }
  27. if ($sp && PageExists($sp)) XLPage('prefs', $sp);
  28. XLSDV('en', array(
  29. 'ak_view' => '',
  30. 'ak_edit' => 'e',
  31. 'ak_history' => 'h',
  32. 'ak_print' => '',
  33. 'ak_recentchanges' => 'c',
  34. 'ak_save' => 's',
  35. 'ak_saveedit' => 'u',
  36. 'ak_savedraft' => 'd',
  37. 'ak_preview' => 'p',
  38. 'ak_em' => '',
  39. 'ak_strong' => '',
  40. ));