neues editiermodul :: w3concepts.conFlakes

acquire
Beiträge: 194
Registriert: So 13. Jun 2004, 13:24
Kontaktdaten:

Beitrag von acquire » Fr 1. Apr 2005, 23:07

Tja, ich habe auch mal wieder ein Problem:
Ich will gerade Contenido auf meinen PC spiegeln um dort vorbereitungen und Tests zu machen, die etwas riskant sein können.
Wenn ich die conFlakes sql ausführe erhalte ich folgende Meldung:
#1060 - Duplicate column name 'pk_cache'
Wenn ich das erste entferne beschwert sich phpmyAdmin, dass es fehlt und wenn ich die letzten beiden entferne giobt es einen Syntax-Fehler.

Weiß jemand Abhilfe?

kummer
Beiträge: 2423
Registriert: Do 6. Mai 2004, 09:17
Wohnort: Bern, Schweiz
Kontaktdaten:

Beitrag von kummer » Mo 4. Apr 2005, 10:45

@cyberDan

was für eine php-version hast du denn installiert?
aitsu.org :: schnell - flexibel - komfortabel :: Version 2.2.0 (since June 22, 2011) (jetzt mit dual license GPL/kommerziell)

CyberDan
Beiträge: 204
Registriert: Mo 15. Dez 2003, 13:01
Wohnort: Saarland
Kontaktdaten:

Beitrag von CyberDan » Mo 4. Apr 2005, 10:58

PHP 4.3.10 auf einen Apache mit Contenido 4.4.5

philippe
Beiträge: 18
Registriert: Mo 4. Apr 2005, 12:50
Kontaktdaten:

Fehlermeldung bei Confalkes-Templates mit Bild

Beitrag von philippe » Mo 4. Apr 2005, 12:57

Hallo

Ich teste gerade Conflakes für ein Projekt an unserer Uni. Ich finde es super.
Ich habe nur das Problem, dass bei den Templates die Bilder enthalten folgende fehlermeldung erscheint und auch nichts im bildauswahl-pulldown erscheint.

Ich befürchte dass es etwas mit dem auslesen des upload folders zu tun hat.
Hat jemand einen Tip?

danke und gruesse

philippe

ps: benutze php5 und contenido4.4.5 auf OSX

Code: Alles auswählen

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1322

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1322

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1322

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1322

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1326

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1322

Warning: Invalid argument supplied for foreach() in /Library/WebServer/Documents/contenido/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 1350

CyberDan
Beiträge: 204
Registriert: Mo 15. Dez 2003, 13:01
Wohnort: Saarland
Kontaktdaten:

Beitrag von CyberDan » Mi 6. Apr 2005, 12:18

@kummer: hast du noch eine Idee, woran der Fehler liegen könnte?
@cyberDan

was für eine php-version hast du denn installiert?
PHP 4.3.10 auf einen Apache mit Contenido 4.4.5

kummer
Beiträge: 2423
Registriert: Do 6. Mai 2004, 09:17
Wohnort: Bern, Schweiz
Kontaktdaten:

Beitrag von kummer » Mi 6. Apr 2005, 13:21

@cyberDan und
@philippe

mit php5 gibt es einen fehler. das habe ich bereits korrigiert. hier der entsprechende neue code:

Code: Alles auswählen

<?php
/**
  * $Revision: 1.17 $
  * $Source: D:/cvs/cvsrepo/test/CONTENIDO_MODULE/conFlakes_m1_444/output.php,v $
  * $Date: 2005/03/30 13:49:19 $
  */

/**
 * conFlakes
 * Online-Editor auf Basis von Templates
 * @package w3conceptsConFlakes
 * @author Andreas Kummer
 * @copyright 2005, mumprecht & kummer w3concepts
 */
class conFlakes {
	
	/**
	 * Konstruktor der Klasse.
	 * @param integer index Index der Klasse
	 */
	function conFlakes($index) {
		
		global $idcat, $idart, $lang, $edit;
		
		// DeBuggin ein- oder ausschalten
		$this->deBug = false;
		
		// Im Klassenkontext zur Verfügung stellen
		$this->idcat = $idcat;
		$this->idart = $idart;
		$this->idlang = $lang;
		
		$this->classIndex = $index;
		
		// Datenbankverbindung herstellen
		$this->db = new DB_Contenido;
		$this->db2 = new DB_Contenido;
		
		// Defaultwerte setzen
		$this->setDefault();
		
		// Templates importieren
		$this->importTemplates();
		$this->importDynTemplates();
		
		// Uebergabewerte im Klassenkontext zur Verfügung stellen
		$this->importParameters();
		
		//if (($contenido && empty($this->get['contenido']) && $changeview =='edit') || ($contenido && !empty($this->get['contenido']) && $this->get['contenido'] == $contenido  && $changeview == 'edit')) {
		if ($edit && empty($this->get['edit'])) {
			if (!empty($this->get['moveUp'.$this->classIndex])) {
				$this->moveContainer($this->get['moveUp'.$this->classIndex]);
			}
			if (!empty($this->get['moveDown'.$this->classIndex])) {
				$this->moveContainer($this->get['moveDown'.$this->classIndex],false);
			}
			if (!empty($this->get['deletePart'.$this->classIndex])) {
				$this->getConFlakesDeleteContainer($this->get['deletePart'.$this->classIndex]);
			}
			if (!empty($this->get['editPart'.$this->classIndex]) && empty($this->post['conFlakesSave'.$this->classIndex])) {
				echo $this->getConFlakesEditOutput($this->get['editPart'.$this->classIndex]);
				return true;
			}
			if (!empty($this->post['newPart'.$this->classIndex]) && (!empty($this->post['type']) || !empty($this->post['dynType']))) {
				echo $this->getConFlakesNewOutput($this->post['newPart'.$this->classIndex]);
				return true;
			}
			if (!empty($this->post['conFlakesSave'.$this->classIndex])) {
				$this->saveConFlakesContent();
			}
			echo $this->getConFlakesEditModeOutput();
		} else {
			// Ausgabe an den Browser
			echo $this->getConFlakesOutput();
			return true;
		}
	}
	
	function setDefault() {
		
		global $cfgClient, $client;
		
		// Tabellennamen festlegen
		$this->tab['cache'] = 'conFlakes_Cache';
		$this->tab['content'] = 'conFlakes_Content';
		$this->tab['container'] = 'conFlakes_Container';
		
		// Replace-Variablen		
		$this->replace['image']['edit'] = 'editImage';
		$this->replace['image']['detail']['uri'] = 'conFlakesImageUri';
		$this->replace['image']['detail']['alt'] = 'conFlakesImageAltText';
		$this->replace['image']['detail']['width'] = 'conFlakesImageWidth';
		$this->replace['image']['detail']['height'] = 'conFlakesImageHeight';
		
		$this->replace['link']['edit'] = 'editLink';
		$this->replace['link']['detail']['uri'] = 'conFlakesLinkUri';
		$this->replace['link']['detail']['target'] = 'conFlakesLinkTarget';
		$this->replace['link']['detail']['name'] = 'conFlakesLinkName';
		
		$this->replace['text']['edit'] = 'editText';
		$this->replace['text']['detail']['name'] = 'conFlakesText';
		
		$this->replace['textarea']['edit'] = 'editTextarea';
		$this->replace['textarea']['detail']['name'] = 'conFlakesTextarea';
		
		$this->replace['list']['edit'] = 'editList';
		$this->replace['list']['detail']['bullet'] = 'conFlakesBulletList';
		$this->replace['list']['detail']['ordered'] = 'conFlakesOrderedList';
		
		$this->replace['dynvariable']['edit'] = 'editDynvarialbe';
		$this->replace['dynvariable']['detail']['skalar'] = 'conFlakesVariableSkalar';
		$this->replace['dynvariable']['detail']['array'] = 'conFlakesVariableArray';
		
		// Bildpfad
		$this->pfad = $cfgClient[$client]['path']['frontend'].$cfgClient[$client]['upload'];
		$this->frontendpfad = $cfgClient[$client]['path']['htmlpath'].$cfgClient[$client]['upload'];
		$this->pathlen = strlen($this->pfad);
		
		// Templatepfad
		$this->templatepfad = $cfgClient[$client]['path']['frontend'].$cfgClient[$client]['upload']."conFlakesTemplates{$this->classIndex}/";
		
		// Schriftgrössen
		$this->fontSize = '90%';
	}
	
	function importTemplates() {
		
		$fileSystem = glob("{$this->templatepfad}*.html");
		if (!empty($fileSystem)) foreach ($fileSystem as $filename) {
			$templateName = basename($filename,".html");
			
			// Einlesen des Templates
			$handle = fopen($filename,"r");
			$content = fread($handle,filesize($filename));
			fclose($handle);
			
			// Extraktion Bodybereich
			preg_match_all("/(<(body)[^>]*>)(.*)(<\/\\2>)/", str_replace("\n","\r",$content), $match);
			
			$this->template[$templateName] = $match[3][0];
		}
		
		if (!empty($this->template)) {
			ksort($this->template);
		} else {
			$this->template = array();
		}
	}
	
	function importDynTemplates() {
		
		$fileSystem = glob("{$this->templatepfad}*.dyn");
		if (!empty($fileSystem)) foreach ($fileSystem as $filename) {
			$templateName = basename($filename,".dyn");
			
			// Einlesen des Templates
			$handle = fopen($filename,"r");
			$content = fread($handle,filesize($filename));
			fclose($handle);
			
			$this->dynTemplate[$templateName] = $content;
		}
		
		if (!empty($this->dynTemplate)) {
			ksort($this->dynTemplate);
		} else {
			$this->dynTemplate = array();
		}
	}
	
	/**
	 * Importiert die per POST und GET übergebenen Werte und entfernt
	 * gleichzeitig - bei Parametern, welche mit POST übertragen worden
	 * sind - allfällig vorhandenen HTML- Code aus dem Resultat.
	 */
	function importParameters() {
		
		$this->get['editPart'] = 0;
		if (!empty($_GET)) foreach ($_GET as $key => $value) {
			$this->get[$key] = $value;
		}
		
		$this->post = array();
		if (!empty($_POST)) foreach ($_POST as $key => $value) {
			// Entfernung allfällig vorhandener HTML-Tags sowie von PHP-Code
			$this->post[$key] = $this->stripTags($value);
		}
	}
	
	function getConFlakesDeleteContainer($pk_container) {
		
		// Ordervalue und pk_cache ermitteln
		$this->db->query("" .
				"SELECT container.ordervalue, cache.pk_cache " .
				"FROM {$this->tab['cache']} AS cache " .
				"LEFT JOIN {$this->tab['container']} AS container ON cache.pk_cache = container.fk_cache " .
				"WHERE" .
				"	container.pk_container = $pk_container");
		if ($this->db->next_record()) {
			$ordervalue = $this->db->f('ordervalue');
			$pk_cache = $this->db->f('pk_cache');
			
			// Einträge in der Content-Tabelle löschen
			$this->db->query("" .
					"DELETE FROM {$this->tab['content']} " .
					"WHERE " .
					"	fk_container = $pk_container");
					
			// Einträge in der Container-Tabelle löschen
			$this->db->query("" .
					"DELETE FROM {$this->tab['container']} " .
					"WHERE " .
					"	pk_container = $pk_container");
					
					
			// Ordervalue der höheren Ordervalues verkürzen
			$this->db->query("" .
					"UPDATE {$this->tab['container']} " .
					"SET " .
					"	ordervalue = ordervalue - 1 " .
					"WHERE " .
					"	ordervalue > $ordervalue " .
					"	AND fk_cache = $pk_cache");
		}
	}
	
	function moveContainer($pk_container, $moveUp = true) {

		// Ordervalue und pk_cache ermitteln
		$this->db->query("" .
				"SELECT container.ordervalue, cache.pk_cache " .
				"FROM {$this->tab['cache']} AS cache " .
				"LEFT JOIN {$this->tab['container']} AS container ON cache.pk_cache = container.fk_cache " .
				"WHERE" .
				"	container.pk_container = $pk_container");
		if ($this->db->next_record()) {
			$ordervalue = $this->db->f('ordervalue');
			$pk_cache = $this->db->f('pk_cache');
			
			// Ordervalues tauschen
			if ($moveUp) {
				$ordervalue2 = $ordervalue - 1;
				$this->db->query("" .
						"UPDATE {$this->tab['container']} " .
						"SET " .
						"	ordervalue = ordervalue + 1 " .
						"WHERE " .
						"	ordervalue = $ordervalue2 " .
						"	AND fk_cache = $pk_cache");
				$this->db->query("" .
						"UPDATE {$this->tab['container']} " .
						"SET " .
						"	ordervalue = ordervalue - 1 " .
						"WHERE " .
						"	pk_container = $pk_container");
			} else {
				$ordervalue2 = $ordervalue + 1;
				$this->db->query("" .
						"UPDATE {$this->tab['container']} " .
						"SET " .
						"	ordervalue = ordervalue - 1 " .
						"WHERE " .
						"	ordervalue = $ordervalue2 " .
						"	AND fk_cache = $pk_cache");
				$this->db->query("" .
						"UPDATE {$this->tab['container']} " .
						"SET " .
						"	ordervalue = ordervalue + 1 " .
						"WHERE " .
						"	pk_container = $pk_container");
			}
		}
	}
	
	function getConFlakesOutput() {
		
		$contents = $this->getCachedContent(true);
		
		$returnvalue = '';
		if ($contents) foreach ($contents as $content) {
			$returnvalue .= $content;
		}
		
		return $returnvalue;
	}
	
	function getConFlakesEditOutput($pk) {
		
		$contents = $this->getContent($pk);
		
		$returnvalue = $this->getEditContainers(0,$pk,$contents);
		
		return $returnvalue;
	}
	
	function getConFlakesNewOutput($pos) {
		
		$returnvalue .= $this->getEditContainers($pos);
		
		return $returnvalue;
	}
	
