Merge branch '1.10.x' of github.com:chamilo/chamilo-lms into 1.10.x

1.10.x
Yannick Warnier 11 years ago
commit fb0f34430e
  1. 2
      main/admin/user_add.php
  2. 2
      main/admin/user_edit.php
  3. 24
      main/inc/lib/formvalidator/Element/DatePicker.php
  4. 24
      main/inc/lib/formvalidator/Element/DateTimePicker.php
  5. 8
      main/inc/lib/nusoap/class.nusoap_base.php
  6. 15
      main/inc/lib/nusoap/class.soap_server.php
  7. 294
      main/inc/lib/nusoap/class.wsdl.php
  8. 20
      main/inc/lib/plugin.lib.php
  9. 7
      main/inc/lib/usermanager.lib.php
  10. 114
      main/webservices/registration.soap.php
  11. 11
      plugin/advanced_subscription/src/AdvancedSubscriptionPlugin.php
  12. 2
      plugin/advanced_subscription/views/open_session.tpl

@ -260,7 +260,7 @@ $form->addGroup($group, 'mail', get_lang('SendMailToNewUser'), ' ');
// Expiration Date
$form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0);
$group = array ();
$group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('On'), 1);
$group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1);
$group[] = $form->createElement(
'DateTimePicker',
'expiration_date',

@ -258,7 +258,7 @@ if (!$user_data['platform_admin']) {
// Expiration Date
$form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0);
$group = array ();
$group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('On'), 1);
$group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1);
$group[] = $form->createElement('DateTimePicker', 'expiration_date', null, array('onchange' => 'javascript: enable_expiration_date();'));
$form->addGroup($group, 'max_member_group', null, '', false);

