'.$txt.''.$txt.''.((!is_null($anchor))?'':'').''; if (!is_null($anchor)) { $text .= ''; } return $text; } else { return false; } } function headline($txt,$fs=20,$c='#008e83',$bgc="",$font=1,$p='images/headlines/') { if(empty($p)) { $p = 'images/headlines/'; } if (!empty($txt)) { if (empty($c)) $c='#008e83'; if ($font==1) $font ="UNIVERSLT-BOLD.TTF"; elseif ($font==2) $font = "UNIVERSLT-BLACK.TTF"; else $font = "GARAMONDITCBYBT-BOOKCONDITALIC.TTF"; $file = $p.md5($txt.$fs.$c.$bgc.$font).'.png'; $size = @getimagesize($file); if (!$size) { exec(BASE_IM."convert -background '".(($bgc=="")?'none':$bgc)."' -fill '".$c."' -font '".BASE.$font."' -pointsize ".$fs." label:'".str_replace(array("'"),array("´"),stripslashes($txt))."' ".BASE.$file); @chmod(BASE.$file,0755); $size = @getimagesize($file); } $txt = htmlspecialchars($txt,ENT_COMPAT,'UTF-8'); $text = array(); $text['img'] = ''.$txt.''; $text['file'] = $GLOBALS['rel_pfad'].$file; $text['width'] = $size[0]; $text['height'] = $size[1]; return $text; } else { return false; } } //Bild neu rendern function resize_img($imgID, $x=90, $y=90, $p='images/misc/',$extend=false) { if (!is_numeric($imgID)) return false; $imgErg = $GLOBALS['mt_db']->mt_sql("SELECT bild_ftp_pfad, bild_pfad, bild_server, bild_size_kb, ".$GLOBALS['bild_sprache']." FROM ".$GLOBALS['s_db2']." WHERE id=".$imgID." LIMIT 1"); if ($GLOBALS['mt_db']->mt_sql_row($imgErg)!=0) { $imgRow = $GLOBALS['mt_db']->mt_sql_erg($imgErg); $source = $imgRow['bild_pfad'].'/'.$imgRow['bild_server']; $size = @getimagesize($source); $file = md5($imgRow['bild_server'].$imgID.$x.$y.$imgRow['bild_size_kb']).'.jpg'; $dest = BASE.$p.$file; $tn_size = @getimagesize($dest); if (!$tn_size) { if ($size) { $aspect_ratio = $size[0]/$size[1]; if (!empty($x) && !empty($y)) { if ($extend) $convert_image = BASE_IM."convert ".$imgRow["bild_ftp_pfad"]."/".$imgRow['bild_server']." -resize ".(round($x*0.9))."x".(round($y*0.9))." -background white -gravity center -extent ".$x."x".$y." ".$dest; else $convert_image = BASE_IM."convert ".$imgRow["bild_ftp_pfad"]."/".$imgRow['bild_server']." -resize ".$x."x".$y."^ -background white -gravity center -extent ".$x."x".$y." ".$dest; } elseif (empty($y)) { $convert_image = BASE_IM."convert ".$imgRow["bild_ftp_pfad"]."/".$imgRow['bild_server']." -resize ".$x." ".$dest; $y = round((1/$aspect_ratio)*$x); } elseif (empty($x)) { $convert_image = BASE_IM."convert ".$imgRow["bild_ftp_pfad"]."/".$imgRow['bild_server']." -resize x".$y." ".$dest; $x = round($y*$aspect_ratio); } exec($convert_image); @chmod($dest,0755); return array($file, $x, $y, 'width: '.$tn_size[0].'px; height: '.$tn_size[1].'px;', $source, stripslashes($imgRow[$GLOBALS['bild_sprache']])); } else { return false; } } elseif ($tn_size) { return array($file, $tn_size[0], $tn_size[1], 'width: '.$tn_size[0].'px; height: '.$tn_size[1].'px;', $source, stripslashes($imgRow[$GLOBALS['bild_sprache']])); } else { return false; } } else { return false; } } function content_bild($bilder,$imgsize=0,$makethumb=false) { if (!is_array($bilder)) $bilder=array_unique(array_diff(array_map('trim',explode(',',$bilder)),array(0,''))); $buffer=array(); if(count($bilder)!=0) { foreach($bilder as $bild) { $bErg=$GLOBALS['mt_db']->mt_sql("SELECT bild_pfad, ".$GLOBALS['bild_sprache'].", bild_server FROM ".$GLOBALS['s_db2']." WHERE id=".$bild); if ($GLOBALS['mt_db']->mt_sql_row($bErg)!=0) { $bRow = array_map('stripslashes', $GLOBALS['mt_db']->mt_sql_erg($bErg)); $bRow[$GLOBALS['bild_sprache']] = trim($bRow[$GLOBALS['bild_sprache']]); $bild_big = $bRow['bild_pfad'].'/'.$bRow['bild_server']; $size = @getimagesize($bild_big); $size[3] = 'width: '.(round($size[0]/12,2)).'em; height: '.(round($size[1]/12,2)).'em;'; if ($imgsize!=0) { $height = $imgsize*$size[1]/$size[0]; $thumb = resize_img($bild, $imgsize, $height); $bild_thumb = 'images/misc/'.$thumb[0]; } elseif (!is_bool($makethumb) || $makethumb!=false) { $thumb = resize_img($bild, $makethumb[0], $makethumb[1],'images/misc/',((isset($makethumb[2]))?true:false)); $bild_thumb = 'images/misc/'.$thumb[0]; } else { $bild_thumb = $bRow['bild_pfad'].'/TN_'.$bRow['bild_server']; } $size_tn = @getimagesize($bild_thumb); $size_tn[3] = 'width: '.$size_tn[0].'px; height: '.$size_tn[1].'px;'; if ($size) { $buffer[$bild] = array('img'=>$bild_big, 'width'=>$size[0], 'height'=>$size[1], 'type'=>$size[2], 'size'=>$size[3], 'titel'=>$bRow[$GLOBALS['bild_sprache']], 'tn_img'=>$bild_thumb, 'tn_width'=>$size_tn[0], 'tn_height'=>$size_tn[1], 'tn_size'=>$size_tn[3]); } } } } return $buffer; } /* //Bild neu rendern function resize_img($imgID, $x=90, $y=90, $p='images/misc/') { if (!is_numeric($imgID)) return false; $imgErg = $GLOBALS['mt_db']->mt_sql("SELECT bild_ftp_pfad, bild_pfad, bild_server, bild_size_kb, ".$GLOBALS['bild_sprache']." FROM ".$GLOBALS['s_db2']." WHERE id=".$imgID." LIMIT 1"); if ($GLOBALS['mt_db']->mt_sql_row($imgErg)!=0) { $imgRow = $GLOBALS['mt_db']->mt_sql_erg($imgErg); $source = $imgRow['bild_pfad'].'/'.$imgRow['bild_server']; $size = @getimagesize($source); $file = md5($imgRow['bild_server'].$imgID.$x.$y.$imgRow['bild_size_kb']).'.jpg'; $dest = BASE.$p.$file; $tn_size = @getimagesize($dest); if (!$tn_size) { if ($size) { $aspect_ratio = $size[0]/$size[1]; if (!empty($x) && !empty($y)) { $convert_image = BASE_IM."convert ".$imgRow["bild_ftp_pfad"]."/".$imgRow['bild_server']." -resize ".$x."x".$y."^ -gravity center -extent ".$x."x".$y." ".$dest; } elseif (empty($y)) { $convert_image = BASE_IM."convert ".$imgRow["bild_ftp_pfad"]."/".$imgRow['bild_server']." -resize ".$x." ".$dest; $y = round((1/$aspect_ratio)*$x); } elseif (empty($x)) { $convert_image = BASE_IM."convert ".$imgRow["bild_ftp_pfad"]."/".$imgRow['bild_server']." -resize x".$y." ".$dest; $x = round($y*$aspect_ratio); } exec($convert_image); @chmod($dest,0755); return array($file, $x, $y, 'width: '.(round($tn_size[0]/12,2)).'em; height: '.(round($tn_size[1]/12,2)).'em;', $source, stripslashes($imgRow[$GLOBALS['bild_sprache']])); } else { return false; } } elseif ($tn_size) { return array($file, $tn_size[0], $tn_size[1], 'width: '.(round($tn_size[0]/12,2)).'em; height: '.(round($tn_size[1]/12,2)).'em;', $source, stripslashes($imgRow[$GLOBALS['bild_sprache']])); } else { return false; } } else { return false; } } function content_bild($bilder,$imgsize=0) { if (!is_array($bilder)) $bilder=array_unique(array_diff(array_map('trim',explode(',',$bilder)),array(0,''))); $buffer=array(); if(count($bilder)!=0) { foreach($bilder as $bild) { $bErg=$GLOBALS['mt_db']->mt_sql("SELECT bild_pfad, ".$GLOBALS['bild_sprache'].", bild_server FROM ".$GLOBALS['s_db2']." WHERE id=".$bild); if ($GLOBALS['mt_db']->mt_sql_row($bErg)!=0) { $bRow = array_map('stripslashes', $GLOBALS['mt_db']->mt_sql_erg($bErg)); $bRow[$GLOBALS['bild_sprache']] = trim($bRow[$GLOBALS['bild_sprache']]); $bild_big = $bRow['bild_pfad'].'/'.$bRow['bild_server']; $size = @getimagesize($bild_big); $size[3] = 'width: '.$size[0].'px; height: '.$size[1].'px;'; if ($imgsize!=0) { $height = $imgsize*$size[1]/$size[0]; $thumb = resize_img($bild, $imgsize, $height); $bild_thumb = 'images/misc/'.$thumb[0]; } else { $bild_thumb = $bRow['bild_pfad'].'/TN_'.$bRow['bild_server']; } $size_tn = @getimagesize($bild_thumb); $size_tn[3] = 'width: '.$size_tn[0].'px; height: '.$size_tn[1].'px;'; if ($size) { $buffer[$bild] = array('img'=>$bild_big, 'width'=>$size[0], 'height'=>$size[1], 'type'=>$size[2], 'size'=>$size[3], 'titel'=>$bRow[$GLOBALS['bild_sprache']], 'tn_img'=>$bild_thumb, 'tn_width'=>$size_tn[0], 'tn_height'=>$size_tn[1], 'tn_size'=>$size_tn[3]); } } } } return $buffer; } */ function content_data($dateien) { if (!is_array($dateien)) $dateien=array_unique(array_diff(array_map('trim',explode(',',$dateien)),array(0,''))); $spr=$_REQUEST['content_sprache']; $buffer=array(); if(count($dateien)!=0) { foreach($dateien as $datei) { $dErg=$GLOBALS['mt_db']->mt_sql("SELECT name, datei_type, datei_pfad, datei_ftp_pfad, datei_size_kb, datei_size_mb, datei_server, bild, datei_titel_".$spr." FROM ".$GLOBALS['s_db3']." WHERE id=".$datei); if ($GLOBALS['mt_db']->mt_sql_row($dErg)!=0) { $dRow = array_map('stripslashes', $GLOBALS['mt_db']->mt_sql_erg($dErg)); $datei_url = $dRow['datei_pfad']."/".$dRow['datei_server']; //Dateigroesse if($dRow['datei_size_kb'] > 500) { $datei_size = str_replace(".",",",sprintf("%01.2f", $dRow['datei_size_mb']))." MB"; } else { $datei_size = str_replace(".",",",sprintf("%01.2f", $dRow['datei_size_kb']))." KB"; } //Dateibild $dateiIMG = array('url'=>$GLOBALS['images_path'].'icon/default.gif', 'width'=>36, 'height'=>36); if (!empty($dRow['bild'])) { $bErg = $GLOBALS['mt_db']->mt_sql("SELECT bild_server, bild_pfad FROM ".$GLOBALS['s_db2']." WHERE id=".$dRow['bild']); if ($GLOBALS['mt_db']->mt_sql_row($bErg)!=0) { $bRow = $GLOBALS['mt_db']->mt_sql_erg($bErg); $bild = $bRow['bild_pfad']."/TN_".$bRow['bild_server']; $size = @getimagesize($bild); if ($size) { $dateiIMG = array('url'=>$bild, 'width'=>$size[0], 'height'=>$size[1]); } } } else { $availableIcons = scandir(BASE.'images/icon'); $b = pathinfo($dRow['datei_server']); $datei_type_endung = ((isset($b['extension']))?strtolower($b['extension']):''); if ($datei_type_endung!='' && in_array($datei_type_endung.'.jpg', $availableIcons)) { $dateiIMG = array('url'=>$GLOBALS['images_path'].'icon/'.$datei_type_endung.'.jpg', 'width'=>36, 'height'=>36); } } $datei_titel=!empty($dRow['datei_titel_'.$spr])?$dRow['datei_titel_'.$spr]:''; //Daten zusammenfuegen if (@file_exists($dRow['datei_ftp_pfad'].'/'.$dRow['datei_server'])) { $buffer[$datei] = array('id'=>$datei, 'titel'=>$dRow['name'], 'datei_titel'=>$datei_titel, 'type'=>$dRow['datei_type'], 'extension'=>$datei_type_endung, 'url'=>$datei_url, 'size'=>$datei_size, 'image'=>$dateiIMG); } } } } return $buffer; } function getThumb($vid_id) { $xml = new DOMDocument(); $xml->load(sprintf(YoutubeApiUrl."%s?v=2",$vid_id)); if(!$xml) { return false; } else { $nodes = $xml->getElementsByTagName("group")->item(0)->getElementsByTagName("thumbnail"); $title = $xml->getElementsByTagName("title")->item(0)->nodeValue; $l = $nodes->length; // this value will also change if ($l>0) { for ($i=0; $i<$l; $i++) { foreach ($nodes->item($i)->attributes as $attrName => $attrNode) { if ((string)$attrName=='name' && (string)$attrNode->value=='hqdefault') { $l=$i+1; break 2; } } } $img_attr = array(); foreach ($nodes->item($l-1)->attributes as $attrName => $attrNode) { $img_attr[(string)$attrName] = (string)$attrNode->value; } if (!empty($title)) $img_attr['title']=$title; return $img_attr; } else { return false; } } } function SetCookieLive($name, $value='', $expire = 0, $path = '/', $domain='.barnimerland.de', $secure=false) { $_COOKIE[$name] = $value; return setcookie($name, $value, $expire, $path, $domain, $secure); } function RemoveCookieLive($name, $path = '/', $domain='.barnimerland.de') { unset($_COOKIE[$name]); return setcookie($name, NULL, -1, $path, $domain); } function get_include_contents($filename) { if (is_file($filename)) { ob_start(); include $filename; $contents = ob_get_contents(); ob_end_clean(); return $contents; } return false; } function multi_array_key_exists($needle, $haystack) { foreach ($needle as $key) { if (array_key_exists($key,$haystack)) { return true; } } return false; } function navLink($arr,$urlParams=array(),$lvl=1) { if(!is_array($arr)) { return false; } $link=''; if($arr['darstellung']=='extern' && !empty($arr['url']) && $arr['url']!='http://') { $link = 'href="'.$arr['url'].'" target="_blank"'; } elseif($arr['anzeige']=='visible') { $link = 'href="#"'; } else { $link = 'href="'.$GLOBALS['router']->url(array_merge($urlParams,array('kat'.$lvl=>$arr['alias']))).'"'; } $link.= (isset($arr['accesskey']) && $arr['accesskey']!='')?' accesskey="'.$arr['accesskey'].'"':''; return $link; } function getLink($arr) { if(!is_array($arr)) return false; $target=(!empty($arr['to_menue_id']) && $arr['darstellung']=='redirect_intern')?$arr['to_menue_id']:$arr['id']; $self = $GLOBALS['menue']->findFirst(NULL, array('lft', 'rght'), array('sprache_id='=>$GLOBALS['sprachen_id'], 'id='=>$target), NULL, -1); if(empty($self)) return false; $target = $GLOBALS['menue']->find(NULL, array('alias'), array('lft <='=>$self['data']['lft'], 'rght >='=>$self['data']['rght'], 'sprache_id='=>$GLOBALS['sprachen_id']), 'lft ASC', NULL, 0, -1); if (!empty($target)) { $navLink=array(); for($t=1; $t~', $tpl, $img); //Bilder finden und ersetzen if (!empty($img[1])) { $img = $img[1]; foreach ($img as $hit) $tpl = str_replace($hit, basename($hit), $tpl); } } require_once(BASE."/visioncontent/class/ext_class/Rmail/Rmail.php"); $mail = new Rmail(); $mail->setSubject($subject); $mail->setFrom($from=='' ? $GLOBALS['nwvtool_email_versender'].' <'.constant('MAIL_SYSTEM').'>' : $from); if(count($cc)!=0 ) $mail->setCc(implode(", ",$cc)); if(count($bcc)!=0) $mail->setBcc(implode(", ",$bcc)); if(count($att)!=0) foreach($att as $a) $mail->addAttachment(new stringAttachment(@file_get_contents(BASE.$a['file']), $a['name'], $a['type'])); //Bilder anhaängen if (!empty($img)) { foreach ($img as $hit) { $size = @getimagesize($hit); if ($size) { $mail->addEmbeddedImage(new fileEmbeddedImage($hit, $size[2], new Base64Encoding())); } } } if ($_SERVER['REMOTE_ADDR']=="213.23.213.26") echo $tpl; $mail->setHTML($tpl); if(!is_array($to)) $to = array($to); return $mail->send($to); } //Funktion zur Zugangsberechtigung für interne Bereiche! function access_check($navID) { if (defined('AREA_'.$navID)) return true; if (!isset($_SESSION['user'][$navID])) return false; $user = $_SESSION['user'][$navID]['user']; $user_pass = $_SESSION['user'][$navID]['pass']; $password_erg = $GLOBALS['mt_db']->sql_save("SELECT id FROM ".$GLOBALS['s_db21']." WHERE passwort_name='%s' AND passwort='%s' AND status=1 AND area=".$navID." AND datum<=NOW() AND (archivdatum=0 OR archivdatum>NOW()) LIMIT 1", array($user,$user_pass)); if($GLOBALS['mt_db']->mt_sql_row($password_erg)!=0) { $pwRow = array_map('stripslashes',$GLOBALS['mt_db']->mt_sql_erg($password_erg)); define('AREA_'.$navID,$pwRow['id']); return true; } return false; } function access_log($code, $params=array()) { $txt=''; if ($code=='THX_0001') { $txt='Login erfolgreich'; } elseif ($code=='THX_0002') { $txt='Logout erfolgreich'; } elseif ($code=='ERR_0001') { $txt='Benutzername oder Passwort falsch'; } elseif ($code=='ERR_0002') { $txt='versuchter Login mit einem gesperrten Account'; } elseif ($code=='ERR_0003') { $txt='versuchter Login mit einem abgelaufenen Account'; } if ($txt!='') { $insert = array('info1'=>$code.' '.$txt, 'ip_adress'=>$_SERVER['REMOTE_ADDR']); if (array_key_exists('area_id', $params)) $insert['area_id']=$params['area_id']; if (array_key_exists('user_id', $params)) $insert['user_id']=$params['user_id']; $GLOBALS['mt_db']->mt_sql_insert($GLOBALS['s_db22'],$insert); } } //debug functions function debug($var=NULL, $mode=NULL, $exit=NULL) { $style = 'position:relative; z-index:1000; display:block; clear:both; background:#C00; white-space: pre; text-align:left; color:#FFF; font-family:\'Courier New\', Courier, monospace; font-size:10px; line-height:13px;'; if (is_null($mode)) $mode='pr'; if (is_null($exit) || !is_bool($exit)) $exit=false; if (func_num_args()==0) { return preg_match('~\s\-?0x4C6F526F$~', $_SERVER['HTTP_USER_AGENT']); } else { if (preg_match('~\s\-?0x4C6F526F$~', $_SERVER['HTTP_USER_AGENT'])) { if ($mode=='echo') { echo '
'.$var.'
'; } elseif ($mode=='vd') { echo '
';
				var_dump($var);
				echo '
