1 | <?php |
---|
2 | $stoppage = true; |
---|
3 | |
---|
4 | extract($_SESSION['sql']); |
---|
5 | $dbhost = $host; |
---|
6 | extract($_SESSION['sett']); |
---|
7 | |
---|
8 | $config = preg_replace("/\{([^\}]+)\}/e", "\\1", join('', file('config.tpl'))); |
---|
9 | $fp = fopen('../kbconfig.php', 'w'); |
---|
10 | fwrite($fp, trim($config)); |
---|
11 | fclose($fp); |
---|
12 | chmod('../kbconfig.php', 0440); |
---|
13 | ?> |
---|
14 | <p>I wrote the config to ../kbconfig.php and chmodded it to 440.<br/> |
---|
15 | </p> |
---|
16 | <?php |
---|
17 | highlight_string($config); |
---|
18 | ?> |
---|
19 | <?php |
---|
20 | if (!file_exists('../kbconfig.php')) |
---|
21 | { |
---|
22 | ?> |
---|
23 | <p>Something went wrong, the file ../kbconfig.php is gone!</p> |
---|
24 | <?php |
---|
25 | return; |
---|
26 | } |
---|
27 | // config is there, use it to create all config vars which arent there |
---|
28 | // to prevent that ppl with running installs get new values |
---|
29 | require_once('../kbconfig.php'); |
---|
30 | |
---|
31 | $db = mysql_connect(DB_HOST, DB_USER, DB_PASS); |
---|
32 | mysql_select_db(DB_NAME); |
---|
33 | |
---|
34 | function insertConfig($key, $value) |
---|
35 | { |
---|
36 | global $db; |
---|
37 | |
---|
38 | $result = mysql_query('select * from kb3_config where cfg_site=\''.KB_SITE.'\' and cfg_key=\''.$key.'\''); |
---|
39 | if (!$row = mysql_fetch_row($result)) |
---|
40 | { |
---|
41 | $sql = "insert into kb3_config values ('".KB_SITE."','".$key."','".$value."')"; |
---|
42 | mysql_query($sql); |
---|
43 | } |
---|
44 | } |
---|
45 | |
---|
46 | // move stuff from the config to the database |
---|
47 | insertConfig('cfg_allianceid', $aid); |
---|
48 | insertConfig('cfg_corpid', $cid); |
---|
49 | |
---|
50 | insertConfig('cfg_common', $common); |
---|
51 | insertConfig('cfg_img', $img); |
---|
52 | insertConfig('cfg_kbhost', $host); |
---|
53 | insertConfig('cfg_style', $style); |
---|
54 | insertConfig('cfg_kbtitle', $title); |
---|
55 | |
---|
56 | insertConfig('cfg_profile', 0); |
---|
57 | insertConfig('cfg_qcache', 1); |
---|
58 | insertConfig('cfg_sqlhalt', 0); |
---|
59 | |
---|
60 | insertConfig('cfg_mainsite', ''); |
---|
61 | |
---|
62 | $confs = file('config.data'); |
---|
63 | foreach ($confs as $line) |
---|
64 | { |
---|
65 | list($key, $value) = explode(chr(9), trim($line)); |
---|
66 | insertConfig($key, $value); |
---|
67 | } |
---|
68 | ?> |
---|
69 | <br/><br/><font size=+1>Found the config on the right place, please continue...</font><br/> |
---|
70 | <p><a href="?step=<?php echo ($_SESSION['state']+1); ?>">Next Step</a></p> |
---|