/**
  * send mime mail using class.ilMimeMail.php
  * All external mails are send to SOAP::sendMail starting a kind of background process
  * @param string of recipients
  * @param string of recipients
  * @param string of recipients
  * @param string subject
  * @param string message
  * @param array attachments
  * @param bool prevent soap
  * @access	public
  * @return	array of saved data
  */
 function sendMimeMail($a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_m_subject, $a_m_message, $a_attachments, $a_no_soap = false)
 {
     include_once "Services/Mail/classes/class.ilMimeMail.php";
     #var_dump("<pre>",$a_rcp_to,$a_rcp_cc,$a_rcp_bcc,$a_m_subject,$a_m_message,$a_attachments,"<pre>");
     #$inst_name = $this->ilias->getSetting("inst_name") ? $this->ilias->getSetting("inst_name") : "ILIAS 4";
     #$a_m_subject = "[".$inst_name."] ".$a_m_subject;
     $a_m_subject = self::getSubjectPrefix() . ' ' . $a_m_subject;
     $sender = $this->getMimeMailSender();
     // #10854
     if ($this->isSOAPEnabled() && !$a_no_soap) {
         // Send per soap
         include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
         $soap_client = new ilSoapClient();
         $soap_client->setResponseTimeout(1);
         $soap_client->enableWSDL(true);
         $soap_client->init();
         $attachments = array();
         $a_attachments = $a_attachments ? $a_attachments : array();
         foreach ($a_attachments as $attachment) {
             $attachments[] = $this->mfile->getAbsolutePath($attachment);
         }
         // mjansen: switched separator from "," to "#:#" because of mantis bug #6039
         $attachments = implode('#:#', $attachments);
         // mjansen: use "#:#" as leading delimiter
         if (strlen($attachments)) {
             $attachments = "#:#" . $attachments;
         }
         $soap_client->call('sendMail', array($_COOKIE['PHPSESSID'] . '::' . $_COOKIE['ilClientId'], $a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $sender, $a_m_subject, $a_m_message, $attachments));
         return true;
     } else {
         // send direct
         include_once "Services/Mail/classes/class.ilMimeMail.php";
         $mmail = new ilMimeMail();
         $mmail->autoCheck(false);
         $mmail->From($sender);
         $mmail->To($a_rcp_to);
         // Add installation name to subject
         $mmail->Subject($a_m_subject);
         $mmail->Body($a_m_message);
         if ($a_rcp_cc) {
             $mmail->Cc($a_rcp_cc);
         }
         if ($a_rcp_bcc) {
             $mmail->Bcc($a_rcp_bcc);
         }
         if (is_array($a_attachments)) {
             foreach ($a_attachments as $attachment) {
                 $mmail->Attach($this->mfile->getAbsolutePath($attachment));
             }
         }
         $mmail->Send();
     }
 }
