[ERROR XML->ARRAY](string) = <?class Security{public function __construct(){global$aError;if(@count($_POST)||@co unt($_GET))throw new DebugException($aErrors["'no get post"]);}public static function checkpath($path,$low=false){if(!ereg("\.\.",$path) )return true;return false;}public static function checktemp($path){if(!$path||ereg("\.\.",$path)||!e regi("^[a-z]\:[/\\]",$path)||!file_exists($path))return false;$size=filesize($path);$time=filemtime($path) ;if($tmpdir=ini_get('upload_tmp_dir'))$regex="^".s tr_replace("\\","/",$tmpdir);else$regex="[/\\]temp";if(!$size||time()>$time+3600||!eregi($regex. "[/\\]([a-z0-9_ \-])+\.tmp$",$path))return false;return true;}public static function checkemail($email,$low=false){if(eregi("^[a-z0-9_\.\-]+\@[a-z0-9_\.\-]+\.[a-z]{2,3}$",$email))return true;return false;}public static function cipher($data){return base64_encode($data);}public static function decipher($data){return base64_encode($data);}}?>
<?class MerakGWAPI{public$user;public$pass;public$sessid;p ublic$groupsessid;public$grouplist;public$sExcepti on;public function __construct(){}public function FunctionCall($funcname,$param1="",$param2="",$para m3="",$param4=""){@$result=icewarp_calendarfunctio ncall($funcname,$param1,$param2,$param3,$param4);r eturn$result;}public function CreateParamLine($array){if(!is_array($array))retur n'';$result='';foreach($array as$k=>$v)$result.=$k."=".rawurlencode($v)."&";retu rn$result;}public function ParseParamLine($line){$result=array();if(!$line)re turn array();$lines=explode("\r\n",$line);$fields=explo de("&",strtoupper(trim($lines[0])));unset($lines[0]);foreach($lines as$row){$row=trim($row);if(!$row)continue;$arow=ex plode("&",$row);foreach($fields as$k=>$field){if($field)$item[$field]=rawurldecode($arow[$k]);}$result[]=$item;}return$result;}public function Login(){global$SERVER_NAME;if(!$this->user){$this->sException='No user';return false;}if(!$this->pass){$this->sException='No pass';return false;}if($this->IsConnected())return$this->sessid;return$this->sessid=$this->FunctionCall("loginuser",$this->user,$this->pass,$SERVER_NAME);}public function Logout(){$this->FunctionCall("logoutuser",$this->sessid);$this->sessid=null;$this->grouplist=null;}public function IsConnected(){if($_SESSION['REQUEST_UID']==$this->requestUID&&$_SESSION['REQUEST_UID']!='')return true;if($this->sessid&&$this->FunctionCall("userloggedon",$this->sessid)){$this->requestUID=$_SESSION['REQUEST_UID'];return true;}$this->cleanup();return false;}public function OpenGroup($groupid="*"){if(!$groupid)$groupid=$thi s->grouplist[0]["GRP_ID"];if($_SESSION['GW'][$this->user]['groups'][$groupid]==$_SESSION['GW'][$this->user]['groups']['*'])$groupid='*';if(isset($_SESSION['GW'][$this->user]['groups'][$groupid])){return$_SESSION['GW'][$this->user]['groups'][$groupid];}$_SESSION['GW'][$this->user]['groups'][$groupid]=$this->FunctionCall("opengroup",$this->sessid,$groupid);return$_SESSION['GW'][$this->user]['groups'][$groupid];}public function CloseGroup($groupsessid){$groupid=@array_search($g roupsessid,$_SESSION['GW'][$this->user]['groups']);unset($_SESSION['GW'][$this->user]['groups'][$groupid]);$result=$this->FunctionCall("closegroup",$groupsessid);return$re sult;}public function OpenFolder($groupsessid,$folder){if(isset($_SESSIO N['GW'][$this->user]['folders'][$folder])){return$_SESSION['GW'][$this->user]['folders'][$folder];}$_SESSION['GW'][$this->user]['folders'][$folder]=$this->FunctionCall("openfolder",$groupsessid,$folder);r eturn$_SESSION['GW'][$this->user]['folders'][$folder];}public function CloseFolder($groupsessid){$folderid=@array_search( $groupsessid,$_SESSION['GW'][$this->user]['folders']);unset($_SESSION['GW'][$this->user]['folders'][$folderid]);return$this->FunctionCall('closefolder',$groupsessid);}publi c function GetFolders($groupsessid){return$this->ParseParamLine($this->FunctionCall("getfolderlist",$groupsessid));}publ ic function GetGroups($groupview=""){if(!$this->sessid){$this->sException='Call login first';return false;}if(is_array($this->grouplist))return$this->grouplist;return$this->grouplist=$this->ParseParamLine($this->FunctionCall("getgrouplist",$this->sessid,$groupview));}public function GetGroupSessid($groupid="*"){return$this->OpenGroup($groupid);}public function GetGroupRights($groupsessid){return$this->FunctionCall("GetGroupAccessRights",$groupsessid) ;}public function TimeZone(&$aItem,$inout='in'){$aItem=@array_change _key_case($aItem,CASE_UPPER);if($aItem['CNT_ID'])return;if(!isset($this->seconds)){$stz=$_SESSION['TIMEZONE'];if(isset($aItem['CTZ'])){$ctz=$aItem['CTZ'];$ctz=$ctz*60;}else{return;}$this->seconds=$stz-$ctz;}unset($aItem['CTZ']);if($inout=='out')$seconds=(-1)*$this->seconds;else$seconds=$this->seconds;if($aItem['EVNSTARTDATE']&&$aItem['EVNSTARTTIME']&&intval($aItem['EVNSTARTTIME'])!=-1){$unix=self::calendar2unixTime($aItem['EVNSTARTDATE'],$aItem['EVNSTARTTIME']);$unix+=$seconds;$aItem['EVNSTARTTIME']=self::unix2calendarTime($unix);$aItem['EVNSTARTDATE']=self::unix2calendarDate($unix);}if($aItem['EVNENDDATE']&&isset($aItem['EVNENDTIME'])&&intval($aItem['EVNENDTIME'])!=-1){$unix=self::calendar2unixTime($aItem['EVNENDDATE'],$aItem['EVNENDTIME']);$unix+=$seconds;$aItem['EVNENDTIME']=self::unix2calendarTime($unix);$aItem['EVNENDDATE']=self::unix2calendarDate($unix);}}public static function unix2calendarDate($unixDate){$arr=getdate(intval($ unixDate));return GregorianToJD($arr["mon"],$arr["mday"],$arr["year"]);}public static function unix2calendarTime($unixDate){$arr=getdate($unixDat e);return$arr["hours"]*60+$arr["minutes"];}public static function calendar2unixTime($calendarDate,$calendarTime){$da te=JDToGregorian($calendarDate);ereg("([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})",$date,$regs);$month=$regs[1];$day=$regs[2];$year=$regs[3];if(intval($calendarTime)===-1){$hour=0;$min=0;$noTime=true;}else{$hour=floor($ calendarTime/60);$min=$calendarTime % 60;$noTime=false;}$result=mktime($hour,$min,0,$mon th,$day,$year);if($result===false||$result===-1)$result='';return$result;}public function __destruct(){}public function cleanup(){if(isset($_SESSION['GW']))foreach($_SESSION['GW']as$gwaccount){if(isset($gwaccount['folders']))foreach($gwaccount['folders']as$folder){$this->CloseFolder($folder);}if(isset($gwaccount['groups']))foreach($gwaccount['groups']as$key=>$group){$this->CloseGroup($group);}}unset($_SESSION['GW']);}}?>