$i;$i++){ if($ArrayWaarden[$i*2]==$Waarde){ $Return.=TekstUitDatabase($ArrayWaarden[($i*2)+1]); } } } else{ $resultaat = database_query($SQL); while($row = database_fetch_array($resultaat)) { if($Waarde==$row["Waarde"]){ $Return.=TekstUitDatabase($row["Weergave"]); } } } return $Return; } function IdVeldNaam($Tabel){ $Bestaat = 0; $resultaat = database_query("SELECT * FROM ".$Tabel." WHERE 1=0"); $VeldNaam = substr(database_field_name($resultaat, 0),0,3); $VeldNaam = $VeldNaam.$Tabel."Id"; $Velden = database_num_fields($resultaat); for ($i=0; $i < $Velden; $i++) { if(database_field_name($resultaat, $i)==$VeldNaam){ $Bestaat = 1; } } if($Bestaat==1){ $VeldNaamDefinitief = $VeldNaam; } else{ $VeldNaamDefinitief = database_field_name($resultaat, 0); } return $VeldNaamDefinitief; } function VoorvoegselTabel($Tabel){ SelecteerDatabase($_SESSION["SES_Database"]); $resultaat = database_query("SELECT * FROM ".$Tabel." WHERE 1=0"); $Voorvoegsel = database_field_name($resultaat, 0); SelecteerDatabase(GLB_DB_Database); if(strlen($Voorvoegsel)<3){ $Voorvoegsel = ""; } return substr($Voorvoegsel,0,3); } function TabelAanmaken($OnderdeelId){ $resultaat = database_query("SELECT klaNaam, ondTabelNaam, ondTabelVoorvoegsel, klaDatabasenaam FROM Onderdelen, Klanten WHERE klaId = ondKlantId AND ondId = ".$OnderdeelId); while($row = database_fetch_array($resultaat)) { $Database = $row["klaDatabasenaam"]; $TabelNaam = $row["klaDatabasenaam"].TekstUitDatabase($row["ondTabelNaam"]); $Voorvoegsel = $row["ondTabelVoorvoegsel"]; } if($Voorvoegsel!=""){ SelecteerDatabase($Database); database_query("CREATE TABLE ".$TabelNaam." ( ".$Voorvoegsel."Id int(11) NOT NULL auto_increment, ".$Voorvoegsel."Positie int(11) default NULL, ".$Voorvoegsel."Aanmaak_medewerkerId int(11) default NULL, ".$Voorvoegsel."Aanmaak_datum_tijd datetime default NULL, ".$Voorvoegsel."Wijziging_datum_tijd datetime default NULL, ".$Voorvoegsel."Wijziging_medewerkerId int(11) default NULL, PRIMARY KEY (".$Voorvoegsel."Id) )"); SelecteerDatabase(GLB_DB_Database); } } function VeldAanmaken($ControlsId){ $resultaat = database_query("SELECT davLengte, davVeldtype, klaNaam, klaDatabasenaam, ondTabelNaam, ondTabelVoorvoegsel,conNaamInDatabase FROM Onderdelen, Klanten, Controls, DatabaseVeld WHERE davId = conDatabaseVeldId AND conOnderdeelId = ondId AND klaId = ondKlantId AND conId = ".$ControlsId); while($row = database_fetch_array($resultaat)) { $Database = $row["klaDatabasenaam"]; $TabelNaam = $row["klaDatabasenaam"].TekstUitDatabase($row["ondTabelNaam"]); $Voorvoegsel = $row["ondTabelVoorvoegsel"]; $VeldNaam = $row["conNaamInDatabase"]; $VeldType = $row["davVeldtype"]; $VeldLengte = $row["davLengte"]; $IdVeld = $Voorvoegsel."Id"; if($VeldLengte==0 || $VeldLengte==""){ $VeldLengte = ""; } else{ $VeldLengte = " ( ".$VeldLengte." ) "; } } if($Voorvoegsel!=""){ SelecteerDatabase($Database); if($VeldType=="date"){ database_query("ALTER TABLE `".$TabelNaam."` ADD `".$VeldNaam."` DATE AFTER `".$IdVeld."`"); } else{ database_query("ALTER TABLE `".$TabelNaam."` ADD `".$VeldNaam."` ".$VeldType.$VeldLengte." AFTER `".$IdVeld."`"); } SelecteerDatabase(GLB_DB_Database); } } define("Taal_Bewerken", "Bewerken"); define("Taal_Bekijken", "Bekijken"); define("Taal_Verwijderen", "Verwijderen"); define("Taal_Toevoegen", "Toevoegen"); define("Taal_VerwijderVraag", "Weet u zeker dat u dit item wilt verwijderen?"); define("Taal_Hoofdmenu", "Hoofdmenu"); define("Taal_Budgetmenu", "Budgetmenu"); define("Taal_Adminmenu", "Adminmenu"); define("Taal_Nieuwsbriefmenu", "Nieuwsbrief"); define("Taal_Overzichtmenu", "Overzichten"); define("Taal_BratpackAdminmenu", "Bratpack Admin"); define("Taal_BratpackStatistiekenmenu", "Statistieken website"); define("Taal_PositieOmhoog", "Positie omhoog"); define("Taal_PositieOmlaag", "Positie omlaag"); define("Taal_SelecteerAlles", "(de)selecteer"); define("Taal_VerwijderAllesVraag", "Weet u zeker dat u alle geselecteerde items wilt verwijderen?"); define("Taal_SelectieOpheffen", "Selectie opheffen"); define("Taal_Selecteren", "Selecteren"); define("Taal_Van", "Van"); define("Taal_Tot", "Tot"); define("Taal_BestandVerwijderVraag", "Weet u zeker dat u het bestand wilt verwijderen?"); ?>", ""); $Return = ZoekEnVervangGebied($Return, "

", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervang($Return, "

", ""); $Return = ZoekEnVervang($Return, "

", ""); $Return = ZoekEnVervang($Return, "

", ""); $Return = ZoekEnVervang($Return, "

", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, " ", " "); $Return = ZoekEnVervang($Return, "
", ""); $Return = ZoekEnVervang($Return, "
", ""); $Return = ZoekEnVervang($Return, "
", ""); $Return = ZoekEnVervang($Return, "
", ""); $Return = ZoekEnVervang($Return, "
", ""); $Return = ZoekEnVervang($Return, "
", ""); $Return = ZoekEnVervang($Return, "
", ""); $Return = ZoekEnVervang($Return, "
", ""); $Return = ZoekEnVervang($Return, "
", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "
", ""); $Return = ZoekEnVervangGebied($Return, "
", ""); return $Return; } function GeenHTMLZoeken($Tekst){ $Return = $Tekst; $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "
", ""); $Return = ZoekEnVervangGebied($Return, "

", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "

", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervang($Return, "\n", ""); $Return = ZoekEnVervang($Return, "\r", ""); $Return = ZoekEnVervang($Return, "

", ""); $Return = ZoekEnVervang($Return, "

", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, " ", " "); $Return = ZoekEnVervang($Return, "
", ""); $Return = ZoekEnVervang($Return, "
", ""); $Return = ZoekEnVervang($Return, "
", ""); $Return = ZoekEnVervang($Return, "
", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "
", ""); $Return = ZoekEnVervang($Return, "
", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "
", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "/script>", ""); $Return = ZoekEnVervang($Return, "/object>", ""); $Return = ZoekEnVervang($Return, "
", ""); $Return = ZoekEnVervang($Return, "
", ""); $Return = ZoekEnVervang($Return, "
    ", ""); $Return = ZoekEnVervang($Return, "
