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)
 
   57                 if(!$this->__checkSession($sid))
 
   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);
 
   98                         foreach($attachments as $attachment)
 
  100                                 $final_filename = null;
 
  105                                         $final_filename = preg_replace(
'/^(\d+?_)(.*)/', 
'$2', 
$filename);
 
  107                                 $mmail->Attach($attachment, 
'', 
'inline', $final_filename);
 
  112                 $ilLog->write(
'SOAP: sendMail(): '.$to.
', '.$cc.
', '.$bcc);
 
  128                 if(!$this->__checkSession($sid))
 
  133                 include_once 
'Services/Mail/classes/class.ilMail.php';
 
  134                 include_once 
'webservice/soap/classes/class.ilSoapMailXmlParser.php';
 
  140                         libxml_use_internal_errors(
true);
 
  141                         $ok = simplexml_load_string($a_mail_xml);
 
  144                                 foreach(libxml_get_errors() as $err)
 
  146                                         $error .= ($err->message.
' ');
 
  152                 catch(InvalidArgumentException $e)
 
  154                         $GLOBALS[
'ilLog']->write(__METHOD__.
' '.$e->getMessage());
 
  159                         $GLOBALS[
'ilLog']->write(__METHOD__.
' '.$e->getMessage());
 
  163                 $mails = $parser->getMails();
 
  167                 foreach($mails as $mail)
 
  170                         include_once 
'./Services/Mail/classes/class.ilFileDataMail.php';
 
  172                         foreach((array) $mail[
'attachments'] as $attachment)
 
  175                                 $file->storeAsAttachment($attachment[
'name'], $attachment[
'content']);
 
  179                         $mail_obj = 
