'; if(!isset($_POST['adminpassword']) or empty($_POST['adminpassword']) and $FIRSTRUN) $error.='admin password not set
'; if(!isset($_POST['adminpassword2']) or empty($_POST['adminpassword2']) and $FIRSTRUN) $error.='retype admin password not set
'; if(!isset($_POST['datadirectory']) or empty($_POST['datadirectory'])) $error.='data directory not set
'; if(!isset($_POST['dateformat']) or empty($_POST['dateformat'])) $error.='dteformat not set
'; if(!isset($_POST['dbname']) or empty($_POST['dbname'])) $error.='databasename not set
'; if($_POST['adminpassword']<>$_POST['adminpassword2'] ) $error.='admin passwords are not the same
'; if(!isset($_POST['adminpassword']) or empty($_POST['adminpassword']) and !$FIRSTRUN){ $_POST['adminpassword']=$CONFIG_ADMINPASSWORD; } if(empty($error)) { //create/fill database $CONFIG_DBNAME=$_POST['dbname']; if(isset($_POST['filldb'])){ self::filldatabase(); } //storedata $config=' '; $filename=$DOCUMENTROOT.'/config/config.php'; file_put_contents($filename,$config); header("Location: ".$WEBROOT."/"); } return($error); } } /** * Fills the database with the initial tables * Note: while the AUTO_INCREMENT function is not supported by SQLite * the same effect can be achieved by accessing the SQLite pseudo-column * "rowid" */ private static function filldatabase(){ $query="CREATE TABLE 'locks' ( 'token' VARCHAR(255) NOT NULL DEFAULT '', 'path' varchar(200) NOT NULL DEFAULT '', 'expires' int(11) NOT NULL DEFAULT '0', 'owner' varchar(200) DEFAULT NULL, 'recursive' int(11) DEFAULT '0', 'writelock' int(11) DEFAULT '0', 'exclusivelock' int(11) NOT NULL DEFAULT '0', PRIMARY KEY ('token'), UNIQUE ('token') ); CREATE TABLE 'log' ( 'timestamp' int(11) NOT NULL, 'user' varchar(250) NOT NULL, 'type' int(11) NOT NULL, 'message' varchar(250) NOT NULL ); CREATE TABLE 'properties' ( 'path' varchar(255) NOT NULL DEFAULT '', 'name' varchar(120) NOT NULL DEFAULT '', 'ns' varchar(120) NOT NULL DEFAULT 'DAV:', 'value' text, PRIMARY KEY ('path','name','ns') );"; OC_DB::multiquery($query); } } ?>