insertConfig('cfg_pilotid', serialize(array())); } insertConfig('cfg_img', $img); insertConfig('cfg_kbhost', $host); insertConfig('cfg_kbtitle', $title); insertConfig('cfg_mainsite', ''); $confs = file('config.data'); foreach ($confs as $line) { $valuepair = explode(chr(9), trim($line)); if (!isset($valuepair[0])) { continue; } if (!isset($valuepair[1])) { $valuepair[1] = ''; } insertConfig($valuepair[0], $valuepair[1]); } $stoppage = false; } // config is there, use it to create all config vars which arent there // to prevent that ppl with running installs get new values $smarty->assign('stoppage', $stoppage); $smarty->assign('nextstep', $_SESSION['state'] + 1); $smarty->display('install_step7.tpl'); function insertConfig($key, $value) { $localvars = array(); $localvars[] = 'cfg_kbhost'; $localvars[] = 'cfg_img'; $localvars[] = 'cfg_kbtitle'; $result = mysql_query('SELECT * FROM kb3_config WHERE cfg_site=\'' . KB_SITE . '\' AND cfg_key=\'' . $key . '\'');
$config = preg_replace("/\\{([^\\}]+)\\}/e", "\\1", join('', file('./templates/config.tpl'))); $fp = fopen('../kbconfig.php', 'w'); fwrite($fp, trim($config)); fclose($fp); chmod('../kbconfig.php', 0440); // move stuff from the config to the database insertConfig('cfg_allianceid', ALLIANCE_ID); insertConfig('cfg_corpid', CORP_ID); insertConfig('cfg_common', COMMON_URL); insertConfig('cfg_img', IMG_URL); insertConfig('cfg_kbhost', KB_HOST); insertConfig('cfg_style', STYLE_URL); insertConfig('cfg_kbtitle', KB_TITLE); insertConfig('cfg_profile', KB_PROFILE); insertConfig('cfg_qcache', DB_USE_QCACHE); insertConfig('cfg_mainsite', MAIN_SITE); $query = "SELECT itd_kll_id, itm_id, itm_name\r\nFROM kb3_items_destroyed\r\nLEFT JOIN kb3_items ON itd_itm_id = itm_id\r\nLEFT JOIN kb3_invtypes ON itm_name = typeName\r\nWHERE invtypes.typeID IS NULL"; $result = mysql_query($query); $smarty->assign('sql_error'); $notice = ''; while ($row = mysql_fetch_array($result)) { $notice .= 'Killmail id ' . $row['itd_kll_id'] . ' contains an item named "' . $row['itm_name'] . '" (id ' . $row['itm_id'] . ') that will be orphaned.<br/>'; } $smarty->assign('notice', $notice); $smarty->assign('stoppage', $stoppage); $smarty->display('install_step41.tpl'); function insertConfig($key, $value) { $result = mysql_query('SELECT * FROM kb3_config WHERE cfg_site=\'' . KB_SITE . '\' AND cfg_key=\'' . $key . '\''); if (!($row = mysql_fetch_row($result))) { $sql = "INSERT INTO kb3_config VALUES ('" . KB_SITE . "','" . $key . "','" . $value . "')";