public static function merge($templates, $separator = '\\n') { $output = ''; foreach ($templates as $template) { $content = get_class($template) !== 'Template' ? sc_i18n($this->thisfile_sc, $this->sc_language, 'SC_TEMPLATE_INCORRECT_TYPE') : $template->output(); $output .= $content . $separator; } return $output; }
function sc_log_attempts($type, $param1 = null, $param2 = null) { global $thisfile_sc, $SITEURL, $sc_language; require_once GSPLUGINPATH . 'getsimple_contact/inc/class.phpmailer.php'; require_once GSPLUGINPATH . 'getsimple_contact/inc/class.html2text.php'; $settings = sc_get_settings(); $ip = $_SERVER['REMOTE_ADDR']; $host = gethostbyaddr($ip); $date = date('Y. m. d. H:i'); if ($type == 'invalid_form_data') { $enabled = ''; $posted = ''; foreach ($param1 as $key => $value) { $enabled .= $value . ', '; } foreach ($param2 as $key => $value) { $posted .= $key . ', '; } } else { $enabled = ''; $posted = ''; } $enabled = substr($enabled, 0, -2); $posted = substr($posted, 0, -2); $subject = sc_i18n($thisfile_sc, $sc_language, 'SC_FE_LOG_SUBJECT_START') . get_site_name(false) . sc_i18n($thisfile_sc, $sc_language, 'SC_FE_LOG_SUBJECT_END'); $log = sc_i18n($thisfile_sc, $sc_language, 'SC_FE_LOG_MESSAGE_START') . get_site_name(false) . ' - ' . get_page_clean_title(false) . sc_i18n($thisfile_sc, $sc_language, 'SC_FE_LOG_MESSAGE_END') . '<br/><br/>'; $log .= sc_i18n($thisfile_sc, $sc_language, 'SC_FE_LOG_MESSAGE_DETAILS') . '<br/>'; $log .= sc_i18n($thisfile_sc, $sc_language, 'SC_FE_LOG_MESSAGE_DATE') . $date . '<br/>'; $log .= sc_i18n($thisfile_sc, $sc_language, 'SC_FE_LOG_MESSAGE_SITE') . $SITEURL . '<br/>'; $log .= sc_i18n($thisfile_sc, $sc_language, 'SC_FE_LOG_MESSAGE_IP') . $ip . '<br/>'; $log .= sc_i18n($thisfile_sc, $sc_language, 'SC_FE_LOG_MESSAGE_HOST') . $host . '<br/>'; $log .= sc_i18n($thisfile_sc, $sc_language, 'SC_FE_LOG_MESSAGE_TYPE') . $type . '<br/>'; if ($type == 'invalid_form_data') { $log .= sc_i18n($thisfile_sc, $sc_language, 'SC_FE_LOG_MESSAGE_WHITELIST') . $enabled . '<br/>'; $log .= sc_i18n($thisfile_sc, $sc_language, 'SC_FE_LOG_MESSAGE_POSTED') . $posted . '<br/>'; } else { if ($type == 'invalid_token') { $log .= sc_i18n($thisfile_sc, $sc_language, 'SC_FE_LOG_MESSAGE_CORRECT_TOKEN') . $param1 . '<br/>'; $log .= sc_i18n($thisfile_sc, $sc_language, 'SC_FE_LOG_MESSAGE_FALSE_TOKEN') . $param2 . '<br/>'; } } $nonHTML = new html2text($log); $mail = new PHPMailer(); if ($settings['smtp_status'] == 1) { $mail->IsSMTP(); $mail->SMTPDebug = 0; $mail->Host = $settings['smtp_host']; $mail->Port = $settings['smtp_port']; if ($settings['smtp_auth'] == 1) { $mail->SMTPAuth = true; $mail->Username = $settings['smtp_username']; $mail->Password = sc_decrypt_smtp_password($settings['smtp_password']); if ($settings['smtp_host'] == 'smtp.gmail.com' && $settings['smtp_port'] == 465) { $mail->SMTPSecure = 'ssl'; } else { if ($settings['smtp_host'] == 'smtp.gmail.com' && $settings['smtp_port'] == 587) { $mail->SMTPSecure = 'tls'; } } } } else { $mail->setLanguage('en_US', GSPLUGINPATH . 'getsimple_contact/lang/'); } $mail->CharSet = 'UTF-8'; $mail->From = $settings['superadmin_email']; $mail->FromName = $settings['superadmin_name']; $mail->addAddress($settings['superadmin_email'], $settings['superadmin_name']); $mail->WordWrap = 50; $mail->isHTML(true); $mail->Subject = $subject; $mail->Body = $log; $mail->AltBody = $nonHTML->get_text(); $mail->send(); }