[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9931] sms: more on pswin
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [9931] sms: more on pswin |
Date: |
Wed, 29 Aug 2012 19:32:31 +0000 |
Revision: 9931
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9931
Author: sigurdne
Date: 2012-08-29 19:32:30 +0000 (Wed, 29 Aug 2012)
Log Message:
-----------
sms: more on pswin
Modified Paths:
--------------
trunk/sms/inc/plugin/gateway/pswin/get.php
trunk/sms/inc/plugin/gateway/pswin/soap.php
Modified: trunk/sms/inc/plugin/gateway/pswin/get.php
===================================================================
--- trunk/sms/inc/plugin/gateway/pswin/get.php 2012-08-29 15:30:20 UTC (rev
9930)
+++ trunk/sms/inc/plugin/gateway/pswin/get.php 2012-08-29 19:32:30 UTC (rev
9931)
@@ -38,14 +38,14 @@
{
if(!isset($this->pswin_param['email_user']) || !
$this->pswin_param['email_user'])
{
-// throw new Exception('Email user not defined');
+// throw new Exception('Email user not defined');
}
require_once 'SMSReceive.php';
$options=array();
$options['soap_version'] = SOAP_1_2;
- $options['location'] =
'http://localhost/~sn5607/savannah_trunk/sms/inc/plugin/gateway/pswin/soap.php';//$this->pswin_param['receive_url'];
+ $options['location'] =
'http://localhost/~sn5607/savannah_trunk/sms/inc/plugin/gateway/pswin/soap.php?domain=default';//$this->pswin_param['receive_url'];
$options['uri'] =
"http://localhost/~sn5607/savannah_trunk/sms/inc/plugin/gateway/pswin/soap.php";
$options['trace'] = 1;
// $options['proxy_host'] =
$this->pswin_param['proxy_host'];
Modified: trunk/sms/inc/plugin/gateway/pswin/soap.php
===================================================================
--- trunk/sms/inc/plugin/gateway/pswin/soap.php 2012-08-29 15:30:20 UTC (rev
9930)
+++ trunk/sms/inc/plugin/gateway/pswin/soap.php 2012-08-29 19:32:30 UTC (rev
9931)
@@ -28,6 +28,11 @@
*/
+ /*
+ Example testurl:
+
http://localhost/~sn5607/savannah_trunk/sms/inc/plugin/gateway/pswin/soap.php?domain=default
+ */
+
$GLOBALS['phpgw_info'] = array();
$GLOBALS['phpgw_info']['flags'] = array
@@ -69,23 +74,23 @@
require_once PHPGW_API_INC.'/functions.inc.php';
- $headers = getallheaders();
- if(ereg('Basic',$headers['Authorization']))
+ $c =
CreateObject('admin.soconfig',$GLOBALS['phpgw']->locations->get_id('sms',
'run'));
+
+ $login = $c->config_data['common']['anonymous_user'];
+ $passwd = $c->config_data['common']['anonymous_pass'];
+
+ $_POST['submitit'] = "";
+
+ $GLOBALS['sessionid'] = $GLOBALS['phpgw']->session->create($login,
$passwd);
+
+ if(!$GLOBALS['sessionid'])
{
- $tmp = $headers['Authorization'];
- $tmp = str_replace(' ','',$tmp);
- $tmp = str_replace('Basic','',$tmp);
- $auth = base64_decode(trim($tmp));
- list($login,$password) = split(':',$auth);
-
- if($GLOBALS['phpgw']->session->create($login, $password))
+ $lang_denied = lang('Anonymous access not correctly
configured');
+ if($GLOBALS['phpgw']->session->reason)
{
- $GLOBALS['phpgw_info']['flags']['authed'] = true;
+ $lang_denied = $GLOBALS['phpgw']->session->reason;
}
- else
- {
- $GLOBALS['phpgw_info']['message']['errors'][] = 'not
authenticated';
- }
+ $GLOBALS['phpgw_info']['message']['errors'][] = $lang_denied;
}
/**
@@ -94,9 +99,6 @@
$wdsl = PHPGW_SERVER_ROOT .
'/sms/inc/plugin/gateway/pswin/Receive.wdsl';
-//_debug_array($wdsl);
-
-
$options = array
(
'uri' => "http://test-uri/", # the name space of the
SOAP service
@@ -147,6 +149,11 @@
function ReceiveSMSMessage($ReceiveSMSMessage)
{
+ if($error = check_error())
+ {
+ return $error;
+ }
+
$filename = '/tmp/test_soap.txt';
$fp = fopen($filename, "wb");
fwrite($fp,serialize($ReceiveSMSMessage));
@@ -166,15 +173,39 @@
return $ReceiveSMSMessageResponse;
}
+ function check_error()
+ {
+ if( isset($GLOBALS['phpgw_info']['message']['errors']) &&
$GLOBALS['phpgw_info']['message']['errors'] )
+ {
+ $error = 'Error(s): ' . implode(' ## AND ## ',
$GLOBALS['phpgw_info']['message']['errors']);
+ return new SoapFault("phpgw", $error);
+ }
+ //to be sure...
+ if( !$GLOBALS['phpgw_info']['flags']['authed'] )
+ {
+ return new SoapFault("phpgw", 'not authenticated');
+ }
+ }
+
function ReceiveDeliveryReport($DeliveryReport)
{
+ if($error = check_error())
+ {
+ return $error;
+ }
+
return '';
}
function hello($someone)
{
+ if($error = check_error())
+ {
+ return $error;
+ }
+
return "Hello " . $someone . " ! - SOAP 1.2";
}
@@ -207,6 +238,14 @@
}
else
{
+
+ if( isset($GLOBALS['phpgw_info']['message']['errors']) &&
$GLOBALS['phpgw_info']['message']['errors'] )
+ {
+ $error = 'Error(s): ' . implode(' ## AND ## ',
$GLOBALS['phpgw_info']['message']['errors']);
+ echo $error;
+ $GLOBALS['phpgw']->common->phpgw_exit(True);
+ }
+
echo "This SOAP server can handle following functions: ";
_debug_array($functions = $GLOBALS['server']->getFunctions());
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9931] sms: more on pswin,
Sigurd Nes <=