source: branches/1.3/admin/config.php.example @ 627

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

merged r585:592 from trunk

  • 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
[623]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
[627]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;
[623]28    $o = str_replace($_SERVER['DOCUMENT_ROOT'],  "{DOCROOT}" . (substr($d, -1) == $sep ? $sep : ""), $o);
[161]29    $xcachedir = realpath(dirname(__FILE__) . "$sep..$sep");
30    $o = str_replace($xcachedir . $sep, "{XCache}$sep", $o);
31    if ($sep == '/') {
32        $o = str_replace("/home/", "{H}/", $o);
33    }
[34]34    return $o;
35}
36
37// you can simply let xcache to do the http auth
38// but if you have your home made login/permission system, you can implement the following
39// {{{ home made login example
40// this is an example only, it's won't work for you without your implemention.
41function check_admin_and_by_pass_xcache_http_auth()
42{
43    require("/path/to/user-login-and-permission-lib.php");
44    session_start();
45
46    if (!user_logined()) {
47        if (!ask_the_user_to_login()) {
48            exit;
49        }
50    }
51
52    user_load_permissions();
53    if (!user_is_admin()) {
54        die("Permission denied");
55    }
56
57    // user is trusted after permission checks above.
58    // tell XCache about it (the only way to by pass XCache http auth)
59    $_SERVER["PHP_AUTH_USER"] = "moo";
60    $_SERVER["PHP_AUTH_PW"] = "your-xcache-password";
61    return true;
62}
63
64// uncomment:
65// check_admin_and_by_pass_xcache_http_auth();
66// }}}
67
68?>
Note: See TracBrowser for help on using the repository browser.