@ -32,9 +32,29 @@ class DatePicker extends HTML_QuickForm_text
*/
public function toHtml()
{
$js = $this->getElementJS();
if ($this->_flagFrozen) {
return $this->getFrozenHtml();
}
$id = $this->getAttribute('id');
$value = $this->getValue();
if (!empty($value)) {
$value = api_format_date($value, DATE_TIME_FORMAT_LONG_24H);
}
if (empty($this->getLabel())) {
return $this->getElementJS() . '
<div class="input-group">
<span class="input-group-addon">
<input ' . $this->_getAttrString($this->_attributes) . '>
</span>
<input class="form-control" type="text" readonly id="' . $id . '_alt" value="' . $value . '">
</div>
';
}
return $js.parent::toHtml();
return $this->getElementJS() . parent::toHtml();
}
/**

@ -26,9 +26,29 @@ class DateTimePicker extends HTML_QuickForm_text
*/
public function toHtml()
{
$js = $this->getElementJS();
if ($this->_flagFrozen) {
return $this->getFrozenHtml();
}
$id = $this->getAttribute('id');
$value = $this->getValue();
if (!empty($value)) {
$value = api_format_date($value, DATE_TIME_FORMAT_LONG_24H);
}
if (empty($this->getLabel())) {
return $this->getElementJS() . '
<div class="input-group">
<span class="input-group-addon">
<input ' . $this->_getAttrString($this->_attributes) . '>
</span>
<input class="form-control" type="text" readonly id="' . $id . '_alt" value="' . $value . '">
</div>
';
}
return $js.parent::toHtml();
return $this->getElementJS() . parent::toHtml();
}
/**

@ -141,7 +141,7 @@ class nusoap_base {
* @access public
*/
var $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema';
/**
* charset encoding for outgoing messages
*
@ -408,7 +408,7 @@ class nusoap_base {
$this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use, soapval=$soapval");
$this->appendDebug('value=' . $this->varDump($val));
$this->appendDebug('attributes=' . $this->varDump($attributes));
if (is_object($val) && get_class($val) == 'soapval' && (! $soapval)) {
$this->debug("serialize_val: serialize soapval");
$xml = $val->serialize($use);
@ -982,7 +982,7 @@ function iso8601_to_timestamp($datestr){
function usleepWindows($usec)
{
$start = gettimeofday();
do
{
$stop = gettimeofday();
@ -993,4 +993,4 @@ function usleepWindows($usec)
}
?>
?>

@ -777,7 +777,7 @@ class nusoap_server extends nusoap_base {
//begin code to compress payload - by John
// NOTE: there is no way to know whether the Web server will also compress
// this data.
if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) {
if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) {
if (strstr($this->headers['accept-encoding'], 'gzip')) {
if (function_exists('gzencode')) {
if (isset($this->debug_flag) && $this->debug_flag) {
@ -871,6 +871,7 @@ class nusoap_server extends nusoap_base {
$this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser');
// parse response, get soap parser obj
$parser = new nusoap_parser($data,$this->xml_encoding,'',$this->decode_utf8);
// parser debug
$this->debug("parser debug: \n".$parser->getDebug());
// if fault occurred during message parsing
@ -904,7 +905,7 @@ class nusoap_server extends nusoap_base {
function getHTTPBody($soapmsg) {
return $soapmsg;
}
/**
* gets the HTTP content type for the current response.
*
@ -916,7 +917,7 @@ class nusoap_server extends nusoap_base {
function getHTTPContentType() {
return 'text/xml';
}
/**
* gets the HTTP content type charset for the current response.
* returns false for non-text content types.
@ -1075,7 +1076,7 @@ class nusoap_server extends nusoap_base {
if(false == $namespace) {
$namespace = "http://$SERVER_NAME/soap/$serviceName";
}
if(false == $endpoint) {
if ($HTTPS == '1' || $HTTPS == 'on') {
$SCHEME = 'https';
@ -1084,11 +1085,11 @@ class nusoap_server extends nusoap_base {
}
$endpoint = "$SCHEME://$SERVER_NAME$SERVER_PORT$SCRIPT_NAME";
}
if(false == $schemaTargetNamespace) {
$schemaTargetNamespace = $namespace;
}
$this->wsdl = new wsdl;
$this->wsdl->serviceName = $serviceName;
$this->wsdl->endpoint = $endpoint;
@ -1124,4 +1125,4 @@ class soap_server extends nusoap_server {
}
?>
?>

@ -6,15 +6,15 @@
/**
* parses a WSDL file, allows access to it's data, other utility methods.
* also builds WSDL structures programmatically.
*
*
* @author Dietrich Ayala <dietrich@ganx4.com>
* @author Scott Nichol <snichol@users.sourceforge.net>
* @version $Id: class.wsdl.php,v 1.76 2010/04/26 20:15:08 snichol Exp $
* @access public
* @access public
*/
class wsdl extends nusoap_base {
// URL or filename of the root of this WSDL
var $wsdl;
var $wsdl;
// define internal arrays of bindings, ports, operations, messages, etc.
var $schemas = array();
var $currentSchema;
@ -32,9 +32,9 @@ class wsdl extends nusoap_base {
var $opData = array();
var $status = '';
var $documentation = false;
var $endpoint = '';
var $endpoint = '';
// array of wsdl docs to import
var $import = array();
var $import = array();
// parser vars
var $parser;
var $position = 0;
@ -57,7 +57,7 @@ class wsdl extends nusoap_base {
/**
* constructor
*
*
* @param string $wsdl WSDL document URL
* @param string $proxyhost
* @param string $proxyport
@ -67,7 +67,7 @@ class wsdl extends nusoap_base {
* @param integer $response_timeout set the response timeout
* @param array $curl_options user-specified cURL options
* @param boolean $use_curl try to use cURL
* @access public
* @access public
*/
function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){
parent::nusoap_base();
@ -127,7 +127,7 @@ class wsdl extends nusoap_base {
}
}
}
}
}
}
}
// WSDL imports
@ -153,18 +153,18 @@ class wsdl extends nusoap_base {
}
}
}
}
}
}
// add new data to operation data
foreach($this->bindings as $binding => $bindingData) {
if (isset($bindingData['operations']) && is_array($bindingData['operations'])) {
foreach($bindingData['operations'] as $operation => $data) {
$this->debug('post-parse data gathering for ' . $operation);
$this->bindings[$binding]['operations'][$operation]['input'] =
isset($this->bindings[$binding]['operations'][$operation]['input']) ?
$this->bindings[$binding]['operations'][$operation]['input'] =
isset($this->bindings[$binding]['operations'][$operation]['input']) ?
array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) :
$this->portTypes[ $bindingData['portType'] ][$operation]['input'];
$this->bindings[$binding]['operations'][$operation]['output'] =
$this->bindings[$binding]['operations'][$operation]['output'] =
isset($this->bindings[$binding]['operations'][$operation]['output']) ?
array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) :
$this->portTypes[ $bindingData['portType'] ][$operation]['output'];
@ -181,16 +181,16 @@ class wsdl extends nusoap_base {
$this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : '';
$this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : '';
$this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : '';
}
}
}
}
}
}
/**
* parses the wsdl document
*
*
* @param string $wsdl path or URL
* @access private
* @access private
*/
function parseWSDL($wsdl = '') {
$this->debug("parse WSDL at path=$wsdl");
@ -200,7 +200,7 @@ class wsdl extends nusoap_base {
$this->setError('no wsdl passed to parseWSDL()!!');
return false;
}
// parse $wsdl for url format
$wsdl_props = parse_url($wsdl);
@ -243,24 +243,24 @@ class wsdl extends nusoap_base {
$wsdl_string = '';
while ($data = fread($fp, 32768)) {
$wsdl_string .= $data;
}
}
fclose($fp);
} else {
$errstr = "Bad path to WSDL file $path";
$this->debug($errstr);
$this->setError($errstr);
return false;
}
}
}
$this->debug('Parse WSDL');
// end new code added
// Create an XML parser.
$this->parser = xml_parser_create();
$this->parser = xml_parser_create();
// Set the options for parsing the XML data.
// xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
// Set the object for the parser.
xml_set_object($this->parser, $this);
xml_set_object($this->parser, $this);
// Set the element handlers for the parser.
xml_set_element_handler($this->parser, 'start_element', 'end_element');
xml_set_character_data_handler($this->parser, 'character_data');
@ -277,7 +277,7 @@ class wsdl extends nusoap_base {
$this->debug("XML payload:\n" . $wsdl_string);
$this->setError($errstr);
return false;
}
}
// free the parser
xml_parser_free($this->parser);
$this->debug('Parsing WSDL done');
@ -286,15 +286,15 @@ class wsdl extends nusoap_base {
return false;
}
return true;
}
}
/**
* start-element handler
*
*
* @param string $parser XML parser object
* @param string $name element name
* @param string $attrs associative array of attributes
* @access private
* @access private
*/
function start_element($parser, $name, $attrs)
{
@ -313,10 +313,10 @@ class wsdl extends nusoap_base {
} else {
// position in the total number of elements, starting from 0
$pos = $this->position++;
$depth = $this->depth++;
$depth = $this->depth++;
// set self as current value for this depth
$this->depth_array[$depth] = $pos;
$this->message[$pos] = array('cdata' => '');
$this->message[$pos] = array('cdata' => '');
// process attributes
if (count($attrs) > 0) {
// register namespace declarations
@ -326,11 +326,11 @@ class wsdl extends nusoap_base {
$this->namespaces[$ns_prefix] = $v;
} else {
$this->namespaces['ns' . (count($this->namespaces) + 1)] = $v;
}
}
if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') {
$this->XMLSchemaVersion = $v;
$this->namespaces['xsi'] = $v . '-instance';
}
}
}
}
// expand each attribute prefix to its namespace
@ -338,22 +338,22 @@ class wsdl extends nusoap_base {
$k = strpos($k, ':') ? $this->expandQname($k) : $k;
if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') {
$v = strpos($v, ':') ? $this->expandQname($v) : $v;
}
}
$eAttrs[$k] = $v;
}
}
$attrs = $eAttrs;
} else {
$attrs = array();
}
}
// get element prefix, namespace and name
if (preg_match('/:/', $name)) {
// get ns prefix
$prefix = substr($name, 0, strpos($name, ':'));
$prefix = substr($name, 0, strpos($name, ':'));
// get ns
$namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : '';
$namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : '';
// get unqualified name
$name = substr(strstr($name, ':'), 1);
}
}
// process attributes, expanding any prefixes to namespaces
// find status, register data
switch ($this->status) {
@ -362,12 +362,12 @@ class wsdl extends nusoap_base {
if (isset($attrs['type'])) {
$this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(',', $attrs));
$this->messages[$this->currentMessage][$attrs['name']] = $attrs['type'];
}
}
if (isset($attrs['element'])) {
$this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implode(',', $attrs));
$this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^';
}
}
}
}
break;
case 'portType':
switch ($name) {
@ -376,25 +376,25 @@ class wsdl extends nusoap_base {
$this->debug("portType $this->currentPortType operation: $this->currentPortOperation");
if (isset($attrs['parameterOrder'])) {
$this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrder'];
}
}
break;
case 'documentation':
$this->documentation = true;
break;
break;
// merge input/output data
default:
$m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : '';
$this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m;
break;
}
}
break;
case 'binding':
switch ($name) {
case 'binding':
case 'binding':
// get ns prefix
if (isset($attrs['style'])) {
$this->bindings[$this->currentBinding]['prefix'] = $prefix;
}
}
$this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attrs);
break;
case 'header':
@ -403,17 +403,17 @@ class wsdl extends nusoap_base {
case 'operation':
if (isset($attrs['soapAction'])) {
$this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $attrs['soapAction'];
}
}
if (isset($attrs['style'])) {
$this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['style'];
}
}
if (isset($attrs['name'])) {
$this->currentOperation = $attrs['name'];
$this->debug("current binding operation: $this->currentOperation");
$this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['name'];
$this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->currentBinding;
$this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($this->bindings[$this->currentBinding]['endpoint']) ? $this->bindings[$this->currentBinding]['endpoint'] : '';
}
}
break;
case 'input':
$this->opStatus = 'input';
@ -426,9 +426,9 @@ class wsdl extends nusoap_base {
$this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = array_merge($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus], $attrs);
} else {
$this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $attrs;
}
}
break;
}
}
break;
case 'service':
switch ($name) {
@ -436,7 +436,7 @@ class wsdl extends nusoap_base {
$this->currentPort = $attrs['name'];
$this->debug('current port: ' . $this->currentPort);
$this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']);
break;
case 'address':
$this->ports[$this->currentPort]['location'] = $attrs['location'];
@ -444,9 +444,9 @@ class wsdl extends nusoap_base {
$this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace;
$this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location'];
break;
}
}
break;
}
}
// set status
switch ($name) {
case 'import':
@ -482,11 +482,11 @@ class wsdl extends nusoap_base {
$this->currentBinding = $this->getLocalPart($attrs['name']);
} else {
$this->currentBinding = $attrs['name'];
}
}
$this->status = 'binding';
$this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']);
$this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']);
}
}
break;
case 'service':
$this->serviceName = $attrs['name'];
@ -496,20 +496,20 @@ class wsdl extends nusoap_base {
case 'definitions':
foreach ($attrs as $name => $value) {
$this->wsdl_info[$name] = $value;
}
}
break;
}
}
}
}
}
}
/**
* end-element handler
*
*
* @param string $parser XML parser object
* @param string $name element name
* @access private
* @access private
*/
function end_element($parser, $name){
function end_element($parser, $name){
// unset schema status
if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) {
$this->status = "";
@ -517,38 +517,38 @@ class wsdl extends nusoap_base {
$this->currentSchema->clearDebug();
$this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema;
$this->debug('Parsing WSDL schema done');
}
}
if ($this->status == 'schema') {
$this->currentSchema->schemaEndElement($parser, $name);
} else {
// bring depth down a notch
$this->depth--;
}
}
// end documentation
if ($this->documentation) {
//TODO: track the node to which documentation should be assigned; it can be a part, message, etc.
//$this->portTypes[$this->currentPortType][$this->currentPortOperation]['documentation'] = $this->documentation;
$this->documentation = false;
}
}
}
}
/**
* element content handler
*
*
* @param string $parser XML parser object
* @param string $data element content
* @access private
* @access private
*/
function character_data($parser, $data)
{
$pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0;
if (isset($this->message[$pos]['cdata'])) {
$this->message[$pos]['cdata'] .= $data;
}
}
if ($this->documentation) {
$this->documentation .= $data;
}
}
}
}
/**
* if authenticating, set user credentials here
@ -567,21 +567,21 @@ class wsdl extends nusoap_base {
$this->authtype = $authtype;
$this->certRequest = $certRequest;
}
function getBindingData($binding)
{
if (is_array($this->bindings[$binding])) {
return $this->bindings[$binding];
}
}
}
/**
* returns an assoc array of operation names => operation data
*
*
* @param string $portName WSDL port name
* @param string $bindingType eg: soap, smtp, dime (only soap and soap12 are currently supported)
* @return array
* @access public
* @return array
* @access public
*/
function getOperations($portName = '', $bindingType = 'soap') {
$ops = array();
@ -613,15 +613,15 @@ class wsdl extends nusoap_base {
$this->debug("getOperations found no operations for port '$portName' bindingType $bindingType");
}
return $ops;
}
}
/**
* returns an associative array of data necessary for calling an operation
*
*
* @param string $operation name of operation
* @param string $bindingType type of binding eg: soap, soap12
* @return array
* @access public
* @return array
* @access public
*/
function getOperationData($operation, $bindingType = 'soap')
{
@ -641,19 +641,19 @@ class wsdl extends nusoap_base {
if ($operation == $bOperation) {
$opData = $this->bindings[ $portData['binding'] ]['operations'][$operation];
return $opData;
}
}
}
}
}
}
}
}
/**
* returns an associative array of data necessary for calling an operation
*
*
* @param string $soapAction soapAction for operation
* @param string $bindingType type of binding eg: soap, soap12
* @return array
* @access public
* @return array
* @access public
*/
function getOperationDataForSoapAction($soapAction, $bindingType = 'soap') {
if ($bindingType == 'soap') {
@ -669,12 +669,12 @@ class wsdl extends nusoap_base {
foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
if ($opData['soapAction'] == $soapAction) {
return $opData;
}
}
}
}
}
}
}
}
/**
* returns an array of information about a given type
* returns false if no type exists by the given name
@ -885,7 +885,7 @@ class wsdl extends nusoap_base {
*
* @param mixed $debug whether to put debug=1 in endpoint URL
* @return string serialization of WSDL
* @access public
* @access public
*/
function serialize($debug = 0)
{
@ -893,15 +893,15 @@ class wsdl extends nusoap_base {
$xml .= "\n<definitions";
foreach($this->namespaces as $k => $v) {
$xml .= " xmlns:$k=\"$v\"";
}
}
// 10.9.02 - add poulter fix for wsdl and tns declarations
if (isset($this->namespaces['wsdl'])) {
$xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\"";
}
}
if (isset($this->namespaces['tns'])) {
$xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\"";
}
$xml .= '>';
}
$xml .= '>';
// imports
if (sizeof($this->import) > 0) {
foreach($this->import as $ns => $list) {
@ -912,8 +912,8 @@ class wsdl extends nusoap_base {
$xml .= '<import namespace="' . $ns . '" />';
}
}
}
}
}
}
// types
if (count($this->schemas)>=1) {
$xml .= "\n<types>\n";
@ -923,7 +923,7 @@ class wsdl extends nusoap_base {
}
}
$xml .= '</types>';
}
}
// messages
if (count($this->messages) >= 1) {
foreach($this->messages as $msgName => $msgParts) {
@ -940,11 +940,11 @@ class wsdl extends nusoap_base {
foreach($this->typemap as $ns => $types) {
if (isset($types[$partType])) {
$typePrefix = $this->getPrefixFromNamespace($ns);
}
}
}
}
if (!isset($typePrefix)) {
die("$partType has no namespace!");
}
}
}
$ns = $this->getNamespaceFromPrefix($typePrefix);
$localPart = $this->getLocalPart($partType);
@ -961,8 +961,8 @@ class wsdl extends nusoap_base {
}
}
$xml .= '</message>';
}
}
}
}
// bindings & porttypes
if (count($this->bindings) >= 1) {
$binding_xml = '';
@ -990,7 +990,7 @@ class wsdl extends nusoap_base {
$portType_xml .= "\n" . ' <operation name="' . $opParts['name'] . '"';
if (isset($opParts['parameterOrder'])) {
$portType_xml .= ' parameterOrder="' . $opParts['parameterOrder'] . '"';
}
}
$portType_xml .= '>';
if(isset($opParts['documentation']) && $opParts['documentation'] != '') {
$portType_xml .= "\n" . ' <documentation>' . htmlspecialchars($opParts['documentation']) . '</documentation>';
@ -998,12 +998,12 @@ class wsdl extends nusoap_base {
$portType_xml .= "\n" . ' <input message="tns:' . $opParts['input']['message'] . '"/>';
$portType_xml .= "\n" . ' <output message="tns:' . $opParts['output']['message'] . '"/>';
$portType_xml .= "\n" . ' </operation>';
}
}
$portType_xml .= "\n" . '</portType>';
$binding_xml .= "\n" . '</binding>';
}
}
$xml .= $portType_xml . $binding_xml;
}
}
// services
$xml .= "\n<service name=\"" . $this->serviceName . '">';
if (count($this->ports) >= 1) {
@ -1011,11 +1011,11 @@ class wsdl extends nusoap_base {
$xml .= "\n" . ' <port name="' . $pName . '" binding="tns:' . $attrs['binding'] . '">';
$xml .= "\n" . ' <soap:address location="' . $attrs['location'] . ($debug ? '?debug=1' : '') . '"/>';
$xml .= "\n" . ' </port>';
}
}
}
}
$xml .= "\n" . '</service>';
return $xml . "\n</definitions>";
}
}
/**
* determine whether a set of parameters are unwrapped
@ -1060,7 +1060,7 @@ class wsdl extends nusoap_base {
$phpType = $typeDef['phpType'];
$arrayType = (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '');
$this->debug("in parametersMatchWrapped: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: $arrayType");
// we expect a complexType or element of complexType
if ($phpType != 'struct') {
$this->debug("in parametersMatchWrapped: not a struct");
@ -1101,7 +1101,7 @@ class wsdl extends nusoap_base {
* TODO
* - multi-ref serialization
* - validate PHP values against type definitions, return errors if invalid
*
*
* @param string $operation operation name
* @param string $direction (input|output)
* @param mixed $parameters parameter value(s)
@ -1112,12 +1112,12 @@ class wsdl extends nusoap_base {
function serializeRPCParameters($operation, $direction, $parameters, $bindingType = 'soap') {
$this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion, bindingType=$bindingType");
$this->appendDebug('parameters=' . $this->varDump($parameters));
if ($direction != 'input' && $direction != 'output') {
$this->debug('The value of the \$direction argument needs to be either "input" or "output"');
$this->setError('The value of the \$direction argument needs to be either "input" or "output"');
return false;
}
}
if (!$opData = $this->getOperationData($operation, $bindingType)) {
$this->debug('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType);
$this->setError('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType);
@ -1168,7 +1168,7 @@ class wsdl extends nusoap_base {
$this->debug("serializing part $name of type $type");
// Track encoding style
if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
$encodingStyle = $opData[$direction]['encodingStyle'];
$encodingStyle = $opData[$direction]['encodingStyle'];
$enc_style = $encodingStyle;
} else {
$enc_style = false;
@ -1194,15 +1194,15 @@ class wsdl extends nusoap_base {
}
$this->debug("serializeRPCParameters returning: $xml");
return $xml;
}
}
/**
* serialize a PHP value according to a WSDL message definition
*
*
* TODO
* - multi-ref serialization
* - validate PHP values against type definitions, return errors if invalid
*
*
* @param string $operation operation name
* @param string $direction (input|output)
* @param mixed $parameters parameter value(s)
@ -1212,14 +1212,14 @@ class wsdl extends nusoap_base {
*/
function serializeParameters($operation, $direction, $parameters)
{
$this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion");
$this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion");
$this->appendDebug('parameters=' . $this->varDump($parameters));
if ($direction != 'input' && $direction != 'output') {
$this->debug('The value of the \$direction argument needs to be either "input" or "output"');
$this->setError('The value of the \$direction argument needs to be either "input" or "output"');
return false;
}
}
if (!$opData = $this->getOperationData($operation)) {
$this->debug('Unable to retrieve WSDL data for operation: ' . $operation);
$this->setError('Unable to retrieve WSDL data for operation: ' . $operation);
@ -1227,18 +1227,18 @@ class wsdl extends nusoap_base {
}
$this->debug('opData:');
$this->appendDebug($this->varDump($opData));
// Get encoding style for output and set to current
$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
$encodingStyle = $opData['output']['encodingStyle'];
$enc_style = $encodingStyle;
}
// set input params
$xml = '';
if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) {
$use = $opData[$direction]['use'];
$this->debug("use=$use");
$this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)');
@ -1249,7 +1249,7 @@ class wsdl extends nusoap_base {
$this->debug('serializing part "'.$name.'" of type "'.$type.'"');
// Track encoding style
if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
$encodingStyle = $opData[$direction]['encodingStyle'];
$encodingStyle = $opData[$direction]['encodingStyle'];
$enc_style = $encodingStyle;
} else {
$enc_style = false;
@ -1275,11 +1275,11 @@ class wsdl extends nusoap_base {
}
$this->debug("serializeParameters returning: $xml");
return $xml;
}
}
/**
* serializes a PHP value according a given type definition
*
*
* @param string $name name of value (part or element)
* @param string $type XML schema type of value (type or element)
* @param mixed $value a native PHP value (parameter value)
@ -1365,7 +1365,7 @@ class wsdl extends nusoap_base {
} else {
$value = 'true';
}
}
}
if ($uqType == 'string' && gettype($value) == 'string') {
$value = $this->expandEntities($value);
}
@ -1446,7 +1446,7 @@ class wsdl extends nusoap_base {
return false;
}
$phpType = $typeDef['phpType'];
$this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') );
$this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') );
// if php type == struct, map value to the <all> element names
if ($phpType == 'struct') {
if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') {
@ -1538,22 +1538,22 @@ class wsdl extends nusoap_base {
foreach($value as $v) {
$cols = ',' . sizeof($v);
$nv = array_merge($nv, $v);
}
}
$value = $nv;
} else {
$cols = '';
}
}
if (is_array($value) && sizeof($value) >= 1) {
$rows = sizeof($value);
$contents = '';
foreach($value as $k => $v) {
$this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]");
//$this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]");
//if (strpos($typeDef['arrayType'], ':') ) {
if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) {
$contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use);
} else {
$contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use);
}
}
}
} else {
$rows = 0;
@ -1597,7 +1597,7 @@ class wsdl extends nusoap_base {
$this->debug("in serializeType: returning: $xml");
return $xml;
}
/**
* serializes the attributes for a complexType
*
@ -1652,7 +1652,7 @@ class wsdl extends nusoap_base {
if ($xname) {
$xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\"";
}
}
}
} else {
$this->debug("no attributes to serialize for XML Schema type $ns:$uqType");
}
@ -1710,7 +1710,7 @@ class wsdl extends nusoap_base {
}
// if user took advantage of a minOccurs=0, then only serialize named parameters
if (isset($optionals)
&& (!isset($xvalue[$eName]))
&& (!isset($xvalue[$eName]))
&& ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true')
){
if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') {
@ -1758,7 +1758,7 @@ class wsdl extends nusoap_base {
}
}
}
}
}
} else {
$this->debug("no elements to serialize for XML Schema type $ns:$uqType");
}
@ -1794,7 +1794,7 @@ class wsdl extends nusoap_base {
}
$elements = $eElements;
}
if (count($attrs) > 0) {
foreach($attrs as $n => $a){
// expand each attribute
@ -1847,7 +1847,7 @@ class wsdl extends nusoap_base {
/**
* register an operation with the server
*
*
* @param string $name operation (method) name
* @param array $in assoc array of input values: key = param name, value = param type
* @param array $out assoc array of output values: key = param name, value = param type
@ -1857,7 +1857,7 @@ class wsdl extends nusoap_base {
* @param string $use (encoded|literal) optional The use for the parameters (cannot mix right now)
* @param string $documentation optional The description to include in the WSDL
* @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
* @access public
* @access public
*/
function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = ''){
if ($use == 'encoded' && $encodingStyle == '') {
@ -1904,7 +1904,7 @@ class wsdl extends nusoap_base {
'parts' => $out),
'namespace' => $namespace,
'transport' => 'http://schemas.xmlsoap.org/soap/http',
'documentation' => $documentation);
'documentation' => $documentation);
// add portTypes
// add messages
if($in)
@ -1932,7 +1932,7 @@ class wsdl extends nusoap_base {
$this->messages[$name.'Response']= '0';
}
return true;
}
}
}
?>
?>

