oSystem=&$oSystem; $this->oURL=new CURL(&$oSystem); } 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) { $this->msCurrentClass=$sName; } 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; } function gbSetApp($sApp) { $this->msApp=$sApp; } function gsGetInterfaceURL($sClass,$sAction) { $sApp=dirname($this->oSystem->oServerEnv->gsGetVar("SCRIPT_NAME"))."/interface"; return "http://".$this->oSystem->oServerEnv->gsGetVar("HTTP_HOST").$sApp."/".$this->oSystem->oSession->gsGetCurrentSessionID()."/$sClass/$sAction"; } 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="http://".$this->oSystem->oServerEnv->gsGetVar("HTTP_HOST").$sApp."/".$sSessionID.$msClass."/".join("/",$asActions); else $sURL="http://".$this->oSystem->oServerEnv->gsGetVar("HTTP_HOST").$sApp."/".$sSessionID.$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 "http://".$this->oSystem->oServerEnv->gsGetVar("HTTP_HOST").$sPath."/images/".$sImg; else return "http://".$this->oSystem->oServerEnv->gsGetVar("HTTP_HOST").$sPath."/images/".$sImg;//."?as=".md5(mt_rand()); } else return "http://".$this->oSystem->oServerEnv->gsGetVar("HTTP_HOST").$sPath."/images/"; } }