new ilMail($ilUser->getId());
 
  181                         $mail_obj->saveAttachments((array) $attachments);
 
  183                                 implode(
',',(array) $mail[
'to']),
 
  184                                 implode(
',',(array) $mail[
'cc']),
 
  185                                 implode(
',',(array) $mail[
'bcc']),
 
  187                                 implode(
"\n",$mail[
'body']),
 
  188                                 (array) $attachments,
 
  189                                 array($mail[
'type']),
 
  190                                 (
bool) $mail[
'usePlaceholders']
 
  194                         foreach((array) $attachments as $att)
 
  196                                 $file->unlinkFile($att);
 
  198                         $mail_obj->savePostData(
 
  219                 if(!$this->__checkSession($sid))
 
  224                 include_once 
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
 
  233                 if(!$this->__checkSession($sid))
 
  238                 include_once 
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
 
  254                 if(!$this->__checkSession($sid))
 
  261                 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
 
  265                 if(!$cp_options->checkOwner($ilUser->getId()))
 
  267                         $ilLog->write(__METHOD__.
': Permission check failed for user id: '.$ilUser->getId().
', copy id: '.$copy_identifier);
 
  272                 if(($node = $cp_options->fetchFirstDependenciesNode()) === 
false)
 
  274                         $cp_options->deleteAll();
 
  275                         $ilLog->write(__METHOD__.
': Finished copy step 2. Copy completed');
 
  281                 $options = $cp_options->getOptions($node[
'child']);
 
  286                                 $ilLog->write(__METHOD__.
': Omitting node: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
 
  291                                 $ilLog->write(__METHOD__.
': Nothing to do for node: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
 
  296                                 $ilLog->write(__METHOD__.
': Start cloning dependencies: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
 
  302                                 $ilLog->write(__METHOD__.
': 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                         $ilLog->write(__METHOD__.
': Permission check failed for user id: '.$ilUser->getId().
', copy id: '.$copy_identifier);
 
  341                 if(($node = $cp_options->fetchFirstNode()) === 
false)
 
  343                         $ilLog->write(__METHOD__.
': Finished copy step 1. Starting copying of object dependencies...');
 
  348                 $options = $cp_options->getOptions($node[
'child']);
 
  354                                 $ilLog->write(__METHOD__.
': Omitting node: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
 
  356                                 $cp_options->appendMapping($node[
'child'],0);
 
  361                                 $ilLog->write(__METHOD__.
': Start cloning node: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
 
  362                                 $new_ref_id = $this->
cloneNode($node,$cp_options);
 
  367                                 $ilLog->write(__METHOD__.
': Start linking node: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
 
  368                                 $new_ref_id = $this->
linkNode($node,$cp_options);
 
  373                                 $ilLog->write(__METHOD__.
': No valid action type given for node: '.$node[
'obj_id'].
', '.$node[
'title'].
', '.$node[
'type']);
 
  391                 $cp_options->dropFirstNode();
 
  393                 if($cp_options->isSOAPEnabled())
 
  396                         include_once 
'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
 
  398                         $soap_client->setResponseTimeout(1);
 
  399                         $soap_client->enableWSDL(
true);
 
  400                         $soap_client->init();
 
  401                         $soap_client->call(
'ilClone',array($sid,$cp_options->getCopyId()));
 
  405                         $ilLog->write(__METHOD__.
': Cannot call SOAP server');
 
  407                         include_once(
'./webservice/soap/include/inc.soap_functions.php');
 
  417                 $cp_options->dropFirstDependenciesNode();
 
  419                 if($cp_options->isSOAPEnabled())
 
  422                         include_once 
'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
 
  424                         $soap_client->setResponseTimeout(1);
 
  425                         $soap_client->enableWSDL(
true);
 
  426                         $soap_client->init();
 
  427                         $soap_client->call(
'ilCloneDependencies',array($sid,$cp_options->getCopyId()));
 
  431                         $ilLog->write(__METHOD__.
': Cannot call SOAP server');
 
  433                         include_once(
'./webservice/soap/include/inc.soap_functions.php');
 
  448                 global 
$ilLog,$tree,$ilAccess,$rbacreview;
 
  452                 $source_id = $node[
'child'];
 
  453                 $parent_id = $node[
'parent'];
 
  454                 $options = $cp_options->getOptions($node[
'child']);
 
  455                 $mappings = $cp_options->getMappings();
 
  457                 if(!$ilAccess->checkAccess(
'copy',
'',$node[
'child']))
 
  459                         $ilLog->write(__METHOD__.
': No copy permission granted: '.$source_id.
', '.$node[
'title'].
', '.$node[
'type']);
 
  463                 if(!isset($mappings[$parent_id]))
 
  465                         $ilLog->write(__METHOD__.
': Omitting node '.$source_id.
', '.$node[
'title'].
', '.$node[
'type']. 
'. No target found.');
 
  472                         $ilLog->write(__METHOD__.
': Omitting node '.$source_id.
', '.$node[
'title'].
', '.$node[
'type']. 
'. Object has been deleted.');
 
  477                 $new_obj = $orig->cloneObject((
int) 
$target_id,$cp_options->getCopyId());
 
  479                 if(!is_object($new_obj))
 
  481                         $ilLog->write(__METHOD__.
': Error copying '.$source_id.
', '.$node[
'title'].
', '.$node[
'type'].
'. No target found.');
 
  486                 include_once 
"Services/AccessControl/classes/class.ilRbacLog.php";
 
  487                 $rbac_log_roles = $rbacreview->getParentRoleIds($new_obj->getRefId(), 
false);
 
  492                 $cp_options->appendMapping($source_id,$new_obj->getRefId());
 
  493                 return $new_obj->getRefId();
 
  507                 $source_id = $node[
'child'];
 
  508                 $mappings = $cp_options->getMappings();
 
  510                 if(!isset($mappings[$source_id]))
 
  512                         $ilLog->write(__METHOD__.
': Omitting node '.$source_id.
', '.$node[
'title'].
', '.$node[
'type']. 
'. No mapping found.');
 
  518                 $orig->cloneDependencies(
$target_id,$cp_options->getCopyId());
 
  531                 global 
$ilLog,$ilAccess,$rbacreview;
 
  533                 $source_id = $node[
'child'];
 
  534                 $parent_id = $node[
'parent'];
 
  535                 $options = $cp_options->getOptions($node[
'child']);
 
  536                 $mappings = $cp_options->getMappings();
 
  538                 if(!$ilAccess->checkAccess(
'delete',
'',$node[
'child']))
 
  540                         $ilLog->write(__METHOD__.
': No delete permission granted: '.$source_id.
', '.$node[
'title'].
', '.$node[
'type']);
 
  544                 if(!isset($mappings[$parent_id]))
 
  546                         $ilLog->write(__METHOD__.
': Omitting node '.$source_id.
', '.$node[
'title'].
', '.$node[
'type']. 
'. No target found.');
 
  552                 $new_ref_id = $orig->createReference();
 
  558                         $ilLog->write(__METHOD__.
': Error linking '.$source_id.
', '.$node[
'title'].
', '.$node[
'type'].
'. No target found.');
 
  563                 include_once 
"Services/AccessControl/classes/class.ilRbacLog.php";
 
  564                 $rbac_log_roles = $rbacreview->getParentRoleIds($new_ref_id, 
false);
 
  569                 $cp_options->appendMapping($source_id,$new_ref_id);
 
  585                     if (is_array($error))
 
  587                         foreach ($error as $err) {
 
  588                                         $msg []= 
"(".$err[
"line"].
",".$err[
"col"].
"): ".$err[
"errormessage"];
 
  595                         $msg = join(
"\n",$msg);
 
  606                 if(!$this->__checkSession($sid))
 
  611                 include_once(
'./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php');
 
  615                 $ilLog->write(__METHOD__.
': Starting task execution...');
 
  617                 $scheduler->startTaskExecution();
 
  643                 $ilLog->write(__METHOD__.
': Started deletion of inactive user objects with expired confirmation hash values (dual opt in) ...');
 
  645                 require_once 
'Services/Registration/classes/class.ilRegistrationSettings.php';
 
  657                         $query .= 
'SELECT usr_id, create_date, reg_hash FROM usr_data ' 
  658                                     . 
'WHERE active = 0 ' 
  659                                     . 
'AND reg_hash IS NOT NULL ' 
  660                                     . 
'AND usr_id = '.$ilDB->quote(
$usr_id, 
'integer').
' ';
 
  664                 $query .= 
'SELECT usr_id, create_date, reg_hash FROM usr_data ' 
  665                             . 
'WHERE active = 0 ' 
  666                             . 
'AND reg_hash IS NOT NULL ' 
  667                             . 
'AND usr_id != '.$ilDB->quote(
$usr_id, 
'integer').
' ';                        
 
  671                 $ilLog->write(__METHOD__.
': '.$ilDB->numRows(
$res).
' inactive user objects with confirmation hash values (dual opt in) found ...');
 
  679                 $num_deleted_users = 0;
 
  680                 while(
$row = $ilDB->fetchAssoc(
$res))
 
  682                         if(
$row[
'usr_id'] == ANONYMOUS_USER_ID || 
$row[
'usr_id'] == SYSTEM_USER_ID) 
continue;                   
 
  683                         if(!strlen(
$row[
'reg_hash'])) 
continue;
 
  685                         if((
int)$oRegSettigs->getRegistrationHashLifetime() > 0 &&
 
  686                            $row[
'create_date'] != 
'' &&
 
  687                            time() - $oRegSettigs->getRegistrationHashLifetime() > strtotime(
$row[
'create_date']))
 
  692                                         $ilLog->write(__METHOD__.
': User '.$user->getLogin().
' (obj_id: '.$user->getId().
') will be deleted due to an expired registration hash ...');
 
  694                                         ++$num_deleted_users;
 
  699                 $ilLog->write(__METHOD__.
': '.$num_deleted_users.
' inactive user objects with expired confirmation hash values (dual opt in) deleted ...');
 
  701                 $ilLog->write(__METHOD__.
': Finished deletion of inactive user objects with expired confirmation hash values (dual opt in) ...');