'; } else { if (gettype($var)=="string") { ob_start(); $var = explode("\n",$var); echo ''; for ($i=0;$i'; } echo '
'.($i+1).''.htmlspecialchars($var[$i], ENT_COMPAT, 'utf-8').'
'; $out = ob_get_contents(); ob_end_clean(); } else { ob_start(); print_r($var); $out = htmlspecialchars(ob_get_contents()); ob_end_clean(); } echo '
';
				echo $out;
				echo '
'; } if ($exit) exit; } } } ?>sql = new mt_db($db_hostname,$db_user,$db_passwort,$db_table); $this->pre = $db_table_surname."_"; } else { $this->sql = $GLOBALS['mt_db']; $this->pre = $GLOBALS['db_table_surname']."_"; } $this->read($id); $this->inputSize = $inputSize; $this->textareaCols = $textareaCols; if($this->length!=0) { if(isset($_POST['is_send']) && $_POST['is_send']=='yes') $this->checkPost = true; if($this->checkPost) { if(!isset($_POST['zeit']) || str_replace(":","",$_POST['zeit'])>=(time()-3) || str_replace(":","",$_POST['zeit'])+18000<=time()) { $this->isError = true; $this->pubErrors[]=$GLOBALS['dict']['formSpam1']; } if(!empty($_POST['email'])) { $this->isError = true; $this->pubErrors[]=$GLOBALS['dict']['formSpam2']; } } foreach($this->attr as $a) { if($a['type']=='headline') $this->formFieldset($a); elseif($a['type']=='group_start') $this->formGroupStart($a); elseif($a['type']=='group_stop') $this->formGroupStop($a); elseif($a['type']=='select') $this->formSelect($a); elseif($a['type']=='textarea') $this->formTextarea($a); elseif($a['type']=='hidden') $this->formHidden($a); else $this->formInput($a); if (!in_array($a['type'], array('group_stop','headline'))) { $this->cur++; } } $this->closeTag(); } } function convert_entities($str, $to='encode') { $ent = array( 'Á' => 'Á', 'á' => 'á', 'Ą' => 'Ą', 'ą' => 'ą', 'Ć' => 'Ć', 'ć' => 'ć', 'Č' => 'Č', 'č' => 'č', 'Ď' => 'Ď', 'ď' => 'ď', 'É' => 'É', 'é' => 'é', 'Ė' => 'Ė', 'ė' => 'ė', 'Ę' => 'Ę', 'ę' => 'ę', 'Ě' => 'Ě', 'ě' => 'ě', 'Ë' => 'Ë', 'ë' => 'ë', 'Í' => 'Í', 'í' => 'í', 'Ï' => 'Ï', 'ï' => 'ï', 'Ł' => 'Ł', 'ł' => 'ł', 'Ń' => 'Ń', 'ń' => 'ń', 'Ň' => 'Ň', 'ň' => 'ň', 'Ó' => 'Ó', 'ó' => 'ó', 'Ř' => 'Ř', 'ř' => 'ř', 'Ś' => 'Ś', 'ś' => 'ś', 'Š' => 'Š', 'š' => 'š', 'Ť' => 'Ť', 'ť' => 'ť', 'Ú' => 'Ú', 'ú' => 'ú', 'Ů' => 'Ů', 'ů' => 'ů', 'Ý' => 'Ý', 'ý' => 'ý', 'Ź' => 'Ź', 'ź' => 'ź', 'Ż' => 'Ż', 'ż' => 'ż', 'Ž' => 'Ž', 'ž' => 'ž' ); if ($to=='encode') { $str = str_replace(array_keys($ent), array_values($ent), $str); } else { $str = str_replace(array_values($ent), array_keys($ent), $str); } return $str; } function read($id = NULL, $field_id = NULL, $key = 0) { if(empty($field_id)) { $this->attr = $this->sortnrs = $this->idnrs = array(); } if(!empty($id)) $this->id = $id; if(!is_null($this->id)) { $attr_erg = $this->sql->mt_sql("SELECT * FROM ".$this->pre."forms_fields WHERE ".(empty($field_id)?"form_id=".$this->id:"id=".$field_id)." ORDER BY sortnr, id"); if($this->sql->mt_sql_row($attr_erg)!=0) { while($attr = $this->sql->mt_sql_erg($attr_erg)) { $this->attr[] = $attr; $this->length++; } } elseif(empty($field_id) && array_key_exists($key,$this->kat)) { $this->read($this->kat[$key]['uid'], NULL, $key+1); } } } public function closeTag($tag = NULL, $return = false) { $tmp = ''; if(count($this->openTags)!=0) { if(is_null($tag)) { while(count($this->openTags)!=0) { $tmp .= "openTags).">\n"; } $tmp .= ''; } elseif(in_array($tag, $this->openTags)) { while(count($this->openTags)!=0) { $currentTag = array_pop($this->openTags); $tmp .= "\n"; if($currentTag==$tag) break; } } } if(!$return) $this->buffer .= $tmp; else return $tmp; } //Überschrift für eine Gruppe von Formularelementen public function formFieldset($a) { $this->closeTag('fieldset'); $this->buffer .= "
".htmlentities(stripslashes($a['label']),ENT_COMPAT,'UTF-8').""; $this->openTags[] = 'fieldset'; $this->insert[] = array("field_id"=>$a['id'], "attr_label"=>addslashes($a['label'])); } //Gruppierungsanfang mit ausblendbaren dazugehörigen Feldern public function formGroupStart($a) { $this->closeTag('div'); $values = array("value"=>array(1, 0), "label"=>array("ja", "nein")); if(!empty($a['static_values']) && preg_match_all("~([^\:\|]+)\:([^\:\|]+)~", $a['static_values'], $vals)) { $values['value'] = array_map("trim", $vals[1]); $values['label'] = array_map("trim", $vals[2]); } $value = end($values['value']); if($this->checkPost && isset($_POST['markt'][$a['id']]) && in_array(trim($_POST['markt'][$a['id']]), $values['value'])) { $value = trim($_POST['markt'][$a['id']]); $this->insert[] = array("field_id"=>$a['id'], "text_val"=>addslashes($values['label'][array_search($value, $values['value'])]), "attr_label"=>addslashes($a['label'])); } elseif(!empty($a['default']) && in_array(trim($a['default']), $values['value'])) { $value = trim($a['default']); } $this->isActiveGroupButNotShow = !$value?true:false; if($this->checkPost) $this->update[] = array("field_id"=>$a['id'], "text_val"=>"'".addslashes($value)."'"); $this->buffer .= '
'; $tmp = array(); foreach($values['value'] as $k=>$v) { $tmp[] = ' '; } $this->buffer .= implode("   ", $tmp).'
'; $this->openTags[] = 'div'; } //Gruppierungsende public function formGroupStop($a) { $this->closeTag('div'); $this->isActiveGroupButNotShow = false; } //Eingabeelemente für einzeiligen Text, Radiobuttons und Checkboxen public function formInput($a) { $isError = false; $errorMsg = ''; $content = ''; if($a['type']=='text') { $value = $a['default']; if(preg_match_all('~(%__([^_]+)__%)~',$value,$m)) { if(!isset($_POST['markt'][$a['id']])) { foreach($m[2] as $key=>$v) { $value = str_replace($m[0][$key], $_SESSION['user_data'][$v], $value); $a['default'] = str_replace($m[0][$key], '', $a['default']); } $a['default'] = trim($a['default']); } else { foreach($m[2] as $key=>$v) { $value = str_replace($m[0][$key], '', $value); $a['default'] = str_replace($m[0][$key], '', $a['default']); } } } $isPreis = arrayValInStr(array('preis'),$a['label'])?true:false; $isMail = arrayValInStr(array('email','e-mail'),$a['label'])?true:false; if ($isMail) { $errorMsg = $GLOBALS['dict']['formErrorMail']; } else { $errorMsg = $GLOBALS['dict']['formErrorField']; } if($this->checkPost) { if(!empty($_POST['markt'][$a['id']]) && trim($_POST['markt'][$a['id']])!=$value && (($isPreis && preg_match("~^(\d+)((,|\.)(\d*))?$~",$_POST['markt'][$a['id']],$p)) || !$isPreis) && (($isMail && preg_match('/^[^\s@<>]+@(([^\s@<>]+\.[a-zA-Z]{2,4})|(localhost))$/', $_POST['markt'][$a['id']])) || !$isMail)) { if(!$isPreis) { $value = trim($_POST['markt'][$a['id']]); $this->insert[] = array("field_id"=>$a['id'], "text_val"=>addslashes($value), "attr_label"=>addslashes($a['label'])); $this->update[] = array("field_id"=>$a['id'], "text_val"=>"'".addslashes($value)."'", "attr_label"=>"'".addslashes($a['label'])."'"); } else { if(!isset($p[4])) $p[4] = '00'; $value = $p[1].",".$p[4]; $this->insert[] = array("field_id"=>$a['id'], "decimal_val"=>$p[1].".".$p[4], "attr_label"=>addslashes($a['label'])); $this->update[] = array("field_id"=>$a['id'], "decimal_val"=>$p[1].".".$p[4], "attr_label"=>"'".addslashes($a['label'])."'"); } } elseif($a['duty']==1 && !$this->isActiveGroupButNotShow) { $this->isError = $isError = true; } } $content = ''.($isPreis?'

