ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilSoapUtils Class Reference
+ Inheritance diagram for ilSoapUtils:
+ Collaboration diagram for ilSoapUtils:

Public Member Functions

 ilSoapUtils ()
 
 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
 ilSoapAdministration ($use_nusoap=true)
 
 initErrorWriter ()
 Overwrite error handler. More...
 
 __explodeSid ($sid)
 
 __setMessage ($a_str)
 
 __getMessage ()
 
 __appendMessage ($a_str)
 
 __setMessageCode ($a_code)
 
 __getMessageCode ()
 
 initAuth ($sid)
 
 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 414 of file class.ilSoapUtils.php.

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

Referenced by ilCloneDependencies().

415  {
416  global $ilLog;
417 
418  $cp_options->dropFirstDependenciesNode();
419 
420  if($cp_options->isSOAPEnabled())
421  {
422  // Start next soap call
423  include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
424  $soap_client = new ilSoapClient();
425  $soap_client->setResponseTimeout(1);
426  $soap_client->enableWSDL(true);
427  $soap_client->init();
428  $soap_client->call('ilCloneDependencies',array($sid,$cp_options->getCopyId()));
429  }
430  else
431  {
432  ilLoggerFactory::getLogger('obj')->warning('SOAP clone call failed. Calling clone method manually');
433  $cp_options->read();
434  include_once('./webservice/soap/include/inc.soap_functions.php');
435  $res = ilSoapFunctions::ilCloneDependencies($sid,$cp_options->getCopyId());
436  }
437  return true;
438  }
static ilCloneDependencies($sid, $copy_identifier)
static getLogger($a_component_id)
Get component logger.
+ 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 private

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

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

Referenced by ilClone().

389  {
390  global $ilLog;
391 
392  $cp_options->dropFirstNode();
393 
394  if($cp_options->isSOAPEnabled())
395  {
396  // Start next soap call
397  include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
398  $soap_client = new ilSoapClient();
399  $soap_client->setResponseTimeout(1);
400  $soap_client->enableWSDL(true);
401  $soap_client->init();
402  $soap_client->call('ilClone',array($sid,$cp_options->getCopyId()));
403  }
404  else
405  {
406  ilLoggerFactory::getLogger('obj')->warning('SOAP clone call failed. Calling clone method manually');
407  $cp_options->read();
408  include_once('./webservice/soap/include/inc.soap_functions.php');
409  $res = ilSoapFunctions::ilClone($sid,$cp_options->getCopyId());
410  }
411  return true;
412  }
static ilClone($sid, $copy_identifier)
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cloneDependencies()

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

cloneDependencies

private

Parameters

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

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

Referenced by ilCloneDependencies().

505  {
506  global $ilLog;
507 
508  $source_id = $node['child'];
509  $mappings = $cp_options->getMappings();
510 
511  if(!isset($mappings[$source_id]))
512  {
513  ilLoggerFactory::getLogger('obj')->debug('Omitting node '.$source_id.', '.$node['title'].', '.$node['type']. '. No mapping found.');
514  return true;
515  }
516  $target_id = $mappings[$source_id];
517 
518  $orig = ilObjectFactory::getInstanceByRefId((int) $source_id);
519  $orig->cloneDependencies($target_id,$cp_options->getCopyId());
520  return true;
521  }
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
$target_id
Definition: goto.php:88
static getLogger($a_component_id)
Get component logger.
+ 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.

private

Parameters

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

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

Referenced by ilClone().

