uses perms field from auth groupex
[wikifarm.git] / install / cookbook / skinchange.php
1 <?php
2 /* Copyright 2004 Patrick R. Michaud (pmichaud@pobox.com)
3
4 This script enables the ?skin= and ?setskin= parameters for
5 wiki pages. The ?skin= parameter causes the current page to be
6 displayed with some alternate skin (defined by the WikiAdministrator),
7 the ?setskin= parameter sets a cookie on the user's browser to
8 always display pages with the requested skin.
9
10 To use this script, define an array called $PageSkinList
11 containing skin names and template files, then
12 include('cookbook/skinchange.php'); in your config.php.
13 An example $PageSkinList to set up 'pmwiki', 'myskin',
14 and 'classic' skins might read:
15
16 $PageSkinList = array(
17 'pmwiki' => 'pmwiki',
18 'myskin' => 'myskin',
19 'classic' => 'myclassicskin');
20
21 If a URL requests a skin that isn't in this array, then PmWiki
22 defaults to the skin already defined by $Skin.
23
24 By default, the setskin cookie that is created will expire after
25 one year. You can set it to expire at the end of the browser
26 session by setting $SkinCookieExpires=0;
27 */
28
29 SDV($SkinCookie, $CookiePrefix.'setskin');
30 SDV($SkinCookieExpires, $Now+60*60*24*365);
31
32 if (isset($_COOKIE[$SkinCookie])) $sk = $_COOKIE[$SkinCookie];
33 if (isset($_GET['setskin'])) {
34 $sk = $_GET['setskin'];
35 setcookie($SkinCookie, $sk, $SkinCookieExpires, '/');
36 }
37 if (isset($_GET['skin'])) $sk = $_GET['skin'];
38 if (@$PageSkinList[$sk]) $Skin = $PageSkinList[$sk];