Пример #1
0
     $log->logAction(USR_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
     standard_error('errorsendingmail', $email_full);
 }
 $mail->ClearAddresses();
 if (validateEmail($alternative_email) && $settings['panel']['sendalternativemail'] == 1) {
     $result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int) $userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($userinfo['def_language']) . '\' AND `templategroup`=\'mails\' AND `varname`=\'pop_success_alternative_subject\'');
     $mail_subject = replace_variables($result['value'] != '' ? $result['value'] : $lng['mails']['pop_success_alternative']['subject'], $replace_arr);
     $result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int) $userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($userinfo['def_language']) . '\' AND `templategroup`=\'mails\' AND `varname`=\'pop_success_alternative_mailbody\'');
     $mail_body = replace_variables($result['value'] != '' ? $result['value'] : $lng['mails']['pop_success_alternative']['mailbody'], $replace_arr);
     $_mailerror = false;
     try {
         $mail->SetFrom($admin['email'], getCorrectUserSalutation($admin));
         $mail->Subject = $mail_subject;
         $mail->AltBody = $mail_body;
         $mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
         $mail->AddAddress($idna_convert->encode($alternative_email), getCorrectUserSalutation($userinfo));
         $mail->Send();
     } catch (phpmailerException $e) {
         $mailerr_msg = $e->errorMessage();
         $_mailerror = true;
     } catch (Exception $e) {
         $mailerr_msg = $e->getMessage();
         $_mailerror = true;
     }
     if ($_mailerror) {
         $log->logAction(USR_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
         standard_error(array('errorsendingmail', $alternative_email));
     }
     $mail->ClearAddresses();
 }
 redirectTo($filename, array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
Пример #2
0
$mail->CharSet = "UTF-8";
if (PHPMailer::ValidateAddress(Settings::Get('panel.adminmail')) !== false) {
    // set return-to address and custom sender-name, see #76
    $mail->SetFrom(Settings::Get('panel.adminmail'), Settings::Get('panel.adminmail_defname'));
    if (Settings::Get('panel.adminmail_return') != '') {
        $mail->AddReplyTo(Settings::Get('panel.adminmail_return'), Settings::Get('panel.adminmail_defname'));
    }
}
// Warn the customers at xx% traffic-usage
$result_stmt = Database::prepare("\n\tSELECT `c`.`customerid`, `c`.`adminid`, `c`.`name`, `c`.`firstname`,\n\t`c`.`company`, `c`.`traffic`, `c`.`email`, `c`.`def_language`,\n\t`a`.`name` AS `adminname`, `a`.`email` AS `adminmail`,\n\t(SELECT SUM(`t`.`http` + `t`.`ftp_up` + `t`.`ftp_down` + `t`.`mail`)\n\tFROM `" . TABLE_PANEL_TRAFFIC . "` `t`\n\tWHERE `t`.`customerid` = `c`.`customerid` AND `t`.`year` = :year AND `t`.`month` = :month\n\t) as `traffic_used`\n\tFROM `" . TABLE_PANEL_CUSTOMERS . "` AS `c`\n\tLEFT JOIN `" . TABLE_PANEL_ADMINS . "` AS `a`\n\tON `a`.`adminid` = `c`.`adminid` WHERE `c`.`reportsent` <> '1'\n");
$result_data = array('year' => date("Y", $yesterday), 'month' => date("m", $yesterday));
Database::pexecute($result_stmt, $result_data);
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
    if (isset($row['traffic']) && $row['traffic'] > 0 && $row['traffic_used'] != null && $row['traffic_used'] * 100 / $row['traffic'] >= (int) Settings::Get('system.report_trafficmax')) {
        $rep_userinfo = array('name' => $row['name'], 'firstname' => $row['firstname'], 'company' => $row['company']);
        $replace_arr = array('SALUTATION' => getCorrectUserSalutation($rep_userinfo), 'NAME' => $row['name'], 'TRAFFIC' => round($row['traffic'] / 1024, 2), 'TRAFFICUSED' => round($row['traffic_used'] / 1024, 2), 'USAGE_PERCENT' => round($row['traffic_used'] * 100 / $row['traffic'], 2), 'MAX_PERCENT' => Settings::Get('system.report_trafficmax'));
        $lngfile_stmt = Database::prepare("\n\t\t\tSELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "`\n\t\t\tWHERE `language` = :deflang\n\t\t");
        $lngfile = Database::pexecute_first($lngfile_stmt, array('deflang' => $row['def_language']));
        if ($lngfile !== null) {
            $langfile = $lngfile['file'];
        } else {
            $lngfile = Database::pexecute_first($lngfile_stmt, array('deflang' => Settings::Get('panel.standardlanguage')));
            $langfile = $lngfile['file'];
        }
        // include english language file (fallback)
        include_once makeCorrectFile(FROXLOR_INSTALL_DIR . '/lng/english.lng.php');
        // include admin/customer language file
        include_once makeCorrectFile(FROXLOR_INSTALL_DIR . '/' . $langfile);
        // Get mail templates from database; the ones from 'admin' are fetched for fallback
        $result2_stmt = Database::prepare("\n\t\t\tSELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`\n\t\t\tWHERE `adminid` = :adminid\n\t\t\tAND `language` = :lang\n\t\t\tAND `templategroup` = 'mails' AND `varname` = :varname\n\t\t");
        $result2_data = array('adminid' => $row['adminid'], 'lang' => $row['def_language'], 'varname' => 'trafficmaxpercent_subject');
Пример #3
0
     $def_language = $userinfo['def_language'];
     $result_stmt = Database::prepare("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`\n\t\t\t\t\t\t\tWHERE `adminid` = :adminid\n\t\t\t\t\t\t\tAND `language` = :lang\n\t\t\t\t\t\t\tAND `templategroup`='mails'\n\t\t\t\t\t\t\tAND `varname`='new_ftpaccount_by_customer_subject'");
     Database::pexecute($result_stmt, array("adminid" => $userinfo['adminid'], "lang" => $def_language));
     $result = $result_stmt->fetch(PDO::FETCH_ASSOC);
     $mail_subject = html_entity_decode(replace_variables($result['value'] != '' ? $result['value'] : $lng['mails']['new_ftpaccount_by_customer']['subject'], $replace_arr));
     $def_language = $userinfo['def_language'];
     $result_stmt = Database::prepare("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`\n\t\t\t\t\t\t\tWHERE `adminid` = :adminid\n\t\t\t\t\t\t\tAND `language` = :lang\n\t\t\t\t\t\t\tAND `templategroup`='mails'\n\t\t\t\t\t\t\tAND `varname`='new_ftpaccount_by_customer_mailbody'");
     Database::pexecute($result_stmt, array("adminid" => $userinfo['adminid'], "lang" => $def_language));
     $result = $result_stmt->fetch(PDO::FETCH_ASSOC);
     $mail_body = html_entity_decode(replace_variables($result['value'] != '' ? $result['value'] : $lng['mails']['new_ftpaccount_by_customer']['mailbody'], $replace_arr));
     $_mailerror = false;
     try {
         $mail->Subject = $mail_subject;
         $mail->AltBody = $mail_body;
         $mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
         $mail->AddAddress($userinfo['email'], getCorrectUserSalutation($userinfo));
         $mail->Send();
     } catch (phpmailerException $e) {
         $mailerr_msg = $e->errorMessage();
         $_mailerror = true;
     } catch (Exception $e) {
         $mailerr_msg = $e->getMessage();
         $_mailerror = true;
     }
     if ($_mailerror) {
         $log->logAction(USR_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
         standard_error('errorsendingmail', $userinfo['email']);
     }
     $mail->ClearAddresses();
 }
 redirectTo($filename, array('page' => $page, 's' => $s));
Пример #4
0
     $srv_ip_stmt = Database::prepare("\n\t\t\t\t\t\t\tSELECT ip, port FROM `" . TABLE_PANEL_IPSANDPORTS . "`\n\t\t\t\t\t\t\tWHERE `id` = :defaultip\n\t\t\t\t\t\t");
     $srv_ip = Database::pexecute_first($srv_ip_stmt, array('defaultip' => Settings::Get('system.defaultip')));
     $replace_arr = array('FIRSTNAME' => $firstname, 'NAME' => $name, 'COMPANY' => $company, 'SALUTATION' => getCorrectUserSalutation(array('firstname' => $firstname, 'name' => $name, 'company' => $company)), 'USERNAME' => $loginname, 'PASSWORD' => $password, 'SERVER_HOSTNAME' => $srv_hostname, 'SERVER_IP' => isset($srv_ip['ip']) ? $srv_ip['ip'] : '', 'SERVER_PORT' => isset($srv_ip['port']) ? $srv_ip['port'] : '', 'DOMAINNAME' => $_stdsubdomain);
     // Get mail templates from database; the ones from 'admin' are fetched for fallback
     $result_stmt = Database::prepare("\n\t\t\t\t\t\t\tSELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`\n\t\t\t\t\t\t\tWHERE `adminid` = :adminid AND `language` = :deflang AND `templategroup` = 'mails' AND `varname` = 'createcustomer_subject'");
     $result = Database::pexecute_first($result_stmt, array('adminid' => $userinfo['adminid'], 'deflang' => $def_language));
     $mail_subject = html_entity_decode(replace_variables($result['value'] != '' ? $result['value'] : $lng['mails']['createcustomer']['subject'], $replace_arr));
     $result_stmt = Database::prepare("\n\t\t\t\t\t\t\tSELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`\n\t\t\t\t\t\t\tWHERE `adminid` = :adminid AND `language` = :deflang AND `templategroup` = 'mails' AND `varname` = 'createcustomer_mailbody'");
     $result = Database::pexecute_first($result_stmt, array('adminid' => $userinfo['adminid'], 'deflang' => $def_language));
     $mail_body = html_entity_decode(replace_variables($result['value'] != '' ? $result['value'] : $lng['mails']['createcustomer']['mailbody'], $replace_arr));
     $_mailerror = false;
     try {
         $mail->Subject = $mail_subject;
         $mail->AltBody = $mail_body;
         $mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
         $mail->AddAddress($email, getCorrectUserSalutation(array('firstname' => $firstname, 'name' => $name, 'company' => $company)));
         $mail->Send();
     } catch (phpmailerException $e) {
         $mailerr_msg = $e->errorMessage();
         $_mailerror = true;
     } catch (Exception $e) {
         $mailerr_msg = $e->getMessage();
         $_mailerror = true;
     }
     if ($_mailerror) {
         $log->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
         standard_error('errorsendingmail', $email);
     }
     $mail->ClearAddresses();
     $log->logAction(ADM_ACTION, LOG_NOTICE, "automatically sent password to user '" . $loginname . "'");
 }
Пример #5
0
     // make it two times larger than password_min_length
     $rnd = '';
     $minlength = $settings['panel']['password_min_length'];
     while (strlen($rnd) < $minlength * 2) {
         $rnd .= md5(uniqid(microtime(), 1));
     }
     $password = substr($rnd, (int) ($minlength / 2), $minlength);
 }
 if ($adminchecked) {
     $db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `password`='" . md5($password) . "'\n\t\t\t\t\t\t\t\tWHERE `loginname`='" . $user['loginname'] . "'\n\t\t\t\t\t\t\t\tAND `email`='" . $user['email'] . "'");
 } else {
     $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `password`='" . md5($password) . "'\n\t\t\t\t\t\t\t\tWHERE `loginname`='" . $user['loginname'] . "'\n\t\t\t\t\t\t\t\tAND `email`='" . $user['email'] . "'");
 }
 $rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'), $db, $settings);
 $rstlog->logAction(USR_ACTION, LOG_WARNING, "Password for user '" . $user['loginname'] . "' has been reset!");
 $replace_arr = array('SALUTATION' => getCorrectUserSalutation($user), 'USERNAME' => $user['loginname'], 'PASSWORD' => $password);
 $body = strtr($lng['pwdreminder']['body'], array('%s' => $user['firstname'] . ' ' . $user['name'], '%p' => $password));
 $def_language = $user['def_language'] != '' ? $user['def_language'] : $settings['panel']['standardlanguage'];
 $result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int) $user['adminid'] . '\' AND `language`=\'' . $db->escape($def_language) . '\' AND `templategroup`=\'mails\' AND `varname`=\'password_reset_subject\'');
 $mail_subject = html_entity_decode(replace_variables($result['value'] != '' ? $result['value'] : $lng['pwdreminder']['subject'], $replace_arr));
 $result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int) $user['adminid'] . '\' AND `language`=\'' . $db->escape($def_language) . '\' AND `templategroup`=\'mails\' AND `varname`=\'password_reset_mailbody\'');
 $mail_body = html_entity_decode(replace_variables($result['value'] != '' ? $result['value'] : $body, $replace_arr));
 $_mailerror = false;
 try {
     $mail->Subject = $mail_subject;
     $mail->AltBody = $mail_body;
     $mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
     $mail->AddAddress($user['email'], $user['firstname'] . ' ' . $user['name']);
     $mail->Send();
 } catch (phpmailerException $e) {
     $mailerr_msg = $e->errorMessage();
Пример #6
0
 * COPYING file online at http://files.froxlor.org/misc/COPYING.txt
 *
 * @copyright  (c) the authors
 * @author     Froxlor team <*****@*****.**> (2010-)
 * @license    GPLv2 http://files.froxlor.org/misc/COPYING.txt
 * @package    Cron
 *
 */
/**
 * report about diskusage for customers
 */
$result_stmt = Database::query("\n\tSELECT `c`.`customerid`, `c`.`adminid`, `c`.`name`, `c`.`firstname`,\n\t`c`.`company`, `c`.`diskspace`, `c`.`diskspace_used`, `c`.`email`, `c`.`def_language`,\n\t`a`.`name` AS `adminname`, `a`.`email` AS `adminmail`\n\tFROM `" . TABLE_PANEL_CUSTOMERS . "` AS `c`\n    LEFT JOIN `" . TABLE_PANEL_ADMINS . "` AS `a`\n    ON `a`.`adminid` = `c`.`adminid`\n    WHERE `c`.`diskspace` > '0' AND `c`.`reportsent` <> '2'\n");
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
    if (isset($row['diskspace']) && $row['diskspace_used'] != null && $row['diskspace_used'] > 0 && $row['diskspace_used'] * 100 / $row['diskspace'] >= (int) Settings::Get('system.report_webmax')) {
        $rep_userinfo = array('name' => $row['name'], 'firstname' => $row['firstname'], 'company' => $row['company']);
        $replace_arr = array('SALUTATION' => getCorrectUserSalutation($rep_userinfo), 'NAME' => $row['name'], 'DISKAVAILABLE' => round($row['diskspace'] / 1024, 2), 'DISKUSED' => round($row['diskspace_used'] / 1024, 2), 'USAGE_PERCENT' => round($row['diskspace_used'] * 100 / $row['diskspace'], 2), 'MAX_PERCENT' => Settings::Get('system.report_webmax'));
        $lngfile_stmt = Database::prepare("\n\t\t\tSELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "`\n\t\t\tWHERE `language` = :deflang\n\t\t");
        $lngfile = Database::pexecute_first($lngfile_stmt, array('deflang' => $row['def_language']));
        if ($lngfile !== null) {
            $langfile = $lngfile['file'];
        } else {
            $lngfile = Database::pexecute_first($lngfile_stmt, array('deflang' => Settings::Get('panel.standardlanguage')));
            $langfile = $lngfile['file'];
        }
        // include english language file (fallback)
        include_once makeCorrectFile(FROXLOR_INSTALL_DIR . '/lng/english.lng.php');
        // include admin/customer language file
        include_once makeCorrectFile(FROXLOR_INSTALL_DIR . '/' . $langfile);
        // Get mail templates from database; the ones from 'admin' are fetched for fallback
        $result2_stmt = Database::prepare("\n\t\t\tSELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`\n\t\t\tWHERE `adminid` = :adminid\n\t\t\tAND `language` = :lang\n\t\t\tAND `templategroup` = 'mails' AND `varname` = :varname\n\t\t");
        $result2_data = array('adminid' => $row['adminid'], 'lang' => $row['def_language'], 'varname' => 'diskmaxpercent_subject');
Пример #7
0
    /**
     * Mail notifications
     */
    public function sendMail($customerid = -1, $template_subject = null, $default_subject = null, $template_body = null, $default_body = null)
    {
        global $mail, $theme;
        // Some checks are to be made here in the future
        if ($customerid != -1) {
            // Get e-mail message for customer
            $usr_stmt = Database::prepare('
				SELECT `name`, `firstname`, `company`, `email`
				FROM `' . TABLE_PANEL_CUSTOMERS . '` WHERE `customerid` = :customerid');
            $usr = Database::pexecute_first($usr_stmt, array('customerid' => $customerid));
            $replace_arr = array('FIRSTNAME' => $usr['firstname'], 'NAME' => $usr['name'], 'COMPANY' => $usr['company'], 'SALUTATION' => getCorrectUserSalutation($usr), 'SUBJECT' => $this->Get('subject', true));
        } else {
            $replace_arr = array('SUBJECT' => $this->Get('subject', true));
        }
        $tpl_seldata = array('adminid' => $this->userinfo['adminid'], 'lang' => $this->userinfo['def_language'], 'tplsubject' => $template_subject);
        $result_stmt = Database::prepare("\n\t\t\tSELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`\n\t\t\tWHERE `adminid`= :adminid\n\t\t\tAND `language`= :lang\n\t\t\tAND `templategroup`= 'mails' AND `varname`= :tplsubject");
        $result = Database::pexecute_first($result_stmt, $tpl_seldata);
        $mail_subject = html_entity_decode(replace_variables($result['value'] != '' ? $result['value'] : $default_subject, $replace_arr));
        unset($tpl_seldata['tplsubject']);
        $tpl_seldata['tplmailbody'] = $template_body;
        $result_stmt = Database::prepare("\n\t\t\tSELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`\n\t\t\tWHERE `adminid`= :adminid\n\t\t\tAND `language`= :lang\n\t\t\tAND `templategroup`= 'mails' AND `varname`= :tplmailbody");
        $result = Database::pexecute_first($result_stmt, $tpl_seldata);
        $mail_body = html_entity_decode(replace_variables($result['value'] != '' ? $result['value'] : $default_body, $replace_arr));
        if ($customerid != -1) {
            $_mailerror = false;
            try {
                $mail->SetFrom(Settings::Get('ticket.noreply_email'), Settings::Get('ticket.noreply_name'));
                $mail->Subject = $mail_subject;
                $mail->AltBody = $mail_body;
                $mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
                $mail->AddAddress($usr['email'], $usr['firstname'] . ' ' . $usr['name']);
                $mail->Send();
            } catch (phpmailerException $e) {
                $mailerr_msg = $e->errorMessage();
                $_mailerror = true;
            } catch (Exception $e) {
                $mailerr_msg = $e->getMessage();
                $_mailerror = true;
            }
            if ($_mailerror) {
                $rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'ticket_class'));
                $rstlog->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
                standard_error('errorsendingmail', $usr['email']);
            }
            $mail->ClearAddresses();
        } else {
            $admin_stmt = Database::prepare("\n\t\t\t\tSELECT `name`, `email` FROM `" . TABLE_PANEL_ADMINS . "`\n\t\t\t\tWHERE `adminid` = :adminid");
            $admin = Database::pexecute_first($admin_stmt, array('adminid' => $this->userinfo['adminid']));
            $_mailerror = false;
            try {
                $mail->SetFrom(Settings::Get('ticket.noreply_email'), Settings::Get('ticket.noreply_name'));
                $mail->Subject = $mail_subject;
                $mail->AltBody = $mail_body;
                $mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
                $mail->AddAddress($admin['email'], $admin['name']);
                $mail->Send();
            } catch (phpmailerException $e) {
                $mailerr_msg = $e->errorMessage();
                $_mailerror = true;
            } catch (Exception $e) {
                $mailerr_msg = $e->getMessage();
                $_mailerror = true;
            }
            if ($_mailerror) {
                $rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'ticket_class'));
                $rstlog->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
                standard_error('errorsendingmail', $admin['email']);
            }
            $mail->ClearAddresses();
        }
    }
Пример #8
0
 /**
  * Mail notifications
  */
 public function sendMail($customerid = -1, $template_subject = null, $default_subject = null, $template_body = null, $default_body = null)
 {
     global $mail;
     // Some checks are to be made here in the future
     if ($customerid != -1) {
         // Get e-mail message for customer
         $usr = $this->db->query_first('SELECT `name`, `firstname`, `company`, `email`
                            FROM `' . TABLE_PANEL_CUSTOMERS . '` 
                            WHERE `customerid` = "' . (int) $customerid . '"');
         $replace_arr = array('FIRSTNAME' => $usr['firstname'], 'NAME' => $usr['name'], 'COMPANY' => $usr['company'], 'SALUTATION' => getCorrectUserSalutation($usr), 'SUBJECT' => $this->Get('subject', true));
     } else {
         $replace_arr = array('SUBJECT' => $this->Get('subject', true));
     }
     $result = $this->db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '`
                             WHERE `adminid`=\'' . (int) $this->userinfo['adminid'] . '\' 
                             AND `language`=\'' . $this->db->escape($this->userinfo['def_language']) . '\' 
                             AND `templategroup`=\'mails\' 
                             AND `varname`=\'' . $template_subject . '\'');
     $mail_subject = html_entity_decode(replace_variables($result['value'] != '' ? $result['value'] : $default_subject, $replace_arr));
     $result = $this->db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '`
                             WHERE `adminid`=\'' . (int) $this->userinfo['adminid'] . '\' 
                             AND `language`=\'' . $this->db->escape($this->userinfo['def_language']) . '\' 
                             AND `templategroup`=\'mails\' 
                             AND `varname`=\'' . $template_body . '\'');
     $mail_body = html_entity_decode(replace_variables($result['value'] != '' ? $result['value'] : $default_body, $replace_arr));
     if ($customerid != -1) {
         $_mailerror = false;
         try {
             $mail->SetFrom($this->settings['ticket']['noreply_email'], $this->settings['ticket']['noreply_name']);
             $mail->Subject = $mail_subject;
             $mail->AltBody = $mail_body;
             $mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
             $mail->AddAddress($usr['email'], $usr['firstname'] . ' ' . $usr['name']);
             $mail->Send();
         } catch (phpmailerException $e) {
             $mailerr_msg = $e->errorMessage();
             $_mailerror = true;
         } catch (Exception $e) {
             $mailerr_msg = $e->getMessage();
             $_mailerror = true;
         }
         if ($_mailerror) {
             $rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'ticket_class'), $this->db, $this->settings);
             $rstlog->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
             standard_error('errorsendingmail', $usr['email']);
         }
         $mail->ClearAddresses();
     } else {
         $admin = $this->db->query_first("SELECT `name`, `email` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid`='" . (int) $this->userinfo['adminid'] . "'");
         $_mailerror = false;
         try {
             $mail->SetFrom($this->settings['ticket']['noreply_email'], $this->settings['ticket']['noreply_name']);
             $mail->Subject = $mail_subject;
             $mail->AltBody = $mail_body;
             $mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
             $mail->AddAddress($admin['email'], $admin['name']);
             $mail->Send();
         } catch (phpmailerException $e) {
             $mailerr_msg = $e->errorMessage();
             $_mailerror = true;
         } catch (Exception $e) {
             $mailerr_msg = $e->getMessage();
             $_mailerror = true;
         }
         if ($_mailerror) {
             $rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'ticket_class'), $this->db, $this->settings);
             $rstlog->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
             standard_error('errorsendingmail', $admin['email']);
         }
         $mail->ClearAddresses();
     }
 }