Example #2
0
 public function confirmRegistration()
 {
     global $lng, $ilias, $ilLog;
     ilUtil::setCookie('iltest', 'cookie', false);
     if (!isset($_GET['rh']) || !strlen(trim($_GET['rh']))) {
         ilUtil::redirect('./login.php?cmd=force_login&reg_confirmation_msg=reg_confirmation_hash_not_passed');
     }
     try {
         require_once 'Services/Registration/classes/class.ilRegistrationSettings.php';
         $oRegSettings = new ilRegistrationSettings();
         $usr_id = ilObjUser::_verifyRegistrationHash(trim($_GET['rh']));
         $oUser = ilObjectFactory::getInstanceByObjId($usr_id);
         $oUser->setActive(true);
         if ($oRegSettings->passwordGenerationEnabled()) {
             $passwd = ilUtil::generatePasswords(1);
             $password = $passwd[0];
             $oUser->setPasswd($password, IL_PASSWD_PLAIN);
             $oUser->setLastPasswordChangeTS(time());
         }
         $oUser->update();
         $usr_lang = $oUser->getPref('language');
         if ($lng->getLangKey() != $usr_lang) {
             $lng = new ilLanguage($usr_lang);
         }
         // send email
         // try individual account mail in user administration
         include_once "Services/Mail/classes/class.ilAccountMail.php";
         include_once './Services/User/classes/class.ilObjUserFolder.php';
         $amail = ilObjUserFolder::_lookupNewAccountMail($usr_lang);
         if (trim($amail["body"]) != "" && trim($amail["subject"]) != "") {
             $acc_mail = new ilAccountMail();
             $acc_mail->setUser($oUser);
             if ($oRegSettings->passwordGenerationEnabled()) {
                 $acc_mail->setUserPassword($password);
             }
             $acc_mail->send();
         } else {
             include_once 'Services/Mail/classes/class.ilMail.php';
             $mail_obj = new ilMail(ANONYMOUS_USER_ID);
             // mail subject
             $subject = $lng->txt("reg_mail_subject");
             // mail body
             $body = $lng->txt("reg_mail_body_salutation") . " " . $oUser->getFullname() . ",\n\n" . $lng->txt("reg_mail_body_text1") . "\n\n" . $lng->txt("reg_mail_body_text2") . "\n" . ILIAS_HTTP_PATH . "/login.php?client_id=" . CLIENT_ID . "\n";
             $body .= $lng->txt("login") . ": " . $oUser->getLogin() . "\n";
             if ($oRegSettings->passwordGenerationEnabled()) {
                 $body .= $lng->txt("passwd") . ": " . $password . "\n";
             }
             $body .= "\n";
             $body .= $lng->txt('reg_mail_body_forgot_password_info') . "\n";
             $body .= "\n";
             $body .= $lng->txt("reg_mail_body_text3") . "\n\r";
             $body .= $oUser->getProfileAsString($lng);
             $mail_obj->enableSoap(false);
             $mail_obj->appendInstallationSignature(true);
             $mail_obj->sendMail($oUser->getEmail(), '', '', $subject, $body, array(), array('normal'));
         }
         ilUtil::redirect('./login.php?cmd=force_login&reg_confirmation_msg=reg_account_confirmation_successful&lang=' . $usr_lang);
     } catch (ilRegConfirmationLinkExpiredException $exception) {
         include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
         $soap_client = new ilSoapClient();
         $soap_client->setResponseTimeout(1);
         $soap_client->enableWSDL(true);
         $soap_client->init();
         $ilLog->write(__METHOD__ . ': Triggered soap call (background process) for deletion of inactive user objects with expired confirmation hash values (dual opt in) ...');
         $soap_client->call('deleteExpiredDualOptInUserObjects', array($_COOKIE['PHPSESSID'] . '::' . $_COOKIE['ilClientId'], $exception->getCode()));
         ilUtil::redirect('./login.php?cmd=force_login&reg_confirmation_msg=' . $exception->getMessage() . "&lang=" . $usr_lang);
     } catch (ilRegistrationHashNotFoundException $exception) {
         ilUtil::redirect('./login.php?cmd=force_login&reg_confirmation_msg=' . $exception->getMessage() . "&lang=" . $usr_lang);
     }
 }
