source: trunk/admin/config.php.example @ 34

Last change on this file since 34 was 34, checked in by moo, 9 years ago

XCache Administration web frontend

File size: 1.2 KB
Line 
1<?php
2
3// this is an example only
4// write your own config and name it as config.php
5
6$charset = "UTF-8";
7
8// this function is detected by xcache.tpl.php, and enabled if function_exists
9// this ob filter is applied for the cache list, not the whole page
10function ob_filter_path_nicer($o)
11{
12    $o = str_replace("/home/", "{H}/", $o);
13    return $o;
14}
15
16// you can simply let xcache to do the http auth
17// but if you have your home made login/permission system, you can implement the following
18// {{{ home made login example
19// this is an example only, it's won't work for you without your implemention.
20function check_admin_and_by_pass_xcache_http_auth()
21{
22    require("/path/to/user-login-and-permission-lib.php");
23    session_start();
24
25    if (!user_logined()) {
26        if (!ask_the_user_to_login()) {
27            exit;
28        }
29    }
30
31    user_load_permissions();
32    if (!user_is_admin()) {
33        die("Permission denied");
34    }
35
36    // user is trusted after permission checks above.
37    // tell XCache about it (the only way to by pass XCache http auth)
38    $_SERVER["PHP_AUTH_USER"] = "moo";
39    $_SERVER["PHP_AUTH_PW"] = "your-xcache-password";
40    return true;
41}
42
43// uncomment:
44// check_admin_and_by_pass_xcache_http_auth();
45// }}}
46
47?>
Note: See TracBrowser for help on using the repository browser.