so schön ist Andrian >>

mehr »
allowLngs as $k => $l) : if(is_array($Mizu->project['conf']['lngs'][$l]['attr']) AND $Mizu->project['conf']['lngs'][$l]['attr']['name']) { $e = $Mizu->project['conf']['lngs'][$l]['attr']['name']; } else { $e = $l; } ?> lng==$l) echo 'class="on"'; ?>>allowLngs)-1 AND 1==2) echo '|'; ?> home
loadTpl) { return ''; } class Request { var $tplsDir = 'tpl/request/tpl'; function getTpls() { if(!is_dir($this->tplsDir)) return array(); $R = array(); foreach(scandir($this->tplsDir) as $v) { $V = $this->tplsDir.'/'.$v; if($v[0]=='.' OR !is_dir($V)) continue; $R[$v] = $v; } return $R; } function isSpam() { $ok = true; // referer check if(substr($_SERVER['HTTP_REFERER'],7,strlen($_SERVER['HTTP_HOST']))!=$_SERVER['HTTP_HOST']) { $ok = false; } // js set field if($this->Mizu->GP['checksum']!=$_SERVER['HTTP_HOST']) { $ok = false; } if(!$ok) { echo '---'; return true; } return false; } function getFormConf() { $FormConf = $this->Mizu->get('lng/formConf'); if($this->Mizu->get('cnt/reqFields')) { $Fields = ''; $tmp = $this->Mizu->getList('cnt/reqFields',array('order'=>array('sort'=>'+0 ASC'))); foreach($tmp as $k => $v) { if(!$v['lng'][$this->Mizu->GP['L']]['name']) continue; switch($v['cnt']['reqFieldType']) { case 'textarea' : default : $Fields.='Mizu->GP['L']]['answ1']) { $Fields.=' answ1="'.$v['lng'][$this->Mizu->GP['L']]['answ1'].'" '; } if($v['lng'][$this->Mizu->GP['L']]['answ2']) { $Fields.=' answ2="'.$v['lng'][$this->Mizu->GP['L']]['answ2'].'" '; } $Fields.='/>'; break; } } #print_rf(htmlentities($Fields));exit; } $formTpl = $this->Mizu->get('cnt/formFile'); if($this->formTpl) { $formTpl = $this->formTpl; } if($this->Mizu->GP['fromTpl']) { $formTpl = $this->Mizu->GP['fromTpl']; } if($formTpl AND !$FormConf) { $file = $this->tplsDir.'/'.$formTpl.'/'.$this->Mizu->GP['L'].'.php'; if(file_exists($file)) { $file = substr($file,4,-4); $FormConf = $this->Mizu->getTpl($file,array('forceTpl'=>true,'Fields'=>$Fields),true); } } return $FormConf; } function exportAction() { // get Entries $timeFilter =''; if($this->Mizu->GP['from']) { $timeFilter.= ' AND createDate >= '.strtotime($this->Mizu->GP['from']); } if($this->Mizu->GP['until']) { $timeFilter.= ' AND createDate <= '.strtotime($this->Mizu->GP['until']); } $A = $this->Mizu->_DB->getRows('SELECT * FROM %%%requests WHERE pid = '.$this->Mizu->GP['id'].' '.$timeFilter.' ORDER BY id'); // calc Data $Data = array(); $Header = array('createDate'=>'Eingetragen am'); foreach($A as $k => $v) { $d = unserialize($v['mailData']); $Data[$k]['createDate'] =date('d.m.Y H:i:s',$v['createDate']); if(is_array($d)) { foreach($d as $field => $value) { if($value['attr']['type']=='title' OR $value['attr']['type']=='submit' OR $value['attr']['type']=='privacyCheckbox' OR $value['attr']['type']=='caption') continue; if($value['valueF']) { $Data[$k][$field] = strip_tags(strtr($value['valueF'],array('
'=>' '))); } elseif(is_array($value['value'])) { foreach($value['value'] as $yy) { $Data[$k][$field] = '-'.$yy.' '; } } else { $Data[$k][$field] = $value['value']; } $Header[$field] = $value['attr']['name']; } } } $sep = ','; $out = '"'.implode('"'.$sep.'"',$Header).'"'."\n"; if($Data) { foreach($Data as $k => $v) { $o = ''; foreach($Header as $field => $xx) { $o.='"'.$v[$field].'"'.$sep.''; } $out.=substr($o,0,-1)."\n"; } } header("Content-type: application/octet-stream; charset=utf-8"); header("Content-length: ".strlen($out)); header("Content-Disposition: attachment; filename=".$this->Mizu->get('lng/nav')." - ".date('d.m.Y',strtotime($this->Mizu->GP['from']))." - ".date('d.m.Y',strtotime($this->Mizu->GP['until'])).".csv"); ob_end_clean(); echo $out; exit; exit; } function init() { global $Mizu; $Mizu = $this->Mizu; $tplID = basename(dirname(__FILE__)); if($this->Mizu->GP['a']=='export' AND $this->Mizu->isAdmin) { $this->exportAction(); } // set includes #echo $Mizu->getCssInc('tpl/'.$tplID.'/screen.css'); ////////////////////////////////////////////////////////////////////// // BUILD FORM $this->Form = array(); $this->FormOut = ''; $Error = array(); $Mail = array(); if($Mizu->GP['formSend']) { $this->FormSended = true; } $FormConf = $this->getFormConf(); if($FormConf) { $this->Form = $Mizu->_Helper->getAfX(simplexml_load_string($FormConf)); if($Mizu->GP['inter']) { $opt = array(); $opt[]['attr'] = array( 'type' => 'text', 'readyonly' => true, 'id' => 'inter', 'name' => $Mizu->_('interested'), 'value' => $Mizu->GP['inter'], ); $this->Form['field'] = array_merge($opt,$this->Form['field']); } #print_rf($Mizu->GP); foreach($this->Form['field'] as $v) { $El = $v; $El['id'] = $v['attr']['id']; if(!$El['id']) { $El['id'] = $Mizu->_Url->nameEncode($v['attr']['name']); if($this->Elements[$El['id']]) $El['id'].='x'; if($this->Elements[$El['id']]) $El['id'].='x'; if($this->Elements[$El['id']]) $El['id'].='x'; if($this->Elements[$El['id']]) $El['id'].='x'; if($this->Elements[$El['id']]) $El['id'].='x'; if($this->Elements[$El['id']]) $El['id'].='x'; } if(!$El['id'] OR $v['attr']['type']=='captcha' OR $v['attr']['type']=='privacyCheckbox') { $El['id'] = $v['attr']['type']; } $El['name'] = $v['attr']['name']; # $EL['formName'] = urlencode($EL['name']); if($Mizu->GP[$El['id']]) { $El['value'] = $Mizu->GP[$El['id']]; } if($El['attr']['value']) { $El['value'] = $El['attr']['value']; } if(is_string($El['value'])) { $El['value'] = trim($El['value']); } if($El['attr']['readyonly']) { $El['spc'] = 'readonly="readyonly"'; } ///////////////////////////////////////////////////////////////// // valid if($this->FormSended) { if($El['attr']['reqIf']) { $T = explode('==',$El['attr']['reqIf']); if($Mizu->GP[$T[0]]==$T[1]) { $El['attr']['req'] = true; } } $valid_ok = true; if($El['attr']['req'] AND !$El['value']) { $valid_ok = false; } switch($El['attr']['valid']) { case 'email' : if($El['value']) { if (!$Mizu->_Helper->isValidEmail($El['value'])) { $valid_ok = false; } else { $absendermail = $El['value']; } } break; case 'captcha' : if($El['value']!=$_SESSION['kcode']) { $valid_ok = false; } break; } if(!$valid_ok) { $Error[] = true; $El['class'] = ' Ierror '; } } ///////////////////////////////////////////////////////////////// // build form if($El['attr']['req']) { $El['name'].='*'; } $LabelClass = 'col-lg-4'; $InputClass = 'col-lg-8'; $this->FormOut.='
'; switch($v['attr']['type']) { case 'ShopCart' : $Shop = $Mizu->getClass('Shop',dirname(__FILE__).'/../shop/Shop.class.php'); $this->FormOut.= $Shop->getRequestFormField(); if($this->FormSended) { $this->FormSended = $Shop->inAction(); } break; /* case 'captcha' : $this->FormOut.='
'.$El['attr']['descr'].'
'; break; */ case 'privacyCheckbox' : $this->FormOut.=''; if($El['value']) { $El['check'] = 'checked="checked"'; } $this->FormOut.='
'.nl2br($v['txt']).'
'; break; case 'label' : case 'caption' : $this->FormOut.=''; $this->FormOut.='
'.$Mizu->parseHtmlTextField(nl2br($v['txt'])).'
'; break; case 'title' : $this->FormOut.=''; $this->FormOut.='

'.$El['name'].'

'; break; case 'textarea' : $this->FormOut.= '
'; break; case 'submit' : $this->FormOut.=''; $this->FormOut.='
'; break; case 'checkbox' : if($El['value']) { $El['check'] = 'checked="checked"'; } $this->FormOut.= '
'.$El['name'].'
'; break; case 'checkboxGroup' : $opts = ''; $El['valueF'] = ''; if(is_array($El['options']['option'])) { foreach($El['options']['option'] as $v) { $v = $v['attr']; $s = ''; if(!isset($v['value'])) $v['value'] = $Mizu->_Url->nameEncode($v['name']); if($El['value'][$v['value']]) { $s = 'checked="checked"'; $El['valueF'].= '-'.$v['name']."
"; } $v['id'] = $El['id'].'-'.$v['value']; $opts.= '
'; } } $this->FormOut.= '
'.$opts.'
'; break; case 'year' : $El['options']['option'][]['attr'] = array('name'=>''); $from = date('Y')+$El['attr']['from']; $until = date('Y')+$El['attr']['until']; if($from<$until) { for($y = $from;$y<= $until;$y++) { $El['options']['option'][]['attr'] = array('name'=>$y); } } else { for($y = $from;$y>= $until;$y--) { $El['options']['option'][]['attr'] = array('name'=>$y); } } case 'select' : if($El['attr']['data']) { switch($El['attr']['data']) { case 'persons' : $El['options']['option'][0]['attr']['name'] = ''; $El['options']['option'][0]['attr']['value'] = ''; foreach(range(1,15) as $xx) { $El['options']['option'][]['attr']['name'] = $xx; } break; } } $opts = ''; if(is_array($El['options']['option'])) { foreach($El['options']['option'] as $v) { $v = $v['attr']; $s = ''; if(!isset($v['value'])) $v['value'] = $Mizu->_Url->nameEncode($v['name']); if($v['value']==$El['value']) { $s = 'selected="selected"'; $El['valueF'] = $v['name']; } $opts.= ''; } } $this->FormOut.= '
'; break; case 'survey' : foreach(range(1,5) as $xx) { $El['options']['option'][]['attr'] = array( 'name' => $xx, ); } $El['spc'][5] = ''.$El['attr']['answ1'].''; $El['spc'][10] = ''.$El['attr']['answ2'].''; case 'radio' : $opts = ''; if(is_array($El['options']['option'])) { foreach($El['options']['option'] as $v) { $v = $v['attr']; if(!isset($v['value'])) $v['value'] = $Mizu->_Url->nameEncode($v['name']); $s = ''; if($v['value']==$El['value']) { $s = 'checked="checked"'; $El['valueF'] = $v['name']; } $opts.= ''.$v['name'].''; } } $this->FormOut.= '
'.$El['spc'][5].$opts.$El['spc'][10].'
'; break; case 'spacer' : $this->FormOut.= '
 
'; break; case 'day' : $El['type'] = 'text'; $El['class'].=' datepicker '; default : $this->FormOut.= ' '; if(!$El['type']) { $El['type'] = 'text'; } if($El['attr']['valid']=='email') { $El['type'] = 'email'; } $this->FormOut.= '
'; break; } ///////////////////////////////////////////////////////////////// // build mail if($El['value']) { switch($v['attr']['type']) { default : break; } if(!$El['valueF']) { $El['valueF'] = $El['value']; } } $Mail[] = $El; $V[$El['id']] = $El['valueF']; $RV[$El['id']] = $El['value']; $this->Elements[$El['id']] = $El; $this->FormOut.='
'; } // send if($this->FormSended AND !count($Error)) { #if($this->isSpam()) return false; $mails = explode(';',$Mizu->getC('email')); if(!$absendermail) { $absendermail = $mails[0]; } // save to Asa if($Mizu->get('cnt/saveAsa')) { $V['id'] = mktime().rand(1,200); ob_start(); require_once('services/mo-asa.xml.php'); $XML = ob_get_contents(); ob_end_clean(); if(file_exists($Mizu->get('cnt/saveAsa'))) { file_put_contents($Mizu->get('cnt/saveAsa').$V['id'].'.xml',$XML); } } if($Mizu->get('cnt/sendThxPage')) { $this->sendThx =true; } if($RV['sendType']=='1') { $this->sendThx =true; } else if($V['sendType']=='2') { $this->sendThx =false; } // send danke page if($this->sendThx AND $nix) { $mail = $this->Mizu->getHelperClass('Mailer'); $mail->CharSet = 'utf-8'; $mail->IsHTML(true); $mail->AddAddress($absendermail,$absendermail); $mail->Subject = $Mizu->get('lng/title'); $mail->From = $mails[0]; $mail->FromName = $mails[0]; $mailToClient = $Mizu->get('lng/thx'); $mail->Body = $mailToClient; if($absendermail!=$mails[0]) { $mail->Send(); } } $mail = $this->Mizu->getHelperClass('Mailer'); $mail->CharSet = 'utf-8'; $mail->IsHTML(true); foreach($mails as $e) { if($e) { $mail->AddAddress($e,$e); } } $mail->From = $absendermail; $mail->FromName = $absendermail; $mail->Subject = $Mizu->get('betreff'); $mailbody = ''; $TypesNotInMail = array('submit','captcha','privacyCheckbox','caption'); foreach($Mail as $k=>$v){ if(in_array($v['attr']['type'],$TypesNotInMail)) { continue; } $t = 0; $mailbody.=''; switch($v['attr']['type']) { case 'ShopCart' : $Shop = $Mizu->getClass('Shop',dirname(__FILE__).'/../shop/Shop.class.php'); $mailbody.= ''; break; case 'label' : case 'caption' : case 'title' : $t = 1; default : $mailbody.= ''; $mailbody.= '"; } else { $mailbody.=""; } } $mailbody.= ''; break; } } $mailbody.= '
'.$Shop->getRequestMailField().'
"; if(!$t) { if($v['value']) { $mailbody.=''.stripslashes($v['valueF'])." 
'; #ob_clean(); echo 'MAIL --------------------------
'.($mailbody).'
---------------------------';exit; $mail->Body = $mailbody; if($mailToClient) { # $mail->Body.='

------------------------------------------------------------
'; $mail->Body.=$mailToClient; } if($mail->Send()) { if($this->Mizu->Conf['requestSaveData']) { $I = array(); $I['i']['pid'] = $this->Mizu->GP['id']; $I['i']['createDate'] = mktime(); $I['i']['lng'] = $Mizu->GP['L']; $I['i']['fromMail'] = $absendermail; $I['i']['mailRaw'] = $mailbody; $I['i']['mailData'] = serialize($this->Elements); $this->Mizu->_DB->IU($I,'%%%requests'); } $this->SendOk = 1; if($RV['sendType']=='2') { $this->SendOk = 2; } } else { } if($this->SendOk) { header('Location:'.$this->Mizu->getUrl(false,false,array('page'=>'thx'))); exit; } unset($_SESSION["kcode"]); //Captcha-Variable zurücksetzen } } } }

Schnellanfrage

noMainImg = true;?>