Example #3
0
 /**
  * clone all objects according to this container
  *
  * @param string $session_id
  * @param string $client_id
  * @param string $new_type
  * @param int $ref_id
  * @param int $clone_source
  * @param array $options
  * @return new refid if clone has finished or parameter ref id if cloning is still in progress
  */
 public function cloneAllObject($session_id, $client_id, $new_type, $ref_id, $clone_source, $options, $soap_call = false)
 {
     global $ilLog;
     include_once './Services/Link/classes/class.ilLink.php';
     include_once 'Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
     global $ilAccess, $ilErr, $rbacsystem, $tree, $ilUser;
     // Save wizard options
     $copy_id = ilCopyWizardOptions::_allocateCopyId();
     $wizard_options = ilCopyWizardOptions::_getInstance($copy_id);
     $wizard_options->saveOwner($ilUser->getId());
     $wizard_options->saveRoot($clone_source);
     // add entry for source container
     $wizard_options->initContainer($clone_source, $ref_id);
     foreach ($options as $source_id => $option) {
         $wizard_options->addEntry($source_id, $option);
     }
     $wizard_options->read();
     $wizard_options->storeTree($clone_source);
     // Special handling for course in existing courses
     if ($new_type == 'crs' and ilObject::_lookupType(ilObject::_lookupObjId($ref_id)) == 'crs') {
         $ilLog->write(__METHOD__ . ': Copy course in course...');
         $ilLog->write(__METHOD__ . ': Added mapping, source ID: ' . $clone_source . ', target ID: ' . $ref_id);
         $wizard_options->read();
         $wizard_options->dropFirstNode();
         $wizard_options->appendMapping($clone_source, $ref_id);
     }
     #print_r($options);
     // Duplicate session to avoid logout problems with backgrounded SOAP calls
     $new_session_id = ilSession::_duplicate($session_id);
     // Start cloning process using soap call
     include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
     $soap_client = new ilSoapClient();
     $soap_client->setResponseTimeout(30);
     $soap_client->enableWSDL(true);
     $ilLog->write(__METHOD__ . ': Trying to call Soap client...');
     if ($soap_client->init()) {
         $ilLog->write(__METHOD__ . ': Calling soap clone method...');
         $res = $soap_client->call('ilClone', array($new_session_id . '::' . $client_id, $copy_id));
     } else {
         $ilLog->write(__METHOD__ . ': SOAP call failed. Calling clone method manually. ');
         $wizard_options->disableSOAP();
         $wizard_options->read();
         include_once './webservice/soap/include/inc.soap_functions.php';
         $res = ilSoapFunctions::ilClone($new_session_id . '::' . $client_id, $copy_id);
     }
     // Check if copy is in progress or if this has been called by soap (don't wait for finishing)
     if ($soap_call || ilCopyWizardOptions::_isFinished($copy_id)) {
         return $res;
     } else {
         return $ref_id;
     }
 }
 /**
  * Call next task scheduler run
  */
 protected function initNextExecution()
 {
     global $ilLog;
     // Start task execution as backend process
     include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
     $soap_client = new ilSoapClient();
     $soap_client->setResponseTimeout(1);
     $soap_client->enableWSDL(true);
     $ilLog->write(__METHOD__ . ': Trying to call Soap client...');
     $new_session_id = ilSession::_duplicate($_COOKIE['PHPSESSID']);
     $client_id = $_COOKIE['ilClientId'];
     if ($soap_client->init() and 0) {
         $ilLog->write(__METHOD__ . ': Calling soap handleECSTasks method...');
         $res = $soap_client->call('handleECSTasks', array($new_session_id . '::' . $client_id, $this->settings->getServerId()));
     } else {
         $ilLog->write(__METHOD__ . ': SOAP call failed. Calling clone method manually. ');
         include_once './webservice/soap/include/inc.soap_functions.php';
         $res = ilSoapFunctions::handleECSTasks($new_session_id . '::' . $client_id, $this->settings->getServerId());
     }
 }
 private function callNextDependency($sid, $cp_options)
 {
     global $ilLog;
     $cp_options->dropFirstDependenciesNode();
     if ($cp_options->isSOAPEnabled()) {
         // Start next soap call
         include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
         $soap_client = new ilSoapClient();
         $soap_client->setResponseTimeout(1);
         $soap_client->enableWSDL(true);
         $soap_client->init();
         $soap_client->call('ilCloneDependencies', array($sid, $cp_options->getCopyId()));
     } else {
         $ilLog->write(__METHOD__ . ': Cannot call SOAP server');
         $cp_options->read();
         include_once './webservice/soap/include/inc.soap_functions.php';
         $res = ilSoapFunctions::ilCloneDependencies($sid, $cp_options->getCopyId());
     }
     return true;
 }