Nova ponuda
unknown
php
5 years ago
49 kB
7
Indexable
<?php
$globalSprache = '';
$globalSaison = '';
$arr_dep = array();
function vd($data)
{
$allowed_ips = [
'176.104.105.50',
'94.228.224.175',
// '213.182.253.2',
'188.246.66.44',
];
if(in_array($_SERVER['REMOTE_ADDR'], $allowed_ips))
{
var_dump($data);
die();
}
}
function printHTML($html)
{
$allowed_ips = [
'176.104.105.50',
'94.228.224.175',
'213.182.253.2',
'213.196.98.254',
'92.60.226.232', //Zdravko 2
];
if(in_array($_SERVER['REMOTE_ADDR'], $allowed_ips))
{
$html = str_replace('<', '<', $html);
$html = str_replace('>', '>', $html);
$html = nl2br($html);
$html = str_replace("\t", ' ', $html);
echo '<code>';
echo $html;
echo '</code>';
die();
}
}
function loadDataFromXml( $_file, $_emailObj ) {
GLOBAL $ppfConfig;
GLOBAL $plDb;
GLOBAL $basicHtml;
GLOBAL $Base64Encode;
GLOBAL $ProtelMessage;
GLOBAL $globalSprache;
GLOBAL $globalSaison;
GLOBAL $arr_dep;
$maxOffers = 4; // maximum number of offers
$maxStorno = 4; // maximum number of stornos
$maxGroup = 4; // maximum number of group
$offerTrans = array('de' => array('Anreise', 'Abreise', 'Erwachsene', 'Kinder', 'Tagespreis', 'Gesamtpreis für %s Übernachtungen', 'Gesamtpreis mit %s Frühbucherbonus', 'und', 'oder', 'pro Person', 'pro Kind', 'Jahre', 'bis', 'ab', 'Gesamtpreis mit %s Rabatt', 'Die dritte Erwachsene Person im Zimmer erhält einen Rabatt von 20%.'),
'en' => array('Arrival', 'Departure', 'Adults', 'Children', 'Price per day unitl', 'Total price for %s Nights', 'Total price with %s early bird discount', 'and', 'or', 'per person', 'per child', 'years', 'till', 'from', 'Total price with %s discount', 'The third adult person in the room will receive a discount of 20%.'),
'it' => array('Arrivo', 'Partenza', 'Adults', 'Children', 'Price per day unitl', 'Total price for %s Nights', 'Total price with %s early bird discount', 'e', 'oppure', 'per person', 'per child', 'years', 'till', 'from', 'Total price with %s discount', 'The third adult person in the room will receive a discount of 20%.'),
'fr' => array('Arriv'.chr(233).'e', 'D'.chr(233).'part', 'Adults', 'Children', 'Price per day unitl', 'Total price for %s Nights', 'Total price with %s early bird discount', 'et', 'ou', 'per person', 'per child', 'years', 'till', 'from', 'Total price with %s discount', 'The third adult person in the room will receive a discount of 20%.'),
);
$dayTrans = array('de' => array('Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'),
'en' => array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'),
'it' => array('Domenica', 'Lunedi', 'Marted'.chr(236), 'Mercoled'.chr(236), 'Giovedi', 'Venerd'.chr(236), 'Sabato'),
'fr' => array('Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'),
);
$_fileContent=file_get_contents('../../../../wordUpLoaded/'.$_file);
$_fileContent=utf8_decode( $_fileContent);
// vd($_fileContent);
$_fileContent = str_replace( chr(13), "\r\n", $_fileContent);
$_fileContent = str_replace( chr(130), ',', $_fileContent);
$_fileContent = str_replace( chr(132), '"', $_fileContent);
$_fileContent = str_replace( chr(133), "...", $_fileContent);
$_fileContent = str_replace( chr(145), "'", $_fileContent);
$_fileContent = str_replace( chr(146), "'", $_fileContent);
$_fileContent = str_replace( chr(147), '"', $_fileContent);
$_fileContent = str_replace( chr(148), '"', $_fileContent);
// lang
if(preg_match("|<sprache>(.*)</sprache>|Uism", $_fileContent, $_regs)){
$_lang = $_regs[1];
}else{
$_lang = 'de';
}
$globalSprache = $_lang;
$_emailObj->setLang($_lang);
// type
if(preg_match("|<typ>(.*)</typ>|Uism", $_fileContent, $_regs)){
$_typ = $_regs[1];
} else {
$_typ = 'em';
}
$_emailObj->setTyp($_typ);
// season
if(preg_match("|<saison>(.*)</saison>|Uism", $_fileContent, $_regs)){
$_season = $_regs[1];
$_emailObj->setIdentityId(1);
if($_season == 'su'){
$_emailObj->setTemplateId(1);
}else if( $_season == 'wi' ) {
$_emailObj->setTemplateId(4);
}
}
// identity
if(preg_match("|<identity>(.*)</identity>|Uism", $_fileContent, $_regs)){
$configIdent = $plDb->faq("SELECT id, vorlagenhtmlid, vorlagenbildid FROM identitaeten WHERE emailfrom='" . mysqli_escape_string($plDb->getConnection(), $_regs[1]). "'");
if(is_array($configIdent)){
$_emailObj->setIdentityId( $configIdent['id'] );
//$_emailObj->setTemplateId($configIdent['vorlagenhtmlid']);
$_emailObj->setTemplateImageId($configIdent['vorlagenbildid']);
}
}
// headerbild
if(preg_match("|<headerbild>(.*)</headerbild>|Uism", $_fileContent, $_regs)){
$_emailObj->setTemplateImageId($_regs[1]);
}
// subject
if(preg_match("|<betreff>(.*)</betreff>|Uism", $_fileContent, $_regs)){
$_emailObj->setSubject(str_replace(" "," ",$_regs[1]));
}else{
$_emailObj->setSubject('');
}
// user
if(preg_match("|<benutzer>(.*)</benutzer>|Uism", $_fileContent, $_regs)){
$_benutzer = $_regs[1];
}else{
$_benutzer = '';
}
// text templates
$_fileContent = preg_replace_callback('|<textvorlage:(.*)>|Uism', 'parseTextvorlage', $_fileContent);
// special styles
$_fileContent = preg_replace('/<highlight1>(.*)<\/highlight1>/Uism', '<span class="imageheadline1">$1</span>', $_fileContent);
$_fileContent = preg_replace('/<highlight2>(.*)<\/highlight2>/Uism', '<span class="imageheadline2">$1</span>', $_fileContent);
// room categories
$links = array(
'SIN' => array('desc' => 'Einzelzimmer', 'nr' => array('106' => array('sketch' => '8108_zs_140x120px_SIN.jpg', 'link' => 'http://www.mirabell.it'),
'202' => array('sketch' => '8108_zs_140x120px_SIN.jpg', 'link' => 'http://www.mirabell.it'),
'206' => array('sketch' => '8108_zs_140x120px_SIN.jpg', 'link' => 'http://www.mirabell.it'))),
'NS' => array('desc' => 'Doppelzimmer Nostalgie', 'nr' => array('102' => array('sketch' => '8108_zs_140x120px_NS.jpg', 'link' => 'http://www.mirabell.it'),
'104' => array('sketch' => '8108_zs_140x120px_NS.jpg', 'link' => 'http://www.mirabell.it'),
'114' => array('sketch' => '8108_zs_140x120px_NS.jpg', 'link' => 'http://www.mirabell.it'),
'121' => array('sketch' => '8108_zs_140x120px_NS.jpg', 'link' => 'http://www.mirabell.it'),
'122' => array('sketch' => '8108_zs_140x120px_NS.jpg', 'link' => 'http://www.mirabell.it'),
'204' => array('sketch' => '8108_zs_140x120px_NS.jpg', 'link' => 'http://www.mirabell.it'),
'212' => array('sketch' => '8108_zs_140x120px_NS.jpg', 'link' => 'http://www.mirabell.it'))),
'NSS' => array('desc' => 'Doppelzimmer Nostalgie Süd', 'nr' => array('102' => array('sketch' => '8108_zs_140x120px_NSS.jpg', 'link' => 'http://www.mirabell.it'),
'104' => array('sketch' => '8108_zs_140x120px_NSS.jpg', 'link' => 'http://www.mirabell.it'),
'114' => array('sketch' => '8108_zs_140x120px_NSS.jpg', 'link' => 'http://www.mirabell.it'),
'121' => array('sketch' => '8108_zs_140x120px_NSS.jpg', 'link' => 'http://www.mirabell.it'),
'122' => array('sketch' => '8108_zs_140x120px_NSS.jpg', 'link' => 'http://www.mirabell.it'),
'204' => array('sketch' => '8108_zs_140x120px_NSS.jpg', 'link' => 'http://www.mirabell.it'),
'212' => array('sketch' => '8108_zs_140x120px_NSS.jpg', 'link' => 'http://www.mirabell.it'))),
'FS' => array('desc' => 'Frühlingssuite', 'nr' => array('301' => array('sketch' => '8108_zs_140x120px_FS_1.jpg', 'link' => 'http://www.mirabell.it'),
'303' => array('sketch' => '8108_zs_140x120px_FS_1.jpg', 'link' => 'http://www.mirabell.it'),
'103' => array('sketch' => '8108_zs_140x120px_FS_1.jpg', 'link' => 'http://www.mirabell.it'),
'107' => array('sketch' => '8108_zs_140x120px_FS_1.jpg', 'link' => 'http://www.mirabell.it'),
'109' => array('sketch' => '8108_zs_140x120px_FS_1.jpg', 'link' => 'http://www.mirabell.it'),
'201' => array('sketch' => '8108_zs_140x120px_FS_1.jpg', 'link' => 'http://www.mirabell.it'),
'203' => array('sketch' => '8108_zs_140x120px_FS_1.jpg', 'link' => 'http://www.mirabell.it'),
'207' => array('sketch' => '8108_zs_140x120px_FS_1.jpg', 'link' => 'http://www.mirabell.it'),
'209' => array('sketch' => '8108_zs_140x120px_FS_1.jpg', 'link' => 'http://www.mirabell.it'),
'219' => array('sketch' => '8108_zs_140x120px_FS_1.jpg', 'link' => 'http://www.mirabell.it'))),
'WS' => array('desc' => 'Suite Waldsaum', 'nr' => array('110' => array('sketch' => '8108_zs_140x120px_WS_1.jpg', 'link' => 'http://www.mirabell.it'),
'111' => array('sketch' => '8108_zs_140x120px_WS_1.jpg', 'link' => 'http://www.mirabell.it'),
'112' => array('sketch' => '8108_zs_140x120px_WS_1.jpg', 'link' => 'http://www.mirabell.it'),
'113' => array('sketch' => '8108_zs_140x120px_WS_1.jpg', 'link' => 'http://www.mirabell.it'),
'115' => array('sketch' => '8108_zs_140x120px_WS_1.jpg', 'link' => 'http://www.mirabell.it'),
'213' => array('sketch' => '8108_zs_140x120px_WS_1.jpg', 'link' => 'http://www.mirabell.it'),
'116' => array('sketch' => '8108_zs_140x120px_WS_1.jpg', 'link' => 'http://www.mirabell.it'),
'117' => array('sketch' => '8108_zs_140x120px_WS_1.jpg', 'link' => 'http://www.mirabell.it'),
'119' => array('sketch' => '8108_zs_140x120px_WS_1.jpg', 'link' => 'http://www.mirabell.it'),
'120' => array('sketch' => '8108_zs_140x120px_WS_1.jpg', 'link' => 'http://www.mirabell.it'),
'214' => array('sketch' => '8108_zs_140x120px_WS_1.jpg', 'link' => 'http://www.mirabell.it'),
'215' => array('sketch' => '8108_zs_140x120px_WS_1.jpg', 'link' => 'http://www.mirabell.it'),
'217' => array('sketch' => '8108_zs_140x120px_WS_1.jpg', 'link' => 'http://www.mirabell.it'),
'218' => array('sketch' => '8108_zs_140x120px_WS_1.jpg', 'link' => 'http://www.mirabell.it'),
'316' => array('sketch' => '8108_zs_140x120px_WS_1.jpg', 'link' => 'http://www.mirabell.it'))),
'TS' => array('desc' => 'Suite im Turm', 'nr' => array('105' => array('sketch' => '8108_zs_140x120px_TS.jpg', 'link' => 'http://www.mirabell.it'),
'205' => array('sketch' => '8108_zs_140x120px_TS.jpg', 'link' => 'http://www.mirabell.it'),
'302' => array('sketch' => '8108_zs_140x120px_TS.jpg', 'link' => 'http://www.mirabell.it'))),
'RS' => array('desc' => 'Suite Rieserferner', 'nr' => array('101' => array('sketch' => '8108_zs_140x120px_RS.jpg', 'link' => 'http://www.mirabell.it'))),
'BW' => array('desc' => 'Suite Bergwelt', 'nr' => array('305' => array('sketch' => '8108_zs_140x120px_BW_1.jpg', 'link' => 'http://www.mirabell.it'),
'306' => array('sketch' => '8108_zs_140x120px_BW_1.jpg', 'link' => 'http://www.mirabell.it'))),
'GS' => array('desc' => 'Gartensuite', 'nr' => array('118' => array('sketch' => '8108_zs_140x120px_GS_1.jpg', 'link' => 'http://www.mirabell.it'),
'216' => array('sketch' => '8108_zs_140x120px_GS_1.jpg', 'link' => 'http://www.mirabell.it'),
'313' => array('sketch' => '8108_zs_140x120px_GS_1.jpg', 'link' => 'http://www.mirabell.it'),
'314' => array('sketch' => '8108_zs_140x120px_GS_1.jpg', 'link' => 'http://www.mirabell.it'),
'222' => array('sketch' => '8108_zs_140x120px_GS_1.jpg', 'link' => 'http://www.mirabell.it'),
'220' => array('sketch' => '8108_zs_140x120px_GS_1.jpg', 'link' => 'http://www.mirabell.it'),
'221' => array('sketch' => '8108_zs_140x120px_GS_1.jpg', 'link' => 'http://www.mirabell.it'),
'315' => array('sketch' => '8108_zs_140x120px_GS_1.jpg', 'link' => 'http://www.mirabell.it'),
'309' => array('sketch' => '8108_zs_140x120px_GS_1.jpg', 'link' => 'http://www.mirabell.it'))),
'AU' => array('desc' => 'Suite Aurora', 'nr' => array('108' => array('sketch' => '8108_zs_140x120px_AU_1.jpg', 'link' => 'http://www.mirabell.it'),
'208' => array('sketch' => '8108_zs_140x120px_AU_1.jpg', 'link' => 'http://www.mirabell.it'),
'307' => array('sketch' => '8108_zs_140x120px_AU_1.jpg', 'link' => 'http://www.mirabell.it'),
'310' => array('sketch' => '8108_zs_140x120px_AU_1.jpg', 'link' => 'http://www.mirabell.it'),
'311' => array('sketch' => '8108_zs_140x120px_AU_1.jpg', 'link' => 'http://www.mirabell.it'),
'308' => array('sketch' => '8108_zs_140x120px_AU_1.jpg', 'link' => 'http://www.mirabell.it'))),
'MI' => array('desc' => 'Traumsuite Mirabell', 'nr' => array('304' => array('sketch' => '8108_zs_140x120px_MI.jpg', 'link' => 'http://www.mirabell.it'))),
'AV' => array('desc' => 'Aveda Wellness-Suite', 'nr' => array('210' => array('sketch' => '8108_zs_140x120px_AV.jpg', 'link' => 'http://www.mirabell.it'),
'211' => array('sketch' => '8108_zs_140x120px_AV.jpg', 'link' => 'http://www.mirabell.it'))),
// 'APP_A' => array('desc' => 'Appartment A', 'nr' => array()),
// 'APP_B' => array('desc' => 'Appartment B', 'nr' => array()),
// 'APP_C' => array('desc' => 'Appartment C', 'nr' => array()),
);
// add nolink class to image-links
$_fileContent = str_replace('target=_blank', 'target="_blank"', $_fileContent);
$_fileContent = preg_replace( '|<a target="_blank" href=(\s*)"(.*)"><bild>(.*)</bild></a>|Uism', "<a target=\"_blank\" href=\"$2\" class=\"nolink\" ><bild>$3</bild></a>", $_fileContent );
// fixed pictures
preg_match_all("[<bild>(.*)</bild>]", $_fileContent, $_picture_matches);
foreach($_picture_matches[1] as $_picture){
$_fileContent = str_replace('<bild>'.$_picture.'</bild>', '<img src="' . $ppfConfig['path']['relativeImages'] . 'fixed/'.$_picture.'" alt="" title="" />', $_fileContent);
}
// links
preg_match_all("[<link ziel=(.*)>(.*)</link>]", $_fileContent, $_link_matches);
foreach( $_link_matches[1] as $key => $_link) {
$_htmlCheck = strlen(strip_tags( $_link_matches[2][$key])) < strlen($_link_matches[2][$key]) ? true : false;
$_addLinkClass = $_htmlCheck ? 'nolink ' : '';
$_persCheck = strpos($_link_matches[2][$key],'{PERSONALIZED:') !== false ? true : false;
$_addLinkClass = $_persCheck ? 'nolink ' : $_addLinkClass;
$_fileContent = str_replace('<link ziel='.$_link.'>'.$_link_matches[2][$key].'</link>', '<a href="'.$_link.'" class="'.$_addLinkClass.'pt" target="_blank">'.$_link_matches[2][$key].'</a>', $_fileContent);
}
/* Find person items */
$_personItemsToFind = array(
'asaid',
'firma',
'anrede',
'titel',
'vorname',
'nachname',
'strasse',
'ort',
'plz',
'land',
'email',
'url',
'telefon',
'mobil',
'fax',
'geburtstag',
'zimmerres1',
'zimmerres2',
'zimmerres3',
'zimmerres4',
);
$_person = array();
foreach($_personItemsToFind as $_value){
if(preg_match("|<".$_value.">(.*)</".$_value.">|Uism", $_fileContent, $_regs)){
$_person[$_value] = trim($_regs[1]);
}
}
// salutation
if($_person['anrede'] != ''){
$_pAnreden = $plDb->query("SELECT * FROM anreden");
while($_rAnrede = $plDb->fetchArray($_pAnreden)){
$_anreden[$_rAnrede["id"]] = array($_rAnrede["anrede".$_emailObj->getLang()], $_rAnrede["anredede"] );
}
$_anrede = $_person['anrede'];
switch(strtolower($_anrede)){
case "herrn":
case "herr":
case "signor":
case "mr":
case "signore":
case "mr.":
case "sig.":
case "herr dr.":
$_anrede="Sehr geehrter Herr";
break;
case "frau":
case "fraun":
case "signora":
case "signorina":
case "mrs.":
case "ms.":
case "frau dr.":
$_anrede="Sehr geehrte Frau";
break;
case "familie":
case "famiglia":
case "family":
$_anrede="Sehr geehrte Familie";
break;
case "an":
case "an die":
case "spett.le":
case "an das":
$_anrede="Sehr geehrte Damen und Herren";
break;
case "firma":
case "ditta":
case "company":
$_anrede="Sehr geehrte Damen und Herren";
break;
}
$_anredeId = 0;
foreach($_anreden as $_key => $_value){
if(strtolower($_anrede) == strtolower($_value[0]) || strtolower($_anrede) == strtolower($_value[1])){
$_anredeId = $_key;
break;
}
}
}
// country
$_pLaender = $plDb->query('SELECT * FROM laender');
while($_rLand=$plDb->fetchArray($_pLaender)){
$_laender[$_rLand['id']] = $_rLand['land'];
}
$_landId = 0;
$_land = $_person['land'];
foreach($_laender as $_key => $_value){
if(strtolower($_land) == strtolower($_value)){
$_landId = $_key;
break;
}
}
// language
switch($_lang){
case "de":
$_spracheId = 1;
break;
case "en":
$_spracheId = 2;
break;
case "it":
$_spracheId = 3;
break;
case "fr":
$_spracheId = 4;
break;
default:
$_spracheId = 0;
break;
}
// category
$_categoryId = false;
// insert/update person
$_email = trim(strtolower($_person['email']));
if((new Mailcheck)->check($_email) === true){
//$_q = "SELECT id, onoff FROM personen WHERE `unique-asa-id` = '".$_person['asaid']."' AND `parentid` = 0"; // check for asaid
//$_p = $plDb->query( $_q);
if($plDb->numRows($_p) == 0){ // check for mail
$_q = "SELECT id, onoff FROM personen WHERE `email` = '".$_person['email']."' AND `parentid` = 0";
$_p = $plDb->query($_q);
}
if($plDb->numRows($_p) != 0){
$_r = $plDb->fetchArray($_p);
$_personId = $_r['id'];
$_onOff = $_r['onoff'];
// if($_onOff==0){
// $plDb->query("INSERT INTO blacklist SET email='".$_person['email']."', grund='unsubscribe-protel', zeit='".time()."'");
// }
$_q = "UPDATE personen SET `firma` = '".addslashes($_person['firma'])."', ";
$_q .= "`anredeid` = '".$_anredeId."', `titel` = '".addslashes( $_person['titel'])."', `vorname` = '".addslashes( $_person['vorname'])."', ";
$_q .= "`nachname` = '".addslashes( $_person['nachname'])."', ";
$_q .= "`strasse` = '".addslashes( $_person['strasse'])."', `ort` = '".addslashes( $_person['ort'])."', `plz` = '".addslashes( $_person['plz'])."', `landid` = '".$_landId."', ";
$_q .= "`url` = '".addslashes( $_person['url'])."', `telefon` = '".addslashes( $_person['telefon'])."', `mobil` = '".addslashes( $_person['mobil'])."', ";
$_q .= "`fax` = '".addslashes( $_person['fax'])."', `geburtstag` = '".$_person['geburtstag']."', `spracheid` = '".$_spracheId."', `onoff` = 1 WHERE `id` = '".$_personId."' ";
$plDb->query($_q);
/* Write Category (new) */
if($_categoryId !== false){
$_pCat = $plDb->query("SELECT * FROM personen_kategorien WHERE personenid='".$_personId."' and kategorienid='".$_categoryId."'");
if($plDb->numRows($_pCat) == 0){
$_q = "INSERT INTO personen_kategorien (personenid, kategorienid) VALUES ('".$_personId."', '".$_categoryId."')";
$plDb->query($_q);
}
}
$ProtelMessage.='<div style="color:green;">Der Kontakt mit der E-Mail Adresse <i>'.$_email.'</i> existiert bereits und wurde aktualisiert.</div>';
} else {
$_uniqueId = $basicHtml->generateUniqueId("personen");
$_q = "INSERT INTO personen (`firma`, `anredeid`, `titel`, `vorname`, `nachname`, `strasse`, `ort`, `plz`, `landid`, ";
$_q .= "`url`, `telefon`, `mobil`, `fax`, `geburtstag`, `uniqueid`, `email`, `spracheid`, `onoff`, `registrierungszeit`, `eingabekategorieid`) VALUES ";
$_q .= "('".addslashes( $_person['firma'])."', ";
$_q .= "'".$_anredeId."', '".addslashes( $_person['titel'])."', '".addslashes( $_person['vorname'])."', ";
$_q .= "'".addslashes( $_person['nachname'])."', '".addslashes( $_person['strasse'])."', '".addslashes( $_person['ort'])."', '".addslashes( $_person['plz'])."', ";
$_q .= "'".$_landId."', '".addslashes( $_person['url'])."', '".addslashes( $_person['telefon'])."', '".addslashes( $_person['mobil'])."', ";
$_q .= "'".addslashes( $_person['fax'])."', '".$_person['geburtstag']."', ";
$_q .= "'".$_uniqueId."', '".$_email."', '".$_spracheId."', '1', '".time()."', '8')";
$plDb->query($_q);
$_personId = $plDb->lastId();
if($_categoryId !== false){
$_q = "INSERT INTO personen_kategorien (personenid, kategorienid) VALUES ('".$_personId."', '".$_categoryId."')";
$plDb->query($_q);
}
$ProtelMessage.='<div style="color:green;">Ein neuer Kontakt mit der E-Mail Adresse <i>'.$_email.'</i> wurde angelegt.</div>';
}
$_emailObj->addRcptIds( $_personId);
} else {
$ProtelMessage.='<div style="color:red;">Die Personendaten konnten nicht übernommen werden. (E-Mail Adresse <i>'.$_email.'</i> ist ungültig).</div>';
$ProtelMessage.='<div style="color:green;">Bitte geben Sie die Personendaten manuell ein.</div>';
}
// mail body
$_emailData = $_fileContent;
$_emailData = str_replace("\xc4", "Ä", $_emailData);
$_emailData = str_replace("\xbe", "¾", $_emailData);
// room blocks
if(preg_match("[<zimmerblock>(.*)</zimmerblock>]Uism", $_emailData, $_roomblock)){
$glue = '';
if(preg_match_all("|<zimmerres>(.*)</zimmerres>|Uism", $_roomblock[1], $_rooms)){
foreach($_rooms[1] as $key => $_room){
// $_room = $_SERVER['REMOTE_ADDR'] == '92.60.226.232' ? debugRoom($links) : $_room;
// $_room = str_replace('<', '<', $_room);
// $_room = str_replace('>', '>', $_room);
// vd($_room);
$room = parseRoom($_room, $links, $offerTrans[$_lang]);
if(!empty($room)){
$_emailData = preg_replace('|\s*<zimmerres>(.*)</zimmerres>\s*|Uism', $glue.$room, $_emailData, 1);
$glue = $_typ == 'rb' ? '<div style="padding:10px; text-align:center;">UND</div>' : '<div style="padding:10px; text-align:center;">ODER</div>';
}else{
$_emailData = preg_replace('|\s*<zimmerres>(.*)</zimmerres>\s*|Uism', '', $_emailData, 1);
}
}
}
if(preg_match_all("|<pauschale:(.*)>|Uism", $_roomblock[1], $_flatrates)){
foreach($_flatrates[1] as $key => $_flatrate){
$flatrate = parseFlatrate($_flatrate);
if(!empty($flatrate)){
$_emailData = preg_replace('|\s*<pauschale:(.*)>\s*|Uism', $glue.$flatrate, $_emailData, 1);
$glue = $_typ == 'rb' ? '<div style="padding:10px; text-align:center;">UND</div>' : '<div style="padding:10px; text-align:center;">ODER</div>';
}else{
$_emailData = preg_replace('|\s*<pauschale:(.*)>\s*|Uism', '', $_emailData, 1);
}
}
}
if(empty($glue)){
$_emailData = preg_replace('|<zimmerblock>(.*)</zimmerblock>|Uism', '', $_emailData);
}
}
// save arrival and departure with tmp email id in db
// update to correct email id in ppfMail.php after email has been sent! (somewhere near LINE 911)
if(count($arr_dep) > 0 && $_typ == 'rb'){
$now = time();
$saved = array();
$emailid = $tmpemailid = $_emailObj->getEmailId();
foreach($arr_dep as $k => $v){
$arr = getUXT($v[0]);
$dep = getUXT($v[1]);
if($arr && $dep && !in_array($arr."-".$dep,$saved)){
$query = "INSERT INTO email_arrivals_departures (id, emailid, tempemailid, arrival, departure, wordfile, created, modified) VALUES (NULL, 0, '".$tmpemailid."', $arr, $dep, '".$_file."', $now, $now)";
$plDb->query($query);
$saved[] = $arr."-".$dep;
}
}
}
// remove xml
$_emailData = preg_replace('|<briefanrede>(.*)</briefanrede>|Uism', '', $_emailData);
$_emailData = preg_replace('|<asaid>(.*)</asaid>|Uism', '', $_emailData);
$_emailData = preg_replace('|<benutzer>(.*)</benutzer>|Uism', '', $_emailData);
$_emailData = preg_replace('|<email>(.*)</email>|Uism', '', $_emailData);
$_emailData = preg_replace('|<anrede>(.*)</anrede>|Uism', '', $_emailData );
$_emailData = preg_replace('|<titel>(.*)</titel>|Uism', '', $_emailData );
$_emailData = preg_replace('|<vorname>(.*)</vorname>|Uism', '', $_emailData );
$_emailData = preg_replace('|<nachname>(.*)</nachname>|Uism', '', $_emailData );
$_emailData = preg_replace('|<strasse>(.*)</strasse>|Uism', '', $_emailData );
$_emailData = preg_replace('|<plz>(.*)</plz>|Uism', '', $_emailData );
$_emailData = preg_replace('|<ort>(.*)</ort>|Uism', '', $_emailData );
$_emailData = preg_replace('|<land>(.*)</land>|Uism', '', $_emailData );
$_emailData = preg_replace('|<email>(.*)</email>|Uism', '', $_emailData );
$_emailData = preg_replace('|<geburtstag>(.*)</geburtstag>|Uism', '', $_emailData );
$_emailData = preg_replace('|<typ>(.*)</typ>|Uism', '', $_emailData );
$_emailData = preg_replace('|<betreff>(.*)</betreff>|Uism', '', $_emailData );
$_emailData = preg_replace('|<sprache>(.*)</sprache>|Uism', '', $_emailData );
$_emailData = preg_replace('|<saison>(.*)</saison>|Uism', '', $_emailData );
$_emailData = preg_replace('|<identity>(.*)</identity>|Uism', '', $_emailData );
$_emailData = preg_replace('|<headerbild>(.*)</headerbild>|Uism', '', $_emailData );
foreach( $_personItemsToFind as $_value) {
$_emailData = str_replace('<'.$_value.'>', '' , $_emailData );
$_emailData = str_replace('</'.$_value.'>', '' , $_emailData );
}
// do some formating
$_linefeed="\r\n";
$_emailData = preg_replace( "|</li>\n<li>|Uism", '</li><li>', $_emailData );
$_emailData = preg_replace( "|</li>\r\n<li>|Uism", '</li><li>', $_emailData );
$_emailData = preg_replace( '|<datum>(.*)</datum>(.*)<internalnumber>(.*)</internalnumber>|Uism', '<datum>$1</datum><internalnumber>$3</internalnumber>', $_emailData );
$_emailData = str_replace('<datum>', '<div style="text-align:right;">' , $_emailData );
$_emailData = str_replace('</datum>', '</div>' , $_emailData );
$_emailData = str_replace('<textblock1>'.$_linefeed, '', $_emailData );
$_emailData = str_replace('<textblock1>', '' , $_emailData );
$_emailData = str_replace('</textblock1>'.$_linefeed, '' , $_emailData );
$_emailData = str_replace('</textblock1>', '' , $_emailData );
$_emailData = str_replace('<textblock2>'.$_linefeed, '<textblock2>', $_emailData );
$_emailData = str_replace('<textblock2>', '<hr class="noborderstart"><div class="textblock2">' , $_emailData );
$_emailData = str_replace('</textblock2>'.$_linefeed, '</textblock2>' , $_emailData );
$_emailData = str_replace('</textblock2>', '</div><hr class="noborderstop">' , $_emailData );
$_emailData = str_replace('<textblock3>'.$_linefeed, '<textblock3>', $_emailData );
$_emailData = str_replace('<textblock3>', '<hr class="noborderstart"><div class="textblock3">' , $_emailData );
$_emailData = str_replace('</textblock3>'.$_linefeed, '</textblock3>' , $_emailData );
$_emailData = str_replace('</textblock3>', '</div><hr class="noborderstop">' , $_emailData );
$_emailData = str_replace('<noborder>'.$_linefeed, '<noborder>', $_emailData );
$_emailData = str_replace('<noborder>', '<hr class="noborderstart"><div class="noborder">' , $_emailData );
$_emailData = str_replace('</noborder>'.$_linefeed, '</noborder>' , $_emailData );
$_emailData = str_replace('</noborder>', '</div><hr class="noborderstop">' , $_emailData );
$_emailData = str_replace('<fett>', '<strong>' , $_emailData );
$_emailData = str_replace('</fett>', '</strong>' , $_emailData );
$_emailData = str_replace('<liste>'.$_linefeed, '<liste>' , $_emailData );
$_emailData = str_replace('<liste>', '<ul>' , $_emailData );
$_emailData = str_replace('</liste>'.$_linefeed, '</ul>' , $_emailData );
$_emailData = str_replace('</liste>', '</ul>' , $_emailData );
$_emailData = str_replace('<punkt>'.$_linefeed, '<punkt>' , $_emailData );
$_emailData = str_replace('<punkt>', '<li>' , $_emailData );
$_emailData = str_replace('</punkt>'.$_linefeed, '</punkt>' , $_emailData );
$_emailData = str_replace('</punkt>', '</li>' , $_emailData );
$_emailData = trim($_emailData);
$_emailData = str_replace( chr(1), "\r\n", $_emailData);
$_emailData = str_replace( chr(11), "\r\n", $_emailData);
$_emailData = str_replace( chr(13), "\r\n", $_emailData);
$_emailData = str_replace( chr(12), "\r\n", $_emailData);
$_emailData = str_replace( chr(9), "\r\n", $_emailData);
$_emailData = str_replace( chr(7), "\r\n", $_emailData);
$_emailData = str_replace( chr(132), "\"", $_emailData);
$_emailData = str_replace( chr(147), "\"", $_emailData);
$_emailData = str_replace( chr(196), "-", $_emailData);
$_emailData = str_replace( chr(150), "-", $_emailData);
$_emailData = str_replace( chr(151), "-", $_emailData);
$_emailData = str_replace( chr(190), "-", $_emailData);
$_emailData = str_replace( chr(128), "§", $_emailData);
$_emailData = str_replace( '§', "€", $_emailData);
$_emailData = str_replace( "\n", "\r\n", $_emailData);
$_finalEmailData = '';
$_emailData = preg_replace( "|\t|", "", $_emailData);
$_emailData = explode( "\r\n", $_emailData);
for($i = 0; $i <= sizeof($_emailData); $i++){
if(trim($_emailData[$i]) == "" && trim($_emailData[$i+1]) == "" && trim($_emailData[$i+2]) == "" && trim( $_emailData[$i+3]) == ""){
// mehr als 4 Zeilen entfernen (vorkorrektur)
} else {
$_finalEmailData .= $_emailData[$i];
}
}
$_finalEmailData = nl2br($_finalEmailData);
// fixes
$_finalEmailData = str_replace('</td></tr><br />', '</td></tr>', $_finalEmailData);
// // set default attachment
// if(in_array($_typ,array('ab','rb')) && $_lang == 'de'){
// $row = $plDb->faq("SELECT id, titel, filename FROM attachments WHERE id=1");
// $_emailObj->addAttachment($row['titel'].' ('.$row['filename'].')', 'list', $row['id']);
// }
$Base64Encode=true;
$_finalEmailData = str_replace('src="http://', 'src="https://', $_finalEmailData);
$_emailObj->setBody( $_finalEmailData );
$_emailObj->saveMe();
$_emailObj->loadMe();
return $_emailObj;
}
function parseRoom($infos, $links, $translations){
global $ppfConfig;
global $arr_dep;
$reduced = false;
if(preg_match("[<anreise>(.*)</anreise>]Uism", $infos, $_ai)){ // arrival infos
$arrival = trim($_ai[1]);
}else{
$arrival = false;
}
if(preg_match("[<abreise>(.*)</abreise>]Uism", $infos, $_di)){ // arrival infos
$departure = trim($_di[1]);
}else{
$departure = false;
}
if($arrival && $departure){
$arr_dep[] = array($arrival,$departure);
}
if(preg_match("[<tage>(.*)</tage>]Uism", $infos, $_di)){ // days infos
$days = trim($_di[1]);
}else{
$days = false;
}
if(preg_match("[<erwachsene>(.*)</erwachsene>]Uism", $infos, $_ai)){ // adults infos
$adults = trim($_ai[1]);
}else{
$adults = false;
}
if(preg_match("[<kinder>(.*)</kinder>]Uism", $infos, $_ki)){ // kids infos
$kids = trim($_ki[1]);
}else{
$kids = false;
}
if(preg_match("[<kleinkinder>(.*)</kleinkinder>]Uism", $infos, $_bi)){ // baby infos
$babies = trim($_bi[1]);
}else{
$babies = false;
}
if(preg_match("[<zimmernr>(.*)</zimmernr>]Uism", $infos, $_rni)){ // room number infos
$room_numbers = trim($_rni[1]);
$room_numbers = explode(chr(13),$room_numbers); // get kategories per offer
}else{
$room_numbers = false;
}
if(preg_match("[<zimmer>(.*)</zimmer>]Uism", $infos, $_ri)){ // room infos
$_ri = trim($_ri[1]);
$_rils = array();
if(preg_match("|{IMG:(.*)}(.*){DESC:(.*)}|Uism", $_ri, $_ril)){ // get romms per offer
$_rils[] = $_ril[0];
}
$rooms = array();
foreach($_rils as $v){
$k = count($rooms);
$v = trim($v);
if(preg_match("[{IMG:(.*)}]Uism", $v, $_ri_kategorie)){ // room infos kategorie
$rooms[$k]['category'] = trim($_ri_kategorie[1]);
$v = trim(str_replace($_ri_kategorie[0],'',$v));
}
if(preg_match("[{DESC:(.*)}]Uism", $v, $_ri_desc)){ // room infos description
$rooms[$k]['description'] = trim($_ri_desc[1]);
$v = nl2br(trim(str_replace($_ri_desc[0],'',$v)));
}
$ri_parts = explode(chr(9),$v);
if(count($ri_parts) == 6){
$rooms[$k]['number'] = trim($ri_parts[0]);
$rooms[$k]['name'] = trim($ri_parts[1]);
$rooms[$k]['arrival'] = trim($ri_parts[2]);
$rooms[$k]['departure'] = trim($ri_parts[3]);
$rooms[$k]['persons'] = trim($ri_parts[4]);
$rooms[$k]['food'] = trim($ri_parts[5]);
}
}
}else{
$rooms = false;
}
if(preg_match("[<kategorie>(.*)</kategorie>]Uism", $infos, $_ci)){ // category infos
$categories = trim($_ci[1]);
$categories = explode(chr(13),$categories); // get kategories per offer
}else{
$categories = false;
}
if(preg_match("[<preise>(.*)</preise>]Uism", $infos, $_pi)){ // price infos
$_pi = trim($_pi[1]);
$_pi = explode(chr(13),$_pi); // get price rows
$seasons = 0;
$addBedsNights = 0;
$prices = array();
foreach($_pi as $v){
$k = count($prices);
// $v = trim($v);
$pi_parts = explode(chr(9),$v);
if(count($pi_parts) == 5){
$prices[$k]['text'] = trim($pi_parts[0]);
$prices[$k]['number'] = trim($pi_parts[1]);
$prices[$k]['price'] = trim($pi_parts[2]);
$prices[$k]['discount'] = trim($pi_parts[3]);
$prices[$k]['sum'] = trim($pi_parts[4]);
if(preg_match("[\s([0-9]{1,2}.[0-9]{1,2}.)(.*)([0-9]{1,2}.[0-9]{1,2}.)\s]Uism", $prices[$k]['text'], $_pti)){ // "found" date in text -> adult or full-paing children
$prices[$k]['age'] = false;
$prices[$k]['time'] = array('from' => $_pti[1], 'to' => $_pti[3]);
if($reduced === false && !empty($prices[$k]['discount'])){
$reduced = $prices[$k]['discount'];
}
$seasons++;
}else if(preg_match("[\s[0-9]{1,2} - [0-9]{1,2}\s]Uism", $prices[$k]['text'], $_pti)){ // "found" age in text -> children
$prices[$k]['age'] = $_pti[0];
$prices[$k]['time'] = false;
}else { // count additional bed nights
$addBedsNights += $prices[$k]['number'];
unset($prices[$k]);
}
}
}
// if($addBedsNights > 0){ // additional bed -> do some math here
// $calc = $prices[$k]['number']/$days;
// if($calc > 0 && $kids >= $calc){
// $adults += $calc;
// $kids -= $calc;
// }
// }
// "group" prices
if($seasons > 1){
$groups = array();
for($a = 0; $a < $seasons; $a++){
$groups[$a] = array();
}
$group = 0;
foreach($prices as $price){
if($group >= $seasons){
$group = 0;
}
$groups[$group][] = $price;
$group++;
}
}else{
$groups = array($prices);
}
}else{
$prices = false;
}
if(preg_match("[<gesamtbetrag>(.*)</gesamtbetrag>]Uism", $infos, $_tp)){ // total price
$total = trim($_tp[1]);
}else{
$total = false;
}
$result = '';
if($arrival && $departure && $days && is_array($room_numbers) && is_array($rooms) && is_array($categories) && is_array($prices) && $total){
$box = '<table bgcolor="#fff5ce" cellpadding="0" width="540" style="width:540px; background-color:#fff5ce;" cellspacing="0">';
$box.= '<tr>';
$box.= '<td width="540" style="width:540px; padding:10px;" align="center">';
// vd($rooms);
// rooms start
foreach($rooms as $k => $v){
if(array_key_exists($v['category'],$links)){
$box.= '<table bgcolor="#fff5ce" cellpadding="0" width="540" style="width:540px; background-color:#fff5ce;" align="center" cellspacing="0">';
if($links[$v['category']]['nr'][$room_numbers[$k]]['sketch'] !== false){ // with sketch
$box.= '<tr>';
$box.= '<td height="20" width="390" style="height: 20px; width:390px; vertical-align:top;" valign="top">';
$box.= '<span class="imageheadline2">'.$v['name'].'</span>';
$box.= '</td>';
$box.= '<td width="140" style="width:150px; text-align:right; vertical-align:top" valign="top" rowspan="3">';
$box.= '<img src="'.$ppfConfig['path']['url'].'/'.$ppfConfig['path']['folder']['images'].'/fixed/zimmer/skizzen/'.$links[$v['category']]['nr'][$room_numbers[$k]]['sketch'].'" border="0" width="140" height="120" alt="'.$v['name'].'" />';
$box.= '</td>';
$box.= '</tr>';
$box.= '<tr>';
$box.= '<td height="5" width="390" style="height: 5px; width:390px; vertical-align:top;">';
$box.= '<hr style="background-color:#746D6A; height:1px; color:#746D6A; border:0;" />';
$box.= '</td>';
$box.= '</tr>';
$box.= '<tr>';
$box.= '<td width="390" style="width:390px; vertical-align:top;" valign="top">';
$box.= $v['description'];
$box.= '</td>';
$box.= '</tr>';
}else{ // without sketch
$box.= '<tr>';
$box.= '<td height="20" width="540" style="height: 20px; width:540px; vertical-align:top;" valign="top">';
$box.= '<span class="imageheadline2">'.$v['name'].'</span>';
$box.= '</td>';
$box.= '<tr>';
$box.= '<td height="5" width="540" style="height: 5px; width:540px; vertical-align:top;">';
$box.= '<hr style="background-color:#746D6A; height:1px; color:#746D6A; border:0;" />';
$box.= '</td>';
$box.= '</tr>';
$box.= '</tr>';
$box.= '<tr>';
$box.= '<td width="540" style="width:540px; vertical-align:top;" valign="top">';
$box.= $v['description'];
$box.= '</td>';
$box.= '</tr>';
}
$box.= '</table>';
}
}
// rooms end
// prices start
$box.= '<table bgcolor="#fff5ce" cellpadding="0" width="540" style="width:540px; background-color:#fff5ce;" align="center" cellspacing="0">';
$box.= '<tr>';
$box.= '<td colspan="3" height="5" width="540" style="height: 5px; width:540px; vertical-align:top;">';
$box.= '<hr style="background-color:#746D6A; height:1px; color:#746D6A; border:0;" />';
$box.= '</td>';
$box.= '</tr>';
$box.= '<tr>';
$box.= '<td width="220" style="width:220px; vertical-align:top;" valign="top">';
$box.= '<table bgcolor="#fff5ce" cellpadding="0" width="220" style="width:220px; background-color:#fff5ce;" align="center" cellspacing="0">';
$box.= '<tr>';
$box.= '<td width="60" style="width:60px; vertical-align:top;">';
$box.= '<span class="style1">'.$translations[0].':</span>';
$box.= '</td>';
$box.= '<td width="60" style="width:60px; vertical-align:top;">';
$box.= $arrival;
$box.= '</td>';
$box.= '<td width="10" style="width:10px; vertical-align:top;"> </td>';
$box.= '<td width="80" style="width:80px; vertical-align:top;">';
$box.= '<span class="style1">'.$translations[2].':</span>';
$box.= '</td>';
$box.= '<td width="10" style="width:10px; vertical-align:top;">';
$box.= $adults;
$box.= '</td>';
$box.= '</tr>';
$box.= '<tr>';
$box.= '<td width="60" style="width:60px; vertical-align:top;">';
$box.= '<span class="style1">'.$translations[1].':</span>';
$box.= '</td>';
$box.= '<td width="60" style="width:60px; vertical-align:top;">';
$box.= $departure;
$box.= '</td>';
$box.= '<td width="10" style="width:10px; vertical-align:top;"> </td>';
$box.= '<td width="80" style="width:80px; vertical-align:top;">';
$box.= '<span class="style1">'.$translations[3].':</span>';
$box.= '</td>';
$box.= '<td width="10" style="width:10px; vertical-align:top;">';
$box.= $kids;
$box.= '</td>';
$box.= '</tr>';
$box.= '</table>';
$box.= '</td>';
$box.= '<td width="30" style="width:30px;"> </td>';
$box.= '<td width="290" style="width:290px; vertical-align:top;" valign="top">';
// price list start
$box.= '<table bgcolor="#fff5ce" cellpadding="0" width="290" style="width:290px; background-color:#fff5ce;" align="center" cellspacing="0">';
foreach($groups as $k => $group){
foreach($group as $price){
$prc = empty($price['sum']) ? number_format(0,2,",",".") : $price['price'];
if($price['age'] !== false){
$box.= '<tr>';
$box.= '<td width="120" style="width:120px; vertical-align:top;"> </td>';
$box.= '<td width="125" style="width:125px; vertical-align:top;">'.$translations[10].' '.$price['age'].' '.$translations[11].'</td>';
$box.= '<td width="45" style="width:45px; vertical-align:top; text-align: right;">€ '.$prc.'</td>';
$box.= '</tr>';
}else if(is_array($price['time'])){
$date = $k == 0 ? ' '.$translations[12].' '.$price['time']['to'] : ' '.$translations[13].' '.$price['time']['from'];
$box.= '<tr>';
$box.= '<td width="120" style="width:120px; vertical-align:top;"><span class="style1">'.$translations[4].$date.'</span></td>';
$box.= '<td width="125" style="width:125px; vertical-align:top;">'.$translations[9].'</td>';
$box.= '<td width="45" style="width:45px; vertical-align:top; text-align: right;">€ '.$prc.'</td>';
$box.= '</tr>';
}
}
}
$box.= '</table>';
// price list end
$box.= '</td>';
$box.= '</tr>';
$box.= '</table>';
// prices end
// total start
$box.= '<table bgcolor="#fff5ce" cellpadding="0" width="540" style="width:540px; background-color:#fff5ce;" align="center" cellspacing="0">';
$box.= '<tr>';
$box.= '<td colspan="2" height="5" width="540" style="height: 5px; width:540px; vertical-align:top;">';
$box.= '<hr style="background-color:#746D6A; height:1px; color:#746D6A; border:0;" />';
$box.= '</td>';
$box.= '</tr>';
if($reduced === false){
$box.= '<tr>';
$box.= '<td width="400" style="width:400px;">';
$box.= '<span class="style1">'.sprintf($translations[5],$days).'</span>';
$box.= '</td>';
$box.= '<td width="140" style="width:140px; text-align: right;">';
$box.= '€ ' . $total;
$box.= '</td>';
$box.= '</tr>';
}else{
$reducedTxt = $reduced == '10%' ? $translations[6] : $translations[14];
$box.= '<tr>';
$box.= '<td width="400" style="width:400px;">';
$box.= '<span class="style1">'.sprintf($reducedTxt,$reduced).'</span>';
$box.= '</td>';
$box.= '<td width="140" style="width:140px; text-align: right;">';
$box.= '€ ' . $total;
$box.= '</td>';
$box.= '</tr>';
}
if($adults > 2){
$box.= '<tr>';
$box.= '<td colspan="2"> </td>';
$box.= '</tr>';
$box.= '<tr>';
$box.= '<td colspan="2">'.$translations[15].'</td>';
$box.= '</tr>';
}
$box.= '</table>';
// total end
$box.= '</td>';
$box.= '</tr>';
$box.= '</table>';
// finish
$result = stripNL($box);
}
return $result;
}
function parseFlatrate($info){
global $globalSprache;
global $globalSaison;
global $ppfConfig;
global $plDb;
$ret = '';
$nr = 1;
$search = trim($info);
if(is_numeric($search)){
$query = "SELECT content".$globalSprache." as content FROM pauschalen WHERE id='".$search."' LIMIT 1";
}else{
$query = "SELECT content".$globalSprache." as content FROM pauschalen WHERE short='".$search."' LIMIT 1";
}
$res = $plDb->query($query);
if($plDb->numRows($res)){
$row = $plDb->fetchArray($res);
$ret = str_replace(array("\t","\r\n","\n\r","\r","\n"),array("","","","",""),$row['content']);
$ret = str_replace(array("src='/",'src="/'),array("src='".$ppfConfig['path']['url']."/",'src="'.$ppfConfig['path']['url']."/"),$ret);
$ret = substr($ret,-6) == '<br />' ? substr($ret,0,-6) : $ret;
$ret = '<table cellpadding="0" cellspacing="0" align="center" width="540" style="width:540px;"><tr><td>'.$ret.'</td></tr></table>';
}
return trim($ret);
}
function parseTextvorlage($matches){
global $globalSprache;
global $globalSaison;
global $ppfConfig;
global $plDb;
$ret = '';
$nr = 1;
$search = trim($matches[1]);
if(is_numeric($search)){
$query = "SELECT textblock".$globalSprache." as textblock, specialdesign, specialdesign2 FROM vorlageninhalte WHERE id='".$search."' LIMIT 1";
}else{
$query = "SELECT textblock".$globalSprache." as textblock, specialdesign, specialdesign2 FROM vorlageninhalte WHERE titel='".$search."' LIMIT 1";
}
$res = $plDb->query($query);
if($plDb->numRows($res)){
$row = $plDb->fetchArray($res);
$nr = $row['specialdesign'] == 1 ? 2 : $nr;
// $nr = $row['specialdesign2'] == 1 ? 3 : $nr;
$ret = str_replace(array("\t","\r\n","\n\r","\r","\n"),array("","","","",""),$row['textblock']);
$ret = str_replace(array("src='/",'src="/'),array("src='".$ppfConfig['path']['url']."/",'src="'.$ppfConfig['path']['url']."/"),$ret);
$ret = '<textblock'.$nr.'>'.trim($ret).'</textblock'.$nr.'>';
}
return $ret;
}
function debugRoom($links){
$key = array_rand($links,1);
$room = array_rand($links[$key]['nr']);
$discounts = array('5%','10%','15%','');
$discount = $discounts[array_rand($discounts)];
return '<anreise>'.chr(13).date("d.m.Y",strtotime("+7 days")).chr(13).'</anreise>'.chr(13).'<abreise>'.chr(13).date("d.m.Y",strtotime("+13 days")).chr(13).'</abreise>'.chr(13).'<tage>'.chr(13).'6'.chr(13).'</tage>'.chr(13).'<erwachsene>'.chr(13).'2'.chr(13).'</erwachsene>'.chr(13).'<kinder>'.chr(13).'7'.chr(13).'</kinder>'.chr(13).'<kleinkinder>'.chr(13).'0'.chr(13).'</kleinkinder>'.chr(13).'<zimmernr>'.chr(13).$room.chr(13).'</zimmernr>'.chr(13).'<zimmer>'.chr(13).'{IMG:'.$key.'}2'.chr(9).$links[$key]['desc'].chr(9).date("d.m.Y",strtotime("+7 days")).chr(9).date("d.m.Y",strtotime("+13 days")).chr(9).'2'.chr(9).'HP{DESC:90m² - Nichraucher - Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.}'.chr(13).'</zimmer>'.chr(13).'<kategorie>'.chr(13).$links[$key]['desc'].chr(13).'</kategorie>'.chr(13).'<preise>2 Pers. vom '.date("d.m.",strtotime("+7 days")).' bis '.date("d.m.Y",strtotime("+13 days")).' '.$links[$key]['desc'].chr(9).'12'.chr(9).'127,00'.chr(9).$discount.chr(9).'1.371,60'.chr(13).'1 x Kinderpreis 0 - 2 Jahre'.chr(9).'6'.chr(9).'127,00'.chr(9).'100%'.chr(9).''.chr(13).'1 x Kinderpreis 2 - 5 Jahre'.chr(9).'6'.chr(9).'41,00'.chr(9).''.chr(9).'246,00'.chr(13).'1 x Kinderpreis 6 - 8 Jahre'.chr(9).'6'.chr(9).'48,00'.chr(9).''.chr(9).'288,00'.chr(13).'1 x Kinderpreis 9 - 13 Jahre'.chr(9).'6'.chr(9).'55,00'.chr(9).''.chr(9).'330,00'.chr(13).'1 x Kinderpreis 14 - 18 Jahre'.chr(9).'6'.chr(9).'66,00'.chr(9).''.chr(9).'396,00'.chr(13).'Zustellbett'.chr(9).'12'.chr(9).'127,00'.chr(9).'20%'.chr(9).'609,60'.chr(13).'</preise>'.chr(13).'<gesamtbetrag>'.chr(13).'3241,20'.chr(13).'</gesamtbetrag>';
}
function getUXT($date){
if(strpos($date,"-") !== false){ // en -> 1961-02-22
$d = substr($date,8,2);
$m = substr($date,5,2);
$y = substr($date,0,4);
$res = mktime(0,0,0,$m,$d,$y);
}else if(strpos($date,"/") !== false){ // it -> 22/02/1961
$d = substr($date,0,2);
$m = substr($date,3,2);
$y = substr($date,6,4);
$res = mktime(0,0,0,$m,$d,$y);
}else if(strpos($date,".") !== false){ // de
$d = substr($date,0,2);
$m = substr($date,3,2);
$y = substr($date,6,4);
$res = mktime(0,0,0,$m,$d,$y);
}else{
$res = false;
}
return $res;
}
function stripNL($text){
$nl = array("\t" => "", "\n" => "", "\r" => "", "\0" => "", "\x0B" => "");
$text = strtr($text, $nl);
return $text;
}
?>Editor is loading...