Пример #9
0
						SELECT `firstname`, `name`, `company`, `email`  FROM `' . TABLE_PANEL_CUSTOMERS . "`\n\t\t\t\t\t\tWHERE `adminid` = :adminid");
                    Database::pexecute($result, array('adminid' => $userinfo['adminid']));
                }
            } else {
                standard_error('noreceipientsgiven');
            }
            $subject = $_POST['subject'];
            $message = wordwrap($_POST['message'], 70);
            if (!empty($message)) {
                $mailcounter = 0;
                $mail->Body = $message;
                $mail->Subject = $subject;
                while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
                    $row['firstname'] = isset($row['firstname']) ? $row['firstname'] : '';
                    $row['company'] = isset($row['company']) ? $row['company'] : '';
                    $mail->AddAddress($row['email'], getCorrectUserSalutation(array('firstname' => $row['firstname'], 'name' => $row['name'], 'company' => $row['company'])));
                    $mail->From = $userinfo['email'];
                    $mail->FromName = (isset($userinfo['firstname']) ? $userinfo['firstname'] . ' ' : '') . $userinfo['name'];
                    if (!$mail->Send()) {
                        if ($mail->ErrorInfo != '') {
                            $mailerr_msg = $mail->ErrorInfo;
                        } else {
                            $mailerr_msg = $row['email'];
                        }
                        $log->logAction(ADM_ACTION, LOG_ERR, 'Error sending mail: ' . $mailerr_msg);
                        standard_error('errorsendingmail', $row['email']);
                    }
                    $mailcounter++;
                    $mail->ClearAddresses();
                }
                redirectTo($filename, array('page' => $page, 's' => $s, 'action' => 'showsuccess', 'sentitems' => $mailcounter));
