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

Last change on this file since 125 was 125, checked in by moo, 8 years ago

sync admin scripts with coverager

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