/** * Check View Backend * * @param string $email email address * @return void */ public function checkBeAction($email = null) { $this->view->assign('pid', $this->id); if (GeneralUtility::validEmail($email)) { $body = 'New <b>Test Email</b> from User ' . BackendUtility::getPropertyFromBackendUser('username') . ' (' . GeneralUtility::getIndpEnv('HTTP_HOST') . ')'; $senderEmail = '*****@*****.**'; if (GeneralUtility::validEmail(ConfigurationUtility::getDefaultMailFromAddress())) { $senderEmail = ConfigurationUtility::getDefaultMailFromAddress(); } $this->view->assignMultiple(['issent' => MailUtility::sendPlainMail($email, $senderEmail, 'New Powermail Test Email', $body), 'email' => $email]); } }
/** * Create Field Record * * @param array $form * @param int $pageUid * @param array $field * @param int $formCounter * @param int $pageCounter * @param int $fieldCounter * @return void */ protected function createFieldRecord($form, $pageUid, $field, $formCounter, $pageCounter, $fieldCounter) { $fieldProperties = ['uid' => 0, 'pid' => $this->configuration['save'] === '[samePage]' ? $form['pid'] : (int) $this->configuration['save'], 'pages' => $pageUid, 'title' => $field['title'], 'type' => $this->rewriteFormType($field), 'css' => $this->rewriteStyles($field), 'cruser_id' => BackendUtility::getPropertyFromBackendUser(), 'hidden' => $field['hidden'], 'sorting' => $field['sorting'], 'marker' => $this->getMarker($field), 'settings' => $field['options'], 'path' => $this->getValueIfDefaultLanguage($field, 'path'), 'content_element' => $field['path'], 'text' => $field['value'], 'placeholder' => $field['placeholder'], 'description' => $field['description'], 'prefill_value' => $this->getPrefillValue($field), 'feuser_value' => $this->getValueIfDefaultLanguage($field, 'fe_field'), 'mandatory' => $this->getValueIfDefaultLanguage($field, 'mandatory'), 'validation' => $this->rewriteValidation($field), 'validation_configuration' => $this->rewriteValidationConfiguration($field), 'datepicker_settings' => $this->getDatePickerSettings($field), 'multiselect' => $this->getValueIfDefaultLanguage($field, 'multiple'), 'sender_email' => $this->isSenderEmail($form, $field), 'sender_name' => $this->isSenderName($form, $field), 'tstamp' => time(), 'crdate' => time()]; if ($field['sys_language_uid'] > 0) { $fieldProperties['sys_language_uid'] = $field['sys_language_uid']; $fieldProperties['l10n_parent'] = (int) $this->localizationRelations['field'][$field['l18n_parent']]; } if (!$this->isDryrun()) { $this->getDatabaseConnection()->exec_INSERTquery('tx_powermail_domain_model_fields', $fieldProperties); $fieldProperties['uid'] = $this->getDatabaseConnection()->sql_insert_id(); $this->localizationRelations['field'][$field['uid']] = $fieldProperties['uid']; } $this->result[$formCounter]['_pages'][$pageCounter]['_fields'][$fieldCounter] = $fieldProperties; }
/** * getPropertyFromBackendUser Test * * @param string $property * @param mixed $value * @dataProvider getPropertyFromBackendUserReturnsStringDataProvider * @return void * @test */ public function getPropertyFromBackendUserReturnsString($property, $value) { $GLOBALS['BE_USER']->user[$property] = $value; $this->assertSame($value, BackendUtility::getPropertyFromBackendUser($property)); }