33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
44 return ignore_user_abort(
true);
49 $this->soap_check =
false;
52 function sendMail($sid,$to,$cc,$bcc,$sender,$subject,$message,$attach)
65 include_once
'Services/Mail/classes/class.ilMimeMail.php';
68 $mmail->autoCheck(
false);
69 $mmail->From($sender);
70 $mmail->To(explode(
',',$to));
71 $mmail->Subject($subject);
72 $mmail->Body($message);
76 $mmail->Cc(explode(
',',$cc));
81 $mmail->Bcc(explode(
',',$bcc));
88 if(strpos($attach,
'#:#') === 0)
90 $attach = substr($attach, strlen(
'#:#'));
91 $attachments = explode(
'#:#', $attach);
95 $attachments = explode(
',', $attach);
97 foreach ($attachments as $attachment)
99 $mmail->Attach($attachment);
104 $ilLog->write(
'SOAP: sendMail(): '.$to.
', '.$cc.
', '.$bcc);
125 include_once
'Services/Mail/classes/class.ilMail.php';
126 include_once
'webservice/soap/classes/class.ilSoapMailXmlParser.php';
132 libxml_use_internal_errors(
true);
133 $ok = simplexml_load_string($a_mail_xml);
136 foreach(libxml_get_errors() as $err)
138 $error .= ($err->message.
' ');
144 catch(InvalidArgumentException $e)
146 $GLOBALS[
'ilLog']->write(__METHOD__.
' '.$e->getMessage());
151 $GLOBALS[
'ilLog']->write(__METHOD__.
' '.$e->getMessage());
155 $mails = $parser->getMails();
159 foreach($mails as $mail)
162 include_once
'./Services/Mail/classes/class.ilFileDataMail.php';
164 foreach((array) $mail[
'attachments'] as $attachment)
167 $file->storeAsAttachment($attachment[
'name'], $attachment[
'content']);
171 $mail_obj =
new ilMail($ilUser->getId());
173 $mail_obj->saveAttachments((array) $attachments);
175 implode(
',',(array) $mail[
'to']),
176 implode(
',',(array) $mail[
'cc']),
177 implode(
',',(array) $mail[
'bcc']),
179 implode(
"\n",$mail[
'body']),
180 (array) $attachments,
181 array($mail[
'type']),
182 (
bool) $mail[
'usePlaceholders']
186 foreach((array) $attachments as $att)
188 $file->unlinkFile($att);
190 $mail_obj->savePostData(
216 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
230 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
253 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
257 if(!$cp_options->checkOwner($ilUser->getId()))
259 $ilLog->write(__METHOD__.
': Permission check failed for user id: '.$ilUser->getId().
', copy id: '.$copy_identifier);
264 if(($node = $cp_options->fetchFirstDependenciesNode()) ===
false)
266 $cp_options->deleteAll();
267 $ilLog->write(__METHOD__.
': Finished copy step 2. Copy completed');
273 $options = $cp_options->getOptions($node[
'child']);
275 switch($options[
'type'])
278 $ilLog->write(__METHOD__.
': Omitting node: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
283 $ilLog->write(__METHOD__.
': Nothing to do for node: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
288 $ilLog->write(__METHOD__.
': Start cloning dependencies: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
294 $ilLog->write(__METHOD__.
': No valid action type given for node: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
309 public function ilClone($sid,$copy_identifier)
321 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
325 if(!$cp_options->checkOwner($ilUser->getId()))
327 $ilLog->write(__METHOD__.
': Permission check failed for user id: '.$ilUser->getId().
', copy id: '.$copy_identifier);
333 if(($node = $cp_options->fetchFirstNode()) ===
false)
335 $ilLog->write(__METHOD__.
': Finished copy step 1. Starting copying of object dependencies...');
340 $options = $cp_options->getOptions($node[
'child']);
343 switch($options[
'type'])
346 $ilLog->write(__METHOD__.
': Omitting node: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
348 $cp_options->appendMapping($node[
'child'],0);
353 $ilLog->write(__METHOD__.
': Start cloning node: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
354 $new_ref_id = $this->
cloneNode($node,$cp_options);
359 $ilLog->write(__METHOD__.
': Start linking node: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
360 $new_ref_id = $this->
linkNode($node,$cp_options);
365 $ilLog->write(__METHOD__.
': No valid action type given for node: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
383 $cp_options->dropFirstNode();
385 if($cp_options->isSOAPEnabled())
388 include_once
'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
390 $soap_client->setResponseTimeout(1);
391 $soap_client->enableWSDL(
true);
392 $soap_client->init();
393 $soap_client->call(
'ilClone',array($sid,$cp_options->getCopyId()));
397 $ilLog->write(__METHOD__.
': Cannot call SOAP server');
399 include_once(
'./webservice/soap/include/inc.soap_functions.php');
409 $cp_options->dropFirstDependenciesNode();
411 if($cp_options->isSOAPEnabled())
414 include_once
'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
416 $soap_client->setResponseTimeout(1);
417 $soap_client->enableWSDL(
true);
418 $soap_client->init();
419 $soap_client->call(
'ilCloneDependencies',array($sid,$cp_options->getCopyId()));
423 $ilLog->write(__METHOD__.
': Cannot call SOAP server');
425 include_once(
'./webservice/soap/include/inc.soap_functions.php');
440 global
$ilLog,$tree,$ilAccess,$rbacreview;
444 $source_id = $node[
'child'];
445 $parent_id = $node[
'parent'];
446 $options = $cp_options->getOptions($node[
'child']);
447 $mappings = $cp_options->getMappings();
449 if(!$ilAccess->checkAccess(
'copy',
'',$node[
'child']))
451 $ilLog->write(__METHOD__.
': No copy permission granted: '.$source_id.
', '.$node[
'title'].
', '.$node[
'type']);
455 if(!isset($mappings[$parent_id]))
457 $ilLog->write(__METHOD__.
': Omitting node '.$source_id.
', '.$node[
'title'].
', '.$node[
'type'].
'. No target found.');
464 $ilLog->write(__METHOD__.
': Omitting node '.$source_id.
', '.$node[
'title'].
', '.$node[
'type'].
'. Object has been deleted.');
469 $new_obj = $orig->cloneObject((
int)
$target_id,$cp_options->getCopyId());
471 if(!is_object($new_obj))
473 $ilLog->write(__METHOD__.
': Error copying '.$source_id.
', '.$node[
'title'].
', '.$node[
'type'].
'. No target found.');
478 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
479 $rbac_log_roles = $rbacreview->getParentRoleIds($new_obj->getRefId(),
false);
484 $cp_options->appendMapping($source_id,$new_obj->getRefId());
485 return $new_obj->getRefId();
499 $source_id = $node[
'child'];
500 $mappings = $cp_options->getMappings();
502 if(!isset($mappings[$source_id]))
504 $ilLog->write(__METHOD__.
': Omitting node '.$source_id.
', '.$node[
'title'].
', '.$node[
'type'].
'. No mapping found.');
510 $orig->cloneDependencies(
$target_id,$cp_options->getCopyId());
523 global
$ilLog,$ilAccess,$rbacreview;
525 $source_id = $node[
'child'];
526 $parent_id = $node[
'parent'];
527 $options = $cp_options->getOptions($node[
'child']);
528 $mappings = $cp_options->getMappings();
530 if(!$ilAccess->checkAccess(
'delete',
'',$node[
'child']))
532 $ilLog->write(__METHOD__.
': No delete permission granted: '.$source_id.
', '.$node[
'title'].
', '.$node[
'type']);
536 if(!isset($mappings[$parent_id]))
538 $ilLog->write(__METHOD__.
': Omitting node '.$source_id.
', '.$node[
'title'].
', '.$node[
'type'].
'. No target found.');
544 $new_ref_id = $orig->createReference();
550 $ilLog->write(__METHOD__.
': Error linking '.$source_id.
', '.$node[
'title'].
', '.$node[
'type'].
'. No target found.');
555 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
556 $rbac_log_roles = $rbacreview->getParentRoleIds($new_ref_id,
false);
561 $cp_options->appendMapping($source_id,$new_ref_id);
577 if (is_array($error))
579 foreach ($error as $err) {
580 $msg []=
"(".$err[
"line"].
",".$err[
"col"].
"): ".$err[
"errormessage"];
587 $msg = join(
"\n",$msg);
603 include_once(
'./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php');
607 $ilLog->write(__METHOD__.
': Starting task execution...');
609 $scheduler->startTaskExecution();
635 $ilLog->write(__METHOD__.
': Started deletion of inactive user objects with expired confirmation hash values (dual opt in) ...');
637 require_once
'Services/Registration/classes/class.ilRegistrationSettings.php';
649 $query .=
'SELECT usr_id, create_date, reg_hash FROM usr_data '
650 .
'WHERE active = 0 '
651 .
'AND reg_hash IS NOT NULL '
652 .
'AND usr_id = '.$ilDB->quote(
$usr_id,
'integer').
' ';
656 $query .=
'SELECT usr_id, create_date, reg_hash FROM usr_data '
657 .
'WHERE active = 0 '
658 .
'AND reg_hash IS NOT NULL '
659 .
'AND usr_id != '.$ilDB->quote(
$usr_id,
'integer').
' ';
663 $ilLog->write(__METHOD__.
': '.$ilDB->numRows(
$res).
' inactive user objects with confirmation hash values (dual opt in) found ...');
671 $num_deleted_users = 0;
672 while(
$row = $ilDB->fetchAssoc(
$res))
674 if(
$row[
'usr_id'] == ANONYMOUS_USER_ID ||
$row[
'usr_id'] == SYSTEM_USER_ID)
continue;
675 if(!strlen(
$row[
'reg_hash']))
continue;
677 if((
int)$oRegSettigs->getRegistrationHashLifetime() > 0 &&
678 $row[
'create_date'] !=
'' &&
679 time() - $oRegSettigs->getRegistrationHashLifetime() > strtotime(
$row[
'create_date']))
684 $ilLog->write(__METHOD__.
': User '.$user->getLogin().
' (obj_id: '.$user->getId().
') will be deleted due to an expired registration hash ...');
686 ++$num_deleted_users;
691 $ilLog->write(__METHOD__.
': '.$num_deleted_users.
' inactive user objects with expired confirmation hash values (dual opt in) deleted ...');
693 $ilLog->write(__METHOD__.
': Finished deletion of inactive user objects with expired confirmation hash values (dual opt in) ...');