fetten Text, [i]Text[/i] für kursiven Text
Links einfügen: [link]http://www.domain.de/[/link] oder [link=http://www.domain.de/]Linkname[/link]"; $error_no_name = "es wurde kein Name eingegeben"; $error_no_text = "es wurde kein Text eingegeben"; $error_email_wrong = "die E-Mail-Adresse sieht nicht richtig aus"; $error_text_too_long = "Der Text ist zu lang ([characters] Zeichen) - Es können nur [max_characters] eingegeben werden"; $error_text_too_short = "Der Text ist zu kurz"; $error_word_too_long = "Das Wort \"[word]\" ist zu lang"; $error_already_made_entry = "Mit dieser IP wurde in den letzten 5 Minuten bereits ein Eintrag gemacht, bitte später nochmal versuchen"; // viewcode - Ergaenzung $error_viewcode_not_correct = "Bitten tragen Sie die Zahlen und Buchstaben auf dem Bild beim Sicherheitscode richtig ein."; // viewcode - Ergaenzung $delete_entry_marking = "Eintrag löschen:"; $no_authorisation_marking = "Keine Berechtigung!"; $log_in_marking = "log in"; $edit_button = "editieren"; $delete_button = "löschen"; $delete_conf_button = "OK - Löschen"; $previous_page = "vorige Seite"; $next_page = "nächste Seite"; $still_no_entries_marking = "Es sind noch keine Einträge vorhanden."; $mail_subject = "Neuer Eintrag im Gästebuch"; $hp_link_marking = "Homepage"; $email_link_marking = "E-Mail"; $months_translated = array("Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"); ?>set_root($pathToTemplates); } // ************************************************************ function getKeyType($key) { preg_match_all("/(.+?):(.+?)/i",$key,$searchresult,PREG_SET_ORDER); if ($searchresult[0][1] != "") return $searchresult[0][1]; return false; } // ************************************************************ function getKeyValue($key) { preg_match_all("/(.+?):(.*)/i",$key,$searchresult,PREG_SET_ORDER); if ($searchresult[0][2] != "") return $searchresult[0][2]; return false; } // ************************************************************ function excistPhpTagType($type, $error = false) { if ($error) return $type; switch ($type) { case "var": return $type; break; case "iterate" : return $type; break; case "!": return $type; break; case "equal": return $type; break; case "notEqual": return $type; break; case "lessThan": return $type; break; case "lessEqual": return $type; break; case "greaterThan": return $type; break; case "greaterEqual": return $type; break; case "include": return $type; break; default: return false; break; } } // ************************************************************ function getTagAttributes($phptag, $error = false) { switch ($phptag) { case "var": return array("name", "width"); break; case "iterate": return array("value"); break; case "equal": return array("compvalleft", "compvalright"); break; case "notEqual": return array("compvalleft", "compvalright"); break; case "lessThan": return array("compvalleft", "compvalright"); break; case "lessEqual": return array("compvalleft", "compvalright"); break; case "greaterThan": return array("compvalleft", "compvalright"); break; case "greaterEqual": return array("compvalleft", "compvalright"); break; case "include": return array("href"); break; default: return false; break; } } // ************************************************************ /** Description @functionname getPhpTagType * @author Black-Horse * @creationtime * @lastchange * @lastchangeby * @reason * * @description Gibt den Type des gibt es ein problem | Problem beseitigt preg_match_all("/excistPhpTagType($searchresult[0][1], $error); return false; } // ************************************************************ function set_root ($root) { $trailer = substr($root,-1); if(!$this->WIN32) { if( (ord($trailer)) != 47 ) $root = "$root". chr(47); if(is_dir($root)) $this->ROOT = $root; else { $this->ROOT = ""; $this->error("Specified ROOT dir [$root] is not a directory"); } } else { if( (ord($trailer)) != 92 ) $root = "$root" . chr(92); $this->ROOT = $root; } } // ************************************************************** function get_template ($template) { if(empty($this->ROOT)) { $this->error("Cannot open template. Root not valid.",1); return false; } $filename = "$this->ROOT"."$template"; $contents = implode("",(@file($filename))); if( (!$contents) or (empty($contents)) ) $this->error("get_template() failure: [$filename] $php_errormsg",1); return $contents; } // ************************************************************ /** Description @functionname attributeValueToKeyValue * @author Black-Horse * @creationtime * @lastchange * @lastchangeby * @reason * * @description Wenn das attributevalue der Name eines Keys sein sollte, dann wird der Wert des Keys zurückgegeben, ist der Keywert ein Array, wird die Größe des Arrays zurückgegeben, wenn $arraycount true ist * * @param String|Array $value der zu überprüfende Attributewert * @param $tpl_array die Liste mit den keynamen und keywerten * @param boolean $arraycount gibt an ob die Anzahl der Arrayelemente von $value zurückgegeben werden soll (optional, default : false) * * @return String $tempstring Wert des Key, Anzahle der Arrayelemente oder "ERROR" */ function attributeValueToKeyValue($value, $tpl_array, $parsecount = -1, $arraycount = false, $ignoreerror = false) { $tempString = false; if ($ignoreerror) $tempString = $value; $tempvalue = ''; while ( list ($key,$val) = each ($tpl_array) ) { if (!(empty($key))) { if (strpos($value,".") == false) $attributemain = $value; else $attributemain = substr($value, 0, strpos($value,".")); if ($this->getKeyValue($key) == $attributemain) $tempvalue = $this->getArrayAttributeValue($value, $val, $parsecount); if ($this->getKeyValue($key) == $attributemain && $this->getKeyType($key) == "var") $tempString = $tempvalue; if ($arraycount && gettype($val) == "array") $tempString = count($tempvalue); } } return $tempString; } // ************************************************************ /** Description @functionname getAttributeValues * @author Black-Horse * @creationtime * @lastchange * @lastchangeby * @reason * * @description Gibt den Inhalt der Attribute zurück, die in den Tags der Template angegeben wurden * * @param String $tempstring Der Tagstring aus dem die Attribute gelesen werden sollen * @param String $attributes Die Liste der Attribute, die in $tempstring vorkommen dürfen * * @return Array $attributevalue die Liste mit den Attributen */ function getAttributeValues($tempstring, $attributes) { preg_match_all("/([a-z0-9A-Z]{1,})=([a-z0-9A-Z\"'.]{1,})/i",$tempstring,$searchresult,PREG_SET_ORDER); for ($i = 0 ; $i < count($searchresult) ; $i++) { $attributeexcist = false; for ($k = 0 ; $k < count($attributes) ; $k++) { if ($searchresult[$i][1] == $attributes[$k]) { //nachfolgende Lösung ist nicht schön aber selten $searchresult[$i][2] = str_replace("\"", "", $searchresult[$i][2]); $searchresult[$i][2] = str_replace("'", "", $searchresult[$i][2]); $attributevalue[$attributes[$i]] = $searchresult[$i][2]; $attributeexcist = true; } } if (!$attributeexcist) { if ($this->DEBUG) $this->error($searchresult[$i][1]." ist kein gültiges Attribut"); } } return $attributevalue; } // ************************************************************ function setNewRow($tempstring) { preg_match_all("/(.*)(\n)(.*)/i",$tempstring,$rownumber,PREG_SET_ORDER); //gibt immer die absolute zeilennummer zurück //echo count($rownumber); //$this->$rownumber = $this->$rownumber + count($rownumber); //echo "row : ".$this->$rownumber; //echo "
"; } // ************************************************************ /** Description @functionname getArrayAttributeValue * @author Black-Horse * @creationtime 25.02.2005 | 18:26 * @lastchange 26.02.2005 | 08:59 * @lastchangeby Black-Horse * @reason auf einen Explode umgeschrieben * * @description Gibt den Inhalt einer beliebigen n-dimensionalen Variablen zurück * * @param String $attributevalue Der Wert des Attributes * @param String $value Der Wert der Variablen von dem Mainattribute * * @return String $tempstring Der Wert des Arrays */ function getArrayAttributeValue($attributevalue, $value, $parsecount = -1) { $temparray = explode(".", $attributevalue); $tempvalue = $value; for ($i = 1 ; $i < count($temparray) ; $i++) { if ($temparray[$i] == 'count' && $parsecount > -1) $tempvalue = $tempvalue[$parsecount]; elseif ($i == count($temparray)-1) $tempvalue = $tempvalue[$temparray[$i]]; else $tempvalue = $tempvalue[$temparray[$i]]; } // if ($parsecount > -1 && gettype($tempstring) == "array") // { // $tempstring = $tempstring[$parsecount]; // } return $tempvalue; } // ************************************************************ /** Description @functionname getEndTagPosition * @author Black-Horse * @creationtime 26.02.2005 | 13:00 * @lastchange 28.02.2005 | 21:00 * @lastchangeby Black-Horse * @reason Der counter funktioniert endlich! * * @description Gibt das richtige Ende des jeweils geöffneten Tags zurück * * @param String $attributevalue Der Wert des Attributes * @param String $value Der Wert der Variablen von dem Mainattribute * * @return String $end Die Position, an der der EndeTag beginnt */ function getEndTagPosition($phptagtype, $template, $opentagcount = 1, $tagbegin = 0, $new = true) { $tagopenbegin = 0; $tempbegin = 0; $tagtempclosebegin = 0; $tagcount = 0; $end = 0; //TODO endlosschleife bei equal .... //Warning: strpos() [function.strpos.html]: Offset not contained in string. in G:\Server\apache\htdocs\sprachfreizeit\imageupload\classes\class.blackware.template.php on line 424 //Warning: strpos() [function.strpos.html]: Offset not contained in string. in G:\Server\apache\htdocs\sprachfreizeit\imageupload\classes\class.blackware.template.php on line 424 //Warning: strpos() [function.strpos.html]: Offset not contained in string. in G:\Server\apache\htdocs\sprachfreizeit\imageupload\classes\class.blackware.template.php on line 425 if ((strpos($template, " strpos($template, "getEndTagPosition($phptagtype, $template, $opentagcount, $tempbegin+strpos($template, "getEndTagPosition($phptagtype, $template, $opentagcount+1, $tagbegin+strpos($template, "", $phpbegin) - $phpbegin) + 1); //auslesen des phptags $temptemplate = $template; if (substr($tempstring, strlen($tempstring)-2, 1) == "/") // geschlossener Tag Anfang { $this->setNewRow($tempstring); $phptagtype = $this->getPhpTagType($tempstring); if ($phptagtype != "false") { $attributes = $this->getTagAttributes($phptagtype); //Attributetags Problem : es muss noch in "" stehen | gelöst! $attributevalue = $this->getAttributeValues($tempstring, $attributes); //Attributetags ende $set = false; while ( list ($key,$val) = each ($tpl_array) ) { if (!(empty($key))) { switch ($this->getKeyType($key)) { case "var": if (strpos($attributevalue['name'],".") == false) $attributemain = $attributevalue['name']; else $attributemain = substr($attributevalue['name'], 0, strpos($attributevalue['name'],".")); if ($iterateuse && $attributemain == "iterate") { $tempiterate = substr($attributevalue['name'], strpos($attributevalue['name'],".")+1); switch ($tempiterate) { case "count": //$template = str_replace($tempstring, $parsecount+1, $template); $template = $this->str_replaceFirst($tempstring, $parsecount+1, $template); break; default: //$template = str_replace($tempstring, "", $template); $template = $this->str_replaceFirst($tempstring, "", $template); break; } $set = true; } //TODO auslagern in eine Switch und Dateinamen übergeben und global speichern, wichtig für die richtige Zeile im Richtigem Dokument!!! if ($phptagtype == "include") { $tempy = ""; $tempy = $this->parse_template ($this->get_template($this->attributeValueToKeyValue($attributevalue['href'], $tpl_array, -1, false, true)), $tpl_array); $template = $this->str_replaceFirst($tempstring, $tempy, $template); $set = true; } if ($this->getKeyValue($key) == $attributemain && $attributemain != "iterate" && $attributemain != "include") { if ($attributemain != $attributevalue['name']) { //$template = str_replace($tempstring, $this->getArrayAttributeValue($attributevalue['name'], $val, $parsecount), $template); $template = $this->str_replaceFirst($tempstring, $this->getArrayAttributeValue($attributevalue['name'], $val, $parsecount), $template); } else { if (gettype($val) == "array") { //$template = str_replace($tempstring, $this->getArrayAttributeValue($attributevalue['name'], $val, $parsecount), $template); $template = $this->str_replaceFirst($tempstring, $this->getArrayAttributeValue($attributevalue['name'], $val, $parsecount), $template); } else { //$template = str_replace($tempstring, $val, $template); $template = $this->str_replaceFirst($tempstring, $val, $template); } } $set = true; } break; default: //$template = str_replace($tempstring, "", $template); $template = $this->str_replaceFirst($tempstring, "", $template); if ($this->DEBUG) $this->error("$key wurde falsch gesetzt"); break; } } } if (!$set) { //$template = str_replace($tempstring, "", $template); $template = $this->str_replaceFirst($tempstring, "", $template); if ($this->DEBUG && $this->getPhpTagType($tempstring) != "!") $this->error($attributevalue['name']." existiert nicht!"); } } else { //$template = str_replace($tempstring, "", $template); $template = $this->str_replaceFirst($tempstring, "", $template); if ($this->DEBUG && $this->getPhpTagType($tempstring) != "!") $this->error("der Befehl php:".$this->getPhpTagType($tempstring,true)." existiert nicht"); } } // geschlossener Tag Ende else // offener Tag Anfang { $phptagtype = $this->getPhpTagType($tempstring); $begin = strpos($template, ">", $phpbegin)+1; $end = $this->getEndTagPosition($phptagtype, substr($template, $begin)); $includedstring = substr($template, $begin, $end); $attributes = $this->getTagAttributes($phptagtype); $attributevalue = $this->getAttributeValues($tempstring, $attributes); $repeat = 1; $includedtemp = ''; $iterateit = false; for ($i = 0 ; $i < count($attributes) ; $i++) { switch ($phptagtype) { case "iterate": $repeat = (!(is_numeric($attributevalue['value']))) ? $this->attributeValueToKeyValue($attributevalue['value'], $tpl_array, -1, true) : $attributevalue['value']; $iterateit = true; break; case "equal": $valueone = $this->attributeValueToKeyValue($attributevalue['compvalleft'], $tpl_array, $parsecount, false, true) ? $this->attributeValueToKeyValue($attributevalue['compvalleft'], $tpl_array, $parsecount, false, true) : $attributevalue['compvalleft']; $valuetwo = $this->attributeValueToKeyValue($attributevalue['compvalright'], $tpl_array, $parsecount, false, true) ? $this->attributeValueToKeyValue($attributevalue['compvalright'], $tpl_array, $parsecount, false, true) : $attributevalue['compvalright']; //echo "left : $valueone ".$this->attributeValueToKeyValue($attributevalue['compvalleft'], $tpl_array, $parsecount, false, true)." "; //echo "right : $valuetwo "; //echo "
"; if ($valueone != $valuetwo) { $includedtemp = ""; $repeat = 0; } break; case "notEqual": $valueone = $this->attributeValueToKeyValue($attributevalue['compvalleft'], $tpl_array, $parsecount, false, true) ? $this->attributeValueToKeyValue($attributevalue['compvalleft'], $tpl_array, $parsecount, false, true) : $attributevalue['compvalleft']; $valuetwo = $this->attributeValueToKeyValue($attributevalue['compvalright'], $tpl_array, $parsecount, false, true) ? $this->attributeValueToKeyValue($attributevalue['compvalright'], $tpl_array, $parsecount, false, true) : $attributevalue['compvalright']; //echo "left : $valueone ".$this->attributeValueToKeyValue($attributevalue['compvalleft'], $tpl_array, $parsecount, false, true)." "; //echo "right : $valuetwo "; //echo "
"; if ($valueone == $valuetwo) { $includedtemp = ""; $repeat = 0; } break; case "lessThan": $valueone = $this->attributeValueToKeyValue($attributevalue['compvalleft'], $tpl_array, $parsecount, false, true) ? $this->attributeValueToKeyValue($attributevalue['compvalleft'], $tpl_array, $parsecount, false, true) : $attributevalue['compvalleft']; $valuetwo = $this->attributeValueToKeyValue($attributevalue['compvalright'], $tpl_array, $parsecount, false, true) ? $this->attributeValueToKeyValue($attributevalue['compvalright'], $tpl_array, $parsecount, false, true) : $attributevalue['compvalright']; //echo "left : $valueone ".$this->attributeValueToKeyValue($attributevalue['compvalleft'], $tpl_array, $parsecount, false, true)." "; //echo "right : $valuetwo "; //echo "
"; if ($valueone >= $valuetwo) { $includedtemp = ""; $repeat = 0; } break; case "lessEqual": $valueone = $this->attributeValueToKeyValue($attributevalue['compvalleft'], $tpl_array, $parsecount, false, true) ? $this->attributeValueToKeyValue($attributevalue['compvalleft'], $tpl_array, $parsecount, false, true) : $attributevalue['compvalleft']; $valuetwo = $this->attributeValueToKeyValue($attributevalue['compvalright'], $tpl_array, $parsecount, false, true) ? $this->attributeValueToKeyValue($attributevalue['compvalright'], $tpl_array, $parsecount, false, true) : $attributevalue['compvalright']; //echo "left : $valueone ".$this->attributeValueToKeyValue($attributevalue['compvalleft'], $tpl_array, $parsecount, false, true)." "; //echo "right : $valuetwo "; //echo "
"; if ($valueone > $valuetwo) { $includedtemp = ""; $repeat = 0; } break; case "greaterThan": $valueone = $this->attributeValueToKeyValue($attributevalue['compvalleft'], $tpl_array, $parsecount, false, true) ? $this->attributeValueToKeyValue($attributevalue['compvalleft'], $tpl_array, $parsecount, false, true) : $attributevalue['compvalleft']; $valuetwo = $this->attributeValueToKeyValue($attributevalue['compvalright'], $tpl_array, $parsecount, false, true) ? $this->attributeValueToKeyValue($attributevalue['compvalright'], $tpl_array, $parsecount, false, true) : $attributevalue['compvalright']; //echo "left : $valueone ".$this->attributeValueToKeyValue($attributevalue['compvalleft'], $tpl_array, $parsecount, false, true)." "; //echo "right : $valuetwo "; //echo "
"; if ($valueone <= $valuetwo) { $includedtemp = ""; $repeat = 0; } break; case "greaterEqual": $valueone = $this->attributeValueToKeyValue($attributevalue['compvalleft'], $tpl_array, $parsecount, false, true) ? $this->attributeValueToKeyValue($attributevalue['compvalleft'], $tpl_array, $parsecount, false, true) : $attributevalue['compvalleft']; $valuetwo = $this->attributeValueToKeyValue($attributevalue['compvalright'], $tpl_array, $parsecount, false, true) ? $this->attributeValueToKeyValue($attributevalue['compvalright'], $tpl_array, $parsecount, false, true) : $attributevalue['compvalright']; //echo "left : $valueone ".$this->attributeValueToKeyValue($attributevalue['compvalleft'], $tpl_array, $parsecount, false, true)." "; //echo "right : $valuetwo "; //echo "
"; if ($valueone < $valuetwo) { $includedtemp = ""; $repeat = 0; } break; default: break; } } for ($i = 0 ; $i < $repeat ; $i++) { $inctemplate = $includedstring; while (strpos($inctemplate, "parse_phptag($inctemplate, strpos($inctemplate, "parse_phptag($inctemplate, strpos($inctemplate, "", $includedtemp, $template); $template = $this->str_replaceFirst($tempstring.$includedstring."", $includedtemp, $template); } $this->setNewRow(substr($temptemplate, $phpbegin, (strpos($temptemplate, "$rownumber = 0; $i = 1; while (strpos($template, "$rownumber = count($rownumber)+1; $i=2; } $template = $this->parse_phptag($template, strpos($template, "LAST = $ReturnVar; $this->HANDLE[$ReturnVar] = 1; if (gettype($FileTags) == "array") { unset($this->$ReturnVar); // Clear any previous data while ( list ( $key , $val ) = each ( $FileTags ) ) { if ( (!isset($this->$val)) || (empty($this->$val)) ) { $this->LOADED["$val"] = 1; if(isset($this->DYNAMIC["$val"])) $this->parse_dynamic($val,$ReturnVar); else { $fileName = $this->FILELIST["$val"]; $this->$val = $this->get_template($fileName); } } $this->$ReturnVar = $this->parse_template($this->$val,$this->PARSEVARS); $this->assign( array( $ReturnVar => $this->$ReturnVar ) ); } } else { $val = $FileTags; if( (substr($val,0,1)) == '.' ) { $append = true; $val = substr($val,1); } if ( (!isset($this->$val)) || (empty($this->$val)) ) { $this->LOADED["$val"] = 1; if(isset($this->DYNAMIC["$val"])) $this->parse_dynamic($val,$ReturnVar); else { $fileName = $this->FILELIST["$val"]; $this->$val = $this->get_template($fileName); } } if($append) $this->$ReturnVar .= $this->parse_template($this->$val,$this->PARSEVARS); else $this->$ReturnVar = $this->parse_template($this->$val,$this->PARSEVARS); $this->assign(array( $ReturnVar => $this->$ReturnVar) ); } return; } // ************************************************************ function FastPrint ( $template = "" ) { if(empty($template)) $template = $this->LAST; if( (!(isset($this->$template))) || (empty($this->$template)) ) { $this->error("Nothing parsed, nothing printed",0); return; } else { echo $this->$template; } return; } // ************************************************************ function FastOutput ( $template = "" ) { if(empty($template)) $template = $this->LAST; if( (!(isset($this->$template))) || (empty($this->$template)) ) { $this->error("Nothing parsed, nothing printed",0); return; } else { return $this->$template; } return; } // ************************************************************ function assign ($tpl_array, $trailer="") { if(gettype($tpl_array) == "array") { while ( list ($key,$val) = each ($tpl_array) ) { if (!(empty($key))) $this->PARSEVARS["$key"] = $val; } } else { if (!empty($tpl_array)) $this->PARSEVARS["$tpl_array"] = $trailer; } } // ************************************************************ function get_assigned($tpl_name = "") { if(empty($tpl_name)) { return false; } if(isset($this->PARSEVARS["$tpl_name"])) { return ($this->PARSEVARS["$tpl_name"]); } else { return false; } } // ************************************************************ function error ($errorMsg, $die = 0) { $this->ERROR = $errorMsg; //echo "ERROR in Zeile ".$this->$rownumber." in ".$this->FILELIST["template"]." : $this->ERROR
\n"; if ($die == 1) { exit; } return; } // ************************************************************ function define ($fileList) { while ( list ($FileTag,$FileName) = each ($fileList) ) { $this->FILELIST["$FileTag"] = $FileName; } return true; } // ************************************************************ function setDebug($debugBool) { $this->DEBUG = $debugBool; } // ************************************************************ /** Description @functionname str_replaceFirst * @author Black-Horse * @creationtime 01.03.2005 | 20:00 * @lastchange * @lastchangeby * @reason * * @description Ersetzt nur den ersten gefunden String. * * @param String $search Der gesuchte String * @param String $replace Der String mit dem ersetzt wird * @param String $string String in dem das ersetzen durchgeführt werden soll * * @return String $string Der neue String */ function str_replaceFirst($search, $replace, $string) { $pos = strpos($string, $search); if (is_int($pos)) { $len = strlen($search); return substr_replace($string, $replace, $pos, $len); } return $string; } } ?>