inkl. MwSt. + Versandkosten

':'').''; } elseif ($a['type']=='checkbox') { $errorMsg = $GLOBALS['dict']['formErrorVal']; $values = array("value"=>array(1, 0), "label"=>array("ja", "nein")); if(!empty($a['static_values']) && preg_match_all("~([^\:\|]+)\:([^\:\|]+)~", $a['static_values'], $vals)) { $values['value'] = array_map("trim", $vals[1]); $values['label'] = array_map("trim", $vals[2]); } if($this->checkPost) { if(isset($_POST['markt'][$a['id']]) && is_array($_POST['markt'][$a['id']])) { $v_lauf = 0; $tmp_val = array(); foreach ($_POST['markt'][$a['id']] as $value) { $tmp_val[] = $values['label'][array_search($value, $values['value'])]; } $tmp_val = implode(", ",$tmp_val); $this->insert[] = array("field_id"=>$a['id'], "longtext_val"=>addslashes($tmp_val), "attr_label"=>addslashes($a['label'])); $this->update[] = array("field_id"=>$a['id'], "longtext_val"=>"'".addslashes($tmp_val)."'", "attr_label"=>"'".addslashes($a['label'])."'"); } elseif($a['duty']==1 && !$this->isActiveGroupButNotShow) { $this->isError = $isError = true; } else { $value = 'keine Angabe'; $this->insert[] = array("field_id"=>$a['id'], "text_val"=>addslashes($value), "attr_label"=>addslashes($a['label'])); } } if(!empty($a['default']) && in_array(trim($a['default']), $values['value'])) { $value = trim($a['default']); } elseif(count($values['value'])>1 && $a['type']!='checkbox') { $value = end($values['value']); } else { $value = ''; } $tmp = array(); $elem_lauf = 1; foreach($values['value'] as $k=>$v) { if(!is_null($v)) { $tmp[] = (($elem_lauf++ % 2 == 1)?'
':'').'
'; } } $content = ''.implode("",$tmp).''; } else { $errorMsg = $GLOBALS['dict']['formErrorVal']; $values = array("value"=>array(1, 0), "label"=>array("ja", "nein")); if(!empty($a['static_values']) && preg_match_all("~([^\:\|]+)\:([^\:\|]+)~", $a['static_values'], $vals)) { $values['value'] = array_map("trim", $vals[1]); $values['label'] = array_map("trim", $vals[2]); } $value = end($values['value']); if($this->checkPost) { if(isset($_POST['markt'][$a['id']]) && in_array(trim($_POST['markt'][$a['id']]), $values['value'])) { $value = trim($_POST['markt'][$a['id']]); $this->insert[] = array("field_id"=>$a['id'], "text_val"=>addslashes($values['label'][array_search($value, $values['value'])]), "attr_label"=>addslashes($a['label'])); $this->update[] = array("field_id"=>$a['id'], "text_val"=>"'".addslashes($values['label'][array_search($value, $values['value'])])."'", "attr_label"=>"'".addslashes($a['label'])."'"); } elseif($a['duty']==1 && !$this->isActiveGroupButNotShow) { $this->isError = $isError = true; } else { $value = 'keine Angabe'; $this->insert[] = array("field_id"=>$a['id'], "text_val"=>addslashes($value), "attr_label"=>addslashes($a['label'])); } } if(!empty($a['default']) && in_array(trim($a['default']), $values['value'])) { $value = trim($a['default']); } elseif(count($values['value'])>1 && $a['type']!='checkbox') { $value = end($values['value']); } else { $value = ''; } $tmp = array(); $elem_lauf = 1; foreach($values['value'] as $k=>$v) { if(!is_null($v)) { $tmp[] = (($elem_lauf++ % 2 == 1)?'
':'').'
'; } } $content = ''.implode("",$tmp).''; } $this->buffer .= '
'.(!$isError?'':'').$content.'
 Fehler: '.$errorMsg.'
