Skip to content

Commit

Permalink
Fix test ws_session_user - refs BT#9092 #hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Barreto committed Feb 25, 2015
1 parent 9a5c4af commit f9c14b9
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions plugin/advanced_subscription/test/ws_session_user.php
Expand Up @@ -22,10 +22,46 @@
$params['user_id'] = intval($_REQUEST['u']);
$params['session_id'] = intval($_REQUEST['s']);
$params['profile_completed'] = 100;
$params['secret_key'] = 'ed639d402804ffa347b489be3e42f28058e402bf';

/**
* Copied code from WSHelperVerifyKey function
*/
/**
* Start WSHelperVerifyKey
*/
//error_log(print_r($params,1));
$check_ip = false;
$ip = trim($_SERVER['REMOTE_ADDR']);
// 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']);
$ip = trim($ip1);
}
// Check if a file that limits access from webservices exists and contains
// the restraining check
if (is_file(api_get_path(WEB_CODE_PATH) .'webservices/webservice-auth-ip.conf.php')) {
include api_get_path(WEB_CODE_PATH).'webservices/webservice-auth-ip.conf.php';
if (!empty($ws_auth_ip)) {
$check_ip = true;
}
}

global $_configuration;
if ($check_ip) {
$security_key = $_configuration['security_key'];
} else {
$security_key = $ip.$_configuration['security_key'];
//error_log($secret_key.'-'.$security_key);
}
/**
* End WSHelperVerifyKey
*/

$params['secret_key'] = sha1($security_key);

// Registration soap wsdl
$wsUrl = 'http://chamilo19.net/main/webservices/registration.soap.php?wsdl';
$wsUrl = api_get_path(WEB_CODE_PATH) . 'webservices/registration.soap.php?wsdl';
$options = array(
'location' => $wsUrl,
'uri' => $wsUrl,
Expand Down

0 comments on commit f9c14b9

Please sign in to comment.