	function getDynEditContainers($pos, $pk = null, $content = null) {
		
		if (empty($pk)) {
			$type = $this->post['dynType'];
		} else {
			$containerInfo = current($content);
			$type = $containerInfo['template'];
		}
		
		$returnvalue = '<div style="background-color:lightgrey; padding:10px;"><form action="" method="POST" style="display:inline;">';
		if ($pos) $returnvalue .= "<input type=\"hidden\" name=\"conFlakesPos\" value=\"$pos\" />";
		if (!empty($pk)) $returnvalue .= "<input type=\"hidden\" name=\"conFlakesPkContainer\" value=\"$pk\" />";
		$returnvalue .= "<input type=\"hidden\" name=\"conFlakesType\" value=\"$type\" />";
		$returnvalue .= "<input type=\"hidden\" name=\"conFlakesEvaluate\" value=\"1\" />";
		
		$returnvalue .= "<div>Publikation von:<br/>";
		if ($content) {
			$returnvalue .= $this->editPubstart($pk,$content,$containerInfo['pubstart']);
		} else {
			$returnvalue .= $this->editPubstart($pk,$content);
		}
		$returnvalue .= '<br/>bis:<br/>';
		if ($content) {
			$returnvalue .= $this->editPubend($pk,$content,$containerInfo['pubend']);
		} else {
			$returnvalue .= $this->editPubend($pk,$content);
		}
		$returnvalue .= '</div>';
		
		if ($content && $containerInfo['cacheevaluation'] == 1) {
			$checked = 'checked = "checked" ';
		} else {
			$checked = '';
		}
		$returnvalue .= "<div style=\"padding-top:5px;\"><input type=\"checkbox\" name=\"conFlakesCacheEvaluation\" value=\"1\" $checked/> Cache Output</div>";
		
		if (empty($pk)) {
			// Uebergabe über Post müsste erfolgen
			$type = $this->post['dynType'];
		} else {
			// Info findet sich in der Datenbank
			$containerInfo = current($content);
			$type = $containerInfo['template'];
		}
		
		if ($content) foreach ($content as $pk_content => $values) {
			if ($values['type'] == 'dynvariable' && $values['attribute'] == 'skalar') $dynvariableSkalar[] = $values['value'];
			if ($values['type'] == 'dynvariable' && $values['attribute'] == 'array') $dynvariableArray[] = $values['value'];
		}
		
		// Dynamische Inhalte aus der PHP-Datei lesen
		preg_match_all("/(\\{conFlakesVariable:skalar=)([\\w|\\s]+)(\\})/",$this->dynTemplate[$type],$matchSkalar);
		preg_match_all("/(\\{conFlakesVariable:array=)([\\w|\\s]+)(\\})/",$this->dynTemplate[$type],$matchArray);
		
		// Die Skalar-Werte anzeigen
		$counter = 0;
		foreach ($matchSkalar[2] as $key => $value) {
			$skalarValue = (isset($dynvariableSkalar[$counter]))?($dynvariableSkalar[$counter]):('');
			$returnvalue .= "<div style=\"padding-top:10px; padding-bottom:5px;\">:: $value (skalar) ::</div><div><input type=\"text\" name=\"conFlakesVariableSkalar[$value]\" value=\"$skalarValue\" style=\"width:100%; font-size:{$this->fontSize};\" /></div>";
			$counter++;
		}
		
		// Die Array-Werte anzeigen
		$counter = 0;
		foreach ($matchArray[2] as $key => $value) {
			$arrayValue = (isset($dynvariableArray[$counter]))?($dynvariableArray[$counter]):('');
			$returnvalue .= "<div style=\"padding-top:10px; padding-bottom:5px;\">:: $value (array) ::</div><div><textarea name=\"conFlakesVariableArray[$value]\" style=\"width:100%; height:300px; font-size:{$this->fontSize}; \">$arrayValue</textarea></div>";
			$counter++;
		}
		
		return $returnvalue.'<div style="padding-top:10px;"><input type="hidden" name="conFlakesSave'.$this->classIndex.'" value="conFlakesSave" /><input type="submit" value="speichern" /></div></form></div>';
	}
	
	function getEditContainers($pos, $pk = null, $content = null) {
		
		if (empty($pk)) {
			if (empty($this->post['dynType'])) {
				$type = $this->post['type'];
			} else {
				return $this->getDynEditContainers($pos);
			}
		} else {
			$containerInfo = current($content);
			if (empty($containerInfo['evaluate'])) {
				$type = $containerInfo['template'];
			} else {
				return $this->getDynEditContainers($pos,$pk,$content);
			}
		}
		
		$returnvalue = '<div style="background-color:lightgrey; padding:10px;"><form action="" method="POST" style="display:inline;">';
		if ($pos) $returnvalue .= "<input type=\"hidden\" name=\"conFlakesPos\" value=\"$pos\" />";
		if (!empty($pk)) $returnvalue .= "<input type=\"hidden\" name=\"conFlakesPkContainer\" value=\"$pk\" />";
		$returnvalue .= "<input type=\"hidden\" name=\"conFlakesType\" value=\"$type\" />";
		
		$returnvalue .= "<div>Publikation von:<br/>";
		if ($content) {
			$returnvalue .= $this->editPubstart($pk,$content,$containerInfo['pubstart']);
		} else {
			$returnvalue .= $this->editPubstart($pk,$content);
		}
		$returnvalue .= '<br/>bis:<br/>';
		if ($content) {
			$returnvalue .= $this->editPubend($pk,$content,$containerInfo['pubend']);
		} else {
			$returnvalue .= $this->editPubend($pk,$content);
		}
		$returnvalue .= '</div>';
		
		foreach ($this->replace as $key => $value) {
			preg_match_all("/(\\{".$key.":)([\\w|\\s]+)(\\})/",$this->template[$type],$match);
			
			$function = "edit$key";
			$returnvalue .= $this->$function($match[2],$type,$pk,$content);
		}
		
		return $returnvalue.'<div style="padding-top:10px;"><input type="hidden" name="conFlakesSave'.$this->classIndex.'" value="conFlakesSave" /><input type="submit" value="speichern" /></div></form></div>';	
	}
	
	function getConFlakesEditModeOutput() {
		
		$contents = $this->getCachedContent();
		
		$counter = 1;
		
		$returnvalue .= $this->addNewTemplate($counter);
		
		if (!empty($contents)) foreach ($contents as $pk_container => $content) {
			
			// publikationsdaten ermitteln
			$this->db->query("" .
					"SELECT " .
					"	IF(pubstart != 0,pubstart,0) AS pubstart, " .
					"	IF(pubend != 0,pubend,0) AS pubend, " .
					"	IF((pubstart < NOW() && pubend > NOW()) || (pubstart < NOW() && pubend = 0),1,0) AS now, " .
					"	IF(pubstart > NOW(),1,0) AS future " .
					"FROM {$this->tab['container']} " .
					"WHERE " .
					"	pk_container = $pk_container");
			if ($this->db->next_record()) {
				$pubstart = $this->db->f('pubstart');
				$pubend = $this->db->f('pubend');
				$now = $this->db->f('now');
				$future = $this->db->f('future');
			}
			
			if (($now && !$pubend && $pubstart) || (!$pubend && !$pubstart)) {
				$publikation = "[ :: Artikel ist online :: ]";
			} elseif ($now && $pubend && !$pubstart) {
				$publikation = "[ :: Artikel ist online bis $pubend :: ]";
			} elseif (!$now && $pubstart && !$pubend) {
				$publikation = "[ :: Artikel ist <strong>offline</strong> bis $pubstart :: ]";
			} elseif (!$now && $future) {
				$publikation = "[ :: Artikel geht von $pubstart bis $pubend online :: ]";
			} else {
				$publikation = "[ :: Artikel ist <strong>offline</strong> seit $pubend :: ]";
			}

			$returnvalue .= '<div style="padding:5px; border-top:1px solid #999999; border-right:1px solid #999999; border-left:1px solid #999999; width:100%; z-index:$counter; font-family:sans-serif; font-size:'.$this->fontSize.'; color:white; background-color:#FF9900">'.$publikation.'</div>';
			
			$returnvalue .= '<div style="padding:5px; border:1px solid #999999; width:100%; z-index:$counter;">'.$content.'</div>';
			
			$phpself = 'front_content.php?';
			foreach ($this->get as $key => $value) {
				if ($key != 'moveUp'.$this->classIndex && $key != 'moveDown'.$this->classIndex && $key != 'deletePart'.$this->classIndex && $key != 'editPart'.$this->classIndex && $key != 'newPart'.$this->classIndex) {
					$phpself .= "&$key=$value";
				}
			}
			
			$edit = "<a href=\"$phpself&editPart{$this->classIndex}=$pk_container\" style=\"color:white; font-size:{$this->fontSize};\">[ :: edit :: ]</a>&nbsp;";
			$delete = "<a href=\"$phpself&deletePart{$this->classIndex}=$pk_container\" style=\"color:white; font-size:{$this->fontSize};\">[ :: delete :: ]</a>&nbsp;";
			
			if ($counter > 1) {
				$moveup = "<a href=\"$phpself&moveUp{$this->classIndex}=$pk_container\" style=\"color:white; font-size:{$this->fontSize};\">[ :: moveUp ^^^ :: ]</a>&nbsp;";
			} else {
				$moveup = '';
			}
			if ($counter < count($contents)) {
				$movedown = "<a href=\"$phpself&moveDown{$this->classIndex}=$pk_container\" style=\"color:white; font-size:{$this->fontSize};\">[ :: moveDown vvv :: ]</a>&nbsp;";
			} else {
				$movedown = '';
			}
			
			$returnvalue .= '<div style="padding:5px; border:1px solid #999999; border-top:none; width:100%; z-index:$counter; font-family:sans-serif; font-size:'.$this->fontSize.'; color:white; background-color:#FF9900">'.$edit.$delete.$moveup.$movedown.'</div>';
			$counter++;
			$returnvalue .= $this->addNewTemplate($counter);
		}
		
		return $returnvalue;
	}
	
	function saveConFlakesContent() {
		
		// Wert für cacheevaluation setzen
		if (!empty($this->post['conFlakesCacheEvaluation'])) {
			$cacheevaluation = 1;
		} else {
			$cacheevaluation = 0;
		}

		// Containerchache erstellen
		$containercache = mysql_real_escape_string($this->createContainerCache($this->post['conFlakesType']));
		
		if (empty($this->post['conFlakesPkContainer'])) {
			// Neuer Eintrag
			if (!$pk_cache = $this->cacheExists()) {
				// Cache ist ebenfalls anzulegen
				$this->db->query("" .
						"INSERT INTO {$this->tab['cache']} " .
						"(classID, idart, idlang) " .
						"VALUES " .
						"({$this->classIndex},{$this->idart},{$this->idlang})");
				$pk_cache = $this->getInsertID();
			}
			
			// Verschieben aller bisherigen Einträge
			$this->db->query("" .
					"UPDATE {$this->tab['container']} " .
					"SET" .
					"	ordervalue = ordervalue + 1 " .
					"WHERE" .
					"	fk_cache = $pk_cache " .
					"	AND ordervalue >= {$this->post['conFlakesPos']}");
			// Neuer Eintrag
			$evaluate = (empty($this->post['conFlakesEvaluate']))?(0):(1);
			$this->db->query("" .
					"INSERT INTO {$this->tab['container']} " .
					"(fk_cache, template, ordervalue, pubstart, pubend, containercache, evaluate, cacheevaluation) " .
					"VALUES " .
					"($pk_cache, '{$this->post['conFlakesType']}', {$this->post['conFlakesPos']}, '{$this->post['conFlakesPubstart']}', '{$this->post['conFlakesPubend']}', '$containercache', $evaluate, $cacheevaluation)");
			$pk_container = $this->getInsertID();
		
		} else {
			// Update des bestehenden Eintrages
			$pk_container = $this->post['conFlakesPkContainer'];
			
			$this->db->query("" .
					"UPDATE {$this->tab['container']} " .
					"SET " .
					"	containercache = '$containercache'," .
					"	pubstart = '{$this->post['conFlakesPubstart']}'," .
					"	pubend = '{$this->post['conFlakesPubend']}', " .
					"	cacheevaluation = $cacheevaluation " .
					"WHERE " .
					"	pk_container = $pk_container");
		}
		
		// Bestehende Einträge in der Tabelle content löschen
		$this->db->query("" .
				"DELETE FROM {$this->tab['content']} " .
				"WHERE" .
				"	fk_container = $pk_container");
				
		foreach ($this->replace as $key => $value) {
			foreach ($value['detail'] as $attribute => $variable) {
				if (!empty($this->post[$variable])) {
					foreach ($this->post[$variable] as $memberID => $value) {
						$value = mysql_real_escape_string($value);
						$this->db->query("" .
								"INSERT INTO {$this->tab['content']} " .
								"(fk_container, type, memberID, attribute, value) " .
								"VALUES " .
								"($pk_container,'$key','$memberID', '$attribute', '$value')");
					}
				}
			}
		}
	}
	
