oSystem=&$oSystem; $this->oURL=&new CURL(&$oSystem); } function gsGetFormID() { $sID=$this->gsGetUniqueID(); $_SESSION["ALLOWEDFORMS"][$sID]=true; return $sID; } function gbFormIsAllowed() { if($sCurrentFormID=$this->oSystem->oClientData->gvGetVariable("__MYFORMID__",false)) { if(isset($_SESSION["ALLOWEDFORMS"][$sCurrentFormID])&& $_SESSION["ALLOWEDFORMS"][$sCurrentFormID]===true) { unset($_SESSION["ALLOWEDFORMS"][$sCurrentFormID]); return true; } } return false; } function gsGetUniqueID() { return md5(microtime()*100000); } function gsGetHostName() { return $this->oSystem->oServerEnv->gsGetVar("HTTP_HOST"); } function gsGetCurrentClass() { return $this->msCurrentClass; } function gbInit($sApp,$asRequestData) { $this->asRawRequest=$asRequestData; if(is_array($asRequestData)) if($this->msCurrentClass=array_shift($asRequestData)) { } else $this->msCurrentClass=false; $this->oSystem->msCurrentClass=$this->msCurrentClass; $this->masParameter=$asRequestData; $this->msApp=$sApp; $this->oURL->gbSetApp($sApp); $this->oURL->gbSetParent($this); } function gbSetCurrentClass($sName,$asActions=false) { $this->msCurrentClass=$sName; if($asActions!==false) $this->masParameter=$asActions; var_dump($this->masParameter); } function gsGetCurrentPathName() { $sRequestURI=getenv("REQUEST_URI"); if(substr($sRequestURI,0,1)=="/") $sRequestURI=substr($sRequestURI,1); $as=explode("/",$sRequestURI); if($s=array_shift($as)) { if(trim($s)=="") $sPathInfo=array_shift($as); else $sPathInfo=$s; } return $sPathInfo; } function gsGetCurrentApp() { return $this->msApp; } function gasGetParamValue($lVa) { if(is_array($this->masParameter)) return $this->masParameter[$lVa]; return false; } function gsGetParamList() { if(is_array($this->asRawRequest)) return join("/",$this->asRawRequest); return "./."; } function gasGetParams() { return $this->masParameter; } function gsGetCurrentParameter(&$asParams,$bToLower=false) { if(is_array($asParams)) { if($sAction=array_shift($asParams)) { if($bToLower===true) return strtolower($sAction); else return $sAction; } else return false; } return false; } } class CURL { var $msApp=false; var $oSystem; function gbSetParent(&$o) { $this->oControl=&$o; } function CURL(&$oSystem) { $this->oSystem=&$oSystem; $this->msHTTP="http://"; $this->msRandomKey=md5(microtime()); setcookie("CURRENTRANDOMKEY",$this->msRandomKey,time()+7200,"/".CLIENTNAME."/"); $_SESSION["app.randomKey"]=$this->msRandomKey; if(strtolower($_SERVER["HTTPS"])=="on") { $this->msHTTP="https://"; } } function gbSetApp($sApp) { $this->msApp=$sApp; } function gsGetInterfaceURL($sClass,$sAction) { $sApp=dirname($this->oSystem->oServerEnv->gsGetVar("SCRIPT_NAME"))."/interface"; return $this->msHTTP.$this->oSystem->oServerEnv->gsGetVar("HTTP_HOST").$sApp."/".$this->oSystem->oSession->gsGetCurrentSessionID()."/$sClass/$sAction"; } function gsGetDocumentURL($msClass,$asActions=false,$sApp=false,$asGetData=false) { $this->msRandomKey=md5(microtime()); setcookie("DOCUMENTRANDOMKEY",$this->msRandomKey,time()+2000,"/".CLIENTNAME."/"); $_SESSION["app.randomKey"]=$this->msRandomKey; if($sApp===false) $sApp=$this->oSystem->oServerEnv->gsGetVar("SCRIPT_NAME"); else $sApp=dirname($this->oSystem->oServerEnv->gsGetVar("SCRIPT_NAME"))."/".$sApp; if(is_array($asActions)) $sURL=$this->msHTTP.$this->oSystem->oServerEnv->gsGetVar("HTTP_HOST").$sApp."/".$this->msRandomKey."/".$msClass."/".join("/",$asActions); else $sURL=$this->msHTTP.$this->oSystem->oServerEnv->gsGetVar("HTTP_HOST").$sApp."/".$this->msRandomKey."/".$msClass."/".$asActions; if(is_array($asGetData)) $sURL.="?".$this->gsGetURLData($asGetData); return $sURL; } function gsGetURL($msClass,$asActions=false,$sApp=false,$asGetData=false) { if($sApp===false) $sApp=$this->oSystem->oServerEnv->gsGetVar("SCRIPT_NAME"); else $sApp=dirname($this->oSystem->oServerEnv->gsGetVar("SCRIPT_NAME"))."/".$sApp; $sSessionID=""; if($this->oSystem->oSession->gsGetCurrentSessionID()!="") $sSessionID=$this->oSystem->oSession->gsGetCurrentSessionID()."/"; if(is_array($asActions)) $sURL=$this->msHTTP.$this->oSystem->oServerEnv->gsGetVar("HTTP_HOST").$sApp."/".$sSessionID.$this->msRandomKey."/".$msClass."/".join("/",$asActions); else $sURL=$this->msHTTP.$this->oSystem->oServerEnv->gsGetVar("HTTP_HOST").$sApp."/".$sSessionID.$this->msRandomKey."/".$msClass."/".$asActions; if(is_array($asGetData)) $sURL.="?".$this->gsGetURLData($asGetData); return $sURL; } function gsGetSimpleURL($asActions) { $msClass=$this->oControl->gsGetCurrentClass(); $sURL=$this->gsGetURL($msClass,$asActions); return $sURL; } 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 gsGetIMGPath($sImg="",$bAddRandom=true) { if(substr($sImg,0,1)=="/") $sImg=substr($sImg,1); $sPath=dirname($this->oSystem->oServerEnv->gsGetVar("SCRIPT_NAME")); if($sImg!="") { if($bAddRandom===false) return $this->msHTTP.$this->oSystem->oServerEnv->gsGetVar("HTTP_HOST").$sPath."/images/".$sImg; else return $this->msHTTP.$this->oSystem->oServerEnv->gsGetVar("HTTP_HOST").$sPath."/images/".$sImg;//."?as=".md5(mt_rand()); } else return $this->msHTTP.$this->oSystem->oServerEnv->gsGetVar("HTTP_HOST").$sPath."/images/"; } }