root/dev/install/install_step7.php @ 400

Revision 400, 2.0 KB (checked in by kovell, 13 years ago)

Fixes: install is locked after first run, private cache files made inaccesible, initial summary caching removed from kill posting, board will not attempt to run on MySQL < 4.1, PILOT_ID cannot be set, legacy option removed from admin panel, pos values added to installation defaults

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