35 if (version_compare(PHP_VERSION,
'5.3.0',
'>=') or 1)
37 include_once
'./webservice/soap/lib2/nusoap.php';
41 include_once
'./webservice/soap/lib/nusoap.php';
44 include_once (
"./Services/Authentication/classes/class.ilAuthUtils.php");
46 define (
'SOAP_CLIENT_ERROR', 1);
47 define (
'SOAP_SERVER_ERROR', 2);
69 define(
'USER_FOLDER_ID',7);
75 $this->error_method = NUSOAP;
79 $this->error_method = PHP5;
81 #echo ("SOAP: using soap mode ".IL_SOAPMODE == IL_SOAPMODE_NUSOAP ? "NUSOAP": "PHP5");
104 if(!$ilAuth->getAuth())
106 switch($ilAuth->getStatus())
132 if(!$ilUser->hasAcceptedUserAgreement() and $ilUser->getId() != ANONYMOUS_USER_ID)
141 if($this->soap_check)
144 $this->
__setMessage(
'SOAP is not enabled in ILIAS administration for this client');
146 return ($set->get(
"soap_user_administration") == 1);
161 include_once(
'classes/class.ilErrorHandling.php');
163 set_error_handler(array(
'ilErrorHandling',
'_ilErrorWriter'),E_ALL);
169 $exploded = explode(
'::',$sid);
171 return is_array($exploded) ? $exploded : array(
'sid' =>
'',
'client' =>
'');
177 $this->message = $a_str;
181 return $this->message;
185 $this->message .= isset($this->message) ?
' ' :
'';
186 $this->message .= $a_str;
191 $this->message_code = $a_code;
196 return $this->message_code;
205 #$_SESSION['_authhttp'.md5(CLIENT_ID)] = true;
206 #$_SESSION['PHPSESSID'] = $sid;
211 include_once(
"./Services/Init/classes/class.ilInitialisation.php");
213 return $init->initILIAS(
"soap");
219 include_once
'./Services/Authentication/classes/class.ilAuthFactory.php';
226 #echo $a_message, $a_code;
227 switch($this->error_method)
232 return new SoapFault($a_code, $a_message);
253 global $rbacsystem, $rbacreview,
$ilLog, $rbacadmin,
$ilSetting, $ilClientIniFile;
255 if (!is_object($ilClientIniFile)) {
256 return $this->
__raiseError(
"Client ini is not initialized",
"Server");
261 $auth_mode_names = array();
262 foreach ($auth_modes as $mode) {
266 include_once
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
267 include_once
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordXMLWriter.php';
270 $record_ids = array();
272 foreach($record_types as
$type) {
274 foreach ($records as $record){
275 $record_ids [] = $record->getRecordId();
278 $record_ids = array_unique($record_ids);
280 $advmwriter->write();
283 include_once (
"./Services/User/classes/class.ilUserXMLWriter.php");
286 $udfWriter->setObjects($users);
290 $client_details[] = array (
"installation_id" => IL_INST_ID,
292 "installation_url" => ILIAS_HTTP_PATH,
293 "installation_description" => $ilClientIniFile->readVariable(
"client",
"description"),
294 "installation_language_default" => $ilClientIniFile->readVariable(
"language",
"default"),
295 "installation_session_expire" => $ilClientIniFile->readVariable(
"session",
"expire"),
296 "installation_php_postmaxsize" => $this->
return_bytes(ini_get(
"post_max_size")),
297 "authentication_methods" => join(
",", $auth_mode_names),
298 "authentication_default_method" => $auth_mode_default,
299 "installation_udf_xml" => $udfWriter ->getXML(),
300 "installation_advmd_xml" => $advmwriter->xmlDumpMem(
false)
305 include_once
'./webservice/soap/classes/class.ilXMLResultSet.php';
309 $xmlResult->addArray($client_details,
true);
312 include_once
'./webservice/soap/classes/class.ilXMLResultSetWriter.php';
314 $xmlResultWriter->start();
315 return $xmlResultWriter->getXML();
324 $last = strtolower($val{strlen($val)-1});
338 switch($this->error_method)
343 return $object instanceof SoapFault;
366 'CLIENT_OBJECT_NOT_FOUND');
370 return $this->
__raiseError(
'Object is already trashed.',
371 'CLIENT_OBJECT_DELETED');
375 if ((is_array($expected_type) && !in_array(
$type, $expected_type))
377 (!is_array($expected_type) &&
$type != $expected_type)
380 return $this->
__raiseError(
"Wrong type $type for id. Expected: ".(is_array($expected_type) ? join (
",",$expected_type) : $expected_type),
'CLIENT_OBJECT_WRONG_TYPE');
383 if (!$rbacsystem->checkAccess($permission,
$ref_id,
$type))
385 return $this->
__raiseError(
'Missing permission $permission for type $type.',
'CLIENT_OBJECT_WRONG_PERMISSION');
397 require_once(
"Services/Init/classes/class.ilInitialisation.php");
400 $init->requireCommonIncludes();
401 $init->initIliasIniFile();
403 $ilias = &
new ILIAS();
409 require_once (
"webservice/soap/classes/class.ilSoapInstallationInfoXMLWriter.php");
412 if (is_array($clientdirs))
414 foreach ($clientdirs as $clientdir)
416 if (is_object($clientInfo= $this->
getClientInfo($init, $clientdir)))
418 $writer->addClient ($clientInfo);
424 return $writer->getXML();
429 require_once(
"Services/Init/classes/class.ilInitialisation.php");
432 $init->requireCommonIncludes();
433 $init->initIliasIniFile();
435 $ilias = &
new ILIAS();
441 require_once (
"webservice/soap/classes/class.ilSoapInstallationInfoXMLWriter.php");
443 $writer->setExportAdvancedMetaDataDefinitions (
true);
444 $writer->setExportUDFDefinitions (
true);
451 return $this->
__raiseError(
"Client ID $clientid does not exist!",
'Client');
453 return $writer->getXML();
459 $ini_file =
"./".$client_dir.
"/client.ini.php";
462 require_once(
"classes/class.ilIniFile.php");
464 $ilClientIniFile =
new ilIniFile($ini_file);
465 $ilClientIniFile->read();
466 if ($ilClientIniFile->ERROR !=
"")
470 $client_id = $ilClientIniFile->readVariable(
'client',
'name');
471 if ($ilClientIniFile->variableExists(
'client',
'expose'))
473 $client_expose = $ilClientIniFile->readVariable(
'client',
'expose');
474 if ($client_expose ==
"0")
479 require_once(
"./Services/Database/classes/class.ilDBWrapperFactory.php");
481 $ilDB->initFromIniFile($ilClientIniFile);
482 if ($ilDB->connect(
true))
486 require_once(
"Services/Administration/classes/class.ilSetting.php");
490 define (
"IL_INST_ID", $settings->get(
"inst_id",0));
491 $settings->access = $ilClientIniFile->readVariable(
"client",
"access");
492 $settings->description = $ilClientIniFile->readVariable(
"client",
"description");
493 $settings->session = min((
int) ini_get(
"session.gc_maxlifetime"), (
int) $ilClientIniFile->readVariable(
"session",
"expire"));
494 $settings->language = $ilClientIniFile->readVariable(
"language",
"default");
495 $settings->clientid = basename($client_dir);
496 $settings->default_show_users_online = $settings->get(
"show_users_online");
497 $settings->default_hits_per_page = $settings->get(
"hits_per_page");
498 $skin = $ilClientIniFile->readVariable(
"layout",
"skin");
499 $style = $ilClientIniFile->readVariable(
"layout",
"style");
500 $settings->default_skin_style = $skin.
":".$style;