@ -106,9 +106,9 @@ class AppPlugin
$pluginList = array();
if (!empty($pluginListName)) {
foreach ($pluginListName as $pluginName) {
$plugin_info = $this->getPluginInfo($pluginName);
if (isset($plugin_info['plugin_class'])) {
$pluginList[] = $plugin_info['plugin_class']::create();
$pluginInfo = $this->getPluginInfo($pluginName);
if (isset($pluginInfo['plugin_class'])) {
$pluginList[] = $pluginInfo['plugin_class']::create();
}
}
}
@ -560,11 +560,19 @@ class AppPlugin
if ($setting['type'] != 'checkbox') {
$form->addElement($setting['type'], $setting['name'], $obj->get_lang($setting['name']));
} else {
$element = & $form->createElement($setting['type'], $setting['name'], '', $obj->get_lang($setting['name']));
if ($setting['init_value'] == 1) {
$element = & $form->createElement(
$setting['type'],
$setting['name'],
'',
$obj->get_lang($setting['name'])
);
if (isset($setting['init_value']) && $setting['init_value'] == 1) {
$element->setChecked(true);
}
$groups[$setting['group']][] = $element;
if (isset($setting['group'])) {
$groups[$setting['group']][] = $element;
}
}
}
foreach ($groups as $k => $v) {

@ -314,7 +314,7 @@ class UserManager
}
} else {
$expirationDate = api_get_utc_datetime($expirationDate);
$expirationDate = new \DateTime($expirationDate);
$expirationDate = new \DateTime($expirationDate, new DateTimeZone('UTC'));
}
$userManager = self::getManager();
@ -848,7 +848,10 @@ class UserManager
if (!empty($expiration_date)) {
$expiration_date = api_get_utc_datetime($expiration_date);
$expiration_date = new \DateTime($expiration_date);
$expiration_date = new \DateTime(
$expiration_date,
new DateTimeZone('UTC')
);
}
$user

