<?php if ($_SESSION['inputcache.okas']!='collectinfo') redirect('./'); $errorareas=array(); $data=$_SESSION['inputcache.data']; require_once("../config.common.inc.php"); require_once("../config.locals.inc.php"); require_once("../includes/db.inc.php"); require_once("../includes/phptools/simpleddlparser.inc.php"); initialize_config($Config); set_local_configurations($Config); initialize_db_config($Config); $DBConn=db_init_connection($Config); $DBConn->connect(); { $createdbsql=file_get_contents("db/createdb.sql"); $createdbsql=str_replace("`reserv`.","`".$Config->DBConfWritable[0]['DBName']."`.",$createdbsql); $createdbsql=str_replace("`reserv_","`".$Config->TablePrefix['reserv'],$createdbsql); upgrade_database($DBConn,$createdbsql,'reserv_'); $dataset['OK-DB-CREATE']=array(0); } if (!$errorareas) { $sql="SELECT MIN(`mb_id`) " ."FROM `{$Config->TableMap['login']}` " ."WHERE " ."mb_status='VALID'"; $mb_id=$DBConn->query_value($sql); if ($data['dbreconstruct']) { $comperebasic=array( 'cp_name'=>$data['businessname'], 'cp_timezone'=>$data['timezone'] ); db_set_compere($DBConn,$mb_id,$comperebasic); db_create_team($DBConn,$mb_id); $dataset['OK-DB-INITIALIZE']=array(0); } $config_locals=file_get_contents('../config.locals.inc.php'); $config_locals=str_replace('$Config->DefaultCPID=0;','$Config->DefaultCPID='.$mb_id.';',$config_locals); file_put_contents('../config.locals.inc.php',$config_locals); $dataset['file.config.locals']='config.locals.inc.php'; $dataset['OK-CREATE-CONFIG-LOCAL']=array(0); } $CMD_TMPL_NAME='install'; $dataset+=$data; $dataset+=$errorareas; if (count_true_entries($errorareas)==0) $dataset['INSTALL-COMPLETE']=array(0); else $dataset['INSTALL-INCOMPLETE']=array(0); ?>