Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function authenticate(TokenInterface $token)
 {
     if (!$this->supports($token)) {
         return null;
     }
     $translator = $this->factory->getTranslator();
     $requestParameters = $token->getRequestParameters();
     $requestMethod = $token->getRequestMethod();
     $requestUrl = $token->getRequestUrl();
     if ($this->serverService->validateRequest($requestParameters, $requestMethod, $requestUrl)) {
         $accessToken = $this->tokenProvider->loadAccessTokenByToken($requestParameters['oauth_token']);
         $user = $accessToken->getUser();
         if (null !== $user) {
             //Recreate token to include user roles in order to be able to avoid CSRF checks with forms
             $token = new OAuthToken($user->getRoles());
             $token->setRequestParameters($requestParameters);
             $token->setRequestMethod($requestMethod);
             $token->setRequestUrl($requestUrl);
             $token->setAuthenticated(true);
             $token->setUser($user);
         }
         return $token;
     }
     throw new AuthenticationException($translator->trans('mautic.api.oauth.auth.failed'));
 }
Exemplo n.º 2
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('site_url', 'text', array('label' => 'mautic.core.config.form.site.url', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.site.url.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('webroot', 'page_list', array('label' => 'mautic.core.config.form.webroot', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.webroot.tooltip', 'data-placeholder' => $this->factory->getTranslator()->trans('mautic.core.config.form.webroot.dashboard')), 'multiple' => false, 'empty_value' => '', 'required' => false));
     $builder->add('cache_path', 'text', array('label' => 'mautic.core.config.form.cache.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.cache.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('log_path', 'text', array('label' => 'mautic.core.config.form.log.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.log.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('image_path', 'text', array('label' => 'mautic.core.config.form.image.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.image.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('theme', 'theme_list', array('label' => 'mautic.core.config.form.theme', 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.page.form.template.help')));
     // Get the list of available languages
     /** @var \Mautic\CoreBundle\Helper\LanguageHelper $languageHelper */
     $languageHelper = $this->factory->getHelper('language');
     $languages = $languageHelper->fetchLanguages(false, false);
     $langChoices = array();
     foreach ($languages as $code => $langData) {
         $langChoices[$code] = $langData['name'];
     }
     $langChoices = array_merge($langChoices, $this->factory->getParameter('supported_languages'));
     // Alpha sort the languages by name
     asort($langChoices);
     $builder->add('locale', 'choice', array('choices' => $langChoices, 'label' => 'mautic.core.config.form.locale', 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.locale.tooltip'), 'empty_value' => false));
     $arrayStringTransformer = new ArrayStringTransformer();
     $builder->add($builder->create('trusted_hosts', 'text', array('label' => 'mautic.core.config.form.trusted.hosts', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.trusted.hosts.tooltip'), 'required' => false))->addViewTransformer($arrayStringTransformer));
     $builder->add($builder->create('trusted_proxies', 'text', array('label' => 'mautic.core.config.form.trusted.proxies', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.trusted.proxies.tooltip'), 'required' => false))->addViewTransformer($arrayStringTransformer));
     $arrayLinebreakTransformer = new ArrayLinebreakTransformer();
     $builder->add($builder->create('do_not_track_ips', 'textarea', array('label' => 'mautic.core.config.form.do_not_track_ips', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.do_not_track_ips.tooltip'), 'required' => false))->addViewTransformer($arrayLinebreakTransformer));
     $builder->add('rememberme_key', 'text', array('label' => 'mautic.core.config.form.rememberme.key', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.rememberme.key.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('rememberme_lifetime', 'text', array('label' => 'mautic.core.config.form.rememberme.lifetime', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.rememberme.lifetime.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('rememberme_path', 'text', array('label' => 'mautic.core.config.form.rememberme.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.rememberme.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('rememberme_domain', 'text', array('label' => 'mautic.core.config.form.rememberme.domain', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.rememberme.domain.tooltip'), 'required' => false));
     $builder->add('default_pagelimit', 'choice', array('choices' => array(5 => 'mautic.core.pagination.5', 10 => 'mautic.core.pagination.10', 15 => 'mautic.core.pagination.15', 20 => 'mautic.core.pagination.20', 25 => 'mautic.core.pagination.25', 30 => 'mautic.core.pagination.30', 50 => 'mautic.core.pagination.50', 100 => 'mautic.core.pagination.100'), 'expanded' => false, 'multiple' => false, 'label' => 'mautic.core.config.form.default.pagelimit', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.default.pagelimit.tooltip'), 'required' => false, 'empty_value' => false));
     $builder->add('default_timezone', 'timezone', array('label' => 'mautic.core.config.form.default.timezone', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.default.timezone.tooltip'), 'multiple' => false, 'empty_value' => 'mautic.user.user.form.defaulttimezone', 'required' => false));
     $builder->add('date_format_full', 'text', array('label' => 'mautic.core.config.form.date.format.full', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.date.format.full.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('date_format_short', 'text', array('label' => 'mautic.core.config.form.date.format.short', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.date.format.short.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('date_format_dateonly', 'text', array('label' => 'mautic.core.config.form.date.format.dateonly', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.date.format.dateonly.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('date_format_timeonly', 'text', array('label' => 'mautic.core.config.form.date.format.timeonly', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.date.format.timeonly.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     // Search for IP Services
     $bundles = $this->factory->getMauticBundles(true);
     $choices = array();
     foreach ($bundles as $bundle) {
         if (isset($bundle['config']['ip_lookup_services'])) {
             foreach ($bundle['config']['ip_lookup_services'] as $service => $details) {
                 $choices[$service] = $details['display_name'];
             }
         }
     }
     natcasesort($choices);
     $builder->add('ip_lookup_service', 'choice', array('choices' => $choices, 'label' => 'mautic.core.config.form.ip.lookup.service', 'label_attr' => array('class' => 'control-label'), 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.ip.lookup.service.tooltip')));
     $builder->add('ip_lookup_auth', 'text', array('label' => 'mautic.core.config.form.ip.lookup.auth', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.ip.lookup.auth.tooltip'), 'required' => false));
     $builder->add('transifex_username', 'text', array('label' => 'mautic.core.config.form.transifex.username', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.transifex.username.tooltip', 'autocomplete' => 'off'), 'required' => false));
     $builder->add('transifex_password', 'password', array('label' => 'mautic.core.config.form.transifex.password', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'placeholder' => 'mautic.user.user.form.passwordplaceholder', 'preaddon' => 'fa fa-lock', 'tooltip' => 'mautic.core.config.form.transifex.password.tooltip', 'autocomplete' => 'off'), 'required' => false));
     $builder->add('update_stability', 'choice', array('choices' => array('alpha' => 'mautic.core.config.update_stability.alpha', 'beta' => 'mautic.core.config.update_stability.beta', 'rc' => 'mautic.core.config.update_stability.rc', 'stable' => 'mautic.core.config.update_stability.stable'), 'label' => 'mautic.core.config.form.update.stability', 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.update.stability.tooltip'), 'empty_value' => false));
     $builder->add('cookie_path', 'text', array('label' => 'mautic.core.config.form.cookie.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.cookie.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('cookie_domain', 'text', array('label' => 'mautic.core.config.form.cookie.domain', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.cookie.domain.tooltip'), 'required' => false));
     $builder->add('cookie_secure', 'yesno_button_group', array('label' => 'mautic.core.config.form.cookie.secure', 'empty_value' => 'mautic.core.form.default', 'data' => array_key_exists('cookie_secure', $options['data']) && !empty($options['data']['cookie_secure']) ? true : false, 'attr' => array('tooltip' => 'mautic.core.config.form.cookie.secure.tooltip')));
     $builder->add('cookie_httponly', 'yesno_button_group', array('label' => 'mautic.core.config.form.cookie.httponly', 'data' => array_key_exists('cookie_httponly', $options['data']) && !empty($options['data']['cookie_httponly']) ? true : false, 'attr' => array('tooltip' => 'mautic.core.config.form.cookie.httponly.tooltip')));
 }
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $model = $this->factory->getModel('lead.list');
     $lists = $model->getUserLists();
     $segments = [];
     $segments[0] = $this->factory->getTranslator()->trans('mautic.lead.all.leads');
     foreach ($lists as $list) {
         $segments[$list['id']] = $list['name'];
     }
     $builder->add('flag', 'choice', ['label' => 'mautic.lead.list.filter', 'multiple' => true, 'choices' => $segments, 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'required' => false]);
 }
Exemplo n.º 4
0
 /**
  * Extracts a downloaded package for the specified language
  *
  * This will attempt to download the package if it is not found
  *
  * @param $languageCode
  *
  * @return array
  */
 public function extractLanguagePackage($languageCode)
 {
     $packagePath = $this->factory->getSystemPath('cache') . '/' . $languageCode . '.zip';
     $translator = $this->factory->getTranslator();
     // Make sure the package actually exists
     if (!file_exists($packagePath)) {
         // Let's try to fetch it
         $result = $this->fetchPackage($languageCode);
         // If there was a failure, there's nothing else we can do here
         if ($result['error']) {
             return $result;
         }
     }
     $zipper = new \ZipArchive();
     $archive = $zipper->open($packagePath);
     if ($archive !== true) {
         // Get the exact error
         switch ($archive) {
             case \ZipArchive::ER_EXISTS:
                 $error = 'mautic.core.update.archive_file_exists';
                 break;
             case \ZipArchive::ER_INCONS:
             case \ZipArchive::ER_INVAL:
             case \ZipArchive::ER_MEMORY:
                 $error = 'mautic.core.update.archive_zip_corrupt';
                 break;
             case \ZipArchive::ER_NOENT:
                 $error = 'mautic.core.update.archive_no_such_file';
                 break;
             case \ZipArchive::ER_NOZIP:
                 $error = 'mautic.core.update.archive_not_valid_zip';
                 break;
             case \ZipArchive::ER_READ:
             case \ZipArchive::ER_SEEK:
             case \ZipArchive::ER_OPEN:
             default:
                 $error = 'mautic.core.update.archive_could_not_open';
                 break;
         }
         return array('error' => true, 'message' => $error);
     }
     // Extract the archive file now
     $zipper->extractTo($this->factory->getSystemPath('translations_root') . '/translations');
     $zipper->close();
     // We can remove the package now
     @unlink($packagePath);
     return array('error' => false, 'message' => 'mautic.core.language.helper.language.saved.successfully');
 }
Exemplo n.º 5
0
 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->translator = $factory->getTranslator();
     /** @var \Mautic\LeadBundle\Model\ListModel $listModel */
     $listModel = $factory->getModel('lead.list');
     $this->fieldChoices = $listModel->getChoiceFields();
     // Locales
     $this->timezoneChoices = FormFieldHelper::getTimezonesChoices();
     $this->countryChoices = FormFieldHelper::getCountryChoices();
     $this->regionChoices = FormFieldHelper::getRegionChoices();
     // Segments
     $lists = $listModel->getUserLists();
     foreach ($lists as $list) {
         $this->listChoices[$list['id']] = $list['name'];
     }
     // Emails
     /** @var \Mautic\EmailBundle\Model\EmailModel $emailModel */
     $emailModel = $factory->getModel('email');
     $viewOther = $factory->getSecurity()->isGranted('email:emails:viewother');
     $emails = $emailModel->getRepository()->getEmailList('', 0, 0, $viewOther, true);
     foreach ($emails as $email) {
         $this->emailChoices[$email['language']][$email['id']] = $email['name'];
     }
     ksort($this->emailChoices);
     // Tags
     $leadModel = $factory->getModel('lead');
     $tags = $leadModel->getTagList();
     foreach ($tags as $tag) {
         $this->tagChoices[$tag['value']] = $tag['label'];
     }
 }
Exemplo n.º 6
0
 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->translator = $factory->getTranslator();
     $this->validator = $factory->getValidator();
     $this->apiMode = $factory->getRequest()->get('api_mode', $factory->getSession()->get('mautic.client.filter.api_mode', 'oauth1a'));
     $this->router = $factory->getRouter();
 }
Exemplo n.º 7
0
 /**
  * Match lead data with integration fields
  *
  * @param $lead
  * @param $config
  *
  * @return array
  */
 public function populateLeadData($lead, $config = array())
 {
     if (!isset($config['leadFields'])) {
         $config = $this->mergeConfigToFeatureSettings($config);
         if (empty($config['leadFields'])) {
             return array();
         }
     }
     if ($lead instanceof Lead) {
         $fields = $lead->getFields(true);
     } else {
         $fields = $lead;
     }
     $leadFields = $config['leadFields'];
     $availableFields = $this->getAvailableLeadFields($config);
     $unknown = $this->factory->getTranslator()->trans('mautic.integration.form.lead.unknown');
     $matched = array();
     foreach ($availableFields as $key => $field) {
         $integrationKey = $this->convertLeadFieldKey($key, $field);
         if (isset($leadFields[$key])) {
             $mauticKey = $leadFields[$key];
             if (isset($fields[$mauticKey]) && !empty($fields[$mauticKey]['value'])) {
                 $matched[$integrationKey] = $fields[$mauticKey]['value'];
             }
         }
         if (!empty($field['required']) && empty($matched[$integrationKey])) {
             $matched[$integrationKey] = $unknown;
         }
     }
     return $matched;
 }
Exemplo n.º 8
0
 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->translator = $factory->getTranslator();
     $this->defaultTheme = $factory->getParameter('theme');
     $this->em = $factory->getEntityManager();
     $this->request = $factory->getRequest();
 }
Exemplo n.º 9
0
 /**
  * Determines the winner of A/B test based on dwell time rates
  *
  * @param MauticFactory $factory
  * @param Page          $parent
  * @param               $children
  *
  * @return array
  */
 public static function determineDwellTimeTestWinner($factory, $parent, $children)
 {
     //find the hits that did not go any further
     $repo = $factory->getEntityManager()->getRepository('MauticPageBundle:Hit');
     $pageIds = array($parent->getId());
     foreach ($children as $c) {
         $pageIds[] = $c->getId();
     }
     $startDate = $parent->getVariantStartDate();
     if ($startDate != null && !empty($pageIds)) {
         //get their bounce rates
         $counts = $repo->getDwellTimes(array('pageIds' => $pageIds, 'startDate' => $startDate));
         $translator = $factory->getTranslator();
         $support = array();
         if ($counts) {
             //in order to get a fair grade, we have to compare the averages here since a page that is only shown
             //25% of the time will have a significantly lower sum than a page shown 75% of the time
             $avgs = array();
             $support['data'] = array();
             $support['labels'] = array();
             foreach ($counts as $pid => $stats) {
                 $avgs[$pid] = $stats['average'];
                 $support['data'][$translator->trans('mautic.page.abtest.label.dewlltime.average')][] = $stats['average'];
                 $support['labels'][] = $pid . ':' . $stats['title'];
             }
             //set max for scales
             $max = max($avgs);
             $support['step_width'] = ceil($max / 10) * 10;
             //get the page ids with the greatest average dwell time
             $winners = $max > 0 ? array_keys($avgs, $max) : array();
             return array('winners' => $winners, 'support' => $support, 'basedOn' => 'page.dwelltime', 'supportTemplate' => 'MauticPageBundle:SubscribedEvents\\AbTest:bargraph.html.php');
         }
     }
     return array('winners' => array(), 'support' => array(), 'basedOn' => 'page.dwelltime');
 }
Exemplo n.º 10
0
 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->em = $factory->getEntityManager();
     $this->translator = $factory->getTranslator();
     $this->model = $factory->getModel('category');
     $this->router = $factory->getRouter();
 }
Exemplo n.º 11
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('unsubscribe_text', 'textarea', array('label' => 'mautic.email.config.unsubscribe_text', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.email.config.unsubscribe_text.tooltip'), 'required' => false, 'data' => array_key_exists('unsubscribe_text', $options['data']) && !empty($options['data']['unsubscribe_text']) ? $options['data']['unsubscribe_text'] : $this->factory->getTranslator()->trans('mautic.email.unsubscribe.text', array('%link%' => '|URL|'))));
     $builder->add('webview_text', 'textarea', array('label' => 'mautic.email.config.webview_text', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.email.config.webview_text.tooltip'), 'required' => false, 'data' => array_key_exists('webview_text', $options['data']) && !empty($options['data']['webview_text']) ? $options['data']['webview_text'] : $this->factory->getTranslator()->trans('mautic.email.webview.text', array('%link%' => '|URL|'))));
     $builder->add('unsubscribe_message', 'textarea', array('label' => 'mautic.email.config.unsubscribe_message', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.email.config.unsubscribe_message.tooltip'), 'required' => false, 'data' => array_key_exists('unsubscribe_message', $options['data']) && !empty($options['data']['unsubscribe_message']) ? $options['data']['unsubscribe_message'] : $this->factory->getTranslator()->trans('mautic.email.unsubscribed.success', array('%resubscribeUrl%' => '|URL|', '%email%' => '|EMAIL|'))));
     $builder->add('resubscribe_message', 'textarea', array('label' => 'mautic.email.config.resubscribe_message', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.email.config.resubscribe_message.tooltip'), 'required' => false, 'data' => array_key_exists('resubscribe_message', $options['data']) && !empty($options['data']['resubscribe_message']) ? $options['data']['resubscribe_message'] : $this->factory->getTranslator()->trans('mautic.email.resubscribed.success', array('%unsubscribeUrl%' => '|URL|', '%email%' => '|EMAIL|'))));
     $builder->add('mailer_from_name', 'text', array('label' => 'mautic.email.config.mailer.from.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.email.config.mailer.from.name.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('mailer_from_email', 'text', array('label' => 'mautic.email.config.mailer.from.email', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.email.config.mailer.from.email.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.email.required')), new Email(array('message' => 'mautic.core.email.required')))));
     $builder->add('mailer_return_path', 'text', array('label' => 'mautic.email.config.mailer.return.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.email.config.mailer.return.path.tooltip'), 'required' => false));
     $builder->add('mailer_transport', 'choice', array('choices' => array('mail' => 'mautic.email.config.mailer_transport.mail', 'mautic.transport.mandrill' => 'mautic.email.config.mailer_transport.mandrill', 'mautic.transport.sendgrid' => 'mautic.email.config.mailer_transport.sendgrid', 'mautic.transport.amazon' => 'mautic.email.config.mailer_transport.amazon', 'mautic.transport.postmark' => 'mautic.email.config.mailer_transport.postmark', 'gmail' => 'mautic.email.config.mailer_transport.gmail', 'sendmail' => 'mautic.email.config.mailer_transport.sendmail', 'smtp' => 'mautic.email.config.mailer_transport.smtp'), 'label' => 'mautic.email.config.mailer.transport', 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.email.config.mailer.transport.tooltip'), 'empty_value' => false));
     $smtpServiceShowConditions = '{"config_emailconfig_mailer_transport":["smtp"]}';
     $builder->add('mailer_host', 'text', array('label' => 'mautic.email.config.mailer.host', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-show-on' => $smtpServiceShowConditions, 'tooltip' => 'mautic.email.config.mailer.host.tooltip'), 'required' => false));
     $builder->add('mailer_port', 'text', array('label' => 'mautic.email.config.mailer.port', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-show-on' => $smtpServiceShowConditions, 'tooltip' => 'mautic.email.config.mailer.port.tooltip'), 'required' => false));
     $mailerLoginShowConditions = '{
         "config_emailconfig_mailer_auth_mode":[
             "plain",
             "login",
             "cram-md5"
         ], "config_emailconfig_mailer_transport":[
             "mautic.transport.mandrill",
             "mautic.transport.sendgrid",
             "mautic.transport.amazon",
             "mautic.transport.postmark",
             "gmail"
         ]
     }';
     $mailerLoginHideConditions = '{
      "config_emailconfig_mailer_transport":[
             "mail",
             "sendmail"
         ]
     }';
     $builder->add('mailer_auth_mode', 'choice', array('choices' => array('plain' => 'mautic.email.config.mailer_auth_mode.plain', 'login' => 'mautic.email.config.mailer_auth_mode.login', 'cram-md5' => 'mautic.email.config.mailer_auth_mode.cram-md5'), 'label' => 'mautic.email.config.mailer.auth.mode', 'label_attr' => array('class' => 'control-label'), 'required' => false, 'attr' => array('class' => 'form-control', 'data-show-on' => $smtpServiceShowConditions, 'tooltip' => 'mautic.email.config.mailer.auth.mode.tooltip'), 'empty_value' => 'mautic.email.config.mailer_auth_mode.none'));
     $builder->add('mailer_user', 'text', array('label' => 'mautic.email.config.mailer.user', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-show-on' => $mailerLoginShowConditions, 'data-hide-on' => $mailerLoginHideConditions, 'tooltip' => 'mautic.email.config.mailer.user.tooltip', 'autocomplete' => 'off'), 'required' => false));
     $builder->add('mailer_password', 'password', array('label' => 'mautic.email.config.mailer.password', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'placeholder' => 'mautic.user.user.form.passwordplaceholder', 'preaddon' => 'fa fa-lock', 'data-show-on' => $mailerLoginShowConditions, 'data-hide-on' => $mailerLoginHideConditions, 'tooltip' => 'mautic.email.config.mailer.password.tooltip', 'autocomplete' => 'off'), 'required' => false));
     $builder->add('mailer_encryption', 'choice', array('choices' => array('ssl' => 'mautic.email.config.mailer_encryption.ssl', 'tls' => 'mautic.email.config.mailer_encryption.tls'), 'label' => 'mautic.email.config.mailer.encryption', 'required' => false, 'attr' => array('class' => 'form-control', 'data-show-on' => $smtpServiceShowConditions, 'tooltip' => 'mautic.email.config.mailer.encryption.tooltip'), 'empty_value' => 'mautic.email.config.mailer_encryption.none'));
     $builder->add('mailer_test_connection_button', 'standalone_button', array('label' => 'mautic.email.config.mailer.transport.test_connection', 'required' => false, 'attr' => array('class' => 'btn btn-success', 'onclick' => 'Mautic.testEmailServerConnection()')));
     $builder->add('mailer_test_send_button', 'standalone_button', array('label' => 'mautic.email.config.mailer.transport.test_send', 'required' => false, 'attr' => array('class' => 'btn btn-info', 'onclick' => 'Mautic.testEmailServerConnection(true)')));
     $spoolConditions = '{"config_emailconfig_mailer_spool_type":["memory"]}';
     $builder->add('mailer_spool_type', 'choice', array('choices' => array('memory' => 'mautic.email.config.mailer_spool_type.memory', 'file' => 'mautic.email.config.mailer_spool_type.file'), 'label' => 'mautic.email.config.mailer.spool.type', 'label_attr' => array('class' => 'control-label'), 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.email.config.mailer.spool.type.tooltip'), 'empty_value' => false));
     $builder->add('mailer_spool_path', 'text', array('label' => 'mautic.email.config.mailer.spool.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-hide-on' => $spoolConditions, 'tooltip' => 'mautic.email.config.mailer.spool.path.tooltip'), 'required' => false));
     $builder->add('mailer_spool_msg_limit', 'text', array('label' => 'mautic.email.config.mailer.spool.msg.limit', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-hide-on' => $spoolConditions, 'tooltip' => 'mautic.email.config.mailer.spool.msg.limit.tooltip'), 'required' => false));
     $builder->add('mailer_spool_time_limit', 'text', array('label' => 'mautic.email.config.mailer.spool.time.limit', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-hide-on' => $spoolConditions, 'tooltip' => 'mautic.email.config.mailer.spool.time.limit.tooltip'), 'required' => false));
     $builder->add('mailer_spool_recover_timeout', 'text', array('label' => 'mautic.email.config.mailer.spool.recover.timeout', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-hide-on' => $spoolConditions, 'tooltip' => 'mautic.email.config.mailer.spool.recover.timeout.tooltip'), 'required' => false));
     $builder->add('mailer_spool_clear_timeout', 'text', array('label' => 'mautic.email.config.mailer.spool.clear.timeout', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-hide-on' => $spoolConditions, 'tooltip' => 'mautic.email.config.mailer.spool.clear.timeout.tooltip'), 'required' => false));
     $builder->add('monitored_email', 'monitored_email', array('label' => false, 'data' => array_key_exists('monitored_email', $options['data']) ? $options['data']['monitored_email'] : array(), 'required' => false));
 }
Exemplo n.º 12
0
 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->em = $factory->getEntityManager();
     $this->security = $factory->getSecurity();
     $this->dispatcher = $factory->getDispatcher();
     $this->translator = $factory->getTranslator();
     $this->factory = $factory;
 }
Exemplo n.º 13
0
 /**
  * @param MauticFactory $factory
  *
  * @throws \RuntimeException if the mcrypt extension is not enabled
  */
 public function __construct(MauticFactory $factory)
 {
     // Toss an Exception back if mcrypt is not found
     if (!extension_loaded('mcrypt')) {
         throw new \RuntimeException($factory->getTranslator()->trans('mautic.core.error.no.mcrypt'));
     }
     $this->key = $factory->getParameter('secret_key');
 }
Exemplo n.º 14
0
 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->translator = $factory->getTranslator();
     $this->em = $factory->getEntityManager();
     $this->model = $factory->getModel('page');
     $this->canViewOther = $factory->getSecurity()->isGranted('page:pages:viewother');
     $this->user = $factory->getUser();
 }
Exemplo n.º 15
0
 /**
  * Handle bounces & complaints from Amazon.
  *
  * @param Request       $request
  * @param MauticFactory $factory
  *
  * @return mixed
  */
 public function handleCallbackResponse(Request $request, MauticFactory $factory)
 {
     $translator = $factory->getTranslator();
     $logger = $factory->getLogger();
     $logger->debug('Receiving webhook from Amazon');
     $payload = json_decode($request->getContent(), true);
     return $this->processJsonPayload($payload, $logger, $translator);
 }
 /**
  * DynamicContentFilterEntryFiltersType constructor.
  *
  * @param MauticFactory $factory
  * @param ListModel     $listModel
  */
 public function __construct(MauticFactory $factory, ListModel $listModel)
 {
     $operatorChoices = $listModel->getFilterExpressionFunctions();
     foreach ($operatorChoices as $key => $value) {
         if (empty($value['hide'])) {
             $this->operatorChoices[$key] = $value['label'];
         }
     }
     $this->translator = $factory->getTranslator();
 }
Exemplo n.º 17
0
 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->factory = $factory;
     $this->templating = $factory->getTemplating();
     $this->request = $factory->getRequest();
     $this->security = $factory->getSecurity();
     $this->serializer = $factory->getSerializer();
     $this->params = $factory->getSystemParameters();
     $this->dispatcher = $factory->getDispatcher();
     $this->translator = $factory->getTranslator();
     $this->init();
 }
Exemplo n.º 18
0
 /**
  * @param Form          $form
  * @param Asset         $asset
  * @param MauticFactory $factory
  * @param               $message
  * @param               $messageMode
  *
  * @return RedirectResponse|Response
  */
 public static function downloadFile(Form $form, Asset $asset, MauticFactory $factory, $message, $messengerMode)
 {
     /** @var \Mautic\AssetBundle\Model\AssetModel $model */
     $model = $factory->getModel('asset');
     $url = $model->generateUrl($asset, true, array('form', $form->getId()));
     if ($messengerMode) {
         return array('download' => $url);
     }
     $msg = $message . $factory->getTranslator()->trans('mautic.asset.asset.submitaction.downloadfile.msg', array('%url%' => $url));
     $content = $factory->getTemplating()->renderResponse('MauticCoreBundle::message.html.php', array('message' => $msg, 'type' => 'notice', 'template' => $factory->getParameter('theme')))->getContent();
     return new Response($content);
 }
Exemplo n.º 19
0
 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     /** @var \Mautic\LeadBundle\Model\ListModel $listModel */
     $listModel = $factory->getModel('lead.list');
     $operatorChoices = $listModel->getFilterExpressionFunctions();
     $this->operatorChoices = array();
     foreach ($operatorChoices as $key => $value) {
         if (empty($value['hide'])) {
             $this->operatorChoices[$key] = $value['label'];
         }
     }
     $this->translator = $factory->getTranslator();
 }
Exemplo n.º 20
0
 /**
  * @param        $message
  * @param array  $messageVars
  * @param string $domain
  * @param null   $title
  * @param null   $icon
  * @param bool   $addNotification
  * @param string $type
  */
 public function addBrowserNotification($message, $messageVars = array(), $domain = 'flashes', $title = null, $icon = null, $addNotification = true, $type = 'notice')
 {
     if ($domain == null) {
         $domain = 'flashes';
     }
     $translator = $this->factory->getTranslator();
     if ($domain === false) {
         //message is already translated
         $translatedMessage = $message;
     } else {
         if (isset($messageVars['pluralCount'])) {
             $translatedMessage = $translator->transChoice($message, $messageVars['pluralCount'], $messageVars, $domain);
         } else {
             $translatedMessage = $translator->trans($message, $messageVars, $domain);
         }
     }
     if ($title !== null) {
         $title = $translator->trans($title);
     } else {
         $title = 'Mautic';
     }
     if ($icon == null) {
         $icon = 'media/images/favicon.ico';
     }
     if (strpos($icon, 'http') !== 0) {
         $assetHelper = $this->factory->getHelper('template.assets');
         $icon = $assetHelper->getUrl($icon, null, null, true);
     }
     $session = $this->factory->getSession();
     $browserNotifications = $session->get('mautic.browser.notifications', array());
     $browserNotifications[] = array('message' => $translatedMessage, 'title' => $title, 'icon' => $icon);
     $session->set('mautic.browser.notifications', $browserNotifications);
     if (!defined('MAUTIC_INSTALLER') && $addNotification) {
         switch ($type) {
             case 'warning':
                 $iconClass = "text-warning fa-exclamation-triangle";
                 break;
             case 'error':
                 $iconClass = "text-danger fa-exclamation-circle";
                 break;
             case 'notice':
                 $iconClass = "fa-info-circle";
             default:
                 break;
         }
         //If the user has not interacted with the browser for the last 30 seconds, consider the message unread
         $lastActive = $this->request->get('mauticUserLastActive', 0);
         $isRead = $lastActive > 30 ? 0 : 1;
         $this->addNotification($translatedMessage, null, $isRead, null, $iconClass);
     }
 }
Exemplo n.º 21
0
 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     /** @var \Mautic\LeadBundle\Model\ListModel $listModel */
     $listModel = $factory->getModel('lead.list');
     $operatorChoices = $listModel->getFilterExpressionFunctions();
     $this->operatorChoices = [];
     foreach ($operatorChoices as $key => $value) {
         if (empty($value['hide'])) {
             $this->operatorChoices[$key] = $value['label'];
         }
     }
     $this->translator = $factory->getTranslator();
     $this->currentListId = $factory->getRequest()->attributes->get('objectId', false);
 }
Exemplo n.º 22
0
 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->translator = $factory->getTranslator();
     $this->defaultTheme = $factory->getParameter('theme');
     $this->em = $factory->getEntityManager();
     $this->request = $factory->getRequest();
     $this->countryChoices = FormFieldHelper::getCountryChoices();
     $this->regionChoices = FormFieldHelper::getRegionChoices();
     $this->timezoneChoices = FormFieldHelper::getTimezonesChoices();
     $this->localeChoices = FormFieldHelper::getLocaleChoices();
     $stages = $factory->getModel('stage')->getRepository()->getSimpleList();
     foreach ($stages as $stage) {
         $this->stageChoices[$stage['value']] = $stage['label'];
     }
 }
Exemplo n.º 23
0
 /**
  * @param Form          $form
  * @param Asset         $asset
  * @param MauticFactory $factory
  * @param               $message
  * @param               $messageMode
  *
  * @return RedirectResponse|Response
  */
 public static function downloadFile(Form $form, Asset $asset, MauticFactory $factory, $message, $messengerMode)
 {
     /** @var \Mautic\AssetBundle\Model\AssetModel $model */
     $model = $factory->getModel('asset');
     $url = $model->generateUrl($asset, true, ['form', $form->getId()]);
     if ($messengerMode) {
         return ['download' => $url];
     }
     $msg = $message . $factory->getTranslator()->trans('mautic.asset.asset.submitaction.downloadfile.msg', ['%url%' => $url]);
     $analytics = $factory->getHelper('template.analytics')->getCode();
     if (!empty($analytics)) {
         $factory->getHelper('template.assets')->addCustomDeclaration($analytics);
     }
     $logicalName = $factory->getHelper('theme')->checkForTwigTemplate(':' . $factory->getParameter('theme') . ':message.html.php');
     $content = $factory->getTemplating()->renderResponse($logicalName, ['message' => $msg, 'type' => 'notice', 'template' => $factory->getParameter('theme')])->getContent();
     return new Response($content);
 }
Exemplo n.º 24
0
 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->translator = $factory->getTranslator();
     $this->em = $factory->getEntityManager();
     $this->model = $factory->getModel('user');
     // Get the list of available languages
     /** @var \Mautic\CoreBundle\Helper\LanguageHelper $languageHelper */
     $languageHelper = $factory->getHelper('language');
     $languages = $languageHelper->fetchLanguages(false, false);
     $langChoices = array();
     foreach ($languages as $code => $langData) {
         $langChoices[$code] = $langData['name'];
     }
     $langChoices = array_merge($langChoices, $factory->getParameter('supported_languages'));
     // Alpha sort the languages by name
     asort($langChoices);
     $this->supportedLanguages = $langChoices;
 }
Exemplo n.º 25
0
 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->translator = $factory->getTranslator();
     /** @var \Mautic\LeadBundle\Model\ListModel $listModel */
     $listModel = $factory->getModel('lead.list');
     $this->fieldChoices = $listModel->getChoiceFields();
     $this->timezoneChoices = FormFieldHelper::getTimezonesChoices();
     $this->countryChoices = FormFieldHelper::getCountryChoices();
     $this->regionChoices = FormFieldHelper::getRegionChoices();
     $lists = $listModel->getUserLists();
     $this->listChoices = array();
     foreach ($lists as $list) {
         $this->listChoices[$list['id']] = $list['name'];
     }
     $leadModel = $factory->getModel('lead');
     $tags = $leadModel->getTagList();
     foreach ($tags as $tag) {
         $this->tagChoices[$tag['value']] = $tag['label'];
     }
 }
Exemplo n.º 26
0
 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->translator = $factory->getTranslator();
     $this->dispatcher = $factory->getDispatcher();
 }
Exemplo n.º 27
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('site_url', 'text', array('label' => 'mautic.core.config.form.site.url', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.site.url.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('webroot', 'page_list', array('label' => 'mautic.core.config.form.webroot', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.webroot.tooltip', 'data-placeholder' => $this->factory->getTranslator()->trans('mautic.core.config.form.webroot.dashboard')), 'multiple' => false, 'empty_value' => '', 'required' => false));
     $builder->add('cache_path', 'text', array('label' => 'mautic.core.config.form.cache.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.cache.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('log_path', 'text', array('label' => 'mautic.core.config.form.log.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.log.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('image_path', 'text', array('label' => 'mautic.core.config.form.image.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.image.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('theme', 'theme_list', array('label' => 'mautic.core.config.form.theme', 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.page.form.template.help')));
     $builder->add('mailer_from_name', 'text', array('label' => 'mautic.core.config.form.mailer.from.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.mailer.from.name.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('mailer_from_email', 'text', array('label' => 'mautic.core.config.form.mailer.from.email', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.mailer.from.email.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.email.required')), new Email(array('message' => 'mautic.core.email.required')))));
     $builder->add('mailer_return_path', 'text', array('label' => 'mautic.core.config.form.mailer.return.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.mailer.return.path.tooltip'), 'required' => false));
     $builder->add('mailer_transport', 'choice', array('choices' => array('mail' => 'mautic.core.config.mailer_transport.mail', 'mautic.transport.mandrill' => 'mautic.core.config.mailer_transport.mandrill', 'mautic.transport.sendgrid' => 'mautic.core.config.mailer_transport.sendgrid', 'mautic.transport.amazon' => 'mautic.core.config.mailer_transport.amazon', 'mautic.transport.postmark' => 'mautic.core.config.mailer_transport.postmark', 'gmail' => 'mautic.core.config.mailer_transport.gmail', 'sendmail' => 'mautic.core.config.mailer_transport.sendmail', 'smtp' => 'mautic.core.config.mailer_transport.smtp'), 'label' => 'mautic.core.config.form.mailer.transport', 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.mailer.transport.tooltip'), 'empty_value' => false));
     $smtpServiceShowConditions = '{"config_coreconfig_mailer_transport":["smtp"]}';
     $builder->add('mailer_host', 'text', array('label' => 'mautic.core.config.form.mailer.host', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-show-on' => $smtpServiceShowConditions, 'tooltip' => 'mautic.core.config.form.mailer.host.tooltip'), 'required' => false));
     $builder->add('mailer_port', 'text', array('label' => 'mautic.core.config.form.mailer.port', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-show-on' => $smtpServiceShowConditions, 'tooltip' => 'mautic.core.config.form.mailer.port.tooltip'), 'required' => false));
     $mailerLoginShowConditions = '{
         "config_coreconfig_mailer_auth_mode":[
             "plain",
             "login",
             "cram-md5"
         ], "config_coreconfig_mailer_transport":[
             "mautic.transport.mandrill",
             "mautic.transport.sendgrid",
             "mautic.transport.amazon",
             "mautic.transport.postmark",
             "gmail"
         ]
     }';
     $mailerLoginHideConditions = '{
      "config_coreconfig_mailer_transport":[
             "mail",
             "sendmail"
         ]
     }';
     $builder->add('mailer_auth_mode', 'choice', array('choices' => array('plain' => 'mautic.core.config.mailer_auth_mode.plain', 'login' => 'mautic.core.config.mailer_auth_mode.login', 'cram-md5' => 'mautic.core.config.mailer_auth_mode.cram-md5'), 'label' => 'mautic.core.config.form.mailer.auth.mode', 'label_attr' => array('class' => 'control-label'), 'required' => false, 'attr' => array('class' => 'form-control', 'data-show-on' => $smtpServiceShowConditions, 'tooltip' => 'mautic.core.config.form.mailer.auth.mode.tooltip'), 'empty_value' => 'mautic.core.config.mailer_auth_mode.none'));
     $builder->add('mailer_user', 'text', array('label' => 'mautic.core.config.form.mailer.user', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-show-on' => $mailerLoginShowConditions, 'data-hide-on' => $mailerLoginHideConditions, 'tooltip' => 'mautic.core.config.form.mailer.user.tooltip', 'autocomplete' => 'off'), 'required' => false));
     $builder->add('mailer_password', 'password', array('label' => 'mautic.core.config.form.mailer.password', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'placeholder' => 'mautic.user.user.form.passwordplaceholder', 'preaddon' => 'fa fa-lock', 'data-show-on' => $mailerLoginShowConditions, 'data-hide-on' => $mailerLoginHideConditions, 'tooltip' => 'mautic.core.config.form.mailer.password.tooltip', 'autocomplete' => 'off'), 'required' => false));
     $builder->add('mailer_encryption', 'choice', array('choices' => array('ssl' => 'mautic.core.config.mailer_encryption.ssl', 'tls' => 'mautic.core.config.mailer_encryption.tls'), 'label' => 'mautic.core.config.form.mailer.encryption', 'required' => false, 'attr' => array('class' => 'form-control', 'data-show-on' => $smtpServiceShowConditions, 'tooltip' => 'mautic.core.config.form.mailer.encryption.tooltip'), 'empty_value' => 'mautic.core.config.mailer_encryption.none'));
     $builder->add('mailer_test_connection_button', 'standalone_button', array('label' => 'mautic.core.config.form.mailer.transport.test_connection', 'required' => false, 'attr' => array('class' => 'btn btn-success', 'onclick' => 'Mautic.testEmailServerConnection()')));
     $builder->add('mailer_test_send_button', 'standalone_button', array('label' => 'mautic.core.config.form.mailer.transport.test_send', 'required' => false, 'attr' => array('class' => 'btn btn-info', 'onclick' => 'Mautic.testEmailServerConnection(true)')));
     $spoolConditions = '{"config_coreconfig_mailer_spool_type":["memory"]}';
     $builder->add('mailer_spool_type', 'choice', array('choices' => array('memory' => 'mautic.core.config.mailer_spool_type.memory', 'file' => 'mautic.core.config.mailer_spool_type.file'), 'label' => 'mautic.core.config.form.mailer.spool.type', 'label_attr' => array('class' => 'control-label'), 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.mailer.spool.type.tooltip'), 'empty_value' => false));
     $builder->add('mailer_spool_path', 'text', array('label' => 'mautic.core.config.form.mailer.spool.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-hide-on' => $spoolConditions, 'tooltip' => 'mautic.core.config.form.mailer.spool.path.tooltip'), 'required' => false));
     $builder->add('mailer_spool_msg_limit', 'text', array('label' => 'mautic.core.config.form.mailer.spool.msg.limit', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-hide-on' => $spoolConditions, 'tooltip' => 'mautic.core.config.form.mailer.spool.msg.limit.tooltip'), 'required' => false));
     $builder->add('mailer_spool_time_limit', 'text', array('label' => 'mautic.core.config.form.mailer.spool.time.limit', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-hide-on' => $spoolConditions, 'tooltip' => 'mautic.core.config.form.mailer.spool.time.limit.tooltip'), 'required' => false));
     $builder->add('mailer_spool_recover_timeout', 'text', array('label' => 'mautic.core.config.form.mailer.spool.recover.timeout', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-hide-on' => $spoolConditions, 'tooltip' => 'mautic.core.config.form.mailer.spool.recover.timeout.tooltip'), 'required' => false));
     $builder->add('mailer_spool_clear_timeout', 'text', array('label' => 'mautic.core.config.form.mailer.spool.clear.timeout', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-hide-on' => $spoolConditions, 'tooltip' => 'mautic.core.config.form.mailer.spool.clear.timeout.tooltip'), 'required' => false));
     // Get the list of available languages
     /** @var \Mautic\CoreBundle\Helper\LanguageHelper $languageHelper */
     $languageHelper = $this->factory->getHelper('language');
     $languages = $languageHelper->fetchLanguages(false, false);
     $langChoices = array();
     foreach ($languages as $code => $langData) {
         $langChoices[$code] = $langData['name'];
     }
     $langChoices = array_merge($langChoices, $this->factory->getParameter('supported_languages'));
     // Alpha sort the languages by name
     asort($langChoices);
     $builder->add('locale', 'choice', array('choices' => $langChoices, 'label' => 'mautic.core.config.form.locale', 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.locale.tooltip'), 'empty_value' => false));
     $arrayStringTransformer = new ArrayStringTransformer();
     $builder->add($builder->create('trusted_hosts', 'text', array('label' => 'mautic.core.config.form.trusted.hosts', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.trusted.hosts.tooltip'), 'required' => false))->addViewTransformer($arrayStringTransformer));
     $builder->add($builder->create('trusted_proxies', 'text', array('label' => 'mautic.core.config.form.trusted.proxies', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.trusted.proxies.tooltip'), 'required' => false))->addViewTransformer($arrayStringTransformer));
     $arrayLinebreakTransformer = new ArrayLinebreakTransformer();
     $builder->add($builder->create('do_not_track_ips', 'textarea', array('label' => 'mautic.core.config.form.do_not_track_ips', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.do_not_track_ips.tooltip'), 'required' => false))->addViewTransformer($arrayLinebreakTransformer));
     $builder->add('rememberme_key', 'text', array('label' => 'mautic.core.config.form.rememberme.key', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.rememberme.key.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('rememberme_lifetime', 'text', array('label' => 'mautic.core.config.form.rememberme.lifetime', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.rememberme.lifetime.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('rememberme_path', 'text', array('label' => 'mautic.core.config.form.rememberme.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.rememberme.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('rememberme_domain', 'text', array('label' => 'mautic.core.config.form.rememberme.domain', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.rememberme.domain.tooltip'), 'required' => false));
     $builder->add('default_pagelimit', 'choice', array('choices' => array(5 => 'mautic.core.pagination.5', 10 => 'mautic.core.pagination.10', 15 => 'mautic.core.pagination.15', 20 => 'mautic.core.pagination.20', 25 => 'mautic.core.pagination.25', 30 => 'mautic.core.pagination.30', 50 => 'mautic.core.pagination.50', 100 => 'mautic.core.pagination.100'), 'expanded' => false, 'multiple' => false, 'label' => 'mautic.core.config.form.default.pagelimit', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.default.pagelimit.tooltip'), 'required' => false, 'empty_value' => false));
     $builder->add('default_timezone', 'timezone', array('label' => 'mautic.core.config.form.default.timezone', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.default.timezone.tooltip'), 'multiple' => false, 'empty_value' => 'mautic.user.user.form.defaulttimezone', 'required' => false));
     $builder->add('date_format_full', 'text', array('label' => 'mautic.core.config.form.date.format.full', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.date.format.full.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('date_format_short', 'text', array('label' => 'mautic.core.config.form.date.format.short', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.date.format.short.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('date_format_dateonly', 'text', array('label' => 'mautic.core.config.form.date.format.dateonly', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.date.format.dateonly.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('date_format_timeonly', 'text', array('label' => 'mautic.core.config.form.date.format.timeonly', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.date.format.timeonly.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     // TODO - Write an API endpoint listing our supported services and build this list from that
     // see CoreBundle\Entity\IpAddress
     $builder->add('ip_lookup_service', 'choice', array('choices' => array('telize' => 'mautic.core.config.ip_lookup_service.telize', 'freegeoip' => 'mautic.core.config.ip_lookup_service.freegeoip', 'geobytes' => 'mautic.core.config.ip_lookup_service.geobytes', 'ipinfodb' => 'mautic.core.config.ip_lookup_service.ipinfodb', 'geoips' => 'mautic.core.config.ip_lookup_service.geoips', 'maxmind_country' => 'mautic.core.config.ip_lookup_service.maxmind_country', 'maxmind_precision' => 'mautic.core.config.ip_lookup_service.maxmind_precision', 'maxmind_omni' => 'mautic.core.config.ip_lookup_service.maxmind_omni'), 'label' => 'mautic.core.config.form.ip.lookup.service', 'label_attr' => array('class' => 'control-label'), 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.ip.lookup.service.tooltip')));
     $builder->add('ip_lookup_auth', 'text', array('label' => 'mautic.core.config.form.ip.lookup.auth', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.ip.lookup.auth.tooltip'), 'required' => false));
     $builder->add('transifex_username', 'text', array('label' => 'mautic.core.config.form.transifex.username', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.transifex.username.tooltip', 'autocomplete' => 'off'), 'required' => false));
     $builder->add('transifex_password', 'password', array('label' => 'mautic.core.config.form.transifex.password', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'placeholder' => 'mautic.user.user.form.passwordplaceholder', 'preaddon' => 'fa fa-lock', 'tooltip' => 'mautic.core.config.form.transifex.password.tooltip', 'autocomplete' => 'off'), 'required' => false));
     $builder->add('update_stability', 'choice', array('choices' => array('alpha' => 'mautic.core.config.update_stability.alpha', 'beta' => 'mautic.core.config.update_stability.beta', 'rc' => 'mautic.core.config.update_stability.rc', 'stable' => 'mautic.core.config.update_stability.stable'), 'label' => 'mautic.core.config.form.update.stability', 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.update.stability.tooltip'), 'empty_value' => false));
     $builder->add('cookie_path', 'text', array('label' => 'mautic.core.config.form.cookie.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.cookie.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('cookie_domain', 'text', array('label' => 'mautic.core.config.form.cookie.domain', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.cookie.domain.tooltip'), 'required' => false));
     $builder->add('cookie_secure', 'yesno_button_group', array('label' => 'mautic.core.config.form.cookie.secure', 'empty_value' => 'mautic.core.form.default', 'data' => array_key_exists('cookie_secure', $options['data']) && !empty($options['data']['cookie_secure']) ? true : false, 'attr' => array('tooltip' => 'mautic.core.config.form.cookie.secure.tooltip')));
     $builder->add('cookie_httponly', 'yesno_button_group', array('label' => 'mautic.core.config.form.cookie.httponly', 'data' => array_key_exists('cookie_httponly', $options['data']) && !empty($options['data']['cookie_httponly']) ? true : false, 'attr' => array('tooltip' => 'mautic.core.config.form.cookie.httponly.tooltip')));
 }
Exemplo n.º 28
0
 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->translator = $factory->getTranslator();
     $this->factory = $factory;
 }
Exemplo n.º 29
0
 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->translator = $factory->getTranslator();
     $this->themes = $factory->getInstalledThemes('asset');
     $this->assetModel = $factory->getModel('asset');
 }
Exemplo n.º 30
0
 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->translator = $factory->getTranslator();
     $this->security = $factory->getSecurity();
 }