Exemplo n.º 1
0
 /**
  * Erzeugt eine neue Email. Wird noch nicht versendet.
  * Muss nicht konfiguriert werden, nimmt die Konfiguration aus der config
  */
 public function __construct()
 {
     parent::__construct();
     if (Config::get('mail_smtp', false)) {
         $this->isSMTP();
         $this->Host = Config::get('mail_smtp_host');
         $this->SMTPAuth = Config::get('mail_smtp_auth', false);
         $this->Username = Config::get('mail_smtp_username');
         $this->Password = Config::get('mail_smtp_password');
         $this->SMTPSecure = Config::get('mail_smtp_secure');
         $this->Port = Config::get('mail_smtp_port');
     }
     // From:
     if (Config::has('mail_from_email')) {
         if (Config::has('mail_from_name')) {
             $this->setFrom(Config::get('mail_from_email'), Config::get('mail_from_name'));
         } else {
             $this->setFrom(Config::get('mail_from_email'));
         }
     }
     // CC:
     if (Config::has('mail_cc')) {
         $cc = Config::get('mail_cc');
         if (is_array($cc)) {
             foreach ($cc as $c) {
                 $this->addCC($c);
             }
         } else {
             $this->addCC($cc);
         }
     }
     // BCC:
     if (Config::has('mail_bcc')) {
         $bcc = Config::get('mail_bcc');
         if (is_array($bcc)) {
             foreach ($bcc as $c) {
                 $this->addBCC($c);
             }
         } else {
             $this->addBCC($bcc);
         }
     }
 }
Exemplo n.º 2
0
<?php

use Drips\App;
use Drips\Config\Config;
use Drips\Database\DB;
use Drips\Database\Connection;
if (class_exists('Drips\\App')) {
    App::on('create', function (App $app) {
        $type = Config::get('database_type', 'mysql');
        $host = Config::get('database_host', 'localhost');
        $database = Config::get('database_name', 'drips');
        $username = Config::get('database_username', 'root');
        $password = Config::get('database_password', 'root');
        $port = Config::get('database_port', 3306);
        $charset = Config::get('database_charset', 'utf-8');
        $config = array('database_type' => $type);
        if ($type == 'sqlite') {
            $config['database_file'] = $host;
        } else {
            $config['server'] = $host;
            $config['database_name'] = $database;
            $config['username'] = $username;
            $config['password'] = $password;
            $config['port'] = $port;
            $config['charset'] = $charset;
        }
        DB::setConnection('default', new Connection($config, true));
    });
}