| 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 | // 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 | |
|---|
| 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 |
|---|
| 25 | function ob_filter_path_nicer($o) |
|---|
| 26 | { |
|---|
| 27 | $sep = DIRECTORY_SEPARATOR; |
|---|
| 28 | $d = $_SERVER['DOCUMENT_ROOT']; |
|---|
| 29 | $o = str_replace($d, "{DOCROOT}" . (substr($d, -1) == $sep ? $sep : ""), $o); |
|---|
| 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 | } |
|---|
| 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. |
|---|
| 42 | function 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 | ?> |
|---|