<?php if ($_SESSION['inputcache.okas']!='collectinfo') redirect('./'); $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 { $cookieprefix=addcslashes($data['cookieprefix'],"\0..\37"); $config_common="<?php
function initialize_config(&\$Config)
{
	\$Config->SESSION_NAME='".$data['sessionname']."';
	\$Config->AllowSSL=false;
	\$Config->Language='".language_requested()."';
	\$Config->CookieName=array(
		'uniwits_ipdata'=>'".$cookieprefix."ipdata',
		'uniwits_lang'=>'".$cookieprefix."lang',
		'uniwits_timebias'=>'".$cookieprefix."timebias',
		'userpcid'=>'".$cookieprefix."userpcid'
	);
	
	\$Config->CookiePrefix='".$cookieprefix."';

	\$Config->TablePrefix=array(
		'uniwits'=>'".addslashes($data['dbtblpfx'])."'
	);
	
	\$Config->CachePrefix='".$data['datapath']."/cache/';

	\$Config->Paths=array(
		'data'=>'".$data['datapath']."',
		'theme.shared'=>'".$data['datapath']."/themes',
		'theme.shared.report'=>'".$data['datapath']."/themes.report',
		'theme.system'=>'themes',
		'user.base'=>'".$data['datapath']."/user',
		'lang.system'=>'languages',
		'upload'=>'".$data['datapath']."/upload',
		'tasklistbase'=>'".$data['datapath']."/tasklist'
	);
	
	\$Config->SESSION_SAVE_PATH=null;
	
	\$Config->DISTRIBUTION_ID='".$data['distributionid']."';
	\$Config->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_local="<?php
function set_local_configurations(&\$Config)
{
	\$Config->DBType='mysql';
	\$Config->SESSION_DOMAIN='".$_SERVER['SERVER_NAME']."';
	\$Config->SERVER_DOMAIN='".$data['siteurl']."';

	\$Config->COOKIE_DOMAIN='".$_SERVER['SERVER_NAME']."';
	\$Config->COOKIE_PATH='".$data['cookiepath']."';
	
	\$Config->DBConfWritable=array(
		array(
			'DBHost'=>'".$data['dbserver']."',
			'DBPort'=>'".$data['dbserverport']."',
			'DBName'=>'".$data['dbname']."',
			'DBUser'=>'".$data['dbuser']."',
			'DBPass'=>'".$data['dbpassword']."'
		)
	);
	\$Config->DBConfReadonly=\$Config->DBConfWritable;
	\$Config->LogDBConfWritable=\$Config->DBConfWritable;
	\$Config->LogDBConfReadonly=\$Config->LogDBConfWritable;
		
	\$Config->MailingMethod='".$data['mailmethod']."';
	\$Config->MailerAddress='".$data['contactmail']."';
	\$Config->SmtpServer='".$data['smtpserver']."';
	\$Config->SmtpPort=".(0+$data['smtpport']).";
	\$Config->PopServer='".$data['popserver']."';
	\$Config->PopPort=".(0+$data['popport']).";
	\$Config->PopUser='".$data['popuser']."';
	\$Config->PopPass='".$data['poppass']."';
	\$Config->ErrorReportMail='".$data['contactmail']."';
	\$Config->DisplayExecutionTime=false;
	\$Config->JumpTargets=array();

	\$Config->DefaultCPID=1;
}
?>"; if (!file_put_contents('../base/config.locals.inc.php',$config_local)) $errorareas['ERROR-CREATE-CONFIG-LOCAL']=array(0); else $dataset['OK-CREATE-CONFIG-LOCAL']=array(0); } if (!$errorareas && $data['dbreconstruct']) { 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); $createdbsql=ereg_replace(" AUTO_INCREMENT=[0-9]+","",$createdbsql); $DBConn->multi_query($createdbsql,"error.db.createtables"); do { $DBConn->store_result(); } while ($DBConn->next_result()); $dataset['OK-DB-CREATE']=array(0); $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); ?>