%PDF- %PDF-
Direktori : /proc/thread-self/root/var/www/pn/wp-content/themes/intosai/lib/user_functions/ |
Current File : //proc/thread-self/root/var/www/pn/wp-content/themes/intosai/lib/user_functions/mailer.php |
<?php $site_url = get_home_url(); /************************************* GLOBALS *************************************/ $boundary = uniqid('np'); //BOUNDARY (DON'T TOUCH) $url = get_field('mail_bas_url_till_site', 'epost'); $foretag = get_field('mail_foretagsnamn', 'epost'); $adress = get_field('mail_adress', 'epost'); $cmail = get_field('mail_kontakt_epost', 'epost'); $ctelefon = get_field('mail_kontakt_telefon', 'epost'); $cright = get_field('mail_copyright_text', 'epost'); $color = get_field('mail_huvudfarg', 'epost'); $tlogo = get_field('mail_logotyp_sidhuvud', 'epost'); $blogo = get_field('mail_logotyp_sidfot', 'epost'); $facebook = get_field('mail_facebook_url', 'epost'); $instagram = get_field('mail_instagram_url', 'epost'); $linkedin = get_field('mail_linkedin_url', 'epost'); $twitter = get_field('mail_twitter_url', 'epost'); /************************************* FUNTIONER *************************************/ function captcha(){ global $secret; $verify_url = 'https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST["g-recaptcha-response"].'&remoteip='.$_SERVER['REMOTE_ADDR']; $json = file_get_contents($verify_url); $obj = json_decode($json); if($obj->success){ return true; }else{ return false; } } function smtp_validate($validate,$field_type = null){ if( !empty($validate) && searchStringForSpam($validate) && field_type_validate($validate,$field_type) ){ return true; }else{ return false; } } function searchStringForSpam($validate){ $strings_to_search = array('href=', '[/url'); foreach ($strings_to_search as $needle) { if( stristr($validate, $needle) ){ $spam = true; return false; } } if($spam){ return false; }else{ return true; } } function field_type_validate($validate,$field_type){ if($field_type === 'email'){ if (!filter_var($validate, FILTER_VALIDATE_EMAIL)) { return false; }else{ return true; } }else{ return true; } } function smtp_sub($sub){ $subject = mb_encode_mimeheader(utf8_decode($sub), 'UTF-8', 'B'); return $subject; } function smtp_params($from){ $params = "-f ".$from; return $params; } function smtp_mail($sub,$message,$excerpt,$page_sender,$form_id) { global $url; global $foretag; global $color; global $tlogo; global $blogo; global $cmail; global $ctelefon; global $adress; global $facebook; global $instagram; global $linkedin; global $twitter; if(!empty($facebook)){ $facebook = '<a href="'.$facebook.'" target="_blank" style="display:block;float:left;margin-right:5px;border:1px solid #fff;width:30px;height:30px;text-align:center;color:#fff;text-decoration:none;background:url('.$url.'/mail_social_sprite.png) top 0px left 0px"></a>'; } if(!empty($instagram)){ $instagram = '<a href="'.$facebook.'" target="_blank" style="display:block;float:left;margin-right:5px;border:1px solid #fff;width:30px;height:30px;text-align:center;color:#fff;text-decoration:none;background:url('.$url.'/mail_social_sprite.png) top 0px left -30px;"></a>'; } if(!empty($linkedin)){ $linkedin ='<a href="'.$linkedin.'" target="_blank" style="display:block;float:left;margin-right:5px;border:1px solid #fff;width:30px;height:30px;text-align:center;color:#fff;text-decoration:none;background:url('.$url.'/mail_social_sprite.png) top 0px left -60px;"></a>'; } if(!empty($twitter)){ $twitter ='<a href="'.$twitter.'" target="_blank" style="display:block;float:left;margin-right:5px;border:1px solid #fff;width:30px;height:30px;text-align:center;color:#fff;text-decoration:none;background:url(url('.$url.'/mail_social_sprite.png) top 0px left -90px;"></a>'; } $html_mail .= '<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <!-- utf-8 works for most cases --> <meta name="viewport" content="width=device-width"> <!-- Forcing initial-scale shouldnt be necessary --> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Use the latest (edge) version of IE rendering engine --> <title>'.$sub.'</title> <!-- the <title> tag shows on email notifications on Android 4.4. --> </head> <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#f4f4f4" style="margin:20px 0; padding:0; -webkit-text-size-adjust:none; -ms-text-size-adjust:none;"> <table cellpadding="0" cellspacing="0" border="0" height="100%" width="100%" bgcolor="#f4f4f4" id="bodyTable" style="border-collapse: collapse;table-layout: fixed;margin:0 auto;"><tr><td> <!-- Hidden Preheader Text : BEGIN --> <div style="display:none; visibility:hidden; opacity:0; color:transparent; height:0; width:0;line-height:0; overflow:hidden;mso-hide: all;"> '.$excerpt.' </div> <!-- Hidden Preheader Text : END --> <!-- Outlook and Lotus Notes dont support max-width but are always on desktop, so we can enforce a wide, fixed width view. --> <!-- Beginning of Outlook-specific wrapper : BEGIN --> <!--[if (gte mso 9)|(IE)]> <table width="600" align="center" cellpadding="0" cellspacing="0" border="0"> <tr> <td> <![endif]--> <!-- Beginning of Outlook-specific wrapper : END --> <!-- Email wrapper : BEGIN --> <table border="0" width="100%" cellpadding="0" cellspacing="0" align="center" style="max-width: 600px;margin: auto;" class="email-container"> <tr> <td style="text-align:left;padding:20px 40px;font-family:sans-serif;font-size:16px;line-height:24px;color:#fff;background:'.$color.';"> <img src="'.$tlogo.'" /> </td> </tr> <tr> <td> <table border="0" width="100%" cellpadding="0" cellspacing="0" bgcolor="#ffffff"> <!-- Full Width, Fluid Column : BEGIN --> <tr> <td style="padding: 40px; font-family: sans-serif; font-size: 16px; line-height: 24px; color: #666666;"> '.$message.' </td> </tr> </td> </tr> <!-- Full Width, Fluid Column : END --> </table> </td> </tr> <tr> <td style="text-align:center;padding:20px 40px;font-family:sans-serif;font-size:12px;line-height:18px;color:#fff;background:#222;border-top:4px solid '.$color.';"> <table border="0" width="100%" cellpadding="0" cellspacing="0" style="margin-bottom:20px;"> <tr> <td style="width:50%;padding:0 10px 0 0;text-align:left;vertical-align:top;"> <div style="display:block;width:100%;margin-bottom:15px;"> <img src="'.$blogo.'" style="width:150px;height:auto;" /><br /> </div> '.$facebook.' '.$instagram.' '.$linkedin.' '.$twitter.' </td> <td style="width:50%;padding:0 0 0 10px;text-align:left;color:#fff;"> <strong>'.$foretag.'</strong><br /> '.$adress.'<br /> <a href="mailto:'.$cmail.'" style="display:block;margin-top:5px;color:#ffffff;">'.$cmail.'</a> <a href="tel:'.$ctelefon.'" style="display:block;margin-top:5px;color:#ffffff;">'.$ctelefon.'</a> </td> </tr> </table> </td> </tr> <tr> <td style="text-align:center;padding:10px 0;font-family:sans-serif;font-size:12px;line-height:18px;color:#444;background:transparent;"> '.$cright.' </td> </tr> </table> <!-- Email wrapper : END --> <!-- End of Outlook-specific wrapper : BEGIN --> <!--[if (gte mso 9)|(IE)]> </td> </tr> </table> <![endif]--> <!-- End of Outlook-specific wrapper : END --> </td></tr></table> </body> </html>'; return $html_mail; }