35 include_once
'./webservice/soap/lib/nusoap.php';
36 include_once (
"./Services/Authentication/classes/class.ilAuthUtils.php");
38 define (
'SOAP_CLIENT_ERROR', 1);
39 define (
'SOAP_SERVER_ERROR', 2);
61 define(
'USER_FOLDER_ID',7);
67 $this->error_method = NUSOAP;
71 $this->error_method = PHP5;
73 #echo ("SOAP: using soap mode ".IL_SOAPMODE == IL_SOAPMODE_NUSOAP ? "NUSOAP": "PHP5");
96 if(!$ilAuth->getAuth())
98 switch($ilAuth->getStatus())
124 if(!$ilUser->hasAcceptedUserAgreement() and $ilUser->getId() != ANONYMOUS_USER_ID)
133 if($this->soap_check)
136 $this->
__setMessage(
'SOAP is not enabled in ILIAS administration for this client');
138 return ($set->get(
"soap_user_administration") == 1);
153 include_once(
'classes/class.ilErrorHandling.php');
155 set_error_handler(array(
'ilErrorHandling',
'_ilErrorWriter'),E_ALL);
161 $exploded = explode(
'::',$sid);
163 return is_array($exploded) ? $exploded : array(
'sid' =>
'',
'client' =>
'');
169 $this->message = $a_str;
173 return $this->message;
177 $this->message .= isset($this->message) ?
' ' :
'';
178 $this->message .= $a_str;
183 $this->message_code = $a_code;
188 return $this->message_code;
197 #$_SESSION['_authhttp'.md5(CLIENT_ID)] = true;
198 #$_SESSION['PHPSESSID'] = $sid;
203 include_once(
"./Services/Init/classes/class.ilInitialisation.php");
205 return $init->initILIAS(
"soap");
211 include_once
'./Services/Authentication/classes/class.ilAuthFactory.php';
218 #echo $a_message, $a_code;
219 switch($this->error_method)
224 return new SoapFault($a_code, $a_message);
245 global $rbacsystem, $rbacreview,
$ilLog, $rbacadmin,
$ilSetting, $ilClientIniFile;
247 if (!is_object($ilClientIniFile)) {
248 return $this->
__raiseError(
"Client ini is not initialized",
"Server");
253 $auth_mode_names = array();
254 foreach ($auth_modes as $mode) {
258 include_once
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
259 include_once
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordXMLWriter.php';
262 $record_ids = array();
264 foreach($record_types as
$type) {
266 foreach ($records as $record){
267 $record_ids [] = $record->getRecordId();
270 $record_ids = array_unique($record_ids);
272 $advmwriter->write();
275 include_once (
"./Services/User/classes/class.ilUserXMLWriter.php");
278 $udfWriter->setObjects($users);
282 $client_details[] = array (
"installation_id" => IL_INST_ID,
284 "installation_url" => ILIAS_HTTP_PATH,
285 "installation_description" => $ilClientIniFile->readVariable(
"client",
"description"),
286 "installation_language_default" => $ilClientIniFile->readVariable(
"language",
"default"),
287 "installation_session_expire" => $ilClientIniFile->readVariable(
"session",
"expire"),
288 "installation_php_postmaxsize" => $this->
return_bytes(ini_get(
"post_max_size")),
289 "authentication_methods" => join(
",", $auth_mode_names),
290 "authentication_default_method" => $auth_mode_default,
291 "installation_udf_xml" => $udfWriter ->getXML(),
292 "installation_advmd_xml" => $advmwriter->xmlDumpMem(
false)
297 include_once
'./webservice/soap/classes/class.ilXMLResultSet.php';
301 $xmlResult->addArray($client_details,
true);
304 include_once
'./webservice/soap/classes/class.ilXMLResultSetWriter.php';
306 $xmlResultWriter->start();
307 return $xmlResultWriter->getXML();
316 $last = strtolower($val{strlen($val)-1});
330 switch($this->error_method)
335 return $object instanceof SoapFault;
358 'CLIENT_OBJECT_NOT_FOUND');
362 return $this->
__raiseError(
'Object is already trashed.',
363 'CLIENT_OBJECT_DELETED');
367 if ((is_array($expected_type) && !in_array(
$type, $expected_type))
369 (!is_array($expected_type) &&
$type != $expected_type)
372 return $this->
__raiseError(
"Wrong type $type for id. Expected: ".(is_array($expected_type) ? join (
",",$expected_type) : $expected_type),
'CLIENT_OBJECT_WRONG_TYPE');
375 if (!$rbacsystem->checkAccess($permission,
$ref_id,
$type))
377 return $this->
__raiseError(
'Missing permission $permission for type $type.',
'CLIENT_OBJECT_WRONG_PERMISSION');
389 require_once(
"Services/Init/classes/class.ilInitialisation.php");
392 $init->requireCommonIncludes();
393 $init->initIliasIniFile();
395 $ilias = &
new ILIAS();
401 require_once (
"webservice/soap/classes/class.ilSoapInstallationInfoXMLWriter.php");
404 if (is_array($clientdirs))
406 foreach ($clientdirs as $clientdir)
408 if (is_object($clientInfo= $this->
getClientInfo($init, $clientdir)))
410 $writer->addClient ($clientInfo);
416 return $writer->getXML();
421 require_once(
"Services/Init/classes/class.ilInitialisation.php");
424 $init->requireCommonIncludes();
425 $init->initIliasIniFile();
427 $ilias = &
new ILIAS();
433 require_once (
"webservice/soap/classes/class.ilSoapInstallationInfoXMLWriter.php");
435 $writer->setExportAdvancedMetaDataDefinitions (
true);
436 $writer->setExportUDFDefinitions (
true);
443 return $this->
__raiseError(
"Client ID $clientid does not exist!",
'Client');
445 return $writer->getXML();
451 $ini_file =
"./".$client_dir.
"/client.ini.php";
454 require_once(
"classes/class.ilIniFile.php");
456 $ilClientIniFile =
new ilIniFile($ini_file);
457 $ilClientIniFile->read();
458 if ($ilClientIniFile->ERROR !=
"")
462 $client_id = $ilClientIniFile->readVariable(
'client',
'name');
463 if ($ilClientIniFile->variableExists(
'client',
'expose'))
465 $client_expose = $ilClientIniFile->readVariable(
'client',
'expose');
466 if ($client_expose ==
"0")
471 require_once(
"./Services/Database/classes/class.ilDBWrapperFactory.php");
473 $ilDB->initFromIniFile($ilClientIniFile);
474 if ($ilDB->connect(
true))
478 require_once(
"Services/Administration/classes/class.ilSetting.php");
482 define (
"IL_INST_ID", $settings->get(
"inst_id",0));
483 $settings->access = $ilClientIniFile->readVariable(
"client",
"access");
484 $settings->description = $ilClientIniFile->readVariable(
"client",
"description");
485 $settings->session = min((
int) ini_get(
"session.gc_maxlifetime"), (
int) $ilClientIniFile->readVariable(
"session",
"expire"));
486 $settings->language = $ilClientIniFile->readVariable(
"language",
"default");
487 $settings->clientid = basename($client_dir);
488 $settings->default_show_users_online = $settings->get(
"show_users_online");
489 $settings->default_hits_per_page = $settings->get(
"hits_per_page");
490 $skin = $ilClientIniFile->readVariable(
"layout",
"skin");
491 $style = $ilClientIniFile->readVariable(
"layout",
"style");
492 $settings->default_skin_style = $skin.
":".$style;