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

Last change on this file since 526 was 526, checked in by moo, 6 years ago

allow user decide to show used or free blocks/percent

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