public function getAction1() { $hash = $_REQUEST['h']; // Token gueltig? //if ($this->piVars['h'] && ($this->piVars['h']==$this->sendcode || $this->piVars['h']==$this->sendcode_old)) { if (strlen($_REQUEST['h']) > 10 || ($this->piVars['sendcode']==$this->sendcode || $this->piVars['sendcode']==$this->sendcode_old)) { $send=1; } else{ $send=0; } if ($send) { $this->error_email = 0; $this->error_password = 0; $this->error_user_exists = 0; // Ist E-Mail gueltig $con=$GLOBALS['TYPO3_DB']->exec_SELECTquery( '*', 'fe_users', "deleted = 0 AND comments=".$GLOBALS['TYPO3_DB']->fullQuoteStr($hash,'fe_users')."", null, null, null ); if (!filter_var($this->piVars['e'],FILTER_VALIDATE_EMAIL)) $this->error_email = 1; // Existiert der Benutzer schon $email=$this->piVars['e']; if ($this->error_email==0) { $con=$GLOBALS['TYPO3_DB']->exec_SELECTquery( 'uid', 'fe_users', "deleted = 0 AND email=".$GLOBALS['TYPO3_DB']->fullQuoteStr($email,'fe_users')."", null, null, null ); $row=$GLOBALS['TYPO3_DB']->sql_fetch_assoc( $con ); if (!empty($row)) { //$update_tmp=$GLOBALS['TYPO3_DB']->exec_UPDATEquery('fe_users',"deleted = 0 AND email=". $GLOBALS['TYPO3_DB']->fullQuoteStr($email,'fe_users')."", array( 'endtime' => 0)); $this->error_user_exists = 1; } } if ( $this->piVars['p']!=$this->piVars['p2']) { $this->error_password_text='Die beiden Passwörter sind nicht gleich'; $this->error_password = 1; } elseif( strlen($this->piVars['p'])<6 ) { $this->error_password = 1; $this->error_password_text='Das Passwort muss mindestens 6 Zeichen lang sein'; } $this->errors = $this->error_email || $this->error_password || $this->error_user_exists; } if (!$this->errors && $send==1) { return 'registersend';//$this->get_register_send_mail(); } else { return 'register';//$this->get_register_form_1(); } } //$mode = $this->pi_getFFvalue($this->settings, 'mode', 'sDEF'); public function getAction2() { $hash = $_REQUEST['h']; // Token gueltig? //if ($this->piVars['h'] && ($this->piVars['h']==$this->sendcode || $this->piVars['h']==$this->sendcode_old)) { if (strlen($_REQUEST['h']) > 10 || ($this->piVars['sendcode']==$this->sendcode || $this->piVars['sendcode']==$this->sendcode_old)) { $send=1; } else{ $send=0; } // Formular 2 // Felder testen if ($send) $this->error_agb = 0; $this->errors = $this->errors || $this->error_agb ; if (!$this->errors && $send==1) { return 'confirm';//$content = $this->update_register_form_2(); } else { return 'data';//$content = $this->get_register_form_2(); } return $content; } /** * renders fluid template * @param string $template path to fluid-html-template, form: ext/Resources/Private/Templates/*$template* * @param array $parameter key=>value pairs, where key is fluid placeholder {key} in the template * @return string rendered (html-format) template */ private function renderFluid($template, $parameter) { /** * @var \TYPO3\CMS\Fluid\View\StandaloneView $emailView */ $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); $fluidView = $objectManager -> get('TYPO3\\CMS\\Fluid\\View\\StandaloneView'); $extPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey); $templateFile = $extPath . "Resources/Private/Templates/" . $template; $partialOrder = $extPath . "Resources/Private/Partials/"; $fluidView -> setTemplatePathAndFilename($templateFile); $fluidView -> setPartialRootPaths([$partialOrder]); $fluidView -> assignMultiple($parameter); $fluidView -> getRequest() -> setControllerExtensionName("ig_account_create"); return $fluidView -> render("index"); } /* public function getMailText($params = array()) { $params['baseUrl'] = $this->baseurl; //echo $this -> renderFluid("Mail/Index.html", $params); exit; return $this -> renderFluid("Mail/Index.html", $params); } */ function sendmail($email, $password, $hash/*, $valid_to*/) { //$endtime= date("d.m.Y - H:i", $valid_to); $msg = $this->pi_getFFvalue($this->settings, 'email_text', 'thanks'); $msg = str_replace('###USERNAME###',$email,$msg); $msg = str_replace('###PASSWORD###',$password,$msg); $username_password = '
Benutzername: '.htmlspecialchars($email).'
Passwort: '.htmlspecialchars($password).'
'; $msg = str_replace('###USERNAME_PASSWORD###',$username_password,$msg); $msg = str_replace('###LOGIN_LINK###',''.$this->baseurl.'de/login.html',$msg); $msg = str_replace('###CONFIRM_LINK###',''.$this->baseurl.'de/registrieren/bestaetigungsseite.html?tx_igaccountcreate_pi1[send]=1&h='.urlencode($hash).'',$msg); $msg = str_replace('###EMAIL_LINK###',''.$this->pi_getFFvalue($this->settings, 'email_from', 'thanks').'',$msg); // Mail Verschicken $cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance ( "TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer" ); $parseFunc = $GLOBALS ['TSFE']->tmpl->setup ['lib.'] ['parseFunc_RTE.']; $contact = array("Nähcenter Iseli AG", "Oberlandstrasse 17", "3700 Spiez", "Telefon +41 33 654 34 84"); $mail = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Mail\MailMessage::class); $parameter = array( "msg" => $cObj->parseFunc ( $msg, $parseFunc ), "logo" => 'fileadmin/layout/images_layout/naehcenter-iseli.jpg', "contact" => $contact, "baseUrl" => $this->baseurl, ); /*var_dump($parameter); die();*/ $body = $this->renderFluid("Mail/Index.html", $parameter); $mail->setFrom(array($this->pi_getFFvalue($this->settings, 'email_from', 'thanks'))); $mail->setTo(array($email)); $mail->setSubject($this->pi_getFFvalue($this->settings, 'email_subject', 'thanks')); $mail->setBody($body, 'text/html'); $mail->send(); // Debug /* $mail->setTo(array('da@internetgalerie.ch')); $mail->send(); */ /* $this->htmlMail = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_htmlmail'); $this->htmlMail->start(); $this->htmlMail->recipient = $email; $this->htmlMail->subject = $this->pi_getFFvalue($this->settings, 'email_subject', 'thanks'); $this->htmlMail->from_email = $this->pi_getFFvalue($this->settings, 'email_from', 'thanks'); $body = ''.$this->html_head.'
' .$msg. '
'; $this->htmlMail->setHTML( $this->htmlMail->encodeMsg ( $body )); //print('MSG
'.$msg.'
END
'); $this->htmlMail->send($email); */ } function get_register_send_mail() { $email = $this->piVars['e']; $password = $this->piVars['p'];//$this->generatePassword(); $newsletter = intval($this->piVars['newsletter']); $hash= md5($this->secret . $email . strval(time())); // Create User $this->createuser($email, $password, $hash, $newsletter); // Send Mail $this->sendmail($email, $password, $hash); $content = '

'.htmlspecialchars($this->pi_getFFvalue($this->settings, 'ueberschrift_rot', 'thanks')).'

'.$this->parseRTE($this->pi_getFFvalue($this->settings, 'einleitungstext', 'thanks')).'
'; return $content; }