app = $app; if($intern) { return; } $this->app->ActionHandlerInit($this); $this->app->ActionHandler("list", "LayoutvorlagenList"); $this->app->ActionHandler("edit", "LayoutvorlagenEdit"); $this->app->ActionHandler("create", "LayoutvorlagenCreate"); $this->app->ActionHandler("copy", "LayoutvorlagenCopy"); $this->app->ActionHandler("getposition", "LayoutvorlagenGetPosition"); $this->app->ActionHandler("saveposition", "LayoutvorlagenSavePosition"); $this->app->ActionHandler("createposition", "LayoutvorlagenCreatePosition"); $this->app->ActionHandler("deleteposition", "LayoutvorlagenDeletePosition"); $this->app->ActionHandler("delete", "LayoutvorlagenDelete"); $this->app->ActionHandler("download", "LayoutvorlagenDownload"); $this->app->ActionHandler("export", "LayoutvorlagenExport"); //$this->app->ActionHandler("import", "LayoutvorlagenImport"); $this->app->ActionHandler("imgvorschau", "LayoutvorlagenImgVorschau"); $this->app->erp->Headlines('Layoutvorlagen'); $this->app->ActionHandlerListen($app); } public function LayoutvorlagenCopy() { $id = (int)$this->app->Secure->GetGET('id'); if($id) { $layoutvorlage = $this->app->DB->SelectArr("SELECT * FROM layoutvorlagen WHERE id = '$id'"); if($layoutvorlage) { $this->app->DB->Insert("INSERT INTO layoutvorlagen (id) VALUES('')"); $newvorlage = $this->app->DB->GetInsertID(); $layoutvorlage[0]['name'] .= ' (Kopie)'; $this->app->FormHandler->ArrayUpdateDatabase("layoutvorlagen",$newvorlage,$layoutvorlage[0],true); $positionen = $this->app->DB->SelectArr("SELECT * FROM layoutvorlagen_positionen WHERE layoutvorlage = '$id'"); if($positionen) { foreach($positionen as $position) { $this->app->DB->Insert("INSERT INTO layoutvorlagen_positionen (id) VALUES('')"); $newvorlagepos = $this->app->DB->GetInsertID(); $position['layoutvorlage'] = $newvorlage; $this->app->FormHandler->ArrayUpdateDatabase("layoutvorlagen_positionen",$newvorlagepos,$position, true); } } } } header('Location: index.php?module=layoutvorlagen&action=list'); exit; } public function LayoutvorlagenDownload($id = 0) { if(!$id)$id = $this->app->Secure->GetGET('id'); // mit infos aus zertifikat und konkreten inhalten $projekt = ""; $Brief = new LayoutvorlagenPDF($this->app, $projekt); $Brief->GetLayoutvorlage($id); $Brief->inlineDocument(); } public function LayoutvorlagenMenu() { $this->app->erp->MenuEintrag("index.php?module=layoutvorlagen&action=list","Übersicht"); } public function LayoutvorlagenList() { //$this->LayoutvorlagenMenu(); $this->app->erp->MenuEintrag("index.php?module=layoutvorlagen&action=list","Übersicht"); $this->app->erp->MenuEintrag("index.php?module=layoutvorlagen&action=create","Neu"); $layoutanlegen = $this->app->Secure->GetPOST('layoutanlegen'); if ($layoutanlegen) { $row['name'] = $this->app->Secure->GetPOST('name'); //$row['name'] = preg_replace('#[^-A-Za-z0-9]#', '-', $row['name']); $row['typ'] = $this->app->Secure->GetPOST('typ'); $row['format'] = $this->app->Secure->GetPOST('format'); $row['kategorie'] = $this->app->Secure->GetPOST('kategorie'); if ($row['name']) { $this->app->DB->Insert(' INSERT INTO layoutvorlagen SET name = "' . $row['name'] . '", typ = "' . $row['typ'] . '", format = "' . $row['format'] . '", kategorie = "' . $row['kategorie'] . '" '); $id = $this->app->DB->GetInsertID(); if ($id) { header('location: index.php?module=layoutvorlagen&action=edit&id=' . $id); exit; } } } if($this->app->Secure->GetPOST('cmd') === 'import') { if (!empty($_FILES['importfile']['tmp_name'])) { $string = file_get_contents($_FILES['importfile']['tmp_name']); $ret = $this->importJson($string, $this->app->Secure->GetPOST('ueberschreiben')); if(!empty($ret['message'])) { $this->app->Tpl->Add('ERRORMSG', $ret['message']); } } else { $this->app->Tpl->Add('ERRORMSG', "Keine Datei ausgewält"); } } $this->app->YUI->TableSearch('TABELLE', 'layoutvorlagen_list'); $this->app->Tpl->Parse('PAGE',"layoutvorlagen_list.tpl"); } /** * @param string $string * @param bool $overwrite * * @return array */ public function importJson($string, $overwrite = false) { $ret = []; if(!(NULL !== $json = json_decode($string))) { return ['status' => 0, 'message' => 'Keine gültige Datei']; } if(empty($json->Layout) && empty($json->Layout->name)) { return ['status' => 0, 'message' => 'Keine gültige Datei Fehlendes Element: Layout']; } $altesLayout = $this->app->DB->SelectArr( sprintf( "select * from layoutvorlagen where name like '%s'", $this->app->DB->real_escape_string($json->Layout->name) ) ); if(!empty($altesLayout) && !$overwrite) { return ['status' => 0, 'message' => 'Es existiert bereis ein Layout mit dem Namen','id' => $altesLayout['id']]; } if(isset($json->Layout->id)) { unset($json->Layout->id); } $columns = $this->app->DB->SelectArr('SHOW COLUMNS FROM layoutvorlagen'); $error = false; foreach($json->Layout as $k => $v) { $found = false; foreach($columns as $k2 => $v2) { if($v2['Field'] == $k) { $found = true; } } if(!$found) { $error = true; } } $columnspos = $this->app->DB->SelectArr('SHOW COLUMNS FROM layoutvorlagen_positionen'); if(!empty($json->Layoutpositionen)) { foreach($json->Layoutpositionen as $k => $pos) { if(isset($pos->id)) { unset($json->Layoutpositionen[$k]->id); } if(isset($pos->layoutvorlage)) { unset($json->Layoutpositionen[$k]->id); } foreach($pos as $kp => $vp) { $found = false; foreach($columnspos as $k2 => $v2) { if($v2['Field'] == $kp) { $found = true; } } if(!$found) { $error = true; } } } } if(!empty($error)) { return ['status' => 0, 'message' => 'Keine gültige Datei: falsche Elemente']; } $query = "insert into layoutvorlagen ("; $i = 0; foreach($columns as $k => $v) { if($v['Field'] !== 'id') { $i++; if($i > 1) { $query .= ', '; } $query .= $v['Field']; } } $query .= ') values ('; $i = 0; foreach($columns as $k => $v) { if($v['Field'] !== 'id') { $i++; if($i > 1) { $query .= ', '; } $query .= "'"; $fieldName = $v['Field']; if(isset($json->Layout->$fieldName)) { $query .= $this->app->DB->real_escape_string($json->Layout->$fieldName); } $query .= "'"; } } $query .= ')'; //alte Löschen falls existiert if($altesLayout) { foreach($altesLayout as $l) { if($l['id']) { $this->app->DB->Delete("delete from layoutvorlagen_positionen where layoutvorlage = ".$l['id']); $this->app->DB->Delete("delete from layoutvorlagen where id = ".$l['id']); } } } // $this->app->DB->Insert($query); $newid = $this->app->DB->GetInsertID(); if(empty($newid)) { return ['status' => 0, 'message' => 'Fehler beim Erstellen des Layouts']; } $j = 0; foreach ($json->Layoutpositionen as $kpos => $pos) { $querypos[$j] = "insert into layoutvorlagen_positionen (layoutvorlage"; $i = 0; foreach($columnspos as $k => $v) { if($v['Field'] !== 'id' && $v['Field'] !== 'layoutvorlage') { $i++; $querypos[$j] .= ', '; $querypos[$j] .= $v['Field']; } } $querypos[$j] .= ") values ('".$newid."'"; $i = 0; foreach($columnspos as $k => $v) { if($v['Field'] !== 'id' && $v['Field'] !== 'layoutvorlage') { $i++; $querypos[$j] .= ', '; $querypos[$j] .= "'"; $fieldName = $v['Field']; if(isset($pos->$fieldName)) { $querypos[$j] .= $this->app->DB->real_escape_string($pos->$fieldName); } $querypos[$j] .= "'"; } } $querypos[$j] .= ")"; $j++; } if(isset($querypos)) { $fehler = false; foreach($querypos as $qp) { $this->app->DB->Insert($qp); if($this->app->DB->error()){ $ret['error'] = $this->app->DB->error(); $fehler = true; } } } if($fehler) { return [ 'status' => 0, 'message' => (empty($ret['error'])?'':$ret['error'].' ') . 'Fehler beim Erstellen von einer oder mehreren Layoutposition(en)' ]; } return [ 'message' => 'Layout ' .$json->Layout->name. ' erfolgreich erstellt', 'status' => true, 'id' => $newid ]; } public function LayoutvorlagenEdit() { $id = $this->app->Secure->GetGET('id'); $cmd = $this->app->Secure->GetGET('cmd'); $speichern = $this->app->Secure->GetPOST('layoutspeichern'); if ($speichern) { $name = $this->app->Secure->GetPOST('name'); $typ = $this->app->Secure->GetPOST('typ'); $format = $this->app->Secure->GetPOST('format'); $kategorie = $this->app->Secure->GetPOST('kategorie'); $projekt = $this->app->Secure->GetPOST('layoutvorlagen_projekt'); $delete_hintergrund = $this->app->Secure->GetPOST('delete_hintergrund')==''?false:true; $pdf_hintergrund = $_FILES['pdf_hintergrund']; if (isset($pdf_hintergrund['tmp_name']) && ($pdf_hintergrund['type'] == 'application/pdf' || $pdf_hintergrund['type'] == 'application/force-download' || $pdf_hintergrund['type'] =='binary/octet-stream' || $pdf_hintergrund['type'] == 'application/octetstream')) { $fp = fopen($pdf_hintergrund['tmp_name'], 'r'); $imgContent = fread($fp, filesize($pdf_hintergrund['tmp_name'])); fclose($fp); $sets[] = 'pdf_hintergrund = "' . base64_encode($imgContent) . '"'; } elseif($delete_hintergrund) { $sets[] = 'pdf_hintergrund = ""'; } $sets[] = 'name = "' . $name . '" '; $sets[] = 'typ = "' . $typ . '" '; $sets[] = 'format = "' . $format . '" '; $sets[] = 'kategorie = "' . $kategorie . '" '; if ($sets) { $this->app->DB->Insert('UPDATE layoutvorlagen SET ' . implode(', ', $sets) . ' WHERE id = ' . $id); } if($projekt != ''){ $projektid = $this->app->DB->Select("SELECT id FROM projekt WHERE abkuerzung = '$projekt' LIMIT 1"); }else{ $projektid = 0; } $this->app->DB->Update("UPDATE layoutvorlagen SET projekt = '$projektid' WHERE id = '$id'"); } $this->app->YUI->AutoComplete("kategorie","layoutvorlagenkategorie"); $this->app->YUI->AutoComplete("layoutvorlagen_projekt", "projektname", 1); //$this->app->erp->MenuEintrag("index.php?module=layoutvorlagen&action=create","Neu"); $this->app->erp->MenuEintrag("index.php?module=layoutvorlagen&action=edit&id=" . $id . "","Details"); $vorlage = $this->app->DB->SelectArr('SELECT * FROM layoutvorlagen WHERE id = ' . $id); $vorlage = reset($vorlage); if ($cmd) { switch ($cmd) { case 'pdfvorschau': $pdf_hintergrund = $this->app->DB->Select('SELECT pdf_hintergrund FROM layoutvorlagen WHERE id = ' . $id); $pdf_hintergrund = base64_decode($pdf_hintergrund); header("Content-type: application/pdf"); header('Content-disposition: attachment; filename="pdf_hintergrund.pdf"'); print $pdf_hintergrund; break; default: break; } exit; } $this->app->User->SetParameter('layoutvorlagen_id', $id); $this->app->Tpl->Add('NAME', $vorlage['name']); $this->app->Tpl->Add('KATEGORIE', $vorlage['kategorie']); if($vorlage['projekt'] > 0){ $projektname = $this->app->DB->Select("SELECT abkuerzung FROM projekt WHERE id = '".$vorlage['projekt']."' LIMIT 1"); if($projektname != ""){ $this->app->Tpl->Add('PROJEKT', $projektname); } } if ($vorlage['pdf_hintergrund']) { $this->app->Tpl->Add('PDFVORSCHAU', ''); } $this->app->Tpl->Add('TAB3', ''); /* $schriftarten = $this->app->erp->GetSchriftarten(); //Test $schriftarten['times'] = "Times"; $schriftarten['juliusc'] = 'juliusc'; $schriftarten['bernard'] = 'Bernard'; $schriftarten['HLBC____'] = 'HLBC____'; */ $schriftartena = $this->app->erp->GetFonts(); foreach($schriftartena as $kk => $vv) { $schriftarten[$kk] = $vv['name']; } //Test End $schriftartenTpl = ''; if ($schriftarten) { foreach ($schriftarten as $schriftartKey => $schriftart) { $schriftartenTpl .= ''; } } $this->app->Tpl->Add('SCHRIFTARTEN', $schriftartenTpl); $rahmenbreiten = array( '0' => 'Kein Rahmen', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10' ); $rahmenTpl = ''; if ($rahmenbreiten) { foreach ($rahmenbreiten as $rahmenbreiteKey => $rahmenbreite) { $rahmenTpl .= ''; } } $positionen = $this->app->DB->SelectArr(' SELECT id, name, typ FROM layoutvorlagen_positionen WHERE layoutvorlage = "' . $id . '" '); $positionenTpl = ''; $positionenTpl .= ''; if ($positionen) { foreach ($positionen as $position) { $positionenTpl .= ''; } } $schriftausrichtungen = array('left' => 'Links', 'center' => 'Zentriert', 'right' => 'Rechts'); $schriftausrichtungenTpl = ''; if ($schriftausrichtungen) { foreach($schriftausrichtungen as $schriftausrichtungKey => $schriftausrichtung) { $schriftausrichtungenTpl .= ''; } } $formate = array('A4' => 'DIN A4 Hoch', 'A4L' => 'DIN A4 Quer','A5' => 'DIN A5 Hoch', 'A5L' => 'DIN A5 Quer','A6' => 'DIN A6 Hoch', 'A6L' => 'DIN A6 Quer'); $formatTpl = ''; if ($formate) { foreach($formate as $formatKey => $formatBeschriftung) { $formatTpl .= ''; } } $this->app->YUI->ColorPicker("schrift_farbe"); $this->app->YUI->ColorPicker("hintergrund_farbe"); $this->app->YUI->ColorPicker("rahmen_farbe"); $this->app->Tpl->Add('SCHRIFTAUSRICHTUNGEN', $schriftausrichtungenTpl); $this->app->Tpl->Add('POSITIONPARENT', $positionenTpl); $this->app->Tpl->Add('FORMAT', $formatTpl); $this->app->Tpl->Add('RAHMEN', $rahmenTpl); $this->app->YUI->TableSearch('TABELLE', 'layoutvorlagen_edit'); $this->app->Tpl->Parse('PAGE',"layoutvorlagen_edit.tpl"); } public function LayoutvorlagenCreate() { $speichern = $this->app->Secure->GetPOST('layouterstellen'); if ($speichern) { $felder = array('name', 'typ', 'format', 'kategorie'); $sets = array(); if ($felder) { foreach ($felder as $feld) { $sets[] = $feld . ' = "' . $this->app->Secure->GetPOST($feld) . '"'; } } $projekt = $this->app->Secure->GetPOST('layoutvorlagen_projekt'); if($projekt != ''){ $projektid = $this->app->DB->Select("SELECT id FROM projekt WHERE abkuerzung = '$projekt' LIMIT 1"); }else{ $projektid = 0; } $query = ('INSERT INTO layoutvorlagen SET ' . implode(', ', $sets) . ' '); $this->app->DB->Insert($query); $layoutvorlagenId = $this->app->DB->GetInsertID(); $this->app->DB->Update("UPDATE layoutvorlagen SET projekt = '$projektid' WHERE id = '$layoutvorlagenId'"); $delete_hintergrund = $this->app->Secure->GetPOST('delete_hintergrund')==''?false:true; $pdf_hintergrund = $_FILES['pdf_hintergrund']; if (isset($pdf_hintergrund['tmp_name']) && ($pdf_hintergrund['type'] == 'application/pdf' || $pdf_hintergrund['type'] == 'application/force-download' || $pdf_hintergrund['type'] =='binary/octet-stream' || $pdf_hintergrund['type'] == 'application/octetstream')) { $fp = fopen($pdf_hintergrund['tmp_name'], 'r'); $imgContent = fread($fp, filesize($pdf_hintergrund['tmp_name'])); fclose($fp); $sets[] = 'pdf_hintergrund = "' . base64_encode($imgContent) . '"'; } elseif($delete_hintergrund) { $sets[] = 'pdf_hintergrund = ""'; } if ($sets) { $this->app->DB->Insert('UPDATE layoutvorlagen SET ' . implode(', ', $sets) . ' WHERE id = ' . $layoutvorlagenId); } if ($layoutvorlagenId) { header('location: index.php?module=layoutvorlagen&action=edit&id=' . $layoutvorlagenId); exit; } } $this->app->YUI->AutoComplete("kategorie","layoutvorlagenkategorie"); $this->app->YUI->AutoComplete("layoutvorlagen_projekt", "projektname", 1); $this->app->erp->MenuEintrag("index.php?module=layoutvorlagen&action=create","Erstellen"); $this->app->Tpl->Parse('PAGE','layoutvorlagen_create.tpl'); } public function LayoutvorlagenGetPosition() { $id = $this->app->Secure->GetPOST('id'); $row = $this->app->DB->SelectRow('SELECT * FROM layoutvorlagen_positionen WHERE id = ' . $id); if ($row['bild_deutsch']) { $bilddata['bild_deutsch'] = 'VORSCHAU'; unset($row['bild_deutsch']); } if ($row['bild_englisch']) { $bilddata['bild_englisch'] = 'VORSCHAU'; unset($row['bild_englisch']); } echo json_encode(array( 'status' => 1, 'statusText' => '', 'row' => $row, 'bilddata' => $bilddata )); $this->app->ExitXentral(); } public function LayoutvorlagenSavePosition() { $id = $this->app->Secure->GetPOST('id'); $typ = $this->app->Secure->GetPOST('typ'); $name = $this->app->Secure->GetPOST('name'); $name = strtolower($name); $name = preg_replace('#[^-A-Za-z0-9]#', '-', $name); $beschreibung = $this->app->Secure->GetPOST('beschreibung'); $position_typ = $this->app->Secure->GetPOST('position_typ'); $position_x = $this->app->Secure->GetPOST('position_x'); $position_y = $this->app->Secure->GetPOST('position_y'); $position_parent = $this->app->Secure->GetPOST('position_parent'); $breite = $this->app->Secure->GetPOST('breite'); $hoehe = $this->app->Secure->GetPOST('hoehe'); $schrift_art = $this->app->Secure->GetPOST('schrift_art'); $schrift_groesse = $this->app->Secure->GetPOST('schrift_groesse'); $zeilen_hoehe = $this->app->Secure->GetPOST('zeilen_hoehe'); $schrift_align = $this->app->Secure->GetPOST('schrift_align'); $schrift_farbe = $this->app->Secure->GetPOST('schrift_farbe'); $hintergrund_farbe = $this->app->Secure->GetPOST('hintergrund_farbe'); $rahmen = $this->app->Secure->GetPOST('rahmen'); $rahmen_farbe = $this->app->Secure->GetPOST('rahmen_farbe'); $sichtbar = ($this->app->Secure->GetPOST('sichtbar')=='')?'0':'1'; $schrift_fett = ($this->app->Secure->GetPOST('schrift_fett')=='')?'0':'1'; $schrift_kursiv = ($this->app->Secure->GetPOST('schrift_kursiv')=='')?'0':'1'; $schrift_underline = ($this->app->Secure->GetPOST('schrift_underline')=='')?'0':'1'; //$this->app->erp->LogFile("sichtbar: ".$sichtbar."."); $inhalt_deutsch = $this->app->Secure->GetPOST('inhalt_deutsch'); $inhalt_englisch = $this->app->Secure->GetPOST('inhalt_englisch'); $layoutvorlage = (int)$this->app->Secure->GetPOST('layoutvorlage'); $sort = (int)$this->app->Secure->GetPOST('sort'); $zeichenbegrenzung = (int)$this->app->Secure->GetPOST('zeichenbegrenzung'); $zeichenbegrenzung_anzahl = (int)$this->app->Secure->GetPOST('zeichenbegrenzung_anzahl'); $layoutvorlagenpos = $this->app->DB->SelectArr("select id, sort from layoutvorlagen_positionen where layoutvorlage = ".$layoutvorlage." and id <> ".$id." order by sort"); $i = 0; if(isset($layoutvorlagenpos[0])) { foreach($layoutvorlagenpos as $key => $pos) { $i++; if($i < $sort && $i != $pos['sort'] ) { $this->app->DB->Update("update layoutvorlagen_positionen set sort = ".$i." where id = ".$pos['id']); } if($i >= $sort && $i + 1 != $pos['sort']) { $this->app->DB->Update("update layoutvorlagen_positionen set sort = ".($i + 1)." where id = ".$pos['id']); } } } if($sort < 1) { $sort = 1; } if($sort > $i + 1) { $sort = $i + 1; } $sets = array(); $sets[] = 'typ = "' . $typ . '"'; $sets[] = 'name = "' . $name . '"'; $sets[] = 'beschreibung = "' . $beschreibung . '"'; $sets[] = 'position_typ = "' . $position_typ . '"'; $sets[] = 'position_x = "' . $position_x . '"'; $sets[] = 'position_y = "' . $position_y . '"'; $sets[] = 'position_parent = "' . $position_parent . '"'; $sets[] = 'breite = "' . $breite . '"'; $sets[] = 'hoehe = "' . $hoehe . '"'; $sets[] = 'schrift_art = "' . $schrift_art . '"'; $sets[] = 'schrift_groesse = "' . $schrift_groesse . '"'; $sets[] = 'zeilen_hoehe = "' . $zeilen_hoehe . '"'; $sets[] = 'schrift_fett = "' . $schrift_fett . '"'; $sets[] = 'schrift_kursiv = "' . $schrift_kursiv . '"'; $sets[] = 'schrift_underline = "' . $schrift_underline . '"'; $sets[] = 'schrift_align = "' . $schrift_align . '"'; $sets[] = 'schrift_farbe = "' . $schrift_farbe . '"'; $sets[] = 'hintergrund_farbe = "' . $hintergrund_farbe . '"'; $sets[] = 'rahmen = "' . $rahmen . '"'; $sets[] = 'rahmen_farbe = "' . $rahmen_farbe . '"'; $sets[] = 'sichtbar = "' . $sichtbar . '"'; $sets[] = 'inhalt_deutsch = "' . $inhalt_deutsch . '"'; $sets[] = 'inhalt_englisch = "' . $inhalt_englisch . '"'; $sets[] = 'layoutvorlage = "' . $layoutvorlage . '"'; $sets[] = 'sort = "' . $sort . '"'; $sets[] = 'zeichenbegrenzung = "' . $zeichenbegrenzung . '"'; $sets[] = 'zeichenbegrenzung_anzahl = "' . $zeichenbegrenzung_anzahl . '"'; if (isset($_FILES['bild_deutsch']['tmp_name'])) { if ($_FILES['bild_deutsch']['type'] == 'image/jpeg' || $_FILES['bild_deutsch']['type'] == 'image/png') { $imgtype = exif_imagetype($_FILES['bild_deutsch']['tmp_name']); $img_type = ''; switch($imgtype) { case IMAGETYPE_GIF: $img_type = 'GIF'; break; case IMAGETYPE_JPEG: $img_type = 'JPEG'; break; case IMAGETYPE_PNG: $img_type = 'PNG'; break; case IMAGETYPE_ICO: $img_type = 'ICO'; break; case IMAGETYPE_BMP: $img_type = 'BMP'; break; } $fp = fopen($_FILES['bild_deutsch']['tmp_name'], 'r'); $sets[] = 'bild_deutsch_typ = "' . $img_type . '"'; $imgContent = fread($fp, filesize($_FILES['bild_deutsch']['tmp_name'])); fclose($fp); $sets[] = 'bild_deutsch = "' . base64_encode($imgContent) . '"'; } } if (isset($_FILES['bild_englisch']['tmp_name'])) { if ($_FILES['bild_englisch']['type'] == 'image/jpeg' || $_FILES['bild_englisch']['type'] == 'image/png') { $imgtype = exif_imagetype($_FILES['bild_deutsch']['tmp_name']); $img_type = ''; switch($imgtype) { case IMAGETYPE_GIF: $img_type = 'GIF'; break; case IMAGETYPE_JPEG: $img_type = 'JPEG'; break; case IMAGETYPE_PNG: $img_type = 'PNG'; break; case IMAGETYPE_ICO: $img_type = 'ICO'; break; case IMAGETYPE_BMP: $img_type = 'BMP'; break; } $sets[] = 'bild_englisch_typ = "' . $img_type . '"'; $fp = fopen($_FILES['bild_englisch']['tmp_name'], 'r'); $imgContent = fread($fp, filesize($_FILES['bild_englisch']['tmp_name'])); fclose($fp); $sets[] = 'bild_englisch = "' . base64_encode($imgContent) . '"'; } } if($id) { $query = ('UPDATE layoutvorlagen_positionen SET ' . implode(',', $sets) . ' WHERE id = ' . $id); $saveType = 'UPDATE'; } else { // $layoutvorlage = $this->app->DB->Select("SELECT layoutvorlage FROM layoutvorlagen_positionen WHERE id='$id'"); $checkname = $this->app->DB->Select(' SELECT id FROM layoutvorlagen_positionen WHERE name = "' . $name . '" AND layoutvorlage="'.$layoutvorlage.'" '); if ($checkname) { $msg = $this->app->erp->base64_url_encode("