448  {
449  global $ilLog,$tree,$ilAccess,$rbacreview;
450 
451  #sleep(20);
452 
453  $source_id = $node['child'];
454  $parent_id = $node['parent'];
455  $options = $cp_options->getOptions($node['child']);
456  $mappings = $cp_options->getMappings();
457 
458  if(!$ilAccess->checkAccess('copy','',$node['child']))
459  {
460  ilLoggerFactory::getLogger('obj')->error('No copy permission granted: '.$source_id.', '.$node['title'].', '.$node['type']);
461  return false;
462 
463  }
464  if(!isset($mappings[$parent_id]))
465  {
466  ilLoggerFactory::getLogger('obj')->info('Omitting node '.$source_id.', '.$node['title'].', '.$node['type']. '. No target found.');
467  return true;
468  }
469  $target_id = $mappings[$parent_id];
470 
471  if(!$tree->isInTree($target_id))
472  {
473  ilLoggerFactory::getLogger('obj')->notice('Omitting node '.$source_id.', '.$node['title'].', '.$node['type']. '. Object has been deleted.');
474  return false;
475  }
476 
477  $orig = ilObjectFactory::getInstanceByRefId((int) $source_id);
478  $new_obj = $orig->cloneObject((int) $target_id,$cp_options->getCopyId());
479 
480  if(!is_object($new_obj))
481  {
482  ilLoggerFactory::getLogger('obj')->error('Error copying '.$source_id.', '.$node['title'].', '.$node['type'].'. No target found.');
483  return false;
484  }
485 
486  // rbac log
487  include_once "Services/AccessControl/classes/class.ilRbacLog.php";
488  $rbac_log_roles = $rbacreview->getParentRoleIds($new_obj->getRefId(), false);
489  $rbac_log = ilRbacLog::gatherFaPa($new_obj->getRefId(), array_keys($rbac_log_roles), true);
490  ilRbacLog::add(ilRbacLog::COPY_OBJECT, $new_obj->getRefId(), $rbac_log, (int)$source_id);
491 
492  // Finally add new mapping entry
493  $cp_options->appendMapping($source_id,$new_obj->getRefId());
494  return $new_obj->getRefId();
495  }
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
$target_id
Definition: goto.php:88
static gatherFaPa($a_ref_id, array $a_role_ids, $a_add_action=false)
if(!is_array($argv)) $options
const COPY_OBJECT
static add($a_action, $a_ref_id, array $a_diff, $a_source_ref_id=false)
static getLogger($a_component_id)
Get component logger.
+ 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 public

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

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

636  {
637  $this->initAuth($sid);
638  $this->initIlias();
639 
640  // Session check not possible -> anonymous user is the trigger
641 
642  global $ilDB, $ilLog;
643 
644  $ilLog->write(__METHOD__.': Started deletion of inactive user objects with expired confirmation hash values (dual opt in) ...');
645 
646  require_once 'Services/Registration/classes/class.ilRegistrationSettings.php';
647  $oRegSettigs = new ilRegistrationSettings();
648 
649  $query = '';
650 
651  /*
652  * Fetch the current actuator user object first, because this user will try to perform very probably
653  * a new registration with the same login name in a few seconds ;-)
654  *
655  */
656  if((int)$usr_id > 0)
657  {
658  $query .= 'SELECT usr_id, create_date, reg_hash FROM usr_data '
659  . 'WHERE active = 0 '
660  . 'AND reg_hash IS NOT NULL '
661  . 'AND usr_id = '.$ilDB->quote($usr_id, 'integer').' ';
662  $query .= 'UNION ';
663  }
664 
665  $query .= 'SELECT usr_id, create_date, reg_hash FROM usr_data '
666  . 'WHERE active = 0 '
667  . 'AND reg_hash IS NOT NULL '
668  . 'AND usr_id != '.$ilDB->quote($usr_id, 'integer').' ';
669 
670  $res = $ilDB->query($query);
671 
672  $ilLog->write(__METHOD__.': '.$ilDB->numRows($res).' inactive user objects with confirmation hash values (dual opt in) found ...');
673 
674  /*
675  * mjansen: 15.12.2010:
676  * I perform the expiration check in php because of multi database support (mysql, postgresql).
677  * I did not find an oracle equivalent for mysql: UNIX_TIMESTAMP()
678  */
679 
680  $num_deleted_users = 0;
681  while($row = $ilDB->fetchAssoc($res))
682  {
683  if($row['usr_id'] == ANONYMOUS_USER_ID || $row['usr_id'] == SYSTEM_USER_ID) continue;
684  if(!strlen($row['reg_hash'])) continue;
685 
686  if((int)$oRegSettigs->getRegistrationHashLifetime() > 0 &&
687  $row['create_date'] != '' &&
688  time() - $oRegSettigs->getRegistrationHashLifetime() > strtotime($row['create_date']))
689  {
690  $user = ilObjectFactory::getInstanceByObjId($row['usr_id'], false);
691  if($user instanceof ilObjUser)
692  {
693  $ilLog->write(__METHOD__.': User '.$user->getLogin().' (obj_id: '.$user->getId().') will be deleted due to an expired registration hash ...');
694  $user->delete();
695  ++$num_deleted_users;
696  }
697  }
698  }
699 
700  $ilLog->write(__METHOD__.': '.$num_deleted_users.' inactive user objects with expired confirmation hash values (dual opt in) deleted ...');
701 
702  $ilLog->write(__METHOD__.': Finished deletion of inactive user objects with expired confirmation hash values (dual opt in) ...');
703 
704  return true;
705  }
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilObjAuthSettingsGUI.
global $ilDB
+ Here is the call graph for this function:

◆ disableSOAPCheck()

ilSoapUtils::disableSOAPCheck ( )

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

48  {
49  $this->soap_check = false;
50  }

◆ distributeMails()

ilSoapUtils::distributeMails (   $sid,
  $a_mail_xml 
)

mail via soap

Parameters
object$sid
object$a_mail_xml
Returns

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

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

125  {
126  $this->initAuth($sid);
127  $this->initIlias();
128 
129  if(!$this->__checkSession($sid))
130  {
131  return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
132  }
133 
134  include_once 'Services/Mail/classes/class.ilMail.php';
135  include_once 'webservice/soap/classes/class.ilSoapMailXmlParser.php';
136 
137  $parser = new ilSoapMailXmlParser($a_mail_xml);
138  try
139  {
140  // Check if wellformed
141  libxml_use_internal_errors(true);
142  $ok = simplexml_load_string($a_mail_xml);
143  if(!$ok)
144  {
145  foreach(libxml_get_errors() as $err)
146  {
147  $error .= ($err->message.' ');
148  }
149  return $this->__raiseError($error, 'CLIENT');
150  }
151  $parser->start();
152  }
153  catch(InvalidArgumentException $e)
154  {
155  $GLOBALS['ilLog']->write(__METHOD__.' '.$e->getMessage());
156  return $this->__raiseError($e->getMessage(),'CLIENT');
157  }
158  catch(ilSaxParserException $e)
159  {
160  $GLOBALS['ilLog']->write(__METHOD__.' '.$e->getMessage());
161  return $this->__raiseError($e->getMessage(), 'CLIENT');
162  }
163 
164  $mails = $parser->getMails();
165 
166  global $ilUser;
167 
168  foreach($mails as $mail)
169  {
170  // Prepare attachments
171  include_once './Services/Mail/classes/class.ilFileDataMail.php';
172  $file = new ilFileDataMail($ilUser->getId());
173  foreach((array) $mail['attachments'] as $attachment)
174  {
175  // TODO: Error handling
176  $file->storeAsAttachment($attachment['name'], $attachment['content']);
177  $attachments[] = ilUtil::_sanitizeFilemame($attachment['name']);
178  }
179 
180  $mail_obj = new ilMail($ilUser->getId());
181  $mail_obj->setSaveInSentbox(true);
182  $mail_obj->saveAttachments((array) $attachments);
183  $mail_obj->sendMail(
184  implode(',',(array) $mail['to']),
185  implode(',',(array) $mail['cc']),
186  implode(',',(array) $mail['bcc']),
187  $mail['subject'],
188  implode("\n", (array)$mail['body']),
189  (array) $attachments,
190  array($mail['type']),
191  (bool) $mail['usePlaceholders']
192  );
193 
194  // Finally unlink attachments
195  foreach((array) $attachments as $att)
196  {
197  $file->unlinkFile($att);
198  }
199  $mail_obj->savePostData(
200  $ilUser->getId(),
201  array(),
202  '',
203  '',
204  '',
205  '',
206  '',
207  '',
208  '',
209  ''
210  );
211  }
212  return true;
213  }
print $file
This class handles all operations on files (attachments) in directory ilias_data/mail.
setSaveInSentbox($a_save_in_sentbox)
SaxParserException thrown by ilSaxParser if property throwException is set.
static _sanitizeFilemame($a_filename)
XML parser for soap mails.
Class Mail this class handles base functions for mail handling.
__raiseError($a_message, $a_code)
global $ilUser
Definition: imgupload.php:15
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
+ Here is the call graph for this function:

◆ getMobsOfObject()

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

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

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

230  {
231  $this->initAuth($sid);
232  $this->initIlias();
233 
234  if(!$this->__checkSession($sid))
235  {
236  return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
237  }
238 
239  include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
240  return ilObjMediaObject::_getMobsOfObject($a_type, $a_id);
241  }
__raiseError($a_message, $a_code)
_getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
+ Here is the call graph for this function:

◆ handleECSTasks()

ilSoapUtils::handleECSTasks (   $sid,
  $a_server_id 
)

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

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

603  {
604  $this->initAuth($sid);
605  $this->initIlias();
606 
607  if(!$this->__checkSession($sid))
608  {
609  return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
610  }
611 
612  include_once('./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php');
613 
614  global $ilLog;
615 
616  $ilLog->write(__METHOD__.': Starting task execution...');
617  $scheduler = ilECSTaskScheduler::_getInstanceByServerId($a_server_id);
618  $scheduler->startTaskExecution();
619 
620  return true;
621  }
__raiseError($a_message, $a_code)
static _getInstanceByServerId($a_server_id)
get singleton instance Private access use ilECSTaskScheduler::start() or ilECSTaskScheduler::startTas...
+ Here is the call graph for this function:

◆ ignoreUserAbort()

ilSoapUtils::ignoreUserAbort ( )

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

43  {
44  return ignore_user_abort(true);
45  }

◆ ilClone()

ilSoapUtils::ilClone (   $sid,
  $copy_identifier 
)

Clone object.

public

Parameters
stringsoap session id
intcopy identifier (ilCopyWizarardOptions)

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

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().

