* @Project NUKEVIET 4.x * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2014 VINADES.,JSC. All rights reserved * @License GNU/GPL version 2 or any later version * @Createdate 31/05/2010, 00:36 */ if (!defined('NV_SYSTEM') and !defined('NV_ADMIN') or !defined('NV_MAINFILE')) { die('Stop!!!'); } unset($lang_module, $language_array, $nv_parse_ini_timezone, $countries, $module_info, $site_mods); global $db, $nv_Request, $nv_plugin_area; $contents = ob_get_contents(); ob_end_clean(); $contents = nv_url_rewrite($contents); if (!defined('NV_IS_AJAX')) { $contents = nv_change_buffer($contents); if (defined('NV_IS_SPADMIN')) { $contents = str_replace('[MEMORY_TIME_USAGE]', sprintf($lang_global['memory_time_usage'], nv_convertfromBytes(memory_get_usage()), number_format(microtime(true) - NV_START_TIME, 3, '.', '')), $contents); } } if (isset($nv_plugin_area[3])) { // Kết nối với các plugin Trước khi website gửi nội dung tới trình duyệt foreach ($nv_plugin_area[3] as $_fplugin) { include NV_ROOTDIR . '/includes/plugin/' . $_fplugin; } } $db = null; unset($lang_global, $global_config, $client_info); //Nen trang if (defined('NV_IS_GZIP')) { $http_accept_encoding = $nv_Request->get_string('HTTP_ACCEPT_ENCODING', 'server', '');
/** * @Project NUKEVIET 3.x * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2012 VINADES.,JSC. All rights reserved * @Createdate 31/05/2010, 00:36 */ if (!defined('NV_SYSTEM') and !defined('NV_ADMIN') or !defined('NV_MAINFILE')) { die('Stop!!!'); } global $db, $nv_Request, $sys_info; $db->sql_close(); $page = ob_get_contents(); ob_end_clean(); if (!defined('NV_IS_AJAX')) { $page = nv_change_buffer($page); } else { $page = $db->unfixdb($page); $page = nv_url_rewrite($page); } //Nen trang if (defined('NV_IS_GZIP')) { $http_accept_encoding = $nv_Request->get_string('HTTP_ACCEPT_ENCODING', 'server', ''); if (!empty($http_accept_encoding)) { $compress_list = array(); $compress_list['deflate'] = 'gzdeflate'; $compress_list['gzip'] = 'gzencode'; $compress_list['x-gzip'] = 'gzencode'; $compress_list['compress'] = 'gzcompress'; $compress_list['x-compress'] = 'gzcompress'; $http_accept_encoding = explode(",", str_replace(' ', '', $http_accept_encoding));
/** * nv_sendmail() * * @param mixed $from * @param mixed $to * @param string $subject * @param string $message * @param string $files * @return */ function nv_sendmail($from, $to, $subject, $message, $files = '') { global $global_config, $sys_info; $sendmail_from = ini_get('sendmail_from'); require_once NV_ROOTDIR . '/includes/phpmailer/class.phpmailer.php'; try { $mail = new PHPMailer(true); $mail->SetLanguage(NV_LANG_INTERFACE, NV_ROOTDIR . '/includes/phpmailer/language/'); $mail->CharSet = $global_config['site_charset']; $mailer_mode = strtolower($global_config['mailer_mode']); if ($mailer_mode == 'smtp') { $mail->IsSMTP(); $mail->SMTPAuth = true; $mail->Port = $global_config['smtp_port']; $mail->Host = $global_config['smtp_host']; $mail->Username = $global_config['smtp_username']; $mail->Password = $global_config['smtp_password']; $SMTPSecure = intval($global_config['smtp_ssl']); switch ($SMTPSecure) { case 1: $mail->SMTPSecure = 'ssl'; break; case 2: $mail->SMTPSecure = 'tls'; break; default: $mail->SMTPSecure = ''; } } elseif ($mailer_mode == 'sendmail') { $mail->IsSendmail(); } elseif (!in_array('mail', $sys_info['disable_functions'])) { $mail->IsMail(); } else { return false; } $message = nv_change_buffer($message); $message = nv_unhtmlspecialchars($message); $subject = nv_unhtmlspecialchars($subject); $mail->From = $sendmail_from; $mail->FromName = $global_config['site_name']; if (is_array($from)) { $mail->AddReplyTo($from[1], $from[0]); } else { $mail->AddReplyTo($from); } if (empty($to)) { return false; } if (!is_array($to)) { $to = array($to); } foreach ($to as $_to) { $mail->AddAddress($_to); } $mail->Subject = $subject; $mail->WordWrap = 120; $mail->MsgHTML($message); $mail->IsHTML(true); if (!empty($files)) { $files = array_map("trim", explode(",", $files)); foreach ($files as $file) { $mail->AddAttachment($file); } } $send = $mail->Send(); if (!$send) { trigger_error($mail->ErrorInfo, E_USER_WARNING); } return $send; } catch (phpmailerException $e) { trigger_error($e->errorMessage(), E_USER_WARNING); return false; } }
/** * nv_sendmail() * * @param mixed $from * @param mixed $to * @param string $subject * @param string $message * @param string $files * @return */ function nv_sendmail($from, $to, $subject, $message, $files = '', $AddEmbeddedImage = false) { global $global_config, $sys_info; try { $mail = new PHPMailer\PHPMailer\PHPMailer(); $mail->SetLanguage(NV_LANG_INTERFACE); $mail->CharSet = $global_config['site_charset']; $mailer_mode = strtolower($global_config['mailer_mode']); if ($mailer_mode == 'smtp') { $mail->isSMTP(); $mail->SMTPAuth = true; $mail->Port = $global_config['smtp_port']; $mail->Host = $global_config['smtp_host']; $mail->Username = $global_config['smtp_username']; $mail->Password = $global_config['smtp_password']; $SMTPSecure = intval($global_config['smtp_ssl']); switch ($SMTPSecure) { case 1: $mail->SMTPSecure = 'ssl'; break; case 2: $mail->SMTPSecure = 'tls'; break; default: $mail->SMTPSecure = ''; } } elseif ($mailer_mode == 'sendmail') { $mail->IsSendmail(); } elseif (!in_array('mail', $sys_info['disable_functions'])) { $mail->IsMail(); } else { return false; } $message = nv_url_rewrite($message); $message = nv_change_buffer($message); $message = nv_unhtmlspecialchars($message); $mail->From = $global_config['site_email']; $mail->FromName = $global_config['site_name']; if (is_array($from)) { $mail->addReplyTo($from[1], $from[0]); } else { $mail->addReplyTo($from); } if (empty($to)) { return false; } if (!is_array($to)) { $to = array($to); } foreach ($to as $_to) { $mail->addAddress($_to); } $mail->Subject = nv_unhtmlspecialchars($subject); $mail->WordWrap = 120; $mail->Body = $message; $mail->AltBody = strip_tags($message); $mail->IsHTML(true); if ($AddEmbeddedImage) { $mail->AddEmbeddedImage(NV_ROOTDIR . '/' . $global_config['site_logo'], 'sitelogo', basename(NV_ROOTDIR . '/' . $global_config['site_logo'])); } if (!empty($files)) { $files = array_map('trim', explode(',', $files)); foreach ($files as $file) { $mail->addAttachment($file); } } if (!$mail->Send()) { trigger_error($mail->ErrorInfo, E_USER_WARNING); return false; } return true; } catch (phpmailerException $e) { trigger_error($e->errorMessage(), E_USER_WARNING); return false; } }
/** * @param string $message */ public function Content($message) { $this->WordWrap = 120; $this->IsHTML(true); $message = nv_url_rewrite($message); $message = nv_change_buffer($message); $message = nv_unhtmlspecialchars($message); $this->Body = $message; $this->AltBody = strip_tags($message); }