root/branch/rev3/install/install_step7.php @ 252

Revision 252, 1.9 KB (checked in by exi, 15 years ago)

Removed pass by reference warning in class.comments.php and class.options.php.
Added a return option for the parser.
Switched to kbconfig.php as main config file.

Line 
1<?php
2$stoppage = true;
3
4extract($_SESSION['sql']);
5$dbhost = $host;
6extract($_SESSION['sett']);
7
8$config = preg_replace("/\{([^\}]+)\}/e", "\\1", join('', file('config.tpl')));
9$fp = fopen('../kbconfig.php', 'w');
10fwrite($fp, trim($config));
11fclose($fp);
12chmod('../kbconfig.php', 0400);
13?>
14<p>I wrote the config to ../kbconfig.php and chmodded it to 400.<br/>
15</p>
16<?php
17highlight_string($config);
18?>
19<?php
20if (!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
29require_once('../kbconfig.php');
30
31$db = mysql_connect(DB_HOST, DB_USER, DB_PASS);
32mysql_select_db(DB_NAME);
33
34function 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
47insertConfig('cfg_allianceid', $aid);
48insertConfig('cfg_corpid', $cid);
49
50insertConfig('cfg_common', $common);
51insertConfig('cfg_img', $img);
52insertConfig('cfg_kbhost', $host);
53insertConfig('cfg_style', $style);
54insertConfig('cfg_kbtitle', $title);
55
56insertConfig('cfg_profile', 0);
57insertConfig('cfg_qcache', 1);
58insertConfig('cfg_sqlhalt', 0);
59
60insertConfig('cfg_mainsite', '');
61
62$confs = file('config.data');
63foreach ($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>
Note: See TracBrowser for help on using the browser.