51eb864f6dbc3561e7d9d31439364a660cbe730a
[atutor.git] / mods / wiki / tools / t_config.php
1 <?php
2   # this is the configuration for the ewiki page and database tools
3   #     (which may need to be distinct from your main ewiki config)
4   #
5
6
7   #-- injects password into fragments/funcs/auth.php
8   $passwords = array(
9 //     "admin" => "...",
10   );
11
12
13
14   #-- tools/ are run standalone?
15   if (!function_exists("ewiki_database")) {
16
17
18      #-- enable readonly:test play account?
19      $test = ($_SERVER["SERVER_NAME"] == "erfurtwiki.sourceforge.net")
20           || ($_SERVER["REMOTE_ADDR"] == "127.0.0.1") && (!strpos($_SERVER["SERVER_NAME"], "."));
21      if ($test && !$_REQUEST["test"]) {
22         $passwords["readonly"] = "test";
23      }
24
25
26      #-- simplest authentication:
27      require("../fragments/funcs/auth.php");
28      
29      if ($_a_user == "readonly") { 
30         define("EWIKI_DB_LOCK", 1);  // disable write-access
31      }
32
33
34      #-- normalize cwd (stupid approach)
35      if (!file_exists($LIB="ewiki.php")) {
36         chdir("..");
37         define("EWIKI_SCRIPT", "../?");
38         define("EWIKI_SCRIPT_BINARY", "../?binary=");
39      }
40
41
42      #-- open db connection, load 'lib'
43      include("./config.php");
44
45
46      #-- PHP fixes
47      include("plugins/lib/fix.php");
48      include("plugins/lib/upgrade.php");
49
50   }
51
52
53   #-- we now seem to run from inside ewiki (via the StaticPages plugin e.g.)
54   else {
55
56      #-- this terminates ewiki from within the spages plugin
57      if (!EWIKI_PROTECTED_MODE || !ewiki_auth($id, $data, $action, 0, 2) || ($ewiki_ring>0) || !isset($ewiki_ring)) {
58         die("Only the administrator can use this function.");
59      }
60
61      #-- some tools/ must be excluded nevertheless (because they override security-related settings, like t_control.php does)
62      define("CONCURRENT_INCLUDE", 1);  // just don't ask for an explaination ;)
63
64   }
65
66
67
68 ?>