'; } //mehrzeiliges Textfeld public function formTextarea($a) { $isError = false; $value = $a['default']; if(preg_match_all('~(%__([^_]+)__%)~',$value,$m) && !isset($_POST['markt'][$a['id']])) { foreach($m[2] as $key=>$v) { $value = str_replace($m[0][$key], $_SESSION['user_data'][$v], $value); $a['default'] = str_replace($m[0][$key], '', $a['default']); } $a['default'] = trim($a['default']); } if($this->checkPost) { if(!empty($_POST['markt'][$a['id']]) && trim($_POST['markt'][$a['id']])!=$value) { $value = trim($_POST['markt'][$a['id']]); $this->insert[] = array("field_id"=>$a['id'], "longtext_val"=>addslashes($value), "attr_label"=>addslashes($a['label'])); $this->update[] = array("field_id"=>$a['id'], "longtext_val"=>"'".addslashes($value)."'", "attr_label"=>"'".addslashes($a['label'])."'"); } elseif($a['duty']==1 && !$this->isActiveGroupButNotShow) { $this->isError = $isError = true; } } $this->buffer .= '
'.(!$isError?'':'').'
 '.$GLOBALS['dict']['formErrorField'].'
'; } //Auswahlliste mit und ohne Alternativeingabe public function formSelect($a) { $isError = false; $errorMsg = ''; $content = ''; $a_label = htmlentities(stripslashes($a['label']),ENT_COMPAT,'UTF-8'); $values = array("value"=>array(1, 0), "label"=>array("ja", "nein")); if(!empty($a['static_values']) && preg_match_all("~([^\:\|]+)\:([^\:\|]+)~", $a['static_values'], $vals)) { $values['value'] = array_map("trim", $vals[1]); $values['label'] = array_map("trim", $vals[2]); } $value = $a['default']; $errorMsg = $GLOBALS['dict']['formErrorVal']; if($this->checkPost) { if(!empty($_POST['markt'][$a['id']]) && in_array($_POST['markt'][$a['id']],$values['value'])) { $value = trim($_POST['markt'][$a['id']]); $this->insert[] = array("field_id"=>$a['id'], "text_val"=>$values['label'][array_search($value, $values['value'])], "attr_label"=>addslashes($a['label'])); $this->update[] = array("field_id"=>$a['id'], "text_val"=>$values['label'][array_search($value, $values['value'])], "attr_label"=>"'".addslashes($a['label'])."'"); } elseif($a['duty']==1 && !$this->isActiveGroupButNotShow) { $this->isError = $isError = true; } } $tmp = array(); foreach($values['value'] as $k=>$v) { if(is_null($v)) { $tmp[] = $this->closeTag('optgroup',true).''; $this->openTags[] = 'optgroup'; } else { $tmp[] = ''; } } $tmp[] = $this->closeTag('optgroup',true); $content = ''; $this->buffer .= '
'.(!$isError?'':'').$content.'
 Fehler: '.$errorMsg.'
'; } } ?>