| | |
| | | if ($mail_config["mailbox_virtual_uidgid_maps"] == 'y') { |
| | | $app->log('Map uid to linux-user',LOGLEVEL_DEBUG); |
| | | $email_parts = explode('@',$data['new']['email']); |
| | | $webdomain = $app->db->queryOneRecord("SELECT domain_id, server_id, system_user, parent_domain_id FROM web_domain WHERE domain = '".$app->db->quote($email_parts[1])."'"); |
| | | $webdomain = $app->db->queryOneRecord("SELECT domain_id, server_id, system_user, parent_domain_id FROM web_domain WHERE domain = ?", $email_parts[1]); |
| | | if ($webdomain) { |
| | | while (($webdomain['system_user'] == null) && ($webdomain['parent_domain_id'] != 0)) { |
| | | $webdomain = $app->db->queryOneRecord("SELECT domain_id, server_id, system_user, parent_domain_id FROM web_domain WHERE domain_id = '".$webdomain['parent_domain_id']."'"); |
| | | $webdomain = $app->db->queryOneRecord("SELECT domain_id, server_id, system_user, parent_domain_id FROM web_domain WHERE domain_id = ?", $webdomain['parent_domain_id']); |
| | | } |
| | | $app->log($data['new']['server_id'].' == '.$webdomain['server_id'],LOGLEVEL_DEBUG); |
| | | |
| | |
| | | $app->log('Mailuser uid: '.$data['new']['uid'].', gid: '.$data['new']['gid'],LOGLEVEL_DEBUG); |
| | | |
| | | // update DB if values changed |
| | | $app->db->query("UPDATE mail_user SET uid = ".$data['new']['uid'].", gid = ".$data['new']['gid']." WHERE mailuser_id = ".$data['new']['mailuser_id']); |
| | | $app->db->query("UPDATE mail_user SET uid = ?, gid = ? WHERE mailuser_id = ?", $data['new']['uid'], $data['new']['gid'], $data['new']['mailuser_id']); |
| | | |
| | | // now get names of uid and gid |
| | | $user = $app->system->getuser($data['new']['uid']); |
| | |
| | | } |
| | | |
| | | //* Send the welcome email message |
| | | if(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt')) { |
| | | $domain = explode('@', $data["new"]["email"])[1]; |
| | | $html = false; |
| | | if(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.html')) { |
| | | $lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.html'); |
| | | $html = true; |
| | | } elseif(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.html')) { |
| | | $lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.html'); |
| | | $html = true; |
| | | } elseif(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.txt')) { |
| | | $lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.txt'); |
| | | } elseif(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt')) { |
| | | $lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt'); |
| | | } elseif(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_en.txt')) { |
| | | $lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_en.txt'); |
| | |
| | | unset($tmp); |
| | | |
| | | $mailHeaders = "MIME-Version: 1.0" . "\n"; |
| | | $mailHeaders .= "Content-type: text/plain; charset=utf-8" . "\n"; |
| | | $mailHeaders .= "Content-Transfer-Encoding: 8bit" . "\n"; |
| | | if($html) { |
| | | $mailHeaders .= "Content-Type: text/html; charset=utf-8" . "\n"; |
| | | $mailHeaders .= "Content-Transfer-Encoding: quoted-printable" . "\n"; |
| | | } else { |
| | | $mailHeaders .= "Content-Type: text/plain; charset=utf-8" . "\n"; |
| | | $mailHeaders .= "Content-Transfer-Encoding: 8bit" . "\n"; |
| | | } |
| | | $mailHeaders .= "From: $welcome_mail_from" . "\n"; |
| | | $mailHeaders .= "Reply-To: $welcome_mail_from" . "\n"; |
| | | $mailTarget = $data["new"]["email"]; |
| | |
| | | if ($mail_config["mailbox_virtual_uidgid_maps"] == 'y') { |
| | | $app->log('Map uid to linux-user',LOGLEVEL_DEBUG); |
| | | $email_parts = explode('@',$data['new']['email']); |
| | | $webdomain = $app->db->queryOneRecord("SELECT domain_id, server_id, system_user, parent_domain_id FROM web_domain WHERE domain = '".$app->db->quote($email_parts[1])."'"); |
| | | $webdomain = $app->db->queryOneRecord("SELECT domain_id, server_id, system_user, parent_domain_id FROM web_domain WHERE domain = ?", $email_parts[1]); |
| | | if ($webdomain) { |
| | | while ($webdomain['parent_domain_id'] != 0) { |
| | | $webdomain = $app->db->queryOneRecord("SELECT domain_id, server_id, system_user, parent_domain_id FROM web_domain WHERE domain_id = '".$webdomain['parent_domain_id']."'"); |
| | | $webdomain = $app->db->queryOneRecord("SELECT domain_id, server_id, system_user, parent_domain_id FROM web_domain WHERE domain_id = ?", $webdomain['parent_domain_id']); |
| | | } |
| | | $app->log($data['new']['server_id'].' == '.$webdomain['server_id'],LOGLEVEL_DEBUG); |
| | | |
| | |
| | | $app->log('Mailuser uid: '.$data['new']['uid'].', gid: '.$data['new']['gid'],LOGLEVEL_DEBUG); |
| | | |
| | | // update DB if values changed |
| | | $app->db->query("UPDATE mail_user SET uid = ".$data['new']['uid'].", gid = ".$data['new']['gid']." WHERE mailuser_id = ".$data['new']['mailuser_id']); |
| | | $app->db->query("UPDATE mail_user SET uid = ?, gid = ? WHERE mailuser_id = ?", $data['new']['uid'], $data['new']['gid'], $data['new']['mailuser_id']); |
| | | |
| | | $user = $app->system->getuser($data['new']['uid']); |
| | | $group = $app->system->getgroup($data['new']['gid']); |