", ""); $Return = ZoekEnVervang($Return, "
  • ", ""); $Return = ZoekEnVervang($Return, "
  • ", ""); $Return = ZoekEnVervang($Return, "
      ", ""); $Return = ZoekEnVervang($Return, "
    ", ""); $Return = ZoekEnVervang($Return, "
  • ", ""); $Return = ZoekEnVervang($Return, "
  • ", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); return $Return; } function GeenHTMLRSS($Tekst){ $Return = $Tekst; $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "
    ", ""); $Return = ZoekEnVervangGebied($Return, "

    ", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "

    ", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervangGebied($Return, "", ""); $Return = ZoekEnVervang($Return, "\n", ""); $Return = ZoekEnVervang($Return, "\r", ""); $Return = ZoekEnVervang($Return, "

    ", ""); $Return = ZoekEnVervang($Return, "

    ", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, " ", ""); $Return = ZoekEnVervang($Return, "
    ", ""); $Return = ZoekEnVervang($Return, "
    ", ""); $Return = ZoekEnVervang($Return, "
    ", ""); $Return = ZoekEnVervang($Return, "
    ", ""); $Return = ZoekEnVervang($Return, "
    ", ""); $Return = ZoekEnVervang($Return, "
    ", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "
    ", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "/script>", ""); $Return = ZoekEnVervang($Return, "/object>", ""); $Return = ZoekEnVervang($Return, "
    ", ""); $Return = ZoekEnVervang($Return, "
    ", ""); $Return = ZoekEnVervang($Return, "
      ", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "
    ", ""); $Return = ZoekEnVervang($Return, "
  • ", ""); $Return = ZoekEnVervang($Return, "
  • ", ""); $Return = ZoekEnVervang($Return, "", ""); $Return = ZoekEnVervang($Return, "
    ", ""); $Return = ZoekEnVervang($Return, "&", "en"); $Return = ZoekEnVervang($Return, "ë", "e"); $Return = ZoekEnVervang($Return, "", "e"); $Return = ZoekEnVervang($Return, "", "Euro"); $Return = ZoekEnVervang($Return, "‘", ""); $Return = ZoekEnVervang($Return, "’", ""); $Return = ZoekEnVervang($Return, "é", "e"); $Return = ZoekEnVervang($Return, "“", ""); $Return = ZoekEnVervang($Return, "”", ""); $Return = ZoekEnVervang($Return, """, ""); $Return = ZoekEnVervang($Return, "€", "euro"); $Return = ZoekEnVervangGebied($Return, "", ""); return $Return; } function ZoekEnVervangGebied($Tekst, $Begin, $Eind, $VervangenDoor){ $Return = $Tekst; while(Zoek($Return, $Begin)>0){ $PositieBegin = strpos($Return, $Begin); $PositieEind = strpos(substr($Return, $PositieBegin), $Eind)+1; $TeVervangen = substr($Return, $PositieBegin, $PositieEind); $Return = ZoekEnVervang($Return, $TeVervangen, $VervangenDoor); } return $Return; } /************************************************************************************** Onderstaande functie is om standaardwoorden en zinnen te vertalen indien een Klanten een anderstalig CMS wenst. ***************************************************************************************/ function GeefVertaling($Veldnaam){ //if(KlantBudget() || KlantNieuwsbrief()){ // $resultaat = database_query("SELECT ".$Veldnaam." FROM Talen, Klanten, KlantenTalen WHERE kltKlantId = klaId AND kltTalenId = talId AND talId = klaTaalId AND klaId = ".$_SESSION["SES_KlantId"]); // while($row = database_fetch_array($resultaat)) { // $Return = TekstUitDatabase($row[$Veldnaam]); // } //} //else{ // $resultaat = database_query("SELECT ".$Veldnaam." FROM Talen, Klanten WHERE talId = klaTaalId AND klaId = ".$_SESSION["SES_KlantId"]); // while($row = database_fetch_array($resultaat)) { // $Return = TekstUitDatabase($row[$Veldnaam]); // } //} return $Return; } /************************************************************************************** Hier worden de leestekens verwijderd. Ook niet zo bijzonder, de nummers slaan op de ASCII nummers van tekens. ***************************************************************************************/ function VerwijderLeestekens($Invoer){ if($_SERVER["SERVER_NAME"]!="webserver"){ $Invoer = html_entity_decode($Invoer,ENT_QUOTES); } for($i=33;48>$i;$i++){ $Invoer = ZoekEnVervang($Invoer, chr($i), ""); } for($i=58;64>$i;$i++){ $Invoer = ZoekEnVervang($Invoer, chr($i), ""); } for($i=91;97>$i;$i++){ $Invoer = ZoekEnVervang($Invoer, chr($i), ""); } for($i=123;255>$i;$i++){ $Invoer = ZoekEnVervang($Invoer, chr($i), ""); } $Invoer = ZoekEnVervang($Invoer, " ", ""); return $Invoer; } /************************************************************************************** Verschil met speciaal en gewoon is dat speciaal een . en een @ laat staan. ***************************************************************************************/ function VerwijderLeestekensSpeciaal($Invoer){ if($_SERVER["SERVER_NAME"]!="webserver"){ $Invoer = html_entity_decode($Invoer,ENT_QUOTES); } for($i=33;47>$i;$i++){ if($i!=46 && $i!=45){ $Invoer = ZoekEnVervang($Invoer, chr($i), ""); } } for($i=58;63>$i;$i++){ $Invoer = ZoekEnVervang($Invoer, chr($i), ""); } for($i=91;96>$i;$i++){ if($i<>95){ $Invoer = ZoekEnVervang($Invoer, chr($i), ""); } } for($i=123;255>$i;$i++){ if($i<>173){ $Invoer = ZoekEnVervang($Invoer, chr($i), ""); } } $Invoer = ZoekEnVervang($Invoer, " ", ""); return $Invoer; } /************************************************************************************** Hier wordt de pagina naam uit een PHP_SELF gehaald, daar krijg je vaak allemaal dirs mee waar je niets aanhebt, daarom deze functie. ***************************************************************************************/ function Paginanaam($Naamoud){ $Array = Splitsen($Naamoud, "/"); $Return = $Array[count($Array)-1]; return $Return; } /************************************************************************************** Dit is de tekst die bij een foto ingevoegd moet worden. ***************************************************************************************/ function FotoTekst(){ $resultaat = database_query("SELECT klaFotoTekst FROM Klanten WHERE klaId = ".$_SESSION["SES_KlantId"]); while($row = database_fetch_array($resultaat)) { $Return = $row["klaFotoTekst"]; } return $Return; } function HTMLSizeToPDFSize($Grootte){ switch($Grootte){ case 15: $Return = 13; break; case 14: $Return = 12; break; case 13: $Return = 11; break; case 12: $Return = 10; break; case 11: $Return = 9; break; } return $Return; } function HTMLRegelhoogteToPDFRegelHoogte($Grootte){ switch($Grootte){ case 16: $Return = 5; break; case 14: $Return = 4; break; case 10: $Return = 4; break; case 6: $Return = 3; break; } return $Return; } function FormatNummer($Getal){ if($Getal=="" || $Getal==0){ $Return = ""; } else{ $Getal = $Getal / 1000; $Return = number_format ($Getal, 0, ",", "."); } return $Return; } /************************************************************************************** Deze functie is gejat van php.net en werkt prima, niets aan doen dus. ***************************************************************************************/ function leading_zero( $aNumber, $intPart, $floatPart=NULL, $dec_point=NULL, $thousands_sep=NULL) { //Note: The $thousands_sep has no real function because it will be "disturbed" by plain leading zeros -> the main goal of the function $formattedNumber = $aNumber; if (!is_null($floatPart)) { //without 3rd parameters the "float part" of the float shouldn't be touched $formattedNumber = number_format($formattedNumber, $floatPart, $dec_point, $thousands_sep); } //if ($intPart > floor(log10($formattedNumber))) $formattedNumber = str_repeat("0",($intPart + -1 - floor(log10($formattedNumber)))).$formattedNumber; return $formattedNumber; } /************************************************************************************** Deze functies zijn voor het zoeken van o.a. statische pagina's en dynamische pagina's. ***************************************************************************************/ function ZoekenDynamisch($ArrayQuery, $ArrayUrl){ for($i=0;count($ArrayQuery)>$i;$i++){ $resultaat = database_query($ArrayQuery[$i]); while($row = database_fetch_array($resultaat)) { if($row["Zoek1"]!=""){ $StringVolledig = GeenHTMLZoeken(TekstUitDatabase(strtolower($row["Zoek1"]))); } if($row["Zoek2"]!=""){ $StringVolledig.= GeenHTMLZoeken(TekstUitDatabase(strtolower($row["Zoek2"]))); } if($row["Zoek3"]!=""){ $StringVolledig.= GeenHTMLZoeken(TekstUitDatabase(strtolower($row["Zoek3"]))); } if($row["Zoek4"]!=""){ $StringVolledig.= GeenHTMLZoeken(TekstUitDatabase(strtolower($row["Zoek4"]))); } $Url = ZoekEnVervang($ArrayUrl[$i], "IdZoekEnVervang", $row["Id"]); $Titel = TekstUitDatabase($row["Zoek1"]); $Tekst = $StringVolledig; database_query("INSERT INTO ZoekenBasis(zobSiteId, zobTekst, zobTitel, zobUrl) VALUES('".GLB_SiteId."', '".TekstNaarDatabase($Tekst)."', '".TekstNaarDatabase($Titel)."', '".$Url."')"); } } } function ZoekenStatisch($ArrayPagina){ for($i=0;count($ArrayPagina)>$i;$i++){ $html = implode ('', file ($ArrayPagina[$i])); if(Zoek($html, "0){ $Temp = Splitsen($html, "0){ $Titel = Splitsen($Temp[0], ""); $Titel = Splitsen($Titel[1], ""); } else{ $Titel = Splitsen($Temp[0], ""); $Titel = Splitsen($Titel[1], ""); } $Titel = $Titel[0]; } else{ $Temp = Splitsen($html, "0){ $Titel = Splitsen($Temp[0], ""); $Titel = Splitsen($Titel[1], ""); } else{ $Titel = Splitsen($Temp[0], ""); $Titel = Splitsen($Titel[1], ""); } $Titel = $Titel[0]; } $html = strtolower($html); $Temp = Splitsen($Temp[1], ""); $Tekst = GeenHTMLZoeken($Temp[0]); $Url = $ArrayPagina[$i]; $Titel = $Titel; database_query("INSERT INTO ZoekenBasis(zobSiteId, zobTekst, zobTitel, zobUrl) VALUES('".GLB_SiteId."', '".TekstNaarDatabase($Tekst)."', '".TekstNaarDatabase($Titel)."', '".$Url."')"); } } function DoorzoekDirectory($dir, $Array){ if (is_dir($dir)){ if(substr($dir, strlen($dir)-1,1)!="/"){ $dir.="/"; } $d = opendir($dir); while ($file = readdir($d)){ if($file!=".." && $file!="."){ if (is_file($dir.$file)){ $Compleet = ZoekEnVervang($dir.$file, "../", GLB_URL); $Array[] = $Compleet; } if(is_dir($dir.$file)){ $Array = DoorzoekDirectory($dir.$file, $Array); } } } closedir($d); } return $Array; } function InArray($Array, $Getal){ $Return = 0; for($x=0;count($Array)>$x;$x++){ if($Array[$x]==$Getal){ $Return = -1; } } return $Return; } function MaakHtmlLink($Tekst){ $Return = TekstUitDatabase($Tekst); $Return = ZoekEnVervang($Return, " ", "spatietekentijdelijk"); $Return = VerwijderLeestekens($Return); $Return = ZoekEnVervang($Return, "spatietekentijdelijk", "_"); return $Return; } function FormatNummerCeesSteur($Getal){ if($Getal=="" || $Getal==0){ $Return = ""; } else{ $Return = number_format ($Getal, 0, ",", "."); } return $Return; } function SpamFormulierControle(){ $Stop = 0; foreach ($_POST as $key => $val){ $HrefWaarde = $HrefWaarde + Zoek($val, "a href="); $HTTPWaarde = $HTTPWaarde + Zoek($val, "http://"); $URLWaarde = $URLWaarde + Zoek($val, "[url="); $ViagraWaarde = $ViagraWaarde + Zoek($val, "viagra"); $CheapWaarde = $CheapWaarde + Zoek($val, "cheap"); } if($HTTPWaarde>4){ $Stop = 1; $Reden.= "Te veel 'http://' strings
    "; } if($HrefWaarde>1){ $Stop = 1; $Reden.= "Te veel 'a href=' strings
    "; } if($ViagraWaarde>1){ $Stop = 1; $Reden.= "Te veel 'viagra' strings
    "; } if($CheapWaarde>1){ $Stop = 1; $Reden.= "Te veel 'cheap' strings
    "; } if($URLWaarde>0){ $Stop = 1; $Reden.= "Te veel '[url=' strings
    "; } if(Zoek($_SERVER["HTTP_REFERER"], $_SERVER["HTTP_HOST"])==0){ $Stop=1; $Reden.= "Vanaf een ander domein '".$_SERVER["HTTP_REFERER"]."'"; } return $Stop; } ?> $w && $w!=0) || ($arr_img["h"] > $h && $h!=0)){ $wh = get_sizes($arr_img["w"], $arr_img["h"], $w, $h); $img_res = img_get_resized($arr_img["img"], $arr_img["w"], $arr_img["h"], $wh["w"],$wh["h"], $use_imagecreatetruecolor, $use_imagecopyresampled); } else { $img_res = $arr_img["img"]; } $file_name = $BestandNaam; if($arr_img["type"]==1){ imagegif($img_res, $file_name); } elseif($arr_img["type"]==2){ ImageJPEG($img_res, $file_name, $JPGkwaliteit); } if($w>(strlen($Tekst)*6) && $Tekst!="" && $arr_img["type"]==2){ $image = PlaatsTekst($file_name, $Tekst); } } function PlaatsTekst($afbeelding, $Tekst){ // Haal plaatje op dat als achtergrond moet dienen. $plaatje = imagecreatefromjpeg($afbeelding); $w = imagesx($plaatje); $h = imagesy($plaatje); $BreedteTekst = strlen($Tekst)*6; $HoogteTekst = 15; $PositieX = $w - $BreedteTekst; $PositieY = $h - $HoogteTekst; // Maak een nieuw plaatje aan om de tekst in te plaatsen, deze plaatsen we straks op het // hierboven geladen plaatje. $plaatjetxt = imagecreate($BreedteTekst,$HoogteTekst); // Set de kleuren wit en zwart voor het ingeladen plaatje. $white = imagecolorallocate($plaatje, 255,255,255); $black = imagecolorallocate($plaatje, 1,1,1); // Set de kleuren wit en zwart voor het nieuw gemaakte plaatje. $whitetxt = imagecolorallocate($plaatjetxt, 255,255,255); $blacktxt = imagecolorallocate($plaatjetxt, 1,1,1); // Stel het te gebruiken lettertype in, het gekozen lettertype moet natuurlijk wel in de // map staan waarin dit bestand thuishoort! // Stel de tekst in die moet worden toegevoegd aan het plaatje. $txt = $Tekst; // Voeg de tekst toe aan het nieuw gemaakte plaatje. Stel ook kleur en positie hier in. $textcolor = imagecolorallocate($plaatjetxt, 1, 1, 1); // write the string at the top left imagestring($plaatjetxt, 2, 0, 0, $txt, $textcolor); // Stel in welke kleur transperant moet worden op het nieuw gemaakte plaatje met tekst. // LET OP: Deze moet dus gelijk zijn aan de kleur die is ingesteld bij $whitetxt!!! imagecolortransparent($plaatjetxt,imagecolorexact($plaatjetxt,255,255,255)); // Zoek de hoogte en breedte van het nieuw gemaakte plaatje $insert_x = imagesx($plaatjetxt); $insert_y = imagesy($plaatjetxt); // Voeg nieuw gemaakte plaatje ($plaatjetxt) en het bestaande plaatje ($plaatje) samen. // Denk eraan dat het bestaande plaatje eerst moet! imagecopymerge($plaatje,$plaatjetxt,$PositieX,$PositieY,0,0,$insert_x,$insert_y,100); $TempNaam = time().$_SESSION["SES_MedewerkerId"]; // Maak van het plaatje een jpg afbeelding en geef kwaliteit op. imagejpeg($plaatje,$afbeelding,100); imagedestroy($plaatje); } function resizer_mainMeer($w, $h, $BestandNaam, $JPGkwaliteit, $Object, $Tekst = ""){ $use_imagecreatetruecolor = true; $use_imagecopyresampled =true; $image_name = $Object["name"]; $image = $Object["tmp_name"]; if(trim($image) == "" || trim($image) =="none"){ return false; } $arr_img = image_from_upload($image); if( ($arr_img["w"] > $w && $w!=0) || ($arr_img["h"] > $h && $h!=0)){ $wh = get_sizes($arr_img["w"], $arr_img["h"], $w, $h); $img_res = img_get_resized($arr_img["img"], $arr_img["w"], $arr_img["h"], $wh["w"],$wh["h"], $use_imagecreatetruecolor, $use_imagecopyresampled); } else { $img_res = $arr_img["img"]; } $file_name = $BestandNaam; if($arr_img["type"]==1){ imagegif($img_res, $file_name); } elseif($arr_img["type"]==2){ ImageJPEG($img_res, $file_name, $JPGkwaliteit); } if($w>(strlen($Tekst)*6) && $Tekst!=""){ $image = PlaatsTekst($file_name, $Tekst); } } function image_from_upload($uploaded_file){ $img_sz = getimagesize( $uploaded_file ); switch( $img_sz[2] ){ case 1: $img_type = "GIF"; $img = ImageCreateFromGif($uploaded_file); break; case 2: $img = ImageCreateFromJpeg($uploaded_file); $img_type = "JPG"; break; case 3: $img = ImageCreateFromPng($uploaded_file); $img_type = "PNG"; break; case 4: $img = ImageCreateFromSwf($uploaded_file); $img_type = "SWF"; break; default: die("
    Het spijt ons momenteel wordt het door u gekozen bestand type nog niet ondersteund door dit systeem van Bratpack.
    "); }//case return array("img"=>$img, "w"=>$img_sz[0], "h"=>$img_sz[1], "type"=>$img_sz[2], "html"=>$img_sz[3]); } function get_sizes($src_w, $src_h, $dst_w,$dst_h ){ //src_w ,src_h-- start width and height //dst_w ,dst_h-- end width and height //return array w=>new width h=>new height mlt => multiplier //the function tries to shrink or enalrge src_w,h in such a way to best fit them into dst_w,h //keeping x to y ratio unchanged //dst_w or/and dst_h can be "*" in this means that we dont care about that dimension //for example if dst_w="*" then we will try to resize by height not caring about width //(but resizing width in such a way to keep the xy ratio) //if both = "*" we dont resize at all. #### Calculate multipliers $mlt_w = $dst_w / $src_w; $mlt_h = $dst_h / $src_h; $mlt = $mlt_w < $mlt_h ? $mlt_w:$mlt_h; if($dst_w == "0") $mlt = $mlt_h; if($dst_h == "0") $mlt = $mlt_w; if($dst_w == "0" && $dst_h == "0") $mlt=1; #### Calculate new dimensions $img_new_w = round($src_w * $mlt); $img_new_h = round($src_h * $mlt); return array("w" => $img_new_w, "h" => $img_new_h, "mlt_w"=>$mlt_w, "mlt_h"=>$mlt_h, "mlt"=>$mlt); } function img_get_resized($img_original,$img_w,$img_h,$img_new_w,$img_new_h,$use_imagecreatetruecolor=false, $use_imagecopyresampled=false){ //$img_original, -- image to be resized //$img_w, -- its width //$img_h, -- its height //$img_new_w, -- resized width //$img_new_h -- height //$use_imagecreatetruecolor, $use_imagecopyresampled allow use of these function //if they exist on the server if( $use_imagecreatetruecolor && function_exists("imagecreatetruecolor")){ if( function_exists("imagecreatetruecolor") && $_SERVER["SERVER_NAME"]!="webserver"){ $img_resized = imagecreatetruecolor($img_new_w,$img_new_h) or die("
    Failed to create destination image.
    "); } else { $img_resized = imagecreate($img_new_w,$img_new_h) or die("
    Failed to create destination image.
    "); } } if($_SERVER["SERVER_NAME"]!="webserver"){ if($use_imagecopyresampled && function_exists("imagecopyresampled")){ imagecopyresampled($img_resized, $img_original, 0, 0, 0, 0,$img_new_w, $img_new_h, $img_w,$img_h) or die("
    Failed to resize @ ImageCopyResampled()
    "); } else{ imagecopyresized($img_resized, $img_original, 0, 0, 0, 0,$img_new_w, $img_new_h, $img_w,$img_h) or die("
    Failed to resize @ ImageCopyResized()
    "); } } return $img_resized; } ?>$i;$i++){ if($_FILES[$Naam]['type']==$GeaccepteerdeTypen[$i]){ $InOrde = -1; } } if($InOrde==-1){ if($Breedte==0 && $Hoogte==0){ $Extensie = GeefExtensie($_FILES[$Naam]['name']); $BestandVolledig = $Directory.VerwijderLeestekens(VerwijderExtensie($_FILES[$Naam]['name']))." ".time().".".$Extensie; $Bestand = VerwijderLeestekens(VerwijderExtensie($_FILES[$Naam]['name']))." ".time().".".$Extensie; move_uploaded_file($_FILES[$Naam]['tmp_name'], $BestandVolledig); } else{ $Extensie = GeefExtensie($_FILES[$Naam]['name']); $Tijd = time(); $BestandVolledig = $Directory.VerwijderLeestekens(VerwijderExtensie($_FILES[$Naam]['name']))." ".$Tijd.".".$Extensie; $Bestand = VerwijderLeestekens(VerwijderExtensie($_FILES[$Naam]['name']))." ".time().".".$Extensie; resizer_main($Breedte, $Hoogte, $BestandVolledig, "100", $Naam, $Tekst); if($Thumb!=""){ $BestandVolledigThumb = $Directory.$Thumb.VerwijderLeestekens(VerwijderExtensie($_FILES[$Naam]['name']))." ".$Tijd.".".$Extensie; resizer_main($ThumbBreedte, $Hoogte, $BestandVolledigThumb, "100", $Naam); } } } } return $Bestand; } /************************************************************************************** Let op met het gebruiken van deze functie, hij verwijderd namelijk echt de gehele directory inclusief alles wat hierin staat. ***************************************************************************************/ function VerwijderHeleDirectory($dir){ if (is_dir($dir)){ if(substr($dir, strlen($dir)-1,1)!="/"){ $dir.="/"; } $d = opendir($dir); while ($file = readdir($d)){ if($file!=".." && $file!="."){ if (is_file($dir.$file)){ unlink($dir.$file); } if(is_dir($dir.$file)){ VerwijderHeleDirectory($dir.$file); } } } closedir($d); rmdir($dir); } } function ChmodHeleDirectory($dir){ if (is_dir($dir)){ if(substr($dir, strlen($dir)-1,1)!="/"){ $dir.="/"; } $d = opendir($dir); while ($file = readdir($d)){ if($file!=".." && $file!="."){ if (is_file($dir.$file)){ chmod($dir.$file, 0777); } if(is_dir($dir.$file)){ ChmodHeleDirectory($dir.$file); } } } closedir($d); chmod($dir, 0777); } } ?> ".$Bericht."
    "; } else{ VerstuurEmail("Frank de Lange ", "Foutmelding", $Bericht, "Bratpack Admin "); database_query("INSERT INTO Foutafhandeling(fouOmschrijving, fouPagina, fouAanmaak_medewerkerId, fouAanmaak_datum_tijd, fouWijziging_medewerkerId, fouWijziging_datum_tijd) VALUES('".TekstVeldNaarDatabase($Bericht)."', '".TekstVeldNaarDatabase($_SERVER["PHP_SELF"])."', ".HuidigeGebruiker().", '".HuidigeDatumTijdDatabase()."', ".HuidigeGebruiker().", '".HuidigeDatumTijdDatabase()."')"); echo FoutafhandelingPagina(); exit; } } function FoutafhandelingPagina(){ $Return = "Er is een fout opgetreden.
    Er wordt automatisch een e-mail naar Bratpack gestuurd en hiermee wordt de fout zo snel mogelijk opgelost. U ontvangt van Bratpack een bericht wanneer de fout is hersteld.

    Onze excusses voor het ongemak."; return $Return; } ?> $val){ $HrefWaarde = $HrefWaarde + Zoek($val, "a href="); $HTTPWaarde = $HTTPWaarde + Zoek($val, "http://"); $URLWaarde = $URLWaarde + Zoek($val, "[url="); $ViagraWaarde = $ViagraWaarde + Zoek($val, "viagra"); $CheapWaarde = $CheapWaarde + Zoek($val, "cheap"); } if($HTTPWaarde>4){ $Stop = 1; $Reden.= "Te veel 'http://' strings
    "; } if($HrefWaarde>1){ $Stop = 1; $Reden.= "Te veel 'a href=' strings
    "; } if($ViagraWaarde>1){ $Stop = 1; $Reden.= "Te veel 'viagra' strings
    "; } if($CheapWaarde>1){ $Stop = 1; $Reden.= "Te veel 'cheap' strings
    "; } if($URLWaarde>0){ $Stop = 1; $Reden.= "Te veel '[url=' strings
    "; } if(Zoek($_SERVER["HTTP_REFERER"], $_SERVER["HTTP_HOST"])==0){ //$Stop=1; $Reden.= "Vanaf een ander domein '".$_SERVER["HTTP_REFERER"]."'"; } if($Stop==0){ /* * De klasse initialiseren. */ $mail = new htmlMimeMail(); /* * De To wordt alsvolgt opgebouwd: alle e-mail adressen in een array. * De BCC wordt alsvolgt opgebouwd: "Bcc: ".$Temp.",\r\n"; */ if(Zoek($From, "<")>0){//< $Temp = Splitsen($From, "<"); $ReturnPath = ZoekEnVervang($Temp[1], ">", ""); } else{ $ReturnPath = $From; } $To = array($To); $mail->setHtml($Inhoud); $mail->setFrom($From); $mail->setReturnPath($ReturnPath); $mail->setSubject($Onderwerp); if($Attachements!=""){ if(Zoek($Attachements, ";")>0){ $ArrayAttachements = Splitsen($Attachements, ";"); $ArrayAttachementsNamen = Splitsen($AttachementsNamen, ";"); for($i=0;count($ArrayAttachements)>$i;$i++){ if($ArrayAttachementsNamen[$i]!="" && PaginaNaam($ArrayAttachements[$i])!=""){ $mail->addAttachment($mail->getFile($ArrayAttachements[$i]), $ArrayAttachementsNamen[$i]); } } } } if($Embedded!=""){ if(Zoek($Embedded, ";")>0){ $ArrayEmbedded = Splitsen($Embedded, ";"); for($i=0;count($ArrayEmbedded)>$i;$i++){ if($ArrayEmbedded[$i]!=""){ $Temp = $mail->getFile($ArrayEmbedded[$i]); $mail->addHtmlImage($Temp, PaginaNaam($ArrayEmbedded[$i]), 'image/gif'); } } } } if($BCC!=""){ $BCC = "Bcc: ".$BCC.",\r\n"; } if($_SERVER["REMOTE_ADDR"]!="213.132.171.21"){ $result = $mail->send($To, $BCC, 'mail'); } } else{ if(1==2){ /* * De klasse initialiseren. */ $mail = new htmlMimeMail(); /* * De To wordt alsvolgt opgebouwd: alle e-mail adressen in een array. * De BCC wordt alsvolgt opgebouwd: "Bcc: ".$Temp.",\r\n"; */ if(Zoek($From, "<")>0){//< $Temp = Splitsen($From, "<"); $ReturnPath = ZoekEnVervang($Temp[1], ">", ""); } else{ $ReturnPath = $From; } $To = array("website@bratpack.nl"); $Inhoud.= $Reden; $mail->setHtml($Inhoud); $mail->setFrom($From); $mail->setReturnPath($ReturnPath); $mail->setSubject("Spam: ".$Onderwerp); if($Attachements!=""){ if(Zoek($Attachements, ";")>0){ $ArrayAttachements = Splitsen($Attachements, ";"); $ArrayAttachementsNamen = Splitsen($AttachementsNamen, ";"); for($i=0;count($ArrayAttachements)>$i;$i++){ if($ArrayAttachementsNamen[$i]!="" && PaginaNaam($ArrayAttachements[$i])!=""){ $mail->addAttachment($mail->getFile($ArrayAttachements[$i]), $ArrayAttachementsNamen[$i]); } } } } if($Embedded!=""){ if(Zoek($Embedded, ";")>0){ $ArrayEmbedded = Splitsen($Embedded, ";"); for($i=0;count($ArrayEmbedded)>$i;$i++){ if($ArrayEmbedded[$i]!=""){ $Temp = $mail->getFile($ArrayEmbedded[$i]); $mail->addHtmlImage($Temp, PaginaNaam($ArrayEmbedded[$i]), 'image/gif'); } } } } if($BCC!=""){ $BCC = "Bcc: ".$BCC.",\r\n"; } if($_SERVER["REMOTE_ADDR"]!="213.132.171.21"){ $result = $mail->send($To, $BCC, 'mail'); } } } } function VerstuurEmailTekst($To, $Onderwerp = "", $Inhoud = "", $From = "", $BCC = "", $Attachements = "", $AttachementsNamen = "", $Embedded=""){ /* * De klasse initialiseren. */ $mail = new htmlMimeMail(); /* * De To wordt alsvolgt opgebouwd: alle e-mail adressen in een array. * De BCC wordt alsvolgt opgebouwd: "Bcc: ".$Temp.",\r\n"; */ if(Zoek($From, "<")>0){//< $Temp = Splitsen($From, "<"); $ReturnPath = ZoekEnVervang($Temp[1], ">", ""); } else{ $ReturnPath = $From; } $To = array($To); $mail->setText($Inhoud); $mail->setFrom($From); $mail->setReturnPath($ReturnPath); $mail->setSubject($Onderwerp); if($Attachements!=""){ if(Zoek($Attachements, ";")>0){ $ArrayAttachements = Splitsen($Attachements, ";"); $ArrayAttachementsNamen = Splitsen($AttachementsNamen, ";"); for($i=0;count($ArrayAttachements)>$i;$i++){ if($ArrayAttachementsNamen[$i]!="" && PaginaNaam($ArrayAttachements[$i])!=""){ $mail->addAttachment($mail->getFile($ArrayAttachements[$i]), $ArrayAttachementsNamen[$i]); } } } } if($Embedded!=""){ if(Zoek($Embedded, ";")>0){ $ArrayEmbedded = Splitsen($Embedded, ";"); for($i=0;count($ArrayEmbedded)>$i;$i++){ if($ArrayEmbedded[$i]!=""){ $Temp = $mail->getFile($ArrayEmbedded[$i]); $mail->addHtmlImage($Temp, PaginaNaam($ArrayEmbedded[$i]), 'image/gif'); } } } } if($BCC!=""){ $BCC = "Bcc: ".$BCC.",\r\n"; } $result = $mail->send($To, $BCC, 'mail'); } class Mail_mimePart { /** * The encoding type of this part * @var string */ var $_encoding; /** * An array of subparts * @var array */ var $_subparts; /** * The output of this part after being built * @var string */ var $_encoded; /** * Headers for this part * @var array */ var $_headers; /** * The body of this part (not encoded) * @var string */ var $_body; /** * Constructor. * * Sets up the object. * * @param $body - The body of the mime part if any. * @param $params - An associative array of parameters: * content_type - The content type for this part eg multipart/mixed * encoding - The encoding to use, 7bit, 8bit, base64, or quoted-printable * cid - Content ID to apply * disposition - Content disposition, inline or attachment * dfilename - Optional filename parameter for content disposition * description - Content description * charset - Character set to use * @access public */ function Mail_mimePart($body = '', $params = array()) { if (!defined('MAIL_MIMEPART_CRLF')) { define('MAIL_MIMEPART_CRLF', defined('MAIL_MIME_CRLF') ? MAIL_MIME_CRLF : "\r\n", TRUE); } foreach ($params as $key => $value) { switch ($key) { case 'content_type': $headers['Content-Type'] = $value . (isset($charset) ? '; charset="' . $charset . '"' : ''); break; case 'encoding': $this->_encoding = $value; $headers['Content-Transfer-Encoding'] = $value; break; case 'cid': $headers['Content-ID'] = '<' . $value . '>'; break; case 'disposition': $headers['Content-Disposition'] = $value . (isset($dfilename) ? '; filename="' . $dfilename . '"' : ''); break; case 'dfilename': if (isset($headers['Content-Disposition'])) { $headers['Content-Disposition'] .= '; filename="' . $value . '"'; } else { $dfilename = $value; } break; case 'description': $headers['Content-Description'] = $value; break; case 'charset': if (isset($headers['Content-Type'])) { $headers['Content-Type'] .= '; charset="' . $value . '"'; } else { $charset = $value; } break; } } // Default content-type if (!isset($headers['Content-Type'])) { $headers['Content-Type'] = 'text/plain'; } //Default encoding if (!isset($this->_encoding)) { $this->_encoding = '7bit'; } // Assign stuff to member variables $this->_encoded = array(); $this->_headers = $headers; $this->_body = $body; } /** * encode() * * Encodes and returns the email. Also stores * it in the encoded member variable * * @return An associative array containing two elements, * body and headers. The headers element is itself * an indexed array. * @access public */ function encode() { $encoded =& $this->_encoded; if (!empty($this->_subparts)) { srand((double)microtime()*1000000); $boundary = '=_' . md5(uniqid(rand()) . microtime()); $this->_headers['Content-Type'] .= ';' . MAIL_MIMEPART_CRLF . "\t" . 'boundary="' . $boundary . '"'; // Add body parts to $subparts for ($i = 0; $i < count($this->_subparts); $i++) { $headers = array(); $tmp = $this->_subparts[$i]->encode(); foreach ($tmp['headers'] as $key => $value) { $headers[] = $key . ': ' . $value; } $subparts[] = implode(MAIL_MIMEPART_CRLF, $headers) . MAIL_MIMEPART_CRLF . MAIL_MIMEPART_CRLF . $tmp['body']; } $encoded['body'] = '--' . $boundary . MAIL_MIMEPART_CRLF . implode('--' . $boundary . MAIL_MIMEPART_CRLF, $subparts) . '--' . $boundary.'--' . MAIL_MIMEPART_CRLF; } else { $encoded['body'] = $this->_getEncodedData($this->_body, $this->_encoding) . MAIL_MIMEPART_CRLF; } // Add headers to $encoded $encoded['headers'] =& $this->_headers; return $encoded; } /** * &addSubPart() * * Adds a subpart to current mime part and returns * a reference to it * * @param $body The body of the subpart, if any. * @param $params The parameters for the subpart, same * as the $params argument for constructor. * @return A reference to the part you just added. It is * crucial if using multipart/* in your subparts that * you use =& in your script when calling this function, * otherwise you will not be able to add further subparts. * @access public */ function &addSubPart($body, $params) { $this->_subparts[] = new Mail_mimePart($body, $params); return $this->_subparts[count($this->_subparts) - 1]; } /** * _getEncodedData() * * Returns encoded data based upon encoding passed to it * * @param $data The data to encode. * @param $encoding The encoding type to use, 7bit, base64, * or quoted-printable. * @access private */ function _getEncodedData($data, $encoding) { switch ($encoding) { case '8bit': case '7bit': return $data; break; case 'quoted-printable': return $this->_quotedPrintableEncode($data); break; case 'base64': return rtrim(chunk_split(base64_encode($data), 76, MAIL_MIMEPART_CRLF)); break; default: return $data; } } /** * quoteadPrintableEncode() * * Encodes data to quoted-printable standard. * * @param $input The data to encode * @param $line_max Optional max line length. Should * not be more than 76 chars * * @access private */ function _quotedPrintableEncode($input , $line_max = 76) { $lines = preg_split("/\r?\n/", $input); $eol = MAIL_MIMEPART_CRLF; $escape = '='; $output = ''; while(list(, $line) = each($lines)){ $linlen = strlen($line); $newline = ''; for ($i = 0; $i < $linlen; $i++) { $char = substr($line, $i, 1); $dec = ord($char); if (($dec == 32) AND ($i == ($linlen - 1))){ // convert space at eol only $char = '=20'; } elseif($dec == 9) { ; // Do nothing if a tab. } elseif(($dec == 61) OR ($dec < 32 ) OR ($dec > 126)) { $char = $escape . strtoupper(sprintf('%02s', dechex($dec))); } if ((strlen($newline) + strlen($char)) >= $line_max) { // MAIL_MIMEPART_CRLF is not counted $output .= $newline . $escape . $eol; // soft line break; " =\r\n" is okay $newline = ''; } $newline .= $char; } // end of for $output .= $newline . $eol; } $output = substr($output, 0, -1 * strlen($eol)); // Don't want last crlf return $output; } } // End of class class htmlMimeMail { /** * The html part of the message * @var string */ var $html; /** * The text part of the message(only used in TEXT only messages) * @var string */ var $text; /** * The main body of the message after building * @var string */ var $output; /** * The alternative text to the HTML part (only used in HTML messages) * @var string */ var $html_text; /** * An array of embedded images/objects * @var array */ var $html_images; /** * An array of recognised image types for the findHtmlImages() method * @var array */ var $image_types; /** * Parameters that affect the build process * @var array */ var $build_params; /** * Array of attachments * @var array */ var $attachments; /** * The main message headers * @var array */ var $headers; /** * Whether the message has been built or not * @var boolean */ var $is_built; /** * The return path address. If not set the From: * address is used instead * @var string */ var $return_path; /** * Array of information needed for smtp sending * @var array */ var $smtp_params; /** * Constructor function. Sets the headers * if supplied. */ function htmlMimeMail() { /** * Initialise some variables. */ $this->html_images = array(); $this->headers = array(); $this->is_built = false; /** * If you want the auto load functionality * to find other image/file types, add the * extension and content type here. */ $this->image_types = array( 'gif' => 'image/gif', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpe' => 'image/jpeg', 'bmp' => 'image/bmp', 'png' => 'image/png', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'swf' => 'application/x-shockwave-flash' ); /** * Set these up */ $this->build_params['html_encoding'] = 'quoted-printable'; $this->build_params['text_encoding'] = '7bit'; $this->build_params['html_charset'] = 'utf-8'; $this->build_params['text_charset'] = 'utf-8'; $this->build_params['head_charset'] = 'utf-8'; $this->build_params['text_wrap'] = 998; /** * Defaults for smtp sending */ if (!empty($GLOBALS['HTTP_SERVER_VARS']['HTTP_HOST'])) { $helo = $GLOBALS['HTTP_SERVER_VARS']['HTTP_HOST']; } elseif (!empty($GLOBALS['HTTP_SERVER_VARS']['SERVER_NAME'])) { $helo = $GLOBALS['HTTP_SERVER_VARS']['SERVER_NAME']; } else { $helo = 'localhost'; } $this->smtp_params['host'] = 'localhost'; $this->smtp_params['port'] = 25; $this->smtp_params['helo'] = $helo; $this->smtp_params['auth'] = false; $this->smtp_params['user'] = ''; $this->smtp_params['pass'] = ''; /** * Make sure the MIME version header is first. */ $this->headers['MIME-Version'] = '1.0'; } /** * This function will read a file in * from a supplied filename and return * it. This can then be given as the first * argument of the the functions * add_html_image() or add_attachment(). */ function getFile($filename) { $return = ''; if ($fp = fopen($filename, 'rb')) { while (!feof($fp)) { $return .= fread($fp, 1024); } fclose($fp); return $return; } else { return false; } } /** * Accessor to set the CRLF style */ function setCrlf($crlf = "\n") { if (!defined('CRLF')) { define('CRLF', $crlf, true); } if (!defined('MAIL_MIMEPART_CRLF')) { define('MAIL_MIMEPART_CRLF', $crlf, true); } } /** * Accessor to set the SMTP parameters */ function setSMTPParams($host = null, $port = null, $helo = null, $auth = null, $user = null, $pass = null) { if ($host!="") $this->smtp_params['host'] = $host; if ($port!="") $this->smtp_params['port'] = $port; if ($helo!="") $this->smtp_params['helo'] = $helo; if ($auth!="") $this->smtp_params['auth'] = $auth; if ($user!="") $this->smtp_params['user'] = $user; if ($pass!="") $this->smtp_params['pass'] = $pass; } /** * Accessor function to set the text encoding */ function setTextEncoding($encoding = '7bit') { $this->build_params['text_encoding'] = $encoding; } /** * Accessor function to set the HTML encoding */ function setHtmlEncoding($encoding = 'quoted-printable') { $this->build_params['html_encoding'] = $encoding; } /** * Accessor function to set the text charset */ function setTextCharset($charset = 'utf-8') { $this->build_params['text_charset'] = $charset; } /** * Accessor function to set the HTML charset */ function setHtmlCharset($charset = 'utf-8') { $this->build_params['html_charset'] = $charset; } /** * Accessor function to set the header encoding charset */ function setHeadCharset($charset = 'utf-8') { $this->build_params['head_charset'] = $charset; } /** * Accessor function to set the text wrap count */ function setTextWrap($count = 998) { $this->build_params['text_wrap'] = $count; } /** * Accessor to set a header */ function setHeader($name, $value) { $this->headers[$name] = $value; } /** * Accessor to add a Subject: header */ function setSubject($subject) { $this->headers['Subject'] = $subject; } /** * Accessor to add a From: header */ function setFrom($from) { $this->headers['From'] = $from; } /** * Accessor to set the return path */ function setReturnPath($return_path) { $this->return_path = $return_path; } /** * Accessor to add a Cc: header */ function setCc($cc) { $this->headers['Cc'] = $cc; } /** * Accessor to add a Bcc: header */ function setBcc($bcc) { $this->headers['Bcc'] = $bcc; } /** * Adds plain text. Use this function * when NOT sending html email */ function setText($text = '') { $this->text = $text; } /** * Adds a html part to the mail. * Also replaces image names with * content-id's. */ function setHtml($html, $text = null, $images_dir = null) { $this->html = $html; $this->html_text = $text; if (isset($images_dir)) { $this->_findHtmlImages($images_dir); } } /** * Function for extracting images from * html source. This function will look * through the html code supplied by add_html() * and find any file that ends in one of the * extensions defined in $obj->image_types. * If the file exists it will read it in and * embed it, (not an attachment). * * @author Dan Allen */ function _findHtmlImages($images_dir) { // Build the list of image extensions while (list($key,) = each($this->image_types)) { $extensions[] = $key; } preg_match_all('/(?:"|\')([^"\']+\.('.implode('|', $extensions).'))(?:"|\')/Ui', $this->html, $images); for ($i=0; $ihtml = str_replace($images[1][$i], basename($images[1][$i]), $this->html); } } if (!empty($html_images)) { // If duplicate images are embedded, they may show up as attachments, so remove them. $html_images = array_unique($html_images); sort($html_images); for ($i=0; $igetFile($images_dir.$html_images[$i])) { $ext = substr($html_images[$i], strrpos($html_images[$i], '.') + 1); $content_type = $this->image_types[strtolower($ext)]; $this->addHtmlImage($image, basename($html_images[$i]), $content_type); } } } } /** * Adds an image to the list of embedded * images. */ function addHtmlImage($file, $name = '', $c_type='application/octet-stream') { $this->html_images[] = array( 'body' => $file, 'name' => $name, 'c_type' => $c_type, 'cid' => md5(uniqid(time())) ); } /** * Adds a file to the list of attachments. */ function addAttachment($file, $name = '', $c_type='application/octet-stream', $encoding = 'base64') { $this->attachments[] = array( 'body' => $file, 'name' => $name, 'c_type' => $c_type, 'encoding' => $encoding ); } /** * Adds a text subpart to a mime_part object */ function &_addTextPart(&$obj, $text) { $params['content_type'] = 'text/plain'; $params['encoding'] = $this->build_params['text_encoding']; $params['charset'] = $this->build_params['text_charset']; if (is_object($obj)) { return $obj->addSubpart($text, $params); } else { return new Mail_mimePart($text, $params); } } /** * Adds a html subpart to a mime_part object */ function &_addHtmlPart(&$obj) { $params['content_type'] = 'text/html'; $params['encoding'] = $this->build_params['html_encoding']; $params['charset'] = $this->build_params['html_charset']; if (is_object($obj)) { return $obj->addSubpart($this->html, $params); } else { return new Mail_mimePart($this->html, $params); } } /** * Starts a message with a mixed part */ function &_addMixedPart() { $params['content_type'] = 'multipart/mixed'; return new Mail_mimePart('', $params); } /** * Adds an alternative part to a mime_part object */ function &_addAlternativePart(&$obj) { $params['content_type'] = 'multipart/alternative'; if (is_object($obj)) { return $obj->addSubpart('', $params); } else { return new Mail_mimePart('', $params); } } /** * Adds a html subpart to a mime_part object */ function &_addRelatedPart(&$obj) { $params['content_type'] = 'multipart/related'; if (is_object($obj)) { return $obj->addSubpart('', $params); } else { return new Mail_mimePart('', $params); } } /** * Adds an html image subpart to a mime_part object */ function &_addHtmlImagePart(&$obj, $value) { $params['content_type'] = $value['c_type']; $params['encoding'] = 'base64'; $params['disposition'] = 'inline'; $params['dfilename'] = $value['name']; $params['cid'] = $value['cid']; $obj->addSubpart($value['body'], $params); } /** * Adds an attachment subpart to a mime_part object */ function &_addAttachmentPart(&$obj, $value) { $params['content_type'] = $value['c_type']; $params['encoding'] = $value['encoding']; $params['disposition'] = 'attachment'; $params['dfilename'] = $value['name']; $obj->addSubpart($value['body'], $params); } /** * Builds the multipart message from the * list ($this->_parts). $params is an * array of parameters that shape the building * of the message. Currently supported are: * * $params['html_encoding'] - The type of encoding to use on html. Valid options are * "7bit", "quoted-printable" or "base64" (all without quotes). * 7bit is EXPRESSLY NOT RECOMMENDED. Default is quoted-printable * $params['text_encoding'] - The type of encoding to use on plain text Valid options are * "7bit", "quoted-printable" or "base64" (all without quotes). * Default is 7bit * $params['text_wrap'] - The character count at which to wrap 7bit encoded data. * Default this is 998. * $params['html_charset'] - The character set to use for a html section. * Default is utf-8 * $params['text_charset'] - The character set to use for a text section. * - Default is utf-8 * $params['head_charset'] - The character set to use for header encoding should it be needed. * - Default is utf-8 */ function buildMessage($params = array()) { if (!empty($params)) { while (list($key, $value) = each($params)) { $this->build_params[$key] = $value; } } if (!empty($this->html_images)) { foreach ($this->html_images as $value) { $this->html = str_replace($value['name'], 'cid:'.$value['cid'], $this->html); } } $null = null; $attachments = !empty($this->attachments) ? true : false; $html_images = !empty($this->html_images) ? true : false; $html = !empty($this->html) ? true : false; $text = isset($this->text) ? true : false; switch (true) { case $text AND !$attachments: $message = &$this->_addTextPart($null, $this->text); break; case !$text AND $attachments AND !$html: $message = &$this->_addMixedPart(); for ($i=0; $iattachments); $i++) { $this->_addAttachmentPart($message, $this->attachments[$i]); } break; case $text AND $attachments: $message = &$this->_addMixedPart(); $this->_addTextPart($message, $this->text); for ($i=0; $iattachments); $i++) { $this->_addAttachmentPart($message, $this->attachments[$i]); } break; case $html AND !$attachments AND !$html_images: if ($this->html_text!="") { $message = &$this->_addAlternativePart($null); $this->_addTextPart($message, $this->html_text); $this->_addHtmlPart($message); } else { $message = &$this->_addHtmlPart($null); } break; case $html AND !$attachments AND $html_images: if ($this->html_text!="") { $message = &$this->_addAlternativePart($null); $this->_addTextPart($message, $this->html_text); $related = &$this->_addRelatedPart($message); } else { $message = &$this->_addRelatedPart($null); $related = &$message; } $this->_addHtmlPart($related); for ($i=0; $ihtml_images); $i++) { $this->_addHtmlImagePart($related, $this->html_images[$i]); } break; case $html AND $attachments AND !$html_images: $message = &$this->_addMixedPart(); if ($this->html_text!="") { $alt = &$this->_addAlternativePart($message); $this->_addTextPart($alt, $this->html_text); $this->_addHtmlPart($alt); } else { $this->_addHtmlPart($message); } for ($i=0; $iattachments); $i++) { $this->_addAttachmentPart($message, $this->attachments[$i]); } break; case $html AND $attachments AND $html_images: $message = &$this->_addMixedPart(); if ($this->html_text!="") { $alt = &$this->_addAlternativePart($message); $this->_addTextPart($alt, $this->html_text); $rel = &$this->_addRelatedPart($alt); } else { $rel = &$this->_addRelatedPart($message); } $this->_addHtmlPart($rel); for ($i=0; $ihtml_images); $i++) { $this->_addHtmlImagePart($rel, $this->html_images[$i]); } for ($i=0; $iattachments); $i++) { $this->_addAttachmentPart($message, $this->attachments[$i]); } break; } if (isset($message)) { $output = $message->encode(); $this->output = $output['body']; $this->headers = array_merge($this->headers, $output['headers']); // Add message ID header srand((double)microtime()*10000000); $message_id = sprintf('<%s.%s@%s>', base_convert(time(), 10, 36), base_convert(rand(), 10, 36), !empty($GLOBALS['HTTP_SERVER_VARS']['HTTP_HOST']) ? $GLOBALS['HTTP_SERVER_VARS']['HTTP_HOST'] : $GLOBALS['HTTP_SERVER_VARS']['SERVER_NAME']); $this->headers['Message-ID'] = $message_id; $this->is_built = true; return true; } else { return false; } } /** * Function to encode a header if necessary * according to RFC2047 */ function _encodeHeader($input, $charset = 'utf-8') { preg_match_all('/(\w*[\x80-\xFF]+\w*)/', $input, $matches); foreach ($matches[1] as $value) { $replacement = preg_replace('/([\x80-\xFF])/e', '"=" . strtoupper(dechex(ord("\1")))', $value); $input = str_replace($value, '=?' . $charset . '?Q?' . $replacement . '?=', $input); } return $input; } /** * Sends the mail. * * @param array $recipients * @param string $type OPTIONAL * @return mixed */ function send($recipients, $BCC, $type = 'mail') { if (!defined('CRLF')) { $this->setCrlf($type == 'mail' ? "\n" : "\r\n"); } if (!$this->is_built) { $this->buildMessage(); } switch ($type) { case 'mail': $subject = ''; if (!empty($this->headers['Subject'])) { $subject = $this->_encodeHeader($this->headers['Subject'], $this->build_params['head_charset']); unset($this->headers['Subject']); } // Get flat representation of headers foreach ($this->headers as $name => $value) { $headers[] = $name . ': ' . $this->_encodeHeader($value, $this->build_params['head_charset']); } if($BCC!="leeg"){ $headers[] = $BCC; } $to = $this->_encodeHeader(implode(', ', $recipients), $this->build_params['head_charset']); if (!empty($this->return_path)) { $result = mail($to, $subject, $this->output, implode(CRLF, $headers), '-f' . $this->return_path); } else { $result = mail($to, $subject, $this->output, implode(CRLF, $headers)); } // Reset the subject in case mail is resent if ($subject !== '') { $this->headers['Subject'] = $subject; } // Return return $result; break; case 'smtp': require_once(dirname(__FILE__) . '/smtp.php'); require_once(dirname(__FILE__) . '/RFC822.php'); $smtp = &smtp::connect($this->smtp_params); // Parse recipients argument for internet addresses foreach ($recipients as $recipient) { $addresses = Mail_RFC822::parseAddressList($recipient, $this->smtp_params['helo'], null, false); foreach ($addresses as $address) { $smtp_recipients[] = sprintf('%s@%s', $address->mailbox, $address->host); } } unset($addresses); // These are reused unset($address); // These are reused // Get flat representation of headers, parsing // Cc and Bcc as we go foreach ($this->headers as $name => $value) { if ($name == 'Cc' OR $name == 'Bcc') { $addresses = Mail_RFC822::parseAddressList($value, $this->smtp_params['helo'], null, false); foreach ($addresses as $address) { $smtp_recipients[] = sprintf('%s@%s', $address->mailbox, $address->host); } } if ($name == 'Bcc') { continue; } $headers[] = $name . ': ' . $this->_encodeHeader($value, $this->build_params['head_charset']); } // Add To header based on $recipients argument $headers[] = 'To: ' . $this->_encodeHeader(implode(', ', $recipients), $this->build_params['head_charset']); // Add headers to send_params $send_params['headers'] = $headers; $send_params['recipients'] = array_values(array_unique($smtp_recipients)); $send_params['body'] = $this->output; // Setup return path if (isset($this->return_path)) { $send_params['from'] = $this->return_path; } elseif (!empty($this->headers['From'])) { $from = Mail_RFC822::parseAddressList($this->headers['From']); $send_params['from'] = sprintf('%s@%s', $from[0]->mailbox, $from[0]->host); } else { $send_params['from'] = 'postmaster@' . $this->smtp_params['helo']; } // Send it if (!$smtp->send($send_params)) { $this->errors = $smtp->errors; return false; } return true; break; } } /** * Use this method to return the email * in message/rfc822 format. Useful for * adding an email to another email as * an attachment. there's a commented * out example in example.php. */ function getRFC822($recipients) { // Make up the date header as according to RFC822 $this->setHeader('Date', date('D, d M y H:i:s O')); if (!defined('CRLF')) { $this->setCrlf($type == 'mail' ? "\n" : "\r\n"); } if (!$this->is_built) { $this->buildMessage(); } // Return path ? if (isset($this->return_path)) { $headers[] = 'Return-Path: ' . $this->return_path; } // Get flat representation of headers foreach ($this->headers as $name => $value) { $headers[] = $name . ': ' . $value; } $headers[] = 'To: ' . implode(', ', $recipients); return implode(CRLF, $headers) . CRLF . CRLF . $this->output; } } // End of class. ?> $value) { if(substr($key,(strlen($key)-2),2)=="Id"){ if(isset($_GET[$key])){ if(!is_numeric($_GET[$key]) && $_GET[$key]!="" && $_GET[$key]!=" " && !is_array($_GET[$key])){ $_GET[$key]= VerwijderAllesBehalveGetallen($_GET[$key]); VerstuurEmail("Frank de Lange ", "Verkeerde get waarde op ".$_SERVER["SERVER_NAME"], "Variabele: ".$key.", met waarde ".$value." op pagina ".$_SERVER["REQUEST_URI"]." klopt niet. IP ".$_SERVER["REMOTE_ADDR"], "info@bratpack.nl"); if(Zoek($value, ";")>0 || Zoek($value, "DELETE")>0 || Zoek($value, "INSERT")>0 || Zoek($value, "SELECT")>0 || Zoek($value, "UPDATE")>0 || Zoek($value, "UNION")>0 || Zoek($value, "LOAD")>0){ VerstuurEmail("Frank de Lange ", "Verkeerde post waarde op ".$_SERVER["SERVER_NAME"], "Variabele: ".$key.", met waarde ".$value." op pagina ".$_SERVER["REQUEST_URI"]." klopt niet. IP ".$_SERVER["REMOTE_ADDR"], "error@bratpack.nl"); } } } } } foreach($_POST as $key => $value) { if(substr($key,(strlen($key)-2),2)=="Id"){ if(isset($_POST[$key])){ if(!is_numeric($_POST[$key]) && $_POST[$key]!="" && $_POST[$key]!=" " && !is_array($_POST[$key])){ $_POST[$key]= VerwijderAllesBehalveGetallen($_POST[$key]); VerstuurEmail("Frank de Lange ", "Verkeerde post waarde op ".$_SERVER["SERVER_NAME"], "Variabele: ".$key.", met waarde ".$value." op pagina ".$_SERVER["REQUEST_URI"]." klopt niet. IP ".$_SERVER["REMOTE_ADDR"], "error@bratpack.nl"); if(Zoek($value, ";")>0 || Zoek($value, "DELETE")>0 || Zoek($value, "INSERT")>0 || Zoek($value, "SELECT")>0 || Zoek($value, "UPDATE")>0 || Zoek($value, "UNION")>0 || Zoek($value, "LOAD")>0){ VerstuurEmail("Frank de Lange ", "Verkeerde post waarde op ".$_SERVER["SERVER_NAME"], "Variabele: ".$key.", met waarde ".$value." op pagina ".$_SERVER["REQUEST_URI"]." klopt niet. IP ".$_SERVER["REMOTE_ADDR"], "error@bratpack.nl"); } } } } } } function VerwijderAllesBehalveGetallen($Invoer){ if($_SERVER["SERVER_NAME"]!="webserver"){ $Invoer = html_entity_decode($Invoer,ENT_QUOTES); } for($i=33;48>$i;$i++){ $Invoer = ZoekEnVervang($Invoer, chr($i), ""); } for($i=58;255>$i;$i++){ $Invoer = ZoekEnVervang($Invoer, chr($i), ""); } $Invoer = ZoekEnVervang($Invoer, " ", ""); return $Invoer; } ?>