From 47d101743ac02b0de3b65abfdb40c7cdf139b9db Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Tue, 13 Apr 2010 21:43:23 +0000 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E6=96=87=E4=BB=B6=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=B9=B6=E5=AF=BC=E5=85=A5=E5=88=B0SVN=E5=BA=93=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit +YUCHENG HU+ git-svn-id: https://svn.code.sf.net/p/hawebs/svn@30 a2543c7e-f6e9-4f8a-8bff-1ffc34733512 --- xcrm/vtiger/trunk/vtigerservice.php | 54 +++++++++++++ xcrm/vtiger/trunk/vtigerversion.php | 14 ++++ xcrm/vtiger/trunk/webservice.php | 115 ++++++++++++++++++++++++++++ 3 files changed, 183 insertions(+) create mode 100644 xcrm/vtiger/trunk/vtigerservice.php create mode 100644 xcrm/vtiger/trunk/vtigerversion.php create mode 100644 xcrm/vtiger/trunk/webservice.php diff --git a/xcrm/vtiger/trunk/vtigerservice.php b/xcrm/vtiger/trunk/vtigerservice.php new file mode 100644 index 00000000..070cdae0 --- /dev/null +++ b/xcrm/vtiger/trunk/vtigerservice.php @@ -0,0 +1,54 @@ +vtigerCRM Soap Services"; + echo "
  • vtigerCRM Outlook Plugin EndPoint URL -- Click here
  • "; + echo "
  • vtigerCRM Word Plugin EndPoint URL -- Click here
  • "; + echo "
  • vtigerCRM ThunderBird Extenstion EndPoint URL -- Click here
  • "; + echo "
  • vtigerCRM Customer Portal EndPoint URL -- Click here
  • "; + echo "
  • vtigerCRM WebForm EndPoint URL -- Click here
  • "; + echo "
  • vtigerCRM FireFox Extension EndPoint URL -- Click here
  • "; +} + + +?> diff --git a/xcrm/vtiger/trunk/vtigerversion.php b/xcrm/vtiger/trunk/vtigerversion.php new file mode 100644 index 00000000..0750aac4 --- /dev/null +++ b/xcrm/vtiger/trunk/vtigerversion.php @@ -0,0 +1,14 @@ + diff --git a/xcrm/vtiger/trunk/webservice.php b/xcrm/vtiger/trunk/webservice.php new file mode 100644 index 00000000..89203f2f --- /dev/null +++ b/xcrm/vtiger/trunk/webservice.php @@ -0,0 +1,115 @@ +success = false; + $state->error = $error; + unset($state->result); + $output = $operationManager->encode($state); + echo $output; + + } + + function writeOutput($operationManager, $data){ + + $state = new State(); + $state->success = true; + $state->result = $data; + unset($state->error); + $output = $operationManager->encode($state); + echo $output; + + } + + $operation = vtws_getParameter($_REQUEST, "operation"); + $operation = strtolower($operation); + $format = vtws_getParameter($_REQUEST, "format","json"); + $sessionId = vtws_getParameter($_REQUEST,"sessionName"); + + $sessionManager = new SessionManager(); + $operationManager = new OperationManager($adb,$operation,$format,$sessionManager); + + try{ + if(!$sessionId || strcasecmp($sessionId,"null")===0){ + $sessionId = null; + } + + $input = $operationManager->getOperationInput(); + $adoptSession = false; + if(strcasecmp($operation,"extendsession")===0){ + if(isset($input['operation'])){ + $sessionId = vtws_getParameter($_REQUEST,"PHPSESSID"); + $adoptSession = true; + }else{ + writeErrorOutput($operationManager,new WebServiceException(WebServiceErrorCode::$AUTHREQUIRED,"Authencation required")); + return; + } + } + $sid = $sessionManager->startSession($sessionId,$adoptSession); + + if(!$sessionId && !$operationManager->isPreLoginOperation()){ + writeErrorOutput($operationManager,new WebServiceException(WebServiceErrorCode::$AUTHREQUIRED,"Authencation required")); + return; + } + + if(!$sid){ + writeErrorOutput($operationManager, $sessionManager->getError()); + return; + } + + $userid = $sessionManager->get("authenticatedUserId"); + + if($userid){ + + $seed_user = new Users(); + $current_user = $seed_user->retrieveCurrentUserInfoFromFile($userid); + + }else{ + $current_user = null; + } + + $operationInput = $operationManager->sanitizeOperation($input); + $includes = $operationManager->getOperationIncludes(); + + foreach($includes as $ind=>$path){ + require_once($path); + } + $rawOutput = $operationManager->runOperation($operationInput,$current_user); + writeOutput($operationManager, $rawOutput); + }catch(WebServiceException $e){ + writeErrorOutput($operationManager,$e); + }catch(Exception $e){ + writeErrorOutput($operationManager, + new WebServiceException(WebServiceErrorCode::$INTERNALERROR,"Unknown Error while processing request")); + } +?>