<?php class Install{ private $error = 0; private $meldung = ''; private $array = array(); private $db; private function make_array($post){ foreach($post AS $key => $value){ if($key != '' && $value != '' && $key != 'datenbank_anlegen' && $key != 'impressum_anlegen'){ $this->array[$key] = $value; } } } private function DBTest(){ $con = mysqli_connect($this->array['host'],$this->array['nutzername'],$this->array['passwort'],$this->array['db']); if (mysqli_connect_errno()) { $this->error = 1; $this->meldung = 'Konnte keine Verbindung zur Datenbank aufbauen.'; } } public function DB_Config($post){ global $_GET; $this->make_array($post); $this->DBTest(); if($this->error == 0){ $this->ConfigEdit(); }else{ $_GET['step'] = 2; } meldung($this->error,$this->meldung); } private function ConfigEdit(){ $file = file_get_contents('db.default.php'); $file = str_replace("???HOST???",$this->array['host'],$file); $file = str_replace("???USER???",$this->array['nutzername'],$file); $file = str_replace("???PASS???",$this->array['passwort'],$file); $file = str_replace("???BASS???",$this->array['db'],$file); $file = str_replace("???PREFIX???",$this->array['prefix'],$file); $file = str_replace("???SCHLUESSEL???", create_code(16),$file); $file = str_replace("???PW???", create_code(4),$file); $datei = fopen("../lib/db_config.php","w"); fwrite($datei, $file,100000); fclose($datei); $this->meldung = 'Configurationsdatei erfolgreich angelegt.'; } private function DBConnect(){ require_once('../lib/db_config.php'); require_once('../lib/class/db.class.php'); $dbnew = new DB; $this->db = $dbnew; } public function DBStrucktur($query){ $this->DBConnect(); if(!empty($query) && $query != ''){ $query = str_replace("vms_",PREFIX,$query); if($this->db->queryInstall($query)== true){ echo '<div class="alert alert-success">Befehl: '. $query .' erfolgreich</div>'; } } } public function GrundConfig($post){ global $_GET; $ArrayInput = array( "wartung" => 0, "domain" => $post['domain'], "seitenname" => $post['name'], "waehrung" => $post['waehrung'], "betreibermail" => $post['mail'], "cron_pw" => $post['cron_pw'], "einzahlgrenze" => 100000, "re1" => 8.00, "re2" => 3.00, "re3" => 1.00, "min_betteln" => 50.00, "max_betteln" => 250.00, "reload_betteln" => 60, "denied_domains" => '@sofort-mail.de;@trash-mail.de;@mailinator.com;@spamgourmet.com;@spammotel.com;@centermail.com;@discardmail.com;@sneakemail.com;@netzidiot.de;@myTrashMail.com;@wegwerfadresse.de;@nervmich.net;@nervtmich.net;@mailinator.net;@klassmaster.com;@mailin8r.com;@sogetthis.com;@mailinator2.com', "auszahlgrenze" => 100, "chat_aktiv" => 2, "anzeige_chat" => 1, "anzeige_text" => 1, "geb_addon" => 1, "news_komment" => 1 ); if($this->insert(PREFIX . CONFIG, $ArrayInput) == true){ }else{ $this->error = 1; $this->meldung = 'Fehler beim Eintragen der Daten'; $_GET['step'] = 4; } meldung($this->error,$this->meldung); } public function Zugangsdaten($post){ $this->DBConnect(); $this->db->update(PREFIX . KONTO, array("passwort" => pw_erstellen($post['user_pass']))); $this->db->update(PREFIX . USER, array("nickname" => $post['user_name'])); $this->db->update(PREFIX . CONFIG, array("admin_name" => base64_encode($post['admin_name']), "admin_pass" => pw_erstellen($post['admin_pass']))); } public function Impressum($post){ $this->make_array($post); $this->DBConnect(); $this->createImpreesum(); } private function createImpreesum(){ $anschrift = 'Anschrift Seitenbetreiber. '.$this->array['name'].' '.$this->array['vorname'].' '.$this->array['str'].' '.$this->array['hs'].' '.$this->array['plz'].' '.$this->array['ort'].' <a href="'.$this->array['mail'].'">'.$this->array['mail'].'</a>'; $impressum = file_get_contents("impressum.txt"); $inhalt = $anschrift.$impressum; $inhalt = base64_encode($inhalt); $this->db->insert(PREFIX. TEXTE, array("name" => "impressum", "text" => $inhalt)); } }