HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers68/resortouddorpduin.nl/wwwroot/app/controllers/c_contact.class.php
<?php
/**
 * c_home.class.php
 * Created by Komma Mediadesign.
 * Author: mike
 * Date: 11/02/14
 */

require_once DOCUMENT_ROOT . 'lib/form/form.class.php';
require_once DOCUMENT_ROOT . 'lib/mail/php_mailer.class.php';

class Contact extends Controller
{
    private $name;

    public function __construct()
    {
        if(LANG_ROOT == "/de/")
        {
            $this->name = 'contact_de';
        }
        else
        {
            $this->name = 'contact';
        }
        parent::__construct();
    }

    /*
     * Index of the home page
     */
    public function index()
    {
        // Title
        $this->View->setData('page_title', SITE_NAME);

        // Generate form
        $Form = new Form($this->name);
        $fields = $Form->generate();
        $this->View->setData('form_fields', $fields);

        // Load template view
        $this->View->render('v_contact');
    }

    public function thanks()
    {
        if( ! isset($_SESSION['contact']['success']))
        {
            if(LANG_ROOT == "/de/")
            {
                Fn::redirect(LANG_ROOT . 'kontakt');
            }
            else
            {
                Fn::redirect(LANG_ROOT . 'contact');
            }
        }

        // Title
        $this->View->setData('page_title', 'Bedankt! | ' . SITE_NAME);

        // Load template view
        $this->View->render('v_thanks');
    }