Пример #10
0
                    $rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'));
                    $rstlog->logAction(USR_ACTION, LOG_WARNING, "User '" . $user['loginname'] . "' requested a link for setting a new password.");
                    // Set together our activation link
                    $protocol = empty($_SERVER['HTTPS']) ? 'http' : 'https';
                    // this can be a fixed value to avoid potential exploiting by modifying headers
                    $host = Settings::Get('system.hostname');
                    // $_SERVER['HTTP_HOST'];
                    $port = $_SERVER['SERVER_PORT'] != 80 ? ':' . $_SERVER['SERVER_PORT'] : '';
                    // there can be only one script to handle this so we can use a fixed value here
                    $script = "/index.php";
                    // $_SERVER['SCRIPT_NAME'];
                    if (Settings::Get('system.froxlordirectlyviahostname') == 0) {
                        $script = makeCorrectFile("/" . basename(__DIR__) . "/" . $script);
                    }
                    $activationlink = $protocol . '://' . $host . $port . $script . '?action=resetpwd&resetcode=' . $activationcode;
                    $replace_arr = array('SALUTATION' => getCorrectUserSalutation($user), 'USERNAME' => $user['loginname'], 'LINK' => $activationlink);
                    $body = strtr($lng['pwdreminder']['body'], array('%s' => $user['firstname'] . ' ' . $user['name'], '%a' => $activationlink));
                    $def_language = $user['def_language'] != '' ? $user['def_language'] : Settings::Get('panel.standardlanguage');
                    $result_stmt = Database::prepare('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '`
						WHERE `adminid`= :adminid
						AND `language`= :lang
						AND `templategroup`=\'mails\'
						AND `varname`=\'password_reset_subject\'');
                    Database::pexecute($result_stmt, array("adminid" => $user['adminid'], "lang" => $def_language));
                    $result = $result_stmt->fetch(PDO::FETCH_ASSOC);
                    $mail_subject = html_entity_decode(replace_variables($result['value'] != '' ? $result['value'] : $lng['pwdreminder']['subject'], $replace_arr));
                    $result_stmt = Database::prepare('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '`
						WHERE `adminid`= :adminid
						AND `language`= :lang
						AND `templategroup`=\'mails\'
						AND `varname`=\'password_reset_mailbody\'');