quoteHandling(); } function quoteHandling() { if(sizeof($_POST) > 0){ foreach($_POST as $name => $value) { $value = str_replace("\"",""",$value); $value = str_replace("'", "'",$value); $value = str_replace("\\\\", "\",$value); if(is_string($value)) $value = stripslashes($value); $_POST[$name]=$value; } } if(sizeof($_GET) > 0){ foreach($_GET as $name => $value) { $value = str_replace("\"",""",$value); $value = str_replace("'", "'",$value); $value = str_replace("\\\\", "\",$value); if(is_string($value)) $value = stripslashes($value); $_GET[$name]=$value; } } if(sizeof($_SESSION) > 0){ foreach($_SESSION as $name => $value) { $value = str_replace("\"",""",$value); $value = str_replace("'", "'",$value); $value = str_replace("\\\\", "\",$value); $value = str_replace("\\", "\",$value); if(is_string($value)) $value = stripslashes($value); $_SESSION[$name]=$value; } } //print_r($_SESSION); } function readInFiles($sPath) { $myFileContent = ""; if(file_exists($sPath)) { $fh = fopen($sPath,"r"); while(!feof($fh)) { $myFileContent.=fgets($fh); } fclose($fh); } return $myFileContent; } function readInOnlineFiles($sPath) { $myFileContent = ""; $fh = fopen($sPath,"r"); while(!feof($fh)) { $myFileContent.=fgets($fh); } fclose($fh); return $myFileContent; } function writeInFile($sPath, $sContent,$writeMode="w+") { $retValue = ""; if(file_exists($sPath)) unlink($sPath); $fh = fopen($sPath,$writeMode); $Result = fwrite($fh,$sContent); $retValue = $Result; return $retValue; } function getFiles($sPath,$Mode) { $retValue = array(); $dr = opendir($sPath); while(($myFile = readdir($dr))) { if($myFile!=="." && $myFile!=="..") { switch($Mode) { case "MODE_F": if(is_file($sPath.$myFile)) $retValue[]=$myFile; break; case "MODE_D": if(is_dir($sPath.$myFile)) $retValue[]=$myFile; break; case "MODE_FD": $retValue[]=$myFile; break; } } } closedir($dr); #sort($retValue); switch($Mode){ case 'MODE_FD': sort($retValue); } return $retValue; } function JSRedirect($sURL) { echo " "; } function EmailValidation($sEmail) { $retValue = false; $EmailPattern = "/^[\w-]+(\.[\w-]+)*@([0-9a-z][0-9a-z-]*[0-9a-z]\.)+([a-z]{2,4})$/i"; if(preg_match($EmailPattern,$sEmail)) { $retValue = true; } return $retValue; } function sendMail($subject, $message, $from_name, $from_email, $to_email) { mail($to_email, $subject, $message, "From: ".$from_name." <".$from_email.">", "-f ".$from_email.""); } function sendHTMLMail($subject, $message, $from_name, $from_email, $to_email) { $boundary = strtoupper(md5(uniqid(time()))); $headers = "From: $from_name <$from_email>"; $headers .= "\nMIME-Version: 1.0"; $headers .= "\nContent-Type: multipart/mixed; boundary=\"$boundary\""; $headers .= "\n\n--$boundary"; $headers .= "\nContent-Type: text/html; charset=iso-8859-1"; $headers .= "\nContent-Transfer-Encoding: 8bit"; $headers .= "\n\n$message"; $headers .= "\n\n--$boundary--\n"; mail($to_email, $subject, $message, $headers); } function extendedURLParser($sInput) { $sInput = str_replace(" ","",$sInput); $retValue = ""; $arr_URLSet = parse_url($sInput); if(!isset($arr_URLSet["host"])) { $sInput = "http://".$sInput; return $this->extendedURLParser($sInput); } else { preg_match_all("|(.+)(\.)(.+)$|U",$arr_URLSet["host"],$Result_Step1,PREG_SET_ORDER); $ResultElements = $Result_Step1[0][0]; $CheckString = strrev($ResultElements); preg_match_all("|^([a-zA-Z0-9-]*\.)([a-zA-Z0-9-]*)|",$CheckString,$Result_Step2,PREG_SET_ORDER); $retValue = strtolower(strrev($Result_Step2[0][0])); return $retValue; } } function dir_del($path) { if (!is_dir ($path)) { return -1; } $dir = opendir ($path); if (!$dir) { return -2; } while ($entry = readdir($dir)) { if ($entry == '.' || $entry == '..') continue; if (is_dir ($path.'/'.$entry)) { $res = $this->dir_del($path.'/'.$entry); if ($res == -1) { closedir ($dir); return -2; } else if ($res == -2) { closedir ($dir); return -2; } else if ($res == -3) { closedir ($dir); return -3; } else if ($res != 0) { closedir ($dir); return -2; } } else if (is_file ($path.'/'.$entry) || is_link ($path.'/'.$entry)) { $res = unlink ($path.'/'.$entry); if (!$res) { closedir ($dir); return -2; } } else { closedir ($dir); return -3; } } closedir ($dir); $res = rmdir ($path); if (!$res) { return -2; } return 0; } function onlyNumbers($sString) { $retValue = ""; preg_match_all("|[0-9]|U",$sString,$Result); foreach($Result[0] as $NumberItem) { $retValue .= $NumberItem; } return $retValue; } function leading_zero($length,$number) { $length=$length-strlen($number); for ($i = 0; $i < $length; $i++) { $number = "0" . $number; } return($number); } function dateToStamp($sD,$sM,$sY,$sH,$sI,$sS) { return mktime($sH,$sI,$sS,$sM,$sD,$sY); } ///// Erweitert durch T. Tittel ///// 2008/09 function formatURL($url){ $urltmp = array(); if(substr($url,0,11) != 'http://www.'){ if(substr($url,0,4) == 'www.'){ $url = 'http://'.$url;} if(substr($url,0,4) != 'www.'){ $url = 'http://www.'.$url;} } $urltmp['visit'] = str_replace('http://','',$url); $urltmp['link'] = $url; return $urltmp; } function markSearch($str,$phrase){ if(trim($phrase) != ""){ $suchmuster = '(.*)('. quotemeta($phrase) .')(.*)'; $ersatz = '\\1\\2\\3'; $str = eregi_replace($suchmuster, $ersatz, $str); } return $str; } } function ctTracking($URL,$PID){ global $Pdb; $ergCT = $Pdb->query("SELECT COUNT(ID) AS 'Hits' FROM pp_tracking_partnerlinks WHERE Project = '".$PID."' AND Ref LIKE '%".mysql_real_escape_string($URL)."%' "); if($ergCT->numRows() > 0){ $resCT = $ergCT->fetchRow(); return $resCT['Hits']; }else{ return 0; } } function isExt($URL){ global $Pdb; $txt=""; $ergCT = $Pdb->query("SELECT ID FROM pp_projects WHERE ( Domain LIKE '%".mysql_real_escape_string(str_replace("www.","",$URL))."%' OR Domain2 LIKE '%".mysql_real_escape_string(str_replace("www.","",$URL))."%' OR Domain3 LIKE '%".mysql_real_escape_string(str_replace("www.","",$URL))."%' OR Domain4 LIKE '%".mysql_real_escape_string(str_replace("www.","",$URL))."%' ) "); if($ergCT->numRows() == 0){ $txt = "E"; }else{ $txt = " "; } return $txt; } function is_utf8($str){ $strlen = strlen($str); for($i=0; $i<$strlen; $i++){ $ord = ord($str[$i]); if($ord < 0x80) continue; // 0bbbbbbb elseif(($ord&0xE0)===0xC0 && $ord>0xC1) $n = 1; // 110bbbbb (exkl C0-C1) elseif(($ord&0xF0)===0xE0) $n = 2; // 1110bbbb elseif(($ord&0xF8)===0xF0 && $ord<0xF5) $n = 3; // 11110bbb (exkl F5-FF) else return false; // ungültiges UTF-8-Zeichen for($c=0; $c<$n; $c++) // $n Folgebytes? // 10bbbbbb if(++$i===$strlen || (ord($str[$i])&0xC0)!==0x80) return false; // ungültiges UTF-8-Zeichen } return true; // kein ungültiges UTF-8-Zeichen gefunden } ?>CID = $ID; $this->DB = $DB; $this->setRights(); } function setRights(){ $erg = $this->DB->query("SELECT * FROM pp_customers_rights WHERE id_kd='".$this->CID."'"); if($erg->numRows() > 0){ $res = $erg->fetchRow(); $this->statistik = $res['statistik']; $this->keywords = $res['keywords']; $this->wysiwyg = $res['wysiwyg']; } } } ?>