ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilSoapUtils Class Reference
+ Inheritance diagram for ilSoapUtils:
+ Collaboration diagram for ilSoapUtils:

Public Member Functions

 ignoreUserAbort ()
 
 disableSOAPCheck ()
 
 sendMail ($sid, $to, $cc, $bcc, $sender, $subject, $message, $attach)
 
 distributeMails ($sid, $a_mail_xml)
 mail via soap More...
 
 saveTempFileAsMediaObject ($sid, $name, $tmp_name)
 
 getMobsOfObject ($sid, $a_type, $a_id)
 
 ilCloneDependencies ($sid, $copy_identifier)
 clone object dependencies (e.g. More...
 
 ilClone ($sid, $copy_identifier)
 Clone object. More...
 
 handleECSTasks ($sid, $a_server_id)
 
 deleteExpiredDualOptInUserObjects ($sid, $usr_id)
 Method for soap webservice: deleteExpiredDualOptInUserObjects. More...
 
- Public Member Functions inherited from ilSoapAdministration
 __construct ($use_nusoap=true)
 Constructor. More...
 
 initErrorWriter ()
 Overwrite error handler. More...
 
 __explodeSid ($sid)
 
 __setMessage ($a_str)
 
 __getMessage ()
 
 __appendMessage ($a_str)
 
 __setMessageCode ($a_code)
 
 __getMessageCode ()
 
 initAuth ($sid)
 Init authentication. More...
 
 initIlias ()
 
 __initAuthenticationObject ($a_auth_mode=AUTH_LOCAL)
 
 __raiseError ($a_message, $a_code)
 
 getNIC ($sid)
 get client information from current as xml result set More...
 
 isFault ($object)
 
 checkObjectAccess ($ref_id, $expected_type, $permission, $returnObject=false)
 check access for ref id: expected type, permission, return object instance if returnobject is true More...
 
 getInstallationInfoXML ()
 
 getClientInfoXML ($clientid)
 

Static Public Member Functions

static validateXML ($xml)
 validates an xml file, if dtd is attached More...
 
- Static Public Member Functions inherited from ilSoapAdministration
static return_bytes ($val)
 calculate bytes from K,M,G modifiers e.g: 8M = 8 * 1024 * 1024 bytes More...
 

Private Member Functions

 callNextNode ($sid, $cp_options)
 Call next node using soap. More...
 
 callNextDependency ($sid, $cp_options)
 
 cloneNode ($node, $cp_options)
 Clone node. More...
 
 cloneDependencies ($node, $cp_options)
 cloneDependencies More...
 
 linkNode ($node, $cp_options)
 Link node. More...
 

Additional Inherited Members

- Data Fields inherited from ilSoapAdministration
 $sauth = null
 
 $error_method = null
 
- Protected Attributes inherited from ilSoapAdministration
 $soap_check = true
 

Detailed Description

Definition at line 35 of file class.ilSoapUtils.php.

Member Function Documentation

◆ callNextDependency()

ilSoapUtils::callNextDependency (   $sid,
  $cp_options 
)
private

Definition at line 437 of file class.ilSoapUtils.php.

438 {
439 global $ilLog;
440
441 $cp_options->dropFirstDependenciesNode();
442
443 if($cp_options->isSOAPEnabled())
444 {
445 // Start next soap call
446 include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
447 $soap_client = new ilSoapClient();
448 $soap_client->setResponseTimeout(1);
449 $soap_client->enableWSDL(true);
450 $soap_client->init();
451 $soap_client->call('ilCloneDependencies',array($sid,$cp_options->getCopyId()));
452 }
453 else
454 {
455 ilLoggerFactory::getLogger('obj')->warning('SOAP clone call failed. Calling clone method manually');
456 $cp_options->read();
457 include_once('./webservice/soap/include/inc.soap_functions.php');
458 $res = ilSoapFunctions::ilCloneDependencies($sid,$cp_options->getCopyId());
459 }
460 return true;
461 }
static getLogger($a_component_id)
Get component logger.
static ilCloneDependencies($sid, $copy_identifier)

References $ilLog, $res, ilLoggerFactory\getLogger(), and ilSoapFunctions\ilCloneDependencies().

Referenced by ilCloneDependencies().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ callNextNode()

ilSoapUtils::callNextNode (   $sid,
  $cp_options 
)
private

Call next node using soap.

Parameters
objectcopx wizard options instance @access private

Definition at line 411 of file class.ilSoapUtils.php.

412 {
413 global $ilLog;
414
415 $cp_options->dropFirstNode();
416
417 if($cp_options->isSOAPEnabled())
418 {
419 // Start next soap call
420 include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
421 $soap_client = new ilSoapClient();
422 $soap_client->setResponseTimeout(1);
423 $soap_client->enableWSDL(true);
424 $soap_client->init();
425 $soap_client->call('ilClone',array($sid,$cp_options->getCopyId()));
426 }
427 else
428 {
429 ilLoggerFactory::getLogger('obj')->warning('SOAP clone call failed. Calling clone method manually');
430 $cp_options->read();
431 include_once('./webservice/soap/include/inc.soap_functions.php');
432 $res = ilSoapFunctions::ilClone($sid,$cp_options->getCopyId());
433 }
434 return true;
435 }
static ilClone($sid, $copy_identifier)

References $ilLog, $res, ilLoggerFactory\getLogger(), and ilSoapFunctions\ilClone().

Referenced by ilClone().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cloneDependencies()

ilSoapUtils::cloneDependencies (   $node,
  $cp_options 
)
private

cloneDependencies

@access private

Parameters

Definition at line 527 of file class.ilSoapUtils.php.

528 {
529 global $ilLog;
530
531 $source_id = $node['child'];
532 $mappings = $cp_options->getMappings();
533
534 if(!isset($mappings[$source_id]))
535 {
536 ilLoggerFactory::getLogger('obj')->debug('Omitting node '.$source_id.', '.$node['title'].', '.$node['type']. '. No mapping found.');
537 return true;
538 }
539 $target_id = $mappings[$source_id];
540
541 $orig = ilObjectFactory::getInstanceByRefId((int) $source_id);
542 $orig->cloneDependencies($target_id,$cp_options->getCopyId());
543 return true;
544 }
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
$target_id
Definition: goto.php:51

References $ilLog, $orig, $target_id, ilObjectFactory\getInstanceByRefId(), and ilLoggerFactory\getLogger().

Referenced by ilCloneDependencies().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cloneNode()

ilSoapUtils::cloneNode (   $node,
  $cp_options 
)
private

Clone node.

@access private

Parameters

Definition at line 470 of file class.ilSoapUtils.php.

471 {
472 global $ilLog,$tree,$ilAccess,$rbacreview;
473
474 #sleep(20);
475
476 $source_id = $node['child'];
477 $parent_id = $node['parent'];
478 $options = $cp_options->getOptions($node['child']);
479 $mappings = $cp_options->getMappings();
480
481 if(!$ilAccess->checkAccess('copy','',$node['child']))
482 {
483 ilLoggerFactory::getLogger('obj')->error('No copy permission granted: '.$source_id.', '.$node['title'].', '.$node['type']);
484 return false;
485
486 }
487 if(!isset($mappings[$parent_id]))
488 {
489 ilLoggerFactory::getLogger('obj')->info('Omitting node '.$source_id.', '.$node['title'].', '.$node['type']. '. No target found.');
490 return true;
491 }
492 $target_id = $mappings[$parent_id];
493
494 if(!$tree->isInTree($target_id))
495 {
496 ilLoggerFactory::getLogger('obj')->notice('Omitting node '.$source_id.', '.$node['title'].', '.$node['type']. '. Object has been deleted.');
497 return false;
498 }
499
500 $orig = ilObjectFactory::getInstanceByRefId((int) $source_id);
501 $new_obj = $orig->cloneObject((int) $target_id,$cp_options->getCopyId());
502
503 if(!is_object($new_obj))
504 {
505 ilLoggerFactory::getLogger('obj')->error('Error copying '.$source_id.', '.$node['title'].', '.$node['type'].'. No target found.');
506 return false;
507 }
508
509 // rbac log
510 include_once "Services/AccessControl/classes/class.ilRbacLog.php";
511 $rbac_log_roles = $rbacreview->getParentRoleIds($new_obj->getRefId(), false);
512 $rbac_log = ilRbacLog::gatherFaPa($new_obj->getRefId(), array_keys($rbac_log_roles), true);
513 ilRbacLog::add(ilRbacLog::COPY_OBJECT, $new_obj->getRefId(), $rbac_log, (int)$source_id);
514
515 // Finally add new mapping entry
516 $cp_options->appendMapping($source_id,$new_obj->getRefId());
517 return $new_obj->getRefId();
518 }
const COPY_OBJECT
static add($a_action, $a_ref_id, array $a_diff, $a_source_ref_id=false)
static gatherFaPa($a_ref_id, array $a_role_ids, $a_add_action=false)
if(!is_array($argv)) $options

References $ilLog, $options, $orig, $target_id, ilRbacLog\add(), ilRbacLog\COPY_OBJECT, ilRbacLog\gatherFaPa(), ilObjectFactory\getInstanceByRefId(), and ilLoggerFactory\getLogger().

Referenced by ilClone().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteExpiredDualOptInUserObjects()

ilSoapUtils::deleteExpiredDualOptInUserObjects (   $sid,
  $usr_id 
)

Method for soap webservice: deleteExpiredDualOptInUserObjects.

This service will run in background. The client has not to wait for response.

Parameters
string$sidSession id + client id, separated by ::
integer$usr_idUser id of the actuator
Returns
boolean true or false @access public

Definition at line 658 of file class.ilSoapUtils.php.

659 {
660 $this->initAuth($sid);
661 $this->initIlias();
662
663 // Session check not possible -> anonymous user is the trigger
664
665 global $ilDB, $ilLog;
666
667 $ilLog->write(__METHOD__.': Started deletion of inactive user objects with expired confirmation hash values (dual opt in) ...');
668
669 require_once 'Services/Registration/classes/class.ilRegistrationSettings.php';
670 $oRegSettigs = new ilRegistrationSettings();
671
672 $query = '';
673
674 /*
675 * Fetch the current actuator user object first, because this user will try to perform very probably
676 * a new registration with the same login name in a few seconds ;-)
677 *
678 */
679 if((int)$usr_id > 0)
680 {
681 $query .= 'SELECT usr_id, create_date, reg_hash FROM usr_data '
682 . 'WHERE active = 0 '
683 . 'AND reg_hash IS NOT NULL '
684 . 'AND usr_id = '.$ilDB->quote($usr_id, 'integer').' ';
685 $query .= 'UNION ';
686 }
687
688 $query .= 'SELECT usr_id, create_date, reg_hash FROM usr_data '
689 . 'WHERE active = 0 '
690 . 'AND reg_hash IS NOT NULL '
691 . 'AND usr_id != '.$ilDB->quote($usr_id, 'integer').' ';
692
693 $res = $ilDB->query($query);
694
695 $ilLog->write(__METHOD__.': '.$ilDB->numRows($res).' inactive user objects with confirmation hash values (dual opt in) found ...');
696
697 /*
698 * mjansen: 15.12.2010:
699 * I perform the expiration check in php because of multi database support (mysql, postgresql).
700 * I did not find an oracle equivalent for mysql: UNIX_TIMESTAMP()
701 */
702
703 $num_deleted_users = 0;
704 while($row = $ilDB->fetchAssoc($res))
705 {
706 if($row['usr_id'] == ANONYMOUS_USER_ID || $row['usr_id'] == SYSTEM_USER_ID) continue;
707 if(!strlen($row['reg_hash'])) continue;
708
709 if((int)$oRegSettigs->getRegistrationHashLifetime() > 0 &&
710 $row['create_date'] != '' &&
711 time() - $oRegSettigs->getRegistrationHashLifetime() > strtotime($row['create_date']))
712 {
713 $user = ilObjectFactory::getInstanceByObjId($row['usr_id'], false);
714 if($user instanceof ilObjUser)
715 {
716 $ilLog->write(__METHOD__.': User '.$user->getLogin().' (obj_id: '.$user->getId().') will be deleted due to an expired registration hash ...');
717 $user->delete();
718 ++$num_deleted_users;
719 }
720 }
721 }
722
723 $ilLog->write(__METHOD__.': '.$num_deleted_users.' inactive user objects with expired confirmation hash values (dual opt in) deleted ...');
724
725 $ilLog->write(__METHOD__.': Finished deletion of inactive user objects with expired confirmation hash values (dual opt in) ...');
726
727 return true;
728 }
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilObjAuthSettingsGUI.
initAuth($sid)
Init authentication.
global $ilDB

References $ilDB, $ilLog, $query, $res, $row, ilObjectFactory\getInstanceByObjId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ disableSOAPCheck()

ilSoapUtils::disableSOAPCheck ( )

Definition at line 43 of file class.ilSoapUtils.php.

44 {
45 $this->soap_check = false;
46 }

◆ distributeMails()

ilSoapUtils::distributeMails (   $sid,
  $a_mail_xml 
)

mail via soap

Parameters
object$sid
object$a_mail_xml
Returns

Definition at line 146 of file class.ilSoapUtils.php.

147 {
148 $this->initAuth($sid);
149 $this->initIlias();
150
151 if(!$this->__checkSession($sid))
152 {
153 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
154 }
155
156 include_once 'Services/Mail/classes/class.ilMail.php';
157 include_once 'webservice/soap/classes/class.ilSoapMailXmlParser.php';
158
159 $parser = new ilSoapMailXmlParser($a_mail_xml);
160 try
161 {
162 // Check if wellformed
163 libxml_use_internal_errors(true);
164 $ok = simplexml_load_string($a_mail_xml);
165 if(!$ok)
166 {
167 foreach(libxml_get_errors() as $err)
168 {
169 $error .= ($err->message.' ');
170 }
171 return $this->__raiseError($error, 'CLIENT');
172 }
173 $parser->start();
174 }
175 catch(InvalidArgumentException $e)
176 {
177 $GLOBALS['ilLog']->write(__METHOD__.' '.$e->getMessage());
178 return $this->__raiseError($e->getMessage(),'CLIENT');
179 }
180 catch(ilSaxParserException $e)
181 {
182 $GLOBALS['ilLog']->write(__METHOD__.' '.$e->getMessage());
183 return $this->__raiseError($e->getMessage(), 'CLIENT');
184 }
185
186 $mails = $parser->getMails();
187
188 global $ilUser;
189
190 foreach($mails as $mail)
191 {
192 // Prepare attachments
193 include_once './Services/Mail/classes/class.ilFileDataMail.php';
194 $file = new ilFileDataMail($ilUser->getId());
195 foreach((array) $mail['attachments'] as $attachment)
196 {
197 // TODO: Error handling
198 $file->storeAsAttachment($attachment['name'], $attachment['content']);
199 $attachments[] = ilUtil::_sanitizeFilemame($attachment['name']);
200 }
201
202 $mail_obj = new ilMail($ilUser->getId());
203 $mail_obj->setSaveInSentbox(true);
204 $mail_obj->saveAttachments((array) $attachments);
205 $mail_obj->sendMail(
206 implode(',',(array) $mail['to']),
207 implode(',',(array) $mail['cc']),
208 implode(',',(array) $mail['bcc']),
209 $mail['subject'],
210 implode("\n", (array)$mail['body']),
211 (array) $attachments,
212 array($mail['type']),
213 (bool) $mail['usePlaceholders']
214 );
215
216 // Finally unlink attachments
217 foreach((array) $attachments as $att)
218 {
219 $file->unlinkFile($att);
220 }
221 $mail_obj->savePostData(
222 $ilUser->getId(),
223 array(),
224 '',
225 '',
226 '',
227 '',
228 '',
229 '',
230 '',
231 ''
232 );
233 }
234 return true;
235 }
$parser
Definition: BPMN2Parser.php:24
$error
Definition: Error.php:17
This class handles all operations on files (attachments) in directory ilias_data/mail.
This class handles base functions for mail handling.
SaxParserException thrown by ilSaxParser if property throwException is set.
__raiseError($a_message, $a_code)
XML parser for soap mails.
static _sanitizeFilemame($a_filename)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
$ilUser
Definition: imgupload.php:18

References $error, $file, $GLOBALS, $ilUser, $ok, $parser, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilUtil\_sanitizeFilemame(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ getMobsOfObject()

ilSoapUtils::getMobsOfObject (   $sid,
  $a_type,
  $a_id 
)

Definition at line 251 of file class.ilSoapUtils.php.

252 {
253 $this->initAuth($sid);
254 $this->initIlias();
255
256 if(!$this->__checkSession($sid))
257 {
258 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
259 }
260
261 include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
263 }
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
$a_type
Definition: workflow.php:93

References $a_type, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObjMediaObject\_getMobsOfObject(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ handleECSTasks()

ilSoapUtils::handleECSTasks (   $sid,
  $a_server_id 
)

Definition at line 625 of file class.ilSoapUtils.php.

626 {
627 $this->initAuth($sid);
628 $this->initIlias();
629
630 if(!$this->__checkSession($sid))
631 {
632 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
633 }
634
635 include_once('./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php');
636
637 global $ilLog;
638
639 $ilLog->write(__METHOD__.': Starting task execution...');
640 $scheduler = ilECSTaskScheduler::_getInstanceByServerId($a_server_id);
641 $scheduler->startTaskExecution();
642
643 return true;
644 }
static _getInstanceByServerId($a_server_id)
get singleton instance Private access use ilECSTaskScheduler::start() or ilECSTaskScheduler::startTas...

References $ilLog, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilECSTaskScheduler\_getInstanceByServerId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ ignoreUserAbort()

ilSoapUtils::ignoreUserAbort ( )

Definition at line 38 of file class.ilSoapUtils.php.

39 {
40 return ignore_user_abort(true);
41 }

◆ ilClone()

ilSoapUtils::ilClone (   $sid,
  $copy_identifier 
)

Clone object.

@access public

Parameters
stringsoap session id
intcopy identifier (ilCopyWizarardOptions)

Definition at line 340 of file class.ilSoapUtils.php.

341 {
342 $this->initAuth($sid);
343 $this->initIlias();
344
345 if(!$this->__checkSession($sid))
346 {
347 ilLoggerFactory::getLogger('obj')->error('Object cloning failed. Invalid session given: '. $this->__getMessage());
348 }
349
350 global $ilLog,$ilUser;
351
352 include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
353 $cp_options = ilCopyWizardOptions::_getInstance($copy_identifier);
354
355 // Check owner of copy procedure
356 if(!$cp_options->checkOwner($ilUser->getId()))
357 {
358 ilLoggerFactory::getLogger('obj')->error('Permission check failed for user id: '.$ilUser->getId().', copy id: '.$copy_identifier);
359 return false;
360 }
361
362
363 // Fetch first node
364 if(($node = $cp_options->fetchFirstNode()) === false)
365 {
366 ilLoggerFactory::getLogger('obj')->info('Finished copy step 1. Starting copying of object dependencies...');
367 return $this->ilCloneDependencies($sid,$copy_identifier);
368 }
369
370 // Check options of this node
371 $options = $cp_options->getOptions($node['child']);
372
373 $new_ref_id = 0;
374 switch($options['type'])
375 {
377 ilLoggerFactory::getLogger('obj')->debug(': Omitting node: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
378 // set mapping to zero
379 $cp_options->appendMapping($node['child'],0);
380 $this->callNextNode($sid,$cp_options);
381 break;
382
384
385 ilLoggerFactory::getLogger('obj')->debug('Start cloning node: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
386 $new_ref_id = $this->cloneNode($node,$cp_options);
387 $this->callNextNode($sid,$cp_options);
388 break;
389
391 ilLoggerFactory::getLogger('obj')->debug('Start linking node: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
392 $new_ref_id = $this->linkNode($node,$cp_options);
393 $this->callNextNode($sid,$cp_options);
394 break;
395
396 default:
397 ilLoggerFactory::getLogger('obj')->warning('No valid action type given for: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
398 $this->callNextNode($sid,$cp_options);
399 break;
400
401 }
402 return $new_ref_id;
403 }
static _getInstance($a_copy_id)
Get instance of copy wizard options.
callNextNode($sid, $cp_options)
Call next node using soap.
linkNode($node, $cp_options)
Link node.
ilCloneDependencies($sid, $copy_identifier)
clone object dependencies (e.g.
cloneNode($node, $cp_options)
Clone node.

References $ilLog, $ilUser, $options, ilSoapAdministration\__getMessage(), ilCopyWizardOptions\_getInstance(), callNextNode(), cloneNode(), ilCopyWizardOptions\COPY_WIZARD_COPY, ilCopyWizardOptions\COPY_WIZARD_LINK, ilCopyWizardOptions\COPY_WIZARD_OMIT, ilLoggerFactory\getLogger(), ilCloneDependencies(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and linkNode().

+ Here is the call graph for this function:

◆ ilCloneDependencies()

ilSoapUtils::ilCloneDependencies (   $sid,
  $copy_identifier 
)

clone object dependencies (e.g.

course start objects, preconditions ...)

@access public

Parameters

Definition at line 272 of file class.ilSoapUtils.php.

273 {
274 $this->initAuth($sid);
275 $this->initIlias();
276
277 if(!$this->__checkSession($sid))
278 {
279 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
280 }
281
282 global $ilLog,$ilUser;
283
284 include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
285 $cp_options = ilCopyWizardOptions::_getInstance($copy_identifier);
286
287 // Check owner of copy procedure
288 if(!$cp_options->checkOwner($ilUser->getId()))
289 {
290 ilLoggerFactory::getLogger('obj')->error('Permission check failed for user id: '.$ilUser->getId().', copy id: '.$copy_identifier);
291 return false;
292 }
293
294 // Fetch first node
295 if(($node = $cp_options->fetchFirstDependenciesNode()) === false)
296 {
297 $cp_options->deleteAll();
298 ilLoggerFactory::getLogger('obj')->info('Finished copy step 2. Copy completed');
299 return true;
300 }
301
302 // Check options of this node
303 $options = $cp_options->getOptions($node['child']);
304 $new_ref_id = 0;
305 switch($options['type'])
306 {
308 ilLoggerFactory::getLogger('obj')->debug(': Omitting node: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
309 $this->callNextDependency($sid,$cp_options);
310 break;
311
313 ilLoggerFactory::getLogger('obj')->debug(': Start cloning dependencies for node: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
314 $this->cloneDependencies($node, $cp_options);
315 $this->callNextDependency($sid,$cp_options);
316 break;
317
319 ilLoggerFactory::getLogger('obj')->debug(': Start cloning dependencies: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
320 $this->cloneDependencies($node,$cp_options);
321 $this->callNextDependency($sid,$cp_options);
322 break;
323
324 default:
325 ilLoggerFactory::getLogger('obj')->warning('No valid action type given for node: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
326 $this->callNextDependency($sid,$cp_options);
327 break;
328 }
329 return true;
330 }
cloneDependencies($node, $cp_options)
cloneDependencies
callNextDependency($sid, $cp_options)

References $ilLog, $ilUser, $options, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilCopyWizardOptions\_getInstance(), callNextDependency(), cloneDependencies(), ilCopyWizardOptions\COPY_WIZARD_COPY, ilCopyWizardOptions\COPY_WIZARD_LINK, ilCopyWizardOptions\COPY_WIZARD_OMIT, ilLoggerFactory\getLogger(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

Referenced by ilClone().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ linkNode()

ilSoapUtils::linkNode (   $node,
  $cp_options 
)
private

Link node.

@access private

Parameters

Definition at line 553 of file class.ilSoapUtils.php.

554 {
555 global $ilLog,$ilAccess,$rbacreview;
556
557 $source_id = $node['child'];
558 $parent_id = $node['parent'];
559 $options = $cp_options->getOptions($node['child']);
560 $mappings = $cp_options->getMappings();
561
562 if(!$ilAccess->checkAccess('delete','',$node['child']))
563 {
564 ilLoggerFactory::getLogger('obj')->warning('No delete permission granted: '.$source_id.', '.$node['title'].', '.$node['type']);
565 return false;
566
567 }
568 if(!isset($mappings[$parent_id]))
569 {
570 ilLoggerFactory::getLogger('obj')->warning('Omitting node '.$source_id.', '.$node['title'].', '.$node['type']. '. No target found.');
571 return true;
572 }
573 $target_id = $mappings[$parent_id];
574
575 $orig = ilObjectFactory::getInstanceByRefId((int) $source_id);
576 $new_ref_id = $orig->createReference();
577 $orig->putInTree($target_id);
578 $orig->setPermissions($target_id);
579
580 if(!($new_ref_id))
581 {
582 ilLoggerFactory::getLogger('obj')->error('Error linking '.$source_id.', '.$node['title'].', '.$node['type'].'. No target found.');
583 return false;
584 }
585
586 // rbac log
587 include_once "Services/AccessControl/classes/class.ilRbacLog.php";
588 $rbac_log_roles = $rbacreview->getParentRoleIds($new_ref_id, false);
589 $rbac_log = ilRbacLog::gatherFaPa($new_ref_id, array_keys($rbac_log_roles), true);
590 ilRbacLog::add(ilRbacLog::LINK_OBJECT, $new_ref_id, $rbac_log, (int)$source_id);
591
592 // Finally add new mapping entry
593 $cp_options->appendMapping($source_id,$new_ref_id);
594 return $new_ref_id;
595 }
const LINK_OBJECT

References $ilLog, $options, $orig, $target_id, ilRbacLog\add(), ilRbacLog\gatherFaPa(), ilObjectFactory\getInstanceByRefId(), ilLoggerFactory\getLogger(), and ilRbacLog\LINK_OBJECT.

Referenced by ilClone().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveTempFileAsMediaObject()

ilSoapUtils::saveTempFileAsMediaObject (   $sid,
  $name,
  $tmp_name 
)

Definition at line 237 of file class.ilSoapUtils.php.

238 {
239 $this->initAuth($sid);
240 $this->initIlias();
241
242 if(!$this->__checkSession($sid))
243 {
244 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
245 }
246
247 include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
248 return ilObjMediaObject::_saveTempFileAsMediaObject($name, $tmp_name);
249 }
static _saveTempFileAsMediaObject($name, $tmp_name, $upload=TRUE)
Create new media object and update page in db and return new media object.

References ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObjMediaObject\_saveTempFileAsMediaObject(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ sendMail()

ilSoapUtils::sendMail (   $sid,
  $to,
  $cc,
  $bcc,
  $sender,
  $subject,
  $message,
  $attach 
)

Definition at line 48 of file class.ilSoapUtils.php.

49 {
50 global $DIC;
51
52 $this->initAuth($sid);
53 $this->initIlias();
54
55 if(!$this->__checkSession($sid))
56 {
57 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
58 }
59
60 include_once 'Services/Mail/classes/class.ilMimeMail.php';
61
62 if(strpos($sender, '#:#') !== false)
63 {
64 $sender = explode('#:#', $sender);
65 }
66
67 $mmail = new ilMimeMail();
68 $mmail->autoCheck(false);
69 $mmail->From($sender);
70 $mmail->To(explode(',',$to));
71 $mmail->Subject($subject);
72 $mmail->Body($message);
73
74 if($cc)
75 {
76 $mmail->Cc(explode(',',$cc));
77 }
78
79 if($bcc)
80 {
81 $mmail->Bcc(explode(',',$bcc));
82 }
83 if($attach)
84 {
85 require_once 'Services/Mail/classes/class.ilFileDataMail.php';
86 $authUserFileData = new \ilFileDataMail($DIC->user()->getId());
87 $senderFileData = new \ilFileDataMail(ANONYMOUS_USER_ID);
88
89 // mjansen: switched separator from "," to "#:#" because of mantis bug #6039
90 // for backward compatibility we have to check if the substring "#:#" exists as leading separator
91 // otherwise we should use ";"
92 if(strpos($attach, '#:#') === 0)
93 {
94 $attach = substr($attach, strlen('#:#'));
95 $attachments = explode('#:#', $attach);
96 }
97 else
98 {
99 $attachments = explode(',', $attach);
100 }
101
102 foreach($attachments as $attachment)
103 {
104 $final_filename = null;
105 $filename = basename($attachment);
106 if(strlen($filename) > 0)
107 {
108 // #17740
109 $final_filename = preg_replace('/^(\d+?_)(.*)/', '$2', $filename);
110 }
111 $allowedPathPrefixes = [
112 $authUserFileData->getAbsoluteAttachmentPoolPathPrefix(),
113 $senderFileData->getAbsoluteAttachmentPoolPathPrefix()
114 ];
115
116 $absoluteAttachmentPath = realpath($attachment);
117
118 $matchedPathPrefixes = array_filter($allowedPathPrefixes, function($path) use ($absoluteAttachmentPath) {
119 return strpos($absoluteAttachmentPath, $path) === 0;
120 });
121
122 if (count($matchedPathPrefixes) > 0) {
123 $mmail->Attach($attachment, '', 'inline', $final_filename);
124 $DIC->logger()->mail()->debug(sprintf("Accepted attachment: %s", $attachment));
125 } else {
126 $DIC->logger()->mail()->warning(sprintf(
127 "Ignored attachment when sending message via SOAP: Given path '%s' is not in allowed prefix list: %s",
128 $absoluteAttachmentPath,
129 implode(', ', $allowedPathPrefixes)
130 ));
131 }
132 }
133 }
134
135 $mmail->Send();
136
137 return true;
138 }
sprintf('%.4f', $callTime)
$path
Definition: aliased.php:25
this class encapsulates the PHP mail() function.
global $DIC

References $DIC, $filename, $path, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and sprintf.

+ Here is the call graph for this function:

◆ validateXML()

static ilSoapUtils::validateXML (   $xml)
static

validates an xml file, if dtd is attached

Parameters
$xmlcurrent xml stream
Returns
true, if correct, or String with error messages

Definition at line 603 of file class.ilSoapUtils.php.

603 {
604 // validate to prevent wrong XMLs
605 $dom = @domxml_open_mem($xml, DOMXML_LOAD_VALIDATING, $error);
606 if ($error)
607 {
608 $msg = array();
609 if (is_array($error))
610 {
611 foreach ($error as $err) {
612 $msg []= "(".$err["line"].",".$err["col"]."): ".$err["errormessage"];
613 }
614 }
615 else
616 {
617 $msg[] = $error;
618 }
619 $msg = join("\n",$msg);
620 return $msg;
621 }
622 return true;
623 }
domxml_open_mem($str, $mode=0, &$error=NULL)

References $error, and domxml_open_mem().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: