33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
40 return ignore_user_abort(
true);
45 $this->soap_check =
false;
48 function sendMail($sid,$to,$cc,$bcc,$sender,$subject,$message,$attach)
55 if(!$this->__checkSession($sid))
60 include_once
'Services/Mail/classes/class.ilMimeMail.php';
62 if(strpos($sender,
'#:#') !==
false)
64 $sender = explode(
'#:#', $sender);
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));
85 require_once
'Services/Mail/classes/class.ilFileDataMail.php';
86 $authUserFileData = new \ilFileDataMail($DIC->user()->getId());
87 $senderFileData = new \ilFileDataMail(ANONYMOUS_USER_ID);
92 if(strpos($attach,
'#:#') === 0)
94 $attach = substr($attach, strlen(
'#:#'));
95 $attachments = explode(
'#:#', $attach);
99 $attachments = explode(
',', $attach);
102 foreach($attachments as $attachment)
104 $final_filename = null;
109 $final_filename = preg_replace(
'/^(\d+?_)(.*)/',
'$2',
$filename);
111 $allowedPathPrefixes = [
112 $authUserFileData->getAbsoluteAttachmentPoolPathPrefix(),
113 $senderFileData->getAbsoluteAttachmentPoolPathPrefix()
116 $absoluteAttachmentPath = realpath($attachment);
118 $matchedPathPrefixes = array_filter($allowedPathPrefixes,
function(
$path) use ($absoluteAttachmentPath) {
119 return strpos($absoluteAttachmentPath,
$path) === 0;
122 if (count($matchedPathPrefixes) > 0) {
123 $mmail->Attach($attachment,
'',
'inline', $final_filename);
124 $DIC->logger()->mail()->debug(sprintf(
"Accepted attachment: %s", $attachment));
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)
151 if(!$this->__checkSession($sid))
156 include_once
'Services/Mail/classes/class.ilMail.php';
157 include_once
'webservice/soap/classes/class.ilSoapMailXmlParser.php';
163 libxml_use_internal_errors(
true);
164 $ok = simplexml_load_string($a_mail_xml);
167 foreach(libxml_get_errors() as $err)
169 $error .= ($err->message.
' ');
177 $GLOBALS[
'ilLog']->write(__METHOD__.
' '.$e->getMessage());
182 $GLOBALS[
'ilLog']->write(__METHOD__.
' '.$e->getMessage());
190 foreach($mails as $mail)
193 include_once
'./Services/Mail/classes/class.ilFileDataMail.php';
195 foreach((
array) $mail[
'attachments'] as $attachment)
198 $file->storeAsAttachment($attachment[
'name'], $attachment[
'content']);
202 $mail_obj =
new ilMail($ilUser->getId());
204 $mail_obj->saveAttachments((
array) $attachments);
206 implode(
',',(
array) $mail[
'to']),
207 implode(
',',(
array) $mail[
'cc']),
208 implode(
',',(
array) $mail[
'bcc']),
210 implode(
"\n", (
array)$mail[
'body']),
211 (
array) $attachments,
212 array($mail[
'type']),
213 (
bool) $mail[
'usePlaceholders']
217 foreach((
array) $attachments as $att)
219 $file->unlinkFile($att);
221 $mail_obj->savePostData(
242 if(!$this->__checkSession($sid))
247 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
256 if(!$this->__checkSession($sid))
261 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
277 if(!$this->__checkSession($sid))
284 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
288 if(!$cp_options->checkOwner($ilUser->getId()))
290 ilLoggerFactory::getLogger(
'obj')->error(
'Permission check failed for user id: '.$ilUser->getId().
', copy id: '.$copy_identifier);
295 if(($node = $cp_options->fetchFirstDependenciesNode()) ===
false)
297 $cp_options->deleteAll();
303 $options = $cp_options->getOptions($node[
'child']);
313 ilLoggerFactory::getLogger(
'obj')->debug(
': Start cloning dependencies for node: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
319 ilLoggerFactory::getLogger(
'obj')->debug(
': Start cloning dependencies: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
325 ilLoggerFactory::getLogger(
'obj')->warning(
'No valid action type given for node: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
340 public function ilClone($sid,$copy_identifier)
345 if(!$this->__checkSession($sid))
352 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
356 if(!$cp_options->checkOwner($ilUser->getId()))
358 ilLoggerFactory::getLogger(
'obj')->error(
'Permission check failed for user id: '.$ilUser->getId().
', copy id: '.$copy_identifier);
364 if(($node = $cp_options->fetchFirstNode()) ===
false)
371 $options = $cp_options->getOptions($node[
'child']);
379 $cp_options->appendMapping($node[
'child'],0);
386 $new_ref_id = $this->
cloneNode($node,$cp_options);
392 $new_ref_id = $this->
linkNode($node,$cp_options);
397 ilLoggerFactory::getLogger(
'obj')->warning(
'No valid action type given for: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
415 $cp_options->dropFirstNode();
417 if($cp_options->isSOAPEnabled())
420 include_once
'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
422 $soap_client->setResponseTimeout(1);
423 $soap_client->enableWSDL(
true);
424 $soap_client->init();
425 $soap_client->call(
'ilClone',
array($sid,$cp_options->getCopyId()));
431 include_once(
'./webservice/soap/include/inc.soap_functions.php');
441 $cp_options->dropFirstDependenciesNode();
443 if($cp_options->isSOAPEnabled())
446 include_once
'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
448 $soap_client->setResponseTimeout(1);
449 $soap_client->enableWSDL(
true);
450 $soap_client->init();
451 $soap_client->call(
'ilCloneDependencies',
array($sid,$cp_options->getCopyId()));
457 include_once(
'./webservice/soap/include/inc.soap_functions.php');
472 global
$ilLog,$tree,$ilAccess,$rbacreview;
476 $source_id = $node[
'child'];
477 $parent_id = $node[
'parent'];
478 $options = $cp_options->getOptions($node[
'child']);
479 $mappings = $cp_options->getMappings();
481 if(!$ilAccess->checkAccess(
'copy',
'',$node[
'child']))
487 if(!isset($mappings[$parent_id]))
489 ilLoggerFactory::getLogger(
'obj')->info(
'Omitting node '.$source_id.
', '.$node[
'title'].
', '.$node[
'type'].
'. No target found.');
496 ilLoggerFactory::getLogger(
'obj')->notice(
'Omitting node '.$source_id.
', '.$node[
'title'].
', '.$node[
'type'].
'. Object has been deleted.');
501 $new_obj =
$orig->cloneObject((
int)
$target_id,$cp_options->getCopyId());
503 if(!is_object($new_obj))
505 ilLoggerFactory::getLogger(
'obj')->error(
'Error copying '.$source_id.
', '.$node[
'title'].
', '.$node[
'type'].
'. No target found.');
510 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
511 $rbac_log_roles = $rbacreview->getParentRoleIds($new_obj->getRefId(),
false);
516 $cp_options->appendMapping($source_id,$new_obj->getRefId());
517 return $new_obj->getRefId();
531 $source_id = $node[
'child'];
532 $mappings = $cp_options->getMappings();
534 if(!isset($mappings[$source_id]))
536 ilLoggerFactory::getLogger(
'obj')->debug(
'Omitting node '.$source_id.
', '.$node[
'title'].
', '.$node[
'type'].
'. No mapping found.');
555 global
$ilLog,$ilAccess,$rbacreview;
557 $source_id = $node[
'child'];
558 $parent_id = $node[
'parent'];
559 $options = $cp_options->getOptions($node[
'child']);
560 $mappings = $cp_options->getMappings();
562 if(!$ilAccess->checkAccess(
'delete',
'',$node[
'child']))
564 ilLoggerFactory::getLogger(
'obj')->warning(
'No delete permission granted: '.$source_id.
', '.$node[
'title'].
', '.$node[
'type']);
568 if(!isset($mappings[$parent_id]))
570 ilLoggerFactory::getLogger(
'obj')->warning(
'Omitting node '.$source_id.
', '.$node[
'title'].
', '.$node[
'type'].
'. No target found.');
576 $new_ref_id =
$orig->createReference();
582 ilLoggerFactory::getLogger(
'obj')->error(
'Error linking '.$source_id.
', '.$node[
'title'].
', '.$node[
'type'].
'. No target found.');
587 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
588 $rbac_log_roles = $rbacreview->getParentRoleIds($new_ref_id,
false);
593 $cp_options->appendMapping($source_id,$new_ref_id);
611 foreach (
$error as $err) {
612 $msg []=
"(".$err[
"line"].
",".$err[
"col"].
"): ".$err[
"errormessage"];
619 $msg = join(
"\n",$msg);
630 if(!$this->__checkSession($sid))
635 include_once(
'./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php');
639 $ilLog->write(__METHOD__.
': Starting task execution...');
641 $scheduler->startTaskExecution();
667 $ilLog->write(__METHOD__.
': Started deletion of inactive user objects with expired confirmation hash values (dual opt in) ...');
669 require_once
'Services/Registration/classes/class.ilRegistrationSettings.php';
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').
' ';
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').
' ';
695 $ilLog->write(__METHOD__.
': '.$ilDB->numRows(
$res).
' inactive user objects with confirmation hash values (dual opt in) found ...');
703 $num_deleted_users = 0;
704 while(
$row = $ilDB->fetchAssoc(
$res))
706 if(
$row[
'usr_id'] == ANONYMOUS_USER_ID ||
$row[
'usr_id'] == SYSTEM_USER_ID)
continue;
707 if(!strlen(
$row[
'reg_hash']))
continue;
709 if((
int)$oRegSettigs->getRegistrationHashLifetime() > 0 &&
710 $row[
'create_date'] !=
'' &&
711 time() - $oRegSettigs->getRegistrationHashLifetime() > strtotime(
$row[
'create_date']))
716 $ilLog->write(__METHOD__.
': User '.$user->getLogin().
' (obj_id: '.$user->getId().
') will be deleted due to an expired registration hash ...');
718 ++$num_deleted_users;
723 $ilLog->write(__METHOD__.
': '.$num_deleted_users.
' inactive user objects with expired confirmation hash values (dual opt in) deleted ...');
725 $ilLog->write(__METHOD__.
': Finished deletion of inactive user objects with expired confirmation hash values (dual opt in) ...');
callNextNode($sid, $cp_options)
Call next node using soap.
This class handles all operations on files (attachments) in directory ilias_data/mail.
static ilClone($sid, $copy_identifier)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
saveTempFileAsMediaObject($sid, $name, $tmp_name)
setSaveInSentbox($a_save_in_sentbox)
SaxParserException thrown by ilSaxParser if property throwException is set.
distributeMails($sid, $a_mail_xml)
mail via soap
getMobsOfObject($sid, $a_type, $a_id)
sendMail($sid, $to, $cc, $bcc, $sender, $subject, $message, $attach)
static gatherFaPa($a_ref_id, array $a_role_ids, $a_add_action=false)
static _sanitizeFilemame($a_filename)
static _getInstance($a_copy_id)
Get instance of copy wizard options.
if(!is_array($argv)) $options
this class encapsulates the PHP mail() function.
XML parser for soap mails.
static validateXML($xml)
validates an xml file, if dtd is attached
This class handles base functions for mail handling.
__raiseError($a_message, $a_code)
deleteExpiredDualOptInUserObjects($sid, $usr_id)
Method for soap webservice: deleteExpiredDualOptInUserObjects.
callNextDependency($sid, $cp_options)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Create styles array
The data for the language used.
static _getInstanceByServerId($a_server_id)
get singleton instance Private access use ilECSTaskScheduler::start() or ilECSTaskScheduler::startTas...
ilCloneDependencies($sid, $copy_identifier)
clone object dependencies (e.g.
Class ilObjAuthSettingsGUI.
static ilCloneDependencies($sid, $copy_identifier)
static add($a_action, $a_ref_id, array $a_diff, $a_source_ref_id=false)
initAuth($sid)
Init authentication.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
handleECSTasks($sid, $a_server_id)
static getLogger($a_component_id)
Get component logger.
domxml_open_mem($str, $mode=0, &$error=NULL)
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
cloneDependencies($node, $cp_options)
cloneDependencies
linkNode($node, $cp_options)
Link node.
ilClone($sid, $copy_identifier)
Clone object.
cloneNode($node, $cp_options)
Clone node.