	/**
	 * Erstellt einen Cache aufgrund der per Post übergebenen Werte.
	 * @param string templateType Template-Typ
	 * @return string Container-Cache
	 */
	function createContainerCache($templateType) {
		
		$template = $this->template[$templateType];
		
		/*
		 * Ermittlung der maximalen Bildgrösse bei Bildplatzhaltern
		 */
		preg_match_all("/(\\{image:maxwidth=)([\\d]+)(\\})/",$this->template[$templateType],$matchMaxWidth);
		$template = preg_replace("/(\\{image:maxwidth=)([\\d]+)(\\})/",'',$template);
		preg_match_all("/(\\{image:maxheight=)([\\d]+)(\\})/",$this->template[$templateType],$matchMaxHeight);
		$template = preg_replace("/(\\{image:maxheight=)([\\d]+)(\\})/",'',$template);
			
		foreach ($this->replace as $key => $value) {
			preg_match_all("/(\\{".$key.":)([\\w|\\s]+)(\\})/",$this->template[$templateType],$match);
			preg_match_all("/(\\{".$key.":)(uri\\})/",$this->template[$templateType],$matchUri);
			
			if ($key == 'image') {
				// Spezialfall, da Bildbreite und -höhe zur Laufzeit bestimmt werden müssen
				for ($i=0;$i<count($matchUri[0]);$i++) {
					
					$maxHeight = (!empty($matchMaxHeight[2][$i])) ? ($matchMaxHeight[2][$i]) : (null);
					$maxWidth = (!empty($matchMaxWidth[2][$i])) ? ($matchMaxWidth[2][$i]) : (null);
					
					foreach ($this->replace[$key]['detail'] as $detail => $variable) {
						if (!empty($this->post[$variable][$i])) {
							if ($detail == 'uri') {
								$replace = $this->resizeImage($this->post[$variable][$i],$maxWidth,$maxHeight);
							} else {
								$replace = $this->post[$variable][$i];
							}
						} else {
							if ($detail == 'width' && !empty($this->post['conFlakesImageUri'][$i])) {
								$imagesize = $this->getImageSize($this->post['conFlakesImageUri'][$i],$maxWidth,$maxHeight);
								$replace = $imagesize['width'];
							} elseif ($detail == 'height' && !empty($this->post['conFlakesImageUri'][$i])) {
								$imagesize = $this->getImageSize($this->post['conFlakesImageUri'][$i],$maxWidth,$maxHeight);
								$replace = $imagesize['height'];
							}
						}
						$template = preg_replace("/(\\{".$key.":)(".$detail."\\})/",$replace,$template,1);
					}
				}
			} elseif ($key == 'list') {
				for ($i=0;$i<count($match[0]);$i++) {
					foreach ($this->replace[$key]['detail'] as $detail => $variable) {
						if (!empty($this->post[$variable][$i])) {
							if ($detail == 'bullet') $replace = '<ul>';
							if ($detail == 'ordered') $replace = '<ol>';
							
							$result = explode("\n",$this->replaceCode($this->post[$variable][$i]));
							if ($result) foreach ($result as $row) {
								$replace .= "<li>$row</li>";
							}
							
							if ($detail == 'bullet') $replace .= '</ul>';
							if ($detail == 'ordered') $replace .= '</ol>';							
						}
						$template = preg_replace("/(\\{".$key.":)(".$detail."\\})/",$replace,$template,1);
					}
				}
			} else {
				if (count($this->replace[$key]['detail']) > 1) {
					for ($i=0;$i<count($matchUri[0]);$i++) {
						foreach ($this->replace[$key]['detail'] as $detail => $variable) {
							if (!empty($this->post[$variable][$i])) {
								$replace = $this->replaceCode($this->post[$variable][$i]);
							} else {
								$replace = '';
							}
							$template = preg_replace("/(\\{".$key.":)(".$detail."\\})/",$replace,$template,1);
						}
					}
				} else {
					for ($i=0;$i<count($match[0]);$i++) {
						$variable = $this->replace[$key]['detail']['name'];
						if (!empty($this->post[$variable][$i])) {
							$replace = nl2br($this->replaceCode($this->post[$variable][$i]));
						} else {
							$replace = '';
						}
						$template = preg_replace("/(\\{".$key.":)([\\w|\\s]+)(\\})/",$replace,$template,1);
					}
				}
			}
		}
		
		return $template;
	}
	
	function createContainerCacheFromDB($templateType,$pk_container,$cacheevaluation) {
		
		if ($cacheevaluation) {
			return $this->evaluateContent($pk_container,$cacheevaluation);
		}
		
		$template = $this->template[$templateType];
		
		$this->db2->query("" .
				"SELECT " .
				"	pk_content, " .
				"	type, " .
				"	memberID, " .
				"	attribute, " .
				"	value " .
				"FROM {$this->tab['content']} " .
				"WHERE " .
				"	fk_container = $pk_container " .
				"ORDER BY" .
				"	attribute ASC, " .
				"	memberID ASC");
		
		while ($this->db2->next_record()) {
			$values[$this->db2->f('type')][$this->db2->f('attribute')][$this->db2->f('memberID')] = stripslashes($this->db2->f('value'));
		}
		
		// folgende beiden zeilen der ermittlung der maximalen bildgrösse bei bildplatzhaltern
		preg_match_all("/(\\{image:maxwidth=)([\\d]+)(\\})/",$this->template[$templateType],$matchMaxWidth);
		$template = preg_replace("/(\\{image:maxwidth=)([\\d]+)(\\})/",'',$template);
		preg_match_all("/(\\{image:maxheight=)([\\d]+)(\\})/",$this->template[$templateType],$matchMaxHeight);
		$template = preg_replace("/(\\{image:maxheight=)([\\d]+)(\\})/",'',$template);		
		
		foreach ($this->replace as $key => $value) {
			preg_match_all("/(\\{".$key.":)([\\w|\\s]+)(\\})/",$this->template[$templateType],$match);
			preg_match_all("/(\\{".$key.":)(uri\\})/",$this->template[$templateType],$matchUri);
			
			if ($key == 'image') {
				// Spezialfall, da Bildbreite und -höhe zur Laufzeit bestimmt werden müssen
				
				for ($i=0;$i<count($matchUri[0]);$i++) {
					
					$maxHeight = (!empty($matchMaxHeight[2][$i])) ? ($matchMaxHeight[2][$i]) : (null);
					$maxWidth = (!empty($matchMaxWidth[2][$i])) ? ($matchMaxWidth[2][$i]) : (null);
				
					foreach ($this->replace[$key]['detail'] as $detail => $variable) {
						if (!empty($values[$key][$detail][$i])) {
							if ($detail == 'uri') {
								$replace = $this->resizeImage($values[$key]['uri'][$i],$maxWidth,$maxHeight);
							} else {
								$replace = $values[$key]['uri'][$i];
							}
						} else {
							$replace = '';
							if ($detail == 'width' && !empty($values[$key]['uri'][$i])) {
								$imagesize = $this->getImageSize($values[$key]['uri'][$i],$maxWidth,$maxHeight);
								$replace = $imagesize['width'];
							}
							if ($detail == 'height' && !empty($values[$key]['uri'][$i])) {
								$imagesize = $this->getImageSize($values[$key]['uri'][$i],$maxWidth,$maxHeight);
								$replace = $imageseize['height'];
							}
						}
						$template = preg_replace("/(\\{".$key.":)(".$detail."\\})/",$replace,$template,1);
					}
				}
			} elseif ($key == 'list') {
				for ($i=0;$i<count($match[0]);$i++) {
					foreach ($this->replace[$key]['detail'] as $detail => $variable) {
						if (!empty($values[$key][$detail][$i])) {
							if ($detail == 'bullet') $replace = '<ul>';
							if ($detail == 'ordered') $replace = '<ol>';
							
							$result = explode("\n",$this->replaceCode($values[$key][$detail][$i]));
							if ($result) foreach ($result as $row) {
								$replace .= "<li>$row</li>";
							}
							
							if ($detail == 'bullet') $replace .= '</ul>';
							if ($detail == 'ordered') $replace .= '</ol>';							
						}
						$template = preg_replace("/(\\{".$key.":)(".$detail."\\})/",$replace,$template,1);
					}
				}
			} else {
				if (count($this->replace[$key]['detail']) > 1) {
					for ($i=0;$i<count($matchUri[0]);$i++) {
						foreach ($this->replace[$key]['detail'] as $detail => $variable) {
							if (!empty($values[$key][$detail][$i])) {
								$replace = $this->replaceCode($values[$key][$detail][$i]);
							} else {
								$replace = '';
							}
							$template = preg_replace("/(\\{".$key.":)(".$detail."\\})/",$replace,$template,1);
						}
					}
				} else {
					for ($i=0;$i<count($match[0]);$i++) {
						if (!empty($values[$key]['name'][$i])) {
							$replace = nl2br($this->replaceCode($values[$key]['name'][$i]));
						} else {
							$replace = '';
						}
						$template = preg_replace("/(\\{".$key.":)([\\w|\\s]+)(\\})/",$replace,$template,1);
					}
				}
			}
		}
		
		return $template;
	}
	
	function getImageWidth($pfad) {
		
		$returnvalue = getimagesize($this->pfad.$pfad);
		
		return $returnvalue[0];
	}
	
	function getImageHeight($pfad) {
		
		$returnvalue = getimagesize($this->pfad.$pfad);
		
		return $returnvalue[1];
	}
	
	function getCachedContent($front = false) {
		
		if ($front) {
			$publicationLimit = "" .
					"AND (" .
					"	container.pubstart = '0000-00-00' " .
					"	OR container.pubstart < now()" .
					"	) " .
					"AND (" .
					"	container.pubend = '0000-00-00' " .
					"	OR container.pubend > now()" .
					"	) ";
		} else {
			$publicationLimit = "";
		}
		
		$returnvalue = array();
		
		$this->db->query("" .
				"SELECT " .
				"	container.pk_container, " .
				"	container.containercache, " .
				"	container.evaluate, " .
				"	container.cacheevaluation, " .
				"	container.template " .
				"FROM {$this->tab['cache']} AS cache " .
				"LEFT JOIN {$this->tab['container']} AS container ON cache.pk_cache = container.fk_cache " .
				"WHERE" .
				"	cache.classID = {$this->classIndex} " .
				"	AND cache.idart = {$this->idart} " .
				"	AND cache.idlang = {$this->idlang} " .
				"	AND container.pk_container IS NOT NULL " .
				"	$publicationLimit " .
				"ORDER BY" .
				"	container.ordervalue");	
		
		while ($this->db->next_record()) {
			$containercache = stripslashes($this->db->f("containercache"));
			if (empty($containercache)) {
				if ($this->db->f('evaluate') == 0 || $this->db->f('cacheevaluation') == 1) {
					$pk_container = $this->db->f('pk_container');
					$containercache = mysql_real_escape_string($this->createContainerCacheFromDB($this->db->f('template'),$pk_container,$this->db->f('cacheevaluation')));
					$this->db2->query("" .
							"UPDATE {$this->tab['container']} " .
							"SET " .
							"	containercache = '$containercache' " .
							"WHERE " .
							"	pk_container = $pk_container");
					$this->db2->query("" .
						"SELECT " .
						"	containercache " .
						"FROM {$this->tab['container']} " .
						"WHERE" .
						"	pk_container = $pk_container");	
						$this->db2->next_record();
					$returnvalue[$pk_container] = stripslashes($this->db2->f('containercache'));
				} else {
					$pk_container = $this->db->f("pk_container");
					$returnvalue[$pk_container] = $this->evaluateContent($pk_container);
				}
			} else {
				$returnvalue[$this->db->f("pk_container")] = $containercache;
			}
		}
		
		return $returnvalue;
	}
	
	function evaluateContent($pk_container,$cachevaluation = false) {
		
		$this->db2->query("" .
				"SELECT * FROM {$this->tab['container']} AS container " .
				"LEFT JOIN {$this->tab['content']} AS content ON content.fk_container = container.pk_container " .
				"WHERE " .
				"	container.pk_container = $pk_container");
		while ($this->db2->next_record()) {
			if ($this->db2->f('attribute') == 'skalar') {
				$conFlakes[$this->db2->f('memberID')] = $this->db2->f('value');
			} else {
				$interim = explode ("\n",$this->db2->f('value'));
				if ($interim) {
					foreach ($interim as $value) {
						$conFlakes[$this->db2->f('memberID')][] = trim($value);
					}
				} else {
					$conFlakes[$this->db2->f('memberID')] = array();
				}
			}
			$template = $this->db2->f('template');
		}
		
		$returnvalue2 = eval('?>'.$this->dynTemplate[$template]);
		$mysqlsafe = mysql_real_escape_string($returnvalue2);
		
		if ($cacheevaluation) {
			$this->db2->query("" .
					"UPDATE {$this->tab['container']} " .
					"SET " .
					"	containercache = $mysqlsafe " .
					"WHERE " .
					"	pk_container = $pk_container");
		}
		
		return $returnvalue;
	}
	
	function getContent($pk_container) {
		
		$returnvalue = array();
		
		$this->db->query("" .
				"SELECT " .
				"	content.pk_content, " .
				"	content.memberID, " .
				"	content.attribute, " .
				"	content.value, " .
				"	content.type, " .
				"	container.template, " .
				"	container.evaluate, " .
				"	container.cacheevaluation, " .
				"	container.pubstart, " .
				"	container.pubend " .
				"FROM {$this->tab['cache']} AS cache " .
				"LEFT JOIN {$this->tab['container']} AS container ON cache.pk_cache = container.fk_cache " .
				"LEFT JOIN {$this->tab['content']} AS content ON container.pk_container = content.fk_container " .
				"WHERE " .
				"	container.pk_container = $pk_container " .
				"ORDER BY " .
				"	content.memberID, " .
				"	content.attribute");
				
		while ($this->db->next_record()) {
			$returnvalue[$this->db->f("pk_content")] = array('pubstart'=>$this->db->f('pubstart'),'pubend'=>$this->db->f('pubend'),'memberID'=>$this->db->f('memberID'),'attribute'=>$this->db->f('attribute'),'type'=>$this->db->f('type'),'template'=>$this->db->f("template"),'value'=>stripslashes($this->db->f("value")),'evaluate'=>$this->db->f("evaluate"),'cacheevaluation'=>$this->db->f("cacheevaluation"));
		}
		
		return $returnvalue;
	}
	
