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

Last change on this file since 647 was 647, checked in by moo, 5 years ago

fix config example, undefined variable d

  • Property svn:eol-style set to native
File size: 1.8 KB
RevLine 
[34]1<?php
2
3// this is an example only
4// write your own config and name it as config.php
5
[123]6// detected by browser
7// $lang = 'en-us';
8
[34]9$charset = "UTF-8";
10
[123]11// developers only
12$show_todo_strings = false;
13
[526]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;
[517]18
[591]19// only enable if you have password protection for admin page
20// enabling this option will cause user to eval() whatever code they want
21$enable_eval = false;
22
[34]23// this function is detected by xcache.tpl.php, and enabled if function_exists
24// this ob filter is applied for the cache list, not the whole page
25function ob_filter_path_nicer($o)
26{
[161]27    $sep = DIRECTORY_SEPARATOR;
[647]28    $d = $_SERVER['DOCUMENT_ROOT'];
29    $o = str_replace($d,  "{DOCROOT}" . (substr($d, -1) == $sep ? $sep : ""), $o);
[161]30    $xcachedir = realpath(dirname(__FILE__) . "$sep..$sep");
31    $o = str_replace($xcachedir . $sep, "{XCache}$sep", $o);
32    if ($sep == '/') {
33        $o = str_replace("/home/", "{H}/", $o);
34    }
[34]35    return $o;
36}
37
38// you can simply let xcache to do the http auth
39// but if you have your home made login/permission system, you can implement the following
40// {{{ home made login example
41// this is an example only, it's won't work for you without your implemention.
42function check_admin_and_by_pass_xcache_http_auth()
43{
44    require("/path/to/user-login-and-permission-lib.php");
45    session_start();
46
47    if (!user_logined()) {
48        if (!ask_the_user_to_login()) {
49            exit;
50        }
51    }
52
53    user_load_permissions();
54    if (!user_is_admin()) {
55        die("Permission denied");
56    }
57
58    // user is trusted after permission checks above.
59    // tell XCache about it (the only way to by pass XCache http auth)
60    $_SERVER["PHP_AUTH_USER"] = "moo";
61    $_SERVER["PHP_AUTH_PW"] = "your-xcache-password";
62    return true;
63}
64
65// uncomment:
66// check_admin_and_by_pass_xcache_http_auth();
67// }}}
68
69?>
Note: See TracBrowser for help on using the repository browser.