Пример #1
0
 public function indexAction(Request $req, Application $app)
 {
     // Nobody can login after CFP deadline
     $loader = new ConfigINIFileLoader(APP_DIR . '/config/config.' . APP_ENV . '.ini');
     $config_data = $loader->load();
     if (strtotime($config_data['application']['enddate'] . ' 11:59 PM') < strtotime('now')) {
         $app['session']->set('flash', array('type' => 'error', 'short' => 'Error', 'ext' => 'Sorry, the call for papers has ended.'));
         return $app->redirect($app['url']);
     }
     // Reset our user to make sure nothing weird happens
     if ($app['sentry']->check()) {
         $app['sentry']->logout();
     }
     $template = $app['twig']->loadTemplate('user/create.twig');
     $form_data = array();
     $form_data['transportation'] = 0;
     $form_data['hotel'] = 0;
     $form_data['formAction'] = '/signup';
     $form_data['buttonInfo'] = 'Create my speaker profile';
     return $template->render($form_data);
 }
Пример #2
0
 public function getConfigContainer()
 {
     if (isset($this->_config)) {
         return $this->_config;
     }
     $loader = new ConfigINIFileLoader($this->getConfigPath());
     $configData = $loader->load();
     // Place our info into Pimple
     $this->_config = new \Pimple();
     foreach ($configData as $category => $info) {
         foreach ($info as $key => $value) {
             $this->_config["{$category}.{$key}"] = $value;
         }
     }
     return $this->_config;
 }
Пример #3
0
 protected function sendResetEmail($twig, $user_id, $email, $reset_code)
 {
     // Create our Mailer object
     $loader = new ConfigINIFileLoader(APP_DIR . '/config/config.' . APP_ENV . '.ini');
     $config_data = $loader->load();
     $transport = new \Swift_SmtpTransport($config_data['smtp']['host'], $config_data['smtp']['port']);
     if (!empty($config_data['smtp']['user'])) {
         $transport->setUsername($config_data['smtp']['user'])->setPassword($config_data['smtp']['password']);
     }
     if (!empty($config_data['smtp']['encryption'])) {
         $transport->setEncryption($config_data['smtp']['encryption']);
     }
     // Build our email that we will send
     $template = $twig->loadTemplate('emails/reset_password.twig');
     $parameters = array('reset_code' => $reset_code, 'method' => !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', 'host' => !empty($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost', 'user_id' => $user_id, 'email' => $config_data['application']['email'], 'title' => $config_data['application']['title']);
     try {
         $mailer = new \Swift_Mailer($transport);
         $message = new \Swift_Message();
         $message->setTo($email);
         $message->setFrom($template->renderBlock('from', $parameters), $template->renderBlock('from_name', $parameters));
         $message->setSubject($template->renderBlock('subject', $parameters));
         $message->setBody($template->renderBlock('body_text', $parameters));
         $message->addPart($template->renderBlock('body_html', $parameters), 'text/html');
         return $mailer->send($message);
     } catch (\Exception $e) {
         echo $e;
         die;
     }
 }
Пример #4
0
 /**
  * Method that sends an email when a talk is created
  *
  * @param Application $app
  * @param string $email
  * @param integer $talk_id
  * @return mixed
  */
 protected function sendSubmitEmail(Application $app, $email, $talk_id)
 {
     $mapper = $app['spot']->mapper('OpenCFP\\Entity\\Talk');
     $talk = $mapper->get($talk_id);
     // Create our Mailer object
     $loader = new ConfigINIFileLoader(APP_DIR . '/config/config.' . APP_ENV . '.ini');
     $config_data = $loader->load();
     $transport = new \Swift_SmtpTransport($config_data['smtp']['host'], $config_data['smtp']['port']);
     if (!empty($config_data['smtp']['user'])) {
         $transport->setUsername($config_data['smtp']['user'])->setPassword($config_data['smtp']['password']);
     }
     if (!empty($config_data['smtp']['encryption'])) {
         $transport->setEncryption($config_data['smtp']['encryption']);
     }
     // Build our email that we will send
     $template = $app['twig']->loadTemplate('emails/talk_submit.twig');
     $parameters = array('email' => $config_data['application']['email'], 'title' => $config_data['application']['title'], 'talk' => $talk->title, 'enddate' => $config_data['application']['enddate']);
     try {
         $mailer = new \Swift_Mailer($transport);
         $message = new \Swift_Message();
         $message->setTo($email);
         $message->setFrom($template->renderBlock('from', $parameters), $template->renderBlock('from_name', $parameters));
         $message->setSubject($template->renderBlock('subject', $parameters));
         $message->setBody($template->renderBlock('body_text', $parameters));
         $message->addPart($template->renderBlock('body_html', $parameters), 'text/html');
         return $mailer->send($message);
     } catch (\Exception $e) {
         echo $e;
         die;
     }
 }