318  {
319  $this->initAuth($sid);
320  $this->initIlias();
321 
322  if(!$this->__checkSession($sid))
323  {
324  ilLoggerFactory::getLogger('obj')->error('Object cloning failed. Invalid session given: '. $this->__getMessage());
325  }
326 
327  global $ilLog,$ilUser;
328 
329  include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
330  $cp_options = ilCopyWizardOptions::_getInstance($copy_identifier);
331 
332  // Check owner of copy procedure
333  if(!$cp_options->checkOwner($ilUser->getId()))
334  {
335  ilLoggerFactory::getLogger('obj')->error('Permission check failed for user id: '.$ilUser->getId().', copy id: '.$copy_identifier);
336  return false;
337  }
338 
339 
340  // Fetch first node
341  if(($node = $cp_options->fetchFirstNode()) === false)
342  {
343  ilLoggerFactory::getLogger('obj')->info('Finished copy step 1. Starting copying of object dependencies...');
344  return $this->ilCloneDependencies($sid,$copy_identifier);
345  }
346 
347  // Check options of this node
348  $options = $cp_options->getOptions($node['child']);
349 
350  $new_ref_id = 0;
351  switch($options['type'])
352  {
354  ilLoggerFactory::getLogger('obj')->debug(': Omitting node: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
355  // set mapping to zero
356  $cp_options->appendMapping($node['child'],0);
357  $this->callNextNode($sid,$cp_options);
358  break;
359 
361 
362  ilLoggerFactory::getLogger('obj')->debug('Start cloning node: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
363  $new_ref_id = $this->cloneNode($node,$cp_options);
364  $this->callNextNode($sid,$cp_options);
365  break;
366 
368  ilLoggerFactory::getLogger('obj')->debug('Start linking node: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
369  $new_ref_id = $this->linkNode($node,$cp_options);
370  $this->callNextNode($sid,$cp_options);
371  break;
372 
373  default:
374  ilLoggerFactory::getLogger('obj')->warning('No valid action type given for: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
375  $this->callNextNode($sid,$cp_options);
376  break;
377 
378  }
379  return $new_ref_id;
380  }
callNextNode($sid, $cp_options)
Call next node using soap.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
if(!is_array($argv)) $options
ilCloneDependencies($sid, $copy_identifier)
clone object dependencies (e.g.
global $ilUser
Definition: imgupload.php:15
static getLogger($a_component_id)
Get component logger.
linkNode($node, $cp_options)
Link node.
cloneNode($node, $cp_options)
Clone node.
+ Here is the call graph for this function:

◆ ilCloneDependencies()

ilSoapUtils::ilCloneDependencies (   $sid,
  $copy_identifier 
)

clone object dependencies (e.g.

course start objects, preconditions ...)

public

Parameters

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

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().

251  {
252  $this->initAuth($sid);
253  $this->initIlias();
254 
255  if(!$this->__checkSession($sid))
256  {
257  return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
258  }
259 
260  global $ilLog,$ilUser;
261 
262  include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
263  $cp_options = ilCopyWizardOptions::_getInstance($copy_identifier);
264 
265  // Check owner of copy procedure
266  if(!$cp_options->checkOwner($ilUser->getId()))
267  {
268  ilLoggerFactory::getLogger('obj')->error('Permission check failed for user id: '.$ilUser->getId().', copy id: '.$copy_identifier);
269  return false;
270  }
271 
272  // Fetch first node
273  if(($node = $cp_options->fetchFirstDependenciesNode()) === false)
274  {
275  $cp_options->deleteAll();
276  ilLoggerFactory::getLogger('obj')->info('Finished copy step 2. Copy completed');
277  return true;
278  }
279 
280  // Check options of this node
281  $options = $cp_options->getOptions($node['child']);
282  $new_ref_id = 0;
283  switch($options['type'])
284  {
286  ilLoggerFactory::getLogger('obj')->debug(': Omitting node: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
287  $this->callNextDependency($sid,$cp_options);
288  break;
289 
291  ilLoggerFactory::getLogger('obj')->debug(': Nothing to do for node: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
292  $this->callNextDependency($sid,$cp_options);
293  break;
294 
296  ilLoggerFactory::getLogger('obj')->debug(': Start cloning dependencies: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
297  $this->cloneDependencies($node,$cp_options);
298  $this->callNextDependency($sid,$cp_options);
299  break;
300 
301  default:
302  ilLoggerFactory::getLogger('obj')->warning('No valid action type given for node: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
303  $this->callNextDependency($sid,$cp_options);
304  break;
305  }
306  return true;
307  }
static _getInstance($a_copy_id)
Get instance of copy wizard options.
if(!is_array($argv)) $options
__raiseError($a_message, $a_code)
callNextDependency($sid, $cp_options)
global $ilUser
Definition: imgupload.php:15
static getLogger($a_component_id)
Get component logger.
cloneDependencies($node, $cp_options)
cloneDependencies
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ilSoapUtils()

ilSoapUtils::ilSoapUtils ( )

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

38  {
39  parent::ilSoapAdministration();
40  }

◆ linkNode()

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

Link node.

private

Parameters

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

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

Referenced by ilClone().

531  {
532  global $ilLog,$ilAccess,$rbacreview;
533 
534  $source_id = $node['child'];
535  $parent_id = $node['parent'];
536  $options = $cp_options->getOptions($node['child']);
537  $mappings = $cp_options->getMappings();
538 
539  if(!$ilAccess->checkAccess('delete','',$node['child']))
540  {
541  ilLoggerFactory::getLogger('obj')->warning('No delete permission granted: '.$source_id.', '.$node['title'].', '.$node['type']);
542  return false;
543 
544  }
545  if(!isset($mappings[$parent_id]))
546  {
547  ilLoggerFactory::getLogger('obj')->warning('Omitting node '.$source_id.', '.$node['title'].', '.$node['type']. '. No target found.');
548  return true;
549  }
550  $target_id = $mappings[$parent_id];
551 
552  $orig = ilObjectFactory::getInstanceByRefId((int) $source_id);
553  $new_ref_id = $orig->createReference();
554  $orig->putInTree($target_id);
555  $orig->setPermissions($target_id);
556 
557  if(!($new_ref_id))
558  {
559  ilLoggerFactory::getLogger('obj')->error('Error linking '.$source_id.', '.$node['title'].', '.$node['type'].'. No target found.');
560  return false;
561  }
562 
563  // rbac log
564  include_once "Services/AccessControl/classes/class.ilRbacLog.php";
565  $rbac_log_roles = $rbacreview->getParentRoleIds($new_ref_id, false);
566  $rbac_log = ilRbacLog::gatherFaPa($new_ref_id, array_keys($rbac_log_roles), true);
567  ilRbacLog::add(ilRbacLog::LINK_OBJECT, $new_ref_id, $rbac_log, (int)$source_id);
568 
569  // Finally add new mapping entry
570  $cp_options->appendMapping($source_id,$new_ref_id);
571  return $new_ref_id;
572  }
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
$target_id
Definition: goto.php:88
static gatherFaPa($a_ref_id, array $a_role_ids, $a_add_action=false)
if(!is_array($argv)) $options
const LINK_OBJECT
static add($a_action, $a_ref_id, array $a_diff, $a_source_ref_id=false)
static getLogger($a_component_id)
Get component logger.
+ 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 215 of file class.ilSoapUtils.php.

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

216  {
217  $this->initAuth($sid);
218  $this->initIlias();
219 
220  if(!$this->__checkSession($sid))
221  {
222  return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
223  }
224 
225  include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
226  return ilObjMediaObject::_saveTempFileAsMediaObject($name, $tmp_name);
227  }
static _saveTempFileAsMediaObject($name, $tmp_name, $upload=TRUE)
Create new media object and update page in db and return new media object.
__raiseError($a_message, $a_code)
+ Here is the call graph for this function:

◆ sendMail()

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

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

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

53  {
54  $this->initAuth($sid);
55  $this->initIlias();
56 
57  if(!$this->__checkSession($sid))
58  {
59  return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
60  }
61 
62  include_once 'Services/Mail/classes/class.ilMimeMail.php';
63 
64  if(strpos($sender, '#:#') !== false)
65  {
66  $sender = explode('#:#', $sender);
67  }
68 
69  $mmail = new ilMimeMail();
70  $mmail->autoCheck(false);
71  $mmail->From($sender);
72  $mmail->To(explode(',',$to));
73  $mmail->Subject($subject);
74  $mmail->Body($message);
75 
76  if($cc)
77  {
78  $mmail->Cc(explode(',',$cc));
79  }
80 
81  if($bcc)
82  {
83  $mmail->Bcc(explode(',',$bcc));
84  }
85  if($attach)
86  {
87  // mjansen: switched separator from "," to "#:#" because of mantis bug #6039
88  // for backward compatibility we have to check if the substring "#:#" exists as leading separator
89  // otherwise we should use ";"
90  if(strpos($attach, '#:#') === 0)
91  {
92  $attach = substr($attach, strlen('#:#'));
93  $attachments = explode('#:#', $attach);
94  }
95  else
96  {
97  $attachments = explode(',', $attach);
98  }
99 
100  foreach($attachments as $attachment)
101  {
102  $final_filename = null;
103  $filename = basename($attachment);
104  if(strlen($filename) > 0)
105  {
106  // #17740
107  $final_filename = preg_replace('/^(\d+?_)(.*)/', '$2', $filename);
108  }
109  $mmail->Attach($attachment, '', 'inline', $final_filename);
110  }
111  }
112 
113  $mmail->Send();
114 
115  return true;
116  }
this class encapsulates the PHP mail() function.
__raiseError($a_message, $a_code)
$filename
Definition: buildRTE.php:89
+ 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 580 of file class.ilSoapUtils.php.

References DOMXML_LOAD_VALIDATING, and domxml_open_mem().

580  {
581  // validate to prevent wrong XMLs
582  $dom = @domxml_open_mem($xml, DOMXML_LOAD_VALIDATING, $error);
583  if ($error)
584  {
585  $msg = array();
586  if (is_array($error))
587  {
588  foreach ($error as $err) {
589  $msg []= "(".$err["line"].",".$err["col"]."): ".$err["errormessage"];
590  }
591  }
592  else
593  {
594  $msg[] = $error;
595  }
596  $msg = join("\n",$msg);
597  return $msg;
598  }
599  return true;
600  }
domxml_open_mem($str, $mode=DOMXML_LOAD_PARSING, &$error=NULL)
const DOMXML_LOAD_VALIDATING
+ Here is the call graph for this function:

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