/**
* Send install notification email to user
*
* @param \Phire\Form\User $form
* @return void
*/
public static function send(\Phire\Form\User $form)
{
$i18n = Table\Config::getI18n();
// Get the domain
$domain = str_replace('www.', '', $_SERVER['HTTP_HOST']);
// Set the recipient
$rcpt = array('name' => $form->username, 'email' => $form->email1, 'url' => 'http://' . $_SERVER['HTTP_HOST'] . BASE_PATH, 'login' => 'http://' . $_SERVER['HTTP_HOST'] . BASE_PATH . APP_URI, 'domain' => $domain);
$config = \Phire\Table\Config::findById('system_email');
$config->value = $form->email1;
$config->update();
$config = \Phire\Table\Config::findById('reply_email');
$config->value = 'noreply@' . $domain;
$config->update();
if (file_exists($_SERVER['DOCUMENT_ROOT'] . BASE_PATH . CONTENT_PATH . '/extensions/themes/phire/mail')) {
$mailTmpl = file_get_contents($_SERVER['DOCUMENT_ROOT'] . BASE_PATH . CONTENT_PATH . '/extensions/themes/phire/mail/install.txt');
} else {
$mailTmpl = file_get_contents(__DIR__ . '/../../../view/phire/mail/install.txt');
}
$mailTmpl = str_replace(array('Dear', 'Thank you for installing Phire CMS for', 'The website will be viewable here:', 'To manage the website, you can login to Phire here:', 'Thank You'), array($i18n->__('Dear'), $i18n->__('Thank you for installing Phire CMS for'), $i18n->__('The website will be viewable here:'), $i18n->__('To manage the website, you can login to Phire here:'), $i18n->__('Thank You')), $mailTmpl);
// Send email verification
$mail = new Mail($domain . ' - ' . $i18n->__('Phire CMS Installation'), $rcpt);
$mail->from('noreply@' . $domain);
$mail->setText($mailTmpl);
$mail->send();
}