33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
39 parent::ilSoapAdministration();
44 return ignore_user_abort(
true);
49 $this->soap_check =
false;
52 function sendMail($sid,$to,$cc,$bcc,$sender,$subject,$message,$attach)
57 if(!$this->__checkSession($sid))
62 include_once
'Services/Mail/classes/class.ilMimeMail.php';
64 if(strpos($sender,
'#:#') !==
false)
66 $sender = explode(
'#:#', $sender);
70 $mmail->autoCheck(
false);
71 $mmail->From($sender);
72 $mmail->To(explode(
',',$to));
73 $mmail->Subject($subject);
74 $mmail->Body($message);
78 $mmail->Cc(explode(
',',$cc));
83 $mmail->Bcc(explode(
',',$bcc));
90 if(strpos($attach,
'#:#') === 0)
92 $attach = substr($attach, strlen(
'#:#'));
93 $attachments = explode(
'#:#', $attach);
97 $attachments = explode(
',', $attach);
100 foreach($attachments as $attachment)
102 $final_filename = null;
107 $final_filename = preg_replace(
'/^(\d+?_)(.*)/',
'$2',
$filename);
109 $mmail->Attach($attachment,
'',
'inline', $final_filename);
129 if(!$this->__checkSession($sid))
134 include_once
'Services/Mail/classes/class.ilMail.php';
135 include_once
'webservice/soap/classes/class.ilSoapMailXmlParser.php';
141 libxml_use_internal_errors(
true);
142 $ok = simplexml_load_string($a_mail_xml);
145 foreach(libxml_get_errors() as $err)
147 $error .= ($err->message.
' ');
155 $GLOBALS[
'ilLog']->write(__METHOD__.
' '.$e->getMessage());
160 $GLOBALS[
'ilLog']->write(__METHOD__.
' '.$e->getMessage());
164 $mails = $parser->getMails();
168 foreach($mails as $mail)
171 include_once
'./Services/Mail/classes/class.ilFileDataMail.php';
173 foreach((array) $mail[
'attachments'] as $attachment)
176 $file->storeAsAttachment($attachment[
'name'], $attachment[
'content']);
180 $mail_obj =
new ilMail($ilUser->getId());
182 $mail_obj->saveAttachments((array) $attachments);
184 implode(
',',(array) $mail[
'to']),
185 implode(
',',(array) $mail[
'cc']),
186 implode(
',',(array) $mail[
'bcc']),
188 implode(
"\n", (array)$mail[
'body']),
189 (array) $attachments,
190 array($mail[
'type']),
191 (
bool) $mail[
'usePlaceholders']
195 foreach((array) $attachments as $att)
197 $file->unlinkFile($att);
199 $mail_obj->savePostData(
220 if(!$this->__checkSession($sid))
225 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
234 if(!$this->__checkSession($sid))
239 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
255 if(!$this->__checkSession($sid))
262 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
266 if(!$cp_options->checkOwner($ilUser->getId()))
268 ilLoggerFactory::getLogger(
'obj')->error(
'Permission check failed for user id: '.$ilUser->getId().
', copy id: '.$copy_identifier);
273 if(($node = $cp_options->fetchFirstDependenciesNode()) ===
false)
275 $cp_options->deleteAll();
281 $options = $cp_options->getOptions($node[
'child']);
291 ilLoggerFactory::getLogger(
'obj')->debug(
': Nothing to do for node: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
296 ilLoggerFactory::getLogger(
'obj')->debug(
': Start cloning dependencies: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
302 ilLoggerFactory::getLogger(
'obj')->warning(
'No valid action type given for node: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
317 public function ilClone($sid,$copy_identifier)
322 if(!$this->__checkSession($sid))
329 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
333 if(!$cp_options->checkOwner($ilUser->getId()))
335 ilLoggerFactory::getLogger(
'obj')->error(
'Permission check failed for user id: '.$ilUser->getId().
', copy id: '.$copy_identifier);
341 if(($node = $cp_options->fetchFirstNode()) ===
false)
348 $options = $cp_options->getOptions($node[
'child']);
356 $cp_options->appendMapping($node[
'child'],0);
363 $new_ref_id = $this->
cloneNode($node,$cp_options);
369 $new_ref_id = $this->
linkNode($node,$cp_options);
374 ilLoggerFactory::getLogger(
'obj')->warning(
'No valid action type given for: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
392 $cp_options->dropFirstNode();
394 if($cp_options->isSOAPEnabled())
397 include_once
'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
399 $soap_client->setResponseTimeout(1);
400 $soap_client->enableWSDL(
true);
401 $soap_client->init();
402 $soap_client->call(
'ilClone',array($sid,$cp_options->getCopyId()));
408 include_once(
'./webservice/soap/include/inc.soap_functions.php');
418 $cp_options->dropFirstDependenciesNode();
420 if($cp_options->isSOAPEnabled())
423 include_once
'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
425 $soap_client->setResponseTimeout(1);
426 $soap_client->enableWSDL(
true);
427 $soap_client->init();
428 $soap_client->call(
'ilCloneDependencies',array($sid,$cp_options->getCopyId()));
434 include_once(
'./webservice/soap/include/inc.soap_functions.php');
449 global
$ilLog,$tree,$ilAccess,$rbacreview;
453 $source_id = $node[
'child'];
454 $parent_id = $node[
'parent'];
455 $options = $cp_options->getOptions($node[
'child']);
456 $mappings = $cp_options->getMappings();
458 if(!$ilAccess->checkAccess(
'copy',
'',$node[
'child']))
464 if(!isset($mappings[$parent_id]))
466 ilLoggerFactory::getLogger(
'obj')->info(
'Omitting node '.$source_id.
', '.$node[
'title'].
', '.$node[
'type'].
'. No target found.');
473 ilLoggerFactory::getLogger(
'obj')->notice(
'Omitting node '.$source_id.
', '.$node[
'title'].
', '.$node[
'type'].
'. Object has been deleted.');
478 $new_obj = $orig->cloneObject((
int)
$target_id,$cp_options->getCopyId());
480 if(!is_object($new_obj))
482 ilLoggerFactory::getLogger(
'obj')->error(
'Error copying '.$source_id.
', '.$node[
'title'].
', '.$node[
'type'].
'. No target found.');
487 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
488 $rbac_log_roles = $rbacreview->getParentRoleIds($new_obj->getRefId(),
false);
493 $cp_options->appendMapping($source_id,$new_obj->getRefId());
494 return $new_obj->getRefId();
508 $source_id = $node[
'child'];
509 $mappings = $cp_options->getMappings();
511 if(!isset($mappings[$source_id]))
513 ilLoggerFactory::getLogger(
'obj')->debug(
'Omitting node '.$source_id.
', '.$node[
'title'].
', '.$node[
'type'].
'. No mapping found.');
519 $orig->cloneDependencies(
$target_id,$cp_options->getCopyId());
532 global
$ilLog,$ilAccess,$rbacreview;
534 $source_id = $node[
'child'];
535 $parent_id = $node[
'parent'];
536 $options = $cp_options->getOptions($node[
'child']);
537 $mappings = $cp_options->getMappings();
539 if(!$ilAccess->checkAccess(
'delete',
'',$node[
'child']))
541 ilLoggerFactory::getLogger(
'obj')->warning(
'No delete permission granted: '.$source_id.
', '.$node[
'title'].
', '.$node[
'type']);
545 if(!isset($mappings[$parent_id]))
547 ilLoggerFactory::getLogger(
'obj')->warning(
'Omitting node '.$source_id.
', '.$node[
'title'].
', '.$node[
'type'].
'. No target found.');
553 $new_ref_id = $orig->createReference();
559 ilLoggerFactory::getLogger(
'obj')->error(
'Error linking '.$source_id.
', '.$node[
'title'].
', '.$node[
'type'].
'. No target found.');
564 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
565 $rbac_log_roles = $rbacreview->getParentRoleIds($new_ref_id,
false);
570 $cp_options->appendMapping($source_id,$new_ref_id);
586 if (is_array($error))
588 foreach ($error as $err) {
589 $msg []=
"(".$err[
"line"].
",".$err[
"col"].
"): ".$err[
"errormessage"];
596 $msg = join(
"\n",$msg);
607 if(!$this->__checkSession($sid))
612 include_once(
'./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php');
616 $ilLog->write(__METHOD__.
': Starting task execution...');
618 $scheduler->startTaskExecution();
644 $ilLog->write(__METHOD__.
': Started deletion of inactive user objects with expired confirmation hash values (dual opt in) ...');
646 require_once
'Services/Registration/classes/class.ilRegistrationSettings.php';
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').
' ';
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').
' ';
672 $ilLog->write(__METHOD__.
': '.$ilDB->numRows(
$res).
' inactive user objects with confirmation hash values (dual opt in) found ...');
680 $num_deleted_users = 0;
681 while(
$row = $ilDB->fetchAssoc(
$res))
683 if(
$row[
'usr_id'] == ANONYMOUS_USER_ID ||
$row[
'usr_id'] == SYSTEM_USER_ID)
continue;
684 if(!strlen(
$row[
'reg_hash']))
continue;
686 if((
int)$oRegSettigs->getRegistrationHashLifetime() > 0 &&
687 $row[
'create_date'] !=
'' &&
688 time() - $oRegSettigs->getRegistrationHashLifetime() > strtotime(
$row[
'create_date']))
693 $ilLog->write(__METHOD__.
': User '.$user->getLogin().
' (obj_id: '.$user->getId().
') will be deleted due to an expired registration hash ...');
695 ++$num_deleted_users;
700 $ilLog->write(__METHOD__.
': '.$num_deleted_users.
' inactive user objects with expired confirmation hash values (dual opt in) deleted ...');
702 $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.
domxml_open_mem($str, $mode=DOMXML_LOAD_PARSING, &$error=NULL)
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
This class handles all operations on files (attachments) in directory ilias_data/mail.
static ilClone($sid, $copy_identifier)
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)
const DOMXML_LOAD_VALIDATING
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
Class Mail this class handles base functions for mail handling.
__raiseError($a_message, $a_code)
deleteExpiredDualOptInUserObjects($sid, $usr_id)
Method for soap webservice: deleteExpiredDualOptInUserObjects.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
callNextDependency($sid, $cp_options)
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)
handleECSTasks($sid, $a_server_id)
static getLogger($a_component_id)
Get component logger.
cloneDependencies($node, $cp_options)
cloneDependencies
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
linkNode($node, $cp_options)
Link node.
ilClone($sid, $copy_identifier)
Clone object.
cloneNode($node, $cp_options)
Clone node.