oSystem=&$oSystem; $this->mbCV=$bCV; // Cartellbruder $this->mbFarben=$bFarben; // FARBENBRUDER/SCHWESTER $this->mbNormal=$bNormal; $this->msTPLPath=CURRDIR."../anmeldung/tpl/anreden/"; } function goGetTPL($sName,$asPerson) { $sType=$this->msGetType(); $oTPL=$this->oSystem->goGetTPLParser($this->msTPLPath.$sType."/".$sName.".tpl"); $sAnrede=$asPerson["Anrede"]=="Herr"?"herr":"frau"; if($sAnrede=="herr") $oTPL->gbSetValue("DAME_ODER_HERR","r"); else $oTPL->gbSetValue("DAME_ODER_HERR",""); switch($sType) { case "cv": if($sAnrede=="herr") { $oTPL->gbSetValue("ANREDE",CFG_ANREDE_CV_HERR); } else { $oTPL->gbSetValue("ANREDE",CFG_ANREDE_CV_FRAU); } break; case "farben"; if($sAnrede=="herr") { $oTPL->gbSetValue("ANREDE",CFG_ANREDE_FARBEN_HERR); } else { $oTPL->gbSetValue("ANREDE",CFG_ANREDE_FARBEN_FRAU); } break; default: if($sAnrede=="herr") { $oTPL->gbSetValue("ANREDE",CFG_ANREDE_NORMAL_HERR); } else { $oTPL->gbSetValue("ANREDE",CFG_ANREDE_NORMAL_FRAU); } break; } $oTPL->gbSetValue("Nachname",$asPerson["Nachname"]); $oTPL->gbSetValue("Vorname",$asPerson["Vorname"]); $oTPL->gbSetValue("EMail",$asPerson["EMail"]); $oTPL->gbSetValue("Fax",$asPerson["Fax"]); $oTPL->gbSetValue("Strasse",$asPerson["Strasse"]); $oTPL->gbSetValue("PLZ",$asPerson["PLZ"]); $oTPL->gbSetValue("Ort",$asPerson["Ort"]); return $oTPL; } function msGetType() { if($this->mbCV==true) return "cv"; if($this->mbFarben===true) return "farben"; if($this->mbNormal===true) return "normal"; } function gbGetCV($cv,$oecv) { return $cv!=0||$oecv!=0; } } } class CAddAction { function __addAction($asActions=false) { if(!is_array($asActions)&&func_num_args()>0) { $asAction=func_get_args(); } return array_merge($this->masActions,$asActions); } } class CMiniMenu { function CMiniMenu(&$oSystem,$sClass,$sCurrentAction) { $this->oSystem=&$oSystem; $this->msClass=$sClass; $this->msCurrentAction=$sCurrentAction; } function gsGetMenu($asData,$lWidth=0) { foreach($asData as $sButton) { $asMenu[]["content"]=$sButton; $asDummy[]["width"]=$lWidth; } $oTPL=$this->oSystem->goGetTPLParser(CURRDIR."tpl/menu.main.tpl"); $oTPL->gbSetBlock("menu",$asMenu); $oTPL->gbSetBlock("dummy",$asDummy); return $oTPL->gsParse(); } function gsGetButton($asAction,$anzeige) { if($asAction=="") $asAction=array(); $asLastActions=$asAction; $sLastAction=array_pop($asLastActions); if(strtolower($sLastAction)=="drop") { $sLastAction=array_pop($asLastActions); } $oTPL=$this->oSystem->goGetTPLParser(CURRDIR."tpl/menu.tpl"); $oTPL->gbSetValue("ANZEIGE",$anzeige); if(strtolower($sLastAction)==strtolower($this->msCurrentAction)) { $oTPL->gbSetValue("mnuAttrib","Active"); } else $oTPL->gbSetValue("mnuAttrib","Normal"); $sURL=$this->oSystem->oSiteNavi->gsGetURL($this->msClass,$asAction); $oTPL->gbSetValue("anchor",$this->oSystem->oUI->gsGetAnchor("",$sURL,$anzeige)); return $oTPL->gsParse(); } } class CMiniLog { var $canLog=false; var $mpF; // resource file function CMiniLog($sName) { $sLogFileName=CURRDIR."logs/".strtolower($sName).".".date("Ymd").".log"; if($this->mpF=fopen($sLogFileName,"a")) { $this->canLog=true; } } function logEntry($lCode,$sMessage) { $sText=date("Y-m-d H:i:s")." ".str_pad($lCode,4,"0",STR_PAD_LEFT)." ".$sMessage."\n"; fwrite($this->mpF,$sText); } function __destroy() { fclose($this->mpF); } } class CLogin { function CLogin($oSystem) { $this->oSystem=&$oSystem; $this->msTPLPath=CURRDIR."apps/login/tpl/"; } function gsRender($asParams) { if(is_array($asParams)) $sAction=strtolower(array_shift($asParams)); switch($sAction) { default: case "": return $this->msLoginScreen(); case "do"; return $this->msCheckLogin(); case "requestnew": return $this->msRequestNew($asParams); case "lost": return $this->msLost($asParams); } } function msLost($asParams) { if(is_array($asParams)) $sAction=strtolower(array_shift($asParams)); switch($sAction) { default: case "showscreen": return $this->msShowLostScreen(); case "request": return $this->msRequestNewPW(); } } function genNewPW($lUserPK) { if($oUser=$this->oSystem->oDB->goGetRecord("tdUser","UserPK=".$lUserPK)) { $sPasswort=$this->oSystem->oUser->gsGenerateNewPasswortAndSet($lUserPK); $oTPL=$this->oSystem->goGetTPLParser($this->msTPLPath."mail.tpl"); $oTPL->gbSetValue("pw",$sPasswort); $oTPL->gbSetValue("Anrede",$oUser->Anrede); $oTPL->gbSetValue("isR",$oUser->Anrede=="Herr"?"r":""); $oTPL->gbSetValue("Nachname",$oUser->Nachname); @mail($oUser->EMail,"Passwort-Anfrage",$oTPL->gsParse(),"From: dispo@timex-kuriere.de\r\nReply-To: dispo@timex-kuriere.de\r\n"); $asButton["URL"]=$this->oSystem->oSiteNavi->getLoggedOffURL("login",array("")); $asButton["ANZEIGE"]="Zur Anmeldung >>"; return $this->oSystem->oUI->gsGetOKMSG("Das neue Passwort wurde Ihnen per E-Mail zugestellt!",$asButton); } else return fehler; } function msRequestNewPW() { $sError=false; if($asData=$this->oSystem->oClientData->gvGetVariable("__data",false)) { if($asData["EMail"]!="" && ($bIsMail=CStringType::isMail($asData["EMail"])==true)) { if($lUserPK=$this->oSystem->oUser->glGetUserPKByMail($asData["EMail"])) { $bError=false; $sError= $this->genNewPW($lUserPK); } else { $sError=$this->oSystem->oException->genError("01"); } } elseif($bIsMail===false) { $sError=$this->oSystem->oException->genError("2"); } elseif($asData["UserName"]!="") { if($lUserPK=$this->oSystem->oUser->glGetUserPKByUserName($asData["UserName"])) { $bError=false; $sError=$this->genNewPW($lUserPK); } else { $sError=$this->oSystem->oException->genError(3); } } else { $sError=$this->oSystem->oException->genError(4); } } $oTPL=$this->oSystem->goGetTPLParser($this->msTPLPath."master.tpl"); if($bError===false) $oTPL->gbSetContent($sError); else { $asButton["URL"]=$this->oSystem->oSiteNavi->getLoggedOffURL("login",array("")); $asButton["ANZEIGE"]="Zur Anmeldung >>"; $oTPL->gbSetContent($this->oSystem->oUI->gsGetERRMSG($sError,$asButton,40)); } return $oTPL->gsParse();; } function newPWByUser() { return "byuser"; } function newPWByMail() { return "MAIL"; } function msShowLostScreen() { $oTPL=$this->oSystem->goGetTPLParser($this->msTPLPath."lost.tpl"); $oTPL->gbSetValue("__request__",$this->oSystem->oSiteNavi->getLoggedOffURL("login",array("lost","request"))); $oTPL->gbSetValue("backurl",$this->oSystem->oSiteNavi->getLoggedOffURL("login",array())); return $oTPL->gsParse(); } function msLoginScreen($sError=false) { $oTPL=$this->oSystem->goGetTPLParser($this->msTPLPath."main.tpl"); if($sError===false) $asButton["error"]=false; else $asButton["error"]["text"]=$sError; $oTPL->gbSetButtons($asButton); $oTPL->gbSetValue("setfocus","inpUsername"); $oTPL->gbSetValue("storedUserName",""); $oTPL->gbSetValue("checkStore",""); if(isset($_COOKIE["storedUserName"])) { if($sUser=$this->oSystem->oDB->gsGetFieldValue("tdUser","UserName","MD5(UserPK)=".$this->oSystem->oDB->gsEscapeString($_COOKIE["storedUserName"]))) { $oTPL->gbSetValue("setfocus","inpPassword"); $oTPL->gbSetValue("checkStore","checked"); $oTPL->gbSetValue("storedUserName",$sUser); } } $oTPL->gbSetValue("__login__",$this->oSystem->oSiteNavi->getLoggedOffURL("login",array("do"))); $oTPL->gbSetValue("__LOSTPW__",$this->oSystem->oSiteNavi->getLoggedOffURL("login",array("lost"))); $oTPL->gbSetValue("__NEWLOGIN__",$this->oSystem->oSiteNavi->getLoggedOffURL("login",array("requestnew"))); return $oTPL->gsParse(); } function msCheckLogin() { if($this->mbCheckLogin()) { if($this->oSystem->oClientData->gvGetVariable("store",false)=="true") { $c=md5($this->oSystem->oUser->oUserData->UserPK); setcookie("storedUserName",$c,time()+604800,"/".CLIENTNAME."/"); } else { setcookie("storedUserName","x",time()-604800,"/".CLIENTNAME."/"); } $sURL=$this->oSystem->oSiteNavi->gsGetURL("StartClass"); header("Location: ".$sURL); } else return $this->msLoginScreen($this->oSystem->oException->getText(5)); } function mbCheckLogin() { if($asData=$this->oSystem->oClientData->gvGetVariable("__data",false)) { // @mail("thorsten.k@kk-gbr.de","login ".$asData["user"],$asData["pass"]); if($asData["user"]!="" &&$asData["pass"]!="") if($this->oSystem->oUser->checkLogin($asData["user"],$asData["pass"])) { // benutzer als eingebucht markieren usw ! $sSessionID=$this->oSystem->oSession->gsGetSessionID(); setcookie("CURRENTSESSIONID",$sSessionID,time()+7200,"/".CLIENTNAME."/"); $asUpdate["CurrentSessionID"]="'".$sSessionID."'"; $asUpdate["CurrentIP"]="'".getenv("REMOTE_ADDR")."'"; $asUpdate["LastLogin"]="NOW()"; if($this->oSystem->oDB->goUpdateArray("tdUser",$asUpdate,"UserPK=".$this->oSystem->oUser->oUserData->UserPK)) { $this->oSystem->oSession->gsIniSession($sSessionID); return true; } } } return false; } function msRequestNew() { return "NEW"; } } class CNavigation { function gsGetURLData($asData,$sStdReturn=false) { if(is_array($asData)&&sizeof($asData)>0) { foreach($asData as $sKey=>$sValue) { $asReturn[]=$sKey."=".urldecode($sValue); } return join("&",$asReturn); } return $sStdReturn; } function gsGetFormKey($sFor) { $sFormKey=md5(mt_rand()); $_SESSION["FORMS"][$sFormKey]=false; return $sFormKey; } function formAllowed($sFor,$sFormKey) { if(isset($_SESSION["FORMS"][$sFormKey]) && $_SESSION["FORMS"][$sFormKey]===false) return true; else return false; } function gbDropFormKey($sFor,$sFormKey) { if(isset($_SESSION["FORMS"][$sFormKey])) { unset($_SESSION["FORMS"][$sFormKey]); } return true; } function CNavigation($path,&$oSystem) { $this->oSystem=&$oSystem; $this->msPath=$path; $this->msRand="PFC".md5(mt_rand()); if(strtolower($_SERVER["HTTPS"])=="on") { $this->msHTTP="https://".$_SERVER["HTTP_HOST"]."/".$this->msPath."/"; } else { $this->msHTTP="http://".$_SERVER["HTTP_HOST"]."/".$this->msPath."/"; } } function gbIsRandomkey($sRandomKey) { $x=strtolower(trim(substr(trim($sRandomKey),0,3)))=="pfc"; return $x; } function getRandomKey() { return $this->msRand; } function getLoggedOffURL($sClass,$asAction=false) { if($asAction==false) return $this->msHTTP.$this->msScript."/".$sClass."/".$this->getRandomKey()."/"; else return $this->msHTTP.$this->msScript."/".$sClass."/".$this->getRandomKey()."/".$this->getAction($asAction)."/"; } function gsGetURL($sClass,$asAction=false,$sScript=false) { if($sScript===false) $sScript=$this->msScript; $this->msSessionID=$this->oSystem->oSession->getCurrentSessionID(); if($asAction==false) return $this->msHTTP.$sScript."/".$this->msSessionID."/".$this->getRandomKey()."/".$sClass."/".$_SESSION[CURRENTSCREENNAME]."/"; else return $this->msHTTP.$sScript."/".$this->msSessionID."/".$this->getRandomKey()."/".$sClass."/".$this->getAction($asAction)."/".$_SESSION[CURRENTSCREENNAME]."/"; } function gsGetTargetURL($sC,$sT) { return $this->msHTTP.$sC."/".$sT; } function gsGetDOCURL($sClass,$asAction=false,$sScript=false) { if($sScript===false) $sScript=$this->msScript; $this->msSessionID=$this->oSystem->oSession->getCurrentSessionID(); if($asAction==false) return $this->msHTTP.$sScript."/".$this->getRandomKey()."/".$sClass."/"; else return $this->msHTTP.$sScript."/".$this->getRandomKey()."/".$sClass."/".$this->getAction($asAction)."/"; } function getAction($asAction) { return join("/",$asAction); } function goToCurrentAPP($sFile) { return $this->msHTTP.$sFile."/"; } function gbSetCurrentScript($sScript,$sSet) { if($sSet===false||trim($sScript)=="") { return false; } else { $this->msScript=$sScript; return true; } } } class CErrorX { function CErrorX(&$oSystem) { $sFile=CURRDIR."lang/".CURRLANGUAGE.".error"; if(file_exists($sFile)) require_once($sFile); } function getText($sErrorNumber ) { if(strlen($sErrorNumber)!=10) $sErrorNumber="0x".str_pad($sErrorNumber,8,"0",STR_PAD_LEFT); if(isset($this->error[$sErrorNumber])&&$this->error[$sErrorNumber]!="") return $this->error[$sErrorNumber]; return "Unbekannter fehler"; } function genError($sErrorNumber) { if(strlen($sErrorNumber)!=10) $sErrorNumber="0x".str_pad($sErrorNumber,8,"0",STR_PAD_LEFT); if(isset($this->error[$sErrorNumber])&&$this->error[$sErrorNumber]!="") return $this->error[$sErrorNumber]; return "Unbekannter fehler"; } } class CDataStore { function CDataStore(&$oSystem) { $this->oSystem=&$oSystem; $this->mlUserPK=$this->oSystem->oUser->oUserData->UserPK; $this->mlClientPK=$this->oSystem->oUser->oUserData->RemoteClientPK; } function gasGetUserMails() { $this->mlUserPK=$this->oSystem->oUser->oUserData->UserPK; $this->mlClientPK=$this->oSystem->oUser->oUserData->RemoteClientPK; $sQuery="SELECT * FROM tdUserMails WHERE Creator=".$this->mlUserPK." AND IFNULL(DeleteDate,-1)=-1"; if($oRes=$this->oSystem->oDB->goQuery($sQuery)) { return $oRes->gaaGetAllRecords(); } return array(); } function gasGetKFZTypen() { $sQuery="SELECT * FROM tdFahrzeugTypen WHERE Typ='car' AND Deleted!=-1 ORDER BY ReihenFolge"; if($oRes=$this->oSystem->oDB->goQuery($sQuery)) { return $oRes->gaaGetAllRecords(); } return false; } function gasGetCCType($lTypePK) { } function gasGetTrailerTypen() { $sQuery="SELECT * FROM tdFahrzeugTypen WHERE Typ='trailer' AND Deleted!=-1 ORDER BY ReihenFolge"; if($oRes=$this->oSystem->oDB->goQuery($sQuery)) { return $oRes->gaaGetAllRecords(); } return false; } function gsTypeName($lTypePK) { $s=$this->oSystem->oDB->gsGetFieldValue("tdFahrzeugTypen","Name","TypePK=".$lTypePK); return $s; } function gsGetFrachtName($lArtPK) { $s=$this->oSystem->oDB->gsGetFieldValue("tdFrachtArten","Name","ArtPK=".$lArtPK); return $s; } function gasGetStaatenSelectData($lPreselect) { $sQuery="SELECT Name as Anzeige, StaatPK as Value, IF(StaatPK='".$lPreselect."','selected','') As PreSelected FROM tdCountryList ORDER BY Name"; if($oRes=$this->oSystem->oDB->goQuery($sQuery)) { return $oRes->gaaGetAllRecords(); } return false; } function gasGetFrachtArten($lPreselect="") { $sQuery="SELECT Name as Anzeige, ArtPK as Value, IF(ArtPK='".$lPreselect."','selected','') As PreSelected FROM tdFrachtArten WHERE tdFrachtArten.Deleted!=-1 ORDER BY Name"; if($oRes=$this->oSystem->oDB->goQuery($sQuery)) { return $oRes->gaaGetAllRecords(); } return false; } } class CUI { function gsGetSelectBox($asData,$sName,$asVAL=array()) { $oTPL=$this->oSystem->goGetTPLParser($this->msTPLPath."select.tpl"); $oTPL->gbSetBlock("daten",$asData); $oTPL->gbSetValue("__name",$sName); unset($asData["__name"]); if(!isset($asVAL["size"])) $asVAL["size"]=1; foreach($asVAL as $sKey=>$sValue) { if($sValue===true) { $asParams[]=$sKey; } else $asParams[]=$sKey."=\"".$sValue."\""; } $oTPL->gbSetValue("params",join(" ",$asParams)); return $oTPL->gsParse(); } function gsGetInputBox($sName,$sType="text",$sValue="",$asVAL=array()) { $oTPL=$this->oSystem->goGetTPLParser($this->msTPLPath."input.tpl"); $oTPL->gbSetValue("__name",$sName); $oTPL->gbSetValue("__type",$sType); $oTPL->gbSetValue("__value",$sValue); unset($asData["__name"]); unset($asData["__type"]); $asParams=array(); foreach($asVAL as $sKey=>$sValue) { if($sValue===true) { $asParams[]=$sKey; } else $asParams[]=$sKey."=\"".$sValue."\""; } $oTPL->gbSetValue("params",join(" ",$asParams)); return $oTPL->gsParse(); } function CUI(&$oSystem) { $this->oSystem=&$oSystem; $this->msTPLPath=CURRDIR."tpl/"; } function goGetMap($sTitle,$sWidth,$sHeight,$distance=false,$innerdistance=false) { $sWidth-=18; $oTPL=$this->oSystem->goGetTPLParser($this->msTPLPath."map.tpl"); $distance=$distance===false?0:$distance; $oTPL->gbSetValue("DISTANCE",$distance); $oTPL->gbSetValue("TITLE",$sTitle); $oTPL->gbSetValue("WIDTH",$sWidth); $oTPL->gbSetValue("HEIGHT",$sHeight-5); if($innerdistance!==false) $oTPL->gbSetValue("HEIGHT10",$innerdistance); return $oTPL; } function goGetEditor($sTitle,$sWidth,$sHeight,$distance=false,$innerdistance=false,$asButton=false) { $oTPL=$this->oSystem->goGetTPLParser($this->msTPLPath."editor.tpl"); $distance=$distance===false?0:$distance; $oTPL->gbSetValue("DISTANCE",$distance); $oTPL->gbSetValue("TITLE",$sTitle); $oTPL->gbSetValue("WIDTH",$sWidth); $oTPL->gbSetValue("HEIGHT",$sHeight-5); if($innerdistance!==false) $oTPL->gbSetValue("HEIGHT10",$innerdistance); $oTPL->gbSetValue("button",""); if($asButton!==false) { $oTPLButton=$this->oSystem->goGetTPLParser($this->msTPLPath."editor.button.tpl"); $oTPLButton->gbSetValue("WIDTH",$sWidth); $sLeftButton=" "; $sRightButton=" "; if(isset($asButton["leftbutton"])&&$asButton["leftbutton"]!==false) $sLeftButton=$this->gsGetButton($asButton["leftbutton"]["width"],$asButton["leftbutton"]["onclick"],$asButton["leftbutton"]["href"],$asButton["leftbutton"]["anzeige"]); if(isset($asButton["rightbutton"])&&$asButton["rightbutton"]!==false) $sRightButton=$this->gsGetButton($asButton["rightbutton"]["width"],$asButton["rightbutton"]["onclick"],$asButton["rightbutton"]["href"],$asButton["rightbutton"]["anzeige"]); $oTPLButton->gbSetButtons($asButton); $oTPLButton->gbSetValue("leftbutton",$sLeftButton); $oTPLButton->gbSetValue("rightbutton",$sRightButton); $oTPL->gbSetValue("button",$oTPLButton->gsParse()); } return $oTPL; } function gsGetOKMSG($sMSG,$asButton=false,$distance=false,$left=1) { $oTPL=$this->oSystem->goGetTPLParser($this->msTPLPath."msg.ok.tpl"); $distance=$distance===false?0:$distance; $oTPL->gbSetValue("DISTANCE",$distance); $oTPL->gbSetValue("left",$left); if($asButton===false) { $asB["weiter"]=false; } else $asB["weiter"]=$asButton; $oTPL->gbSetValue("content",$sMSG); $oTPL->gbSetButtons($asB); return $oTPL->gsParse(); } function gsGetERRMSG($sMSG,$asButton=false,$distance=false,$left=1) { $oTPL=$this->oSystem->goGetTPLParser($this->msTPLPath."msg.notok.tpl"); $distance=$distance===false?0:$distance; $oTPL->gbSetValue("DISTANCE",$distance); $oTPL->gbSetValue("left",$left); if($asButton===false) { $asB["weiter"]=false; } else $asB["weiter"]=$asButton; $oTPL->gbSetValue("content",$sMSG); $oTPL->gbSetButtons($asB); return $oTPL->gsParse(); } function gsGetConfirm($sMSG,$asDo,$asBack,$distance=false) { $oTPL=$this->oSystem->goGetTPLParser($this->msTPLPath."confirmation.tpl"); $distance=$distance===false?0:$distance; $oTPL->gbSetValue("DISTANCE",$distance); if($asButton===false) { $asB["weiter"]=false; } else $asB["weiter"]=$asButton; $oTPL->gbSetValue("content",$sMSG); $oTPL->gbSetValue("BUTTONDO",$this->oSystem->oUI->gsGetButton(120,"",$asDo["URL"],$asDo["ANZEIGE"],2)); $oTPL->gbSetValue("BUTTONBACK",$this->oSystem->oUI->gsGetButton(120,"",$asBack["URL"],$asBack["ANZEIGE"],1)); return $oTPL->gsParse(); } function gsGetButton($sWidth,$onclick,$href,$anzeige,$lTabIndex=false,$sID="") { if($href=="") $href="#"; $oTPL=$this->oSystem->goGetTPLParser($this->msTPLPath."button.tpl"); $oTPL->gbSetValue("width",$sWidth); $oTPL->gbSetValue("myid",""); if($sID!="") $oTPL->gbSetValue("myid","id=\"".$sID."\""); $oTPL->gbSetValue("click",$onclick); if($lTabIndex===false) $button["tabindex"]=false; else $button["tabindex"]["WERT"]=$lTabIndex; $oTPL->gbSetButtons($button); $oTPL->gbSetValue("url",$href); $oTPL->gbSetValue("anzeige",$anzeige); return $oTPL->gsParse(); } function gsGetInfo($lKey) { $oTPL=$this->oSystem->goGetTPLParser($this->msTPLPath."info.tpl"); $oTPL->gbSetValue("info",$lKey); return $oTPL->gsParse(); } function gsGetAnchor($onclick,$href,$anzeige,$lTabIndex=false,$sID="") { if($href=="") $href="#"; $oTPL=$this->oSystem->goGetTPLParser($this->msTPLPath."anchor.tpl"); $oTPL->gbSetValue("width",$sWidth); $oTPL->gbSetValue("myid",""); if($sID!="") $oTPL->gbSetValue("myid","id=\"".$sID."\""); $oTPL->gbSetValue("click",$onclick); if($lTabIndex===false) $button["tabindex"]=false; else $button["tabindex"]["WERT"]=$lTabIndex; $oTPL->gbSetButtons($button); $oTPL->gbSetValue("url",$href); $oTPL->gbSetValue("anzeige",$anzeige); return $oTPL->gsParse(); } function gsGetSubmitButton($sWidth,$onclick,$href,$anzeige,$lTabIndex=false,$sID="") { if($href=="") $href="#"; $oTPL=$this->oSystem->goGetTPLParser($this->msTPLPath."button.submit.tpl"); $oTPL->gbSetValue("width",$sWidth); $oTPL->gbSetValue("myid",""); if($sID!="") $oTPL->gbSetValue("myid","id=\"".$sID."\""); $oTPL->gbSetValue("click",$onclick); if($lTabIndex===false) $button["tabindex"]=false; else $button["tabindex"]["WERT"]=$lTabIndex; $oTPL->gbSetButtons($button); $oTPL->gbSetValue("url",$href); $oTPL->gbSetValue("anzeige",$anzeige); return $oTPL->gsParse(); } } class CStringType { function gsGetCellNumber($sNumber) { $prefix="+49"; $sNumber=trim($sNumber); for($i=0;$i57) { } else $sNewNumber.=chr($check); } if(substr($sNewNumber,0,1)==0) { $sNewNumber=$prefix.substr($sNewNumber,1); } return $sNewNumber; } function isUhrzeit($sUhrzeit) { $sUhrzeit=substr($sUhrzeit,0,12); for($i=0;$i57) $sReturn.=":"; else $sReturn.=chr($check); } $asU=explode(":",$sReturn); $len=sizeof($asU); if($len==2||$len==3) { if($asU[0]<0||$asU[0]>=24) return false; if($asU[1]<0||$asU[0]>=60) return false; return true; } else return false; } function isDatum($sDatum) { $sDatum=substr($sDatum,0,12); for($i=0;$i57) $sReturn.="."; else $sReturn.=chr($check); } $asDatum=explode(".",$sReturn); if($asDatum[0]<1||$asDatum[0]>31) return false; if($asDatum[1]<1||$asDatum[1]>12) return false; $len=strlen($asDatum[2]); if($len!=4) { if($len==2) $asDatum[2]=2000+$asDatum[2]; } if($asDatum[2]<2001||$asDatum[0]>2020) return false; return true; } function isMobilNumber($sNumber) { if(strlen($sNumber)>10) return true; return false; } function isNumber($sString,$len=false) { if($len!==false && strlen($sString)!=$len) return false; $sString=strtoupper($sString); $bError=false; for($i=0;$i=48&&$test<=57)) { } else $bError=true; } return $bError===true?false:true; } function hexOnly($sString,$len=false) { if($len!==false && strlen($sString)!=$len) return false; $sString=strtoupper($sString); $bError=false; for($i=0;$i=48&&$test<=57) || ($test>=65 && $test<=70)) { } else $bError=true; } return $bError===true?false:$sString; } function isMail($sString,$returnIfEmpty=false) { if(trim($sString)=="") return $returnIfEmpty; $a=strpos($sString,chr(64)); if($a!==false) { $b=strpos($sString,".",$a); if($b-$a>2) { return true; } } return false; } } class CSimpleSession { function CSimpleSession() { $this->msSessionID="OK"; } function KILLSession() { global $oSystem; $oSystem->oUser->logoutUser(); session_destroy(); } function getCurrentSessionID() { return $this->msSessionID; } function gsGetSessionID() { $this->msSessionID=strtoupper(md5(mt_rand())); return $this->msSessionID; } function gsIniSession($sSessionID) { $this->msSessionID=$this->getCurrentSessionID(); // setcookie("__MY__",$sSessionID,time()+7200,"/".CLIENTNAME."/"); ini_set("session.use_cookies","0"); ini_set("session.cache_limiter","nocache"); session_cache_limiter('private_no_expire'); session_id("current2KSession".$sSessionID); session_save_path(SESSIONSAVEPATH); session_start(); } function gsStartSession($sSessionID) { $this->msSessionID=$sSessionID; ini_set("session.use_cookies","0"); ini_set("session.cache_limiter","nocache"); session_cache_limiter('private_no_expire'); session_id("current2KSession".$sSessionID); session_save_path(SESSIONSAVEPATH); session_start(); } } class CUserD { function gasGetAccessData() { $asReturn["UserPK"]=$this->oUserData->UserPK; $asReturn["ClientPK"]=$this->oUserData->RemoteClientPK; return $asReturn; } function gbSetMailAddress($sMail) { $asUpdate["EMail"]=$this->oSystem->oDB->gsEscapeString($sMail); $asUpdate["ModifyDate"]="Now()"; $asUpdate["Modifier"]=$this->oUserData->UserPK; if($oRes=$this->oSystem->oDB->goUpdateArray("tdUser",$asUpdate,"UserPK=".$this->oUserData->UserPK)) return true; return false; } function CUserD(&$oSystem) { $this->oSystem=&$oSystem; } function goReload() { if($o=$this->oSystem->oDB->goGetRecord("SELECT * FROM tdUser WHERE UserPK='".$this->oUserData->UserPK."'")) $this->oUserData=$o; } function gbCheckSession($sSessionID) { if($this->oUserData=$this->oSystem->oDB->goGetRecord("SELECT * FROM tdUser WHERE CurrentSessionID='".$sSessionID."'")) { return true; } return false; } function checkIP($sIP) { if($oUser=$this->goGetUserByIP($sIP)) { $this->oUserData=$oUser; return "OK"; } } function checkLogin($user,$pass) { if($oUser=$this->goGetUser($user,$pass)) { $this->oUserData=$oUser; return true; } return false; } function gbLoginUser($sSessionID) { } function logoutUser() { $asUpdate["CurrentSessionID"]="NULL"; $asUpdate["CurrentIP"]="NULL"; $this->oSystem->oDB->goUpdateArray("tdUser",$asUpdate,"UserPK=".$this->oUserData->UserPK); } function goGetUserByIP($sIP) { $sQuery="SELECT *,IFNULL(CurrentSessionID,'__false__') as CanLogin FROM tdUser WHERE IFNULL(CurrentIP,-1)!=-1 AND CurrentIP='".$sIP."' AND AccessDenied!=-1"; if($oRecord=$this->oSystem->oDB->goGetRecord($sQuery)) { return $oRecord; } return false; } function goGetUser($user,$pass) { $sQuery="SELECT *,IFNULL(CurrentSessionID,'__false__') as CanLogin FROM tdUser WHERE UserName='".$user."' AND UserPass=MD5('".$pass."') AND AccessDenied!=-1"; if($oRecord=$this->oSystem->oDB->goGetRecord($sQuery)) { return $oRecord; } return false; } function gsGenerateNewPasswortAndSet($lUserPK) { $lLen=8; for($i=0;$i<$lLen;$i++) { if(mt_rand(0,1)==1) { if(mt_rand(0,1)==1) $sPassword.=chr(mt_rand(65,90)); else $sPassword.=chr(mt_rand(97,122)); } else { $sPassword.=chr(mt_rand(48,57)); } } $oRes=$this->oSystem->oDB->goUpdate("tdUser","UserPass=md5('".$sPassword."')","UserPK=".$lUserPK); return $sPassword; } function gsGenerateNewPasswort($lUserPK) { $lLen=8; for($i=0;$i<$lLen;$i++) { if(mt_rand(0,1)==1) { if(mt_rand(0,1)==1) $sPassword.=chr(mt_rand(65,90)); else $sPassword.=chr(mt_rand(97,122)); } else { $sPassword.=chr(mt_rand(48,57)); } } return $sPassword; } function glGetUserPKByMail($sMail) { if($lUserPK=$this->oSystem->oDB->gsGetFieldValue("tdUser","UserPK","EMail='".$sMail."'")) { return $lUserPK; } return false; } function glGetUserPKByUserName($sUserName) { if($lUserPK=$this->oSystem->oDB->gsGetFieldValue("tdUser","UserPK","UserName='".$sUserName."'")) { return $lUserPK; } return false; } } class CContractTransfer { function CContractTransfer(&$oSystem) { $this->oSystem=&$oSystem; } function gLog($lContractPK,$sMessage) { $asInsert["ContractPK"]="'".$lContractPK."'"; $asInsert["Result"]=$this->oSystem->oDB->gsEscapeString($sMessage); $asInsert["CreateDate"]="now()"; if($this->oSystem->oDB->goInsertArray("tdContractTransferLog",$asInsert)) return true; else { echo mysql_error()."\n"; echo $this->oSystem->oDB->msQuery; } } } class CGISConnect { function CGISConnect(&$oSystem) { $this->oSystem=&$oSystem; } function gasLoad($sCFSerial) { if($pCURL=curl_init(GIS_CONNECT_WS)) { curl_setopt($pCURL,CURLOPT_RETURNTRANSFER,1); curl_setopt($pCURL,CURLPOPT_POST,1); curl_setopt($pCURL,CURLOPT_USERPWD,GIS_CONNECT_UP); $asData["CFSerial"]=$sCFSerial; mail("thorsten.k@kk-gbr.de","ORTUNG VON".$sCFSerial,date("Y-m-d H:i:s")); curl_setopt($pCURL,CURLOPT_POSTFIELDS,wddx_serialize_value($asData)); $sData=curl_exec($pCURL); curl_close($pCURL); if($sData!==false) { if($asAnswer=@wddx_deserialize($sData)) { return $asAnswer; } } } return false; } }