    public function validate()
    {
        if(isset($_POST['secret_code']) && $_POST['secret_code'] == 'spam_check_komma')
        {
            $Form = new Form($this->name);
            if($Form->validate())
            {
                // Get data for mail
                $data = $_SESSION[$this->name]['data'];

                // Convert message
                //$data['message'] = nl2br($data['message']);

                $from['email'] = COMPANY_EMAIL;
                $from['name'] = COMPANY_NAME;
                $to['email'] = COMPANY_EMAIL;
                $to['name'] = COMPANY_NAME;

                $containsSpamValue = false;

                // Create message for mail
                $msg = '<strong>Aanvraag van STRAND RESORT website</strong><br /><br />';
                if (LANG_ROOT == '/de/'){
                    $msg .= '<strong>DUITSE SITE</strong><br /><br />';
                }
                $msg .= 'Er is een bericht binnen gekomen via het contactformulier op de website:<br /><br />';
                foreach ($data as $prop => $value)
                {
                    if(is_array($value))
                    {
                        $msg .= '<strong>Heeft ons gevonden via:</strong><br>';
                        foreach ($value as $via)
                        {
                            $msg .= $via . ' <br>';
                        }
                        $msg .= '<br>';
                    }
                    else
                    {
                        $msg .= '<strong>' . $prop . '</strong>:<br /> ';

                        if(strpos($value, 'u7636614.ct.sendgrid.net')) $containsSpamValue = true;

                        if($value == '')
                        {
                            $msg .= 'no<br><br>';
                        }
                        else
                        {
                            $msg .= $value . '<br /><br />';
                        }
                    }
                }

                if($containsSpamValue) {
                    Fn::redirect(LANG_ROOT . 'contact');
                }

                if(LANG_ROOT == '/de/')
                {

                    // Message client
                    $clientMsg = '<html>
                                <head>
                                    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
                                    <title>Resort Ouddorp duin</title>
                                    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
                                </head>
                                <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" bgcolor="#F9F9F9">
                                    <table width="100%" cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td valign="top" align="center">

                                                <table align="center" border="0" cellpadding="0" cellspacing="0" width="664">
                                                    <tr>
                                                        <td width="664">';
                    $clientMsg .= '<img src="https://www.resortouddorpduin.nl/public/images/email/header_de.jpg" width="664" height="246" />';
                    $clientMsg .= '</td>
                                                    </tr>
                                                    <tr>
                                                        <td bgcolor="#FFFFFF" width="664">
                                                            &nbsp;
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td bgcolor="#C1A256" width="664" style="color:#505050;font-family:Arial;font-size:14px;line-height:150%;text-align:left;padding: 5px 0 5px 10px;">
                                                            <h3 style="color: #F9E7CD;"><b>Vielen Dank für Ihre Interesse im “Strand Resort Ouddorp Duin”</b></h3>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td bgcolor="#E9DCBD" width="664" style="color:#505050;font-family:Arial;font-size:14px;line-height:150%;text-align:left;padding: 5px 0 5px 20px;">
                                                            <p>';
                    $clientMsg .= '<br>Lieber ' . $data['first_name'] . '  ' . $data['last_name'] . ',';
                    $clientMsg .= '<p>Vielen Dank für das Interesse am "Strand Resort Ouddorp Duin"!</p>
                                    <p>
                                        Die Immobilien im Resort sind jedoch ausverkauft.<br/>
                                        In Kürze erfahren Sie von uns neue Erholungsprojekte und ein neues Wohnangebot im Planungsgebiet \'Ouddorp Duin\'.
                                    </p>

                                    <p>Mit freundlichen Gr&uuml;&szlig;en,</p>
                                    <p>Verkaufsteam Beach Resort Ouddorp Duin</p>';

                    $clientMsg .= '<img src="https://www.resortouddorpduin.nl/public/images/email/logouddorpduin.png" /><br>';
                    $clientMsg .= '<p>Beach Resort Ouddorp Duin Ontwikkeling B.V.<br>
                                                                <a href="https://www.resortouddorpduin.de/">www.resortouddorpduin.de</a><br>
                                                                0031 (0)73 30 300 55</p>
                                                                
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td align="center" width="664"style="font-family:Arial;font-size:12px;color:#707070;">
                                                            <br><a href="https://twitter.com/Ouddorp_Duin">Twitter</a> | <a href="https://www.facebook.com/pages/Strand-Resort-Ouddorp-Duin/1425474207693138">Facebook</a> | <a href="https://plus.google.com/109532910681268273525#109532910681268273525/posts">Google +</a>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td align="center" width="664" style="font-family:Arial;font-size:12px;color:#707070;font-style: italic;">
                                                            <br>Copyright &copy; 2016 Strand Resort Ouddorp Duin, Alle rechten voorbehouden.
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                </body>
                                </html>';
                }
                else
                {
                    // Message client
                    $clientMsg = '<html>
                            <head>
                                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
                                <title>Resort Ouddorp duin</title>
                                <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
                            </head>
							<body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" bgcolor="#F9F9F9">
								<table width="100%" cellpadding="0" cellspacing="0">
									<tr>
										<td valign="top" align="center">

											<table align="center" border="0" cellpadding="0" cellspacing="0" width="664">
												<tr>
													<td width="664">';
                    $clientMsg .= '<img src="https://www.resortouddorpduin.nl/public/images/email/header.jpg" width="664" height="246" />';
                    $clientMsg .= '</td>
												</tr>
												<tr>
													<td bgcolor="#FFFFFF" width="664">
														&nbsp;
													</td>
												</tr>
												<tr>
													<td bgcolor="#C1A256" width="664" style="color:#505050;font-family:Arial;font-size:14px;line-height:150%;text-align:left;padding: 5px 0 5px 10px;">
														<h3 style="color: #F9E7CD;"><b>Strand Resort Ouddorp Duin</b></h3>
													</td>
												</tr>
												<tr>
													<td bgcolor="#E9DCBD" width="664" style="color:#505050;font-family:Arial;font-size:14px;line-height:150%;text-align:left;padding: 5px 0 5px 20px;">
														<p>';
                    $clientMsg .= '<br>Beste ' . $data['first_name'] . '  ' . $data['last_name'] . ',';
                    $clientMsg .= '</p>
												<p>Hartelijk dank voor de getoonde interesse in "Strand Resort Ouddorp Duin"!</p>
												<p>Echter, zijn de woningen op het resort uitverkocht.<br/>
                                                En verneemt u op korte termijn van ons over nieuwe recreatieprojecten en een nieuw aanbod woningen binnen plangebied ‘Ouddorp Duin’.<p>
												<p>Met vriendelijke groet,</p>
												<p>Verkoopteam Strand Resort Ouddorp Duin</p>';
                    $clientMsg .= '<img src="https://www.resortouddorpduin.nl/public/images/email/logouddorpduin.png" /><br>';
                    $clientMsg .= '<p>Strand Resort Ouddorp Duin Ontwikkeling B.V.<br>
                                                            0031 (0)73 30 300 55
															<a href="https://www.resortouddorpduin.nl">www.resortouddorpduin.nl</a>
															</p>
															<p>Utopialaan 49<br>
															5232 CD &rsquo;s-Hertogenbosch<br>
															NEDERLAND</p>
													</td>
												</tr>
												<tr>
													<td align="center" width="664"style="font-family:Arial;font-size:12px;color:#707070;">
														<br>Volg ons op <a href="https://twitter.com/Ouddorp_Duin">Twitter</a> | <a href="https://www.facebook.com/pages/Strand-Resort-Ouddorp-Duin/1425474207693138">Facebook</a> | <a href="https://plus.google.com/109532910681268273525#109532910681268273525/posts">Google +</a>
													</td>
												</tr>
												<tr>
													<td align="center" width="664" style="font-family:Arial;font-size:12px;color:#707070;font-style: italic;">
														<br>Copyright &copy; 2016 Strand Resort Ouddorp Duin, Alle rechten voorbehouden.
													</td>
												</tr>
											</table>
										</td>
									</tr>
								</table>
                            </body>
                            </html>';
                }


                // Send e-mail
                $Mailer = new PHPMailer(true);
                try
                {
                    // Mail
                    $Mailer->AddAddress($to['email'], $to['name']);
                    $Mailer->SetFrom($from['email'], $from['name']);

//                    if(LANG_ROOT == '/de/')
//                    {
//                        $Mailer->Subject = 'Broschüre Anfrage - STRAND RESORT';
//                    }
//                    else
//                    {
//                        $Mailer->Subject = 'Brochure Aanvraag - STRAND RESORT';
//                    }
                    $Mailer->Subject = 'Brochure Aanvraag - STRAND RESORT';

                    $Mailer->MsgHTML($msg);
                    $Mailer->Send();

                    // Mail Client
                    $ClientMailer = new PHPMailer(true);
                    $ClientMailer->AddAddress($data['email'], $data['contact_name']);
                    $ClientMailer->SetFrom(COMPANY_EMAIL, COMPANY_NAME);
                    if(LANG_ROOT == '/de/')
                    {
                        $ClientMailer->Subject = 'Vielen Dank vor Ihre Anfrage';
                    }
                    else
                    {
                        $ClientMailer->Subject = 'Bedankt voor uw aanvraag';
                    }


                    $ClientMailer->MsgHTML($clientMsg);
                    $ClientMailer->Send();

                    if(LANG_ROOT == '/de/')
                    {
                        $_SESSION['contact']['success'] = 'Sehr geehrte(r) Herr/Frau,<br /><br />
                                                        Vielen Dank f&uuml;r Ihne eingabe, Sie bekommen ein Best&auml;tigungsmail.<br /><br />
                                                        Freundliche gr&uuml;&szlig;e<br />
                                                        Strand Resort Ouddorp Duin';
                    }
                    else
                    {
                        $_SESSION['contact']['success'] = 'Geachte heer / mevrouw,<br /><br />
                                                        Bedankt voor uw aanvraag. U ontvangt de informatie spoedig per mail.<br /><br />
                                                        Met vriendelijke groet,<br />
                                                        Strand Resort Ouddorp Duin';
                    }

                    // Redirect to thank-you page
                    if(LANG_ROOT == '/de/')
                    {
                        Fn::redirect(LANG_ROOT . 'kontakt/danke');
                    }
                    else
                    {
                        Fn::redirect(LANG_ROOT . 'contact/bedankt');
                    }

                }
                catch (phpmailerException $e)
                {
                    // Catch mail problem?
                    $_SESSION[$this->name]['main_error'] = 'Er is iets fout gegaan bij verzenden. <br />Neem contact op met <a href="mailto:info@resortouddorpduin.nl">info@resortouddorpduin.nl</a>';
                }
                unset($_SESSION[$this->name]['data']);
                Fn::redirect(LANG_ROOT . 'contact');
            }
        }
        Fn::redirect(LANG_ROOT . 'contact');
    }
}