	function addNewTemplate($pos) {
		
		$phpself = 'front_content.php?';
		foreach ($this->get as $key => $value) {
			if ($key != 'moveUp'.$this->classIndex && $key != 'moveDown'.$this->classIndex && $key != 'deletePart'.$this->classIndex && $key != 'editPart'.$this->classIndex && $key != 'newPart'.$this->classIndex) {
				$phpself .= "&$key=$value";
			}
		}
		
		// Statische Inhalte anbieten
		$returnvalue = '<div style="text-align:right; margin-top: 10px; width:100%"><form action="'.$phpself.'" method="POST" name="formnew'.$this->classIndex.'p'.$pos.'" style="display:inline;">';
		$returnvalue .= '<input type="hidden" name="newPart'.$this->classIndex.'" value="'.$pos.'" />';
		$returnvalue .= '<select size="1" name="type" style="font-family:sans-serif; font-size:'.$this->fontSize.'; letter-spacing:1px; color:#FFFFFF; background-color:#FF9900; width:150px;" onChange="formnew'.$this->classIndex.'p'.$pos.'.submit();">';
		$returnvalue .= '<option value="">:: Template einfügen ::</option>';
		
		foreach ($this->template as $key => $value) {
			$returnvalue .= "<option value=\"$key\">$key</option>";
		}
		
		$returnvalue .= '</select></form></div>';
		
		// Dynamische Inhalte anbieten
		$returnvalue .= '<div style="text-align:right; margin-bottom: 10px; width:100%"><form action="'.$phpself.'" method="POST" name="dynformnew'.$this->classIndex.'p'.$pos.'" style="display:inline;">';
		$returnvalue .= '<input type="hidden" name="newPart'.$this->classIndex.'" value="'.$pos.'" />';
		$returnvalue .= '<select size="1" name="dynType" style="font-family:sans-serif; font-size:'.$this->fontSize.'; letter-spacing:1px; color:#FFFFFF; background-color:#FF9900; width:150px;" onChange="dynformnew'.$this->classIndex.'p'.$pos.'.submit();">';
		$returnvalue .= '<option value="">:: dynTemplate einfügen ::</option>';
		
		foreach ($this->dynTemplate as $key => $value) {
			$returnvalue .= "<option value=\"$key\">$key</option>";
		}
		
		$returnvalue .= '</select></form></div>';
		
		return $returnvalue;
	}
	
	function editPubstart($pk,$content,$value = '') {
		
		return "<input type=\"text\" size=\"20\" name=\"conFlakesPubstart\" value=\"$value\" style=\"font-size:{$this->fontSize};\"/>";
	}
	
	function editPubend($pk,$content,$value = '') {
		
		return "<input type=\"text\" size=\"20\" name=\"conFlakesPubend\" value=\"$value\" style=\"font-size:{$this->fontSize};\"/>";
	}
	
	function editText($match,$type,$pk,$content) {
		
		if ($content) foreach ($content as $pk_content => $values) {
			if ($values['type'] == 'text') $name[] = $values['value'];
		}
		
		$returnvalue = '';
		
		$counter = 0;
		foreach ($match as $attribute) {
			$nameValue = (isset($name[$counter]))?($name[$counter]):('');
			$returnvalue .= "<div style=\"padding-top:10px; padding-bottom:5px;\">:: $attribute ::</div><div><input type=\"text\" name=\"conFlakesText[$counter]\" value=\"$nameValue\" style=\"width:100%; font-size:{$this->fontSize};\" /></div>";
			$counter++;
		}
		
		return $returnvalue;
	}

	function editTextarea($match,$type,$pk,$content) {
		
		if ($content) foreach ($content as $pk_content => $values) {
			if ($values['type'] == 'textarea') $name[] = $values['value'];
		}
		
		$returnvalue = '';
		
		$counter = 0;
		foreach ($match as $attribute) {
			$nameValue = (isset($name[$counter]))?($name[$counter]):('');
			$returnvalue .= "<div style=\"padding-top:10px; padding-bottom:5px;\">:: $attribute ::</div><div><textarea name=\"conFlakesTextarea[$counter]\" style=\"width:100%; height:300px; font-size:{$this->fontSize}; \">$nameValue</textarea></div>";
			$counter++;
		}
		
		return $returnvalue;
	}

	function editImage($match,$type,$pk,$content) {
		
		if ($content) foreach ($content as $pk_content => $values) {
			if ($values['type'] == 'image' && $values['attribute'] == 'uri') $uri[] = $values['value'];
			if ($values['type'] == 'image' && $values['attribute'] == 'alt') $altText["{$values['memberID']}"] = $values['value'];
		}
		
		$counter = 0;
		for ($i=0; $i<substr_count($this->template[$type],'{image:uri}');$i++) {
			$uriValue = (isset($uri[$counter]))?($uri[$counter]):('');
			$altValue = (isset($altText[$counter]))?($altText[$counter]):('');
			$returnvalue .= "<div style=\"padding-top:10px; padding-bottom:5px;\">:: Bild $i ::</div><div><select name=\"conFlakesImageUri[$i]\" size=\"1\" style=\"width:100%; font-size:{$this->fontSize};\" />".$this->makeImageSelect($uriValue)."</select</div>";
			$returnvalue .= "<div style=\"padding-top:5px;\"> :: AltText $i :: <input type=\"text\" name=\"conFlakesImageAltText[$i]\" value=\"$altValue\" style=\"width:75%; font-size:{$this->fontSize};\" /></div>";
			$counter++;
		}
		
		return $returnvalue;
	}
	
	function editdynvariable($match,$type,$pk,$content) {
		
		// diese Funktion hat keine Funktion
		// sie darf allerdings nicht gelöscht werden,
		// sondern dient nur als platzhalter.
	}
	
	function editList($match,$type,$pk,$content) {
		
		if ($content) foreach ($content as $pk_content => $values) {
			if ($values['type'] == 'list' && $values['attribute'] == 'bullet') $bullet[] = $values['value'];
			if ($values['type'] == 'list' && $values['attribute'] == 'ordered') $ordered[] = $values['value'];
		}
		
		$returnvalue .= '';
		
		$counter = 0;
		
		for ($i=0; $i<substr_count($this->template[$type],'{list:bullet}');$i++) {
			// echo 'das ist ein test (bullet)';
			$bulletValue = (isset($bullet[$counter]))?($bullet[$counter]):('');
			$returnvalue .= "<div style=\"padding-top:10px; padding-bottom:5px;\">:: BulletList ::</div><div><textarea name=\"conFlakesBulletList[$counter]\" style=\"width:100%; height:300px; font-size:{$this->fontSize};\">$bulletValue</textarea></div>";
			$counter++;
		}
		for ($i=0; $i<substr_count($this->template[$type],'{list:ordered}');$i++) {
			// echo 'das ist ein test (ordered)';
			$orderedValue = (isset($ordered[$counter]))?($ordered[$counter]):('');
			$returnvalue .= "<div style=\"padding-top:10px; padding-bottom:5px;\">:: OrdredList ::</div><div><textarea name=\"conFlakesOrderedList[$counter]\" style=\"width:100%; height:300px; font-size:{$this->fontSize};\">$orderedValue</textarea></div>";
			$counter++;
		}
		
		return $returnvalue;
	}

	function editLink($match,$type,$pk,$content) {
		
		if ($content) foreach ($content as $pk_content => $values) {
			if ($values['type'] == 'link' && $values['attribute'] == 'name') $name["{$values['memberID']}"] = $values['value'];
			if ($values['type'] == 'link' && $values['attribute'] == 'uri') $uri["{$values['memberID']}"] = $values['value'];
			if ($values['type'] == 'link' && $values['attribute'] == 'target') $target["{$values['memberID']}"] = $values['value'];
		}
		
		for ($i=0; $i<substr_count($this->template[$type],'{link:uri}');$i++) {
			$nameValue = (!empty($name[$i]))?($name[$i]):('');
			$uriValue = (!empty($uri[$i]))?($uri[$i]):('');
			$targetValue = (!empty($target[$i]))?($target[$i]):('');
			$returnvalue .= "" .
					"<div style=\"padding-top:10px; padding-bottom:5px;\">:: Link $i ::</div>" .
					"<div style=\"padding-top:5px;\">Name :: <input type=\"text\" name=\"conFlakesLinkName[$i]\" value=\"$nameValue\" style=\"width:75%; font-size:{$this->fontSize};\" /></div>" .
					"<div style=\"padding-top:5px;\">URI :: <input type=\"text\" name=\"conFlakesLinkUri[$i]\" value=\"$uriValue\" style=\"width:75%; font-size:{$this->fontSize};\" /></div>" .
					"<div style=\"padding-top:5px;\">Target :: <input type=\"text\" name=\"conFlakesLinkTarget[$i]\" value=\"$targetValue\" style=\"width:30%; font-size:{$this->fontSize};\" /></div>";
		}
		
		return $returnvalue;
	}
	
	function getInsertID() {
		
		// Liefert den letzten Autoincrement-Wert der Datenbank
		$this->db->query("SELECT LAST_INSERT_ID() AS insertID");
		
		if ($this->db->next_record()) {
			return $this->db->f('insertID');
		}
		
		return false;
	}
	
	/**
	 * Die Funktion prüft, ob bereits ein Eintrag für diese Seite vorliegt oder
	 * nicht. Gibt im Erfolgsfall (bei Vorhandensein) den Primärschlüssel
	 * zurück. Sonst false.
	 * @return mixed Primärschlüssel (integer) im Erfolgsfall. Sonst false.
	 */
	function cacheExists() {
		
		$this->db->query("" .
				"SELECT " .
				"	pk_cache " .
				"FROM {$this->tab['cache']} " .
				"WHERE " .
				"	classID = {$this->classIndex} " .
				"	AND idart = {$this->idart} " .
				"	AND idlang = {$this->idlang}");
				
		if ($this->db->next_record()) {
			return $this->db->f("pk_cache");
		}
		
		return false;
	}
	
	function getPath($root,$level = 0) {
		$content = $this->readDir($root);

		// debugging
		$this->deBug($content, 'getPath-Content aus readDir');

		$returnvalue = array();

		if ($content) foreach ($content as $file) {
			if (is_dir($root.$file)) {
				$verzeichnis = substr($root,$this->pathlen);
				$returnvalue["{$verzeichnis}{$file}/"] = str_repeat("&nbsp;",$level * 5).$file;
				$returnvalue = array_merge($returnvalue,$this->getPath($root.$file."/",$level+1));
			} else {
				$verzeichnis = substr($root,$this->pathlen);
				$returnvalue["{$verzeichnis}{$file}"] = str_repeat("&nbsp;",$level * 5).'-'.$file;
				$returnvalue = array_merge($returnvalue,$this->getPath($root.$file,$level+1));				
			}
		}
		
		// debugging
		$this->deBug($returnvalue, 'getPath-Returnvalue');

		return $returnvalue;
	}

	function readDir($path) {
		if (!is_dir($path)) return false;

		$handle = opendir($path);

		while ($file = readdir ($handle)) {
			if ($file != "." && $file != "..") $returnvalue[] = $file;
		}
		closedir($handle);

		return $returnvalue;
	}

	function makeSelect($preselection) {
		$pfad = $this->getPath($this->pfad);

		$returnvalue = "<option value=\"\">Bitte wählen...</option>";
		foreach ($pfad as $key => $value) {
			if ($preselection == $key) {
				$returnvalue .= "<option value=\"$key\" selected=\"selected\">$value</option>";
			} else {
				$returnvalue .= "<option value=\"$key\">$value</option>";
			}
		}
		
		return $returnvalue;
	}
	
	/**
	 * Gibt Selects spezifisch für Bilder zurück.
	 * @param string preselection Vorauswahl
	 * @return string HTML-Entsprechung für ein Select-Feld
	 */
	function makeImageSelect($preselection) {
		$pfad = $this->getPath($this->pfad);

		$returnvalue = "<option value=\"\">Bitte wählen...</option>";
		foreach ($pfad as $key => $value) {
			
			// Pfadinformationen (u.a. die Extension) ermitteln
			$pathInfo = pathinfo($key);
			
			$this->deBug($pathInfo, 'pathInfo');
			
			// Wenn es sich um einen Bildpfad handelt, ausgeben
			if (
				$pathInfo['extension'] == 'jpg' ||
				$pathInfo['extension'] == 'jpeg' ||
				$pathInfo['extension'] == 'gif' ||
				$pathInfo['extension'] == 'png' ||
				empty($pathInfo['extension'])
				) {
			
				if ($preselection == $key) {
					$returnvalue .= "<option value=\"$key\" selected=\"selected\">$value</option>";
				} else {
					$returnvalue .= "<option value=\"$key\">$value</option>";
				}
				
			}
		}
		
		return $returnvalue;
	}
	