@ -36,6 +36,10 @@ function return_error($code) {
return $fault;
}
/**
* @param array $params
* @return bool
*/
function WSHelperVerifyKey($params)
{
global $_configuration, $debug;
@ -51,7 +55,7 @@ function WSHelperVerifyKey($params)
// if we are behind a reverse proxy, assume it will send the
// HTTP_X_FORWARDED_FOR header and use this IP instead
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
list($ip1, $ip2) = split(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
list($ip1, $ip2) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
$ip = trim($ip1);
}
if ($debug)
@ -455,9 +459,6 @@ function WSCreateUser($params) {
return return_error(WS_ERROR_SECRET_KEY);
}
// database table definition
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$firstName = $params['firstname'];
$lastName = $params['lastname'];
$status = $params['status'];
@ -750,7 +751,7 @@ function WSCreateUsersPasswordCrypted($params)
$phone = '';
$picture_uri = '';
$auth_source = PLATFORM_AUTH_SOURCE;
$expiration_date = '0000-00-00 00:00:00';
$expiration_date = '';
$active = 1;
$hr_dept_id = 0;
$extra = null;
@ -838,6 +839,7 @@ function WSCreateUsersPasswordCrypted($params)
expiration_date='".Database::escape_string($expiration_date)."',
active='1',
hr_dept_id=".intval($hr_dept_id);
$sql .= " WHERE user_id='".$r_check_user[0]."'";
Database::query($sql);
@ -874,7 +876,7 @@ function WSCreateUsersPasswordCrypted($params)
}
// First check wether the login already exists
if (!UserManager::is_username_available($loginName)) {
if(api_set_failure('login-pass already taken')) {
if (api_set_failure('login-pass already taken')) {
$results[] = 0;
continue;
}
@ -901,6 +903,10 @@ function WSCreateUsersPasswordCrypted($params)
if ($result) {
//echo "id returned";
$return = Database::insert_id();
$sql = "UPDATE $table_user SET user_id = id WHERE id = $return";
Database::query($sql);
if (api_is_multiple_url_enabled()) {
if (api_get_current_access_url_id() != -1) {
UrlManager::add_user_to_url($return, api_get_current_access_url_id());
@ -919,7 +925,7 @@ function WSCreateUsersPasswordCrypted($params)
''
);
// Save the remote system's id into user_field_value table.
$res = UserManager::update_extra_field_value(
UserManager::update_extra_field_value(
$return,
$original_user_id_name,
$original_user_id_value
@ -937,7 +943,7 @@ function WSCreateUsersPasswordCrypted($params)
''
);
// Save the external system's id into user_field_value table.
$res = UserManager::update_extra_field_value(
UserManager::update_extra_field_value(
$return,
$extra_field_name,
$extra_field_value
@ -1007,8 +1013,10 @@ $server->register('WSCreateUserPasswordCrypted', // m
);
// Define the method WSCreateUserPasswordCrypted
function WSCreateUserPasswordCrypted($params) {
function WSCreateUserPasswordCrypted($params)
{
global $_user, $_configuration, $debug;
$debug = 1;
if ($debug) error_log('WSCreateUserPasswordCrypted');
if ($debug) error_log(print_r($params,1));
@ -1019,26 +1027,28 @@ function WSCreateUserPasswordCrypted($params) {
// Database table definition.
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$result = array();
$orig_user_id_value = array();
$password = $params['password'];
$encrypt_method = $params['encrypt_method'];
$firstName = $params['firstname'];
$lastName = $params['lastname'];
$status = $params['status'];
$email = $params['email'];
$loginName = $params['loginname'];
$official_code = $params['official_code'];
$language = '';
$phone = $params['phone'];
$picture_uri = '';
$auth_source = PLATFORM_AUTH_SOURCE;
$expiration_date = '0000-00-00 00:00:00'; $active = 1; $hr_dept_id = 0; $extra = null;
$original_user_id_name = $params['original_user_id_name'];
$password = $params['password'];
$encrypt_method = $params['encrypt_method'];
$firstName = $params['firstname'];
$lastName = $params['lastname'];
$status = $params['status'];
$email = $params['email'];
$loginName = $params['loginname'];
$official_code = isset($params['official_code']) ? $params['official_code'] : '';
$language = '';
$phone = $params['phone'];
$picture_uri = '';
$auth_source = PLATFORM_AUTH_SOURCE;
$expiration_date = '';
$active = 1;
$hr_dept_id = 0;
$extra = null;
$original_user_id_name = $params['original_user_id_name'];
$original_user_id_value = $params['original_user_id_value'];
$orig_user_id_value[] = $params['original_user_id_value'];
$extra_list = $params['extra'];
$orig_user_id_value[] = $params['original_user_id_value'];
$extra_list = isset($params['extra']) ? $params['extra'] : '';
if (!empty($_configuration['password_encryption'])) {
if ($_configuration['password_encryption'] === $encrypt_method ) {
@ -1074,7 +1084,10 @@ function WSCreateUserPasswordCrypted($params) {
}
// Check whether x_user_id exists into user_field_values table.
$user_id = UserManager::get_user_id_from_original_id($original_user_id_value, $original_user_id_name);
$user_id = UserManager::get_user_id_from_original_id(
$original_user_id_value,
$original_user_id_name
);
if ($debug) error_log('Ready to create user');
@ -1098,7 +1111,7 @@ function WSCreateUserPasswordCrypted($params) {
username='".Database::escape_string($loginName)."',";
if (!is_null($auth_source)) {
$sql .= " auth_source='".Database::escape_string($auth_source)."',";
$sql .= " auth_source='".Database::escape_string($auth_source)."',";
}
$sql .= "
password='".Database::escape_string($password)."',
@ -1118,7 +1131,11 @@ function WSCreateUserPasswordCrypted($params) {
$extra_field_name = $extra['field_name'];
$extra_field_value = $extra['field_value'];
// Save the external system's id into user_field_value table.
$res = UserManager::update_extra_field_value($r_check_user[0], $extra_field_name, $extra_field_value);
UserManager::update_extra_field_value(
$r_check_user[0],
$extra_field_name,
$extra_field_value
);
}
}
return $r_check_user[0];
@ -1154,7 +1171,7 @@ function WSCreateUserPasswordCrypted($params) {
status = '".Database::escape_string($status)."',
password = '".Database::escape_string($password)."',
email = '".Database::escape_string($email)."',
official_code = '".Database::escape_string($official_code)."',
official_code = '".Database::escape_string($official_code)."',
picture_uri = '".Database::escape_string($picture_uri)."',
creator_id = '".Database::escape_string($creator_id)."',
auth_source = '".Database::escape_string($auth_source)."',
@ -1170,6 +1187,8 @@ function WSCreateUserPasswordCrypted($params) {
if ($result) {
$return = Database::insert_id();
$sql = "UPDATE $table_user SET user_id = id WHERE id = $return";
Database::query($sql);
$url_id = api_get_current_access_url_id();
UrlManager::add_user_to_url($return, $url_id);
@ -1183,7 +1202,7 @@ function WSCreateUserPasswordCrypted($params) {
''
);
// Save the remote system's id into user_field_value table.
$res = UserManager::update_extra_field_value(
UserManager::update_extra_field_value(
$return,
$original_user_id_name,
$original_user_id_value
@ -1201,7 +1220,7 @@ function WSCreateUserPasswordCrypted($params) {
''
);
// save the external system's id into user_field_value table'
$res = UserManager::update_extra_field_value(
UserManager::update_extra_field_value(
$return,
$extra_field_name,
$extra_field_value
@ -5698,27 +5717,30 @@ $server->register('WSListCourses',
);
// define the method WSListCourses
function WSListCourses($params) {
if(!WSHelperVerifyKey($params)) {
function WSListCourses($params)
{
if (!WSHelperVerifyKey($params)) {
return return_error(WS_ERROR_SECRET_KEY);
}
$course_field_name = $params['original_course_id_name'];
$course_field_name = isset($params['original_course_id_name']) ? $params['original_course_id_name'] : '';
$courses_result = array();
$category_names = array();
$courses = CourseManager::get_courses_list();
foreach($courses as $course) {
foreach ($courses as $course) {
$course_tmp = array();
$course_tmp['id'] = $course['id'];
$course_tmp['code'] = $course['code'];
$course_tmp['title'] = $course['title'];
$course_tmp['language'] = $course['language'];
$course_tmp['language'] = $course['course_language'];
$course_tmp['visibility'] = $course['visibility'];
// Determining category name
if($category_names[$course['category_code']]) {
if (!empty($course['category_code']) &&
$category_names[$course['category_code']]
) {
$course_tmp['category_name'] = $category_names[$course['category_code']];
} else {
$category = CourseManager::get_course_category($course['category_code']);
@ -5727,12 +5749,20 @@ function WSListCourses($params) {
}
// Determining number of students registered in course
$course_tmp['number_students'] = CourseManager::get_users_count_in_course($course['code']);
$course_tmp['number_students'] = CourseManager::get_users_count_in_course(
$course['code']
);
// Determining external course id
$course_tmp['external_course_id'] = CourseManager::get_course_extra_field_value($course_field_name, $course['code']);
$externalCourseId = '';
if ($course_field_name) {
$externalCourseId = CourseManager::get_course_extra_field_value(
$course_field_name,
$course['code']
);
}
$course_tmp['external_course_id'] = $externalCourseId;
$courses_result[] = $course_tmp;
}
@ -6599,7 +6629,9 @@ if (!empty($hook)) {
}
// Use the request to (try to) invoke the service
$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input');
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
// If you send your data in utf8 then this value must be false.
$decodeUTF8 = api_get_setting('registration.soap.php.decode_utf8');
if ($decodeUTF8 === 'true') {

@ -1087,6 +1087,17 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
*/
public function getOpenSessionUrl($userId, $params)
{
$userIsSubscribed = SessionManager::isUserSubscribedAsStudent(
$params['session_id'],
$userId
);
if ($userIsSubscribed) {
return api_get_path(WEB_CODE_PATH)
. 'session/index.php?session_id='
. intval($params['session_id']);
}
$params['secret_key'] = null;
$params['user_id'] = null;
$params['user_field'] = null;

@ -40,7 +40,7 @@
</div>
{% else %}
<div class="alert alert-success legal-terms-popup">
{{ 'SuccessSubscriptionToSessionX'|get_plugin_lang('AdvancedSubscriptionPlugin') }}
{{ 'SuccessSubscriptionToSessionX'|get_plugin_lang('AdvancedSubscriptionPlugin')|format(session.name) }}
</div>
<div class="text-right legal-terms-popup">

Loading…
Cancel
Save