<?php if ($_SESSION['inputcache.okas']!='collectinfo') redirect('./'); require_once("../includes/phptools/simpleddlparser.inc.php"); require_once('configcontent.inc.php'); $errorareas=array(); $data=$_SESSION['inputcache.data']; if (!is_dir($data['datapath'])) mkdir($data['datapath'],0755,true); if (!is_writable($data['datapath'])) $errorareas['ERROR-DATAPATH-CREATE']=array(0); else { file_put_contents($data['datapath'].'/.htaccess',"Deny from all"); chmod($data['datapath'].'/.htaccess',0644); $dataset['OK-DATAPATH-CREATE']=array(0); } $dataset['file.config.common']='base/config.common.inc.php'; if (!is_writable('../base/config.common.inc.php')) $errorareas['ERROR-CREATE-CONFIG-COMMON']=array(0); else { $config_common=login_config_common_text(null,array( 'sessionname'=>$data['sessionname'], 'language'=>language_requested(), 'cookieprefix'=>$data['cookieprefix'], 'dbtblpfx'=>$data['dbtblpfx'], 'datapath'=>$data['datapath'], 'distributionid'=>$data['distributionid'], 'VERSION'=>trim(file_get_contents('VERSION')) )); if (!file_put_contents('../base/config.common.inc.php',$config_common)) $errorareas['ERROR-CREATE-CONFIG-COMMON']=array(0); else $dataset['OK-CREATE-CONFIG-COMMON']=array(0); } $dataset['file.config.locals']='base/config.locals.inc.php'; if (!is_writable('../base/config.locals.inc.php')) $errorareas['ERROR-CREATE-CONFIG-LOCAL']=array(0); else { $config_locals=login_config_locals_text(null,array( 'siteurl'=>$data['siteurl'], 'cookiepath'=>$data['cookiepath'], 'dbserver'=>$data['dbserver'], 'dbserverport'=>$data['dbserverport'], 'dbname'=>$data['dbname'], 'dbuser'=>$data['dbuser'], 'dbpassword'=>$data['dbpassword'], 'mailmethod'=>$data['mailmethod'], 'contactmail'=>$data['contactmail'], 'smtpserver'=>$data['smtpserver'], 'smtpport'=>0+$data['smtpport'], 'popserver'=>$data['popserver'], 'popport'=>0+$data['popport'], 'popuser'=>$data['popuser'], 'poppass'=>$data['poppass'] )); if (!file_put_contents('../base/config.locals.inc.php',$config_locals)) $errorareas['ERROR-CREATE-CONFIG-LOCAL']=array(0); else $dataset['OK-CREATE-CONFIG-LOCAL']=array(0); } if (!$errorareas) { include "../base/config.common.inc.php"; include "../base/config.locals.inc.php"; include "../base/config.db.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("`uniwits`.","`".$data['dbname']."`.",$createdbsql); $createdbsql=str_replace("`uniwits_","`".$data['dbtblpfx'],$createdbsql); upgrade_database($DBConn,$createdbsql,'uniwits_'); $dataset['OK-DB-CREATE']=array(0); if ($data['dbreconstruct']) { $mb_id=db_insert_login($DBConn,array('mb_login'=>$data['adminlogin'],'mb_pswdhash'=>password_hash($data['adminpassword']),'mb_status'=>'VALID')); db_set_member($DBConn,$mb_id,array('mb_id'=>$mb_id, 'mb_nickname'=>$data['adminnickname'], 'mb_timezone_minutes'=>$data['timezone'], 'mb_timestamp'=>db_date())); db_set_member_info($DBConn,$mb_id,array('mb_id'=>$mb_id, 'mb_timestamp'=>db_date())); db_set_member_emails($DBConn,$mb_id,array($data['contactmail'])); db_validate_member_email($DBConn,$mb_id,array($data['contactmail'])); db_set_member_notifying_email($DBConn,$mb_id,$data['contactmail']); $dataset['OK-DB-INITIALIZE']=array(0); } } $dataset+=$data; $dataset+=$errorareas; if (count_true_entries($errorareas)==0) $dataset['INSTALL-COMPLETE']=array(0); else $dataset['INSTALL-INCOMPLETE']=array(0); ?>