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

Last change on this file since 523 was 523, checked in by moo, 7 years ago

fix possible wrong separator in docuemnt root

File size: 1.6 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// width of graph for free blocks
15$free_graph_width = 120;
16
17// this function is detected by xcache.tpl.php, and enabled if function_exists
18// this ob filter is applied for the cache list, not the whole page
19function ob_filter_path_nicer($o)
20{
21    $sep = DIRECTORY_SEPARATOR;
22    $o = str_replace($_SERVER['DOCUMENT_ROOT'],  "{DOCROOT}" . (substr($d, -1) == $sep ? $sep : ""), $o);
23    $xcachedir = realpath(dirname(__FILE__) . "$sep..$sep");
24    $o = str_replace($xcachedir . $sep, "{XCache}$sep", $o);
25    if ($sep == '/') {
26        $o = str_replace("/home/", "{H}/", $o);
27    }
28    return $o;
29}
30
31// you can simply let xcache to do the http auth
32// but if you have your home made login/permission system, you can implement the following
33// {{{ home made login example
34// this is an example only, it's won't work for you without your implemention.
35function check_admin_and_by_pass_xcache_http_auth()
36{
37    require("/path/to/user-login-and-permission-lib.php");
38    session_start();
39
40    if (!user_logined()) {
41        if (!ask_the_user_to_login()) {
42            exit;
43        }
44    }
45
46    user_load_permissions();
47    if (!user_is_admin()) {
48        die("Permission denied");
49    }
50
51    // user is trusted after permission checks above.
52    // tell XCache about it (the only way to by pass XCache http auth)
53    $_SERVER["PHP_AUTH_USER"] = "moo";
54    $_SERVER["PHP_AUTH_PW"] = "your-xcache-password";
55    return true;
56}
57
58// uncomment:
59// check_admin_and_by_pass_xcache_http_auth();
60// }}}
61
62?>
Note: See TracBrowser for help on using the repository browser.