<?php


class EmailSettingsHook
{
    public function loadSettings()
    {
        $ci =& get_instance();
        $ci->load->model('MailSettingsModel');
        $configSettings = $ci->load->config('email', true);
        $ci->load->database();
        if ($ci->MailSettingsModel->isSettingsTableExists()) {
            $settings = $ci->MailSettingsModel->getSettings();
            if ($settings['protocol'] != '') {
                $settings = array_replace($configSettings, $settings);
                $ci->load->library('email', $settings);
            }
        }
    }
}