Ejemplo n.º 1
0
 private function __construct()
 {
     $config = ApplicationRegistry::instance();
     $this->config['smtp_host'] = $config->getConfigParam('smtp_host');
     $this->config['smtp_port'] = $config->getConfigParam('smtp_port');
     $this->config['smtp_mode'] = $config->getConfigParam('smtp_mode');
     $this->config['smtp_user'] = $config->getConfigParam('smtp_user');
     $this->config['smtp_pass'] = $config->getConfigParam('smtp_pass');
     $this->config['mail_from'] = $config->getConfigParam('mail_from');
 }
Ejemplo n.º 2
0
 public function __construct()
 {
     $config = ApplicationRegistry::instance();
     $dsn = 'mysql:dbname=' . $config->getConfigParam('db_name') . ';host=' . $config->getConfigParam('db_host');
     try {
         $this->db = new \PDO($dsn, $config->getConfigParam('db_user'), $config->getConfigParam('db_password'));
         $this->db->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
     } catch (\PDOException $e) {
         throw new \Exception('Не могу соединиться с базой данных: ' . $e->getMessage());
     }
     $this->db->query("SET names 'utf8'");
 }
Ejemplo n.º 3
0
 public function __construct()
 {
     $this->view = new View();
     $this->config = ApplicationRegistry::instance();
     $this->request = RequestRegistry::getRequest();
     $this->session = SessionRegistry::instance();
     $error = $this->request->getProperty('app_error');
     if (is_null($this->session->getCurrentUser()) && $this->request->getProperty('controller') != 'login' && is_null($error)) {
         $this->redirect('/login/');
     } elseif (is_null($this->session->getCurrentUser()) && !is_null($error) && !$error instanceof \App\library\exceptions\LoginException) {
         $this->redirect('/login/');
     }
 }
Ejemplo n.º 4
0
 public function __construct()
 {
     $this->config = ApplicationRegistry::instance();
     $this->request = RequestRegistry::getRequest();
     $this->session = SessionRegistry::instance();
 }