[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 | |
---|
[34] | 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 |
---|
| 21 | function ob_filter_path_nicer($o) |
---|
| 22 | { |
---|
[161] | 23 | $sep = DIRECTORY_SEPARATOR; |
---|
[623] | 24 | $o = str_replace($_SERVER['DOCUMENT_ROOT'], "{DOCROOT}" . (substr($d, -1) == $sep ? $sep : ""), $o); |
---|
[161] | 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 | } |
---|
[34] | 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. |
---|
| 37 | function 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 | ?> |
---|