dbConnect(); // $GLOBALS["myDBConnection"]->setValue("SqlStatement","SET Keyword 'utf8'"); // $myKeywordQuery = $GLOBALS["myDBConnection"]->dbSelect(); // $GLOBALS["myDBConnection"]->setValue("SqlStatement","SET CHARACTER SET 'utf8'"); // $myKeywordQuery = $GLOBALS["myDBConnection"]->dbSelect(); $ActProj = 0; if ((isset($_GET["Pid"]) && strlen($_GET["Pid"]) > 0)) { $ProjectArray = array(); $getProject_sql = "SELECT * FROM pp_projects WHERE SecureKey='" . addslashes($_GET["Pid"]) . "' AND Active=1 LIMIT 1"; $GLOBALS["myDBConnection"]->setValue("SqlStatement", $getProject_sql); $myProjectQuery = $GLOBALS["myDBConnection"]->dbSelect(); while ($myProjectResult = mysql_fetch_array($myProjectQuery)) { $ActProj = 1; $KWAdd = ""; if ($myProjectResult["AddKeyword"] == "1") { $KWAdd = "/" . $myProjectResult["MainKeyword"]; } $ProjectArray["Project"] = array( "ProjectID" => $myProjectResult["ID"], "Domain" => $myProjectResult["Domain"], "Template" => $myProjectResult["Template"], "Lang" => $myProjectResult["Lang"], "MainKeyword" => $myProjectResult["MainKeyword"], "BaseLink" => $myProjectResult["Baselink"] . $KWAdd, "URL_KW_PRAEFIX" => $myProjectResult["URL_KW_PRAEFIX"], "URL_KW_SUFFIX" => $myProjectResult["URL_KW_SUFFIX"], "txt_add_site" => $myProjectResult["txt_add_site"], "KW_trenner" => $myProjectResult["KW_trenner"], "lnk_cl" => $myProjectResult["lnk_cl"], "bg_cl" => $myProjectResult["bg_cl"], "txt_cl" => $myProjectResult["txt_cl"], "word_separator" => $myProjectResult["word_separator"], "insite_template" => $myProjectResult["insite_template"], "insite_template_utf8" => $myProjectResult["insite_template_utf8"], "kw_rows" => $myProjectResult["kw_rows"], "linkmanager" => $myProjectResult["linkmanager"], ); $SpecKWLink = "http://www." . $ProjectArray["Project"]["Domain"]; $getCustomerInfos_sql = "SELECT * FROM pp_customers WHERE ID=" . $myProjectResult["Customer_ID"] . " AND active_flag=1 LIMIT 1"; $GLOBALS["myDBConnection"]->setValue("SqlStatement", $getCustomerInfos_sql); $myCustomerQuery = $GLOBALS["myDBConnection"]->dbSelect(); while ($myCustomerResult = mysql_fetch_array($myCustomerQuery)) { $ProjectArray["Customer"] = array( "CustomerID" => $myCustomerResult["ID"], "Company" => $myCustomerResult["Company"], "Name" => $myCustomerResult["Name"], "Firstname" => $myCustomerResult["Firstname"], "Street" => $myCustomerResult["Street"], "HN" => $myCustomerResult["HN"], "Postal" => $myCustomerResult["Postal"], "Town" => $myCustomerResult["Town"], "Phone" => $myCustomerResult["Phone"], "Email" => $myCustomerResult["Email"] ); if (isset($_GET["KW"]) && $_GET['KW'] != 'interessante_Zusatzthemen') { $Repl = array("_" => " "); if ($ProjectArray["Project"]["word_separator"] == "-") { $Repl["-"] = " "; } $KWSql = strtr($_GET["KW"], $Repl); $AddOn = " AND Keyword='" . mysql_escape_string(utf8_decode($KWSql)) . "' order by prio,Keyword LIMIT 1"; } if ($AddOn == "") { $AddOn = " order by prio,Keyword LIMIT 1 "; } else { // $AddOn = " order by Keyword"; } // canonical // if (isset($_GET["KW"])){ // $canonicalkw = strtr($_GET["KW"],$Repl); // }else{ // $canonicalkw = $ProjectArray["Project"]["MainKeyword"] ; // } $getKeywords_sql = "SELECT * FROM pp_keywords WHERE Project_ID=" . $myProjectResult["ID"] . " AND active=1 AND Customer_ID=" . $myCustomerResult["ID"] . $AddOn; $GLOBALS["myDBConnection"]->setValue("SqlStatement", $getKeywords_sql); #echo $getKeywords_sql; $myKeywordQuery = $GLOBALS["myDBConnection"]->dbSelect(); while ($myKeywordResult = mysql_fetch_array($myKeywordQuery)) { $DeepLink = $myKeywordResult["Deeplink"]; $DeepLinkActive = $myKeywordResult["ActivateDeeplink"]; $TrivLink = $myKeywordResult["Triviallink"]; $TrivLinkActive = $myKeywordResult["ActivateTriviallink"]; $ProjectArray["Keyword"] = array( "KeywordID" => $myKeywordResult["ID"], "Keyword" => $myKeywordResult["Keyword"], "MetaDescription" => $myKeywordResult["MetaDescription"], "MetaKeywords" => $myKeywordResult["MetaKeywords"], "Browsertitle" => $myKeywordResult["Browsertitle"], "Title" => $myKeywordResult["Title"], "Listing_1" => $myKeywordResult["Listing_1"], "Listing_2" => $myKeywordResult["Listing_2"], "Listing_3" => $myKeywordResult["Listing_3"], "Listing_4" => $myKeywordResult["Listing_4"], "Listing_5" => $myKeywordResult["Listing_5"], "zusTXTKW" => html_entity_decode($myKeywordResult['zusTXTKW']), "KW_Image" => $myKeywordResult['image_url'], "KW_Href" => $myKeywordResult['image_href'], "include_into_url" => $myKeywordResult['include_into_url'], "include_into_url_aktiv" => $myKeywordResult['include_into_url_aktiv'], "include_after_content" => $myKeywordResult['include_after_content'], "include_utf_kodiert" => $myKeywordResult['include_utf_kodiert'], "include_KWTXT_utf_kodiert" => $myKeywordResult['include_KWTXT_utf_kodiert'] ); $formatArray = array("strong", "em"); srand(microtime() * 1000000); // Wieviel Textzeilen gibt es $LinesCount = 0; for($i = 0;$i <= 20;$i++) { if ($myKeywordResult["Contentline_" . $i] != "") { $LinesCount++; } // echo $LinesCount; $CONTENT_TMP .= $myKeywordResult["Contentline_" . $i] . " "; } $CONTENT_TMP = eregi_replace($myKeywordResult["Keyword"], '###' . $myKeywordResult["Keyword"], $CONTENT_TMP); $kws = explode('###', $CONTENT_TMP); foreach($kws as $k => $v) { $randFormat = rand(0, (count($formatArray) - 1)); $suchmuster = '(' . $myKeywordResult["Keyword"] . ')'; $ersatz = '<' . $formatArray[$randFormat] . '>\\1'; $ProjectArray["Keyword"]["Content_TMP"][$k] .= eregi_replace($suchmuster, $ersatz, $v); } /*for($i=1;$i<=$LinesCount;$i++) { $randFormat = rand(0,(count($formatArray)-1)); # Update T. Tittel, 31.1.2008 # Gro? und Kleinschreibung wurde nicht beachtet bzw gefunden und ersetzt # $ProjectArray["Keyword"]["Contentline_".$i] = str_replace(($myKeywordResult["Keyword"]),"<".$formatArray[$randFormat].">".$myKeywordResult["Keyword"]."",($myKeywordResult["Contentline_".$i])); $suchmuster = '('.$myKeywordResult["Keyword"].')'; $ersatz = '<'.$formatArray[$randFormat].'>\\1'; $ProjectArray["Keyword"]["Contentline_".$i] = eregi_replace($suchmuster, $ersatz, $myKeywordResult["Contentline_".$i]); }*/ // echo $zufall; if (strlen($TrivLink) > 0 && $TrivLinkActive == "1") { do { $zufall = rand(1, sizeOf($kws)); $ProjectArray["Keyword"]["Content_TMP"][$zufall] = eregi_replace(($myKeywordResult["Keyword"]), "" . $myKeywordResult["Keyword"] . "", ($ProjectArray["Keyword"]["Content_TMP"][$zufall])); } while (eregi($myKeywordResult["Keyword"], $ProjectArray["Keyword"]["Content_TMP"][$zufall]) == false); } if (strlen($DeepLink) > 0 && $DeepLinkActive == "1") { $SpecKWLink = $DeepLink; } } $getOtherKeywords_sql = "SELECT * FROM pp_keywords WHERE Project_ID=" . $myProjectResult["ID"] . " AND active=1 AND Customer_ID=" . $myCustomerResult["ID"] . " order by prio,Keyword"; // if($_SERVER["REMOTE_ADDR"]=="84.186.193.82") echo $getOtherKeywords_sql; $GLOBALS["myDBConnection"]->setValue("SqlStatement", $getOtherKeywords_sql); $myOtherKeywordQuery = $GLOBALS["myDBConnection"]->dbSelect(); while ($myOtherKeywordResult = mysql_fetch_array($myOtherKeywordQuery)) { $ProjectArray["KeywordList"][] = array( "Keyword" => $myOtherKeywordResult["Keyword"] ); } $NoKw = count($ProjectArray["KeywordList"]); $EntriesPerColumn = $NoKw / $ProjectArray["Project"]["kw_rows"]; $KWList = array(); $counter = 0; $column = 0; foreach($ProjectArray["KeywordList"] as $KeywordItem) { $counter++; $KWList[$column][] = $KeywordItem["Keyword"]; if ($counter >= $EntriesPerColumn) { $column++; $counter = 0; } } $KWList1 = ""; foreach($KWList[0] as $KWList1Array) { $KWList1 .= "" . $KWList1Array . "
"; } if (is_array($KWList[1])) { $KWList2 = ""; foreach($KWList[1] as $KWList2Array) { $KWList2 .= "" . $KWList2Array . "
"; } } if (is_array($KWList[2])) { $KWList3 = ""; foreach($KWList[2] as $KWList3Array) { $KWList3 .= "" . $KWList3Array . "
"; } } $TemplateListing = $GLOBALS["usefulTools"]->readInFiles("templates/templates/" . $ProjectArray["Project"]["Template"] . "/listing.htm"); $MyListings = ""; for($l = 0;$l <= 5;$l++) { if (strlen($ProjectArray["Keyword"]["Listing_" . $l]) > 0) { $MyListings .= str_replace("##LISTING_POINT##", $ProjectArray["Keyword"]["Listing_" . $l], $TemplateListing) . "\n"; } } // Canonical // $canonicalURL = $ProjectArray["Project"]["BaseLink"]."/".$ProjectArray["Project"]["URL_KW_PRAEFIX"].str_replace(" ",$ProjectArray["Project"]["word_separator"],$canonicalkw).".htm"; // # KW Wolke $KWW = array(); $KWWh = array(); $erg = $Pdb->query("SELECT kw.Keyword, kw.ID FROM pp_keywords kw, pp_projects p WHERE p.SecureKey='" . mysql_real_escape_string($_GET['Pid']) . "' AND kw.Active ='1' AND kw.Project_ID = p.ID "); $i = 0; while ($res = $erg->fetchRow()) { $erghit = $Pdb->query("SELECT COUNT(t.Keyword) as hits, t.KW FROM pp_tracking t WHERE t.Keyword = '" . $res['ID'] . "' AND t.Mode='out' GROUP BY t.Keyword "); if ($erghit->numRows() > 0) { $reshit = $erghit->fetchRow(); $KWWh[$reshit['hits']] = $res['Keyword']; // $KWWh[$i] = $res['Keyword']; } else { $KWWh['0_' . $i] = $res['Keyword']; } $KWW[] = $res['Keyword']; $i++; } // aufsteigend Sortieren asort($KWW) ; // hits aufsteigend ksort($KWWh); $KWW_String = "
"; $p = 0; foreach($KWW as $k => $v) { $fs = 8; $x = array_search ($v, $KWWh) ; // echo $KWWh[$x].'-'; $kwp = 0; foreach($KWWh as $kp => $vp) { if ($vp == $v) { if ($kwp < 5) { switch ($kwp) { case '0': $fs = 14; break; case '1': $fs = 13; break; case '2': $fs = 12; break; case '3': $fs = 11; break; case '4': $fs = 10; break; case '5': $fs = 9; break; } } } $kwp++; } $KWW_String .= "" . $v . " "; $p++; } $KWW_String .= "
"; // # KW Image if ($ProjectArray["Keyword"]["KW_Image"] != "") { $KW_Image = ""; if ($ProjectArray["Keyword"]["KW_Href"] != "") { $KW_Image .= ''; } $KW_Image .= '' . $ProjectArray['Keyword']['Keyword'] . ''; if ($ProjectArray["Keyword"]["KW_Href"] != "") { $KW_Image .= ''; } } // $CONTENT = $ProjectArray["Keyword"]["Contentline_1"]." ".$ProjectArray["Keyword"]["Contentline_2"]." ".$ProjectArray["Keyword"]["Contentline_3"]." ".$ProjectArray["Keyword"]["Contentline_4"]." ".$ProjectArray["Keyword"]["Contentline_5"]; // $CONTENT = $ProjectArray["Keyword"]["Contentlines"]; // if($ProjectArray["Keyword"]["Contentline_6"] != ""){ // $CONTENT .= "
".$ProjectArray["Keyword"]["Contentline_7"]."
".$ProjectArray["Keyword"]["Contentline_8"]."
".$ProjectArray["Keyword"]["Contentline_9"]."
".$ProjectArray["Keyword"]["Contentline_10"]; // } $CONTENT = ""; if (sizeof($ProjectArray["Keyword"]["Content_TMP"]) > 0) { foreach($ProjectArray["Keyword"]["Content_TMP"] as $k => $v) { $CONTENT .= $v; } } if($ProjectArray["Project"]["linkmanager"] == 1){ // // Zusatzseite // $GLOBALS["myDBConnection"]->setValue("SqlStatement", "SELECT * FROM pp_add_text WHERE Project_ID = '".$ProjectArray["Project"]['ProjectID']."' AND aktiv='1'"); $myInfoQuery = $GLOBALS["myDBConnection"]->dbSelect(); $InfoSiteExist = mysql_numrows($myInfoQuery); if($InfoSiteExist > 0){ $InfoPageLink = "".$ProjectArray["Project"]['txt_add_site'].""; } // zusatzseite // Content zuweisen if($_GET['KW'] =='interessante_Zusatzthemen'){ $GLOBALS["myDBConnection"]->setValue("SqlStatement", "SELECT * FROM pp_add_text WHERE Project_ID = '".$ProjectArray["Project"]['ProjectID']."' AND aktiv='1'"); $myInfoQuery = $GLOBALS["myDBConnection"]->dbSelect(); $myInfoResult = mysql_fetch_array($myInfoQuery); #$TemplateContent = $GLOBALS["usefulTools"]->readInFiles("templates/templates/" . $ProjectArray["Project"]["Template"] . "/info.htm"); $ProjectArray["Keyword"]["MetaDescription"] = $myInfoResult['description']; $ProjectArray["Keyword"]["MetaKeywords"] = $myInfoResult['keywords']; $ProjectArray["Keyword"]["Browsertitle"] = $myInfoResult['title']; $ProjectArray["Keyword"]["Title"] = $myInfoResult['txt_header']; $InfoCONTENT = $myInfoResult['txt']; } // // Partnerlinks // if ($KWSql == "" || ucfirst($_GET["KW"]) == ucfirst($ProjectArray['Project']['MainKeyword'])) { $erg = $Pdb->query("SELECT pl.* FROM pp_partnerlinks pl WHERE pl.ID_Project='" . $ProjectArray["Project"]['ProjectID'] . "' "); $PL = ""; if ($erg->numRows() > 0) { $res = $erg->fetchRow(); if($InfoPageLink != ""){ $PL_pre = "".$InfoPageLink."
"; $res['PL_TEXT'] = $InfoCONTENT; }else{ $PL_pre = "".$ProjectArray["Project"]['txt_add_site'].":
"; } for($i=1; $i<=10; $i++){ $tmpdom = explode('.',$res['l'.$i]); $ergPLcheck = $Pdb->query("SELECT * FROM pp_projects WHERE Domain like '".$tmpdom[1].".".$tmpdom[2]."' AND Active = 1 "); if($ergPLcheck->numRows() == 0){ $res['l'.$i] = ''; $Pdb->query("UPDATE pp_partnerlinks SET l".$i." = '', l".$i."_txt = '' WHERE ID_Project='" . $ProjectArray["Project"]['ProjectID'] . "'"); $res['PL_TEXT'] = str_replace('[L'.$i.']','',$res['PL_TEXT']); $res['PL_TEXT'] = str_replace('[/L'.$i.']','',$res['PL_TEXT']); $Pdb->query("UPDATE pp_add_text set PL_TEXT = '".$res['PL_TEXT']."' WHERE Project_ID = '".$ProjectArray["Project"]['ProjectID']."'"); } } if ($res['l1'] != ""){ $l1link = '' . $res['l1_txt'] . ''; $PL .= $l1link; } if ($res['l2'] != ""){ $l2link = '' . $res['l2_txt'] . ''; $PL .= ','.$l2link; } if ($res['l3'] != ""){ $l3link = '' . $res['l3_txt'] . ''; $PL .= ', '.$l3link; } if ($res['l4'] != ""){ $l4link = '' . $res['l4_txt'] . ''; $PL .= ', '.$l4link ; } if ($res['l5'] != ""){ $l5link = '' . $res['l5_txt'] . ''; $PL .= ', '.$l5link ; } if ($res['l6'] != ""){ $l6link = '' . $res['l6_txt'] . ''; $PL .= ', '.$l6link; } if ($res['l7'] != ""){ $l7link = '' . $res['l7_txt'] . ''; $PL .= ', '.$l7link; } if ($res['l8'] != ""){ $l8link = '' . $res['l8_txt'] . ''; $PL .= ', '.$l8link; } if ($res['l9'] != ""){ $l9link = '' . $res['l9_txt'] . ''; $PL .= ', '.$l9link; } if ($res['l10'] != ""){ $l10link = '' . $res['l10_txt'] . ''; $PL .= ', '.$l10link; } if ($res['PL_TEXT'] != "") { $PL_TEXT = $res['PL_TEXT']; if($l1link != ''){ $PL_TEXT = preg_replace('#\[L1](.*)\[/L1\]#Uis', '\1', $PL_TEXT); }else{ $PL_TEXT = str_replace('[L1]','',$PL_TEXT); $PL_TEXT = str_replace('[/L1]','',$PL_TEXT); } if($l2link != ''){ $PL_TEXT = preg_replace('#\[L2](.*)\[/L2\]#Uis', '\1', $PL_TEXT); }else{ $PL_TEXT = str_replace('[L2]','',$PL_TEXT); $PL_TEXT = str_replace('[/L2]','',$PL_TEXT); } if($l3link != ''){ $PL_TEXT = preg_replace('#\[L3](.*)\[/L3\]#Uis', '\1', $PL_TEXT); }else{ $PL_TEXT = str_replace('[L3]','',$PL_TEXT); $PL_TEXT = str_replace('[/L3]','',$PL_TEXT); } if($l4link != ''){ $PL_TEXT = preg_replace('#\[L4](.*)\[/L4\]#Uis', '\1', $PL_TEXT); }else{ $PL_TEXT = str_replace('[L4]','',$PL_TEXT); $PL_TEXT = str_replace('[/L4]','',$PL_TEXT); } if($l5link != ''){ $PL_TEXT = preg_replace('#\[L5](.*)\[/L5\]#Uis', '\1', $PL_TEXT); }else{ $PL_TEXT = str_replace('[L5]','',$PL_TEXT); $PL_TEXT = str_replace('[/L5]','',$PL_TEXT); } if($l6link != ''){ $PL_TEXT = preg_replace('#\[l6](.*)\[/l6\]#Uis', '\1', $PL_TEXT); }else{ $PL_TEXT = str_replace('[L6]','',$PL_TEXT); $PL_TEXT = str_replace('[/L6]','',$PL_TEXT); } if($l7link != ''){ $PL_TEXT = preg_replace('#\[l7](.*)\[/l7\]#Uis', '\1', $PL_TEXT); }else{ $PL_TEXT = str_replace('[L7]','',$PL_TEXT); $PL_TEXT = str_replace('[/L7]','',$PL_TEXT); } if($l8link != ''){ $PL_TEXT = preg_replace('#\[l8](.*)\[/l8\]#Uis', '\1', $PL_TEXT); }else{ $PL_TEXT = str_replace('[L8]','',$PL_TEXT); $PL_TEXT = str_replace('[/L8]','',$PL_TEXT); } if($l9link != ''){ $PL_TEXT = preg_replace('#\[l9](.*)\[/l9\]#Uis', '\1', $PL_TEXT); }else{ $PL_TEXT = str_replace('[L9]','',$PL_TEXT); $PL_TEXT = str_replace('[/L9]','',$PL_TEXT); } if($l10link != ''){ $PL_TEXT = preg_replace('#\[l10](.*)\[/l10\]#Uis', '\1', $PL_TEXT); }else{ $PL_TEXT = str_replace('[L10]','',$PL_TEXT); $PL_TEXT = str_replace('[/L10]','',$PL_TEXT); } $PL_TEXT = nl2br($PL_TEXT); $PL = $PL_TEXT; } } if($InfoCONTENT != ""){ $CONTENT = $PL; $PL = ""; } if( $_GET['KW'] != 'interessante_Zusatzthemen'){ if ($PL != "" && $InfoPageLink =="") { $PL = $PL_pre . $PL; }elseif($InfoPageLink !=""){ $PL = $PL_pre; } } } } // Sprachfile einbinden // wenn das File nicht vorhanden ist, dann lade de if (file_exists(dirname(__FILE__) . '/templates/language/' . $myProjectResult["Lang"] . '/lang_' . $myProjectResult["Lang"] . '.php')) { include(dirname(__FILE__) . '/templates/language/' . $myProjectResult["Lang"] . '/lang_' . $myProjectResult["Lang"] . '.php'); } else { include(dirname(__FILE__) . '/templates/language/de/lang_de.php'); } if (isset($_GET["KW"]) && $_GET['KW'] != 'interessante_Zusatzthemen') { $TemplateContent = $GLOBALS["usefulTools"]->readInFiles("templates/templates/" . $ProjectArray["Project"]["Template"] . "/template.htm"); }else{ $TemplateContent = $GLOBALS["usefulTools"]->readInFiles("templates/templates/" . $ProjectArray["Project"]["Template"] . "/template_addSite.html"); if($TemplateContent == ""){ $TemplateContent = $GLOBALS["usefulTools"]->readInFiles("templates/templates/" . $ProjectArray["Project"]["Template"] . "/template.htm"); } } /** */ /* AddOn f?re Flugshop */ $datum = date('d.m.Y'); $tage = 7; $tageRet = 14; list($tag, $monat, $jahr) = explode('.', $datum); // Aus diesen Einzelteilen k?nnen wir mit mktime einen Unix-Timestamp bauen, und die 5 Monate gleich hinzuz?hlen: $timestamp = mktime(0, 0, 0, $monat, $tag + $tage, $jahr); $dateAB = date('d.m.Y', $timestamp); $timestamp = mktime(0, 0, 0, $monat, $tag + $tageRet, $jahr); $dateRet = date('d.m.Y', $timestamp); /** */ $ReplArray = array( "##META_DESCRIPTION##" => $ProjectArray["Keyword"]["MetaDescription"], "##META_KEYWORDS##" => $ProjectArray["Keyword"]["MetaKeywords"], "##KEYWORD##" => $ProjectArray["Keyword"]["Keyword"], "##KEYWORDCODED##" => rawurlencode($ProjectArray["Keyword"]["Keyword"]), "##BROWSERTITLE##" => $ProjectArray["Keyword"]["Browsertitle"], "##TOPIC##" => $ProjectArray["Keyword"]["Title"], "##KEYWORD_CONTENT##" => nl2br($CONTENT), "##DOMAIN##" => $myProjectResult["Domain"], "##LOGO_LINK##" => 'http://www.' . $myProjectResult["Domain"], "##LISTING##" => $MyListings, "##LISTING_1##" => $ProjectArray["Keyword"]["Listing_1"], "##LISTING_2##" => $ProjectArray["Keyword"]["Listing_2"], "##LISTING_3##" => $ProjectArray["Keyword"]["Listing_3"], "##LISTING_4##" => $ProjectArray["Keyword"]["Listing_4"], "##LISTING_5##" => $ProjectArray["Keyword"]["Listing_5"], "##MAINKEYWORD_1##" => $ProjectArray["Project"]["MainKeyword"], "##MAINKEYWORD_2##" => $ProjectArray["Project"]["MainKeyword"], "##BASELINK##" => $ProjectArray["Project"]["BaseLink"], "##CUSTOMERSITE##" => $SpecKWLink, "##KW_COL1##" => $KWList1, "##KW_COL2##" => $KWList2, "##KW_COL3##" => $KWList3, "##PROJECTID##" => $ProjectArray["Project"]["ProjectID"], "##KWID##" => $ProjectArray["Keyword"]["KeywordID"] , "##KWW##" => $KWW_String, "##zusTXTKW##" => nl2br($ProjectArray["Keyword"]["zusTXTKW"]) , "##PARTNERLINKS##" => str_replace('
', ' ', nl2br($PL)), "##LNK_CL##" => str_replace('#', '', $ProjectArray["Project"]["lnk_cl"]), "##TXT_CL##" => str_replace('#', '', $ProjectArray["Project"]["txt_cl"]) , "##BG_CL##" => str_replace('#', '', $ProjectArray["Project"]["bg_cl"]), "##LANG_META_LANG_TXT##" => $LANG_META_LANG_TXT, "##Direkteinstieg_TXT##" => $Direkteinstieg_TXT, "##opt_DIR_LINK_TXT##" => $opt_DIR_LINK_TXT, "##SEARCH_TXT##" => $Search_TXT, "##moreInfos_TXT##" => $moreInfos_TXT, "##InfoFind_TXT##" => $InfoFind_TXT, "##allToTopic_TXT##" => $allToTopic_TXT, "##RSSInfo_TXT##" => $RssInfo_TXT, "##SitemapToTopic_TXT##" => $SitemapToTopic_TXT, "##KEYWORD_IMAGE##" => $KW_Image, "##dateAB##" => $dateAB, "##dateRet##" => $dateRet, "##CANONICALURL##" => $canonicalURL, "##InfoPageLink##" => $InfoPageLink, ); $myContent = strtr($TemplateContent, $ReplArray); } } // ** Wrapper **// if ($ProjectArray["Keyword"]["include_into_url_aktiv"] == 1 || $ProjectArray["Project"]["insite_template"] == 1) { if (trim($ProjectArray["Keyword"]["include_into_url"]) != "") { $url = $ProjectArray["Keyword"]["include_into_url"]; } else { $url = "http://www." . $ProjectArray["Project"]["Domain"]; } $ch = curl_init($url); #curl_setopt ($ch, CURLOPT_URL, $url); #curl_setopt ($ch, CURLOPT_HEADER, 0); #curl_setopt ($ch, CURLOPT_HEADER, 'accept-language: de-de'); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); #curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 3); #curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0)'); #$result = curl_exec ($ch); $result = curl_exec_follow($ch); curl_close ($ch); // $result= html_entity_decode($result); // if($ProjectArray["Keyword"]["include_utf_kodiert"] == 1){$result = utf8_encode($result);} if ($ProjectArray["Keyword"]["include_utf_kodiert"] == 1) { $result = utf8_decode($result); $UTF8 = 1; } # für Gasprofi auskommentieren ##$result = utf8_decode($result); if ($ProjectArray["Project"]["insite_template"] == 1 && $ProjectArray["Keyword"]["include_into_url_aktiv"] != 1 && $ProjectArray["Project"]["insite_template_utf8"] == 1) { $result = utf8_decode($result); $UTF8 = 1; } // if(is_utf8($result) == true) { $result= utf8_decode($result); $UTF8 = 1;} //if($ProjectArray["Keyword"]["include_KWTXT_utf_kodiert"] == 1){$myContent = utf8_encode($myContent);} // Links suchen und an absolute() weiterleiten $x = parse_url($url); $host = $x['scheme'] . '://' . $x['host']; $result = preg_replace(',([^>]+)src="([^>"\s]+)",ie', '"\1src=\"" . absolute("\2", $host) . "\""', $result); $result = preg_replace(",([^>]+)src='([^>'\s]+)',ie", "'\1src=\'" . absolute("\2", $host) . "\''", $result); $result = preg_replace(',([^>]+)data="([^>"\s]+)",ie', '"\1data=\"" . absolute("\2", $host) . "\""', $result); $result = preg_replace(",([^>]+)data='([^>'\s]+)',ie", "'\1data=\'" . absolute("\2", $host) . "\''", $result); $result = preg_replace(',([^>]+)value="([^>"\s]+)",ie', '"\1value=\"" . absolute("\2", $host) . "\""', $result); #$result = preg_replace(",([^>]+)value='([^>'\s]+)',ie", "'\1value=\'" . absolute("\2", $host) . "\''", $result); # $result = preg_replace(',([^>]+)src= \'([^>\s]+)\',ie', # '"\1src=\"" . absolute("\2", $host) . "\""', # $result); $result = preg_replace(',([^>]+)href="([^>"\s]+)",ie', '"\1href=\"" . absolute("\2", $host) . "\""', $result); $result = preg_replace(',([^>]+)href="([^>"\s]+)",ie', '"\1href=\"" . absolute("\2", $host) . "\""', $result); $result = preg_replace(',([^>]+)background="([^>"\s]+)",ie', '"\1background=\"" . absolute("\2", $host) . "\""', $result); $result = preg_replace(',([^>]+)icPath="([^>"\s]+)",ie', '"\1icPath=\"" . absolute("\2", $host) . "\""', $result); $result = preg_replace('/url\(([\'"]?)(?![\'"a-z]+:)/i', 'url(\1'. $host . '/\2', $result); $result = preg_replace("#()(.*)()#siU", "$1 $3", $result); if ($ProjectArray["Keyword"]["include_after_content"] != 1 ||$_GET['KW'] == 'interessante_Zusatzthemen') { $myContent = preg_replace("#()(.*)()#siU", "$1" . $myContent . "$3", $result); }else { $myContent = preg_replace("#()(.*)()#siU", "$1 $2" . $myContent . "$3", $result); } #Startseitentext entfernen #$myContent = preg_replace("#()(.*)()#siU", "$1" . $ProjectArray["Keyword"]["Browsertitle"] . "$3", $myContent); $regex_pattern = '@(.*?)\@is'; $myContent = preg_replace ($regex_pattern,''.htmlentities($ProjectArray["Keyword"]["Browsertitle"]).'',$myContent); $myContent = preg_replace ('//si','',$myContent); $myContent = preg_replace ('//si','',$myContent); #$myContent = str_replace('', ' ', $myContent); if ($UTF8 == 1) { $myContent = utf8_encode($myContent); } } // ** End Wrapper **// $myDBConnection->dbClose(); }else { $myContent = $GLOBALS["usefulTools"]->readInFiles("templates/uc.htm"); } if ($ActProj == 0) { header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); header('Connection: close'); exit(); }else { echo $myContent; } function curl_exec_follow(/*resource*/ &$ch, /*int*/ $redirects = 20, /*bool*/ $curlopt_header = false) { if ((!ini_get('open_basedir') && !ini_get('safe_mode')) || $redirects < 1) { curl_setopt($ch, CURLOPT_HEADER, $curlopt_header); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $redirects > 0); curl_setopt($ch, CURLOPT_MAXREDIRS, $redirects); return curl_exec($ch); } else { curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FORBID_REUSE, false); do { $data = curl_exec($ch); if (curl_errno($ch)) break; $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($code != 301 && $code != 302) break; $header_start = strpos($data, "\r\n")+2; $headers = substr($data, $header_start, strpos($data, "\r\n\r\n", $header_start)+2-$header_start); if (!preg_match("!\r\n(?:Location|URI): *(.*?) *\r\n!", $headers, $matches)) break; curl_setopt($ch, CURLOPT_URL, $matches[1]); } while (--$redirects); if (!$redirects) trigger_error('Too many redirects. When following redirects, libcurl hit the maximum amount.', E_USER_WARNING); if (!$curlopt_header) $data = substr($data, strpos($data, "\r\n\r\n")+4); return $data; } } // Funktion, die relative in absolute Links umschreibt function absolute ($relative, $absolute) { // Link ist schon absolut if (preg_match(',^(https?://|ftp://|mailto:|news:|javascript:),i', $relative)) return $relative; // parse_url() nimmt die URL auseinander $url = parse_url($absolute); // dirname() erkennt auf / endende URLs nicht if ($url['path'] { strlen($url['path']) - 1} == '/') $dir = substr($url['path'], 0, strlen($url['path']) - 1); else $dir = dirname($url['path']); // absoluter Link auf dem gleichen Server if ($relative { 0} == '/') { $relative = substr($relative, 1); $dir = ''; } // Link f?ngt mit ./ an elseif (substr($relative, 0, 2) == './') $relative = substr($relative, 2); // Referenzen auf h?her liegende Verzeichnisse aufl?sen else while (substr($relative, 0, 3) == '../') { $relative = substr($relative, 3); $dir = substr($dir, 0, strrpos($dir, '/')); } // volle URL zur?ckgeben return sprintf('%s://%s%s/%s', $url['scheme'], $url['host'], $dir, $relative); } ?>