Ejemplo n.º 1
0
    /**
     * Write email configuration.
     *
     * @param bool $force - Force write - disregarding config - only use when copying default configuration!
     * @return int
     */
    public function reWriteConf($force = false)
    {
        $sysConf = new sysConf();
        $sendMailPath = $this->originalSendmailPath;
        /*
         * Only override sendmail path if allowed.
         */
        if ($force || CommonFunctions::allowSendmailPathEdit()) {
            $sendMailPath = $this->getSendmailPath();
        }
        $content = '
<?php
	$this->smtpHost = \'' . $this->_safeEscape($this->getSmtpHost()) . '\';
	$this->smtpUser = \'' . $this->_safeEscape($this->getSmtpUser()) . '\';
	$this->smtpPass = \'' . $this->_safeEscape($this->getSmtpPass()) . '\';
	$this->smtpPort = \'' . $this->_safeEscape($this->getSmtpPort()) . '\';

	$this->sendmailPath = \'' . $this->_safeEscape($sendMailPath) . '\';

	$this->mailType = \'' . $this->_safeEscape($this->getMailType()) . '\';
	$this->mailAddress = \'' . $this->_safeEscape($this->getMailAddress()) . '\';
	$this->smtpAuth = \'' . $this->_safeEscape($this->getSmtpAuth()) . '\';
	$this->smtpSecurity = \'' . $this->_safeEscape($this->getSmtpSecurity()) . '\';
?>';
        return file_put_contents($this->configurationFile, $content);
    }