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

Last change on this file since 123 was 123, checked in by moo, 8 years ago

Chinese translation for admin page

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