* @copyright 2007-2014 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class AdminEmailsControllerCore extends AdminController { public function __construct() { $this->bootstrap = true; $this->className = 'Configuration'; $this->table = 'configuration'; parent::__construct(); foreach (Contact::getContacts($this->context->language->id) as $contact) $arr[] = array('email_message' => $contact['id_contact'], 'name' => $contact['name']); $this->fields_options = array( 'email' => array( 'title' => $this->l('Email'), 'icon' => 'icon-envelope', 'fields' => array( 'PS_MAIL_EMAIL_MESSAGE' => array( 'title' => $this->l('Send email to'), 'desc' => $this->l('Where customers send messages from the order page.'), 'validation' => 'isUnsignedId', 'type' => 'select', 'cast' => 'intval', 'identifier' => 'email_message', 'list' => $arr ), 'PS_MAIL_METHOD' => array( 'title' => '', 'validation' => 'isGenericName', 'type' => 'radio', 'required' => true, 'choices' => array( 3 => $this->l('Never send emails (may be useful for testing purposes)'), 2 => $this->l('Set my own SMTP parameters (for advanced users ONLY)') ), 'js' => array( 1 => 'onclick="$(\'#configuration_fieldset_smtp\').slideUp();"', 2 => 'onclick="$(\'#configuration_fieldset_smtp\').slideDown();"', 3 => 'onclick="$(\'#configuration_fieldset_smtp\').slideUp();"' ), 'visibility' => Shop::CONTEXT_ALL ), 'PS_MAIL_TYPE' => array('title' => '', 'validation' => 'isGenericName', 'type' => 'radio', 'required' => true, 'choices' => array( Mail::TYPE_HTML => $this->l('Send email in HTML format'), Mail::TYPE_TEXT => $this->l('Send email in text format'), Mail::TYPE_BOTH => $this->l('Both') ) ), ), 'submit' => array('title' => $this->l('Save')) ), 'smtp' => array( 'title' => $this->l('Email'), 'fields' => array( 'PS_MAIL_DOMAIN' => array( 'title' => $this->l('Mail domain name'), 'hint' => $this->l('Fully qualified domain name (keep this field empty if you don\'t know).'), 'empty' => true, 'validation' => 'isUrl', 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL ), 'PS_MAIL_SERVER' => array( 'title' => $this->l('SMTP server'), 'hint' => $this->l('IP address or server name (e.g. smtp.mydomain.com).'), 'validation' => 'isGenericName', 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL ), 'PS_MAIL_USER' => array( 'title' => $this->l('SMTP user'), 'hint' => $this->l('Leave blank if not applicable.'), 'validation' => 'isGenericName', 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL ), 'PS_MAIL_PASSWD' => array( 'title' => $this->l('SMTP password'), 'hint' => $this->l('Leave blank if not applicable.'), 'validation' => 'isAnything', 'type' => 'password', 'visibility' => Shop::CONTEXT_ALL, 'autocomplete' => false ), 'PS_MAIL_SMTP_ENCRYPTION' => array( 'title' => $this->l('Encryption'), 'hint' => $this->l('Use an encrypt protocol'), 'desc' => Tools::apacheModExists('mod_ssl') ? '/!\\ '.$this->l('SSL mod seems to not be installed on your server.') : '', 'type' => 'select', 'cast' => 'strval', 'identifier' => 'mode', 'list' => array( array( 'mode' => 'off', 'name' => $this->l('None') ), array( 'mode' => 'tls', 'name' => $this->l('TLS') ), array( 'mode' => 'ssl', 'name' => $this->l('SSL') ) ), 'visibility' => Shop::CONTEXT_ALL ), 'PS_MAIL_SMTP_PORT' => array( 'title' => $this->l('Port'), 'hint' => $this->l('Port number to use.'), 'validation' => 'isInt', 'type' => 'text', 'cast' => 'intval', 'visibility' => Shop::CONTEXT_ALL ), ), 'submit' => array('title' => $this->l('Save')) ), 'test' => array( 'title' => $this->l('Test your email configuration'), 'hide_multishop_checkbox' => true, 'fields' => array( 'PS_SHOP_EMAIL' => array( 'title' => $this->l('Send a test email to'), 'type' => 'text', 'id' => 'testEmail', 'no_multishop_checkbox' => true ), ), 'bottom' => '