/** * */ public function setUp() { vfsStreamWrapper::register(); $root = vfsStreamWrapper::setRoot(new vfsStreamDirectory('root')); $customizing_dir = vfsStream::newDirectory('Customizing')->at($root); $this->client_dir = vfsStream::newDirectory('clients/default/agreement')->at($customizing_dir); $this->global_dir = vfsStream::newDirectory('global/agreement')->at($customizing_dir); $this->lng = $this->getMockBuilder('ilLanguage')->disableOriginalConstructor()->getMock(); $this->lng->expects($this->any())->method('getLangKey')->will($this->returnValue('de')); $this->lng->expects($this->any())->method('getDefaultLanguage')->will($this->returnValue('fr')); $this->source_files = array(vfsStream::url(implode('/', array('root', 'Customizing', 'clients', 'default', 'agreement', 'agreement_' . $this->lng->getLangKey() . '.html'))) => $this->lng->getLangKey(), vfsStream::url(implode('/', array('root', 'Customizing', 'clients', 'default', 'agreement', 'agreement_' . $this->lng->getDefaultLanguage() . '.html'))) => $this->lng->getDefaultLanguage(), vfsStream::url(implode('/', array('root', 'Customizing', 'clients', 'default', 'agreement', 'agreement_en.html'))) => 'en', vfsStream::url(implode('/', array('root', 'Customizing', 'global', 'agreement', 'agreement_' . $this->lng->getLangKey() . '.html'))) => $this->lng->getLangKey(), vfsStream::url(implode('/', array('root', 'Customizing', 'global', 'agreement', 'agreement_' . $this->lng->getDefaultLanguage() . '.html'))) => $this->lng->getDefaultLanguage(), vfsStream::url(implode('/', array('root', 'Customizing', 'global', 'agreement', 'agreement_en.html'))) => 'en'); }
/** * Creates (or reuses) a password assistance session, and sends a password * assistance mail to the specified user. * Note: To prevent DOS attacks, a new session is created only, if no session * exists, or if the existing session has been expired. * The password assistance mail contains an URL, which points to this script * and contains the following URL parameters: * client_id * key * @param $email * @param $logins */ public function sendUsernameAssistanceMail($email, array $logins) { require_once 'Services/Mail/classes/class.ilMailbox.php'; require_once 'Services/Mail/classes/class.ilMimeMail.php'; require_once 'include/inc.pwassist_session_handler.php'; $protocol = $this->https->isDetected() ? 'https://' : 'http://'; $server_url = $protocol . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/')) . '/'; $login_url = $server_url . 'pwassist.php' . '?client_id=' . $this->ilias->getClientId() . '&lang=' . $this->lng->getLangKey(); $contact_address = $this->settings->get('admin_email'); $mm = new ilMimeMail(); $mm->Subject($this->lng->txt('pwassist_mail_subject')); $mm->From($contact_address); $mm->To($email); $mm->Body(str_replace(array("\\n", "\\t"), array("\n", "\t"), sprintf($this->lng->txt('pwassist_username_mail_body'), join($logins, ",\n"), $server_url, $_SERVER['REMOTE_ADDR'], $email, 'mailto:' . $contact_address, $login_url))); $mm->Send(); }