	function resizeImage($bildpfad,$maxWidth,$maxHeight) {
		
		// Pfaddetails ermitteln
		$pathinfo = pathinfo($bildpfad);
		$dirname = $pathinfo['dirname'];
		$basename = basename($bildpfad,$pathinfo['extension']);
		$extension = strtolower($pathinfo['extension']);
aitsu.org :: schnell - flexibel - komfortabel :: Version 2.2.0 (since June 22, 2011) (jetzt mit dual license GPL/kommerziell)

CyberDan
Beiträge: 204
Registriert: Mo 15. Dez 2003, 13:01
Wohnort: Saarland
Kontaktdaten:

Beitrag von CyberDan » Mi 6. Apr 2005, 13:36

da ist wohl beim posten was schief gelaufen, bei dem Quelltext fehlt das letzte Stück :wink:

kummer
Beiträge: 2423
Registriert: Do 6. Mai 2004, 09:17
Wohnort: Bern, Schweiz
Kontaktdaten:

Beitrag von kummer » Mi 6. Apr 2005, 13:41

sorry, hier nochmal:

Code: Alles auswählen

<?php
/**
  * $Revision: 1.17 $
  * $Source: D:/cvs/cvsrepo/test/CONTENIDO_MODULE/conFlakes_m1_444/output.php,v $
  * $Date: 2005/03/30 13:49:19 $
  */

/**
 * conFlakes
 * Online-Editor auf Basis von Templates
 * @package w3conceptsConFlakes
 * @author Andreas Kummer
 * @copyright 2005, mumprecht & kummer w3concepts
 */
class conFlakes {
	
	/**
	 * Konstruktor der Klasse.
	 * @param integer index Index der Klasse
	 */
	function conFlakes($index) {
		
		global $idcat, $idart, $lang, $edit;
		
		// DeBuggin ein- oder ausschalten
		$this->deBug = false;
		
		// Im Klassenkontext zur Verfügung stellen
		$this->idcat = $idcat;
		$this->idart = $idart;
		$this->idlang = $lang;
		
		$this->classIndex = $index;
		
		// Datenbankverbindung herstellen
		$this->db = new DB_Contenido;
		$this->db2 = new DB_Contenido;
		
		// Defaultwerte setzen
		$this->setDefault();
		
		// Templates importieren
		$this->importTemplates();
		$this->importDynTemplates();
		
		// Uebergabewerte im Klassenkontext zur Verfügung stellen
		$this->importParameters();
		
		//if (($contenido && empty($this->get['contenido']) && $changeview =='edit') || ($contenido && !empty($this->get['contenido']) && $this->get['contenido'] == $contenido  && $changeview == 'edit')) {
		if ($edit && empty($this->get['edit'])) {
			if (!empty($this->get['moveUp'.$this->classIndex])) {
				$this->moveContainer($this->get['moveUp'.$this->classIndex]);
			}
			if (!empty($this->get['moveDown'.$this->classIndex])) {
				$this->moveContainer($this->get['moveDown'.$this->classIndex],false);
			}
			if (!empty($this->get['deletePart'.$this->classIndex])) {
				$this->getConFlakesDeleteContainer($this->get['deletePart'.$this->classIndex]);
			}
			if (!empty($this->get['editPart'.$this->classIndex]) && empty($this->post['conFlakesSave'.$this->classIndex])) {
				echo $this->getConFlakesEditOutput($this->get['editPart'.$this->classIndex]);
				return true;
			}
			if (!empty($this->post['newPart'.$this->classIndex]) && (!empty($this->post['type']) || !empty($this->post['dynType']))) {
				echo $this->getConFlakesNewOutput($this->post['newPart'.$this->classIndex]);
				return true;
			}
			if (!empty($this->post['conFlakesSave'.$this->classIndex])) {
				$this->saveConFlakesContent();
			}
			echo $this->getConFlakesEditModeOutput();
		} else {
			// Ausgabe an den Browser
			echo $this->getConFlakesOutput();
			return true;
		}
	}
	
	function setDefault() {
		
		global $cfgClient, $client;
		
		// Tabellennamen festlegen
		$this->tab['cache'] = 'conFlakes_Cache';
		$this->tab['content'] = 'conFlakes_Content';
		$this->tab['container'] = 'conFlakes_Container';
		
		// Replace-Variablen		
		$this->replace['image']['edit'] = 'editImage';
		$this->replace['image']['detail']['uri'] = 'conFlakesImageUri';
		$this->replace['image']['detail']['alt'] = 'conFlakesImageAltText';
		$this->replace['image']['detail']['width'] = 'conFlakesImageWidth';
		$this->replace['image']['detail']['height'] = 'conFlakesImageHeight';
		
		$this->replace['link']['edit'] = 'editLink';
		$this->replace['link']['detail']['uri'] = 'conFlakesLinkUri';
		$this->replace['link']['detail']['target'] = 'conFlakesLinkTarget';
		$this->replace['link']['detail']['name'] = 'conFlakesLinkName';
		
		$this->replace['text']['edit'] = 'editText';
		$this->replace['text']['detail']['name'] = 'conFlakesText';
		
		$this->replace['textarea']['edit'] = 'editTextarea';
		$this->replace['textarea']['detail']['name'] = 'conFlakesTextarea';
		
		$this->replace['list']['edit'] = 'editList';
		$this->replace['list']['detail']['bullet'] = 'conFlakesBulletList';
		$this->replace['list']['detail']['ordered'] = 'conFlakesOrderedList';
		
		$this->replace['dynvariable']['edit'] = 'editDynvarialbe';
		$this->replace['dynvariable']['detail']['skalar'] = 'conFlakesVariableSkalar';
		$this->replace['dynvariable']['detail']['array'] = 'conFlakesVariableArray';
		
		// Bildpfad
		$this->pfad = $cfgClient[$client]['path']['frontend'].$cfgClient[$client]['upload'];
		$this->frontendpfad = $cfgClient[$client]['path']['htmlpath'].$cfgClient[$client]['upload'];
		$this->pathlen = strlen($this->pfad);
		
		// Templatepfad
		$this->templatepfad = $cfgClient[$client]['path']['frontend'].$cfgClient[$client]['upload']."conFlakesTemplates{$this->classIndex}/";
		
		// Schriftgrössen
		$this->fontSize = '90%';
	}
	
	function importTemplates() {
		
		$fileSystem = glob("{$this->templatepfad}*.html");
		if (!empty($fileSystem)) foreach ($fileSystem as $filename) {
			$templateName = basename($filename,".html");
			
			// Einlesen des Templates
			$handle = fopen($filename,"r");
			$content = fread($handle,filesize($filename));
			fclose($handle);
			
			// Extraktion Bodybereich
			preg_match_all("/(<(body)[^>]*>)(.*)(<\/\\2>)/", str_replace("\n","\r",$content), $match);
			
			$this->template[$templateName] = $match[3][0];
		}
		
		if (!empty($this->template)) {
			ksort($this->template);
		} else {
			$this->template = array();
		}
	}
	
	function importDynTemplates() {
		
		$fileSystem = glob("{$this->templatepfad}*.dyn");
		if (!empty($fileSystem)) foreach ($fileSystem as $filename) {
			$templateName = basename($filename,".dyn");
			
			// Einlesen des Templates
			$handle = fopen($filename,"r");
			$content = fread($handle,filesize($filename));
			fclose($handle);
			
			$this->dynTemplate[$templateName] = $content;
		}
		
		if (!empty($this->dynTemplate)) {
			ksort($this->dynTemplate);
		} else {
			$this->dynTemplate = array();
		}
	}
	
	/**
	 * Importiert die per POST und GET übergebenen Werte und entfernt
	 * gleichzeitig - bei Parametern, welche mit POST übertragen worden
	 * sind - allfällig vorhandenen HTML- Code aus dem Resultat.
	 */
	function importParameters() {
		
		$this->get['editPart'] = 0;
		if (!empty($_GET)) foreach ($_GET as $key => $value) {
			$this->get[$key] = $value;
		}
		
		$this->post = array();
		if (!empty($_POST)) foreach ($_POST as $key => $value) {
			// Entfernung allfällig vorhandener HTML-Tags sowie von PHP-Code
			$this->post[$key] = $this->stripTags($value);
		}
	}
	
	function getConFlakesDeleteContainer($pk_container) {
		
		// Ordervalue und pk_cache ermitteln
		$this->db->query("" .
				"SELECT container.ordervalue, cache.pk_cache " .
				"FROM {$this->tab['cache']} AS cache " .
				"LEFT JOIN {$this->tab['container']} AS container ON cache.pk_cache = container.fk_cache " .
				"WHERE" .
				"	container.pk_container = $pk_container");
		if ($this->db->next_record()) {
			$ordervalue = $this->db->f('ordervalue');
			$pk_cache = $this->db->f('pk_cache');
			
			// Einträge in der Content-Tabelle löschen
			$this->db->query("" .
					"DELETE FROM {$this->tab['content']} " .
					"WHERE " .
					"	fk_container = $pk_container");
					
			// Einträge in der Container-Tabelle löschen
			$this->db->query("" .
					"DELETE FROM {$this->tab['container']} " .
					"WHERE " .
					"	pk_container = $pk_container");
					
					
			// Ordervalue der höheren Ordervalues verkürzen
			$this->db->query("" .
					"UPDATE {$this->tab['container']} " .
					"SET " .
					"	ordervalue = ordervalue - 1 " .
					"WHERE " .
					"	ordervalue > $ordervalue " .
					"	AND fk_cache = $pk_cache");
		}
	}
	
	function moveContainer($pk_container, $moveUp = true) {

		// Ordervalue und pk_cache ermitteln
		$this->db->query("" .
				"SELECT container.ordervalue, cache.pk_cache " .
				"FROM {$this->tab['cache']} AS cache " .
				"LEFT JOIN {$this->tab['container']} AS container ON cache.pk_cache = container.fk_cache " .
				"WHERE" .
				"	container.pk_container = $pk_container");
		if ($this->db->next_record()) {
			$ordervalue = $this->db->f('ordervalue');
			$pk_cache = $this->db->f('pk_cache');
			
			// Ordervalues tauschen
			if ($moveUp) {
				$ordervalue2 = $ordervalue - 1;
				$this->db->query("" .
						"UPDATE {$this->tab['container']} " .
						"SET " .
						"	ordervalue = ordervalue + 1 " .
						"WHERE " .
						"	ordervalue = $ordervalue2 " .
						"	AND fk_cache = $pk_cache");
				$this->db->query("" .
						"UPDATE {$this->tab['container']} " .
						"SET " .
						"	ordervalue = ordervalue - 1 " .
						"WHERE " .
						"	pk_container = $pk_container");
			} else {
				$ordervalue2 = $ordervalue + 1;
				$this->db->query("" .
						"UPDATE {$this->tab['container']} " .
						"SET " .
						"	ordervalue = ordervalue - 1 " .
						"WHERE " .
						"	ordervalue = $ordervalue2 " .
						"	AND fk_cache = $pk_cache");
				$this->db->query("" .
						"UPDATE {$this->tab['container']} " .
						"SET " .
						"	ordervalue = ordervalue + 1 " .
						"WHERE " .
						"	pk_container = $pk_container");
			}
		}
	}
	
	function getConFlakesOutput() {
		
		$contents = $this->getCachedContent(true);
		
		$returnvalue = '';
		if ($contents) foreach ($contents as $content) {
			$returnvalue .= $content;
		}
		
		return $returnvalue;
	}
	
	function getConFlakesEditOutput($pk) {
		
		$contents = $this->getContent($pk);
		
		$returnvalue = $this->getEditContainers(0,$pk,$contents);
		
		return $returnvalue;
	}
	
	function getConFlakesNewOutput($pos) {
		
		$returnvalue .= $this->getEditContainers($pos);
		
		return $returnvalue;
	}
	
	function getDynEditContainers($pos, $pk = null, $content = null) {
		
		if (empty($pk)) {
			$type = $this->post['dynType'];
		} else {
			$containerInfo = current($content);
			$type = $containerInfo['template'];
		}
		
		$returnvalue = '<div style="background-color:lightgrey; padding:10px;"><form action="" method="POST" style="display:inline;">';
		if ($pos) $returnvalue .= "<input type=\"hidden\" name=\"conFlakesPos\" value=\"$pos\" />";
		if (!empty($pk)) $returnvalue .= "<input type=\"hidden\" name=\"conFlakesPkContainer\" value=\"$pk\" />";
		$returnvalue .= "<input type=\"hidden\" name=\"conFlakesType\" value=\"$type\" />";
		$returnvalue .= "<input type=\"hidden\" name=\"conFlakesEvaluate\" value=\"1\" />";
		
		$returnvalue .= "<div>Publikation von:<br/>";
		if ($content) {
			$returnvalue .= $this->editPubstart($pk,$content,$containerInfo['pubstart']);
		} else {
			$returnvalue .= $this->editPubstart($pk,$content);
		}
		$returnvalue .= '<br/>bis:<br/>';
		if ($content) {
			$returnvalue .= $this->editPubend($pk,$content,$containerInfo['pubend']);
		} else {
			$returnvalue .= $this->editPubend($pk,$content);
		}
		$returnvalue .= '</div>';
		
		if ($content && $containerInfo['cacheevaluation'] == 1) {
			$checked = 'checked = "checked" ';
		} else {
			$checked = '';
		}
		$returnvalue .= "<div style=\"padding-top:5px;\"><input type=\"checkbox\" name=\"conFlakesCacheEvaluation\" value=\"1\" $checked/> Cache Output</div>";
		
		if (empty($pk)) {
			// Uebergabe über Post müsste erfolgen
			$type = $this->post['dynType'];
		} else {
			// Info findet sich in der Datenbank
			$containerInfo = current($content);
			$type = $containerInfo['template'];
		}
		
		if ($content) foreach ($content as $pk_content => $values) {
			if ($values['type'] == 'dynvariable' && $values['attribute'] == 'skalar') $dynvariableSkalar[] = $values['value'];
			if ($values['type'] == 'dynvariable' && $values['attribute'] == 'array') $dynvariableArray[] = $values['value'];
		}
		
		// Dynamische Inhalte aus der PHP-Datei lesen
		preg_match_all("/(\\{conFlakesVariable:skalar=)([\\w|\\s]+)(\\})/",$this->dynTemplate[$type],$matchSkalar);
		preg_match_all("/(\\{conFlakesVariable:array=)([\\w|\\s]+)(\\})/",$this->dynTemplate[$type],$matchArray);
		
		// Die Skalar-Werte anzeigen
		$counter = 0;
		foreach ($matchSkalar[2] as $key => $value) {
			$skalarValue = (isset($dynvariableSkalar[$counter]))?($dynvariableSkalar[$counter]):('');
			$returnvalue .= "<div style=\"padding-top:10px; padding-bottom:5px;\">:: $value (skalar) ::</div><div><input type=\"text\" name=\"conFlakesVariableSkalar[$value]\" value=\"$skalarValue\" style=\"width:100%; font-size:{$this->fontSize};\" /></div>";
			$counter++;
		}
		
		// Die Array-Werte anzeigen
		$counter = 0;
		foreach ($matchArray[2] as $key => $value) {
			$arrayValue = (isset($dynvariableArray[$counter]))?($dynvariableArray[$counter]):('');
			$returnvalue .= "<div style=\"padding-top:10px; padding-bottom:5px;\">:: $value (array) ::</div><div><textarea name=\"conFlakesVariableArray[$value]\" style=\"width:100%; height:300px; font-size:{$this->fontSize}; \">$arrayValue</textarea></div>";
			$counter++;
		}
		
		return $returnvalue.'<div style="padding-top:10px;"><input type="hidden" name="conFlakesSave'.$this->classIndex.'" value="conFlakesSave" /><input type="submit" value="speichern" /></div></form></div>';
	}
	
	function getEditContainers($pos, $pk = null, $content = null) {
		
		if (empty($pk)) {
			if (empty($this->post['dynType'])) {
				$type = $this->post['type'];
			} else {
				return $this->getDynEditContainers($pos);
			}
		} else {
			$containerInfo = current($content);
			if (empty($containerInfo['evaluate'])) {
				$type = $containerInfo['template'];
			} else {
				return $this->getDynEditContainers($pos,$pk,$content);
			}
		}
		
		$returnvalue = '<div style="background-color:lightgrey; padding:10px;"><form action="" method="POST" style="display:inline;">';
		if ($pos) $returnvalue .= "<input type=\"hidden\" name=\"conFlakesPos\" value=\"$pos\" />";
		if (!empty($pk)) $returnvalue .= "<input type=\"hidden\" name=\"conFlakesPkContainer\" value=\"$pk\" />";
		$returnvalue .= "<input type=\"hidden\" name=\"conFlakesType\" value=\"$type\" />";
		
		$returnvalue .= "<div>Publikation von:<br/>";
		if ($content) {
			$returnvalue .= $this->editPubstart($pk,$content,$containerInfo['pubstart']);
		} else {
			$returnvalue .= $this->editPubstart($pk,$content);
		}
		$returnvalue .= '<br/>bis:<br/>';
		if ($content) {
			$returnvalue .= $this->editPubend($pk,$content,$containerInfo['pubend']);
		} else {
			$returnvalue .= $this->editPubend($pk,$content);
		}
		$returnvalue .= '</div>';
		
		foreach ($this->replace as $key => $value) {
			preg_match_all("/(\\{".$key.":)([\\w|\\s]+)(\\})/",$this->template[$type],$match);
			
			$function = "edit$key";
			$returnvalue .= $this->$function($match[2],$type,$pk,$content);
		}
		
		return $returnvalue.'<div style="padding-top:10px;"><input type="hidden" name="conFlakesSave'.$this->classIndex.'" value="conFlakesSave" /><input type="submit" value="speichern" /></div></form></div>';	
	}
	
	function getConFlakesEditModeOutput() {
		
		$contents = $this->getCachedContent();
		
		$counter = 1;
		
		$returnvalue .= $this->addNewTemplate($counter);
		
		if (!empty($contents)) foreach ($contents as $pk_container => $content) {
			
			// publikationsdaten ermitteln
			$this->db->query("" .
					"SELECT " .
					"	IF(pubstart != 0,pubstart,0) AS pubstart, " .
					"	IF(pubend != 0,pubend,0) AS pubend, " .
					"	IF((pubstart < NOW() && pubend > NOW()) || (pubstart < NOW() && pubend = 0),1,0) AS now, " .
					"	IF(pubstart > NOW(),1,0) AS future " .
					"FROM {$this->tab['container']} " .
					"WHERE " .
					"	pk_container = $pk_container");
			if ($this->db->next_record()) {
				$pubstart = $this->db->f('pubstart');
				$pubend = $this->db->f('pubend');
				$now = $this->db->f('now');
				$future = $this->db->f('future');
			}
			
			if (($now && !$pubend && $pubstart) || (!$pubend && !$pubstart)) {
				$publikation = "[ :: Artikel ist online :: ]";
			} elseif ($now && $pubend && !$pubstart) {
				$publikation = "[ :: Artikel ist online bis $pubend :: ]";
			} elseif (!$now && $pubstart && !$pubend) {
				$publikation = "[ :: Artikel ist <strong>offline</strong> bis $pubstart :: ]";
			} elseif (!$now && $future) {
				$publikation = "[ :: Artikel geht von $pubstart bis $pubend online :: ]";
			} else {
				$publikation = "[ :: Artikel ist <strong>offline</strong> seit $pubend :: ]";
			}

			$returnvalue .= '<div style="padding:5px; border-top:1px solid #999999; border-right:1px solid #999999; border-left:1px solid #999999; width:100%; z-index:$counter; font-family:sans-serif; font-size:'.$this->fontSize.'; color:white; background-color:#FF9900">'.$publikation.'</div>';
			
			$returnvalue .= '<div style="padding:5px; border:1px solid #999999; width:100%; z-index:$counter;">'.$content.'</div>';
			
			$phpself = 'front_content.php?';
			foreach ($this->get as $key => $value) {
				if ($key != 'moveUp'.$this->classIndex && $key != 'moveDown'.$this->classIndex && $key != 'deletePart'.$this->classIndex && $key != 'editPart'.$this->classIndex && $key != 'newPart'.$this->classIndex) {
					$phpself .= "&$key=$value";
				}
			}
			
			$edit = "<a href=\"$phpself&editPart{$this->classIndex}=$pk_container\" style=\"color:white; font-size:{$this->fontSize};\">[ :: edit :: ]</a>&nbsp;";
			$delete = "<a href=\"$phpself&deletePart{$this->classIndex}=$pk_container\" style=\"color:white; font-size:{$this->fontSize};\">[ :: delete :: ]</a>&nbsp;";
			
			if ($counter > 1) {
				$moveup = "<a href=\"$phpself&moveUp{$this->classIndex}=$pk_container\" style=\"color:white; font-size:{$this->fontSize};\">[ :: moveUp ^^^ :: ]</a>&nbsp;";
			} else {
				$moveup = '';
			}
			if ($counter < count($contents)) {
				$movedown = "<a href=\"$phpself&moveDown{$this->classIndex}=$pk_container\" style=\"color:white; font-size:{$this->fontSize};\">[ :: moveDown vvv :: ]</a>&nbsp;";
			} else {
				$movedown = '';
			}
			
			$returnvalue .= '<div style="padding:5px; border:1px solid #999999; border-top:none; width:100%; z-index:$counter; font-family:sans-serif; font-size:'.$this->fontSize.'; color:white; background-color:#FF9900">'.$edit.$delete.$moveup.$movedown.'</div>';
			$counter++;
			$returnvalue .= $this->addNewTemplate($counter);
		}
		
		return $returnvalue;
	}
	
	function saveConFlakesContent() {
		
		// Wert für cacheevaluation setzen
		if (!empty($this->post['conFlakesCacheEvaluation'])) {
			$cacheevaluation = 1;
		} else {
			$cacheevaluation = 0;
		}

		// Containerchache erstellen
		$containercache = mysql_real_escape_string($this->createContainerCache($this->post['conFlakesType']));
		
		if (empty($this->post['conFlakesPkContainer'])) {
			// Neuer Eintrag
			if (!$pk_cache = $this->cacheExists()) {
				// Cache ist ebenfalls anzulegen
				$this->db->query("" .
						"INSERT INTO {$this->tab['cache']} " .
						"(classID, idart, idlang) " .
						"VALUES " .
						"({$this->classIndex},{$this->idart},{$this->idlang})");
				$pk_cache = $this->getInsertID();
			}
			
			// Verschieben aller bisherigen Einträge
			$this->db->query("" .
					"UPDATE {$this->tab['container']} " .
					"SET" .
					"	ordervalue = ordervalue + 1 " .
					"WHERE" .
					"	fk_cache = $pk_cache " .
					"	AND ordervalue >= {$this->post['conFlakesPos']}");
			// Neuer Eintrag
			$evaluate = (empty($this->post['conFlakesEvaluate']))?(0):(1);
			$this->db->query("" .
					"INSERT INTO {$this->tab['container']} " .
					"(fk_cache, template, ordervalue, pubstart, pubend, containercache, evaluate, cacheevaluation) " .
					"VALUES " .
					"($pk_cache, '{$this->post['conFlakesType']}', {$this->post['conFlakesPos']}, '{$this->post['conFlakesPubstart']}', '{$this->post['conFlakesPubend']}', '$containercache', $evaluate, $cacheevaluation)");
			$pk_container = $this->getInsertID();
		
		} else {
			// Update des bestehenden Eintrages
			$pk_container = $this->post['conFlakesPkContainer'];
			
			$this->db->query("" .
					"UPDATE {$this->tab['container']} " .
					"SET " .
					"	containercache = '$containercache'," .
					"	pubstart = '{$this->post['conFlakesPubstart']}'," .
					"	pubend = '{$this->post['conFlakesPubend']}', " .
					"	cacheevaluation = $cacheevaluation " .
					"WHERE " .
					"	pk_container = $pk_container");
		}
		
		// Bestehende Einträge in der Tabelle content löschen
		$this->db->query("" .
				"DELETE FROM {$this->tab['content']} " .
				"WHERE" .
				"	fk_container = $pk_container");
				
		foreach ($this->replace as $key => $value) {
			foreach ($value['detail'] as $attribute => $variable) {
				if (!empty($this->post[$variable])) {
					foreach ($this->post[$variable] as $memberID => $value) {
						$value = mysql_real_escape_string($value);
						$this->db->query("" .
								"INSERT INTO {$this->tab['content']} " .
								"(fk_container, type, memberID, attribute, value) " .
								"VALUES " .
								"($pk_container,'$key','$memberID', '$attribute', '$value')");
					}
				}
			}
		}
	}
	
	/**
	 * Erstellt einen Cache aufgrund der per Post übergebenen Werte.
	 * @param string templateType Template-Typ
	 * @return string Container-Cache
	 */
	function createContainerCache($templateType) {
		
		$template = $this->template[$templateType];
		
		/*
		 * Ermittlung der maximalen Bildgrösse bei Bildplatzhaltern
		 */
		preg_match_all("/(\\{image:maxwidth=)([\\d]+)(\\})/",$this->template[$templateType],$matchMaxWidth);
		$template = preg_replace("/(\\{image:maxwidth=)([\\d]+)(\\})/",'',$template);
		preg_match_all("/(\\{image:maxheight=)([\\d]+)(\\})/",$this->template[$templateType],$matchMaxHeight);
		$template = preg_replace("/(\\{image:maxheight=)([\\d]+)(\\})/",'',$template);
			
		foreach ($this->replace as $key => $value) {
			preg_match_all("/(\\{".$key.":)([\\w|\\s]+)(\\})/",$this->template[$templateType],$match);
			preg_match_all("/(\\{".$key.":)(uri\\})/",$this->template[$templateType],$matchUri);
			
			if ($key == 'image') {
				// Spezialfall, da Bildbreite und -höhe zur Laufzeit bestimmt werden müssen
				for ($i=0;$i<count($matchUri[0]);$i++) {
					
					$maxHeight = (!empty($matchMaxHeight[2][$i])) ? ($matchMaxHeight[2][$i]) : (null);
					$maxWidth = (!empty($matchMaxWidth[2][$i])) ? ($matchMaxWidth[2][$i]) : (null);
					
					foreach ($this->replace[$key]['detail'] as $detail => $variable) {
						if (!empty($this->post[$variable][$i])) {
							if ($detail == 'uri') {
								$replace = $this->resizeImage($this->post[$variable][$i],$maxWidth,$maxHeight);
							} else {
								$replace = $this->post[$variable][$i];
							}
						} else {
							if ($detail == 'width' && !empty($this->post['conFlakesImageUri'][$i])) {
								$imagesize = $this->getImageSize($this->post['conFlakesImageUri'][$i],$maxWidth,$maxHeight);
								$replace = $imagesize['width'];
							} elseif ($detail == 'height' && !empty($this->post['conFlakesImageUri'][$i])) {
								$imagesize = $this->getImageSize($this->post['conFlakesImageUri'][$i],$maxWidth,$maxHeight);
								$replace = $imagesize['height'];
							}
						}
						$template = preg_replace("/(\\{".$key.":)(".$detail."\\})/",$replace,$template,1);
					}
				}
			} elseif ($key == 'list') {
				for ($i=0;$i<count($match[0]);$i++) {
					foreach ($this->replace[$key]['detail'] as $detail => $variable) {
						if (!empty($this->post[$variable][$i])) {
							if ($detail == 'bullet') $replace = '<ul>';
							if ($detail == 'ordered') $replace = '<ol>';
							
							$result = explode("\n",$this->replaceCode($this->post[$variable][$i]));
							if ($result) foreach ($result as $row) {
								$replace .= "<li>$row</li>";
							}
							
							if ($detail == 'bullet') $replace .= '</ul>';
							if ($detail == 'ordered') $replace .= '</ol>';							
						}
						$template = preg_replace("/(\\{".$key.":)(".$detail."\\})/",$replace,$template,1);
					}
				}
			} else {
				if (count($this->replace[$key]['detail']) > 1) {
					for ($i=0;$i<count($matchUri[0]);$i++) {
						foreach ($this->replace[$key]['detail'] as $detail => $variable) {
							if (!empty($this->post[$variable][$i])) {
								$replace = $this->replaceCode($this->post[$variable][$i]);
							} else {
								$replace = '';
							}
							$template = preg_replace("/(\\{".$key.":)(".$detail."\\})/",$replace,$template,1);
						}
					}
				} else {
					for ($i=0;$i<count($match[0]);$i++) {
						$variable = $this->replace[$key]['detail']['name'];
						if (!empty($this->post[$variable][$i])) {
							$replace = nl2br($this->replaceCode($this->post[$variable][$i]));
						} else {
							$replace = '';
						}
						$template = preg_replace("/(\\{".$key.":)([\\w|\\s]+)(\\})/",$replace,$template,1);
					}
				}
			}
		}
		
		return $template;
	}
	
	function createContainerCacheFromDB($templateType,$pk_container,$cacheevaluation) {
		
		if ($cacheevaluation) {
			return $this->evaluateContent($pk_container,$cacheevaluation);
		}
		
		$template = $this->template[$templateType];
		
		$this->db2->query("" .
				"SELECT " .
				"	pk_content, " .
				"	type, " .
				"	memberID, " .
				"	attribute, " .
				"	value " .
				"FROM {$this->tab['content']} " .
				"WHERE " .
				"	fk_container = $pk_container " .
				"ORDER BY" .
				"	attribute ASC, " .
				"	memberID ASC");
		
		while ($this->db2->next_record()) {
			$values[$this->db2->f('type')][$this->db2->f('attribute')][$this->db2->f('memberID')] = stripslashes($this->db2->f('value'));
		}
		
		// folgende beiden zeilen der ermittlung der maximalen bildgrösse bei bildplatzhaltern
		preg_match_all("/(\\{image:maxwidth=)([\\d]+)(\\})/",$this->template[$templateType],$matchMaxWidth);
		$template = preg_replace("/(\\{image:maxwidth=)([\\d]+)(\\})/",'',$template);
		preg_match_all("/(\\{image:maxheight=)([\\d]+)(\\})/",$this->template[$templateType],$matchMaxHeight);
		$template = preg_replace("/(\\{image:maxheight=)([\\d]+)(\\})/",'',$template);		
		
		foreach ($this->replace as $key => $value) {
			preg_match_all("/(\\{".$key.":)([\\w|\\s]+)(\\})/",$this->template[$templateType],$match);
			preg_match_all("/(\\{".$key.":)(uri\\})/",$this->template[$templateType],$matchUri);
			
			if ($key == 'image') {
				// Spezialfall, da Bildbreite und -höhe zur Laufzeit bestimmt werden müssen
				
				for ($i=0;$i<count($matchUri[0]);$i++) {
					
					$maxHeight = (!empty($matchMaxHeight[2][$i])) ? ($matchMaxHeight[2][$i]) : (null);
					$maxWidth = (!empty($matchMaxWidth[2][$i])) ? ($matchMaxWidth[2][$i]) : (null);
				
					foreach ($this->replace[$key]['detail'] as $detail => $variable) {
						if (!empty($values[$key][$detail][$i])) {
							if ($detail == 'uri') {
								$replace = $this->resizeImage($values[$key]['uri'][$i],$maxWidth,$maxHeight);
							} else {
								$replace = $values[$key]['uri'][$i];
							}
						} else {
							$replace = '';
							if ($detail == 'width' && !empty($values[$key]['uri'][$i])) {
								$imagesize = $this->getImageSize($values[$key]['uri'][$i],$maxWidth,$maxHeight);
								$replace = $imagesize['width'];
							}
							if ($detail == 'height' && !empty($values[$key]['uri'][$i])) {
								$imagesize = $this->getImageSize($values[$key]['uri'][$i],$maxWidth,$maxHeight);
								$replace = $imageseize['height'];
							}
						}
						$template = preg_replace("/(\\{".$key.":)(".$detail."\\})/",$replace,$template,1);
					}
				}
			} elseif ($key == 'list') {
				for ($i=0;$i<count($match[0]);$i++) {
					foreach ($this->replace[$key]['detail'] as $detail => $variable) {
						if (!empty($values[$key][$detail][$i])) {
							if ($detail == 'bullet') $replace = '<ul>';
							if ($detail == 'ordered') $replace = '<ol>';
							
							$result = explode("\n",$this->replaceCode($values[$key][$detail][$i]));
							if ($result) foreach ($result as $row) {
								$replace .= "<li>$row</li>";
							}
							
							if ($detail == 'bullet') $replace .= '</ul>';
							if ($detail == 'ordered') $replace .= '</ol>';							
						}
						$template = preg_replace("/(\\{".$key.":)(".$detail."\\})/",$replace,$template,1);
					}
				}
			} else {
				if (count($this->replace[$key]['detail']) > 1) {
					for ($i=0;$i<count($matchUri[0]);$i++) {
						foreach ($this->replace[$key]['detail'] as $detail => $variable) {
							if (!empty($values[$key][$detail][$i])) {
								$replace = $this->replaceCode($values[$key][$detail][$i]);
							} else {
								$replace = '';
							}
							$template = preg_replace("/(\\{".$key.":)(".$detail."\\})/",$replace,$template,1);
						}
					}
				} else {
					for ($i=0;$i<count($match[0]);$i++) {
						if (!empty($values[$key]['name'][$i])) {
							$replace = nl2br($this->replaceCode($values[$key]['name'][$i]));
						} else {
							$replace = '';
						}
						$template = preg_replace("/(\\{".$key.":)([\\w|\\s]+)(\\})/",$replace,$template,1);
					}
				}
			}
		}
		
		return $template;
	}
	
	function getImageWidth($pfad) {
		
		$returnvalue = getimagesize($this->pfad.$pfad);
		
		return $returnvalue[0];
	}
	
	function getImageHeight($pfad) {
		
		$returnvalue = getimagesize($this->pfad.$pfad);
		
		return $returnvalue[1];
	}
	
	function getCachedContent($front = false) {
		
		if ($front) {
			$publicationLimit = "" .
					"AND (" .
					"	container.pubstart = '0000-00-00' " .
					"	OR container.pubstart < now()" .
					"	) " .
					"AND (" .
					"	container.pubend = '0000-00-00' " .
					"	OR container.pubend > now()" .
					"	) ";
		} else {
			$publicationLimit = "";
		}
		
		$returnvalue = array();
		
		$this->db->query("" .
				"SELECT " .
				"	container.pk_container, " .
				"	container.containercache, " .
				"	container.evaluate, " .
				"	container.cacheevaluation, " .
				"	container.template " .
				"FROM {$this->tab['cache']} AS cache " .
				"LEFT JOIN {$this->tab['container']} AS container ON cache.pk_cache = container.fk_cache " .
				"WHERE" .
				"	cache.classID = {$this->classIndex} " .
				"	AND cache.idart = {$this->idart} " .
				"	AND cache.idlang = {$this->idlang} " .
				"	AND container.pk_container IS NOT NULL " .
				"	$publicationLimit " .
				"ORDER BY" .
				"	container.ordervalue");	
		
		while ($this->db->next_record()) {
			$containercache = stripslashes($this->db->f("containercache"));
			if (empty($containercache)) {
				if ($this->db->f('evaluate') == 0 || $this->db->f('cacheevaluation') == 1) {
					$pk_container = $this->db->f('pk_container');
					$containercache = mysql_real_escape_string($this->createContainerCacheFromDB($this->db->f('template'),$pk_container,$this->db->f('cacheevaluation')));
					$this->db2->query("" .
							"UPDATE {$this->tab['container']} " .
							"SET " .
							"	containercache = '$containercache' " .
							"WHERE " .
							"	pk_container = $pk_container");
					$this->db2->query("" .
						"SELECT " .
						"	containercache " .
						"FROM {$this->tab['container']} " .
						"WHERE" .
						"	pk_container = $pk_container");	
						$this->db2->next_record();
					$returnvalue[$pk_container] = stripslashes($this->db2->f('containercache'));
				} else {
					$pk_container = $this->db->f("pk_container");
					$returnvalue[$pk_container] = $this->evaluateContent($pk_container);
				}
			} else {
				$returnvalue[$this->db->f("pk_container")] = $containercache;
			}
		}
		
		return $returnvalue;
	}
	
	function evaluateContent($pk_container,$cachevaluation = false) {
		
		$this->db2->query("" .
				"SELECT * FROM {$this->tab['container']} AS container " .
				"LEFT JOIN {$this->tab['content']} AS content ON content.fk_container = container.pk_container " .
				"WHERE " .
				"	container.pk_container = $pk_container");
		while ($this->db2->next_record()) {
			if ($this->db2->f('attribute') == 'skalar') {
				$conFlakes[$this->db2->f('memberID')] = $this->db2->f('value');
			} else {
				$interim = explode ("\n",$this->db2->f('value'));
				if ($interim) {
					foreach ($interim as $value) {
						$conFlakes[$this->db2->f('memberID')][] = trim($value);
					}
				} else {
					$conFlakes[$this->db2->f('memberID')] = array();
				}
			}
			$template = $this->db2->f('template');
		}
		
		$returnvalue2 = eval('?>'.$this->dynTemplate[$template]);
		$mysqlsafe = mysql_real_escape_string($returnvalue2);
		
		if ($cacheevaluation) {
			$this->db2->query("" .
					"UPDATE {$this->tab['container']} " .
					"SET " .
					"	containercache = $mysqlsafe " .
					"WHERE " .
					"	pk_container = $pk_container");
		}
		
		return $returnvalue;
	}
	
	function getContent($pk_container) {
		
		$returnvalue = array();
		
		$this->db->query("" .
				"SELECT " .
				"	content.pk_content, " .
				"	content.memberID, " .
				"	content.attribute, " .
				"	content.value, " .
				"	content.type, " .
				"	container.template, " .
				"	container.evaluate, " .
				"	container.cacheevaluation, " .
				"	container.pubstart, " .
				"	container.pubend " .
				"FROM {$this->tab['cache']} AS cache " .
				"LEFT JOIN {$this->tab['container']} AS container ON cache.pk_cache = container.fk_cache " .
				"LEFT JOIN {$this->tab['content']} AS content ON container.pk_container = content.fk_container " .
				"WHERE " .
				"	container.pk_container = $pk_container " .
				"ORDER BY " .
				"	content.memberID, " .
				"	content.attribute");
				
		while ($this->db->next_record()) {
			$returnvalue[$this->db->f("pk_content")] = array('pubstart'=>$this->db->f('pubstart'),'pubend'=>$this->db->f('pubend'),'memberID'=>$this->db->f('memberID'),'attribute'=>$this->db->f('attribute'),'type'=>$this->db->f('type'),'template'=>$this->db->f("template"),'value'=>stripslashes($this->db->f("value")),'evaluate'=>$this->db->f("evaluate"),'cacheevaluation'=>$this->db->f("cacheevaluation"));
		}
		
		return $returnvalue;
	}
	
	function addNewTemplate($pos) {
		
		$phpself = 'front_content.php?';
		foreach ($this->get as $key => $value) {
			if ($key != 'moveUp'.$this->classIndex && $key != 'moveDown'.$this->classIndex && $key != 'deletePart'.$this->classIndex && $key != 'editPart'.$this->classIndex && $key != 'newPart'.$this->classIndex) {
				$phpself .= "&$key=$value";
			}
		}
		
		// Statische Inhalte anbieten
		$returnvalue = '<div style="text-align:right; margin-top: 10px; width:100%"><form action="'.$phpself.'" method="POST" name="formnew'.$this->classIndex.'p'.$pos.'" style="display:inline;">';
		$returnvalue .= '<input type="hidden" name="newPart'.$this->classIndex.'" value="'.$pos.'" />';
		$returnvalue .= '<select size="1" name="type" style="font-family:sans-serif; font-size:'.$this->fontSize.'; letter-spacing:1px; color:#FFFFFF; background-color:#FF9900; width:150px;" onChange="formnew'.$this->classIndex.'p'.$pos.'.submit();">';
		$returnvalue .= '<option value="">:: Template einfügen ::</option>';
		
		foreach ($this->template as $key => $value) {
			$returnvalue .= "<option value=\"$key\">$key</option>";
		}
		
		$returnvalue .= '</select></form></div>';
		
		// Dynamische Inhalte anbieten
		$returnvalue .= '<div style="text-align:right; margin-bottom: 10px; width:100%"><form action="'.$phpself.'" method="POST" name="dynformnew'.$this->classIndex.'p'.$pos.'" style="display:inline;">';
		$returnvalue .= '<input type="hidden" name="newPart'.$this->classIndex.'" value="'.$pos.'" />';
		$returnvalue .= '<select size="1" name="dynType" style="font-family:sans-serif; font-size:'.$this->fontSize.'; letter-spacing:1px; color:#FFFFFF; background-color:#FF9900; width:150px;" onChange="dynformnew'.$this->classIndex.'p'.$pos.'.submit();">';
		$returnvalue .= '<option value="">:: dynTemplate einfügen ::</option>';
		
		foreach ($this->dynTemplate as $key => $value) {
			$returnvalue .= "<option value=\"$key\">$key</option>";
		}
		
		$returnvalue .= '</select></form></div>';
		
		return $returnvalue;
	}
	
	function editPubstart($pk,$content,$value = '') {
		
		return "<input type=\"text\" size=\"20\" name=\"conFlakesPubstart\" value=\"$value\" style=\"font-size:{$this->fontSize};\"/>";
	}
	
	function editPubend($pk,$content,$value = '') {
		
		return "<input type=\"text\" size=\"20\" name=\"conFlakesPubend\" value=\"$value\" style=\"font-size:{$this->fontSize};\"/>";
	}
	
	function editText($match,$type,$pk,$content) {
		
		if ($content) foreach ($content as $pk_content => $values) {
			if ($values['type'] == 'text') $name[] = $values['value'];
		}
		
		$returnvalue = '';
		
		$counter = 0;
		foreach ($match as $attribute) {
			$nameValue = (isset($name[$counter]))?($name[$counter]):('');
			$returnvalue .= "<div style=\"padding-top:10px; padding-bottom:5px;\">:: $attribute ::</div><div><input type=\"text\" name=\"conFlakesText[$counter]\" value=\"$nameValue\" style=\"width:100%; font-size:{$this->fontSize};\" /></div>";
			$counter++;
		}
		
		return $returnvalue;
	}

	function editTextarea($match,$type,$pk,$content) {
		
		if ($content) foreach ($content as $pk_content => $values) {
			if ($values['type'] == 'textarea') $name[] = $values['value'];
		}
		
		$returnvalue = '';
		
		$counter = 0;
		foreach ($match as $attribute) {
			$nameValue = (isset($name[$counter]))?($name[$counter]):('');
			$returnvalue .= "<div style=\"padding-top:10px; padding-bottom:5px;\">:: $attribute ::</div><div><textarea name=\"conFlakesTextarea[$counter]\" style=\"width:100%; height:300px; font-size:{$this->fontSize}; \">$nameValue</textarea></div>";
			$counter++;
		}
		
		return $returnvalue;
	}

	function editImage($match,$type,$pk,$content) {
		
		if ($content) foreach ($content as $pk_content => $values) {
			if ($values['type'] == 'image' && $values['attribute'] == 'uri') $uri[] = $values['value'];
			if ($values['type'] == 'image' && $values['attribute'] == 'alt') $altText["{$values['memberID']}"] = $values['value'];
		}
		
		$counter = 0;
		for ($i=0; $i<substr_count($this->template[$type],'{image:uri}');$i++) {
			$uriValue = (isset($uri[$counter]))?($uri[$counter]):('');
			$altValue = (isset($altText[$counter]))?($altText[$counter]):('');
			$returnvalue .= "<div style=\"padding-top:10px; padding-bottom:5px;\">:: Bild $i ::</div><div><select name=\"conFlakesImageUri[$i]\" size=\"1\" style=\"width:100%; font-size:{$this->fontSize};\" />".$this->makeImageSelect($uriValue)."</select</div>";
			$returnvalue .= "<div style=\"padding-top:5px;\"> :: AltText $i :: <input type=\"text\" name=\"conFlakesImageAltText[$i]\" value=\"$altValue\" style=\"width:75%; font-size:{$this->fontSize};\" /></div>";
			$counter++;
		}
		
		return $returnvalue;
	}
	
	function editdynvariable($match,$type,$pk,$content) {
		
		// diese Funktion hat keine Funktion
		// sie darf allerdings nicht gelöscht werden,
		// sondern dient nur als platzhalter.
	}
	
	function editList($match,$type,$pk,$content) {
		
		if ($content) foreach ($content as $pk_content => $values) {
			if ($values['type'] == 'list' && $values['attribute'] == 'bullet') $bullet[] = $values['value'];
			if ($values['type'] == 'list' && $values['attribute'] == 'ordered') $ordered[] = $values['value'];
		}
		
		$returnvalue .= '';
		
		$counter = 0;
		
		for ($i=0; $i<substr_count($this->template[$type],'{list:bullet}');$i++) {
			// echo 'das ist ein test (bullet)';
			$bulletValue = (isset($bullet[$counter]))?($bullet[$counter]):('');
			$returnvalue .= "<div style=\"padding-top:10px; padding-bottom:5px;\">:: BulletList ::</div><div><textarea name=\"conFlakesBulletList[$counter]\" style=\"width:100%; height:300px; font-size:{$this->fontSize};\">$bulletValue</textarea></div>";
			$counter++;
		}
		for ($i=0; $i<substr_count($this->template[$type],'{list:ordered}');$i++) {
			// echo 'das ist ein test (ordered)';
			$orderedValue = (isset($ordered[$counter]))?($ordered[$counter]):('');
			$returnvalue .= "<div style=\"padding-top:10px; padding-bottom:5px;\">:: OrdredList ::</div><div><textarea name=\"conFlakesOrderedList[$counter]\" style=\"width:100%; height:300px; font-size:{$this->fontSize};\">$orderedValue</textarea></div>";
			$counter++;
		}
		
		return $returnvalue;
	}

	function editLink($match,$type,$pk,$content) {
		
		if ($content) foreach ($content as $pk_content => $values) {
			if ($values['type'] == 'link' && $values['attribute'] == 'name') $name["{$values['memberID']}"] = $values['value'];
			if ($values['type'] == 'link' && $values['attribute'] == 'uri') $uri["{$values['memberID']}"] = $values['value'];
			if ($values['type'] == 'link' && $values['attribute'] == 'target') $target["{$values['memberID']}"] = $values['value'];
		}
		
		for ($i=0; $i<substr_count($this->template[$type],'{link:uri}');$i++) {
			$nameValue = (!empty($name[$i]))?($name[$i]):('');
			$uriValue = (!empty($uri[$i]))?($uri[$i]):('');
			$targetValue = (!empty($target[$i]))?($target[$i]):('');
			$returnvalue .= "" .
					"<div style=\"padding-top:10px; padding-bottom:5px;\">:: Link $i ::</div>" .
					"<div style=\"padding-top:5px;\">Name :: <input type=\"text\" name=\"conFlakesLinkName[$i]\" value=\"$nameValue\" style=\"width:75%; font-size:{$this->fontSize};\" /></div>" .
					"<div style=\"padding-top:5px;\">URI :: <input type=\"text\" name=\"conFlakesLinkUri[$i]\" value=\"$uriValue\" style=\"width:75%; font-size:{$this->fontSize};\" /></div>" .
					"<div style=\"padding-top:5px;\">Target :: <input type=\"text\" name=\"conFlakesLinkTarget[$i]\" value=\"$targetValue\" style=\"width:30%; font-size:{$this->fontSize};\" /></div>";
		}
		
		return $returnvalue;
	}
	
	function getInsertID() {
		
		// Liefert den letzten Autoincrement-Wert der Datenbank
		$this->db->query("SELECT LAST_INSERT_ID() AS insertID");
		
		if ($this->db->next_record()) {
			return $this->db->f('insertID');
		}
		
		return false;
	}
	
	/**
	 * Die Funktion prüft, ob bereits ein Eintrag für diese Seite vorliegt oder
	 * nicht. Gibt im Erfolgsfall (bei Vorhandensein) den Primärschlüssel
	 * zurück. Sonst false.
	 * @return mixed Primärschlüssel (integer) im Erfolgsfall. Sonst false.
	 */
	function cacheExists() {
		
		$this->db->query("" .
				"SELECT " .
				"	pk_cache " .
				"FROM {$this->tab['cache']} " .
				"WHERE " .
				"	classID = {$this->classIndex} " .
				"	AND idart = {$this->idart} " .
				"	AND idlang = {$this->idlang}");
				
		if ($this->db->next_record()) {
			return $this->db->f("pk_cache");
		}
		
		return false;
	}
	
	function getPath($root,$level = 0) {
		$content = $this->readDir($root);

		// debugging
		$this->deBug($content, 'getPath-Content aus readDir');

		$returnvalue = array();

		if ($content) foreach ($content as $file) {
			if (is_dir($root.$file)) {
				$verzeichnis = substr($root,$this->pathlen);
				$returnvalue["{$verzeichnis}{$file}/"] = str_repeat("&nbsp;",$level * 5).$file;
				$returnvalue = array_merge($returnvalue,$this->getPath($root.$file."/",$level+1));
			} else {
				$verzeichnis = substr($root,$this->pathlen);
				$returnvalue["{$verzeichnis}{$file}"] = str_repeat("&nbsp;",$level * 5).'-'.$file;
				$returnvalue = array_merge($returnvalue,$this->getPath($root.$file,$level+1));				
			}
		}
		
		// debugging
		$this->deBug($returnvalue, 'getPath-Returnvalue');

		return $returnvalue;
	}

	function readDir($path) {
		if (!is_dir($path)) return false;

		$handle = opendir($path);

		while ($file = readdir ($handle)) {
			if ($file != "." && $file != "..") $returnvalue[] = $file;
		}
		closedir($handle);

		return $returnvalue;
	}

	function makeSelect($preselection) {
		$pfad = $this->getPath($this->pfad);

		$returnvalue = "<option value=\"\">Bitte wählen...</option>";
		foreach ($pfad as $key => $value) {
			if ($preselection == $key) {
				$returnvalue .= "<option value=\"$key\" selected=\"selected\">$value</option>";
			} else {
				$returnvalue .= "<option value=\"$key\">$value</option>";
			}
		}
		
		return $returnvalue;
	}
	
	/**
	 * Gibt Selects spezifisch für Bilder zurück.
	 * @param string preselection Vorauswahl
	 * @return string HTML-Entsprechung für ein Select-Feld
	 */
	function makeImageSelect($preselection) {
		$pfad = $this->getPath($this->pfad);

		$returnvalue = "<option value=\"\">Bitte wählen...</option>";
		foreach ($pfad as $key => $value) {
			
			// Pfadinformationen (u.a. die Extension) ermitteln
			$pathInfo = pathinfo($key);
			
			$this->deBug($pathInfo, 'pathInfo');
			
			// Wenn es sich um einen Bildpfad handelt, ausgeben
			if (
				$pathInfo['extension'] == 'jpg' ||
				$pathInfo['extension'] == 'jpeg' ||
				$pathInfo['extension'] == 'gif' ||
				$pathInfo['extension'] == 'png' ||
				empty($pathInfo['extension'])
				) {
			
				if ($preselection == $key) {
					$returnvalue .= "<option value=\"$key\" selected=\"selected\">$value</option>";
				} else {
					$returnvalue .= "<option value=\"$key\">$value</option>";
				}
				
			}
		}
		
		return $returnvalue;
	}
	
	function resizeImage($bildpfad,$maxWidth,$maxHeight) {
		
		// Pfaddetails ermitteln
		$pathinfo = pathinfo($bildpfad);
		$dirname = $pathinfo['dirname'];
		$basename = basename($bildpfad,$pathinfo['extension']);
		$extension = strtolower($pathinfo['extension']);
		
		// Bilddimension ermitteln
		$imageSize = $this->getImageSize($bildpfad,$maxWidth,$maxHeight&#4
aitsu.org :: schnell - flexibel - komfortabel :: Version 2.2.0 (since June 22, 2011) (jetzt mit dual license GPL/kommerziell)

kummer
Beiträge: 2423
Registriert: Do 6. Mai 2004, 09:17
Wohnort: Bern, Schweiz
Kontaktdaten:

Beitrag von kummer » Mi 6. Apr 2005, 13:42

der code schein zu gross zu sein. ich poste ihn auf meiner site und gebe dann hier den entsprechenden link bekannt.

bis später!

gruss,
andreas
aitsu.org :: schnell - flexibel - komfortabel :: Version 2.2.0 (since June 22, 2011) (jetzt mit dual license GPL/kommerziell)

kummer
Beiträge: 2423
Registriert: Do 6. Mai 2004, 09:17
Wohnort: Bern, Schweiz
Kontaktdaten:

Beitrag von kummer » Mi 6. Apr 2005, 13:50

upload ist erfolgt. die neuste version kann hier bezogen werden:

http://w3concepts.net/1/1/69.html

gruss,
andreas
aitsu.org :: schnell - flexibel - komfortabel :: Version 2.2.0 (since June 22, 2011) (jetzt mit dual license GPL/kommerziell)

CyberDan
Beiträge: 204
Registriert: Mo 15. Dez 2003, 13:01
Wohnort: Saarland
Kontaktdaten:

Beitrag von CyberDan » Mi 6. Apr 2005, 14:01

bei mir gehts trotz neuer Version immer noch nicht. Wie gehabt, gehts im Editor, aber bei der Vorschau oder im Frontend kriege ich ne weisse Seite mit dieser Meldung:
Warning: Unterminated comment starting line 1801 in /kunden/.../front_content.php(563) : eval()'d code on line 1801

Parse error: parse error, unexpected $, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /kunden/.../front_content.php(563) : eval()'d code on line 1801
Wenn ich das Hauptnavigationsmodul aus dem Template entferne, klappts wieder. Aber eine Seite ohne Navi bringt nicht wirklich viel 8)

acquire
Beiträge: 194
Registriert: So 13. Jun 2004, 13:24
Kontaktdaten:

Beitrag von acquire » Mi 6. Apr 2005, 16:33

Und was ist mit Version 1.6? :D
Ich bleibe erstmal bei meiner Version, denn ich habe HTML Code drin...
Wäre schlecht, wenn es nach einem Edit weg wäre...

kummer
Beiträge: 2423
Registriert: Do 6. Mai 2004, 09:17
Wohnort: Bern, Schweiz
Kontaktdaten:

Beitrag von kummer » Mi 6. Apr 2005, 16:36

die 1.6 ist wie mahlers 9. synfonie... :lol:
aitsu.org :: schnell - flexibel - komfortabel :: Version 2.2.0 (since June 22, 2011) (jetzt mit dual license GPL/kommerziell)

CyberDan
Beiträge: 204
Registriert: Mo 15. Dez 2003, 13:01
Wohnort: Saarland
Kontaktdaten:

Beitrag von CyberDan » Mi 6. Apr 2005, 16:58

ich habe jetzt mit der neuen und den alten Versionen zahlreiche Test gemacht: auch wenn ich eine leere html-seite mit nur einem Container als Layout anlege, kriege ich das Modul nicht zum laufen. Irgendwo scheint da noch ein Bug zu sein. Evtl. hat auch Domainfactory irgendwelche Einschränkungen bei PHP, von denen ich bisher nichts wusste.


Edit: Seit ich jetzt ein wenig probiert habe, kriege ich keine Fehlermeldung mehr, das Modul wird aber gar nicht erst angezeigt. Im Errorlog landet auch nichts.
Ich habe jetzt auf einem zweiten Server (der allerdings auch bei Domainfactory gehostet wird) das Modul getestet. Hier siehts genauso aus. Es scheint also wirklich an irgendwelchen Einschränkungen seitens des Servers zu liegen :-(

kummer
Beiträge: 2423
Registriert: Do 6. Mai 2004, 09:17
Wohnort: Bern, Schweiz
Kontaktdaten:

Beitrag von kummer » Mi 6. Apr 2005, 17:00

aber ohne hauptnavi funktioniert es, oder? und im editierbereich auch mit hauptnavi, richtig?
aitsu.org :: schnell - flexibel - komfortabel :: Version 2.2.0 (since June 22, 2011) (jetzt mit dual license GPL/kommerziell)

Gesperrt